Updated Contact
This commit is contained in:
parent
746201b395
commit
1aec926fd6
1 changed files with 13 additions and 33 deletions
|
@ -7,30 +7,11 @@
|
||||||
|
|
||||||
class Contact implements ObjectTypeInterface
|
class Contact implements ObjectTypeInterface
|
||||||
{
|
{
|
||||||
/**
|
private string $phone_number;
|
||||||
* @var string
|
private string $first_name;
|
||||||
*/
|
private ?string $last_name;
|
||||||
private $phone_number;
|
private ?int $user_id;
|
||||||
|
private ?string $vcard;
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $first_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
private $last_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int|null
|
|
||||||
*/
|
|
||||||
private $user_id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
private $vcard;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contact's phone number
|
* Contact's phone number
|
||||||
|
@ -85,9 +66,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array representation of the object
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
|
@ -101,15 +80,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs object from an array representation
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return Contact
|
|
||||||
*/
|
*/
|
||||||
public static function fromArray(array $data): self
|
public static function fromArray(?array $data): ?Contact
|
||||||
{
|
{
|
||||||
$object = new self();
|
if($data === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new self();
|
||||||
$object->phone_number = $data['phone_number'] ?? null;
|
$object->phone_number = $data['phone_number'] ?? null;
|
||||||
$object->first_name = $data['first_name'] ?? null;
|
$object->first_name = $data['first_name'] ?? null;
|
||||||
$object->last_name = $data['last_name'] ?? null;
|
$object->last_name = $data['last_name'] ?? null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue