Refactored \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent and added
- \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setPhoneNumber - \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setFirstName - \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setLastName - \TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent::setVcard https://git.n64.cc/nosial/libs/tgbot/-/issues/3
This commit is contained in:
parent
e463b81948
commit
581fa42715
1 changed files with 79 additions and 0 deletions
|
@ -1,9 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/** @noinspection PhpUnused */
|
||||||
/** @noinspection PhpMissingFieldTypeInspection */
|
/** @noinspection PhpMissingFieldTypeInspection */
|
||||||
|
|
||||||
namespace TgBotLib\Objects\Telegram\InputMessageContent;
|
namespace TgBotLib\Objects\Telegram\InputMessageContent;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
|
use TgBotLib\Classes\Validate;
|
||||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||||
|
|
||||||
class InputContactMessageContent implements ObjectTypeInterface
|
class InputContactMessageContent implements ObjectTypeInterface
|
||||||
|
@ -38,6 +41,22 @@
|
||||||
return $this->phone_number;
|
return $this->phone_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of 'phone_number' property
|
||||||
|
* Contact's phone number
|
||||||
|
*
|
||||||
|
* @param string $phone_number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setPhoneNumber(string $phone_number): self
|
||||||
|
{
|
||||||
|
if(!Validate::length($phone_number, 1, 255))
|
||||||
|
throw new InvalidArgumentException('phone_number should be between 1-255 characters');
|
||||||
|
|
||||||
|
$this->phone_number = $phone_number;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contact's first name
|
* Contact's first name
|
||||||
*
|
*
|
||||||
|
@ -48,6 +67,22 @@
|
||||||
return $this->first_name;
|
return $this->first_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of 'first_name' property
|
||||||
|
* Contact's first name
|
||||||
|
*
|
||||||
|
* @param string $first_name
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setFirstName(string $first_name): self
|
||||||
|
{
|
||||||
|
if(!Validate::length($first_name, 1, 255))
|
||||||
|
throw new InvalidArgumentException('first_name should be between 1-255 characters');
|
||||||
|
|
||||||
|
$this->first_name = $first_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional. Contact's last name
|
* Optional. Contact's last name
|
||||||
*
|
*
|
||||||
|
@ -58,6 +93,28 @@
|
||||||
return $this->last_name;
|
return $this->last_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of 'last_name' property
|
||||||
|
* Optional. Contact's last name
|
||||||
|
*
|
||||||
|
* @param string|null $last_name
|
||||||
|
* @return InputContactMessageContent
|
||||||
|
*/
|
||||||
|
public function setLastName(?string $last_name): self
|
||||||
|
{
|
||||||
|
if($last_name == null)
|
||||||
|
{
|
||||||
|
$this->last_name = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Validate::length($last_name, 1, 255))
|
||||||
|
throw new InvalidArgumentException('last_name should be between 1-255 characters (or null)');
|
||||||
|
|
||||||
|
$this->last_name = $last_name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
|
* Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
|
||||||
*
|
*
|
||||||
|
@ -69,6 +126,28 @@
|
||||||
return $this->vcard;
|
return $this->vcard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of 'vcard' property
|
||||||
|
* Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
|
||||||
|
*
|
||||||
|
* @param string|null $vcard
|
||||||
|
* @return InputContactMessageContent
|
||||||
|
*/
|
||||||
|
public function setVcard(?string $vcard): self
|
||||||
|
{
|
||||||
|
if($vcard == null)
|
||||||
|
{
|
||||||
|
$this->vcard = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Validate::length($vcard, 1, 2048))
|
||||||
|
throw new InvalidArgumentException('vcard should be between 1-2048 characters (or null)');
|
||||||
|
|
||||||
|
$this->vcard = $vcard;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array representation of the object
|
* Returns an array representation of the object
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue