Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Conditional statements improved(minor changes). #2323

Merged
merged 1 commit into from

2 participants

Yousha Aleayoub Matthew Weier O'Phinney
Yousha Aleayoub

No description provided.

Matthew Weier O'Phinney weierophinney merged commit d1c552f into from
Matthew Weier O'Phinney

Very nice changes -- thanks!

Merged to release and master branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 14, 2012
  1. Yousha Aleayoub
This page is out of date. Refresh to see the latest.
10 library/Zend/Authentication/Adapter/DbTable.php
View
@@ -294,14 +294,12 @@ public function getResultRowObject($returnColumns = null, $omitColumns = null)
}
return $returnObject;
- } else {
-
- foreach ($this->resultRow as $resultColumn => $resultValue) {
- $returnObject->{$resultColumn} = $resultValue;
- }
- return $returnObject;
+ }
+ foreach ($this->resultRow as $resultColumn => $resultValue) {
+ $returnObject->{$resultColumn} = $resultValue;
}
+ return $returnObject;
}
/**
28 library/Zend/Authentication/Adapter/Http.php
View
@@ -589,9 +589,9 @@ protected function _digestAuth($header)
if ($this->_secureStringCompare($digest, $data['response'])) {
$identity = array('username'=>$data['username'], 'realm'=>$data['realm']);
return new Authentication\Result(Authentication\Result::SUCCESS, $identity);
- } else {
- return $this->_challengeClient();
}
+
+ return $this->_challengeClient();
}
/**
@@ -682,9 +682,9 @@ protected function _parseDigestAuth($header)
}
if (!ctype_xdigit($temp[1])) {
return false;
- } else {
- $data['nonce'] = $temp[1];
}
+
+ $data['nonce'] = $temp[1];
$temp = null;
$ret = preg_match('/uri="([^"]+)"/', $header, $temp);
@@ -715,9 +715,9 @@ protected function _parseDigestAuth($header)
}
if (32 != strlen($temp[1]) || !ctype_xdigit($temp[1])) {
return false;
- } else {
- $data['response'] = $temp[1];
}
+
+ $data['response'] = $temp[1];
$temp = null;
// The spec says this should default to MD5 if omitted. OK, so how does
@@ -739,9 +739,9 @@ protected function _parseDigestAuth($header)
}
if (!ctype_print($temp[1])) {
return false;
- } else {
- $data['cnonce'] = $temp[1];
}
+
+ $data['cnonce'] = $temp[1];
$temp = null;
// If the server sent an opaque value, the client must send it back
@@ -767,9 +767,9 @@ protected function _parseDigestAuth($header)
if (!$this->ieNoOpaque &&
(32 != strlen($temp[1]) || !ctype_xdigit($temp[1]))) {
return false;
- } else {
- $data['opaque'] = $temp[1];
}
+
+ $data['opaque'] = $temp[1];
$temp = null;
}
@@ -781,9 +781,9 @@ protected function _parseDigestAuth($header)
}
if (!in_array($temp[1], $this->supportedQops)) {
return false;
- } else {
- $data['qop'] = $temp[1];
}
+
+ $data['qop'] = $temp[1];
$temp = null;
// Not optional in this implementation. The spec says this value
@@ -795,9 +795,9 @@ protected function _parseDigestAuth($header)
}
if (8 != strlen($temp[1]) || !ctype_xdigit($temp[1])) {
return false;
- } else {
- $data['nc'] = $temp[1];
}
+
+ $data['nc'] = $temp[1];
$temp = null;
return $data;
4 library/Zend/Authentication/Adapter/Ldap.php
View
@@ -438,9 +438,9 @@ protected function checkGroupMembership(ZendLdap\Ldap $ldap, $canonicalName, $dn
if ($result === 1) {
return true;
- } else {
- return 'Failed to verify group membership with ' . $group->toString();
}
+
+ return 'Failed to verify group membership with ' . $group->toString();
}
/**
11 library/Zend/Escaper/Escaper.php
View
@@ -268,9 +268,8 @@ protected function htmlAttrMatcher($matches)
*/
if ($ord > 255) {
return sprintf('&#x%04X;', $ord);
- } else {
- return sprintf('&#x%02X;', $ord);
}
+ return sprintf('&#x%02X;', $ord);
}
/**
@@ -285,10 +284,9 @@ protected function jsMatcher($matches)
$chr = $matches[0];
if (strlen($chr) == 1) {
return sprintf('\\x%02X', ord($chr));
- } else {
- $chr = $this->convertEncoding($chr, 'UTF-16BE', 'UTF-8');
- return sprintf('\\u%04s', strtoupper(bin2hex($chr)));
}
+ $chr = $this->convertEncoding($chr, 'UTF-16BE', 'UTF-8');
+ return sprintf('\\u%04s', strtoupper(bin2hex($chr)));
}
/**
@@ -384,8 +382,7 @@ protected function convertEncoding($string, $to, $from)
if ($result === false) {
return ''; // return non-fatal blank string on encoding errors from users
- } else {
- return $result;
}
+ return $result;
}
}
25 library/Zend/Http/Headers.php
View
@@ -264,17 +264,17 @@ public function get($name)
$headers[] = $this->headers[$index];
}
return new ArrayIterator($headers);
- } else {
- $index = array_search($key, $this->headersKeys);
- if ($index === false) {
- return false;
- }
- if (is_array($this->headers[$index])) {
- return $this->lazyLoadHeader($index);
- } else {
- return $this->headers[$index];
- }
}
+
+ $index = array_search($key, $this->headersKeys);
+ if ($index === false) {
+ return false;
+ }
+
+ if (is_array($this->headers[$index])) {
+ return $this->lazyLoadHeader($index);
+ }
+ return $this->headers[$index];
}
/**
@@ -441,11 +441,10 @@ protected function lazyLoadHeader($index)
$this->headers[] = $header;
}
return $current;
- } else {
- $this->headers[$index] = $current = $headers;
- return $current;
}
+ $this->headers[$index] = $current = $headers;
+ return $current;
}
/**
3  library/Zend/Http/Response.php
View
@@ -511,8 +511,7 @@ protected function decodeDeflate($body)
if ($zlibHeader[1] % 31 == 0) {
return gzuncompress($body);
- } else {
- return gzinflate($body);
}
+ return gzinflate($body);
}
}
1  library/Zend/Json/Encoder.php
View
@@ -94,7 +94,6 @@ protected function _encodeValue(&$value)
}
-
/**
* Encode an object to JSON by encoding each of the public properties
*
3  library/Zend/Json/Json.php
View
@@ -201,9 +201,8 @@ protected static function _getXmlValue($simpleXmlElementObject)
$match = preg_match($pattern, $simpleXmlElementObject, $matchings);
if ($match) {
return new Expr($matchings[1]);
- } else {
- return (trim(strval($simpleXmlElementObject)));
}
+ return (trim(strval($simpleXmlElementObject)));
}
/**
* _processXml - Contains the logic for xml2json
15 library/Zend/Ldap/Collection.php
View
@@ -88,9 +88,8 @@ public function getFirst()
if ($this->count() > 0) {
$this->rewind();
return $this->current();
- } else {
- return null;
}
+ return null;
}
/**
@@ -135,9 +134,8 @@ public function current()
$this->cache[$this->current] = $this->createEntry($current);
}
return $this->cache[$this->current];
- } else {
- return null;
}
+ return null;
}
/**
@@ -163,9 +161,8 @@ public function dn()
$this->rewind();
}
return $this->iterator->key();
- } else {
- return null;
}
+ return null;
}
/**
@@ -181,9 +178,8 @@ public function key()
$this->rewind();
}
return $this->current;
- } else {
- return null;
}
+ return null;
}
/**
@@ -221,8 +217,7 @@ public function valid()
{
if (isset($this->cache[$this->current])) {
return true;
- } else {
- return $this->iterator->valid();
}
+ return $this->iterator->valid();
}
}
12 library/Zend/Ldap/Dn.php
View
@@ -57,9 +57,8 @@ public static function factory($dn, $caseFold = null)
return self::fromArray($dn, $caseFold);
} elseif (is_string($dn)) {
return self::fromString($dn, $caseFold);
- } else {
- throw new Exception\LdapException(null, 'Invalid argument type for $dn');
}
+ throw new Exception\LdapException(null, 'Invalid argument type for $dn');
}
/**
@@ -168,9 +167,8 @@ public function get($index, $length = 1, $caseFold = null)
}
if ($length === 1) {
return self::caseFoldRdn($this->dn[$index], $caseFold);
- } else {
- return self::caseFoldDn(array_slice($this->dn, $index, $length, false), $caseFold);
}
+ return self::caseFoldDn(array_slice($this->dn, $index, $length, false), $caseFold);
}
/**
@@ -325,9 +323,8 @@ public function toArray($caseFold = null)
if ($caseFold === self::ATTR_CASEFOLD_NONE) {
return $this->dn;
- } else {
- return self::caseFoldDn($this->dn, $caseFold);
}
+ return self::caseFoldDn($this->dn, $caseFold);
}
/**
@@ -387,9 +384,8 @@ public function offsetExists($offset)
$offset = (int)$offset;
if ($offset < 0 || $offset >= count($this->dn)) {
return false;
- } else {
- return true;
}
+ return true;
}
/**
3  library/Zend/Ldap/Ldap.php
View
@@ -982,9 +982,8 @@ public function count($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB)
} catch (Exception\LdapException $e) {
if ($e->getCode() === Exception\LdapException::LDAP_NO_SUCH_OBJECT) {
return 0;
- } else {
- throw $e;
}
+ throw $e;
}
return $result->count();
10 library/Zend/Ldap/Node.php
View
@@ -395,9 +395,9 @@ public function willBeMoved()
return false;
} elseif ($this->newDn !== null) {
return ($this->dn != $this->newDn);
- } else {
- return false;
}
+
+ return false;
}
/**
@@ -995,12 +995,10 @@ public function hasChildren()
if (!is_array($this->children)) {
if ($this->isAttached()) {
return ($this->countChildren() > 0);
- } else {
- return false;
}
- } else {
- return (count($this->children) > 0);
+ return false;
}
+ return (count($this->children) > 0);
}
/**
6 library/Zend/Mime/Part.php
View
@@ -123,9 +123,8 @@ public function getContent($EOL = Mime::LINEEND)
{
if ($this->isStream) {
return stream_get_contents($this->getEncodedStream());
- } else {
- return Mime::encode($this->content, $this->encoding, $EOL);
}
+ return Mime::encode($this->content, $this->encoding, $EOL);
}
/**
@@ -136,9 +135,8 @@ public function getRawContent()
{
if ($this->isStream) {
return stream_get_contents($this->content);
- } else {
- return $this->content;
}
+ return $this->content;
}
/**
3  library/Zend/Paginator/Paginator.php
View
@@ -828,9 +828,8 @@ public function toJson()
if ($currentItems instanceof DbAbstractRowset) {
return Json::encode($currentItems->toArray());
- } else {
- return Json::encode($currentItems);
}
+ return Json::encode($currentItems);
}
/**
3  library/Zend/Soap/Wsdl.php
View
@@ -519,9 +519,8 @@ public function dump($filename = false)
if (!$filename) {
echo $this->toXML();
return true;
- } else {
- return file_put_contents($filename, $this->toXML());
}
+ return file_put_contents($filename, $this->toXML());
}
/**
Something went wrong with that request. Please try again.