From 09e591158e636e13bb74732d1004cbb743fee2a2 Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Fri, 18 Jan 2013 23:02:24 +0100 Subject: [PATCH 01/11] Fixed prepared statement params --- src/Adapter/DbTable.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Adapter/DbTable.php b/src/Adapter/DbTable.php index 25bcf8a..087c9ee 100644 --- a/src/Adapter/DbTable.php +++ b/src/Adapter/DbTable.php @@ -439,11 +439,17 @@ protected function _authenticateCreateSelect() */ protected function _authenticateQuerySelect(DbSelect $dbSelect) { + $params = array($this->identity); + + if (!is_callable($this->credentialValidationCallback)) { + array_unshift($params, $this->credential); + } + $statement = $this->zendDb->createStatement(); $dbSelect->prepareStatement($this->zendDb, $statement); $resultSet = new ResultSet(); try { - $resultSet->initialize($statement->execute(array($this->credential, $this->identity))); + $resultSet->initialize($statement->execute($params)); $resultIdentities = $resultSet->toArray(); } catch (\Exception $e) { throw new Exception\RuntimeException( @@ -500,14 +506,15 @@ protected function _authenticateValidateResult($resultIdentity) $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; return $this->_authenticateCreateAuthResult(); } - } - if ($resultIdentity['zend_auth_credential_match'] != '1') { - $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID; - $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; - return $this->_authenticateCreateAuthResult(); - } + } else { + if ($resultIdentity['zend_auth_credential_match'] != '1') { + $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID; + $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; + return $this->_authenticateCreateAuthResult(); + } - unset($resultIdentity['zend_auth_credential_match']); + unset($resultIdentity['zend_auth_credential_match']); + } $this->resultRow = $resultIdentity; $this->authenticateResultInfo['code'] = AuthenticationResult::SUCCESS; From 2c0bfa4a5d2bd89ccec0b66b6a69fde637bf3e84 Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Fri, 18 Jan 2013 23:02:52 +0100 Subject: [PATCH 02/11] Added test for credential validation callback --- test/Adapter/DbTableTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/Adapter/DbTableTest.php b/test/Adapter/DbTableTest.php index e727cfd..fc01155 100644 --- a/test/Adapter/DbTableTest.php +++ b/test/Adapter/DbTableTest.php @@ -92,6 +92,19 @@ public function testAuthenticateSuccessWithTreatment() $this->assertTrue($result->isValid()); } + + /** + * Ensures expected behavior for authentication success + */ + public function testAuthenticateSuccessWithCallback() + { + $this->_adapter = new Adapter\DbTable($this->_db, 'users', 'username', 'password', null, function($a, $b){return $a === $b;}); + $this->_adapter->setIdentity('my_username'); + $this->_adapter->setCredential('my_password'); + $result = $this->_adapter->authenticate(); + $this->assertTrue($result->isValid()); + } + /** * Ensures expected behavior for for authentication failure * reason: Identity not found. From 7205fea9c2f42b5302f78668407a8c20e6a34788 Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Mon, 21 Jan 2013 22:09:25 +0100 Subject: [PATCH 03/11] Throw an exception if an invalid callback is provided --- src/Adapter/DbTable.php | 9 +++++++-- test/Adapter/DbTableTest.php | 13 +++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Adapter/DbTable.php b/src/Adapter/DbTable.php index d2cb667..7a0e821 100644 --- a/src/Adapter/DbTable.php +++ b/src/Adapter/DbTable.php @@ -205,15 +205,20 @@ public function setCredentialTreatment($treatment) $this->credentialTreatment = $treatment; return $this; } + /** * setCredentialValidationCallback() - allows the developer to use a callback as a way of checking the * credential. * - * @param callable $validationCallback - * @return DbTable Provides a fluent interface + * @param type $validationCallback + * @return \Zend\Authentication\Adapter\DbTable + * @throws Exception\InvalidArgumentException */ public function setCredentialValidationCallback($validationCallback) { + if (!is_callable($validationCallback)) { + throw new Exception\InvalidArgumentException('Invalid callback provided'); + } $this->credentialValidationCallback = $validationCallback; return $this; } diff --git a/test/Adapter/DbTableTest.php b/test/Adapter/DbTableTest.php index fc01155..3734923 100644 --- a/test/Adapter/DbTableTest.php +++ b/test/Adapter/DbTableTest.php @@ -105,6 +105,19 @@ public function testAuthenticateSuccessWithCallback() $this->assertTrue($result->isValid()); } + + /** + * Ensures expected behavior for an invalid callback + */ + public function testAuthenticateCallbackThrowsException() + { + $this->setExpectedException( + 'Zend\Authentication\Adapter\Exception\InvalidArgumentException', + 'Invalid callback provided' + ); + $this->_adapter->setCredentialValidationCallback('This is not a valid callback'); + } + /** * Ensures expected behavior for for authentication failure * reason: Identity not found. From a653f455452d0814d2bfb51f762c9205b704fe40 Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Mon, 21 Jan 2013 22:32:08 +0100 Subject: [PATCH 04/11] DocBlock fixes --- src/Adapter/DbTable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapter/DbTable.php b/src/Adapter/DbTable.php index 7a0e821..f8960a8 100644 --- a/src/Adapter/DbTable.php +++ b/src/Adapter/DbTable.php @@ -210,8 +210,8 @@ public function setCredentialTreatment($treatment) * setCredentialValidationCallback() - allows the developer to use a callback as a way of checking the * credential. * - * @param type $validationCallback - * @return \Zend\Authentication\Adapter\DbTable + * @param callable $validationCallback + * @return DbTable * @throws Exception\InvalidArgumentException */ public function setCredentialValidationCallback($validationCallback) From 51be8fb6cc07b5d0fa70c547b1f114d46263d302 Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Fri, 18 Jan 2013 23:02:24 +0100 Subject: [PATCH 05/11] Fixed prepared statement params --- src/Adapter/DbTable.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Adapter/DbTable.php b/src/Adapter/DbTable.php index d9468d9..88f6ba8 100644 --- a/src/Adapter/DbTable.php +++ b/src/Adapter/DbTable.php @@ -457,14 +457,15 @@ protected function _authenticateValidateResult($resultIdentity) $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; return $this->_authenticateCreateAuthResult(); } - } - if ($resultIdentity['zend_auth_credential_match'] != '1') { - $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID; - $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; - return $this->_authenticateCreateAuthResult(); - } + } else { + if ($resultIdentity['zend_auth_credential_match'] != '1') { + $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID; + $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; + return $this->_authenticateCreateAuthResult(); + } - unset($resultIdentity['zend_auth_credential_match']); + unset($resultIdentity['zend_auth_credential_match']); + } $this->resultRow = $resultIdentity; $this->authenticateResultInfo['code'] = AuthenticationResult::SUCCESS; From ba30f69434b6ca8d3ffea18fda9b8c83e7bfa04c Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Fri, 18 Jan 2013 23:02:52 +0100 Subject: [PATCH 06/11] Added test for credential validation callback --- test/Adapter/DbTableTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/Adapter/DbTableTest.php b/test/Adapter/DbTableTest.php index e727cfd..fc01155 100644 --- a/test/Adapter/DbTableTest.php +++ b/test/Adapter/DbTableTest.php @@ -92,6 +92,19 @@ public function testAuthenticateSuccessWithTreatment() $this->assertTrue($result->isValid()); } + + /** + * Ensures expected behavior for authentication success + */ + public function testAuthenticateSuccessWithCallback() + { + $this->_adapter = new Adapter\DbTable($this->_db, 'users', 'username', 'password', null, function($a, $b){return $a === $b;}); + $this->_adapter->setIdentity('my_username'); + $this->_adapter->setCredential('my_password'); + $result = $this->_adapter->authenticate(); + $this->assertTrue($result->isValid()); + } + /** * Ensures expected behavior for for authentication failure * reason: Identity not found. From 2b234ed345c11f4b9f7943174f00a3181810769f Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Sat, 19 Jan 2013 13:08:32 +0100 Subject: [PATCH 07/11] Removed callable type hint since this is PHP 5.4 only --- src/Adapter/DbTable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapter/DbTable.php b/src/Adapter/DbTable.php index 88f6ba8..c459271 100644 --- a/src/Adapter/DbTable.php +++ b/src/Adapter/DbTable.php @@ -103,7 +103,7 @@ class DbTable extends AbstractAdapter * @return \Zend\Authentication\Adapter\DbTable */ public function __construct(DbAdapter $zendDb, $tableName = null, $identityColumn = null, - $credentialColumn = null, $credentialTreatment = null, callable $credentialValidationCallback = null) + $credentialColumn = null, $credentialTreatment = null, $credentialValidationCallback = null) { $this->zendDb = $zendDb; @@ -193,7 +193,7 @@ public function setCredentialTreatment($treatment) * @param callable $validationCallback * @return DbTable Provides a fluent interface */ - public function setCredentialValidationCallback(callable $validationCallback) + public function setCredentialValidationCallback($validationCallback) { $this->credentialValidationCallback = $validationCallback; return $this; From 18d36f93416bcddd709d729c0fa297567e4d7206 Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Mon, 21 Jan 2013 22:09:25 +0100 Subject: [PATCH 08/11] Throw an exception if an invalid callback is provided --- src/Adapter/DbTable.php | 9 +++++++-- test/Adapter/DbTableTest.php | 13 +++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Adapter/DbTable.php b/src/Adapter/DbTable.php index c459271..bb2ae2e 100644 --- a/src/Adapter/DbTable.php +++ b/src/Adapter/DbTable.php @@ -186,15 +186,20 @@ public function setCredentialTreatment($treatment) $this->credentialTreatment = $treatment; return $this; } + /** * setCredentialValidationCallback() - allows the developer to use a callback as a way of checking the * credential. * - * @param callable $validationCallback - * @return DbTable Provides a fluent interface + * @param type $validationCallback + * @return \Zend\Authentication\Adapter\DbTable + * @throws Exception\InvalidArgumentException */ public function setCredentialValidationCallback($validationCallback) { + if (!is_callable($validationCallback)) { + throw new Exception\InvalidArgumentException('Invalid callback provided'); + } $this->credentialValidationCallback = $validationCallback; return $this; } diff --git a/test/Adapter/DbTableTest.php b/test/Adapter/DbTableTest.php index fc01155..3734923 100644 --- a/test/Adapter/DbTableTest.php +++ b/test/Adapter/DbTableTest.php @@ -105,6 +105,19 @@ public function testAuthenticateSuccessWithCallback() $this->assertTrue($result->isValid()); } + + /** + * Ensures expected behavior for an invalid callback + */ + public function testAuthenticateCallbackThrowsException() + { + $this->setExpectedException( + 'Zend\Authentication\Adapter\Exception\InvalidArgumentException', + 'Invalid callback provided' + ); + $this->_adapter->setCredentialValidationCallback('This is not a valid callback'); + } + /** * Ensures expected behavior for for authentication failure * reason: Identity not found. From 61f1b2fdf827316906a0ea41b224fc2938b9a5fa Mon Sep 17 00:00:00 2001 From: Justin Verweel Date: Mon, 21 Jan 2013 22:32:08 +0100 Subject: [PATCH 09/11] DocBlock fixes --- src/Adapter/DbTable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapter/DbTable.php b/src/Adapter/DbTable.php index bb2ae2e..ec4e3d6 100644 --- a/src/Adapter/DbTable.php +++ b/src/Adapter/DbTable.php @@ -191,8 +191,8 @@ public function setCredentialTreatment($treatment) * setCredentialValidationCallback() - allows the developer to use a callback as a way of checking the * credential. * - * @param type $validationCallback - * @return \Zend\Authentication\Adapter\DbTable + * @param callable $validationCallback + * @return DbTable * @throws Exception\InvalidArgumentException */ public function setCredentialValidationCallback($validationCallback) From c71cb346e1769863b957729831ecb9c3464781ec Mon Sep 17 00:00:00 2001 From: JustInVTime Date: Mon, 25 Mar 2013 21:39:03 +0100 Subject: [PATCH 10/11] Removed '_' prefixes from non public API function names --- src/Adapter/DbTable/AbstractAdapter.php | 30 +++++++++---------- src/Adapter/DbTable/CallbackCheckAdapter.php | 18 +++++------ .../DbTable/CredentialTreatmentAdapter.php | 8 ++--- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Adapter/DbTable/AbstractAdapter.php b/src/Adapter/DbTable/AbstractAdapter.php index be85df1..5eefb89 100644 --- a/src/Adapter/DbTable/AbstractAdapter.php +++ b/src/Adapter/DbTable/AbstractAdapter.php @@ -237,17 +237,17 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null) */ public function authenticate() { - $this->_authenticateSetup(); - $dbSelect = $this->_authenticateCreateSelect(); - $resultIdentities = $this->_authenticateQuerySelect($dbSelect); + $this->authenticateSetup(); + $dbSelect = $this->authenticateCreateSelect(); + $resultIdentities = $this->authenticateQuerySelect($dbSelect); - if (($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof AuthenticationResult) { + if (($authResult = $this->authenticateValidateResultSet($resultIdentities)) instanceof AuthenticationResult) { return $authResult; } // At this point, ambiguity is already done. Loop, check and break on success. foreach ($resultIdentities as $identity) { - $authResult = $this->_authenticateValidateResult($identity); + $authResult = $this->authenticateValidateResult($identity); if ($authResult->isValid()) { break; } @@ -264,7 +264,7 @@ public function authenticate() * @param array $resultIdentity * @return AuthenticationResult */ - abstract protected function _authenticateValidateResult($resultIdentity); + abstract protected function authenticateValidateResult($resultIdentity); /** * _authenticateCreateSelect() - This method creates a Zend\Db\Sql\Select object that @@ -272,7 +272,7 @@ abstract protected function _authenticateValidateResult($resultIdentity); * * @return Sql\Select */ - abstract protected function _authenticateCreateSelect(); + abstract protected function authenticateCreateSelect(); /** * _authenticateSetup() - This method abstracts the steps involved with @@ -282,7 +282,7 @@ abstract protected function _authenticateCreateSelect(); * @throws Exception\RuntimeException in the event that setup was not done properly * @return bool */ - protected function _authenticateSetup() + protected function authenticateSetup() { $exception = null; @@ -319,7 +319,7 @@ protected function _authenticateSetup() * @throws Exception\RuntimeException when an invalid select object is encountered * @return array */ - protected function _authenticateQuerySelect(Sql\Select $dbSelect) + protected function authenticateQuerySelect(Sql\Select $dbSelect) { $sql = new Sql\Sql($this->zendDb); $statement = $sql->prepareStatementForSqlObject($dbSelect); @@ -347,29 +347,29 @@ protected function _authenticateQuerySelect(Sql\Select $dbSelect) * @param array $resultIdentities * @return bool|\Zend\Authentication\Result */ - protected function _authenticateValidateResultSet(array $resultIdentities) + protected function authenticateValidateResultSet(array $resultIdentities) { if (count($resultIdentities) < 1) { $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND; $this->authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.'; - return $this->_authenticateCreateAuthResult(); + return $this->authenticateCreateAuthResult(); } elseif (count($resultIdentities) > 1 && false === $this->getAmbiguityIdentity()) { $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_AMBIGUOUS; $this->authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.'; - return $this->_authenticateCreateAuthResult(); + return $this->authenticateCreateAuthResult(); } return true; } - + /** * Creates a Zend\Authentication\Result object from the information that * has been collected during the authenticate() attempt. * * @return AuthenticationResult */ - protected function _authenticateCreateAuthResult() + protected function authenticateCreateAuthResult() { return new AuthenticationResult( $this->authenticateResultInfo['code'], @@ -379,5 +379,5 @@ protected function _authenticateCreateAuthResult() } - + } diff --git a/src/Adapter/DbTable/CallbackCheckAdapter.php b/src/Adapter/DbTable/CallbackCheckAdapter.php index 1ed643e..e7205fd 100644 --- a/src/Adapter/DbTable/CallbackCheckAdapter.php +++ b/src/Adapter/DbTable/CallbackCheckAdapter.php @@ -17,7 +17,7 @@ class CallbackCheckAdapter extends AbstractAdapter { - + /** * $credentialValidationCallback - This overrides the Treatment usage to provide a callback * that allows for validation to happen in code @@ -26,7 +26,7 @@ class CallbackCheckAdapter extends AbstractAdapter */ protected $credentialValidationCallback = null; - + /** * __construct() - Sets configuration options * @@ -68,7 +68,7 @@ public function setCredentialValidationCallback($validationCallback) return $this; } - + /** * _authenticateCreateSelect() - This method creates a Zend\Db\Sql\Select object that @@ -76,7 +76,7 @@ public function setCredentialValidationCallback($validationCallback) * * @return Sql\Select */ - protected function _authenticateCreateSelect() + protected function authenticateCreateSelect() { // get select $dbSelect = clone $this->getDbSelect(); @@ -87,7 +87,7 @@ protected function _authenticateCreateSelect() return $dbSelect; } - + /** * _authenticateValidateResult() - This method attempts to validate that @@ -97,25 +97,25 @@ protected function _authenticateCreateSelect() * @param array $resultIdentity * @return AuthenticationResult */ - protected function _authenticateValidateResult($resultIdentity) + protected function authenticateValidateResult($resultIdentity) { try { $callbackResult = call_user_func($this->credentialValidationCallback, $resultIdentity[$this->credentialColumn], $this->credential); } catch (\Exception $e) { $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_UNCATEGORIZED; $this->authenticateResultInfo['messages'][] = $e->getMessage(); - return $this->_authenticateCreateAuthResult(); + return $this->authenticateCreateAuthResult(); } if ($callbackResult !== true) { $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID; $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; - return $this->_authenticateCreateAuthResult(); + return $this->authenticateCreateAuthResult(); } $this->resultRow = $resultIdentity; $this->authenticateResultInfo['code'] = AuthenticationResult::SUCCESS; $this->authenticateResultInfo['messages'][] = 'Authentication successful.'; - return $this->_authenticateCreateAuthResult(); + return $this->authenticateCreateAuthResult(); } } diff --git a/src/Adapter/DbTable/CredentialTreatmentAdapter.php b/src/Adapter/DbTable/CredentialTreatmentAdapter.php index 3ff8b86..6148b22 100644 --- a/src/Adapter/DbTable/CredentialTreatmentAdapter.php +++ b/src/Adapter/DbTable/CredentialTreatmentAdapter.php @@ -75,7 +75,7 @@ public function setCredentialTreatment($treatment) * * @return Sql\Select */ - protected function _authenticateCreateSelect() + protected function authenticateCreateSelect() { // build credential expression if (empty($this->credentialTreatment) || (strpos($this->credentialTreatment, '?') === false)) { @@ -105,12 +105,12 @@ protected function _authenticateCreateSelect() * @param array $resultIdentity * @return AuthenticationResult */ - protected function _authenticateValidateResult($resultIdentity) + protected function authenticateValidateResult($resultIdentity) { if ($resultIdentity['zend_auth_credential_match'] != '1') { $this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID; $this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; - return $this->_authenticateCreateAuthResult(); + return $this->authenticateCreateAuthResult(); } unset($resultIdentity['zend_auth_credential_match']); @@ -118,6 +118,6 @@ protected function _authenticateValidateResult($resultIdentity) $this->authenticateResultInfo['code'] = AuthenticationResult::SUCCESS; $this->authenticateResultInfo['messages'][] = 'Authentication successful.'; - return $this->_authenticateCreateAuthResult(); + return $this->authenticateCreateAuthResult(); } } From a5736f75ed84093dad5441f4671518aa7d0138a1 Mon Sep 17 00:00:00 2001 From: Nicolas Eeckeloo Date: Mon, 29 Apr 2013 09:38:13 +0200 Subject: [PATCH 11/11] Fix coding standards PSR-2 --- src/Adapter/DbTable/CallbackCheckAdapter.php | 2 +- src/Adapter/Http.php | 4 ++-- src/Result.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Adapter/DbTable/CallbackCheckAdapter.php b/src/Adapter/DbTable/CallbackCheckAdapter.php index 908880b..9e7c0b5 100644 --- a/src/Adapter/DbTable/CallbackCheckAdapter.php +++ b/src/Adapter/DbTable/CallbackCheckAdapter.php @@ -46,7 +46,7 @@ public function __construct( if (null !== $credentialValidationCallback) { $this->setCredentialValidationCallback($credentialValidationCallback); } else { - $this->setCredentialValidationCallback(function($a, $b){ + $this->setCredentialValidationCallback(function($a, $b) { return $a === $b; }); } diff --git a/src/Adapter/Http.php b/src/Adapter/Http.php index 07dd319..13d7fdb 100644 --- a/src/Adapter/Http.php +++ b/src/Adapter/Http.php @@ -491,7 +491,7 @@ protected function _basicAuth($header) && !is_array($result) && $this->_secureStringCompare($result, $creds[1]) ) { - $identity = array('username'=>$creds[0], 'realm'=>$this->realm); + $identity = array('username' => $creds[0], 'realm' => $this->realm); return new Authentication\Result(Authentication\Result::SUCCESS, $identity); } elseif (is_array($result)) { return new Authentication\Result(Authentication\Result::SUCCESS, $result); @@ -583,7 +583,7 @@ protected function _digestAuth($header) // If our digest matches the client's let them in, otherwise return // a 401 code and exit to prevent access to the protected resource. if ($this->_secureStringCompare($digest, $data['response'])) { - $identity = array('username'=>$data['username'], 'realm'=>$data['realm']); + $identity = array('username' => $data['username'], 'realm' => $data['realm']); return new Authentication\Result(Authentication\Result::SUCCESS, $identity); } diff --git a/src/Result.php b/src/Result.php index 5e31631..3c90d9c 100644 --- a/src/Result.php +++ b/src/Result.php @@ -77,7 +77,7 @@ public function __construct($code, $identity, array $messages = array()) if ($code < self::FAILURE_UNCATEGORIZED) { $code = self::FAILURE; - } elseif ($code > self::SUCCESS ) { + } elseif ($code > self::SUCCESS) { $code = 1; }