Skip to content

Commit

Permalink
cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikzogg committed Sep 7, 2013
1 parent c28eba9 commit e46bfcf
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 38 deletions.
12 changes: 6 additions & 6 deletions src/Payment/Saferpay/Data/AbstractBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ public function addSubObject(SubBaseInterface $subBase)
}

/**
* @param string $name
* @param array $arguments
* @param string $name
* @param array $arguments
* @return mixed
* @throws \ErrorException
*/
public function __call($name, $arguments)
{
foreach($this->subObjectBags as $subObjectBag) {
if($subObjectBag->getReflection()->hasMethod($name)) {
foreach ($this->subObjectBags as $subObjectBag) {
if ($subObjectBag->getReflection()->hasMethod($name)) {
$methodReflection = $subObjectBag->getReflection()->getMethod($name);
if($methodReflection->isPublic()) {
if ($methodReflection->isPublic()) {
return $methodReflection->invokeArgs($subObjectBag->getObject(), $arguments);
} else {
throw new \ErrorException("Method {$name} is not public on {$subObjectBag->getReflection()->getName()}");
Expand All @@ -65,4 +65,4 @@ public function getInvalidData()
{
return $this->keyValueBag->getInvalidData();
}
}
}
6 changes: 3 additions & 3 deletions src/Payment/Saferpay/Data/AbstractGetSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ abstract class AbstractGetSet
protected function registerValidationKeys()
{
$reflectionClass = new \ReflectionClass($this);
foreach($reflectionClass->getConstants() as $constName => $constValue) {
if(SaferpayConditionConverter::isCondition($constValue)) {
foreach ($reflectionClass->getConstants() as $constName => $constValue) {
if (SaferpayConditionConverter::isCondition($constValue)) {
$this->keyValueBag->addValidationKey($constName, $constValue);
}
}
Expand All @@ -38,4 +38,4 @@ protected function get($offset)
{
return $this->keyValueBag[$offset];
}
}
}
23 changes: 12 additions & 11 deletions src/Payment/Saferpay/Data/KeyValueBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct()
}

/**
* @param mixed $offset
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
Expand All @@ -50,7 +50,7 @@ public function offsetExists($offset)
}

/**
* @param mixed $offset
* @param mixed $offset
* @return mixed|null
*/
public function offsetGet($offset)
Expand All @@ -59,21 +59,22 @@ public function offsetGet($offset)
}

/**
* @param mixed $offset
* @param mixed $value
* @param mixed $offset
* @param mixed $value
* @throws \InvalidArgumentException
*/
public function offsetSet($offset, $value)
{
if(!is_scalar($value)) {
if (!is_scalar($value)) {
throw new \InvalidArgumentException("Only scalar values (integer, float, string or boolean) are allowed!");
}

if(array_key_exists($offset, $this->validKeys)) {
if (array_key_exists($offset, $this->validKeys)) {
$condition = $this->validKeys[$offset];
if(preg_match(SaferpayConditionConverter::toRegex($condition), $value) === 1) {
if (preg_match(SaferpayConditionConverter::toRegex($condition), $value) === 1) {
$this->data[$offset] = $value;
$this->keys = array_keys($this->data);

return;
}
}
Expand All @@ -86,7 +87,7 @@ public function offsetSet($offset, $value)
*/
public function offsetUnset($offset)
{
if(in_array($offset, $this->keys)) {
if (in_array($offset, $this->keys)) {
unset($this->keys[array_search($offset, $this->keys)]);
$this->keys = array_keys($this->data);
}
Expand All @@ -97,7 +98,7 @@ public function offsetUnset($offset)
*/
public function current()
{
if(array_key_exists($this->pointer, $this->keys)) {
if (array_key_exists($this->pointer, $this->keys)) {
return $this->data[$this->keys[$this->pointer]];
}

Expand All @@ -114,7 +115,7 @@ public function next()
*/
public function key()
{
if(array_key_exists($this->pointer, $this->keys)) {
if (array_key_exists($this->pointer, $this->keys)) {
return $this->keys[$this->pointer];
}

Expand Down Expand Up @@ -161,4 +162,4 @@ public function getInvalidData()
{
return $this->invalidData;
}
}
}
2 changes: 1 addition & 1 deletion src/Payment/Saferpay/Data/PayConfirmParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public function getMpiTxCavv()
}

/**
* @param string $mpi_mpi_xid
* @param string $mpi_mpi_xid
* @return mixed
* @deprecated
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Payment/Saferpay/Data/PayConfirmParameterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function setMpiliabilityshift($mpi_liabilityshift);
public function getMpiliabilityshift();

/**
* @param string $mpi_tx_cavv
* @param string $mpi_tx_cavv
* @return mixed
* @deprecated
*/
Expand All @@ -346,7 +346,7 @@ public function setMpiTxCavv($mpi_tx_cavv);
public function getMpiTxCavv();

/**
* @param string $mpi_xid
* @param string $mpi_xid
* @return mixed
* @deprecated
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Payment/Saferpay/Data/SubBaseBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ public function getReflection()
{
return $this->reflection;
}
}
}
2 changes: 1 addition & 1 deletion src/Payment/Saferpay/Data/SubBaseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
interface SubBaseInterface
{
public function setValueBag(KeyValueBag $valueBag);
}
}
27 changes: 14 additions & 13 deletions src/Payment/Saferpay/Saferpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function getLogger()
}

/**
* @param PayInitParameterInterface $payInitParameter
* @param PayInitParameterInterface $payInitParameter
* @return mixed
*/
public function createPayInit(PayInitParameterInterface $payInitParameter)
Expand All @@ -86,12 +86,12 @@ public function createPayInit(PayInitParameterInterface $payInitParameter)
/**
* @param $xml
* @param $signature
* @param PayConfirmParameterInterface $payConfirmParameter
* @param PayConfirmParameterInterface $payConfirmParameter
* @return PayConfirmParameterInterface
*/
public function verifyPayConfirm($xml, $signature, PayConfirmParameterInterface $payConfirmParameter = null)
{
if(is_null($payConfirmParameter)) {
if (is_null($payConfirmParameter)) {
$payConfirmParameter = new PayConfirmParameter();
}

Expand All @@ -105,11 +105,11 @@ public function verifyPayConfirm($xml, $signature, PayConfirmParameterInterface
}

/**
* @param PayConfirmParameter $payConfirmParameter
* @param string $action
* @param null $spPassword
* @param PayCompleteParameterInterface $payCompleteParameter
* @param PayCompleteResponseInterface $payCompleteResponse
* @param PayConfirmParameter $payConfirmParameter
* @param string $action
* @param null $spPassword
* @param PayCompleteParameterInterface $payCompleteParameter
* @param PayCompleteResponseInterface $payCompleteResponse
* @return PayCompleteResponse|PayCompleteResponseInterface
* @throws Exception\NoPasswordGivenException
* @throws \Exception
Expand All @@ -126,7 +126,7 @@ public function payCompleteV2(
throw new \Exception('Saferpay: call confirm before complete!');
}

if(is_null($payCompleteParameter)) {
if (is_null($payCompleteParameter)) {
$payCompleteParameter = new PayCompleteParameter();
}

Expand All @@ -139,13 +139,13 @@ public function payCompleteV2(

if ($this->isTestAccountId($payCompleteParameter->getAccountid())) {
$payCompleteParameterData = array_merge($payCompleteParameterData, array('spPassword' => PayInitParameterInterface::SAFERPAYTESTACCOUNT_SPPASSWORD));
} else if ($action != PayCompleteParameterInterface::ACTION_SETTLEMENT && !$spPassword) {
} elseif ($action != PayCompleteParameterInterface::ACTION_SETTLEMENT && !$spPassword) {
throw new NoPasswordGivenException();
}

$response = $this->request($payCompleteParameter->getRequestUrl(), $payCompleteParameterData);

if(is_null($payCompleteResponse)) {
if (is_null($payCompleteResponse)) {
$payCompleteResponse = new PayCompleteResponse();
}

Expand Down Expand Up @@ -202,20 +202,21 @@ protected function fillDataFromXML(AbstractBase $data, $xml)

$method = 'set';
$offsetParts = explode('_', $attribute->nodeName);
foreach($offsetParts as $offsetPart) {
foreach ($offsetParts as $offsetPart) {
$method .= ucfirst(strtolower($offsetPart));
}
$data->$method($attribute->nodeValue);
}
}

/**
* @param string $accountId
* @param string $accountId
* @return bool
*/
protected function isTestAccountId($accountId)
{
$prefix = PayInitParameterInterface::TESTACCOUNT_PREFIX;

return substr($accountId, 0, strlen($prefix)) === $prefix;
}
}

0 comments on commit e46bfcf

Please sign in to comment.