merged branch rouffj/cs (PR #2671)

Commits
-------

c89d45b Fix cs

Discussion
----------

Fix cs

---------------------------------------------------------------------------

by rouffj at 2011/11/17 23:30:29 -0800

lsmith77: ok, so i revert my change only on RequestMatcher file ?
This commit is contained in:
Fabien Potencier 2011-11-18 12:50:14 +01:00
commit 3b9776aee6
5 changed files with 23 additions and 18 deletions

View File

@ -204,14 +204,14 @@ class RequestMatcher implements RequestMatcherInterface
list($address, $netmask) = explode('/', $ip);
$bytes_addr = unpack("n*", inet_pton($address));
$bytes_test = unpack("n*", inet_pton($requestIp));
$bytesAddr = unpack("n*", inet_pton($address));
$bytesTest = unpack("n*", inet_pton($requestIp));
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
$left = $netmask - 16 * ($i-1);
$left = ($left <= 16) ? $left : 16;
$mask = ~(0xffff >> $left) & 0xffff;
if (($bytes_addr[$i] & $mask) != ($bytes_test[$i] & $mask)) {
if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) {
return false;
}
}

View File

@ -68,7 +68,8 @@ abstract class StubIntl
* @param integer $errorCode The error code returned by StubIntl::getErrorCode()
* @return Boolean
*/
static public function isFailure($errorCode) {
static public function isFailure($errorCode)
{
return in_array($errorCode, static::$errorCodes, true)
&& $errorCode !== self::U_ZERO_ERROR;
}
@ -80,7 +81,8 @@ abstract class StubIntl
*
* @return integer
*/
static public function getErrorCode() {
static public function getErrorCode()
{
return static::$errorCode;
}
@ -91,7 +93,8 @@ abstract class StubIntl
*
* @return string
*/
static public function getErrorMessage() {
static public function getErrorMessage()
{
return static::$errorMessages[static::$errorCode];
}
@ -102,7 +105,8 @@ abstract class StubIntl
* @throws \InvalidArgumentException If the code is not one of the error
* constants in this class
*/
static public function setErrorCode($code) {
static public function setErrorCode($code)
{
if (!isset(static::$errorMessages[$code])) {
throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
}

View File

@ -764,7 +764,8 @@ class StubNumberFormatter
* @param mixed $value The value to be normalized
* @return int The normalized value for the attribute (0 or 1)
*/
private function normalizeGroupingUsedValue($value) {
private function normalizeGroupingUsedValue($value)
{
return (int) (Boolean) (int) $value;
}

View File

@ -26,7 +26,7 @@ class MoFileDumper extends FileDumper
*/
public function format(MessageCatalogue $messages, $domain = 'messages')
{
$output = $sources = $targets = $source_offsets = $target_offsets = '';
$output = $sources = $targets = $sourceOffsets = $targetOffsets = '';
$offsets = array();
$size = 0;
@ -47,19 +47,19 @@ class MoFileDumper extends FileDumper
'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size),
);
$sources_size = strlen($sources);
$sources_start = $header['offsetHashes'] + 1;
$sourcesSize = strlen($sources);
$sourcesStart = $header['offsetHashes'] + 1;
foreach ($offsets as $offset) {
$source_offsets .= $this->writeLong($offset[1])
. $this->writeLong($offset[0] + $sources_start);
$target_offsets .= $this->writeLong($offset[3])
. $this->writeLong($offset[2] + $sources_start + $sources_size);
$sourceOffsets .= $this->writeLong($offset[1])
. $this->writeLong($offset[0] + $sourcesStart);
$targetOffsets .= $this->writeLong($offset[3])
. $this->writeLong($offset[2] + $sourcesStart + $sourcesSize);
}
$output = implode(array_map(array($this, 'writeLong'), $header))
. $source_offsets
. $target_offsets
. $sourceOffsets
. $targetOffsets
. $sources
. $targets
;

View File

@ -101,4 +101,4 @@ class PoFileLoader extends ArrayLoader implements LoaderInterface
return array_filter($messages);
}
}
}