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

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2 into feat…
Browse files Browse the repository at this point in the history
…ure/console
  • Loading branch information
Thinkscape committed Jul 15, 2012
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 95 deletions.
10 changes: 5 additions & 5 deletions src/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/DefaultIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 . ')');
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/Converter/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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');
Expand Down
17 changes: 8 additions & 9 deletions src/Dn.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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]);
}
}
Expand Down Expand Up @@ -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)) {
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/AbstractLogicalFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}
Expand Down
Loading

0 comments on commit 37d0971

Please sign in to comment.