8000 [Security][Acl] CS fix for commit: 3c3a90b9e5c78f89027169a33e80cfa76b… · symfony/symfony@d570dbe · GitHub
[go: up one dir, main page]

Skip to content

Commit d570dbe

Browse files
committed
[Security][Acl] CS fix for commit: 3c3a90b
1 parent 3c3a90b commit d570dbe

File tree

1 file changed

+35
-39
lines changed

1 file changed

+35
-39
lines changed

src/Symfony/Component/Security/Acl/Dbal/AclProvider.php

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -257,47 +257,43 @@ protected function getAncestorLookupSql(array $batch)
257257
INNER JOIN {$this->options['oid_ancestors_table_name']} a ON a.object_identity_id = o.id
258258
WHERE (
259259
SELECTCLAUSE;
260-
261-
$types = array();
262-
for ($i=0,$c=count($batch); $i<$c; $i++) {
263-
if(!isset($types[$batch[$i]->getType()])) {
264-
$types[$batch[$i]->getType()] = true;
265-
if(count($batch) > 1) {
266-
break;
267-
}
268-
}
260+
261+
$types = array();
262+
$count = count($batch);
263+
for ($i = 0; $i < $count; $i++) {
264+
if (!isset($types[$batch[$i]->getType()])) {
265+
$types[$batch[$i]->getType()] = true;
266+
if ($count > 1) {
267+
break;
268+
}
269+
}
269270
}
270-
271-
if(count($types) === 1) {
272-
273-
$where = '(o.object_identifier IN (%s) AND c.class_type = %s)';
274-
$ids = array();
275-
for ($i=0,$c=count($batch); $i<$c; $i++) {
276-
$ids[] = $this->connection->quote($batch[$i]->getIdentifier());
277-
}
278-
279-
$sql .= sprintf(
280-
$where,
281-
implode(',', $ids),
282-
$this->connection->quote($batch[0]->getType())
283-
);
284-
271+
272+
if (1 === count($types)) {
273+
$ids = array();
274+
for ($i = 0; $i < $count; $i++) {
275+
$ids[] = $this->connection->quote($batch[$i]->getIdentifier());
276+
}
277+
278+
$sql .= sprintf(
279+
'(o.object_identifier IN (%s) AND c.class_type = %s)',
280+
implode(',', $ids),
281+
$this->connection->quote($batch[0]->getType())
282+
);
285283
} else {
286-
287-
$where = '(o.object_identifier = %s AND c.class_type = %s)';
288-
for ($i=0,$c=count($batch); $i<$c; $i++) {
289-
$sql .= sprintf(
290-
$where,
291-
$this->connection->quote($batch[$i]->getIdentifier()),
292-
$this->connection->quote($batch[$i]->getType())
293-
);
294-
295-
if ($i+1 < $c) {
296-
$sql .= ' OR ';
297-
}
298-
}
284+
$where = '(o.object_identifier = %s AND c.class_type = %s)';
285+
for ($i = 0; $i < $count; $i++) {
286+
$sql .= sprintf(
287+
$where,
288+
$this->connection->quote($batch[$i]->getIdentifier()),
289+
$this->connection->quote($batch[$i]->getType())
290+
);
291+
292+
if ($i+1 < $count) {
293+
$sql .= ' OR ';
294+
}
295+
}
299296
}
300-
301297

302298
$sql .= ')';
303299

@@ -445,7 +441,7 @@ private function doUpdateAceIdentityMap(array &$aces)
445441
* @param array $oidLookup
446442
*
447443
* @return \SplObjectStorage mapping object identities to ACL instances
448-
*
444+
*
449445
* @throws AclNotFoundException
450446
*/
451447
private function lookupObjectIdentities(array $batch, array $sids, array $oidLookup)

0 commit comments

Comments
 (0)
0