Skip to content

Commit

Permalink
Merge pull request #28 from tarfin-labs/laravel-9-support
Browse files Browse the repository at this point in the history
Laravel 9 support added.
  • Loading branch information
tkaratug authored May 10, 2022
2 parents 3d41fca + 7b0d07c commit f1c6043
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.4, 8.0]
laravel: [8.*]
php: [7.4, 8.0, 8.1]
laravel: [8.*, 9.*]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to `netgsm` will be documented in this file

## Unreleased

## [4.3.0] - 2022-02-08

- Laravel 9 support added.

## [4.2.0] - 2021-06-03

- PHP 8 support added.
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^7.4|^8.0|^8.1",
"guzzlehttp/guzzle": "^7.1",
"illuminate/support": "^8.0",
"illuminate/notifications": "^8.0",
"illuminate/translation": "^8.0",
"illuminate/support": "^8.0|^9.0",
"illuminate/notifications": "^8.0|^9.0",
"illuminate/translation": "^8.0|^9.0",
"nesbot/carbon": "^2.0",
"ext-simplexml": "*"
},
"require-dev": {
"fakerphp/faker": "^1.14",
"phpunit/phpunit": "^9.4",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^6.0"
"orchestra/testbench": "^6.0|^7.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions src/Balance/NetgsmAvailableCredit.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class NetgsmAvailableCredit extends NetgsmApiClient
* extracts credit from the returned response.
*
* @return string
*
* @throws NetgsmException
*/
public function parseResponse(): ?string
Expand Down
2 changes: 2 additions & 0 deletions src/Balance/NetgsmPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class NetgsmPackages extends NetgsmApiClient
* handles the response and return the package list as an array.
*
* @return array
*
* @throws NetgsmException
*/
public function parseResponse(): array
Expand Down Expand Up @@ -61,6 +62,7 @@ public function parseResponse(): array
* returns the packages list for associated netgsm account.
*
* @return array
*
* @throws GuzzleException
* @throws NetgsmException
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Exceptions/CouldNotSendNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class CouldNotSendNotification extends AbstractNetgsmException
/**
* Thrown when there's a bad request and an error is responded.
*
* @param ClientException $exception
*
* @param ClientException $exception
* @return static
*/
public static function NetgsmRespondedWithAnError(ClientException $exception)
Expand Down
4 changes: 2 additions & 2 deletions src/Iys/NetgsmIys.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class NetgsmIys extends AbstractNetgsmIys
/**
* Add address request.
*
* @param Add $request
* @param Add $request
* @return $this
*/
public function addAddress(Add $request): NetgsmIys
Expand All @@ -25,7 +25,7 @@ public function addAddress(Add $request): NetgsmIys
/**
* Search address request.
*
* @param Search $request
* @param Search $request
* @return $this
*/
public function searchAddress(Search $request): NetgsmIys
Expand Down
20 changes: 10 additions & 10 deletions src/Iys/Requests/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Add
protected ?int $retailerAccess;

/**
* @param string $refId
* @param string $refId
* @return $this
*/
public function setRefId(string $refId): self
Expand All @@ -36,7 +36,7 @@ public function setRefId(string $refId): self
}

/**
* @param string $type
* @param string $type
* @return $this
*/
public function setType(string $type): self
Expand All @@ -47,7 +47,7 @@ public function setType(string $type): self
}

/**
* @param string $source
* @param string $source
* @return $this
*/
public function setSource(string $source): self
Expand All @@ -58,7 +58,7 @@ public function setSource(string $source): self
}

/**
* @param string $recipient
* @param string $recipient
* @return $this
*/
public function setRecipient(string $recipient): self
Expand All @@ -69,7 +69,7 @@ public function setRecipient(string $recipient): self
}

/**
* @param string $status
* @param string $status
* @return $this
*/
public function setStatus(string $status): self
Expand All @@ -80,7 +80,7 @@ public function setStatus(string $status): self
}

/**
* @param string $consentDate
* @param string $consentDate
* @return $this
*/
public function setConsentDate(string $consentDate): self
Expand All @@ -91,7 +91,7 @@ public function setConsentDate(string $consentDate): self
}

/**
* @param string $recipientType
* @param string $recipientType
* @return $this
*/
public function setRecipientType(string $recipientType): self
Expand All @@ -102,7 +102,7 @@ public function setRecipientType(string $recipientType): self
}

/**
* @param int|null $retailerCode
* @param int|null $retailerCode
* @return $this
*/
public function setRetailerCode(?int $retailerCode): self
Expand All @@ -113,7 +113,7 @@ public function setRetailerCode(?int $retailerCode): self
}

/**
* @param int|null $retailerAccess
* @param int|null $retailerAccess
* @return $this
*/
public function setRetailerAccess(?int $retailerAccess): self
Expand All @@ -124,7 +124,7 @@ public function setRetailerAccess(?int $retailerAccess): self
}

/**
* @param array $defaults
* @param array $defaults
* @return $this
*/
public function setDefaults(array $defaults): self
Expand Down
10 changes: 5 additions & 5 deletions src/Iys/Requests/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Search
protected string $refId;

/**
* @param string $type
* @param string $type
* @return $this
*/
public function setType(string $type): self
Expand All @@ -26,7 +26,7 @@ public function setType(string $type): self
}

/**
* @param string $recipient
* @param string $recipient
* @return $this
*/
public function setRecipient(string $recipient): self
Expand All @@ -37,7 +37,7 @@ public function setRecipient(string $recipient): self
}

/**
* @param string $recipientType
* @param string $recipientType
* @return $this
*/
public function setRecipientType(string $recipientType): self
Expand All @@ -48,7 +48,7 @@ public function setRecipientType(string $recipientType): self
}

