Skip to content

Commit

Permalink
2.x: a lot of classes are now final classes and it protected properti…
Browse files Browse the repository at this point in the history
…es have been declared as privated
  • Loading branch information
aalbarca committed Jan 28, 2023
1 parent 1219b01 commit 4cf094b
Show file tree
Hide file tree
Showing 37 changed files with 84 additions and 88 deletions.
4 changes: 2 additions & 2 deletions src/Http/GuzzleClientHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;

class GuzzleClientHandler implements ClientHandler
final class GuzzleClientHandler implements ClientHandler
{
/**
* @var \GuzzleHttp\Client The Guzzle client.
*/
protected $guzzle_client;
private $guzzle_client;

/**
* @param \GuzzleHttp\Client|null The Guzzle client.
Expand Down
8 changes: 4 additions & 4 deletions src/Http/RawResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

namespace Netflie\WhatsAppCloudApi\Http;

class RawResponse
final class RawResponse
{
/**
* @var array The response headers in the form of an associative array.
*/
protected array $headers;
private array $headers;

/**
* @var string The raw response body.
*/
protected string $body;
private string $body;

/**
* @var int The HTTP status response code.
*/
protected $http_response_code;
private $http_response_code;

/**
* Creates a new GraphRawResponse entity.
Expand Down
4 changes: 2 additions & 2 deletions src/Message/AudioMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Netflie\WhatsAppCloudApi\Message\Media\MediaID;

class AudioMessage extends Message
final class AudioMessage extends Message
{
/**
* {@inheritdoc}
Expand All @@ -16,7 +16,7 @@ class AudioMessage extends Message
*
* You can get a WhatsApp Media ID uploading the document to the WhatsApp Cloud servers.
*/
protected MediaID $id;
private MediaID $id;

/**
* {@inheritdoc}
Expand Down
6 changes: 3 additions & 3 deletions src/Message/Contact/ContactName.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Netflie\WhatsAppCloudApi\Message\Contact;

class ContactName
final class ContactName
{
protected string $first_name;
private string $first_name;

protected string $last_name;
private string $last_name;

public function __construct(string $first_name, string $last_name = '')
{
Expand Down
8 changes: 4 additions & 4 deletions src/Message/Contact/Phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Netflie\WhatsAppCloudApi\Message\Contact;

class Phone
final class Phone
{
protected string $number;
private string $number;

protected string $wa_id;
private string $wa_id;

protected PhoneType $type;
private PhoneType $type;

public function __construct(string $number, PhoneType $type, string $wa_id = '')
{
Expand Down
2 changes: 1 addition & 1 deletion src/Message/Contact/PhoneType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use MyCLabs\Enum\Enum;

class PhoneType extends Enum
final class PhoneType extends Enum
{
private const CELL = 'cell';
private const MAIN = 'main';
Expand Down
2 changes: 1 addition & 1 deletion src/Message/Contact/Phones.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Netflie\WhatsAppCloudApi\Message\Contact;

class Phones implements \Countable, \IteratorAggregate
final class Phones implements \Countable, \IteratorAggregate
{
private array $phones;

Expand Down
6 changes: 3 additions & 3 deletions src/Message/ContactMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
use Netflie\WhatsAppCloudApi\Message\Contact\Phone;
use Netflie\WhatsAppCloudApi\Message\Contact\Phones;

class ContactMessage extends Message
final class ContactMessage extends Message
{
/**
* {@inheritdoc}
*/
protected string $type = 'contacts';

protected ContactName $name;
private ContactName $name;

protected Phones $phones;
private Phones $phones;

/**
* {@inheritdoc}
Expand Down
8 changes: 4 additions & 4 deletions src/Message/DocumentMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Netflie\WhatsAppCloudApi\Message\Media\MediaID;

class DocumentMessage extends Message
final class DocumentMessage extends Message
{
/**
* {@inheritdoc}
Expand All @@ -16,17 +16,17 @@ class DocumentMessage extends Message
*
* You can get a WhatsApp Media ID uploading the document to the WhatsApp Cloud servers.
*/
protected MediaID $id;
private MediaID $id;

/**
* Describes the filename for the specific document: eg. my-document.pdf.
*/
protected string $name;
private string $name;

/**
* Describes the specified document.
*/
protected ?string $caption;
private ?string $caption;

/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Message/Error/InvalidMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Netflie\WhatsAppCloudApi\Message\Error;

class InvalidMessage extends \Exception
final class InvalidMessage extends \Exception
{
}
6 changes: 3 additions & 3 deletions src/Message/ImageMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Netflie\WhatsAppCloudApi\Message\Media\MediaID;

class ImageMessage extends Message
final class ImageMessage extends Message
{
/**
* {@inheritdoc}
Expand All @@ -16,12 +16,12 @@ class ImageMessage extends Message
*
* You can get a WhatsApp Media ID uploading the document to the WhatsApp Cloud servers.
*/
protected MediaID $id;
private MediaID $id;

/**
* Describes the specified document.
*/
protected ?string $caption;
private ?string $caption;

/**
* {@inheritdoc}
Expand Down
10 changes: 5 additions & 5 deletions src/Message/LocationMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

use Netflie\WhatsAppCloudApi\Message\Error\InvalidMessage;

class LocationMessage extends Message
final class LocationMessage extends Message
{
/**
* {@inheritdoc}
*/
protected string $type = 'location';

protected float $longitude;
private float $longitude;

protected float $latitude;
private float $latitude;

/**
* Name of the location
*/
protected string $name;
private string $name;

protected string $address;
private string $address;

/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Message/Media/LinkID.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Netflie\WhatsAppCloudApi\Message\Error\InvalidMessage;

class LinkID extends MediaID
final class LinkID extends MediaID
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Message/Media/MediaID.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class MediaID
/**
* Value of the identifier
*/
protected string $value;
private string $value;

public function __construct(string $id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Message/Media/MediaObjectID.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Netflie\WhatsAppCloudApi\Message\Media;

class MediaObjectID extends MediaID
final class MediaObjectID extends MediaID
{
/**
* {@inheritdoc}
Expand Down
6 changes: 3 additions & 3 deletions src/Message/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ abstract class Message
/**
* @var string Currently only "whatsapp" value is supported.
*/
protected string $messaging_product = 'whatsapp';
private string $messaging_product = 'whatsapp';

/**
* @var string Currently only "individual" value is supported.
*/
protected string $recipient_type = 'individual';
private string $recipient_type = 'individual';

/**
* @var string WhatsApp ID or phone number for the person you want to send a message to.
*/
protected string $to;
private string $to;

/**
* @var string Type of message object.
Expand Down
10 changes: 5 additions & 5 deletions src/Message/OptionsListMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

use Netflie\WhatsAppCloudApi\Message\OptionsList\Action;

class OptionsListMessage extends Message
final class OptionsListMessage extends Message
{
/**
* {@inheritdoc}
*/
protected string $type = 'list';

protected string $header;
private string $header;

protected string $body;
private string $body;

protected string $footer;
private string $footer;

protected Action $action;
private Action $action;

/**
* {@inheritdoc}
Expand Down
4 changes: 2 additions & 2 deletions src/Message/StickerMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Netflie\WhatsAppCloudApi\Message\Media\MediaID;

class StickerMessage extends Message
final class StickerMessage extends Message
{
/**
* {@inheritdoc}
Expand All @@ -16,7 +16,7 @@ class StickerMessage extends Message
*
* You can get a WhatsApp Media ID uploading the document to the WhatsApp Cloud servers.
*/
protected MediaID $id;
private MediaID $id;

/**
* {@inheritdoc}
Expand Down
8 changes: 4 additions & 4 deletions src/Message/Template/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

namespace Netflie\WhatsAppCloudApi\Message\Template;

class Component
final class Component
{
/**
* Parameters of a header template.
*/
protected array $header;
private array $header;

/**
* Parameters of a body template.
*/
protected array $body;
private array $body;

/**
* Buttons to attach to a template.
*/
protected array $buttons;
private array $buttons;

public function __construct(array $header = [], array $body = [], array $buttons = [])
{
Expand Down
8 changes: 4 additions & 4 deletions src/Message/TemplateMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Netflie\WhatsAppCloudApi\Message\Template\Component;

class TemplateMessage extends Message
final class TemplateMessage extends Message
{
/**
* {@inheritdoc}
Expand All @@ -15,18 +15,18 @@ class TemplateMessage extends Message
* Name of the template
* @link https://business.facebook.com/wa/manage/message-templates/ Dashboard to manage (create, edit and delete) templates.
*/
protected string $name;
private string $name;

/**
* @link https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages See supported language codes.
*/
protected string $language;
private string $language;

/**
* Templates header, body and buttons can be personalized
* @link https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates See how you can personalized your templates.
*/
protected ?Component $components;
private ?Component $components;

/**
* {@inheritdoc}
Expand Down
Loading

0 comments on commit 4cf094b

Please sign in to comment.