Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add @throws to docblock #749

Merged
merged 2 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions lib/mail/Asm.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ class Asm implements \JsonSerializable
*/
private $groups_to_display;

/**
* Optional constructor
*
* @param int|GroupId|null $group_id A GroupId object or the
* unsubscribe group to
* associate with this email
* @param int[]|GroupsToDisplay|null $groups_to_display A GroupsToDisplay
* object or an array
* containing the
* unsubscribe groups
* that you would like
* to be displayed
* on the unsubscribe
* preferences page.
*/
/**
* Optional constructor
*
* @param int|GroupId|null $group_id A GroupId object or the
* unsubscribe group to
* associate with this email
* @param int[]|GroupsToDisplay|null $groups_to_display A GroupsToDisplay
* object or an array
* containing the
* unsubscribe groups
* that you would like
* to be displayed
* on the unsubscribe
* preferences page.
* @throws \SendGrid\Mail\TypeException
*/
public function __construct(
$group_id = null,
$groups_to_display = null
Expand All @@ -62,7 +63,7 @@ public function __construct(
* @param int|GroupId $group_id The unsubscribe group to associate with this
* email
*
* @throws TypeException
* @throws \SendGrid\Mail\TypeException
*/
public function setGroupId($group_id)
{
Expand Down Expand Up @@ -103,7 +104,7 @@ public function getGroupId()
* on the unsubscribe
* preferences page.
*
* @throws TypeException
* @throws \SendGrid\Mail\TypeException
*/
public function setGroupsToDisplay($groups_to_display)
{
Expand Down
60 changes: 31 additions & 29 deletions lib/mail/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ class Attachment implements \JsonSerializable
/** @var $content_id string Used when disposition is inline to diplay the file within the body of the email */
private $content_id;

/**
* Optional constructor
*
* @param string $content Base64 encoded content
* @param string $type Mime type of the attachment
* @param string $filename File name of the attachment
* @param string $disposition How the attachment should be displayed: inline
* or attachment, default is attachment
* @param string $content_id Used when disposition is inline to diplay the
* file within the body of the email
*/
/**
* Optional constructor
*
* @param string $content Base64 encoded content
* @param string $type Mime type of the attachment
* @param string $filename File name of the attachment
* @param string $disposition How the attachment should be displayed: inline
* or attachment, default is attachment
* @param string $content_id Used when disposition is inline to diplay the
* file within the body of the email
* @throws \SendGrid\Mail\TypeException
*/
public function __construct(
$content = null,
$type = null,
Expand Down Expand Up @@ -72,8 +73,8 @@ public function __construct(
*
* @param string $content Base64 encoded content
*
* @throws TypeException
*/
* @throws \SendGrid\Mail\TypeException
*/
public function setContent($content)
{
if (!is_string($content)) {
Expand All @@ -100,9 +101,9 @@ public function getContent()
* Add the mime type to a Attachment object
*
* @param string $type Mime type of the attachment
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setType($type)
{
if (!is_string($type)) {
Expand All @@ -125,9 +126,9 @@ public function getType()
* Add the file name to a Attachment object
*
* @param string $filename File name of the attachment
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setFilename($filename)
{
if (!is_string($filename)) {
Expand All @@ -151,9 +152,9 @@ public function getFilename()
*
* @param string $disposition How the attachment should be displayed:
* inline or attachment, default is attachment
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setDisposition($disposition)
{
if (!is_string($disposition)) {
Expand All @@ -172,12 +173,13 @@ public function getDisposition()
return $this->disposition;
}

/**
* Add the content id to a Attachment object
*
* @param string $content_id Used when disposition is inline to diplay
* the file within the body of the email
*/
/**
* Add the content id to a Attachment object
*
* @param string $content_id Used when disposition is inline to diplay
* the file within the body of the email
* @throws \SendGrid\Mail\TypeException
*/
public function setContentID($content_id)
{
if (!is_string($content_id)) {
Expand All @@ -202,7 +204,7 @@ public function getContentID()
* @param $string string The string that has to be checked
* @return bool
*/
private function isBase64($string)
private function isBase64($string)
{
$decoded_data = base64_decode($string, true);
$encoded_data = base64_encode($decoded_data);
Expand Down
19 changes: 10 additions & 9 deletions lib/mail/BatchId.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ class BatchId implements \JsonSerializable
/** @var $batch_id string This ID represents a batch of emails to be sent at the same time */
private $batch_id;

/**
* Optional constructor
*
* @param string|null $batch_id This ID represents a batch of emails to
* be sent at the same time
*/
/**
* Optional constructor
*
* @param string|null $batch_id This ID represents a batch of emails to
* be sent at the same time
* @throws \SendGrid\Mail\TypeException
*/
public function __construct($batch_id = null)
{
if (isset($batch_id)) {
Expand All @@ -42,9 +43,9 @@ public function __construct($batch_id = null)
*
* @param string $batch_id This ID represents a batch of emails to be sent
* at the same time
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setBatchId($batch_id)
{
if (!is_string($batch_id)) {
Expand Down
27 changes: 14 additions & 13 deletions lib/mail/BccSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ class BccSettings implements \JsonSerializable
/** @var $email string The email address that you would like to receive the BCC */
private $email;

/**
* Optional constructor
*
* @param bool|null $enable Indicates if this setting is enabled
* @param string|null $email The email address that you would like
* to receive the BCC
*/
/**
* Optional constructor
*
* @param bool|null $enable Indicates if this setting is enabled
* @param string|null $email The email address that you would like
* to receive the BCC
* @throws \SendGrid\Mail\TypeException
*/
public function __construct($enable = null, $email = null)
{
if (isset($enable)) {
Expand All @@ -47,9 +48,9 @@ public function __construct($enable = null, $email = null)
* Update the enable setting on a BccSettings object
*
* @param bool $enable Indicates if this setting is enabled
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setEnable($enable)
{
if (!is_bool($enable)) {
Expand All @@ -73,9 +74,9 @@ public function getEnable()
*
* @param string $email The email address that you would like
* to receive the BCC
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setEmail($email)
{
if (!is_string($email) &&
Expand Down
17 changes: 9 additions & 8 deletions lib/mail/BypassListManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ class BypassListManagement implements \JsonSerializable
/** @var $enable bool Indicates if this setting is enabled */
private $enable;

/**
* Optional constructor
*
* @param bool|null $enable Indicates if this setting is enabled
*/
/**
* Optional constructor
*
* @param bool|null $enable Indicates if this setting is enabled
* @throws \SendGrid\Mail\TypeException
*/
public function __construct($enable = null)
{
if (isset($enable)) {
Expand All @@ -46,9 +47,9 @@ public function __construct($enable = null)
* Update the enable setting on a BypassListManagement object
*
* @param bool $enable Indicates if this setting is enabled
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setEnable($enable)
{
if (!is_bool($enable)) {
Expand Down
19 changes: 10 additions & 9 deletions lib/mail/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ class Category implements \JsonSerializable
/** @var $category string A category name for an email message. Each category name may not exceed 255 characters */
private $category;

/**
* Optional constructor
*
* @param string|null $category A category name for an email message.
* Each category name may not exceed 255
* characters
*/
/**
* Optional constructor
*
* @param string|null $category A category name for an email message.
* Each category name may not exceed 255
* characters
* @throws \SendGrid\Mail\TypeException
*/
public function __construct($category = null)
{
if (isset($category)) {
Expand All @@ -45,8 +46,8 @@ public function __construct($category = null)
* Each category name may not exceed 255
* characters
*
* @throws TypeException
*/
* @throws \SendGrid\Mail\TypeException
*/
public function setCategory($category)
{
if (!is_string($category)) {
Expand Down
29 changes: 15 additions & 14 deletions lib/mail/ClickTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ class ClickTracking implements \JsonSerializable
/* @var $enable_text bool Indicates if this setting should be included in the text/plain portion of your email */
private $enable_text;

/**
* Optional constructor
*
* @param bool|null $enable Indicates if this setting is enabled
* @param bool|null $enable_text Indicates if this setting should be
* included in the text/plain portion of
* your email
*/
/**
* Optional constructor
*
* @param bool|null $enable Indicates if this setting is enabled
* @param bool|null $enable_text Indicates if this setting should be
* included in the text/plain portion of
* your email
* @throws \SendGrid\Mail\TypeException
*/
public function __construct($enable = null, $enable_text = null)
{
if (isset($enable)) {
Expand All @@ -48,9 +49,9 @@ public function __construct($enable = null, $enable_text = null)
* Update the enable setting on a ClickTracking object
*
* @param bool $enable Indicates if this setting is enabled
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setEnable($enable)
{
if (!is_bool($enable)) {
Expand All @@ -73,9 +74,9 @@ public function getEnable()
* Update the enable text setting on a ClickTracking object
*
* @param bool $enable_text Indicates if this setting is enabled
*
* @throws TypeException
*/
*
* @throws \SendGrid\Mail\TypeException
*/
public function setEnableText($enable_text)
{
if (!is_bool($enable_text)) {
Expand Down
Loading