Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 2d2a3fa

Browse files
committed
fixed CS
1 parent 4368c75 commit 2d2a3fa

33 files changed

+134
-118
lines changed

Acl/Dbal/AclProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function findAcls(array $oids, array $sids = array())
104104
$currentBatch = array();
105105
$oidLookup = array();
106106

107-
for ($i=0,$c=count($oids); $i<$c; $i++) {
107+
for ($i = 0,$c = count($oids); $i<$c; $i++) {
108108
$oid = $oids[$i];
109109
$oidLookupKey = $oid->getIdentifier().$oid->getType();
110110
$oidLookup[$oidLookupKey] = $oid;
@@ -500,8 +500,8 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
500500
$acls = $aces = $emptyArray = array();
501501
$oidCache = $oidLookup;
502502
$result = new \SplObjectStorage();
503-
$loadedAces =& $this->loadedAces;
504-
$loadedAcls =& $this->loadedAcls;
503+
$loadedAces = & $this->loadedAces;
504+
$loadedAcls = & $this->loadedAcls;
505505
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
506506

507507
// we need these to set protected properties on hydrated objects
@@ -593,7 +593,7 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
593593
// It is important to only ever have one ACE instance per actual row since
594594
// some ACEs are shared between ACL instances
595595
if (!isset($loadedAces[$aceId])) {
596-
if (!isset($sids[$key = ($username?'1':'0').$securityIdentifier])) {
596+
if (!isset($sids[$key = ($username ? '1' : '0').$securityIdentifier])) {
597597
if ($username) {
598598
$sids[$key] = new UserSecurityIdentity(
599599
substr($securityIdentifier, 1 + $pos = strpos($securityIdentifier, '-')),

Acl/Dbal/MutableAclProvider.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function propertyChanged($sender, $propertyName, $oldValue, $newValue)
188188
$propertyChanges['aces'] = new \SplObjectStorage();
189189
}
190190

191-
$acePropertyChanges = $propertyChanges['aces']->contains($ace)? $propertyChanges['aces']->offsetGet($ace) : array();
191+
$acePropertyChanges = $propertyChanges['aces']->contains($ace) ? $propertyChanges['aces']->offsetGet($ace) : array();
192192

193193
if (isset($acePropertyChanges[$propertyName])) {
194194
$oldValue = $acePropertyChanges[$propertyName][0];
@@ -448,8 +448,8 @@ class_id,
448448
$query,
449449
$this->options['entry_table_name'],
450450
$classId,
451-
null === $objectIdentityId? 'NULL' : intval($objectIdentityId),
452-
null === $field? 'NULL' : $this->connection->quote($field),
451+
null === $objectIdentityId ? 'NULL' : intval($objectIdentityId),
452+
null === $field ? 'NULL' : $this->connection->quote($field),
453453
$aceOrder,
454454
$securityIdentityId,
455455
$mask,
@@ -767,7 +767,7 @@ private function updateNewFieldAceProperty($name, array $changes)
767767
$classIds = new \SplObjectStorage();
768768
$currentIds = array();
769769
foreach ($changes[1] as $field => $new) {
770-
for ($i=0,$c=count($new); $i<$c; $i++) {
770+
for ($i = 0,$c = count($new); $i<$c; $i++) {
771771
$ace = $new[$i];
772772

773773
if (null === $ace->getId()) {
@@ -844,7 +844,7 @@ private function updateNewAceProperty($name, array $changes)
844844
$sids = new \SplObjectStorage();
845845
$classIds = new \SplObjectStorage();
846846
$currentIds = array();
847-
for ($i=0,$c=count($new); $i<$c; $i++) {
847+
for ($i = 0,$c = count($new); $i<$c; $i++) {
848848
$ace = $new[$i];
849849

850850
if (null === $ace->getId()) {
@@ -887,7 +887,7 @@ private function updateOldAceProperty($name, array $changes)
887887
list($old, $new) = $changes;
888888
$currentIds = array();
889889

890-
for ($i=0,$c=count($new); $i<$c; $i++) {
890+
for ($i = 0,$c = count($new); $i<$c; $i++) {
891891
$ace = $new[$i];
892892

893893
if (null !== $ace->getId()) {
@@ -925,11 +925,11 @@ private function updateAce(\SplObjectStorage $aces, $ace)
925925
if (isset($propertyChanges['aceOrder'])
926926
&& $propertyChanges['aceOrder'][1] > $propertyChanges['aceOrder'][0]
927927
&& $propertyChanges == $aces->offsetGet($ace)) {
928-
$aces->next();
929-
if ($aces->valid()) {
930-
$this->updateAce($aces, $aces->current());
931-
}
928+
$aces->next();
929+
if ($aces->valid()) {
930+
$this->updateAce($aces, $aces->current());
932931
}
932+
}
933933

934934
if (isset($propertyChanges['mask'])) {
935935
$sets[] = sprintf('mask = %d', $propertyChanges['mask'][1]);
@@ -949,5 +949,4 @@ private function updateAce(\SplObjectStorage $aces, $ace)
949949

950950
$this->connection->executeQuery($this->getUpdateAccessControlEntrySql($ace->getId(), $sets));
951951
}
952-
953952
}

Acl/Domain/Acl.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function getClassAces()
125125
*/
126126
public function getClassFieldAces($field)
127127
{
128-
return isset($this->classFieldAces[$field])? $this->classFieldAces[$field] : array();
128+
return isset($this->classFieldAces[$field]) ? $this->classFieldAces[$field] : array();
129129
}
130130

131131
/**
@@ -403,7 +403,7 @@ public function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditF
403403
*/
404404
private function deleteAce($property, $index)
405405
{
406-
$aces =& $this->$property;
406+
$aces = & $this->$property;
407407
if (!isset($aces[$index])) {
408408
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
409409
}
@@ -413,7 +413,7 @@ private function deleteAce($property, $index)
413413
$this->$property = array_values($this->$property);
414414
$this->onPropertyChanged($property, $oldValue, $this->$property);
415415

416-
for ($i=$index,$c=count($this->$property); $i<$c; $i++) {
416+
for ($i = $index,$c = count($this->$property); $i<$c; $i++) {
417417
$this->onEntryPropertyChanged($aces[$i], 'aceOrder', $i+1, $i);
418418
}
419419
}
@@ -428,7 +428,7 @@ private function deleteAce($property, $index)
428428
*/
429429
private function deleteFieldAce($property, $index, $field)
430430
{
431-
$aces =& $this->$property;
431+
$aces = & $this->$property;
432432
if (!isset($aces[$field][$index])) {
433433
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
434434
}
@@ -438,7 +438,7 @@ private function deleteFieldAce($property, $index, $field)
438438
$aces[$field] = array_values($aces[$field]);
439439
$this->onPropertyChanged($property, $oldValue, $this->$property);
440440

441-
for ($i=$index,$c=count($aces[$field]); $i<$c; $i++) {
441+
for ($i = $index,$c = count($aces[$field]); $i<$c; $i++) {
442442
$this->onEntryPropertyChanged($aces[$field][$i], 'aceOrder', $i+1, $i);
443443
}
444444
}
@@ -473,7 +473,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $
473473
}
474474
}
475475

476-
$aces =& $this->$property;
476+
$aces = & $this->$property;
477477
$oldValue = $this->$property;
478478
if (isset($aces[$index])) {
479479
$this->$property = array_merge(
@@ -482,7 +482,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $
482482
array_slice($this->$property, $index)
483483
);
484484

485-
for ($i=$index,$c=count($this->$property)-1; $i<$c; $i++) {
485+
for ($i = $index,$c = count($this->$property)-1; $i<$c; $i++) {
486486
$this->onEntryPropertyChanged($aces[$i+1], 'aceOrder', $i, $i+1);
487487
}
488488
}
@@ -522,7 +522,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
522522
}
523523
}
524524

525-
$aces =& $this->$property;
525+
$aces = & $this->$property;
526526
if (!isset($aces[$field])) {
527527
$aces[$field] = array();
528528
}
@@ -539,7 +539,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
539539
array_slice($aces[$field], $index)
540540
);
541541

542-
for ($i=$index,$c=count($aces[$field])-1; $i<$c; $i++) {
542+
for ($i = $index,$c = count($aces[$field])-1; $i<$c; $i++) {
543543
$this->onEntryPropertyChanged($aces[$field][$i+1], 'aceOrder', $i, $i+1);
544544
}
545545
}
@@ -559,7 +559,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
559559
*/
560560
private function updateAce($property, $index, $mask, $strategy = null)
561561
{
562-
$aces =& $this->$property;
562+
$aces = & $this->$property;
563563
if (!isset($aces[$index])) {
564564
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
565565
}
@@ -618,7 +618,7 @@ private function updateFieldAce($property, $index, $field, $mask, $strategy = nu
618618
throw new \InvalidArgumentException('$field cannot be empty.');
619619
}
620620

621-
$aces =& $this->$property;
621+
$aces = & $this->$property;
622622
if (!isset($aces[$field][$index])) {
623623
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
624624
}

Acl/Permission/MaskBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function getPattern()
128128
$length = strlen($pattern);
129129
$bitmask = str_pad(decbin($this->mask), $length, '0', STR_PAD_LEFT);
130130

131-
for ($i=$length-1; $i>=0; $i--) {
131+
for ($i = $length-1; $i >= 0; $i--) {
132132
if ('1' === $bitmask[$i]) {
133133
try {
134134
$pattern[$i] = self::getCode(1 << ($length - $i - 1));

Acl/Voter/AclVoter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function vote(TokenInterface $token, $object, array $attributes)
6464

6565
if (null === $object) {
6666
if (null !== $this->logger) {
67-
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable? 'grant access' : 'abstain'));
67+
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable ? 'grant access' : 'abstain'));
6868
}
6969

7070
return $this->allowIfObjectIdentityUnavailable ? self::ACCESS_GRANTED : self::ACCESS_ABSTAIN;
@@ -79,7 +79,7 @@ public function vote(TokenInterface $token, $object, array $attributes)
7979
$oid = $object;
8080
} elseif (null === $oid = $this->objectIdentityRetrievalStrategy->getObjectIdentity($object)) {
8181
if (null !== $this->logger) {
82-
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable? 'grant access' : 'abstain'));
82+
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable ? 'grant access' : 'abstain'));
8383
}
8484

8585
return $this->allowIfObjectIdentityUnavailable ? self::ACCESS_GRANTED : self::ACCESS_ABSTAIN;

Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ public function authenticate(TokenInterface $token)
5656
return;
5757
}
5858

59-
if (!$user = $token->getUser()) {
60-
throw new BadCredentialsException('No pre-authenticated principal found in request.');
61-
}
59+
if (!$user = $token->getUser()) {
60+
throw new BadCredentialsException('No pre-authenticated principal found in request.');
61+
}
6262
/*
6363
if (null === $token->getCredentials()) {
6464
throw new BadCredentialsException('No pre-authenticated credentials found in request.');
6565
}
6666
*/
6767
$user = $this->userProvider->loadUserByUsername($user);
6868

69-
$this->userChecker->checkPostAuth($user);
69+
$this->userChecker->checkPostAuth($user);
7070

71-
$authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles());
72-
$authenticatedToken->setAttributes($token->getAttributes());
71+
$authenticatedToken = new PreAuthenticatedToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles());
72+
$authenticatedToken->setAttributes($token->getAttributes());
7373

74-
return $authenticatedToken;
75-
}
74+
return $authenticatedToken;
75+
}
7676

7777
/**
7878
* {@inheritdoc}

Core/Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function serialize()
154154
is_object($this->user) ? clone $this->user : $this->user,
155155
$this->authenticated,
156156
$this->roles,
157-
$this->attributes
157+
$this->attributes,
158158
)
159159
);
160160
}

Core/Util/ClassUtils.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class ClassUtils
3939
/**
4040
* This class should not be instantiated
4141
*/
42-
private function __construct() {}
42+
private function __construct()
43+
{
44+
}
4345

4446
/**
4547
* Gets the real class name of a class name that could be a proxy.

Core/Util/StringUtils.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class StringUtils
2121
/**
2222
* This class should not be instantiated
2323
*/
24-
private function __construct() {}
24+
private function __construct()
25+
{
26+
}
2527

2628
/**
2729
* Compares two strings.

Http/Authentication/DefaultAuthenticationFailureHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtil
5353
'failure_path' => null,
5454
'failure_forward' => false,
5555
'login_path' => '/login',
56-
'failure_path_parameter' => '_failure_path'
56+
'failure_path_parameter' => '_failure_path',
5757
), $options);
5858
}
5959

@@ -63,7 +63,7 @@ public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtil
6363
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
6464
{
6565
if ($failureUrl = $request->get($this->options['failure_path_parameter'], null, true)) {
66-
$this->options['failure_path'] = $failureUrl;
66+
$this->options['failure_path'] = $failureUrl;
6767
}
6868

6969
if (null === $this->options['failure_path']) {

Http/RememberMe/TokenBasedRememberMeServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function generateCookieValue($class, $username, $expires, $password)
129129
$class,
130130
base64_encode($username),
131131
$expires,
132-
$this->generateCookieHash($class, $username, $expires, $password)
132+
$this->generateCookieHash($class, $username, $expires, $password),
133133
));
134134
}
135135

Tests/Acl/Dbal/AclProviderBenchmarkTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function generateTestData()
9696
$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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
9797
$this->insertOidAncestorStmt = $this->con->prepare('INSERT INTO acl_object_identity_ancestors (object_identity_id, ancestor_id) VALUES (?, ?)');
9898

99-
for ($i=0; $i<40000; $i++) {
99+
for ($i = 0; $i<40000; $i++) {
100100
$this->generateAclHierarchy();
101101
}
102102
}
@@ -111,7 +111,7 @@ protected function generateAclHierarchy()
111111
protected function generateAclLevel($depth, $parentId, $ancestors)
112112
{
113113
$level = count($ancestors);
114-
for ($i=0,$t=rand(1, 10); $i<$t; $i++) {
114+
for ($i = 0,$t = rand(1, 10); $i<$t; $i++) {
115115
$id = $this->generateAcl($this->chooseClassId(), $parentId, $ancestors);
116116

117117
if ($level < $depth) {
@@ -165,7 +165,7 @@ protected function chooseSid()
165165
$this->insertSidStmt->execute(array(
166166
$id,
167167
$this->getRandomString(rand(5, 30)),
168-
rand(0, 1)
168+
rand(0, 1),
169169
));
170170
$id += 1;
171171

@@ -182,7 +182,7 @@ protected function generateAces($classId, $objectId)
182182
$sids = array();
183183
$fieldOrder = array();
184184

185-
for ($i=0; $i<=30; $i++) {
185+
for ($i = 0; $i <= 30; $i++) {
186186
$fieldName = rand(0, 1) ? null : $this->getRandomString(rand(10, 20));
187187

188188
do {

Tests/Acl/Dbal/MutableAclProviderTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public function testDeleteAcl()
8888
try {
8989
$provider->findAcl($oid);
9090
$this->fail('ACL has not been properly deleted.');
91-
} catch (AclNotFoundException $notFound) { }
91+
} catch (AclNotFoundException $notFound) {
92+
}
9293
}
9394

9495
public function testDeleteAclDeletesChildren()
@@ -103,7 +104,8 @@ public function testDeleteAclDeletesChildren()
103104
try {
104105
$provider->findAcl(new ObjectIdentity(1, 'Foo'));
105106
$this->fail('Child-ACLs have not been deleted.');
106-
} catch (AclNotFoundException $notFound) { }
107+
} catch (AclNotFoundException $notFound) {
108+
}
107109
}
108110

109111
public function testFindAclsAddsPropertyListener()
@@ -148,7 +150,7 @@ public function testFindAclsAddsPropertyListenerToParentAcls()
148150
'parent' => array(
149151
'object_identifier' => '1',
150152
'class_type' => 'anotherFoo',
151-
)
153+
),
152154
));
153155

154156
$propertyChanges = $this->getField($provider, 'propertyChanges');
@@ -288,7 +290,8 @@ public function testUpdateAclThrowsExceptionOnConcurrentModificationOfSharedProp
288290
try {
289291
$provider->updateAcl($acl1);
290292
$this->fail('Provider failed to detect a concurrent modification.');
291-
} catch (ConcurrentModificationException $ex) { }
293+
} catch (ConcurrentModificationException $ex) {
294+
}
292295
}
293296

294297
public function testUpdateAcl()

0 commit comments

Comments
 (0)