slarray
in package
Class slarray
Tags
Table of Contents
Methods
- articlesarray() : array<string|int, mixed>
- Converts an object representing an article into an associative array.
- customerarray() : array<string|int, mixed>
- Converts a customer object into an array, containing formatted address information and custom field values.
- addressarray() : array<string|int, mixed>
- Converts an object representing an address to an associative array.
- formatphone() : string
- Formats a phone number by removing spaces, dashes, and slashes.
Methods
articlesarray()
Converts an object representing an article into an associative array.
public
articlesarray(object $r) : array<string|int, mixed>
The array includes the article's number, name, description, unit of quantity, warehouse status, stock quantity, inactive status, and price.
Parameters
- $r : object
-
The object representing the article
Return values
array<string|int, mixed> —The associative array containing the article information
customerarray()
Converts a customer object into an array, containing formatted address information and custom field values.
public
customerarray(object $r) : array<string|int, mixed>
Parameters
- $r : object
-
The customer object to convert
Return values
array<string|int, mixed> —The converted customer data as an array
addressarray()
Converts an object representing an address to an associative array.
private
addressarray(object $r) : array<string|int, mixed>
The returned array contains the following keys:
- number: The address number.
- first: The first name of the contact person.
- last: The last name of the contact person.
- company: The company name.
- name: The name of the contact person. If the company name is available, it is used. Otherwise, if the first name is available, it is concatenated with the last name. Otherwise, the last name is used.
- street: The street name.
- zip: The zip code.
- city: The city name.
- phone: The formatted phone number, obtained by calling the formatphone() method with the first telephone number from the contact object.
- mobile: The formatted phone number, obtained by calling the formatphone() method with the second telephone number from the contact object.
- mail: The email address from the contact object.
Parameters
- $r : object
-
The object representing the address
Return values
array<string|int, mixed> —The converted address as an associative array
formatphone()
Formats a phone number by removing spaces, dashes, and slashes.
private
formatphone(string $tel) : string
If the phone number starts with '0', it will be replaced with '+49'.
Parameters
- $tel : string
-
The phone number to format
Return values
string —The formatted phone number