CS: Binary operators should be arounded by at least one space
This commit is contained in:
parent
0b1f17206c
commit
ec2cec6fd8
@ -87,7 +87,7 @@ class DbalLoggerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$testString = 'abc';
|
$testString = 'abc';
|
||||||
|
|
||||||
$shortString = str_pad('', DbalLogger::MAX_STRING_LENGTH, $testString);
|
$shortString = str_pad('', DbalLogger::MAX_STRING_LENGTH, $testString);
|
||||||
$longString = str_pad('', DbalLogger::MAX_STRING_LENGTH+1, $testString);
|
$longString = str_pad('', DbalLogger::MAX_STRING_LENGTH + 1, $testString);
|
||||||
|
|
||||||
$dbalLogger
|
$dbalLogger
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -138,7 +138,7 @@ class PropelLogger
|
|||||||
$trace = debug_backtrace();
|
$trace = debug_backtrace();
|
||||||
$method = $trace[2]['args'][2];
|
$method = $trace[2]['args'][2];
|
||||||
|
|
||||||
$watch = 'Propel Query '.(count($this->queries)+1);
|
$watch = 'Propel Query '.(count($this->queries) + 1);
|
||||||
if ('PropelPDO::prepare' === $method) {
|
if ('PropelPDO::prepare' === $method) {
|
||||||
$this->isPrepared = true;
|
$this->isPrepared = true;
|
||||||
$this->stopwatch->start($watch, 'propel');
|
$this->stopwatch->start($watch, 'propel');
|
||||||
|
@ -204,7 +204,7 @@ class Cookie
|
|||||||
private static function parseDate($dateValue)
|
private static function parseDate($dateValue)
|
||||||
{
|
{
|
||||||
// trim single quotes around date if present
|
// trim single quotes around date if present
|
||||||
if (($length = strlen($dateValue)) > 1 && "'" === $dateValue[0] && "'" === $dateValue[$length-1]) {
|
if (($length = strlen($dateValue)) > 1 && "'" === $dateValue[0] && "'" === $dateValue[$length - 1]) {
|
||||||
$dateValue = substr($dateValue, 1, -1);
|
$dateValue = substr($dateValue, 1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ class PrototypedArrayNode extends ArrayNode
|
|||||||
|
|
||||||
$value = $this->remapXml($value);
|
$value = $this->remapXml($value);
|
||||||
|
|
||||||
$isAssoc = array_keys($value) !== range(0, count($value) -1);
|
$isAssoc = array_keys($value) !== range(0, count($value) - 1);
|
||||||
$normalized = array();
|
$normalized = array();
|
||||||
foreach ($value as $k => $v) {
|
foreach ($value as $k => $v) {
|
||||||
if (null !== $this->keyAttribute && is_array($v)) {
|
if (null !== $this->keyAttribute && is_array($v)) {
|
||||||
|
@ -93,7 +93,7 @@ abstract class FileLoader extends Loader
|
|||||||
$resources = is_array($resource) ? $resource : array($resource);
|
$resources = is_array($resource) ? $resource : array($resource);
|
||||||
for ($i = 0; $i < $resourcesCount = count($resources); $i++) {
|
for ($i = 0; $i < $resourcesCount = count($resources); $i++) {
|
||||||
if (isset(self::$loading[$resources[$i]])) {
|
if (isset(self::$loading[$resources[$i]])) {
|
||||||
if ($i == $resourcesCount-1) {
|
if ($i == $resourcesCount - 1) {
|
||||||
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
|
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -96,7 +96,7 @@ class OutputFormatterStyleStack
|
|||||||
return $this->emptyStyle;
|
return $this->emptyStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->styles[count($this->styles)-1];
|
return $this->styles[count($this->styles) - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1342,14 +1342,14 @@ EOF;
|
|||||||
$i = $this->variableCount;
|
$i = $this->variableCount;
|
||||||
|
|
||||||
if ('' === $name) {
|
if ('' === $name) {
|
||||||
$name .= $firstChars[$i%$firstCharsLength];
|
$name .= $firstChars[$i % $firstCharsLength];
|
||||||
$i = (int) ($i/$firstCharsLength);
|
$i = (int) ($i / $firstCharsLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($i > 0) {
|
while ($i > 0) {
|
||||||
--$i;
|
--$i;
|
||||||
$name .= $nonFirstChars[$i%$nonFirstCharsLength];
|
$name .= $nonFirstChars[$i % $nonFirstCharsLength];
|
||||||
$i = (int) ($i/$nonFirstCharsLength);
|
$i = (int) ($i / $nonFirstCharsLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
++$this->variableCount;
|
++$this->variableCount;
|
||||||
|
@ -272,7 +272,7 @@ abstract class AbstractFindAdapter extends AbstractAdapter
|
|||||||
foreach ($dates as $i => $date) {
|
foreach ($dates as $i => $date) {
|
||||||
$command->add($i > 0 ? '-and' : null);
|
$command->add($i > 0 ? '-and' : null);
|
||||||
|
|
||||||
$mins = (int) round((time()-$date->getTarget()) / 60);
|
$mins = (int) round((time() - $date->getTarget()) / 60);
|
||||||
|
|
||||||
if (0 > $mins) {
|
if (0 > $mins) {
|
||||||
// mtime is in the future
|
// mtime is in the future
|
||||||
|
@ -64,13 +64,13 @@ class NumberComparator extends Comparator
|
|||||||
$target *= 1000000;
|
$target *= 1000000;
|
||||||
break;
|
break;
|
||||||
case 'mi':
|
case 'mi':
|
||||||
$target *= 1024*1024;
|
$target *= 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
$target *= 1000000000;
|
$target *= 1000000000;
|
||||||
break;
|
break;
|
||||||
case 'gi':
|
case 'gi':
|
||||||
$target *= 1024*1024*1024;
|
$target *= 1024 * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ class Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->bits[] = self::create($this);
|
$this->bits[] = self::create($this);
|
||||||
$this->labels[$label] = count($this->bits)-1;
|
$this->labels[$label] = count($this->bits) - 1;
|
||||||
|
|
||||||
return $this->bits[$this->labels[$label]];
|
return $this->bits[$this->labels[$label]];
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,10 @@ class NumberComparatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('==1KI', array('1024'), array('1023', '1025')),
|
array('==1KI', array('1024'), array('1023', '1025')),
|
||||||
|
|
||||||
array('==1m', array('1000000'), array('999999', '1000001')),
|
array('==1m', array('1000000'), array('999999', '1000001')),
|
||||||
array('==1mi', array(1024*1024), array(1024*1024-1, 1024*1024+1)),
|
array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)),
|
||||||
|
|
||||||
array('==1g', array('1000000000'), array('999999999', '1000000001')),
|
array('==1g', array('1000000000'), array('999999999', '1000000001')),
|
||||||
array('==1gi', array(1024*1024*1024), array(1024*1024*1024-1, 1024*1024*1024+1)),
|
array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)),
|
||||||
|
|
||||||
array('!= 1000', array('500', '999'), array('1000')),
|
array('!= 1000', array('500', '999'), array('1000')),
|
||||||
);
|
);
|
||||||
|
@ -111,7 +111,7 @@ class IpUtils
|
|||||||
$bytesTest = unpack('n*', inet_pton($requestIp));
|
$bytesTest = unpack('n*', inet_pton($requestIp));
|
||||||
|
|
||||||
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
|
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
|
||||||
$left = $netmask - 16 * ($i-1);
|
$left = $netmask - 16 * ($i - 1);
|
||||||
$left = ($left <= 16) ? $left : 16;
|
$left = ($left <= 16) ? $left : 16;
|
||||||
$mask = ~(0xffff >> $left) & 0xffff;
|
$mask = ~(0xffff >> $left) & 0xffff;
|
||||||
if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) {
|
if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) {
|
||||||
|
@ -125,7 +125,7 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($parts[count($parts)-1]);
|
unset($parts[count($parts) - 1]);
|
||||||
|
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
if (null !== $array && !array_key_exists($part, $array)) {
|
if (null !== $array && !array_key_exists($part, $array)) {
|
||||||
@ -150,7 +150,7 @@ class NamespacedAttributeBag extends AttributeBag
|
|||||||
protected function resolveKey($name)
|
protected function resolveKey($name)
|
||||||
{
|
{
|
||||||
if (strpos($name, $this->namespaceCharacter) !== false) {
|
if (strpos($name, $this->namespaceCharacter) !== false) {
|
||||||
$name = substr($name, strrpos($name, $this->namespaceCharacter)+1, strlen($name));
|
$name = substr($name, strrpos($name, $this->namespaceCharacter) + 1, strlen($name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
|
@ -119,14 +119,14 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testCookieIsNotCleared()
|
public function testCookieIsNotCleared()
|
||||||
{
|
{
|
||||||
$cookie = new Cookie('foo', 'bar', time()+3600*24);
|
$cookie = new Cookie('foo', 'bar', time() + 3600 * 24);
|
||||||
|
|
||||||
$this->assertFalse($cookie->isCleared(), '->isCleared() returns false if the cookie did not expire yet');
|
$this->assertFalse($cookie->isCleared(), '->isCleared() returns false if the cookie did not expire yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCookieIsCleared()
|
public function testCookieIsCleared()
|
||||||
{
|
{
|
||||||
$cookie = new Cookie('foo', 'bar', time()-20);
|
$cookie = new Cookie('foo', 'bar', time() - 20);
|
||||||
|
|
||||||
$this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired');
|
$this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired');
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly', $cookie->__toString(), '->__toString() returns string representation of the cookie');
|
$this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly', $cookie->__toString(), '->__toString() returns string representation of the cookie');
|
||||||
|
|
||||||
$cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
|
$cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
|
||||||
$this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time()-31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');
|
$this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');
|
||||||
|
|
||||||
$cookie = new Cookie('foo', 'bar', 0, '/', '');
|
$cookie = new Cookie('foo', 'bar', 0, '/', '');
|
||||||
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());
|
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());
|
||||||
|
@ -29,7 +29,7 @@ function strip_minor_versions($version)
|
|||||||
|
|
||||||
function centered($text)
|
function centered($text)
|
||||||
{
|
{
|
||||||
$padding = (int) ((LINE_WIDTH - strlen($text))/2);
|
$padding = (int) ((LINE_WIDTH - strlen($text)) / 2);
|
||||||
|
|
||||||
return str_repeat(' ', $padding).$text;
|
return str_repeat(' ', $padding).$text;
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ class ApacheUrlMatcher extends UrlMatcher
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (false !== $pos = strpos($name, '_', 9)) {
|
if (false !== $pos = strpos($name, '_', 9)) {
|
||||||
$type = substr($name, 9, $pos-9);
|
$type = substr($name, 9, $pos - 9);
|
||||||
$name = substr($name, $pos+1);
|
$name = substr($name, $pos + 1);
|
||||||
} else {
|
} else {
|
||||||
$type = substr($name, 9);
|
$type = substr($name, 9);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class ApacheMatcherDumper extends MatcherDumper
|
|||||||
$variables[] = sprintf('E=__ROUTING_host_%s:1', $hostRegexUnique);
|
$variables[] = sprintf('E=__ROUTING_host_%s:1', $hostRegexUnique);
|
||||||
|
|
||||||
foreach ($compiledRoute->getHostVariables() as $i => $variable) {
|
foreach ($compiledRoute->getHostVariables() as $i => $variable) {
|
||||||
$variables[] = sprintf('E=__ROUTING_host_%s_%s:%%%d', $hostRegexUnique, $variable, $i+1);
|
$variables[] = sprintf('E=__ROUTING_host_%s_%s:%%%d', $hostRegexUnique, $variable, $i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$variables = implode(',', $variables);
|
$variables = implode(',', $variables);
|
||||||
|
@ -67,7 +67,7 @@ class DumperPrefixCollection extends DumperCollection
|
|||||||
// Prefix starts with route's prefix
|
// Prefix starts with route's prefix
|
||||||
if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) {
|
if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) {
|
||||||
$child = new DumperPrefixCollection();
|
$child = new DumperPrefixCollection();
|
||||||
$child->setPrefix(substr($prefix, 0, strlen($collection->prefix)+1));
|
$child->setPrefix(substr($prefix, 0, strlen($collection->prefix) + 1));
|
||||||
$collection->add($child);
|
$collection->add($child);
|
||||||
|
|
||||||
return $child->addPrefixRoute($route);
|
return $child->addPrefixRoute($route);
|
||||||
|
@ -104,7 +104,7 @@ class AclProvider implements AclProviderInterface
|
|||||||
$currentBatch = array();
|
$currentBatch = array();
|
||||||
$oidLookup = array();
|
$oidLookup = array();
|
||||||
|
|
||||||
for ($i = 0, $c = count($oids); $i<$c; $i++) {
|
for ($i = 0, $c = count($oids); $i < $c; $i++) {
|
||||||
$oid = $oids[$i];
|
$oid = $oids[$i];
|
||||||
$oidLookupKey = $oid->getIdentifier().$oid->getType();
|
$oidLookupKey = $oid->getIdentifier().$oid->getType();
|
||||||
$oidLookup[$oidLookupKey] = $oid;
|
$oidLookup[$oidLookupKey] = $oid;
|
||||||
@ -313,7 +313,7 @@ SELECTCLAUSE;
|
|||||||
$this->connection->quote($batch[$i]->getType())
|
$this->connection->quote($batch[$i]->getType())
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($i+1 < $count) {
|
if ($i + 1 < $count) {
|
||||||
$sql .= ' OR ';
|
$sql .= ' OR ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -786,7 +786,7 @@ QUERY;
|
|||||||
$sids = new \SplObjectStorage();
|
$sids = new \SplObjectStorage();
|
||||||
$classIds = new \SplObjectStorage();
|
$classIds = new \SplObjectStorage();
|
||||||
foreach ($changes[1] as $field => $new) {
|
foreach ($changes[1] as $field => $new) {
|
||||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||||
$ace = $new[$i];
|
$ace = $new[$i];
|
||||||
|
|
||||||
if (null === $ace->getId()) {
|
if (null === $ace->getId()) {
|
||||||
@ -860,7 +860,7 @@ QUERY;
|
|||||||
|
|
||||||
$sids = new \SplObjectStorage();
|
$sids = new \SplObjectStorage();
|
||||||
$classIds = new \SplObjectStorage();
|
$classIds = new \SplObjectStorage();
|
||||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||||
$ace = $new[$i];
|
$ace = $new[$i];
|
||||||
|
|
||||||
if (null === $ace->getId()) {
|
if (null === $ace->getId()) {
|
||||||
@ -901,7 +901,7 @@ QUERY;
|
|||||||
list($old, $new) = $changes;
|
list($old, $new) = $changes;
|
||||||
$currentIds = array();
|
$currentIds = array();
|
||||||
|
|
||||||
for ($i = 0, $c = count($new); $i<$c; $i++) {
|
for ($i = 0, $c = count($new); $i < $c; $i++) {
|
||||||
$ace = $new[$i];
|
$ace = $new[$i];
|
||||||
|
|
||||||
if (null !== $ace->getId()) {
|
if (null !== $ace->getId()) {
|
||||||
|
@ -415,8 +415,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
$this->$property = array_values($this->$property);
|
$this->$property = array_values($this->$property);
|
||||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||||
|
|
||||||
for ($i = $index, $c = count($this->$property); $i<$c; $i++) {
|
for ($i = $index, $c = count($this->$property); $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i+1, $i);
|
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i + 1, $i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,8 +441,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
$aces[$field] = array_values($aces[$field]);
|
$aces[$field] = array_values($aces[$field]);
|
||||||
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
$this->onPropertyChanged($property, $oldValue, $this->$property);
|
||||||
|
|
||||||
for ($i = $index, $c = count($aces[$field]); $i<$c; $i++) {
|
for ($i = $index, $c = count($aces[$field]); $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i+1, $i);
|
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i + 1, $i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,8 +486,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
array_slice($this->$property, $index)
|
array_slice($this->$property, $index)
|
||||||
);
|
);
|
||||||
|
|
||||||
for ($i = $index, $c = count($this->$property)-1; $i<$c; $i++) {
|
for ($i = $index, $c = count($this->$property) - 1; $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$i+1], 'aceOrder', $i, $i+1);
|
$this->onEntryPropertyChanged($aces[$i + 1], 'aceOrder', $i, $i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,8 +544,8 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
|
|||||||
array_slice($aces[$field], $index)
|
array_slice($aces[$field], $index)
|
||||||
);
|
);
|
||||||
|
|
||||||
for ($i = $index, $c = count($aces[$field])-1; $i<$c; $i++) {
|
for ($i = $index, $c = count($aces[$field]) - 1; $i < $c; $i++) {
|
||||||
$this->onEntryPropertyChanged($aces[$field][$i+1], 'aceOrder', $i, $i+1);
|
$this->onEntryPropertyChanged($aces[$field][$i + 1], 'aceOrder', $i, $i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class MaskBuilder
|
|||||||
$length = strlen($pattern);
|
$length = strlen($pattern);
|
||||||
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
|
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
for ($i = $length-1; $i >= 0; $i--) {
|
for ($i = $length - 1; $i >= 0; $i--) {
|
||||||
if ('1' === $bitmask[$i]) {
|
if ('1' === $bitmask[$i]) {
|
||||||
try {
|
try {
|
||||||
$pattern[$i] = self::getCode(1 << ($length - $i - 1));
|
$pattern[$i] = self::getCode(1 << ($length - $i - 1));
|
||||||
|
@ -235,7 +235,7 @@ abstract class AbstractToken implements TokenInterface
|
|||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
$class = get_class($this);
|
$class = get_class($this);
|
||||||
$class = substr($class, strrpos($class, '\\')+1);
|
$class = substr($class, strrpos($class, '\\') + 1);
|
||||||
|
|
||||||
$roles = array();
|
$roles = array();
|
||||||
foreach ($this->roles as $role) {
|
foreach ($this->roles as $role) {
|
||||||
|
@ -92,7 +92,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->insertEntryStmt = $this->con->prepare('INSERT INTO acl_entries (id, class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
|
$this->insertEntryStmt = $this->con->prepare('INSERT INTO acl_entries (id, class_id, object_identity_id, field_name, ace_order, security_identity_id, mask, granting, granting_strategy, audit_success, audit_failure) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
|
||||||
$this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)');
|
$this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)');
|
||||||
|
|
||||||
for ($i = 0; $i<40000; $i++) {
|
for ($i = 0; $i < 40000; $i++) {
|
||||||
$this->generateAclHierarchy();
|
$this->generateAclHierarchy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function generateAclLevel($depth, $parentId, $ancestors)
|
protected function generateAclLevel($depth, $parentId, $ancestors)
|
||||||
{
|
{
|
||||||
$level = count($ancestors);
|
$level = count($ancestors);
|
||||||
for ($i = 0, $t = rand(1, 10); $i<$t; $i++) {
|
for ($i = 0, $t = rand(1, 10); $i < $t; $i++) {
|
||||||
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
|
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
|
||||||
|
|
||||||
if ($level < $depth) {
|
if ($level < $depth) {
|
||||||
@ -124,9 +124,9 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
|
$this->insertClassStmt->execute(array($id, $this->getRandomString(rand(20, 100), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\_')));
|
||||||
++$id;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id - 1;
|
||||||
} else {
|
} else {
|
||||||
return rand(1000, $id-1);
|
return rand(1000, $id - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->generateAces($classId, $id);
|
$this->generateAces($classId, $id);
|
||||||
++$id;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function chooseSid()
|
protected function chooseSid()
|
||||||
@ -165,9 +165,9 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
));
|
));
|
||||||
++$id;
|
++$id;
|
||||||
|
|
||||||
return $id-1;
|
return $id - 1;
|
||||||
} else {
|
} else {
|
||||||
return rand(1000, $id-1);
|
return rand(1000, $id - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$sid = $this->chooseSid();
|
$sid = $this->chooseSid();
|
||||||
} while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
|
} while (array_key_exists($sid, $sids) && in_array($fieldName, $sids[$sid], true));
|
||||||
|
|
||||||
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName]+1 : 0;
|
$fieldOrder[$fieldName] = array_key_exists($fieldName, $fieldOrder) ? $fieldOrder[$fieldName] + 1 : 0;
|
||||||
if (!isset($sids[$sid])) {
|
if (!isset($sids[$sid])) {
|
||||||
$sids[$sid] = array();
|
$sids[$sid] = array();
|
||||||
}
|
}
|
||||||
@ -238,7 +238,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$cLength = strlen($chars);
|
$cLength = strlen($chars);
|
||||||
|
|
||||||
while (strlen($s) < $length) {
|
while (strlen($s) < $length) {
|
||||||
$s .= $chars[mt_rand(0, $cLength-1)];
|
$s .= $chars[mt_rand(0, $cLength - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
|
@ -49,7 +49,7 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
|||||||
$f += $c[$i] * $c[$i];
|
$f += $c[$i] * $c[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
$Y = 16/5000 * $f - 5000;
|
$Y = 16 / 5000 * $f - 5000;
|
||||||
|
|
||||||
$this->assertTrue($Y > 1.03 && $Y < 57.4, 'Poker test failed, Y = '.$Y);
|
$this->assertTrue($Y > 1.03 && $Y < 57.4, 'Poker test failed, Y = '.$Y);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
$userProvider = $this->getProvider();
|
$userProvider = $this->getProvider();
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass'));
|
||||||
|
|
||||||
$userProvider
|
$userProvider
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@ -129,7 +129,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
|
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() + 3600, 'foopass'));
|
||||||
|
|
||||||
$returnedToken = $service->autoLogin($request);
|
$returnedToken = $service->autoLogin($request);
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ class PoFileLoader extends ArrayLoader
|
|||||||
end($plurals);
|
end($plurals);
|
||||||
$count = key($plurals);
|
$count = key($plurals);
|
||||||
// Fill missing spots with '-'.
|
// Fill missing spots with '-'.
|
||||||
$empties = array_fill(0, $count+1, '-');
|
$empties = array_fill(0, $count + 1, '-');
|
||||||
$plurals += $empties;
|
$plurals += $empties;
|
||||||
ksort($plurals);
|
ksort($plurals);
|
||||||
$messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals));
|
$messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals));
|
||||||
|
@ -60,7 +60,7 @@ class IssnValidator extends ConstraintValidator
|
|||||||
|
|
||||||
for ($i = 0; $i < 7; ++$i) {
|
for ($i = 0; $i < 7; ++$i) {
|
||||||
// Multiply the first digit by 8, the second by 7, etc.
|
// Multiply the first digit by 8, the second by 7, etc.
|
||||||
$checkSum += (8-$i) * $canonical{$i};
|
$checkSum += (8 - $i) * $canonical{$i};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 !== $checkSum % 11) {
|
if (0 !== $checkSum % 11) {
|
||||||
|
@ -151,7 +151,7 @@ abstract class FileValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
*/
|
*/
|
||||||
public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix)
|
public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix)
|
||||||
{
|
{
|
||||||
fseek($this->file, $bytesWritten-1, SEEK_SET);
|
fseek($this->file, $bytesWritten - 1, SEEK_SET);
|
||||||
fwrite($this->file, '0');
|
fwrite($this->file, '0');
|
||||||
fclose($this->file);
|
fclose($this->file);
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ abstract class FileValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
*/
|
*/
|
||||||
public function testMaxSizeNotExceeded($bytesWritten, $limit)
|
public function testMaxSizeNotExceeded($bytesWritten, $limit)
|
||||||
{
|
{
|
||||||
fseek($this->file, $bytesWritten-1, SEEK_SET);
|
fseek($this->file, $bytesWritten - 1, SEEK_SET);
|
||||||
fwrite($this->file, '0');
|
fwrite($this->file, '0');
|
||||||
fclose($this->file);
|
fclose($this->file);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user