Skip to content

Commit

Permalink
PSR-2 compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DerMika committed Sep 14, 2016
1 parent 8afee56 commit 3c6bfbf
Show file tree
Hide file tree
Showing 130 changed files with 433 additions and 513 deletions.
1 change: 0 additions & 1 deletion src/Amadeus/Client/InvalidMessageException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@
*/
class InvalidMessageException extends Exception
{

}
3 changes: 2 additions & 1 deletion src/Amadeus/Client/Params.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public function __construct($params = [])
* @param array $params
* @return void
*/
protected function loadFromArray(array $params) {
protected function loadFromArray(array $params)
{
$this->loadRequestCreator($params);
$this->loadSessionHandler($params);
$this->loadResponseHandler($params);
Expand Down
3 changes: 2 additions & 1 deletion src/Amadeus/Client/Params/AuthParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public function __construct($params = [])
* @param array $params
* @return void
*/
protected function loadFromArray(array $params) {
protected function loadFromArray(array $params)
{
if (count($params) > 0) {
$this->officeId = $params['officeId'];
$this->originatorTypeCode = (isset($params['originatorTypeCode'])) ? $params['originatorTypeCode'] : "U";
Expand Down
3 changes: 2 additions & 1 deletion src/Amadeus/Client/Params/SessionHandlerParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public function __construct($params = [])
* @param array $params
* @return void
*/
protected function loadFromArray(array $params) {
protected function loadFromArray(array $params)
{
if (count($params) > 0) {
if (isset($params['soapHeaderVersion'])) {
$this->soapHeaderVersion = $params['soapHeaderVersion'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public function __construct(RequestCreatorParams $params);
* @return mixed
*/
public function createRequest($messageName, RequestOptionsInterface $params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\RequestOptions\Air\RetrieveSeatMap;

use Amadeus\Client\LoadParamsFromArray;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ class Itinerary extends LoadParamsFromArray
* @var Segment[]
*/
public $segments;

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ class AirSellFromRecommendationOptions extends Base
* @var Air\SellFromRecommendation\Itinerary[]
*/
public $itinerary = [];

}
1 change: 0 additions & 1 deletion src/Amadeus/Client/RequestOptions/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@
*/
abstract class Base extends LoadParamsFromArray implements RequestOptionsInterface
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@
*/
class PricingOptions extends FarePricePnrWithBookingClassOptions
{

}
2 changes: 1 addition & 1 deletion src/Amadeus/Client/RequestOptions/Fare/MPPassenger.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
class MPPassenger extends LoadParamsFromArray
{
CONST TYPE_ADULT = "ADT";
const TYPE_ADULT = "ADT";

const TYPE_CHILD = "CH";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\RequestOptions\Fare;

use Amadeus\Client\LoadParamsFromArray;

/**
Expand All @@ -32,6 +33,7 @@
class PricePnrBcFareBasis extends LoadParamsFromArray
{
const SEGREFTYPE_SEGMENT = 'S';

const SEGREFTYPE_CONNECTING = 'X';

/**
Expand Down
1 change: 1 addition & 0 deletions src/Amadeus/Client/RequestOptions/MiniRule/Pricing.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\RequestOptions\MiniRule;

use Amadeus\Client\LoadParamsFromArray;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Amadeus/Client/RequestOptions/Offer/PassengerDef.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ class PassengerDef extends LoadParamsFromArray
* @var int
*/
public $passengerTattoo;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ class FrequentFlyer extends Element
* @var string
*/
public $number;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@

namespace Amadeus\Client\RequestOptions\Pnr\Element;

use Amadeus\Client\RequestOptions\Pnr\Element;

/**
* OtherServiceInfo
*
* @package Amadeus\Client\RequestOptions\Pnr\Element
* @author Dieter Devlieghere <dieter.devlieghere@benelux.amadeus.com>
*/
class OtherServiceInfo
class OtherServiceInfo extends Element
{

//TODO: Not yet implemented
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ class Ticketing extends Element
* @var Queue
*/
public $ticketQueue;

}
34 changes: 0 additions & 34 deletions src/Amadeus/Client/RequestOptions/Pnr/Passenger.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Amadeus/Client/RequestOptions/Pnr/Segment/Hotel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@
*/
class Hotel extends Segment
{

}
1 change: 0 additions & 1 deletion src/Amadeus/Client/RequestOptions/Pnr/Traveller.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Traveller extends LoadParamsFromArray

const TRAV_TYPE_INFANT = "INF";


/**
* Unique sequence number for traveller
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ class PnrAddMultiElementsOptions extends PnrAddMultiElementsBase
* @var Pnr\Element[]
*/
public $elements = [];
}
}
2 changes: 1 addition & 1 deletion src/Amadeus/Client/RequestOptions/PnrRetrieveOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ class PnrRetrieveOptions extends Base
* @var string
*/
public $recordLocator;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@
*/
interface RequestOptionsInterface
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\RequestOptions;

use Amadeus\Client\Params\AuthParams;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@
*/
class SecuritySignOutOptions extends Base
{

}
1 change: 0 additions & 1 deletion src/Amadeus/Client/RequestOptions/Ticket/Pricing.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

use Amadeus\Client\LoadParamsFromArray;


/**
* Pricing
*
Expand Down
4 changes: 2 additions & 2 deletions src/Amadeus/Client/ResponseHandler/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ protected function analyzeGenericOfferResponse($response)
$msgNode = $domXpath->query('//m:errorsDescription/m:errorWarningDescription/m:freeText')->item(0);

if ($msgNode instanceof \DOMNode) {
if (trim($msgNode->nodeValue) === "OFFER CONFIRMED SUCCESSFULLY" || trim($msgNode->nodeValue) === "OFFER VERIFIED SUCCESSFULLY" ) {
if (trim($msgNode->nodeValue) === "OFFER CONFIRMED SUCCESSFULLY" || trim($msgNode->nodeValue) === "OFFER VERIFIED SUCCESSFULLY") {
$analyzeResponse->messages[] = new Result\NotOk(
0,
trim($msgNode->nodeValue)
Expand Down Expand Up @@ -915,7 +915,7 @@ protected function makeMessageFromMessagesNodeList($errorTextNodeList)
return implode(
' - ',
array_map(
function($item) {
function ($item) {
return trim($item->nodeValue);
},
iterator_to_array($errorTextNodeList)
Expand Down
12 changes: 6 additions & 6 deletions src/Amadeus/Client/Session/Handler/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ abstract class Base implements HandlerInterface, LoggerAwareInterface
* @var array
*/
protected $soapClientOptions = [
'trace' => 1,
'exceptions' => 1,
'soap_version' => SOAP_1_1
'trace' => 1,
'exceptions' => 1,
'soap_version' => SOAP_1_1
];

/**
Expand Down Expand Up @@ -289,7 +289,7 @@ public function sendMessage($messageName, Client\Struct\BaseWsMessage $messageBo
* @param string $messageName
* @param array $messageOptions
*/
protected abstract function prepareForNextMessage($messageName, $messageOptions);
abstract protected function prepareForNextMessage($messageName, $messageOptions);

/**
* Handles post message actions
Expand All @@ -301,7 +301,7 @@ protected abstract function prepareForNextMessage($messageName, $messageOptions)
* @param array $messageOptions
* @param mixed $result
*/
protected abstract function handlePostMessage($messageName, $lastResponse, $messageOptions, $result);
abstract protected function handlePostMessage($messageName, $lastResponse, $messageOptions, $result);

/**
* Get the last raw XML message that was sent out
Expand Down Expand Up @@ -547,7 +547,7 @@ protected function getSoapClient($msgName)
* @param string $wsdlId
* @return \SoapClient
*/
protected abstract function initSoapClient($wsdlId);
abstract protected function initSoapClient($wsdlId);

/**
* Get Messages & Versions from an imported WSDL file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@
*/
class InvalidSessionException extends Exception
{

}
10 changes: 5 additions & 5 deletions src/Amadeus/Client/Session/Handler/SoapHeader4.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected function createSoapHeaders($sessionData, $params, $messageName, $messa
$password = base64_decode($params->authParams->passwordData);
$creation = new \DateTime('now', new \DateTimeZone('UTC'));
$t = microtime(true);
$micro = sprintf("%03d",($t - floor($t)) * 1000);
$micro = sprintf("%03d", ($t - floor($t)) * 1000);
$creationString = $this->createDateTimeStringForAuth($creation, $micro);
$messageNonce = $this->generateUniqueNonce($params->authParams->nonceBase, $creationString);
$encodedNonce = base64_encode($messageNonce);
Expand Down Expand Up @@ -275,7 +275,7 @@ protected function createSoapHeaders($sessionData, $params, $messageName, $messa
)
)
);
} else if ($stateful === true) {
} elseif ($stateful === true) {
//We are authenticated and stateful: provide session header to continue or terminate session
$statusCode =
(isset($messageOptions['endSession']) && $messageOptions['endSession'] === true) ?
Expand Down Expand Up @@ -354,9 +354,9 @@ protected function generateGuid()

$uuid = substr($charId, 0, 8) . $hyphen
.substr($charId, 8, 4) . $hyphen
.substr($charId,12, 4) . $hyphen
.substr($charId,16, 4) . $hyphen
.substr($charId,20,12);
.substr($charId, 12, 4) . $hyphen
.substr($charId, 16, 4) . $hyphen
.substr($charId, 20, 12);

return $uuid;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@
*/
class UnsupportedOperationException extends Exception
{

}
4 changes: 2 additions & 2 deletions src/Amadeus/Client/SoapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public function __construct($wsdl, $options, Log\LoggerInterface $logger = null)
*/
public function __doRequest($request, $location, $action, $version, $oneWay = null)
{
if (!extension_loaded ('xsl')) {
if (!extension_loaded('xsl')) {
throw new Exception('PHP XSL extension is not enabled.');
}

$newRequest = $this->transformIncomingRequest( $request);
$newRequest = $this->transformIncomingRequest($request);

return parent::__doRequest($newRequest, $location, $action, $version, $oneWay);
}
Expand Down
1 change: 1 addition & 0 deletions src/Amadeus/Client/Struct/Air/FlightInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\Struct\Air;

use Amadeus\Client\RequestOptions\AirFlightInfoOptions;
use Amadeus\Client\Struct\BaseWsMessage;

Expand Down
1 change: 1 addition & 0 deletions src/Amadeus/Client/Struct/Air/GeneralFlightInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\Struct\Air;

use Amadeus\Client\RequestOptions\AirFlightInfoOptions;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Amadeus/Client/Struct/Air/MultiAvailability.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@
*/
class MultiAvailability extends BaseWsMessage
{

}
1 change: 0 additions & 1 deletion src/Amadeus/Client/Struct/Air/OriginDestinationDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@
*/
class OriginDestinationDetails extends AddMultiElementsOriginDestination
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\Struct\Air\RetrieveSeatMap;

use Amadeus\Client\RequestOptions\Air\RetrieveSeatMap\FrequentFlyer;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

namespace Amadeus\Client\Struct\Air\RetrieveSeatMap;

use Amadeus\Client\RequestOptions\Air\RetrieveSeatMap\FrequentFlyer;

/**
Expand Down
Loading

0 comments on commit 3c6bfbf

Please sign in to comment.