Skip to content

Commit

Permalink
Apply fixes from StyleCI (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
frkcn authored Mar 26, 2024
1 parent bc809bd commit 64481ea
Show file tree
Hide file tree
Showing 23 changed files with 164 additions and 164 deletions.
14 changes: 7 additions & 7 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
return [
'credentials' => [
'user_code' => env('NETGSM_USERCODE'),
'secret' => env('NETGSM_SECRET'),
'brand_code'=> env('NETGSM_BRANDCODE'),
'secret' => env('NETGSM_SECRET'),
'brand_code' => env('NETGSM_BRANDCODE'),
],
'defaults' => [
'language' => env('NETGSM_LANGUAGE', 'tr'),
'header' => env('NETGSM_HEADER', null),
'defaults' => [
'language' => env('NETGSM_LANGUAGE', 'tr'),
'header' => env('NETGSM_HEADER', null),
'sms_sending_method' => env('NETGSM_SMS_SENDING_METHOD', 'get'),
'base_uri' => env('NETGSM_BASE_URI', 'https://api.netgsm.com.tr'),
'timeout' => env('NETGSM_TIMEOUT', 60),
'base_uri' => env('NETGSM_BASE_URI', 'https://api.netgsm.com.tr'),
'timeout' => env('NETGSM_TIMEOUT', 60),
],
];
26 changes: 13 additions & 13 deletions resources/lang/en/errors.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

return [
'message_too_long' => 'Message length limit exceeded.',
'start_date_incorrect' => 'Invalid start date. Proceeded with system date.',
'end_date_incorrect' => 'Invalid end date. Proceeded with system date.',
'sender_incorrect' => 'Message title (sender name) is not defined in system',
'credentials_incorrect' => 'Invalid username and password or user does not have API access',
'parameters_incorrect' => 'invalid query. One of the parameters that you send is invalid or required parameters are missing.',
'receiver_incorrect' => 'Invalid recipient.',
'message_too_long' => 'Message length limit exceeded.',
'start_date_incorrect' => 'Invalid start date. Proceeded with system date.',
'end_date_incorrect' => 'Invalid end date. Proceeded with system date.',
'sender_incorrect' => 'Message title (sender name) is not defined in system',
'credentials_incorrect' => 'Invalid username and password or user does not have API access',
'parameters_incorrect' => 'invalid query. One of the parameters that you send is invalid or required parameters are missing.',
'receiver_incorrect' => 'Invalid recipient.',
'otp_account_not_defined' => 'There is no OTP SMS package in your account.',
'query_limit_exceed' => 'Query limit exceeded.',
'system_error' => 'system error.',
'netgsm_general_error' => 'Netgsm responded an error :',
'no_record' => 'No record',
'job_id_not_found' => 'Job id not found',
'query_limit_exceed' => 'Query limit exceeded.',
'system_error' => 'system error.',
'netgsm_general_error' => 'Netgsm responded an error :',
'no_record' => 'No record',
'job_id_not_found' => 'Job id not found',

'invalid_netgsm_message' => 'invalid netgsm message',
'method_not_allowed' => ':method method is not allowed',
'method_not_allowed' => ':method method is not allowed',
];
26 changes: 13 additions & 13 deletions resources/lang/tr/errors.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

return [
'message_too_long' => 'Mesaj metnindeki bir problemden dolayı gönderilemedi veya standart maksimum mesaj karakter sayısını geçtiniz.',
'start_date_incorrect' => 'Mesaj gönderim baslangıç tarihinde hata var. Sistem tarihi ile değiştirilip işleme alındı.',
'end_date_incorrect' => 'Mesaj gönderim sonlandırılma tarihinde hata var. Sistem tarihi ile değiştirilip işleme alındı.Bitiş tarihi başlangıç tarihinden küçük girilmiş ise, sistem bitiş tarihine içinde bulunduğu tarihe 24 saat ekler.',
'sender_incorrect' => 'Mesaj başlığınız (gönderici adınızın) sistemde tanımlı değil.',
'credentials_incorrect' => 'Geçersiz kullanıcı adı, şifre veya kullanıcınızın API erişim izni yok.',
'parameters_incorrect' => 'Hatalı sorgulama. Gönderdiğiniz parametrelerden birisi hatalı veya zorunlu alanlardan biri eksik.',
'receiver_incorrect' => 'Gönderilen numara hatalı.',
'message_too_long' => 'Mesaj metnindeki bir problemden dolayı gönderilemedi veya standart maksimum mesaj karakter sayısını geçtiniz.',
'start_date_incorrect' => 'Mesaj gönderim baslangıç tarihinde hata var. Sistem tarihi ile değiştirilip işleme alındı.',
'end_date_incorrect' => 'Mesaj gönderim sonlandırılma tarihinde hata var. Sistem tarihi ile değiştirilip işleme alındı.Bitiş tarihi başlangıç tarihinden küçük girilmiş ise, sistem bitiş tarihine içinde bulunduğu tarihe 24 saat ekler.',
'sender_incorrect' => 'Mesaj başlığınız (gönderici adınızın) sistemde tanımlı değil.',
'credentials_incorrect' => 'Geçersiz kullanıcı adı, şifre veya kullanıcınızın API erişim izni yok.',
'parameters_incorrect' => 'Hatalı sorgulama. Gönderdiğiniz parametrelerden birisi hatalı veya zorunlu alanlardan biri eksik.',
'receiver_incorrect' => 'Gönderilen numara hatalı.',
'otp_account_not_defined' => 'Hesabınızda OTP SMS Paketi tanımlı değildir.',
'query_limit_exceed' => 'Hesabınızda OTP SMS Paketi tanımlı değildir.',
'system_error' => 'Sistem hatası.',
'netgsm_general_error' => 'Netgsm hatalı cevap döndü :',
'no_record' => 'Kayıt yok',
'job_id_not_found' => 'Job id bulunamadı',
'query_limit_exceed' => 'Hesabınızda OTP SMS Paketi tanımlı değildir.',
'system_error' => 'Sistem hatası.',
'netgsm_general_error' => 'Netgsm hatalı cevap döndü :',
'no_record' => 'Kayıt yok',
'job_id_not_found' => 'Job id bulunamadı',

'invalid_netgsm_message' => 'Geçerli bir Netgsm mesajı değil',
'method_not_allowed' => ':method metoduna izin verilmiyor',
'method_not_allowed' => ':method metoduna izin verilmiyor',
];
4 changes: 2 additions & 2 deletions src/Balance/NetgsmAvailableCredit.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class NetgsmAvailableCredit extends NetgsmApiClient
* @var array
*/
protected $errorCodes = [
'30' => NetgsmErrors::CREDENTIALS_INCORRECT,
'40' => NetgsmErrors::NO_RECORD,
'30' => NetgsmErrors::CREDENTIALS_INCORRECT,
'40' => NetgsmErrors::NO_RECORD,
'100' => NetgsmErrors::SYSTEM_ERROR,
];

Expand Down
8 changes: 4 additions & 4 deletions src/Balance/NetgsmPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class NetgsmPackages extends NetgsmApiClient
* @var array
*/
protected $errorCodes = [
'30' => NetgsmErrors::CREDENTIALS_INCORRECT,
'40' => NetgsmErrors::NO_RECORD,
'30' => NetgsmErrors::CREDENTIALS_INCORRECT,
'40' => NetgsmErrors::NO_RECORD,
'100' => NetgsmErrors::SYSTEM_ERROR,
];

Expand All @@ -49,8 +49,8 @@ public function parseResponse(): array
$columns = array_filter(explode('|', $row));
$columns = array_map('trim', $columns);
$availablePackages[] = [
'amount' => (int) $columns[0],
'amountType' => $columns[1] ?? null,
'amount' => (int) $columns[0],
'amountType' => $columns[1] ?? null,
'packageType' => $columns[2] ?? null,
];
}
Expand Down
14 changes: 7 additions & 7 deletions src/Iys/AbstractNetgsmIys.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ abstract class AbstractNetgsmIys extends NetgsmApiClient
public function send(): string
{
$response = $this->client->request($this->method, $this->url, [
'headers' => [
'Content-Type' => 'application/json',
'headers' => [
'Content-Type' => 'application/json',
],
'json' => [
'header' => [
'username' => $this->credentials['user_code'],
'password' => $this->credentials['secret'],
'header' => [
'username' => $this->credentials['user_code'],
'password' => $this->credentials['secret'],
'brandCode' => $this->credentials['brand_code'],
],
'body' => [
'data' => $this->body,
'body' => [
'data' => $this->body,
],
],
]);
Expand Down
18 changes: 9 additions & 9 deletions src/Iys/Requests/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ public function setDefaults(array $defaults): self
public function body(): array
{
return [
'refid' => $this->refId ?? null,
'type' => $this->type ?? null,
'source' => $this->source ?? null,
'recipient' => $this->recipient ?? null,
'status' => $this->status ?? null,
'consentDate' => $this->consentDate ?? null,
'recipientType' => $this->recipientType ?? null,
'retailerCode' => $this->retailerCode ?? null,
'retailerAccess' => $this->retailerAccess ?? null,
'refid' => $this->refId ?? null,
'type' => $this->type ?? null,
'source' => $this->source ?? null,
'recipient' => $this->recipient ?? null,
'status' => $this->status ?? null,
'consentDate' => $this->consentDate ?? null,
'recipientType' => $this->recipientType ?? null,
'retailerCode' => $this->retailerCode ?? null,
'retailerAccess' => $this->retailerAccess ?? null,
];
}

Expand Down
8 changes: 4 additions & 4 deletions src/Iys/Requests/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public function setDefaults(array $defaults): self
public function body(): array
{
return [
'type' => $this->type ?? null,
'recipient' => $this->recipient ?? null,
'recipientType' => $this->recipientType ?? null,
'refid' => $this->refId ?? null,
'type' => $this->type ?? null,
'recipient' => $this->recipient ?? null,
'recipientType' => $this->recipientType ?? null,
'refid' => $this->refId ?? null,
];
}

Expand Down
4 changes: 2 additions & 2 deletions src/Netgsm.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public function sendSms(AbstractNetgsmMessage $netgsmMessage)
* Get sms status report between given dates.
*
* @param AbstractNetgsmReport $report
* @param $startDate
* @param $endDate
* @param $startDate
* @param $endDate
* @param array $filters
* @return Collection
*
Expand Down
4 changes: 2 additions & 2 deletions src/NetgsmApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function setCredentials(array $credentials): self
/**
* Sends requests to netgsm api endpoints with specified credentials.
*
* @param $method
* @param $url
* @param $method
* @param $url
* @param null $params
* @param array $headers
* @return string
Expand Down
2 changes: 1 addition & 1 deletion src/NetgsmServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function register()

$client = new Client([
'base_uri' => $config['defaults']['base_uri'],
'timeout' => $config['defaults']['timeout'],
'timeout' => $config['defaults']['timeout'],
]);

return new Netgsm($client, $config['credentials'], $config['defaults']);
Expand Down
8 changes: 4 additions & 4 deletions src/Report/AbstractNetgsmReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public function setPage(int $page): self
/**
* formats the value by specified type.
*
* @param $value
* @param $format
* @param $value
* @param $format
* @return int|string
*/
protected function formatValue($value, $format)
Expand Down Expand Up @@ -160,7 +160,7 @@ protected function formatValue($value, $format)
public function getReports(): Collection
{
$data = [
'page' => 1,
'page' => 1,
];

$data = array_merge($data, $this->filters);
Expand Down Expand Up @@ -190,7 +190,7 @@ public function getReports(): Collection
/**
* validates the response returned from netgsm report api.
*
* @param $response
* @param $response
* @return bool
*
* @throws ReportException
Expand Down
20 changes: 10 additions & 10 deletions src/Report/NetgsmSmsDetailReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class NetgsmSmsDetailReport extends AbstractNetgsmReport
* @var array
*/
protected $filters = [
'type' => 1,
'type' => 1,
'version' => 1,
'view' => 2,
'view' => 2,
];

/**
Expand All @@ -65,26 +65,26 @@ public function setBulkId($bulkId): AbstractNetgsmReport
/**
* Processes and returns a report line.
*
* @param $line
* @param $line
* @return array
*/
public function processRow($line): array
{
return [
'jobId' => (int) $line->msginfo->jobID,
'message' => (string) $line->msginfo->msg,
'jobId' => (int) $line->msginfo->jobID,
'message' => (string) $line->msginfo->msg,
'startDate' => (string) $line->datetime->startdate,
'endDate' => (string) $line->datetime->stopdate,
'status' => (string) $line->msginfo->state,
'total' => (string) $line->msginfo->total,
'header' => (string) $line->msginfo->msgheader,
'endDate' => (string) $line->datetime->stopdate,
'status' => (string) $line->msginfo->state,
'total' => (string) $line->msginfo->total,
'header' => (string) $line->msginfo->msgheader,
];
}

/**
* Parses the XML response returned from the Netgsm API service.
*
* @param $response
* @param $response
* @return Collection
*
* @throws \TarfinLabs\Netgsm\Exceptions\ReportException
Expand Down
42 changes: 21 additions & 21 deletions src/Report/NetgsmSmsReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class NetgsmSmsReport extends AbstractNetgsmReport
* @var array
*/
protected $filters = [
'type' => 2,
'type' => 2,
'version' => 2,
];

Expand All @@ -34,28 +34,28 @@ class NetgsmSmsReport extends AbstractNetgsmReport
*/
protected $columnMap = [
0 => [
'jobId' => 'integer',
'phone' => 'string',
'jobId' => 'integer',
'phone' => 'string',
'status' => 'integer',
],
1 => [
'jobId' => 'integer',
'phone' => 'string',
'jobId' => 'integer',
'phone' => 'string',
'status' => 'integer',
],
2 => [
'jobId' => 'integer',
'phone' => 'string',
'status' => 'integer',
'jobId' => 'integer',
'phone' => 'string',
'status' => 'integer',
'operatorCode' => 'integer',
'length' => 'integer',
'startDate' => 'date',
'startTime' => 'date',
'errorCode' => 'integer',
'length' => 'integer',
'startDate' => 'date',
'startTime' => 'date',
'errorCode' => 'integer',
],
3 => [
'jobId' => 'integer',
'phone' => 'string',
'jobId' => 'integer',
'phone' => 'string',
'status' => 'integer',
],
];
Expand All @@ -64,14 +64,14 @@ class NetgsmSmsReport extends AbstractNetgsmReport
* @var array
*/
protected $columns = [
'jobId' => null,
'phone' => null,
'status' => null,
'jobId' => null,
'phone' => null,
'status' => null,
'operatorCode' => null,
'length' => null,
'startDate' => null,
'startTime' => null,
'errorCode' => null,
'length' => null,
'startDate' => null,
'startTime' => null,
'errorCode' => null,
];

/**
Expand Down
18 changes: 9 additions & 9 deletions src/Sms/NetgsmOtpMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class NetgsmOtpMessage extends AbstractNetgsmMessage
protected $url = 'sms/send/otp';

protected $errorCodes = [
'20' => NetgsmErrors::MESSAGE_TOO_LONG,
'30' => NetgsmErrors::CREDENTIALS_INCORRECT,
'40' => NetgsmErrors::SENDER_INCORRECT,
'50' => NetgsmErrors::RECEIVER_INCORRECT,
'60' => NetgsmErrors::OTP_ACCOUNT_NOT_DEFINED,
'70' => NetgsmErrors::PARAMETERS_INCORRECT,
'80' => NetgsmErrors::QUERY_LIMIT_EXCEED,
'20' => NetgsmErrors::MESSAGE_TOO_LONG,
'30' => NetgsmErrors::CREDENTIALS_INCORRECT,
'40' => NetgsmErrors::SENDER_INCORRECT,
'50' => NetgsmErrors::RECEIVER_INCORRECT,
'60' => NetgsmErrors::OTP_ACCOUNT_NOT_DEFINED,
'70' => NetgsmErrors::PARAMETERS_INCORRECT,
'80' => NetgsmErrors::QUERY_LIMIT_EXCEED,
'100' => NetgsmErrors::SYSTEM_ERROR,
];

Expand Down Expand Up @@ -69,8 +69,8 @@ protected function mappers(): array
{
return [
'msgheader' => $this->header ?? $this->defaults['header'],
'msg' => $this->message,
'no' => is_array($this->recipients) ? $this->recipients[0] : $this->recipients,
'msg' => $this->message,
'no' => is_array($this->recipients) ? $this->recipients[0] : $this->recipients,
];
}
}
Loading

0 comments on commit 64481ea

Please sign in to comment.