Refactor customer number handling for clarity.
Reassign the customer number to a variable before reuse, improving code readability and reducing redundant calls to the value method. This change streamlines object property creation and simplifies maintainability.
This commit is contained in:
@@ -295,11 +295,12 @@ class users_o extends db
|
||||
$phone = $this->phone->value();
|
||||
$phone = $phone === null ? null : (int)$phone;
|
||||
$display_name = $this->display_name->value();
|
||||
$customer_name = $this->getCustomerName($this->customer_number->value());
|
||||
$customer_number = (int)$this->customer_number->value();
|
||||
$customer_name = $this->getCustomerName($customer_number);
|
||||
// Create the array with the object properties
|
||||
$array = [
|
||||
'id' => (int)$this->id,
|
||||
'customer_number' => (int)$this->customer_number->value(),
|
||||
'customer_number' => $customer_number,
|
||||
'customer_name' => $customer_name,
|
||||
'display_name' => $display_name === 'Unnamed' ? $customer_name : $display_name,
|
||||
'group_id' => (int)$this->group_id->value(),
|
||||
|
||||
Reference in New Issue
Block a user