run phpcbf
This commit is contained in:
parent
7767091426
commit
8da32c3969
3 changed files with 7 additions and 7 deletions
|
@ -51,7 +51,7 @@ class SequenceCommandController extends CommandController
|
||||||
->createQuery('SELECT i.type, MAX(i.number) max_number FROM ' . Insert::class . ' i GROUP BY i.type')
|
->createQuery('SELECT i.type, MAX(i.number) max_number FROM ' . Insert::class . ' i GROUP BY i.type')
|
||||||
->getScalarResult();
|
->getScalarResult();
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$cleanArray[$result['type']] = (int) $result['max_number'];
|
$cleanArray[$result['type']] = (int)$result['max_number'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($typesToClean as $typeToClean) {
|
foreach ($typesToClean as $typeToClean) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ class SequenceGenerator
|
||||||
// TODO: Let increment be configurable per type
|
// TODO: Let increment be configurable per type
|
||||||
do {
|
do {
|
||||||
$count++;
|
$count++;
|
||||||
} while (! $this->validateFreeNumber($count, $type));
|
} while (!$this->validateFreeNumber($count, $type));
|
||||||
|
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class SequenceGenerator
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
return false;
|
return false;
|
||||||
} catch (DBALException $e) {
|
} catch (DBALException $e) {
|
||||||
if (! $e->getPrevious() instanceof \PDOException) {
|
if (!$e->getPrevious() instanceof \PDOException) {
|
||||||
$this->systemLogger->critical('Exception occured: ' . $e->getMessage());
|
$this->systemLogger->critical('Exception occured: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -104,7 +104,7 @@ class SequenceGenerator
|
||||||
*/
|
*/
|
||||||
public function getLastNumberFor($type): int
|
public function getLastNumberFor($type): int
|
||||||
{
|
{
|
||||||
return (int) $this->entityManager->getConnection()->executeQuery(
|
return (int)$this->entityManager->getConnection()->executeQuery(
|
||||||
'SELECT MAX(number) FROM '
|
'SELECT MAX(number) FROM '
|
||||||
. $this->entityManager->getClassMetadata(Insert::class)->getTableName()
|
. $this->entityManager->getClassMetadata(Insert::class)->getTableName()
|
||||||
. ' WHERE type = :type',
|
. ' WHERE type = :type',
|
||||||
|
@ -122,7 +122,7 @@ class SequenceGenerator
|
||||||
if (\is_object($stringOrObject)) {
|
if (\is_object($stringOrObject)) {
|
||||||
$stringOrObject = TypeHandling::getTypeForValue($stringOrObject);
|
$stringOrObject = TypeHandling::getTypeForValue($stringOrObject);
|
||||||
}
|
}
|
||||||
if (! $stringOrObject) {
|
if (!$stringOrObject) {
|
||||||
throw new Exception('No Type given');
|
throw new Exception('No Type given');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class SequenceTest extends FunctionalTestCase
|
||||||
|
|
||||||
$pIds = [];
|
$pIds = [];
|
||||||
for ($i = 0; $i < 10; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
$pId = pcntl_fork();
|
$pId = \pcntl_fork();
|
||||||
if ($pId) {
|
if ($pId) {
|
||||||
$pIds[] = $pId;
|
$pIds[] = $pId;
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,7 +39,7 @@ class SequenceTest extends FunctionalTestCase
|
||||||
|
|
||||||
foreach ($pIds as $pId) {
|
foreach ($pIds as $pId) {
|
||||||
$status = 0;
|
$status = 0;
|
||||||
pcntl_waitpid($pId, $status);
|
\pcntl_waitpid($pId, $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEquals(101, $sequenceGenerator->getLastNumberFor($sequenceGenerator));
|
$this->assertEquals(101, $sequenceGenerator->getLastNumberFor($sequenceGenerator));
|
||||||
|
|
Loading…
Add table
Reference in a new issue