Skip to content

Commit

Permalink
apply php-cs-fixer @psr2
Browse files Browse the repository at this point in the history
  • Loading branch information
alhoqbani committed Apr 13, 2018
1 parent 3f73aa4 commit ba66414
Show file tree
Hide file tree
Showing 60 changed files with 2,744 additions and 276 deletions.
72 changes: 72 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$header = <<<'EOF'
This file is part of SMSA WebService package.
(c) Hamoud Alhoqbani <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

$finder = PhpCsFixer\Finder::create()
->exclude('tests')
->in(__DIR__);

$rules = [
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => false,
],
'blank_line_before_return' => true,
'cast_spaces' => true,
'concat_space' => [
'spacing' => 'none',
],
'ereg_to_preg' => true,
'method_separation' => true,
'no_blank_lines_after_phpdoc' => true,
'no_extra_consecutive_blank_lines' => true,
'no_short_bool_cast' => true,
'no_unneeded_control_parentheses' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'phpdoc_align' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => [
'type' => 'var',
],
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'self_accessor' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'line_ending' => true,
'blank_line_after_namespace' => true,
'no_unused_imports' => true,
'header_comment' => ['header' => $header],
'yoda_style' => true,
];

return Config::create()->setRules($rules)
->setFinder(Finder::create()->in(__DIR__))
->setUsingCache(true)
->setRiskyAllowed(true);
8 changes: 7 additions & 1 deletion src/Exceptions/FailedResponse.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?php

/*
* This file is part of SMSA WebService package.
* (c) Hamoud Alhoqbani <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Alhoqbani\SMSAWebService\Exceptions;

class FailedResponse extends SMSAWebServiceException
{

}
8 changes: 7 additions & 1 deletion src/Exceptions/RequestError.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?php

/*
* This file is part of SMSA WebService package.
* (c) Hamoud Alhoqbani <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Alhoqbani\SMSAWebService\Exceptions;

class RequestError extends SMSAWebServiceException
{

}
8 changes: 7 additions & 1 deletion src/Exceptions/SMSAWebServiceException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?php

/*
* This file is part of SMSA WebService package.
* (c) Hamoud Alhoqbani <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Alhoqbani\SMSAWebService\Exceptions;

abstract class SMSAWebServiceException extends \Exception
{

}
30 changes: 20 additions & 10 deletions src/Models/Customer.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<?php

namespace Alhoqbani\SmsaWebService\Models;
/*
* This file is part of SMSA WebService package.
* (c) Hamoud Alhoqbani <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Alhoqbani\SmsaWebService\Models;

class Customer
{

/**
* Customer Name.
* Cannot be Null
Expand Down Expand Up @@ -47,9 +53,9 @@ class Customer
* @var string
*/
private $country;

/** Optional Properties */

/**
* Address Line 2.
* Either of Address fields to be filled duly
Expand Down Expand Up @@ -98,7 +104,7 @@ class Customer
* @var string
*/
private $email = '';

/**
* Customer constructor.
*
Expand All @@ -109,12 +115,16 @@ class Customer
* @param string $country
*/
public function __construct(
string $name, string $mobile, string $addressLine1, string $city, string $country = 'KSA'
string $name,
string $mobile,
string $addressLine1,
string $city,
string $country = 'KSA'
) {
$this->name = $name;
$this->mobile = $mobile;
$this->name = $name;
$this->mobile = $mobile;
$this->addressLine1 = $addressLine1;
$this->city = $city;
$this->country = $country;
$this->city = $city;
$this->country = $country;
}
}
29 changes: 18 additions & 11 deletions src/Models/Shipment.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<?php

namespace Alhoqbani\SMSAWebService\Models;
/*
* This file is part of SMSA WebService package.
* (c) Hamoud Alhoqbani <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Alhoqbani\SMSAWebService\Models;

class Shipment
{

const TYPE_DLV = 'DLV';
const TYPE_VAL = 'VAL';
const TYPE_HAL = 'HAL';
const TYPE_BLT = 'BLT';

/**
* Unique Number for each day (Required).
* Cannot be Null
Expand Down Expand Up @@ -42,9 +47,9 @@ class Shipment
* @var int
*/
private $weight = 0;

/** Optional Properties */

/**
* Id.
* Optional
Expand Down Expand Up @@ -83,9 +88,9 @@ class Shipment
* @var string
*/
private $gpsPoints = '';

/** Related Objects */

/**
* Customer associated with the shipment.
*
Expand All @@ -98,7 +103,7 @@ class Shipment
* @var \Alhoqbani\SMSAWebService\Models\Shipper
*/
private $shipper;

/**
* Shipment constructor.
*
Expand All @@ -107,10 +112,12 @@ class Shipment
* @param \Alhoqbani\SMSAWebService\Models\Customer $customer
*/
public function __construct(
string $referenceNumber, string $type = self::TYPE_DLV, Customer $customer
string $referenceNumber,
string $type = self::TYPE_DLV,
Customer $customer
) {
$this->referenceNumber = $referenceNumber;
$this->type = $type;
$this->customer = $customer;
$this->type = $type;
$this->customer = $customer;
}
}
27 changes: 13 additions & 14 deletions src/Models/Shipper.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
/**
* Created by PhpStorm.
* User: hamoud
* Date: 4/7/18
* Time: 1:10 AM

/*
* This file is part of SMSA WebService package.
* (c) Hamoud Alhoqbani <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Alhoqbani\SmsaWebService\Models;


class Shipper
{

/**
* Shipper Name.
* Mandatory
Expand Down Expand Up @@ -68,8 +68,7 @@ class Shipper
* @var string
*/
private $phone;



/**
* Shipper constructor.
*
Expand All @@ -90,12 +89,12 @@ public function __construct(
string $country,
string $phone
) {
$this->name = $name;
$this->contactName = $contactName;
$this->name = $name;
$this->contactName = $contactName;
$this->addressLine1 = $addressLine1;
$this->addressLine2 = $addressLine2;
$this->city = $city;
$this->country = $country;
$this->phone = $phone;
$this->city = $city;
$this->country = $country;
$this->phone = $phone;
}
}
7 changes: 7 additions & 0 deletions src/Response/SMSAResponse.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file is part of SMSA WebService package.
* (c) Hamoud Alhoqbani <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Alhoqbani\SMSAWebService\Response;

class SMSAResponse
Expand Down
Loading

0 comments on commit ba66414

Please sign in to comment.