Skip to content

Commit ba66414

Browse files
committed
apply php-cs-fixer @psr2
1 parent 3f73aa4 commit ba66414

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2744
-276
lines changed

.php_cs.dist

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$header = <<<'EOF'
7+
This file is part of SMSA WebService package.
8+
(c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
9+
For the full copyright and license information, please view the LICENSE
10+
file that was distributed with this source code.
11+
EOF;
12+
13+
$finder = PhpCsFixer\Finder::create()
14+
->exclude('tests')
15+
->in(__DIR__);
16+
17+
$rules = [
18+
'@PSR2' => true,
19+
'array_syntax' => [
20+
'syntax' => 'short',
21+
],
22+
'binary_operator_spaces' => [
23+
'align_double_arrow' => true,
24+
'align_equals' => false,
25+
],
26+
'blank_line_before_return' => true,
27+
'cast_spaces' => true,
28+
'concat_space' => [
29+
'spacing' => 'none',
30+
],
31+
'ereg_to_preg' => true,
32+
'method_separation' => true,
33+
'no_blank_lines_after_phpdoc' => true,
34+
'no_extra_consecutive_blank_lines' => true,
35+
'no_short_bool_cast' => true,
36+
'no_unneeded_control_parentheses' => true,
37+
'no_whitespace_in_blank_line' => true,
38+
'ordered_imports' => true,
39+
'phpdoc_align' => true,
40+
'phpdoc_indent' => true,
41+
'phpdoc_inline_tag' => true,
42+
'phpdoc_no_access' => true,
43+
'phpdoc_no_alias_tag' => [
44+
'type' => 'var',
45+
],
46+
'phpdoc_no_package' => true,
47+
'phpdoc_order' => true,
48+
'phpdoc_scalar' => true,
49+
'phpdoc_separation' => true,
50+
'phpdoc_to_comment' => true,
51+
'phpdoc_trim' => true,
52+
'phpdoc_types' => true,
53+
'phpdoc_var_without_name' => true,
54+
'self_accessor' => true,
55+
'single_quote' => true,
56+
'space_after_semicolon' => true,
57+
'standardize_not_equals' => true,
58+
'ternary_operator_spaces' => true,
59+
'trailing_comma_in_multiline_array' => true,
60+
'trim_array_spaces' => true,
61+
'unary_operator_spaces' => true,
62+
'line_ending' => true,
63+
'blank_line_after_namespace' => true,
64+
'no_unused_imports' => true,
65+
'header_comment' => ['header' => $header],
66+
'yoda_style' => true,
67+
];
68+
69+
return Config::create()->setRules($rules)
70+
->setFinder(Finder::create()->in(__DIR__))
71+
->setUsingCache(true)
72+
->setRiskyAllowed(true);

src/Exceptions/FailedResponse.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of SMSA WebService package.
5+
* (c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace Alhoqbani\SMSAWebService\Exceptions;
411

512
class FailedResponse extends SMSAWebServiceException
613
{
7-
814
}

src/Exceptions/RequestError.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of SMSA WebService package.
5+
* (c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace Alhoqbani\SMSAWebService\Exceptions;
411

512
class RequestError extends SMSAWebServiceException
613
{
7-
814
}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of SMSA WebService package.
5+
* (c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace Alhoqbani\SMSAWebService\Exceptions;
411

512
abstract class SMSAWebServiceException extends \Exception
613
{
7-
814
}

src/Models/Customer.php

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<?php
22

3-
namespace Alhoqbani\SmsaWebService\Models;
3+
/*
4+
* This file is part of SMSA WebService package.
5+
* (c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
49

10+
namespace Alhoqbani\SmsaWebService\Models;
511

612
class Customer
713
{
8-
14+
915
/**
1016
* Customer Name.
1117
* Cannot be Null
@@ -47,9 +53,9 @@ class Customer
4753
* @var string
4854
*/
4955
private $country;
50-
56+
5157
/** Optional Properties */
52-
58+
5359
/**
5460
* Address Line 2.
5561
* Either of Address fields to be filled duly
@@ -98,7 +104,7 @@ class Customer
98104
* @var string
99105
*/
100106
private $email = '';
101-
107+
102108
/**
103109
* Customer constructor.
104110
*
@@ -109,12 +115,16 @@ class Customer
109115
* @param string $country
110116
*/
111117
public function __construct(
112-
string $name, string $mobile, string $addressLine1, string $city, string $country = 'KSA'
118+
string $name,
119+
string $mobile,
120+
string $addressLine1,
121+
string $city,
122+
string $country = 'KSA'
113123
) {
114-
$this->name = $name;
115-
$this->mobile = $mobile;
124+
$this->name = $name;
125+
$this->mobile = $mobile;
116126
$this->addressLine1 = $addressLine1;
117-
$this->city = $city;
118-
$this->country = $country;
127+
$this->city = $city;
128+
$this->country = $country;
119129
}
120130
}

src/Models/Shipment.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
<?php
22

3-
namespace Alhoqbani\SMSAWebService\Models;
3+
/*
4+
* This file is part of SMSA WebService package.
5+
* (c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
49

10+
namespace Alhoqbani\SMSAWebService\Models;
511

612
class Shipment
713
{
8-
914
const TYPE_DLV = 'DLV';
1015
const TYPE_VAL = 'VAL';
1116
const TYPE_HAL = 'HAL';
1217
const TYPE_BLT = 'BLT';
13-
18+
1419
/**
1520
* Unique Number for each day (Required).
1621
* Cannot be Null
@@ -42,9 +47,9 @@ class Shipment
4247
* @var int
4348
*/
4449
private $weight = 0;
45-
50+
4651
/** Optional Properties */
47-
52+
4853
/**
4954
* Id.
5055
* Optional
@@ -83,9 +88,9 @@ class Shipment
8388
* @var string
8489
*/
8590
private $gpsPoints = '';
86-
91+
8792
/** Related Objects */
88-
93+
8994
/**
9095
* Customer associated with the shipment.
9196
*
@@ -98,7 +103,7 @@ class Shipment
98103
* @var \Alhoqbani\SMSAWebService\Models\Shipper
99104
*/
100105
private $shipper;
101-
106+
102107
/**
103108
* Shipment constructor.
104109
*
@@ -107,10 +112,12 @@ class Shipment
107112
* @param \Alhoqbani\SMSAWebService\Models\Customer $customer
108113
*/
109114
public function __construct(
110-
string $referenceNumber, string $type = self::TYPE_DLV, Customer $customer
115+
string $referenceNumber,
116+
string $type = self::TYPE_DLV,
117+
Customer $customer
111118
) {
112119
$this->referenceNumber = $referenceNumber;
113-
$this->type = $type;
114-
$this->customer = $customer;
120+
$this->type = $type;
121+
$this->customer = $customer;
115122
}
116123
}

src/Models/Shipper.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: hamoud
5-
* Date: 4/7/18
6-
* Time: 1:10 AM
2+
3+
/*
4+
* This file is part of SMSA WebService package.
5+
* (c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
78
*/
89

910
namespace Alhoqbani\SmsaWebService\Models;
1011

11-
1212
class Shipper
1313
{
14-
14+
1515
/**
1616
* Shipper Name.
1717
* Mandatory
@@ -68,8 +68,7 @@ class Shipper
6868
* @var string
6969
*/
7070
private $phone;
71-
72-
71+
7372
/**
7473
* Shipper constructor.
7574
*
@@ -90,12 +89,12 @@ public function __construct(
9089
string $country,
9190
string $phone
9291
) {
93-
$this->name = $name;
94-
$this->contactName = $contactName;
92+
$this->name = $name;
93+
$this->contactName = $contactName;
9594
$this->addressLine1 = $addressLine1;
9695
$this->addressLine2 = $addressLine2;
97-
$this->city = $city;
98-
$this->country = $country;
99-
$this->phone = $phone;
96+
$this->city = $city;
97+
$this->country = $country;
98+
$this->phone = $phone;
10099
}
101100
}

src/Response/SMSAResponse.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of SMSA WebService package.
5+
* (c) Hamoud Alhoqbani <h.alhoqbani@gmail.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace Alhoqbani\SMSAWebService\Response;
411

512
class SMSAResponse

0 commit comments

Comments
 (0)