Skip to content

Commit

Permalink
Apply PHP CS Fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
irazasyed authored and github-actions[bot] committed Mar 12, 2024
1 parent 595d683 commit 2ad61bc
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 65 deletions.
27 changes: 12 additions & 15 deletions src/Components/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
namespace NotificationChannels\Facebook\Components;

use Illuminate\Support\Str;
use JsonSerializable;
use NotificationChannels\Facebook\Enums\ButtonType;
use NotificationChannels\Facebook\Exceptions\CouldNotCreateButton;

/**
* Class Button.
*/
class Button implements JsonSerializable
class Button implements \JsonSerializable
{
/** @var string Button Title */
protected $title;
Expand Down Expand Up @@ -51,9 +50,9 @@ public static function create(string $title = '', $data = null, string $type = B
/**
* Set Button Title.
*
* @throws CouldNotCreateButton
*
* @return $this
*
* @throws CouldNotCreateButton
*/
public function title(string $title): self
{
Expand All @@ -73,9 +72,9 @@ public function title(string $title): self
/**
* Set a URL for the button.
*
* @throws CouldNotCreateButton
*
* @return $this
*
* @throws CouldNotCreateButton
*/
public function url(string $url): self
{
Expand All @@ -94,9 +93,9 @@ public function url(string $url): self
}

/**
* @throws CouldNotCreateButton
*
* @return $this
*
* @throws CouldNotCreateButton
*/
public function phone(string $phone): self
{
Expand All @@ -115,11 +114,9 @@ public function phone(string $phone): self
}

/**
* @param $postback
* @return $this
*
* @throws CouldNotCreateButton|\JsonException
*
* @return $this
*/
public function postback($postback): self
{
Expand Down Expand Up @@ -199,9 +196,9 @@ public function toArray(): array
/**
* Convert the object into something JSON serializable.
*
* @throws CouldNotCreateButton
*
* @return mixed
*
* @throws CouldNotCreateButton
*/
public function jsonSerialize()
{
Expand All @@ -221,9 +218,9 @@ protected function isType(string $type): bool
*
* @param mixed $data
*
* @throws CouldNotCreateButton
*
* @return $this
*
* @throws CouldNotCreateButton
*/
protected function makePayload($data): self
{
Expand Down
19 changes: 9 additions & 10 deletions src/Components/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace NotificationChannels\Facebook\Components;

use JsonSerializable;
use NotificationChannels\Facebook\Exceptions\CouldNotCreateCard;
use NotificationChannels\Facebook\Traits\HasButtons;

/**
* Class Card.
*/
class Card implements JsonSerializable
class Card implements \JsonSerializable
{
use HasButtons;

Expand All @@ -31,9 +30,9 @@ public function __construct(string $title = '')
/**
* Create a Card.
*
* @throws CouldNotCreateCard
*
* @return static
*
* @throws CouldNotCreateCard
*/
public static function create(string $title = ''): self
{
Expand All @@ -43,9 +42,9 @@ public static function create(string $title = ''): self
/**
* Set Button Title.
*
* @throws CouldNotCreateCard
*
* @return $this
*
* @throws CouldNotCreateCard
*/
public function title(string $title): self
{
Expand Down Expand Up @@ -87,9 +86,9 @@ public function image(string $imageUrl): self
/**
* Set Card Subtitle.
*
* @throws CouldNotCreateCard
*
* @return $this
*
* @throws CouldNotCreateCard
*/
public function subtitle(string $subtitle): self
{
Expand Down Expand Up @@ -123,9 +122,9 @@ public function toArray(): array
/**
* Convert the object into something JSON serializable.
*
* @throws CouldNotCreateCard
*
* @return mixed
*
* @throws CouldNotCreateCard
*/
public function jsonSerialize()
{
Expand Down
4 changes: 1 addition & 3 deletions src/Exceptions/CouldNotCreateButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace NotificationChannels\Facebook\Exceptions;

use Exception;

/**
* Class CouldNotCreateButton.
*/
class CouldNotCreateButton extends Exception
class CouldNotCreateButton extends \Exception
{
/**
* Thrown when the button title is not provided.
Expand Down
4 changes: 1 addition & 3 deletions src/Exceptions/CouldNotCreateCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace NotificationChannels\Facebook\Exceptions;

use Exception;

/**
* Class CouldNotCreateCard.
*/
class CouldNotCreateCard extends Exception
class CouldNotCreateCard extends \Exception
{
/**
* Thrown when the button title is not provided.
Expand Down
4 changes: 1 addition & 3 deletions src/Exceptions/CouldNotCreateMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace NotificationChannels\Facebook\Exceptions;

use Exception;

/**
* Class CouldNotCreateMessage.
*/
class CouldNotCreateMessage extends Exception
class CouldNotCreateMessage extends \Exception
{
/**
* Thrown when the message text is not provided.
Expand Down
5 changes: 2 additions & 3 deletions src/Exceptions/CouldNotSendNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

namespace NotificationChannels\Facebook\Exceptions;

use Exception;
use GuzzleHttp\Exception\ClientException;

/**
* Class CouldNotSendNotification.
*/
class CouldNotSendNotification extends Exception
class CouldNotSendNotification extends \Exception
{
/**
* Thrown when there's a bad request and an error is responded.
Expand Down Expand Up @@ -41,7 +40,7 @@ public static function facebookPageTokenNotProvided(string $message): self
*
* @return static
*/
public static function couldNotCommunicateWithFacebook(Exception $exception): self
public static function couldNotCommunicateWithFacebook(\Exception $exception): self
{
return new static('The communication with Facebook failed. Reason: '.$exception->getMessage());
}
Expand Down
13 changes: 3 additions & 10 deletions src/Facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace NotificationChannels\Facebook;

use Exception;
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\GuzzleException;
Expand Down Expand Up @@ -35,10 +34,6 @@ public function __construct(string $token = null, HttpClient $httpClient = null)

/**
* Set Default Graph API Version.
*
* @param $graphApiVersion
*
* @return Facebook
*/
public function setGraphApiVersion($graphApiVersion): self
{
Expand All @@ -51,8 +46,6 @@ public function setGraphApiVersion($graphApiVersion): self
* Set App Secret to generate appsecret_proof.
*
* @param string $secret
*
* @return Facebook
*/
public function setSecret($secret = null): self
{
Expand Down Expand Up @@ -103,10 +96,10 @@ protected function httpClient(): HttpClient
*
* @param string $method
*
* @return mixed|ResponseInterface
*
* @throws GuzzleException
* @throws CouldNotSendNotification
*
* @return mixed|ResponseInterface
*/
protected function api(string $endpoint, array $options, $method = 'GET')
{
Expand All @@ -126,7 +119,7 @@ protected function api(string $endpoint, array $options, $method = 'GET')
return $this->httpClient()->request($method, $url, $options);
} catch (ClientException $exception) {
throw CouldNotSendNotification::facebookRespondedWithAnError($exception);
} catch (Exception $exception) {
} catch (\Exception $exception) {
throw CouldNotSendNotification::couldNotCommunicateWithFacebook($exception);
}
}
Expand Down
29 changes: 13 additions & 16 deletions src/FacebookMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace NotificationChannels\Facebook;

use JsonSerializable;
use NotificationChannels\Facebook\Enums\AttachmentType;
use NotificationChannels\Facebook\Enums\ImageAspectRatioType;
use NotificationChannels\Facebook\Enums\MessagingType;
Expand All @@ -14,7 +13,7 @@
/**
* Class FacebookMessage.
*/
class FacebookMessage implements JsonSerializable
class FacebookMessage implements \JsonSerializable
{
use HasButtons;

Expand Down Expand Up @@ -68,9 +67,9 @@ public function __construct(string $text = '')
}

/**
* @throws CouldNotCreateMessage
*
* @return static
*
* @throws CouldNotCreateMessage
*/
public static function create(string $text = ''): self
{
Expand Down Expand Up @@ -104,9 +103,9 @@ public function to($recipient, string $type = RecipientType::ID): self
/**
* Notification text.
*
* @throws CouldNotCreateMessage
*
* @return $this
*
* @throws CouldNotCreateMessage
*/
public function text(string $text): self
{
Expand All @@ -123,9 +122,9 @@ public function text(string $text): self
/**
* Add Attachment.
*
* @throws CouldNotCreateMessage
*
* @return $this
*
* @throws CouldNotCreateMessage
*/
public function attach(string $attachmentType, string $url): self
{
Expand Down Expand Up @@ -156,9 +155,9 @@ public function attach(string $attachmentType, string $url): self
*
* @param string $notificationType Possible values: REGULAR, SILENT_PUSH, NO_PUSH
*
* @throws CouldNotCreateMessage
*
* @return $this
*
* @throws CouldNotCreateMessage
*/
public function notificationType(string $notificationType): self
{
Expand Down Expand Up @@ -268,8 +267,6 @@ public function isUpdate(): self
/**
* Helper to set messaging type as MESSAGE_TAG.
*
* @param $messageTag
*
* @return $this
*/
public function isMessageTag($messageTag): self
Expand All @@ -283,9 +280,9 @@ public function isMessageTag($messageTag): self
/**
* Add up to 10 cards to be displayed in a carousel.
*
* @throws CouldNotCreateMessage
*
* @return $this
*
* @throws CouldNotCreateMessage
*/
public function cards(array $cards): self
{
Expand All @@ -309,9 +306,9 @@ public function toNotGiven(): bool
/**
* Convert the object into something JSON serializable.
*
* @throws CouldNotCreateMessage
*
* @return mixed
*
* @throws CouldNotCreateMessage
*/
public function jsonSerialize()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/HasButtons.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ trait HasButtons
/**
* Add up to 3 call to action buttons.
*
* @throws CouldNotCreateMessage
*
* @return $this
*
* @throws CouldNotCreateMessage
*/
public function buttons(array $buttons = []): self
{
Expand Down
1 change: 1 addition & 0 deletions tests/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Class ExampleTest.
*
* @internal
*
* @coversNothing
*/
class ExampleTest extends TestCase
Expand Down

0 comments on commit 2ad61bc

Please sign in to comment.