Moved InputMessageContent objects
This commit is contained in:
parent
fb2a06024d
commit
4c0ad925d7
11 changed files with 14 additions and 14 deletions
|
@ -0,0 +1,174 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Enums\Types\InputMessageContentType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
class InputContactMessageContent extends InputMessageContent implements ObjectTypeInterface
|
||||
{
|
||||
private string $phone_number;
|
||||
private string $first_name;
|
||||
private ?string $last_name;
|
||||
private ?string $vcard;
|
||||
|
||||
/**
|
||||
* Contact's phone number
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPhoneNumber(): string
|
||||
{
|
||||
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
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstName(): string
|
||||
{
|
||||
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
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLastName(): ?string
|
||||
{
|
||||
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
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/VCard
|
||||
* @return string|null
|
||||
*/
|
||||
public function getVcard(): ?string
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'phone_number' => $this->phone_number,
|
||||
'first_name' => $this->first_name,
|
||||
'last_name' => $this->last_name,
|
||||
'vcard' => $this->vcard,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): InputContactMessageContent
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = InputMessageContentType::CONTACT;
|
||||
$object->phone_number = $data['phone_number'] ?? null;
|
||||
$object->first_name = $data['first_name'] ?? null;
|
||||
$object->last_name = $data['last_name'] ?? null;
|
||||
$object->vcard = $data['vcard'] ?? null;
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,640 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
/** @noinspection PhpUnused */
|
||||
|
||||
namespace TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Enums\Types\InputMessageContentType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Inline\InputMessageContent;
|
||||
use TgBotLib\Objects\LabeledPrice;
|
||||
|
||||
class InputInvoiceMessageContent extends InputMessageContent implements ObjectTypeInterface
|
||||
{
|
||||
private string $title;
|
||||
private string $description;
|
||||
private string $payload;
|
||||
private string $provider_token;
|
||||
private string $currency;
|
||||
/**
|
||||
* @var LabeledPrice[]
|
||||
*/
|
||||
private array $prices;
|
||||
private ?int $max_tip_amount;
|
||||
/**
|
||||
* @var int[]|null
|
||||
*/
|
||||
private ?array $suggested_tip_amounts;
|
||||
private ?string $provider_data;
|
||||
private ?string $photo_url;
|
||||
private ?int $photo_size;
|
||||
private ?int $photo_width;
|
||||
private ?int $photo_height;
|
||||
private bool $need_name;
|
||||
private bool $need_phone_number;
|
||||
private bool $need_email;
|
||||
private bool $need_shipping_address;
|
||||
private bool $send_phone_number_to_provider;
|
||||
private bool $send_email_to_provider;
|
||||
private bool $is_flexible;
|
||||
|
||||
/**
|
||||
* Product name, 1-32 characters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'title' property
|
||||
* Product name, 1-32 characters
|
||||
*
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(string $title): self
|
||||
{
|
||||
if(!Validate::length($title, 1, 32))
|
||||
{
|
||||
throw new InvalidArgumentException('title should be between 1-32 characters');
|
||||
}
|
||||
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Product description, 1-255 characters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'description' property
|
||||
* Product description, 1-255 characters
|
||||
*
|
||||
* @param string $description
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription(string $description): self
|
||||
{
|
||||
if(!Validate::length($description, 1, 255))
|
||||
{
|
||||
throw new InvalidArgumentException('description should be between 1-255 characters');
|
||||
}
|
||||
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bot-defined invoice payload, 1-128 bytes.
|
||||
* This will not be displayed to the user, use for your internal processes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPayload(): string
|
||||
{
|
||||
return $this->payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set's the value of 'payload' property
|
||||
* Bot-defined invoice payload, 1-128 bytes.
|
||||
*
|
||||
* @param string $payload
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayload(string $payload): self
|
||||
{
|
||||
if(!Validate::length($payload, 1, 128))
|
||||
{
|
||||
throw new InvalidArgumentException('payload should be between 1-128 characters');
|
||||
}
|
||||
|
||||
$this->payload = $payload;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment provider token, obtained via @BotFather
|
||||
*
|
||||
* @see https://t.me/botfather
|
||||
* @return string
|
||||
*/
|
||||
public function getProviderToken(): string
|
||||
{
|
||||
return $this->provider_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'provider_token' property
|
||||
* Payment provider token, obtained via @BotFather
|
||||
*
|
||||
* @param string $provider_token
|
||||
* @return $this
|
||||
*/
|
||||
public function setProviderToken(string $provider_token): self
|
||||
{
|
||||
$this->provider_token = $provider_token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Three-letter ISO 4217 currency code
|
||||
*
|
||||
* @return string
|
||||
* @link https://core.telegram.org/bots/payments#supported-currencies
|
||||
*/
|
||||
public function getCurrency(): string
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'currency' property
|
||||
* Three-letter ISO 4217 currency code, see more on currencies
|
||||
*
|
||||
* @param string $currency
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurrency(string $currency): self
|
||||
{
|
||||
if(!Validate::length($currency, 3, 3))
|
||||
{
|
||||
throw new InvalidArgumentException('currency should be 3 characters');
|
||||
}
|
||||
|
||||
$this->currency = $currency;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Price breakdown, a JSON-serialized list of components
|
||||
* (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
|
||||
*
|
||||
* @return LabeledPrice[]
|
||||
*/
|
||||
public function getPrices(): array
|
||||
{
|
||||
return $this->prices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a price to the list of prices
|
||||
*
|
||||
* @param LabeledPrice $price
|
||||
* @return $this
|
||||
*/
|
||||
public function addPrice(LabeledPrice $price): self
|
||||
{
|
||||
$this->prices[] = $price;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current list of prices
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function clearPrices(): self
|
||||
{
|
||||
$this->prices = [];
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. The maximum accepted amount for tips in the smallest units of the currency
|
||||
* (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the
|
||||
* exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency
|
||||
* (2 for the majority of currencies). Defaults to 0
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getMaxTipAmount(): ?int
|
||||
{
|
||||
return $this->max_tip_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'max_tip_amount' property
|
||||
* Optional. The maximum accepted amount for tips in the smallest units of the currency
|
||||
* (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the
|
||||
* exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency
|
||||
* (2 for the majority of currencies). Defaults to 0
|
||||
*
|
||||
* @param int $max_tip_amount
|
||||
* @return $this
|
||||
*/
|
||||
public function setMaxTipAmount(int $max_tip_amount): self
|
||||
{
|
||||
$this->max_tip_amount = $max_tip_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency
|
||||
* (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts
|
||||
* must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
|
||||
*
|
||||
* @return int[]|null
|
||||
*/
|
||||
public function getSuggestedTipAmounts(): ?array
|
||||
{
|
||||
return $this->suggested_tip_amounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'suggested_tip_amounts' property
|
||||
* Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency
|
||||
* (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts
|
||||
* must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
|
||||
*
|
||||
* @param array $suggested_tip_amounts
|
||||
* @return $this
|
||||
*/
|
||||
public function setSuggestionsTipAmounts(array $suggested_tip_amounts): self
|
||||
{
|
||||
$this->suggested_tip_amounts = $suggested_tip_amounts;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider.
|
||||
* A detailed description of the required fields should be provided by the payment provider.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getProviderData(): ?string
|
||||
{
|
||||
return $this->provider_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'provider_data' property
|
||||
* Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider.
|
||||
* A detailed description of the required fields should be provided by the payment provider.
|
||||
*
|
||||
* @param string|null $provider_data
|
||||
* @return $this
|
||||
*/
|
||||
public function setProviderData(?string $provider_data): self
|
||||
{
|
||||
if($provider_data === null)
|
||||
{
|
||||
$this->provider_data = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->provider_data = $provider_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPhotoUrl(): ?string
|
||||
{
|
||||
return $this->photo_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'photo_url' property
|
||||
* Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
|
||||
*
|
||||
* @param string|null $photo_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhotoUrl(?string $photo_url): self
|
||||
{
|
||||
if($photo_url === null)
|
||||
{
|
||||
$this->photo_url = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->photo_url = $photo_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Photo size in bytes
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getPhotoSize(): ?int
|
||||
{
|
||||
return $this->photo_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'photo_size' property
|
||||
* Optional. Photo size in bytes
|
||||
*
|
||||
* @param int|null $photo_size
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhotoSize(?int $photo_size): self
|
||||
{
|
||||
if($photo_size === null)
|
||||
{
|
||||
$this->photo_size = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->photo_size = $photo_size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Photo width
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getPhotoWidth(): ?int
|
||||
{
|
||||
return $this->photo_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'photo_width' property
|
||||
* Optional. Photo width
|
||||
*
|
||||
* @param int|null $photo_width
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhotoWidth(?int $photo_width): self
|
||||
{
|
||||
if($photo_width === null)
|
||||
{
|
||||
$this->photo_width = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->photo_width = $photo_width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Photo height
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getPhotoHeight(): ?int
|
||||
{
|
||||
return $this->photo_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'photo_height' property
|
||||
* Optional. Photo height
|
||||
*
|
||||
* @param int|null $photo_height
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhotoHeight(?int $photo_height): self
|
||||
{
|
||||
if($photo_height === null)
|
||||
{
|
||||
$this->photo_height = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->photo_height = $photo_height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if you require the user's full name to complete the order
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function needName(): bool
|
||||
{
|
||||
return $this->need_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'need_name' property
|
||||
* Optional. Pass True if you require the user's full name to complete the order
|
||||
*
|
||||
* @param bool $need_name
|
||||
* @return $this
|
||||
*/
|
||||
public function setNeedName(bool $need_name): self
|
||||
{
|
||||
$this->need_name = $need_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if you require the user's phone number to complete the order
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function needPhoneNumber(): bool
|
||||
{
|
||||
return $this->need_phone_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'need_phone_number' property
|
||||
* Optional. Pass True if you require the user's phone number to complete the order
|
||||
*
|
||||
* @param bool $need_phone_number
|
||||
* @return $this
|
||||
*/
|
||||
public function setNeedPhoneNumber(bool $need_phone_number): self
|
||||
{
|
||||
$this->need_phone_number = $need_phone_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if you require the user's email address to complete the order
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function needEmail(): bool
|
||||
{
|
||||
return $this->need_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'need_email' property
|
||||
* Optional. Pass True if you require the user's email address to complete the order
|
||||
*
|
||||
* @param bool $need_email
|
||||
* @return $this
|
||||
*/
|
||||
public function setNeedEmail(bool $need_email): self
|
||||
{
|
||||
$this->need_email = $need_email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if you require the user's shipping address to complete the order
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function needShippingAddress(): bool
|
||||
{
|
||||
return $this->need_shipping_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'need_shipping_address' property
|
||||
* Optional. Pass True if you require the user's shipping address to complete the order
|
||||
*
|
||||
* @param bool $need_shipping_address
|
||||
* @return $this
|
||||
*/
|
||||
public function setNeedShippingAddress(bool $need_shipping_address): self
|
||||
{
|
||||
$this->need_shipping_address = $need_shipping_address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if the user's phone number should be sent to provider
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSendPhoneNumberToProvider(): bool
|
||||
{
|
||||
return $this->send_phone_number_to_provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'send_phone_number_to_provider' property
|
||||
* Optional. Pass True if the user's phone number should be sent to provider
|
||||
*
|
||||
* @param bool $send_phone_number_to_provider
|
||||
* @return $this
|
||||
*/
|
||||
public function setSendPhoneNumberToProvider(bool $send_phone_number_to_provider): self
|
||||
{
|
||||
$this->send_phone_number_to_provider = $send_phone_number_to_provider;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if the user's email address should be sent to provider
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSendEmailToProvider(): bool
|
||||
{
|
||||
return $this->send_email_to_provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'send_email_to_provider' property
|
||||
* Optional. Pass True if the user's email address should be sent to provider
|
||||
*
|
||||
* @param bool $send_email_to_provider
|
||||
* @return $this
|
||||
*/
|
||||
public function setSendEmailToProvider(bool $send_email_to_provider): self
|
||||
{
|
||||
$this->send_email_to_provider = $send_email_to_provider;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if the final price depends on the shipping method
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFlexible(): bool
|
||||
{
|
||||
return $this->is_flexible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'is_flexible' property
|
||||
* Optional. Pass True if the final price depends on the shipping method
|
||||
*
|
||||
* @param bool $is_flexible
|
||||
* @return $this
|
||||
*/
|
||||
public function setIsFlexible(bool $is_flexible): self
|
||||
{
|
||||
$this->is_flexible = $is_flexible;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'payload' => $this->payload,
|
||||
'provider_token' => $this->provider_token,
|
||||
'currency' => $this->currency,
|
||||
'prices' => array_map(fn(LabeledPrice $labeled_price) => $labeled_price->toArray(), $this->prices),
|
||||
'max_tip_amount' => $this->max_tip_amount,
|
||||
'suggested_tip_amounts' => $this->suggested_tip_amounts,
|
||||
'provider_data' => $this->provider_data,
|
||||
'photo_url' => $this->photo_url,
|
||||
'photo_size' => $this->photo_size,
|
||||
'photo_width' => $this->photo_width,
|
||||
'photo_height' => $this->photo_height,
|
||||
'need_name' => $this->need_name,
|
||||
'need_phone_number' => $this->need_phone_number,
|
||||
'need_email' => $this->need_email,
|
||||
'need_shipping_address' => $this->need_shipping_address,
|
||||
'send_phone_number_to_provider' => $this->send_phone_number_to_provider,
|
||||
'send_email_to_provider' => $this->send_email_to_provider,
|
||||
'is_flexible' => $this->is_flexible,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): InputInvoiceMessageContent
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = InputMessageContentType::INVOICE;
|
||||
$object->title = $data['title'] ?? null;
|
||||
$object->description = $data['description'] ?? null;
|
||||
$object->payload = $data['payload'] ?? null;
|
||||
$object->provider_token = $data['provider_token'] ?? null;
|
||||
$object->currency = $data['currency'] ?? null;
|
||||
$object->prices = array_map(fn(array $prices) => LabeledPrice::fromArray($prices), $data['prices']);
|
||||
$object->max_tip_amount = $data['max_tip_amount'] ?? null;
|
||||
$object->suggested_tip_amounts = $data['suggested_tip_amounts'] ?? null;
|
||||
$object->provider_data = $data['provider_data'] ?? null;
|
||||
$object->photo_url = $data['photo_url'] ?? null;
|
||||
$object->photo_size = $data['photo_size'] ?? null;
|
||||
$object->photo_width = $data['photo_width'] ?? null;
|
||||
$object->photo_height = $data['photo_height'] ?? null;
|
||||
$object->need_name = $data['need_name'] ?? false;
|
||||
$object->need_phone_number = $data['need_phone_number'] ?? false;
|
||||
$object->need_email = $data['need_email'] ?? false;
|
||||
$object->need_shipping_address = $data['need_shipping_address'] ?? false;
|
||||
$object->send_phone_number_to_provider = $data['send_phone_number_to_provider'] ?? false;
|
||||
$object->send_email_to_provider = $data['send_email_to_provider'] ?? false;
|
||||
$object->is_flexible = $data['is_flexible'] ?? false;
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,234 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Enums\Types\InputMessageContentType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
class InputLocationMessageContent extends InputMessageContent implements ObjectTypeInterface
|
||||
{
|
||||
private float $latitude;
|
||||
private float $longitude;
|
||||
private ?float $horizontal_accuracy;
|
||||
private ?int $live_period;
|
||||
private ?int $heading;
|
||||
private ?int $proximity_alert_radius;
|
||||
|
||||
/**
|
||||
* Latitude of the location in degrees
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getLatitude(): float
|
||||
{
|
||||
return $this->latitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'latitude' property
|
||||
* Latitude of the location in degrees
|
||||
*
|
||||
* @param float $latitude
|
||||
* @return $this
|
||||
*/
|
||||
public function setLatitude(float $latitude): self
|
||||
{
|
||||
$this->latitude = $latitude;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Longitude of the location in degrees
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getLongitude(): float
|
||||
{
|
||||
return $this->longitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'longitude' property
|
||||
* Longitude of the location in degrees
|
||||
*
|
||||
* @param float $longitude
|
||||
* @return $this
|
||||
*/
|
||||
public function setLongitude(float $longitude): self
|
||||
{
|
||||
$this->longitude = $longitude;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. The radius of uncertainty for the location, measured in meters; 0-1500
|
||||
*
|
||||
* @return float|null
|
||||
*/
|
||||
public function getHorizontalAccuracy(): ?float
|
||||
{
|
||||
return $this->horizontal_accuracy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'horizontal_accuracy' property
|
||||
*
|
||||
* @param float|null $horizontal_accuracy
|
||||
* @return $this
|
||||
*/
|
||||
public function setHorizontalAccuracy(?float $horizontal_accuracy): self
|
||||
{
|
||||
if($horizontal_accuracy == null)
|
||||
{
|
||||
$this->horizontal_accuracy = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->horizontal_accuracy = $horizontal_accuracy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getLivePeriod(): ?int
|
||||
{
|
||||
return $this->live_period;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'live_period' property
|
||||
* Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
|
||||
*
|
||||
* @param int|null $live_period
|
||||
* @return $this
|
||||
*/
|
||||
public function setLivePeriod(?int $live_period): self
|
||||
{
|
||||
if($live_period)
|
||||
{
|
||||
$this->live_period = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if($live_period < 60 || $live_period > 86400)
|
||||
{
|
||||
throw new InvalidArgumentException('live_period should be a value between 60-86400');
|
||||
}
|
||||
|
||||
$this->live_period = $live_period;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. For live locations, a direction in which the user is moving, in degrees.
|
||||
* Must be between 1 and 360 if specified.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getHeading(): ?int
|
||||
{
|
||||
return $this->heading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'heading' property
|
||||
* Optional. For live locations, a direction in which the user is moving, in degrees.
|
||||
* Must be between 1 and 360 if specified.
|
||||
*
|
||||
* @param int|null $heading
|
||||
* @return $this
|
||||
*/
|
||||
public function setHeading(?int $heading): self
|
||||
{
|
||||
if($heading == null)
|
||||
{
|
||||
$this->heading = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if($heading < 1 || $heading > 360)
|
||||
{
|
||||
throw new InvalidArgumentException('heading should be a value between 1-360');
|
||||
}
|
||||
|
||||
$this->heading = $heading;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member,
|
||||
* in meters. Must be between 1 and 100000 if specified.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getProximityAlertRadius(): ?int
|
||||
{
|
||||
return $this->proximity_alert_radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'proximity_alert_radius' property
|
||||
* Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member,
|
||||
*
|
||||
* @param int|null $proximity_alert_radius
|
||||
* @return $this
|
||||
*/
|
||||
public function setProximityAlertRadius(?int $proximity_alert_radius): self
|
||||
{
|
||||
if($proximity_alert_radius == null)
|
||||
{
|
||||
$this->proximity_alert_radius = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if(!Validate::length($proximity_alert_radius, 1, 100000))
|
||||
{
|
||||
throw new InvalidArgumentException('proximity_alert_radius should be between 1-100000 characters');
|
||||
}
|
||||
|
||||
$this->proximity_alert_radius = $proximity_alert_radius;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'latitude' => $this->latitude,
|
||||
'longitude' => $this->longitude,
|
||||
'horizontal_accuracy' => $this->horizontal_accuracy,
|
||||
'live_period' => $this->live_period,
|
||||
'heading' => $this->heading,
|
||||
'proximity_alert_radius' => $this->proximity_alert_radius,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): InputLocationMessageContent
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = InputMessageContentType::LOCATION;
|
||||
$object->latitude = (float)$data['latitude'] ?? null;
|
||||
$object->longitude = (float)$data['longitude'] ?? null;
|
||||
$object->horizontal_accuracy = (float)$data['horizontal_accuracy'] ?? null;
|
||||
$object->live_period = (int)$data['live_period'] ?? null;
|
||||
$object->heading = (int)$data['heading'] ?? null;
|
||||
$object->proximity_alert_radius = (int)$data['proximity_alert_radius'] ?? null;
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,201 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Enums\Types\InputMessageContentType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Inline\InputMessageContent;
|
||||
use TgBotLib\Objects\MessageEntity;
|
||||
|
||||
class InputTextMessageContent extends InputMessageContent implements ObjectTypeInterface
|
||||
{
|
||||
private string $message_text;
|
||||
private ?string $parse_mode;
|
||||
/**
|
||||
* @var MessageEntity[]|null
|
||||
*/
|
||||
private ?array $entities;
|
||||
private bool $disable_web_page_preview;
|
||||
|
||||
/**
|
||||
* Text of the message to be sent, 1-4096 characters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMessageText(): string
|
||||
{
|
||||
return $this->message_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'message_text' property
|
||||
* Text of the message to be sent, 1-4096 characters
|
||||
*
|
||||
* @param string $message_text
|
||||
* @return $this
|
||||
*/
|
||||
public function setMessageText(string $message_text): self
|
||||
{
|
||||
if(!Validate::length($message_text, 1, 4096))
|
||||
{
|
||||
throw new InvalidArgumentException('message_text should be between 1-4096 characters');
|
||||
}
|
||||
|
||||
$this->message_text = $message_text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Mode for parsing entities in the message text.
|
||||
*
|
||||
* @see https://core.telegram.org/bots/api#formatting-options
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParseMode(): ?string
|
||||
{
|
||||
return $this->parse_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'parse_mode' property
|
||||
* Optional. Mode for parsing entities in the message text.
|
||||
*
|
||||
* @param string|null $parse_mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setParseMode(?string $parse_mode): self
|
||||
{
|
||||
if($parse_mode == null)
|
||||
{
|
||||
$this->parse_mode = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if(!in_array(strtolower($parse_mode), ['markdown', 'html']))
|
||||
{
|
||||
throw new InvalidArgumentException('parse_mode should be either Markdown or HTML');
|
||||
}
|
||||
|
||||
$this->parse_mode = strtolower($parse_mode);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. List of special entities that appear in message text, which can be specified instead of parse_mode
|
||||
*
|
||||
* @return MessageEntity[]|null
|
||||
*/
|
||||
public function getEntities(): ?array
|
||||
{
|
||||
return $this->entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'entities' property
|
||||
* Optional. List of special entities that appear in message text, which can be specified instead of parse_mode
|
||||
*
|
||||
* @param MessageEntity[]|null $entities
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntities(?array $entities): self
|
||||
{
|
||||
if($entities == null)
|
||||
{
|
||||
$this->entities = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
foreach($entities as $entity)
|
||||
{
|
||||
if(!($entity instanceof MessageEntity))
|
||||
{
|
||||
throw new InvalidArgumentException('entities should be an array of MessageEntity objects');
|
||||
}
|
||||
}
|
||||
|
||||
$this->entities = $entities;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Disables link previews for links in the sent message
|
||||
*
|
||||
* @return bool
|
||||
* @noinspection PhpUnused
|
||||
*/
|
||||
public function isDisableWebPagePreview(): bool
|
||||
{
|
||||
return $this->disable_web_page_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'disable_web_page_preview' property
|
||||
* Optional. Disables link previews for links in the sent message
|
||||
*
|
||||
* @param bool $disable_web_page_preview
|
||||
* @return $this
|
||||
*/
|
||||
public function setDisableWebPagePreview(bool $disable_web_page_preview): self
|
||||
{
|
||||
$this->disable_web_page_preview = $disable_web_page_preview;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
$message_entities = null;
|
||||
|
||||
if($this->entities !== null)
|
||||
{
|
||||
/** @var MessageEntity $entity */
|
||||
foreach($this->entities as $entity)
|
||||
{
|
||||
if($entity instanceof MessageEntity)
|
||||
{
|
||||
$message_entities[] = $entity->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return [
|
||||
'message_text' => $this->message_text,
|
||||
'parse_mode' => $this->parse_mode,
|
||||
'entities' => $message_entities,
|
||||
'disable_web_page_preview' => $this->disable_web_page_preview,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): InputTextMessageContent
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = InputMessageContentType::TEXT;
|
||||
$object->message_text = $data['message_text'] ?? null;
|
||||
$object->parse_mode = $data['parse_mode'] ?? null;
|
||||
$object->disable_web_page_preview = (bool)$data['disable_web_page_preview'] ?? false;
|
||||
|
||||
if(isset($data['entities']))
|
||||
{
|
||||
foreach($data['entities'] as $entity)
|
||||
{
|
||||
$object->entities[] = MessageEntity::fromArray($entity);
|
||||
}
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
use TgBotLib\Enums\Types\InputMessageContentType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Inline\InputMessageContent;
|
||||
|
||||
class InputVenueMessageContent extends InputMessageContent implements ObjectTypeInterface
|
||||
{
|
||||
private float $latitude;
|
||||
private float $longitude;
|
||||
private string $title;
|
||||
private string $address;
|
||||
private ?string $foursquare_id;
|
||||
private ?string $foursquare_type;
|
||||
private ?string $google_place_id;
|
||||
private ?string $google_place_type;
|
||||
|
||||
/**
|
||||
* Latitude of the venue in degrees
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getLatitude(): float
|
||||
{
|
||||
return $this->latitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'latitude' property
|
||||
* Latitude of the venue in degrees
|
||||
*
|
||||
* @param float $latitude
|
||||
* @return $this
|
||||
*/
|
||||
public function setLatitude(float $latitude): self
|
||||
{
|
||||
$this->latitude = $latitude;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Longitude of the venue in degrees
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getLongitude(): float
|
||||
{
|
||||
return $this->longitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'longitude' property
|
||||
* Longitude of the venue in degrees
|
||||
*
|
||||
* @param float $longitude
|
||||
* @return $this
|
||||
*/
|
||||
public function setLongitude(float $longitude): self
|
||||
{
|
||||
$this->longitude = $longitude;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the venue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'title' property
|
||||
* Name of the venue
|
||||
*
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(string $title): self
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of the venue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAddress(): string
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'address' property
|
||||
* Address of the venue
|
||||
*
|
||||
* @param string $address
|
||||
* @return $this
|
||||
*/
|
||||
public function setAddress(string $address): self
|
||||
{
|
||||
$this->address = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Foursquare identifier of the venue, if known
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFoursquareId(): ?string
|
||||
{
|
||||
return $this->foursquare_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'foursquare_id' property
|
||||
* Optional. Foursquare identifier of the venue, if known
|
||||
*
|
||||
* @param string|null $foursquare_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setFoursquareId(?string $foursquare_id): self
|
||||
{
|
||||
$this->foursquare_id = $foursquare_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”,
|
||||
* “arts_entertainment/aquarium” or “food/icecream”.)
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFoursquareType(): ?string
|
||||
{
|
||||
return $this->foursquare_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'foursquare_type' property
|
||||
* Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”,
|
||||
* “arts_entertainment/aquarium” or “food/icecream”.)
|
||||
*
|
||||
* @param string|null $foursquare_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setFoursquareType(?string $foursquare_type): self
|
||||
{
|
||||
$this->foursquare_type = $foursquare_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Google Places identifier of the venue
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getGooglePlaceId(): ?string
|
||||
{
|
||||
return $this->google_place_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'google_place_id' property
|
||||
* Optional. Google Places identifier of the venue
|
||||
*
|
||||
* @param string|null $google_place_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setGooglePlaceId(?string $google_place_id): self
|
||||
{
|
||||
$this->google_place_id = $google_place_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Google Places type of the venue.
|
||||
*
|
||||
* @return string|null
|
||||
* @see https://developers.google.com/places/web-service/supported_types
|
||||
*/
|
||||
public function getGooglePlaceType(): ?string
|
||||
{
|
||||
return $this->google_place_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'google_place_type' property
|
||||
* Optional. Google Places type of the venue.
|
||||
*
|
||||
* @param string|null $google_place_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setGooglePlaceType(?string $google_place_type): self
|
||||
{
|
||||
$this->google_place_type = $google_place_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'latitude' => $this->latitude,
|
||||
'longitude' => $this->longitude,
|
||||
'title' => $this->title,
|
||||
'address' => $this->address,
|
||||
'foursquare_id' => $this->foursquare_id,
|
||||
'foursquare_type' => $this->foursquare_type,
|
||||
'google_place_id' => $this->google_place_id,
|
||||
'google_place_type' => $this->google_place_type,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function fromArray(array $data): InputVenueMessageContent
|
||||
{
|
||||
$object = new self();
|
||||
$object->type = InputMessageContentType::VENUE;
|
||||
$object->latitude = (float)$data['latitude'] ?? null;
|
||||
$object->longitude = (float)$data['longitude'] ?? null;
|
||||
$object->title = $data['title'] ?? null;
|
||||
$object->address = $data['address'] ?? null;
|
||||
$object->foursquare_id = $data['foursquare_id'] ?? null;
|
||||
$object->foursquare_type = $data['foursquare_type'] ?? null;
|
||||
$object->google_place_id = $data['google_place_id'] ?? null;
|
||||
$object->google_place_type = $data['google_place_type'] ?? null;
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue