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

Conditional statements improved(minor changes). #2323

Merged
merged 1 commit into from Sep 13, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions library/Zend/Authentication/Adapter/DbTable.php
Expand Up @@ -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;
}

/**
Expand Down
28 changes: 14 additions & 14 deletions library/Zend/Authentication/Adapter/Http.php
Expand Up @@ -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();
}

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
}

Expand All @@ -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
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Authentication/Adapter/Ldap.php
Expand Up @@ -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();
}

/**
Expand Down
11 changes: 4 additions & 7 deletions library/Zend/Escaper/Escaper.php
Expand Up @@ -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);
}

/**
Expand All @@ -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)));
}

/**
Expand Down Expand Up @@ -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 changes: 12 additions & 13 deletions library/Zend/Http/Headers.php
Expand Up @@ -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];
}

/**
Expand Down Expand Up @@ -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;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Http/Response.php
Expand Up @@ -511,8 +511,7 @@ protected function decodeDeflate($body)

if ($zlibHeader[1] % 31 == 0) {
return gzuncompress($body);
} else {
return gzinflate($body);
}
return gzinflate($body);
}
}
1 change: 0 additions & 1 deletion library/Zend/Json/Encoder.php
Expand Up @@ -94,7 +94,6 @@ protected function _encodeValue(&$value)
}



/**
* Encode an object to JSON by encoding each of the public properties
*
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Json/Json.php
Expand Up @@ -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
Expand Down
15 changes: 5 additions & 10 deletions library/Zend/Ldap/Collection.php
Expand Up @@ -88,9 +88,8 @@ public function getFirst()
if ($this->count() > 0) {
$this->rewind();
return $this->current();
} else {
return null;
}
return null;
}

/**
Expand Down Expand Up @@ -135,9 +134,8 @@ public function current()
$this->cache[$this->current] = $this->createEntry($current);
}
return $this->cache[$this->current];
} else {
return null;
}
return null;
}

/**
Expand All @@ -163,9 +161,8 @@ public function dn()
$this->rewind();
}
return $this->iterator->key();
} else {
return null;
}
return null;
}

/**
Expand All @@ -181,9 +178,8 @@ public function key()
$this->rewind();
}
return $this->current;
} else {
return null;
}
return null;
}

/**
Expand Down Expand Up @@ -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 changes: 4 additions & 8 deletions library/Zend/Ldap/Dn.php
Expand Up @@ -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');
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Ldap/Ldap.php
Expand Up @@ -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();
Expand Down
10 changes: 4 additions & 6 deletions library/Zend/Ldap/Node.php
Expand Up @@ -395,9 +395,9 @@ public function willBeMoved()
return false;
} elseif ($this->newDn !== null) {
return ($this->dn != $this->newDn);
} else {
return false;
}

return false;
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions library/Zend/Mime/Part.php
Expand Up @@ -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);
}

/**
Expand All @@ -136,9 +135,8 @@ public function getRawContent()
{
if ($this->isStream) {
return stream_get_contents($this->content);
} else {
return $this->content;
}
return $this->content;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Paginator/Paginator.php
Expand Up @@ -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);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Soap/Wsdl.php
Expand Up @@ -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());
}

/**
Expand Down