Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'cs/remove-underscores' of https://github.com/arse/zf2 i…
Browse files Browse the repository at this point in the history
…nto feature/protected-underscores

Conflicts:
	library/Zend/Console/Getopt.php
  • Loading branch information
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 191 deletions.
134 changes: 67 additions & 67 deletions src/Adapter/DbTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,77 +29,77 @@ class DbTable implements AdapterInterface
*
* @var DbAdapter
*/
protected $_zendDb = null;
protected $zendDb = null;

/**
* @var DbSelect
*/
protected $_dbSelect = null;
protected $dbSelect = null;

/**
* $_tableName - the table name to check
* $tableName - the table name to check
*
* @var string
*/
protected $_tableName = null;
protected $tableName = null;

/**
* $_identityColumn - the column to use as the identity
* $identityColumn - the column to use as the identity
*
* @var string
*/
protected $_identityColumn = null;
protected $identityColumn = null;

/**
* $_credentialColumns - columns to be used as the credentials
* $credentialColumns - columns to be used as the credentials
*
* @var string
*/
protected $_credentialColumn = null;
protected $credentialColumn = null;

/**
* $_identity - Identity value
* $identity - Identity value
*
* @var string
*/
protected $_identity = null;
protected $identity = null;

/**
* $_credential - Credential values
* $credential - Credential values
*
* @var string
*/
protected $_credential = null;
protected $credential = null;

/**
* $_credentialTreatment - Treatment applied to the credential, such as MD5() or PASSWORD()
* $credentialTreatment - Treatment applied to the credential, such as MD5() or PASSWORD()
*
* @var string
*/
protected $_credentialTreatment = null;
protected $credentialTreatment = null;

/**
* $_authenticateResultInfo
* $authenticateResultInfo
*
* @var array
*/
protected $_authenticateResultInfo = null;
protected $authenticateResultInfo = null;

/**
* $_resultRow - Results of database authentication query
* $resultRow - Results of database authentication query
*
* @var array
*/
protected $_resultRow = null;
protected $resultRow = null;

/**
* $_ambiguityIdentity - Flag to indicate same Identity can be used with
* $ambiguityIdentity - Flag to indicate same Identity can be used with
* different credentials. Default is FALSE and need to be set to true to
* allow ambiguity usage.
*
* @var boolean
*/
protected $_ambiguityIdentity = false;
protected $ambiguityIdentity = false;

/**
* __construct() - Sets configuration options
Expand All @@ -114,7 +114,7 @@ class DbTable implements AdapterInterface
public function __construct(DbAdapter $zendDb, $tableName = null, $identityColumn = null,
$credentialColumn = null, $credentialTreatment = null)
{
$this->_zendDb = $zendDb;
$this->zendDb = $zendDb;

if (null !== $tableName) {
$this->setTableName($tableName);
Expand All @@ -141,7 +141,7 @@ public function __construct(DbAdapter $zendDb, $tableName = null, $identityColum
*/
public function setTableName($tableName)
{
$this->_tableName = $tableName;
$this->tableName = $tableName;
return $this;
}

Expand All @@ -153,7 +153,7 @@ public function setTableName($tableName)
*/
public function setIdentityColumn($identityColumn)
{
$this->_identityColumn = $identityColumn;
$this->identityColumn = $identityColumn;
return $this;
}

Expand All @@ -165,7 +165,7 @@ public function setIdentityColumn($identityColumn)
*/
public function setCredentialColumn($credentialColumn)
{
$this->_credentialColumn = $credentialColumn;
$this->credentialColumn = $credentialColumn;
return $this;
}

Expand All @@ -188,7 +188,7 @@ public function setCredentialColumn($credentialColumn)
*/
public function setCredentialTreatment($treatment)
{
$this->_credentialTreatment = $treatment;
$this->credentialTreatment = $treatment;
return $this;
}

Expand All @@ -200,7 +200,7 @@ public function setCredentialTreatment($treatment)
*/
public function setIdentity($value)
{
$this->_identity = $value;
$this->identity = $value;
return $this;
}

Expand All @@ -213,7 +213,7 @@ public function setIdentity($value)
*/
public function setCredential($credential)
{
$this->_credential = $credential;
$this->credential = $credential;
return $this;
}

Expand All @@ -228,9 +228,9 @@ public function setCredential($credential)
public function setAmbiguityIdentity($flag)
{
if (is_integer($flag)) {
$this->_ambiguityIdentity = (1 === $flag ? true : false);
$this->ambiguityIdentity = (1 === $flag ? true : false);
} elseif (is_bool($flag)) {
$this->_ambiguityIdentity = $flag;
$this->ambiguityIdentity = $flag;
}
return $this;
}
Expand All @@ -243,7 +243,7 @@ public function setAmbiguityIdentity($flag)
*/
public function getAmbiguityIdentity()
{
return $this->_ambiguityIdentity;
return $this->ambiguityIdentity;
}

