diff --git a/src/Attribute.php b/src/Attribute.php index be72abc33..fe81e431d 100644 --- a/src/Attribute.php +++ b/src/Attribute.php @@ -46,7 +46,7 @@ public static function setAttribute(array &$data, $attribName, $value, $append = $valArray[] = $v; } } - } else if ($value !== null) { + } elseif ($value !== null) { $value = self::valueToLdap($value); if ($value !== null) { $valArray[] = $value; @@ -83,10 +83,10 @@ public static function getAttribute(array $data, $attribName, $index = null) $retArray[] = self::valueFromLDAP($v); } return $retArray; - } else if (is_int($index)) { + } elseif (is_int($index)) { if (!isset($data[$attribName])) { return null; - } else if ($index >= 0 && $index < count($data[$attribName])) { + } elseif ($index >= 0 && $index < count($data[$attribName])) { return self::valueFromLDAP($data[$attribName][$index]); } else { return null; @@ -248,7 +248,7 @@ public static function createPassword($password, $hashType = self::PASSWORD_HASH $password = '"' . $password . '"'; if (function_exists('mb_convert_encoding')) { $password = mb_convert_encoding($password, 'UTF-16LE', 'UTF-8'); - } else if (function_exists('iconv')) { + } elseif (function_exists('iconv')) { $password = iconv('UTF-8', 'UTF-16LE', $password); } else { $len = strlen($password); @@ -363,7 +363,7 @@ private static function valueFromLdapDateTime($value) { if ($value instanceof DateTime) { return $value->format('U'); - } else if (is_string($value)) { + } elseif (is_string($value)) { try { return Converter\Converter::fromLdapDateTime($value, false)->format('U'); } catch (Converter\Exception\InvalidArgumentException $e) { diff --git a/src/Collection/DefaultIterator.php b/src/Collection/DefaultIterator.php index 9ec89a7fd..e8c0b25f7 100644 --- a/src/Collection/DefaultIterator.php +++ b/src/Collection/DefaultIterator.php @@ -128,7 +128,7 @@ public function setAttributeNameTreatment($attributeNameTreatment) if (is_callable($attributeNameTreatment)) { if (is_string($attributeNameTreatment) && !function_exists($attributeNameTreatment)) { $this->attributeNameTreatment = self::ATTRIBUTE_TO_LOWER; - } else if (is_array($attributeNameTreatment) + } elseif (is_array($attributeNameTreatment) && !method_exists($attributeNameTreatment[0], $attributeNameTreatment[1]) ) { $this->attributeNameTreatment = self::ATTRIBUTE_TO_LOWER; @@ -265,7 +265,7 @@ public function next() if ($code === Exception\LdapException::LDAP_SIZELIMIT_EXCEEDED) { // we have reached the size limit enforced by the server return; - } else if ($code > Exception\LdapException::LDAP_SUCCESS) { + } elseif ($code > Exception\LdapException::LDAP_SUCCESS) { throw new Exception\LdapException($this->ldap, 'getting next entry (' . $msg . ')'); } } diff --git a/src/Converter/Converter.php b/src/Converter/Converter.php index 2c6f4229e..75f4474b5 100644 --- a/src/Converter/Converter.php +++ b/src/Converter/Converter.php @@ -94,19 +94,19 @@ public static function toLdap($value, $type = self::STANDARD) default: if (is_string($value)) { return $value; - } else if (is_int($value) || is_float($value)) { + } elseif (is_int($value) || is_float($value)) { return (string)$value; - } else if (is_bool($value)) { + } elseif (is_bool($value)) { return self::toldapBoolean($value); - } else if (is_object($value)) { + } elseif (is_object($value)) { if ($value instanceof DateTime) { return self::toLdapDatetime($value); } else { return self::toLdapSerialize($value); } - } else if (is_array($value)) { + } elseif (is_array($value)) { return self::toLdapSerialize($value); - } else if (is_resource($value) && get_resource_type($value) === 'stream') { + } elseif (is_resource($value) && get_resource_type($value) === 'stream') { return stream_get_contents($value); } else { return null; @@ -135,7 +135,7 @@ public static function toLdapDateTime($date, $asUtc = true) if (is_int($date)) { $date = new DateTime('@' . $date); $date->setTimezone(new DateTimeZone(date_default_timezone_get())); - } else if (is_string($date)) { + } elseif (is_string($date)) { $date = new DateTime($date); } else { throw new Exception\InvalidArgumentException('Parameter $date is not of the expected type'); @@ -212,7 +212,7 @@ public static function fromLdap($value, $type = self::STANDARD, $dateTimeAsUtc = if (is_numeric($value)) { // prevent numeric values to be treated as date/time return $value; - } else if ('TRUE' === $value || 'FALSE' === $value) { + } elseif ('TRUE' === $value || 'FALSE' === $value) { return self::fromLdapBoolean($value); } if (preg_match('/^\d{4}[\d\+\-Z\.]*$/', $value)) { @@ -366,7 +366,7 @@ public static function fromLdapBoolean($value) { if ('TRUE' === $value) { return true; - } else if ('FALSE' === $value) { + } elseif ('FALSE' === $value) { return false; } else { throw new Exception\InvalidArgumentException('The given value is not a boolean value'); diff --git a/src/Dn.php b/src/Dn.php index 9564c91f1..990c33712 100644 --- a/src/Dn.php +++ b/src/Dn.php @@ -55,7 +55,7 @@ public static function factory($dn, $caseFold = null) { if (is_array($dn)) { return self::fromArray($dn, $caseFold); - } else if (is_string($dn)) { + } elseif (is_string($dn)) { return self::fromString($dn, $caseFold); } else { throw new Exception\LdapException(null, 'Invalid argument type for $dn'); @@ -168,8 +168,7 @@ public function get($index, $length = 1, $caseFold = null) } if ($length === 1) { return self::caseFoldRdn($this->dn[$index], $caseFold); - } - else { + } else { return self::caseFoldDn(array_slice($this->dn, $index, $length, false), $caseFold); } } @@ -570,7 +569,7 @@ public static function explodeDn( $multi[$key] = $val; } $ret[] = $multi; - } else if (is_string($k[$i]) && is_string($v[$i])) { + } elseif (is_string($k[$i]) && is_string($v[$i])) { $ret[] = array($k[$i] => $v[$i]); } } @@ -617,7 +616,7 @@ public static function checkDn( $key = trim(substr($dn, $ko, $di - $ko)); if ($caseFold == self::ATTR_CASEFOLD_LOWER) { $key = strtolower($key); - } else if ($caseFold == self::ATTR_CASEFOLD_UPPER) { + } elseif ($caseFold == self::ATTR_CASEFOLD_UPPER) { $key = strtoupper($key); } if (is_array($multi)) { @@ -632,14 +631,14 @@ public static function checkDn( } $state = 2; $vo = $di + 1; - } else if ($ch === ',' || $ch === ';' || $ch === '+') { + } elseif ($ch === ',' || $ch === ';' || $ch === '+') { return false; } break; case 2: // collect value if ($ch === '\\') { $state = 3; - } else if ($ch === ',' || $ch === ';' || $ch === 0 || $ch === '+') { + } elseif ($ch === ',' || $ch === ';' || $ch === 0 || $ch === '+') { $value = self::unescapeValue(trim(substr($dn, $vo, $di - $vo))); if (is_array($multi)) { $va[count($va) - 1][] = $value; @@ -654,10 +653,10 @@ public static function checkDn( $ka[] = array($lastKey); $va[] = array($lastVal); $multi = array(strtolower($lastKey)); - } else if ($ch === ',' || $ch === ';' || $ch === 0) { + } elseif ($ch === ',' || $ch === ';' || $ch === 0) { $multi = false; } - } else if ($ch === '=') { + } elseif ($ch === '=') { return false; } break; diff --git a/src/Filter/AbstractLogicalFilter.php b/src/Filter/AbstractLogicalFilter.php index 8c4964453..a09dadcd1 100644 --- a/src/Filter/AbstractLogicalFilter.php +++ b/src/Filter/AbstractLogicalFilter.php @@ -50,7 +50,7 @@ protected function __construct(array $subfilters, $symbol) foreach ($subfilters as $key => $s) { if (is_string($s)) { $subfilters[$key] = new StringFilter($s); - } else if (!($s instanceof AbstractFilter)) { + } elseif (!($s instanceof AbstractFilter)) { throw new Exception\FilterException('Only strings or Zend\Ldap\Filter\AbstractFilter allowed.'); } } diff --git a/src/Ldap.php b/src/Ldap.php index ae88c1a44..5e75347c8 100644 --- a/src/Ldap.php +++ b/src/Ldap.php @@ -11,6 +11,7 @@ namespace Zend\Ldap; use Traversable; +use Zend\Stdlib\ErrorHandler; /** * @category Zend @@ -115,7 +116,9 @@ public function getResource() */ public function getLastErrorCode() { - $ret = @ldap_get_option($this->resource, LDAP_OPT_ERROR_NUMBER, $err); + ErrorHandler::start(E_WARNING); + $ret = ldap_get_option($this->resource, LDAP_OPT_ERROR_NUMBER, $err); + ErrorHandler::stop(); if ($ret === true) { if ($err <= -1 && $err >= -17) { /* For some reason draft-ietf-ldapext-ldap-c-api-xx.txt error @@ -145,15 +148,21 @@ public function getLastError(&$errorCode = null, array &$errorMessages = null) * different things so we just try to collect what we * can and eliminate dupes. */ - $estr1 = @ldap_error($this->resource); + ErrorHandler::start(E_WARNING); + $estr1 = ldap_error($this->resource); + ErrorHandler::stop(); if ($errorCode !== 0 && $estr1 === 'Success') { - $estr1 = @ldap_err2str($errorCode); + ErrorHandler::start(E_WARNING); + $estr1 = ldap_err2str($errorCode); + ErrorHandler::stop(); } if (!empty($estr1)) { $errorMessages[] = $estr1; } - @ldap_get_option($this->resource, LDAP_OPT_ERROR_STRING, $estr2); + ErrorHandler::start(E_WARNING); + ldap_get_option($this->resource, LDAP_OPT_ERROR_STRING, $estr2); + ErrorHandler::stop(); if (!empty($estr2) && !in_array($estr2, $errorMessages)) { $errorMessages[] = $estr2; } @@ -630,7 +639,9 @@ protected function getAccount($acctname, array $attrs = null) public function disconnect() { if (is_resource($this->resource)) { - @ldap_unbind($this->resource); + ErrorHandler::start(E_WARNING); + ldap_unbind($this->resource); + ErrorHandler::stop(); } $this->resource = null; $this->boundUser = false; @@ -718,16 +729,18 @@ public function connect($host = null, $port = null, $useSsl = null, $useStartTls $this->boundUser = false; $optReferrals = ($this->getOptReferrals()) ? 1 : 0; - if (@ldap_set_option($resource, LDAP_OPT_PROTOCOL_VERSION, 3) - && @ldap_set_option($resource, LDAP_OPT_REFERRALS, $optReferrals) + ErrorHandler::start(E_WARNING); + if (ldap_set_option($resource, LDAP_OPT_PROTOCOL_VERSION, 3) + && ldap_set_option($resource, LDAP_OPT_REFERRALS, $optReferrals) ) { if ($networkTimeout) { - @ldap_set_option($resource, LDAP_OPT_NETWORK_TIMEOUT, $networkTimeout); + ldap_set_option($resource, LDAP_OPT_NETWORK_TIMEOUT, $networkTimeout); } if ($useSsl || !$useStartTls || @ldap_start_tls($resource)) { return $this; } } + ErrorHandler::stop(); $zle = new Exception\LdapException($this, "$host:$port"); $this->disconnect(); @@ -801,7 +814,10 @@ public function bind($username = null, $password = null) $zle = new Exception\LdapException(null, 'Empty password not allowed - see allowEmptyPassword option.'); } else { - if (@ldap_bind($this->resource, $username, $password)) { + ErrorHandler::start(E_WARNING); + $bind = ldap_bind($this->resource, $username, $password); + ErrorHandler::stop(); + if ($bind) { $this->boundUser = $username; return $this; } @@ -879,7 +895,7 @@ public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, if ($basedn === null) { $basedn = $this->getBaseDn(); - } else if ($basedn instanceof Dn) { + } elseif ($basedn instanceof Dn) { $basedn = $basedn->toString(); } @@ -887,24 +903,28 @@ public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, $filter = $filter->toString(); } + ErrorHandler::start(E_WARNING); switch ($scope) { case self::SEARCH_SCOPE_ONE: - $search = @ldap_list($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); + $search = ldap_list($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); break; case self::SEARCH_SCOPE_BASE: - $search = @ldap_read($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); + $search = ldap_read($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); break; case self::SEARCH_SCOPE_SUB: default: - $search = @ldap_search($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); + $search = ldap_search($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); break; } + ErrorHandler::stop(); if ($search === false) { throw new Exception\LdapException($this, 'searching: ' . $filter); } if ($sort !== null && is_string($sort)) { - $isSorted = @ldap_sort($this->getResource(), $search, $sort); + ErrorHandler::start(E_WARNING); + $isSorted = ldap_sort($this->getResource(), $search, $sort); + ErrorHandler::stop(); if ($isSorted === false) { throw new Exception\LdapException($this, 'sorting: ' . $sort); } @@ -1137,7 +1157,7 @@ public function add($dn, array $entry) $value = Dn::unescapeValue($value); if (!array_key_exists($key, $entry)) { $entry[$key] = array($value); - } else if (!in_array($value, $entry[$key])) { + } elseif (!in_array($value, $entry[$key])) { $entry[$key] = array_merge(array($value), $entry[$key]); } } @@ -1149,7 +1169,9 @@ public function add($dn, array $entry) } } - $isAdded = @ldap_add($this->getResource(), $dn->toString(), $entry); + ErrorHandler::start(E_WARNING); + $isAdded = ldap_add($this->getResource(), $dn->toString(), $entry); + ErrorHandler::stop(); if ($isAdded === false) { throw new Exception\LdapException($this, 'adding: ' . $dn->toString()); } @@ -1188,7 +1210,9 @@ public function update($dn, array $entry) } if (count($entry) > 0) { - $isModified = @ldap_modify($this->getResource(), $dn->toString(), $entry); + ErrorHandler::start(E_WARNING); + $isModified = ldap_modify($this->getResource(), $dn->toString(), $entry); + ErrorHandler::stop(); if ($isModified === false) { throw new Exception\LdapException($this, 'updating: ' . $dn->toString()); } @@ -1243,7 +1267,9 @@ public function delete($dn, $recursively = false) } } } - $isDeleted = @ldap_delete($this->getResource(), $dn); + ErrorHandler::start(E_WARNING); + $isDeleted = ldap_delete($this->getResource(), $dn); + ErrorHandler::stop(); if ($isDeleted === false) { throw new Exception\LdapException($this, 'deleting: ' . $dn); } @@ -1267,19 +1293,23 @@ protected function getChildrenDns($parentDn) $parentDn = $parentDn->toString(); } $children = array(); - $search = @ldap_list($this->getResource(), $parentDn, '(objectClass=*)', array('dn')); + + ErrorHandler::start(E_WARNING); + $search = ldap_list($this->getResource(), $parentDn, '(objectClass=*)', array('dn')); for ( - $entry = @ldap_first_entry($this->getResource(), $search); + $entry = ldap_first_entry($this->getResource(), $search); $entry !== false; - $entry = @ldap_next_entry($this->getResource(), $entry) + $entry = ldap_next_entry($this->getResource(), $entry) ) { - $childDn = @ldap_get_dn($this->getResource(), $entry); + $childDn = ldap_get_dn($this->getResource(), $entry); if ($childDn === false) { + ErrorHandler::stop(); throw new Exception\LdapException($this, 'getting dn'); } $children[] = $childDn; } - @ldap_free_result($search); + ldap_free_result($search); + ErrorHandler::stop(); return $children; } @@ -1348,7 +1378,7 @@ public function rename($from, $to, $recursively = false, $alwaysEmulate = false) $emulate = (bool)$alwaysEmulate; if (!function_exists('ldap_rename')) { $emulate = true; - } else if ($recursively) { + } elseif ($recursively) { $emulate = true; } @@ -1365,10 +1395,13 @@ public function rename($from, $to, $recursively = false, $alwaysEmulate = false) $newRdn = Dn::implodeRdn(array_shift($newDnParts)); $newParent = Dn::implodeDn($newDnParts); - $isOK = @ldap_rename($this->getResource(), $from, $newRdn, $newParent, true); + + ErrorHandler::start(E_WARNING); + $isOK = ldap_rename($this->getResource(), $from, $newRdn, $newParent, true); + ErrorHandler::stop(); if ($isOK === false) { throw new Exception\LdapException($this, 'renaming ' . $from . ' to ' . $to); - } else if (!$this->exists($to)) { + } elseif (!$this->exists($to)) { $emulate = true; } } diff --git a/src/Ldif/Encoder.php b/src/Ldif/Encoder.php index 414e7b9ce..681f92cbf 100644 --- a/src/Ldif/Encoder.php +++ b/src/Ldif/Encoder.php @@ -75,9 +75,9 @@ protected function _decode($string) $matches = array(); if (substr($line, 0, 1) === ' ' && $last !== null) { $last[2] .= substr($line, 1); - } else if (substr($line, 0, 1) === '#') { + } elseif (substr($line, 0, 1) === '#') { continue; - } else if (preg_match('/^([a-z0-9;-]+)(:[:<]?\s*)([^:<]*)$/i', $line, $matches)) { + } elseif (preg_match('/^([a-z0-9;-]+)(:[:<]?\s*)([^:<]*)$/i', $line, $matches)) { $name = strtolower($matches[1]); $type = trim($matches[2]); $value = $matches[3]; @@ -86,13 +86,13 @@ protected function _decode($string) } if ($name === 'version') { continue; - } else if (count($item) > 0 && $name === 'dn') { + } elseif (count($item) > 0 && $name === 'dn') { $items[] = $item; $item = array(); $last = null; } $last = array($name, $type, $value); - } else if (trim($line) === '') { + } elseif (trim($line) === '') { continue; } } @@ -120,7 +120,7 @@ protected function pushAttribute(array $attribute, array &$entry) } if ($name === 'dn') { $entry[$name] = $value; - } else if (isset($entry[$name]) && $value !== '') { + } elseif (isset($entry[$name]) && $value !== '') { $entry[$name][] = $value; } else { $entry[$name] = ($value !== '') ? array($value) : array(); @@ -152,9 +152,9 @@ protected function _encode($value) { if (is_scalar($value)) { return $this->encodeString($value); - } else if (is_array($value)) { + } elseif (is_array($value)) { return $this->encodeAttributes($value); - } else if ($value instanceof Ldap\Node) { + } elseif ($value instanceof Ldap\Node) { return $value->toLdif($this->options); } @@ -199,10 +199,10 @@ protected function encodeString($string, &$base64 = null) if ($char >= 127) { $base64 = true; break; - } else if ($i === 0 && in_array($char, $unsafe_init_char)) { + } elseif ($i === 0 && in_array($char, $unsafe_init_char)) { $base64 = true; break; - } else if (in_array($char, $unsafe_char)) { + } elseif (in_array($char, $unsafe_char)) { $base64 = true; break; } diff --git a/src/Node.php b/src/Node.php index 81ae74e82..b3ab434df 100644 --- a/src/Node.php +++ b/src/Node.php @@ -240,7 +240,7 @@ public static function create($dn, array $objectClass = array()) { if (is_string($dn) || is_array($dn)) { $dn = Dn::factory($dn); - } else if ($dn instanceof Dn) { + } elseif ($dn instanceof Dn) { $dn = clone $dn; } else { throw new Exception\LdapException(null, '$dn is of a wrong data type.'); @@ -264,7 +264,7 @@ public static function fromLdap($dn, Ldap $ldap) { if (is_string($dn) || is_array($dn)) { $dn = Dn::factory($dn); - } else if ($dn instanceof Dn) { + } elseif ($dn instanceof Dn) { $dn = clone $dn; } else { throw new Exception\LdapException(null, '$dn is of a wrong data type.'); @@ -293,7 +293,7 @@ public static function fromArray(array $data, $fromDataSource = false) } if (is_string($data['dn']) || is_array($data['dn'])) { $dn = Dn::factory($data['dn']); - } else if ($data['dn'] instanceof Dn) { + } elseif ($data['dn'] instanceof Dn) { $dn = clone $data['dn']; } else { throw new Exception\LdapException(null, '\'dn\' key is of a wrong data type.'); @@ -316,7 +316,7 @@ protected function ensureRdnAttributeValues($overwrite = false) foreach ($this->getRdnArray() as $key => $value) { if (!array_key_exists($key, $this->currentData) || $overwrite) { Attribute::setAttribute($this->currentData, $key, $value, false); - } else if (!in_array($value, $this->currentData[$key])) { + } elseif (!in_array($value, $this->currentData[$key])) { Attribute::setAttribute($this->currentData, $key, $value, true); } } @@ -393,7 +393,7 @@ public function willBeMoved() { if ($this->isNew() || $this->willBeDeleted()) { return false; - } else if ($this->newDn !== null) { + } elseif ($this->newDn !== null) { return ($this->dn != $this->newDn); } else { return false; @@ -605,7 +605,7 @@ public function getChangedData() foreach ($this->currentData as $key => $value) { if (!array_key_exists($key, $this->originalData) && !empty($value)) { $changed[$key] = $value; - } else if ($this->originalData[$key] !== $this->currentData[$key]) { + } elseif ($this->originalData[$key] !== $this->currentData[$key]) { $changed[$key] = $value; } } @@ -629,9 +629,9 @@ public function getChanges() foreach ($this->currentData as $key => $value) { if (!array_key_exists($key, $this->originalData) && !empty($value)) { $changes['add'][$key] = $value; - } else if (count($this->originalData[$key]) === 0 && !empty($value)) { + } elseif (count($this->originalData[$key]) === 0 && !empty($value)) { $changes['add'][$key] = $value; - } else if ($this->originalData[$key] !== $this->currentData[$key]) { + } elseif ($this->originalData[$key] !== $this->currentData[$key]) { if (empty($value)) { $changes['delete'][$key] = $value; } else { @@ -812,10 +812,9 @@ protected function assertChangeableAttribute($name) $rdn = $this->getRdnArray(Dn::ATTR_CASEFOLD_LOWER); if ($name == 'dn') { throw new Exception\LdapException(null, 'DN cannot be changed.'); - } - else if (array_key_exists($name, $rdn)) { + } elseif (array_key_exists($name, $rdn)) { throw new Exception\LdapException(null, 'Cannot change attribute because it\'s part of the RDN'); - } else if (in_array($name, self::$systemAttributes)) { + } elseif (in_array($name, self::$systemAttributes)) { throw new Exception\LdapException(null, 'Cannot change attribute because it\'s read-only'); } else { return true; diff --git a/src/Node/AbstractNode.php b/src/Node/AbstractNode.php index 4e2df3f71..d2955c142 100644 --- a/src/Node/AbstractNode.php +++ b/src/Node/AbstractNode.php @@ -286,8 +286,7 @@ public function existsAttribute($name, $emptyExists = false) } return count($this->currentData[$name]) > 0; - } - else { + } else { return false; } } diff --git a/src/Node/RootDse.php b/src/Node/RootDse.php index 3ad73be80..e1e94c7ec 100644 --- a/src/Node/RootDse.php +++ b/src/Node/RootDse.php @@ -38,9 +38,9 @@ public static function create(Ldap\Ldap $ldap) $data = $ldap->getEntry($dn, array('*', '+'), true); if (isset($data['domainfunctionality'])) { return new RootDse\ActiveDirectory($dn, $data); - } else if (isset($data['dsaname'])) { + } elseif (isset($data['dsaname'])) { return new RootDse\eDirectory($dn, $data); - } else if (isset($data['structuralobjectclass']) + } elseif (isset($data['structuralobjectclass']) && $data['structuralobjectclass'][0] === 'OpenLDAProotDSE' ) { return new RootDse\OpenLdap($dn, $data); diff --git a/src/Node/Schema/ObjectClass/OpenLdap.php b/src/Node/Schema/ObjectClass/OpenLdap.php index f0124847a..e82493740 100644 --- a/src/Node/Schema/ObjectClass/OpenLdap.php +++ b/src/Node/Schema/ObjectClass/OpenLdap.php @@ -124,9 +124,9 @@ public function getType() { if ($this->structural) { return Schema::OBJECTCLASS_TYPE_STRUCTURAL; - } else if ($this->abstract) { + } elseif ($this->abstract) { return Schema::OBJECTCLASS_TYPE_ABSTRACT; - } else if ($this->auxiliary) { + } elseif ($this->auxiliary) { return Schema::OBJECTCLASS_TYPE_AUXILIARY; } else { return Schema::OBJECTCLASS_TYPE_UNKNOWN; diff --git a/test/Node/ChildrenIterationTest.php b/test/Node/ChildrenIterationTest.php index 3419d2281..2d8c2be56 100644 --- a/test/Node/ChildrenIterationTest.php +++ b/test/Node/ChildrenIterationTest.php @@ -67,7 +67,7 @@ public function testSimpleRecursiveIteration() $this->assertEquals(Ldap\Dn::fromString(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE) ->toString(Ldap\Dn::ATTR_CASEFOLD_LOWER), $dn ); - } else if ($i == 1) { + } elseif ($i == 1) { $this->assertEquals('ou=Node', $rdn); $this->assertEquals($this->createDn('ou=Node,'), $dn); } else { diff --git a/test/OfflineTest.php b/test/OfflineTest.php index a35c63483..a947f0735 100644 --- a/test/OfflineTest.php +++ b/test/OfflineTest.php @@ -101,9 +101,6 @@ public function testOptionsGetter() public function testConfigObject() { - /** - * @see Zend\Config\Config - */ $config = new Config\Config(array( 'host' => TESTS_ZEND_LDAP_HOST, 'username' => TESTS_ZEND_LDAP_USERNAME, diff --git a/test/SearchTest.php b/test/SearchTest.php index f844a34f4..1b3de040f 100644 --- a/test/SearchTest.php +++ b/test/SearchTest.php @@ -96,8 +96,7 @@ public function testResultIteration() $this->assertEquals(9, count($items)); $i = 0; - foreach ($items as $key => $item) - { + foreach ($items as $key => $item) { $this->assertEquals($i, $key); $i++; } @@ -151,8 +150,7 @@ public function testSorting() Ldap\Ldap::SEARCH_SCOPE_SUB, array(), 'l' ); $this->assertEquals(5, $items->count()); - foreach ($items as $key => $item) - { + foreach ($items as $key => $item) { $this->assertEquals($lSorted[$key], $item['l'][0]); } } @@ -243,15 +241,13 @@ public function testMultipleResultIteration() $this->assertEquals($isCount, $items->count()); $i = 0; - foreach ($items as $key => $item) - { + foreach ($items as $key => $item) { $this->assertEquals($i, $key); $i++; } $this->assertEquals($isCount, $i); $i = 0; - foreach ($items as $key => $item) - { + foreach ($items as $key => $item) { $this->assertEquals($i, $key); $i++; } @@ -259,15 +255,13 @@ public function testMultipleResultIteration() $items->close(); $i = 0; - foreach ($items as $key => $item) - { + foreach ($items as $key => $item) { $this->assertEquals($i, $key); $i++; } $this->assertEquals($isCount, $i); $i = 0; - foreach ($items as $key => $item) - { + foreach ($items as $key => $item) { $this->assertEquals($i, $key); $i++; } @@ -524,8 +518,7 @@ public function testResultIterationAfterCallingCurrent() $this->assertEquals(TESTS_ZEND_LDAP_WRITEABLE_SUBTREE, $current['dn']); $i = 0; - foreach ($items as $key => $item) - { + foreach ($items as $key => $item) { $this->assertEquals($i, $key); $i++; }