/**
* @param string $refId
* @param string $refId
* @return $this
*/
public function setRefId(string $refId): self
Expand All @@ -59,7 +59,7 @@ public function setRefId(string $refId): self
}

/**
* @param array $defaults
* @param array $defaults
* @return $this
*/
public function setDefaults(array $defaults): self
Expand Down
5 changes: 5 additions & 0 deletions src/Netgsm.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Netgsm

/**
* Netgsm constructor.
*
* @param Client $client
* @param array $credentials
* @param array $defaults
Expand All @@ -35,6 +36,7 @@ public function __construct(Client $client, array $credentials = [], array $defa
/**
* @param AbstractNetgsmMessage $netgsmMessage
* @return mixed
*
* @throws CouldNotSendNotification
* @throws Exceptions\IncorrectPhoneNumberFormatException
* @throws GuzzleException
Expand Down Expand Up @@ -62,6 +64,7 @@ public function sendSms(AbstractNetgsmMessage $netgsmMessage)
* @param $endDate
* @param array $filters
* @return Collection
*
* @throws GuzzleException
* @throws Exceptions\ReportException
*/
Expand Down Expand Up @@ -100,6 +103,7 @@ public function getReports(
* Returns the remaining credits amount (TL) on the netgsm account.
*
* @return string
*
* @throws Exceptions\NetgsmException
* @throws GuzzleException
*/
Expand All @@ -116,6 +120,7 @@ public function getCredit()
* Returns the available package list and their balances on the netgsm account.
*
* @return array
*
* @throws Exceptions\NetgsmException
* @throws GuzzleException
*/
Expand Down
1 change: 1 addition & 0 deletions src/NetgsmApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function setCredentials(array $credentials): self
* @param null $params
* @param array $headers
* @return string
*
* @throws GuzzleException
*/
protected function callApi($method, $url, $params = null, $headers = [])
Expand Down
5 changes: 3 additions & 2 deletions src/NetgsmChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public function __construct(Netgsm $netgsm)
/**
* Send the given notification.
*
* @param $notifiable
* @param Notification $notification
* @param $notifiable
* @param Notification $notification
*
* @throws Exceptions\CouldNotSendNotification
* @throws GuzzleException
* @throws IncorrectPhoneNumberFormatException
Expand Down
2 changes: 2 additions & 0 deletions src/Report/AbstractNetgsmReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ protected function formatValue($value, $format)
* returns the netgsm basic sms reports as a collection.
*
* @return Collection
*
* @throws GuzzleException
* @throws ReportException
*/
Expand Down Expand Up @@ -191,6 +192,7 @@ public function getReports(): Collection
*
* @param $response
* @return bool
*
* @throws ReportException
*/
public function validateResponse($response): bool
Expand Down
2 changes: 2 additions & 0 deletions src/Report/NetgsmSmsDetailReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class NetgsmSmsDetailReport extends AbstractNetgsmReport
/**
* Sets the Netgsm service bulkId
* If bulkId is set, type value is set to 0.
*
* @see https://www.netgsm.com.tr/dokuman/#http-get-rapor
*
* @param mixed $bulkId
Expand Down Expand Up @@ -85,6 +86,7 @@ public function processRow($line): array
*
* @param $response
* @return Collection
*
* @throws \TarfinLabs\Netgsm\Exceptions\ReportException
*/
public function parseResponse(string $response): Collection
Expand Down
2 changes: 2 additions & 0 deletions src/Report/NetgsmSmsReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class NetgsmSmsReport extends AbstractNetgsmReport
/**
* Sets the Netgsm service bulkId
* If bulkId is set, type value is set to 1.
*
* @see https://www.netgsm.com.tr/dokuman/#http-get-rapor
*
* @param string $bulkId
Expand Down Expand Up @@ -119,6 +120,7 @@ protected function processRow(string $line): array
*
* @param string $response
* @return Collection
*
* @throws \TarfinLabs\Netgsm\Exceptions\ReportException
*/
public function parseResponse(string $response): Collection
Expand Down
7 changes: 7 additions & 0 deletions src/Sms/AbstractNetgsmMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public static function create(string $message = null, array $defaults = [])

/**
* AbstractNetgsmMessage constructor.
*
* @param array $defaults
* @param string $message
*/
Expand Down Expand Up @@ -149,6 +150,7 @@ public function getRecipients(): array

/**
* set's the sms origin.
*
* @see https://www.netgsm.com.tr/dokuman/#g%C3%B6nderici-ad%C4%B1-sorgulama
*
* @param null $header
Expand Down Expand Up @@ -204,6 +206,7 @@ public function getSendMethod(): string
*
* @param string $sendMethod
* @return $this
*
* @throws Exception
*/
public function setSendMethod(string $sendMethod): self
Expand Down Expand Up @@ -316,6 +319,7 @@ public function getJobId(): string
* parses the response from api and returns job id.
*
* @return $this
*
* @throws CouldNotSendNotification
* @throws NetgsmException
*/
Expand Down Expand Up @@ -347,6 +351,7 @@ public function parseResponse(): self
* sends a sms via get method.
*
* @return $this
*
* @throws CouldNotSendNotification
* @throws GuzzleException
* @throws NetgsmException
Expand All @@ -362,6 +367,7 @@ protected function sendViaGet(): self
* sends a sms via xml method.
*
* @return $this
*
* @throws CouldNotSendNotification
* @throws GuzzleException
* @throws NetgsmException
Expand All @@ -379,6 +385,7 @@ protected function sendViaXml(): self
* sends a sms via specified sending method.
*
* @return $this
*
* @throws IncorrectPhoneNumberFormatException
*/
public function send()
Expand Down
Loading

0 comments on commit f1c6043

Please sign in to comment.