/**
Expand All @@ -253,10 +253,10 @@ public function getAmbiguityIdentity()
*/
public function getDbSelect()
{
if ($this->_dbSelect == null) {
$this->_dbSelect = new DbSelect();
if ($this->dbSelect == null) {
$this->dbSelect = new DbSelect();
}
return $this->_dbSelect;
return $this->dbSelect;
}

/**
Expand All @@ -268,26 +268,26 @@ public function getDbSelect()
*/
public function getResultRowObject($returnColumns = null, $omitColumns = null)
{
if (!$this->_resultRow) {
if (!$this->resultRow) {
return false;
}

$returnObject = new \stdClass();

if (null !== $returnColumns) {

$availableColumns = array_keys($this->_resultRow);
$availableColumns = array_keys($this->resultRow);
foreach ((array)$returnColumns as $returnColumn) {
if (in_array($returnColumn, $availableColumns)) {
$returnObject->{$returnColumn} = $this->_resultRow[$returnColumn];
$returnObject->{$returnColumn} = $this->resultRow[$returnColumn];
}
}
return $returnObject;

} elseif (null !== $omitColumns) {

$omitColumns = (array)$omitColumns;
foreach ($this->_resultRow as $resultColumn => $resultValue) {
foreach ($this->resultRow as $resultColumn => $resultValue) {
if (!in_array($resultColumn, $omitColumns)) {
$returnObject->{$resultColumn} = $resultValue;
}
Expand All @@ -296,7 +296,7 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null)

} else {

foreach ($this->_resultRow as $resultColumn => $resultValue) {
foreach ($this->resultRow as $resultColumn => $resultValue) {
$returnObject->{$resultColumn} = $resultValue;
}
return $returnObject;
Expand Down Expand Up @@ -346,25 +346,25 @@ protected function _authenticateSetup()
{
$exception = null;

if ($this->_tableName == '') {
if ($this->tableName == '') {
$exception = 'A table must be supplied for the DbTable authentication adapter.';
} elseif ($this->_identityColumn == '') {
} elseif ($this->identityColumn == '') {
$exception = 'An identity column must be supplied for the DbTable authentication adapter.';
} elseif ($this->_credentialColumn == '') {
} elseif ($this->credentialColumn == '') {
$exception = 'A credential column must be supplied for the DbTable authentication adapter.';
} elseif ($this->_identity == '') {
} elseif ($this->identity == '') {
$exception = 'A value for the identity was not provided prior to authentication with DbTable.';
} elseif ($this->_credential === null) {
} elseif ($this->credential === null) {
$exception = 'A credential value was not provided prior to authentication with DbTable.';
}

if (null !== $exception) {
throw new Exception\RuntimeException($exception);
}

$this->_authenticateResultInfo = array(
$this->authenticateResultInfo = array(
'code' => AuthenticationResult::FAILURE,
'identity' => $this->_identity,
'identity' => $this->identity,
'messages' => array()
);

Expand All @@ -380,23 +380,23 @@ protected function _authenticateSetup()
protected function _authenticateCreateSelect()
{
// build credential expression
if (empty($this->_credentialTreatment) || (strpos($this->_credentialTreatment, '?') === false)) {
$this->_credentialTreatment = '?';
if (empty($this->credentialTreatment) || (strpos($this->credentialTreatment, '?') === false)) {
$this->credentialTreatment = '?';
}

$credentialExpression = new Expression(
'(CASE WHEN '
. $this->_zendDb->getPlatform()->quoteIdentifier($this->_credentialColumn)
. ' = ' . $this->_credentialTreatment
. $this->zendDb->getPlatform()->quoteIdentifier($this->credentialColumn)
. ' = ' . $this->credentialTreatment
. ' THEN 1 ELSE 0 END) AS '
. $this->_zendDb->getPlatform()->quoteIdentifier('zend_auth_credential_match')
. $this->zendDb->getPlatform()->quoteIdentifier('zend_auth_credential_match')
);

// get select
$dbSelect = clone $this->getDbSelect();
$dbSelect->from($this->_tableName)
$dbSelect->from($this->tableName)
->columns(array('*', $credentialExpression))
->where($this->_zendDb->getPlatform()->quoteIdentifier($this->_identityColumn) . ' = ?');
->where($this->zendDb->getPlatform()->quoteIdentifier($this->identityColumn) . ' = ?');

return $dbSelect;
}
Expand All @@ -411,11 +411,11 @@ protected function _authenticateCreateSelect()
*/
protected function _authenticateQuerySelect(DbSelect $dbSelect)
{
$statement = $this->_zendDb->createStatement();
$dbSelect->prepareStatement($this->_zendDb, $statement);
$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(array($this->credential, $this->identity)));
$resultIdentities = $resultSet->toArray();
} catch (\Exception $e) {
throw new Exception\RuntimeException(
Expand All @@ -438,12 +438,12 @@ 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.';
$this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND;
$this->authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.';
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.';
$this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_IDENTITY_AMBIGUOUS;
$this->authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.';
return $this->_authenticateCreateAuthResult();
}

Expand All @@ -461,16 +461,16 @@ protected function _authenticateValidateResultSet(array $resultIdentities)
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.';
$this->authenticateResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID;
$this->authenticateResultInfo['messages'][] = 'Supplied credential is invalid.';
return $this->_authenticateCreateAuthResult();
}

unset($resultIdentity['zend_auth_credential_match']);
$this->_resultRow = $resultIdentity;
$this->resultRow = $resultIdentity;

$this->_authenticateResultInfo['code'] = AuthenticationResult::SUCCESS;
$this->_authenticateResultInfo['messages'][] = 'Authentication successful.';
$this->authenticateResultInfo['code'] = AuthenticationResult::SUCCESS;
$this->authenticateResultInfo['messages'][] = 'Authentication successful.';
return $this->_authenticateCreateAuthResult();
}

Expand All @@ -483,9 +483,9 @@ protected function _authenticateValidateResult($resultIdentity)
protected function _authenticateCreateAuthResult()
{
return new AuthenticationResult(
$this->_authenticateResultInfo['code'],
$this->_authenticateResultInfo['identity'],
$this->_authenticateResultInfo['messages']
$this->authenticateResultInfo['code'],
$this->authenticateResultInfo['identity'],
$this->authenticateResultInfo['messages']
);
}

Expand Down
Loading

0 comments on commit 78b260b

Please sign in to comment.