@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function setTestingTrue() |
| 27 | 27 | { |
| 28 | - Logging::$testing = true; |
|
| 28 | + Logging::$testing = true; |
|
| 29 | 29 | } |
| 30 | 30 | //</editor-fold desc="Public Methods"> |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -16,15 +16,13 @@ |
||
| 16 | 16 | * Trait OnlyTestLogging |
| 17 | 17 | * @package Tests\Helpers |
| 18 | 18 | */ |
| 19 | -trait OnlyTestLogging |
|
| 20 | -{ |
|
| 19 | +trait OnlyTestLogging { |
|
| 21 | 20 | //<editor-fold desc="Public Methods"> |
| 22 | 21 | /** |
| 23 | 22 | * Sets the logging value testing to true |
| 24 | 23 | * @before |
| 25 | 24 | */ |
| 26 | - public function setTestingTrue() |
|
| 27 | - { |
|
| 25 | + public function setTestingTrue() { |
|
| 28 | 26 | Logging::$testing = true; |
| 29 | 27 | } |
| 30 | 28 | //</editor-fold desc="Public Methods"> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * Class TestEnum |
| 17 | 17 | * @package Tests\Helpers |
| 18 | 18 | */ |
| 19 | -abstract class TestEnum extends BasicEnum |
|
| 20 | -{ |
|
| 19 | +abstract class TestEnum extends BasicEnum { |
|
| 21 | 20 | //<editor-fold desc="Fields"> |
| 22 | 21 | const INT_KEY = 1; |
| 23 | 22 | const KEY = "value"; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param Tournament $tournament The tournament to analyze |
| 25 | 25 | * @param mixed[][] $influences the earliest influences of the tournament before the change |
| 26 | 26 | */ |
| 27 | - public function adaptOpenSyncFromValues(Tournament $tournament, array $influences): void; |
|
| 27 | + public function adaptOpenSyncFromValues( Tournament $tournament, array $influences ): void; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Gets all ranking systems of a tournament and its earliest influences as time. |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param Tournament $tournament the tournament to analyze |
| 33 | 33 | * @return mixed[][] |
| 34 | 34 | */ |
| 35 | - public function getRankingSystemsEarliestInfluences(Tournament $tournament): array; |
|
| 35 | + public function getRankingSystemsEarliestInfluences( Tournament $tournament ): array; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Recalculates all ranking systems which have an open sync from value. |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * Interface RankingSystemServiceInterface |
| 17 | 17 | * @package Tfboe\FmLib\Service |
| 18 | 18 | */ |
| 19 | -interface RankingSystemServiceInterface |
|
| 20 | -{ |
|
| 19 | +interface RankingSystemServiceInterface { |
|
| 21 | 20 | //<editor-fold desc="Public Methods"> |
| 22 | 21 | /** |
| 23 | 22 | * Adapts the open sync from property of all relevant ranking systems |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __construct(Container $app) |
| 32 | 32 | { |
| 33 | - $this->app = $app; |
|
| 33 | + $this->app = $app; |
|
| 34 | 34 | } |
| 35 | 35 | //</editor-fold desc="Constructor"> |
| 36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function loadRankingSystemService(string $name): RankingSystemInterface |
| 42 | 42 | { |
| 43 | - return $this->app->make($this->getClassWithNamespace($name, 'Tfboe\FmLib\Service\RankingSystem')); |
|
| 43 | + return $this->app->make($this->getClassWithNamespace($name, 'Tfboe\FmLib\Service\RankingSystem')); |
|
| 44 | 44 | } |
| 45 | 45 | //</editor-fold desc="Public Methods"> |
| 46 | 46 | |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | protected function getClassWithNamespace(string $class, string $namespace): string |
| 55 | 55 | { |
| 56 | - if (strpos($class, 'Interface') === false) { |
|
| 57 | - $class .= 'Interface'; |
|
| 58 | - } |
|
| 59 | - if (strpos($class, '\\') === false) { |
|
| 60 | - return $namespace . '\\' . $class; |
|
| 61 | - } else { |
|
| 62 | - return $class; |
|
| 63 | - } |
|
| 56 | + if (strpos($class, 'Interface') === false) { |
|
| 57 | + $class .= 'Interface'; |
|
| 58 | + } |
|
| 59 | + if (strpos($class, '\\') === false) { |
|
| 60 | + return $namespace . '\\' . $class; |
|
| 61 | + } else { |
|
| 62 | + return $class; |
|
| 63 | + } |
|
| 64 | 64 | } |
| 65 | 65 | //</editor-fold desc="Protected Methods"> |
| 66 | 66 | //<editor-fold desc="Private Methods"> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * DynamicServiceLoadingService constructor. |
| 29 | 29 | * @param Container $app |
| 30 | 30 | */ |
| 31 | - public function __construct(Container $app) |
|
| 31 | + public function __construct( Container $app ) |
|
| 32 | 32 | { |
| 33 | 33 | $this->app = $app; |
| 34 | 34 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * @inheritdoc |
| 40 | 40 | */ |
| 41 | - public function loadRankingSystemService(string $name): RankingSystemInterface |
|
| 41 | + public function loadRankingSystemService( string $name ): RankingSystemInterface |
|
| 42 | 42 | { |
| 43 | 43 | return $this->app->make($this->getClassWithNamespace($name, 'Tfboe\FmLib\Service\RankingSystem')); |
| 44 | 44 | } |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | * @param string $namespace the namespace |
| 52 | 52 | * @return string the full class name (with namespace) and with interface |
| 53 | 53 | */ |
| 54 | - protected function getClassWithNamespace(string $class, string $namespace): string |
|
| 54 | + protected function getClassWithNamespace( string $class, string $namespace ): string |
|
| 55 | 55 | { |
| 56 | - if (strpos($class, 'Interface') === false) { |
|
| 56 | + if ( strpos($class, 'Interface') === false ) { |
|
| 57 | 57 | $class .= 'Interface'; |
| 58 | 58 | } |
| 59 | - if (strpos($class, '\\') === false) { |
|
| 60 | - return $namespace . '\\' . $class; |
|
| 59 | + if ( strpos($class, '\\') === false ) { |
|
| 60 | + return $namespace.'\\'.$class; |
|
| 61 | 61 | } else { |
| 62 | 62 | return $class; |
| 63 | 63 | } |
@@ -16,8 +16,7 @@ discard block |
||
| 16 | 16 | * Class DynamicLoadingService |
| 17 | 17 | * @package Tfboe\FmLib\Service |
| 18 | 18 | */ |
| 19 | -class DynamicServiceLoadingService implements DynamicServiceLoadingServiceInterface |
|
| 20 | -{ |
|
| 19 | +class DynamicServiceLoadingService implements DynamicServiceLoadingServiceInterface { |
|
| 21 | 20 | //<editor-fold desc="Fields"> |
| 22 | 21 | /** @var Container */ |
| 23 | 22 | private $app; |
@@ -28,8 +27,7 @@ discard block |
||
| 28 | 27 | * DynamicServiceLoadingService constructor. |
| 29 | 28 | * @param Container $app |
| 30 | 29 | */ |
| 31 | - public function __construct(Container $app) |
|
| 32 | - { |
|
| 30 | + public function __construct(Container $app) { |
|
| 33 | 31 | $this->app = $app; |
| 34 | 32 | } |
| 35 | 33 | //</editor-fold desc="Constructor"> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -30,6 +30,6 @@ discard block |
||
| 30 | 30 | * @param TournamentHierarchyInterface $entity |
| 31 | 31 | * @return \DateTime |
| 32 | 32 | */ |
| 33 | - public function getTime(TournamentHierarchyInterface $entity); |
|
| 33 | + public function getTime( TournamentHierarchyInterface $entity ); |
|
| 34 | 34 | //</editor-fold desc="Public Methods"> |
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * Interface TimeService |
| 17 | 17 | * @package Tfboe\FmLib\Service\RankingSystemService\TimeService |
| 18 | 18 | */ |
| 19 | -interface TimeServiceInterface |
|
| 20 | -{ |
|
| 19 | +interface TimeServiceInterface { |
|
| 21 | 20 | //<editor-fold desc="Public Methods"> |
| 22 | 21 | /** |
| 23 | 22 | * If the service has a memory clears all remembered times. This needs to be called when times of some entities |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -26,6 +26,6 @@ discard block |
||
| 26 | 26 | * @return int returns -1 if entity1 should be before entity2, 1 if it should be after entity2 and 0 if they are |
| 27 | 27 | * equal. |
| 28 | 28 | */ |
| 29 | - public function compareEntities(TournamentHierarchyInterface $entity1, TournamentHierarchyInterface $entity2): int; |
|
| 29 | + public function compareEntities( TournamentHierarchyInterface $entity1, TournamentHierarchyInterface $entity2 ): int; |
|
| 30 | 30 | //</editor-fold desc="Public Methods"> |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | * Interface EntityComparerInterface |
| 17 | 17 | * @package Tfboe\FmLib\Service\RankingSystemService |
| 18 | 18 | */ |
| 19 | -interface EntityComparerInterface |
|
| 20 | -{ |
|
| 19 | +interface EntityComparerInterface { |
|
| 21 | 20 | //<editor-fold desc="Public Methods"> |
| 22 | 21 | /** |
| 23 | 22 | * Compares two entities. |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | * Interface EloRankingInterface |
| 15 | 15 | * @package Tfboe\FmLib\Service\TournamentRanking |
| 16 | 16 | */ |
| 17 | -interface EloRankingInterface extends GameRankingSystemInterface |
|
| 18 | -{ |
|
| 17 | +interface EloRankingInterface extends GameRankingSystemInterface { |
|
| 19 | 18 | |
| 20 | 19 | } |
| 21 | 20 | \ No newline at end of file |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function __construct(TimeServiceInterface $timeService) |
| 33 | 33 | { |
| 34 | - $this->timeService = $timeService; |
|
| 34 | + $this->timeService = $timeService; |
|
| 35 | 35 | } |
| 36 | 36 | //</editor-fold desc="Constructor"> |
| 37 | 37 | |
@@ -42,18 +42,18 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function compareEntities(TournamentHierarchyInterface $entity1, TournamentHierarchyInterface $entity2): int |
| 44 | 44 | { |
| 45 | - $tmpE1 = $entity1; |
|
| 46 | - $tmpE2 = $entity2; |
|
| 47 | - while ($tmpE1 !== null && $tmpE2 !== null && $tmpE1->getId() !== $tmpE2->getId()) { |
|
| 48 | - $comparison = $this->compareEntityTimes($tmpE1, $tmpE2); |
|
| 49 | - if ($comparison !== 0) { |
|
| 50 | - return $comparison; |
|
| 51 | - } |
|
| 52 | - $tmpE1 = $tmpE1->getParent(); |
|
| 53 | - $tmpE2 = $tmpE2->getParent(); |
|
| 54 | - } |
|
| 45 | + $tmpE1 = $entity1; |
|
| 46 | + $tmpE2 = $entity2; |
|
| 47 | + while ($tmpE1 !== null && $tmpE2 !== null && $tmpE1->getId() !== $tmpE2->getId()) { |
|
| 48 | + $comparison = $this->compareEntityTimes($tmpE1, $tmpE2); |
|
| 49 | + if ($comparison !== 0) { |
|
| 50 | + return $comparison; |
|
| 51 | + } |
|
| 52 | + $tmpE1 = $tmpE1->getParent(); |
|
| 53 | + $tmpE2 = $tmpE2->getParent(); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - return $this->compareLocalIdentifiersWithinTournament($entity1, $entity2); |
|
| 56 | + return $this->compareLocalIdentifiersWithinTournament($entity1, $entity2); |
|
| 57 | 57 | } |
| 58 | 58 | //</editor-fold desc="Public Methods"> |
| 59 | 59 | |
@@ -66,23 +66,23 @@ discard block |
||
| 66 | 66 | * entity2 are before the times of entity1 and 0 if they have the same times |
| 67 | 67 | */ |
| 68 | 68 | protected function compareEntityTimes(TournamentHierarchyInterface $entity1, |
| 69 | - TournamentHierarchyInterface $entity2) |
|
| 69 | + TournamentHierarchyInterface $entity2) |
|
| 70 | 70 | { |
| 71 | - $time1 = $this->timeService->getTime($entity1); |
|
| 72 | - $time2 = $this->timeService->getTime($entity2); |
|
| 73 | - if ($time1 < $time2) { |
|
| 74 | - return -1; |
|
| 75 | - } else if ($time1 > $time2) { |
|
| 76 | - return 1; |
|
| 77 | - } |
|
| 78 | - if ($entity1->getStartTime() !== null && $entity2->getStartTime() !== null) { |
|
| 79 | - if ($entity1->getStartTime() < $entity2->getStartTime()) { |
|
| 80 | - return -1; |
|
| 81 | - } else if ($entity1->getStartTime() > $entity2->getStartTime()) { |
|
| 82 | - return 1; |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - return 0; |
|
| 71 | + $time1 = $this->timeService->getTime($entity1); |
|
| 72 | + $time2 = $this->timeService->getTime($entity2); |
|
| 73 | + if ($time1 < $time2) { |
|
| 74 | + return -1; |
|
| 75 | + } else if ($time1 > $time2) { |
|
| 76 | + return 1; |
|
| 77 | + } |
|
| 78 | + if ($entity1->getStartTime() !== null && $entity2->getStartTime() !== null) { |
|
| 79 | + if ($entity1->getStartTime() < $entity2->getStartTime()) { |
|
| 80 | + return -1; |
|
| 81 | + } else if ($entity1->getStartTime() > $entity2->getStartTime()) { |
|
| 82 | + return 1; |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + return 0; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -93,20 +93,20 @@ discard block |
||
| 93 | 93 | * and 0 if the two entities are equal (<=> all predecessors have same local identifiers) |
| 94 | 94 | */ |
| 95 | 95 | protected function compareLocalIdentifiersWithinTournament(TournamentHierarchyInterface $entity1, |
| 96 | - TournamentHierarchyInterface $entity2) |
|
| 96 | + TournamentHierarchyInterface $entity2) |
|
| 97 | 97 | { |
| 98 | - //compare unique identifiers within tournament |
|
| 99 | - $predecessors1 = $this->getPredecessors($entity1); |
|
| 100 | - $predecessors2 = $this->getPredecessors($entity2); |
|
| 98 | + //compare unique identifiers within tournament |
|
| 99 | + $predecessors1 = $this->getPredecessors($entity1); |
|
| 100 | + $predecessors2 = $this->getPredecessors($entity2); |
|
| 101 | 101 | |
| 102 | - for ($i = count($predecessors1) - 1; $i >= 0; $i--) { |
|
| 103 | - if ($predecessors1[$i]->getLocalIdentifier() !== $predecessors2[$i]->getLocalIdentifier()) { |
|
| 104 | - return $predecessors1[$i]->getLocalIdentifier() <=> $predecessors2[$i]->getLocalIdentifier(); |
|
| 105 | - } |
|
| 106 | - } |
|
| 102 | + for ($i = count($predecessors1) - 1; $i >= 0; $i--) { |
|
| 103 | + if ($predecessors1[$i]->getLocalIdentifier() !== $predecessors2[$i]->getLocalIdentifier()) { |
|
| 104 | + return $predecessors1[$i]->getLocalIdentifier() <=> $predecessors2[$i]->getLocalIdentifier(); |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - //the two entities are equal |
|
| 109 | - return 0; |
|
| 108 | + //the two entities are equal |
|
| 109 | + return 0; |
|
| 110 | 110 | } |
| 111 | 111 | //</editor-fold desc="Protected Methods"> |
| 112 | 112 | |
@@ -118,12 +118,12 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | private function getPredecessors(TournamentHierarchyInterface $entity): array |
| 120 | 120 | { |
| 121 | - $res = []; |
|
| 122 | - while ($entity !== null) { |
|
| 123 | - $res[] = $entity; |
|
| 124 | - $entity = $entity->getParent(); |
|
| 125 | - } |
|
| 126 | - return $res; |
|
| 121 | + $res = []; |
|
| 122 | + while ($entity !== null) { |
|
| 123 | + $res[] = $entity; |
|
| 124 | + $entity = $entity->getParent(); |
|
| 125 | + } |
|
| 126 | + return $res; |
|
| 127 | 127 | } |
| 128 | 128 | //</editor-fold desc="Private Methods"> |
| 129 | 129 | } |
| 130 | 130 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * EntityComparerByTimeStartTimeAndLocalIdentifier constructor. |
| 30 | 30 | * @param TimeServiceInterface $timeService |
| 31 | 31 | */ |
| 32 | - public function __construct(TimeServiceInterface $timeService) |
|
| 32 | + public function __construct( TimeServiceInterface $timeService ) |
|
| 33 | 33 | { |
| 34 | 34 | $this->timeService = $timeService; |
| 35 | 35 | } |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * @inheritDoc |
| 42 | 42 | */ |
| 43 | - public function compareEntities(TournamentHierarchyInterface $entity1, TournamentHierarchyInterface $entity2): int |
|
| 43 | + public function compareEntities( TournamentHierarchyInterface $entity1, TournamentHierarchyInterface $entity2 ): int |
|
| 44 | 44 | { |
| 45 | 45 | $tmpE1 = $entity1; |
| 46 | 46 | $tmpE2 = $entity2; |
| 47 | - while ($tmpE1 !== null && $tmpE2 !== null && $tmpE1->getId() !== $tmpE2->getId()) { |
|
| 47 | + while ( $tmpE1 !== null && $tmpE2 !== null && $tmpE1->getId() !== $tmpE2->getId() ) { |
|
| 48 | 48 | $comparison = $this->compareEntityTimes($tmpE1, $tmpE2); |
| 49 | - if ($comparison !== 0) { |
|
| 49 | + if ( $comparison !== 0 ) { |
|
| 50 | 50 | return $comparison; |
| 51 | 51 | } |
| 52 | 52 | $tmpE1 = $tmpE1->getParent(); |
@@ -65,20 +65,20 @@ discard block |
||
| 65 | 65 | * @return int returns -1 if the relevant times of entity1 are before the relevant times of entity2, 1 if the times of |
| 66 | 66 | * entity2 are before the times of entity1 and 0 if they have the same times |
| 67 | 67 | */ |
| 68 | - protected function compareEntityTimes(TournamentHierarchyInterface $entity1, |
|
| 69 | - TournamentHierarchyInterface $entity2) |
|
| 68 | + protected function compareEntityTimes( TournamentHierarchyInterface $entity1, |
|
| 69 | + TournamentHierarchyInterface $entity2 ) |
|
| 70 | 70 | { |
| 71 | 71 | $time1 = $this->timeService->getTime($entity1); |
| 72 | 72 | $time2 = $this->timeService->getTime($entity2); |
| 73 | - if ($time1 < $time2) { |
|
| 73 | + if ( $time1 < $time2 ) { |
|
| 74 | 74 | return -1; |
| 75 | - } else if ($time1 > $time2) { |
|
| 75 | + } else if ( $time1 > $time2 ) { |
|
| 76 | 76 | return 1; |
| 77 | 77 | } |
| 78 | - if ($entity1->getStartTime() !== null && $entity2->getStartTime() !== null) { |
|
| 79 | - if ($entity1->getStartTime() < $entity2->getStartTime()) { |
|
| 78 | + if ( $entity1->getStartTime() !== null && $entity2->getStartTime() !== null ) { |
|
| 79 | + if ( $entity1->getStartTime() < $entity2->getStartTime() ) { |
|
| 80 | 80 | return -1; |
| 81 | - } else if ($entity1->getStartTime() > $entity2->getStartTime()) { |
|
| 81 | + } else if ( $entity1->getStartTime() > $entity2->getStartTime() ) { |
|
| 82 | 82 | return 1; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | * @return int returns -1 if the first predecessor with a lower local identifier is of entity1, 1 if it is of entity2 |
| 93 | 93 | * and 0 if the two entities are equal (<=> all predecessors have same local identifiers) |
| 94 | 94 | */ |
| 95 | - protected function compareLocalIdentifiersWithinTournament(TournamentHierarchyInterface $entity1, |
|
| 96 | - TournamentHierarchyInterface $entity2) |
|
| 95 | + protected function compareLocalIdentifiersWithinTournament( TournamentHierarchyInterface $entity1, |
|
| 96 | + TournamentHierarchyInterface $entity2 ) |
|
| 97 | 97 | { |
| 98 | 98 | //compare unique identifiers within tournament |
| 99 | 99 | $predecessors1 = $this->getPredecessors($entity1); |
| 100 | 100 | $predecessors2 = $this->getPredecessors($entity2); |
| 101 | 101 | |
| 102 | - for ($i = count($predecessors1) - 1; $i >= 0; $i--) { |
|
| 103 | - if ($predecessors1[$i]->getLocalIdentifier() !== $predecessors2[$i]->getLocalIdentifier()) { |
|
| 102 | + for ( $i = count($predecessors1) - 1; $i >= 0; $i-- ) { |
|
| 103 | + if ( $predecessors1[$i]->getLocalIdentifier() !== $predecessors2[$i]->getLocalIdentifier() ) { |
|
| 104 | 104 | return $predecessors1[$i]->getLocalIdentifier() <=> $predecessors2[$i]->getLocalIdentifier(); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | * @param TournamentHierarchyInterface $entity the entity for which to get the predecessors |
| 117 | 117 | * @return TournamentHierarchyInterface[] the predecessors of $entity inclusive $entity |
| 118 | 118 | */ |
| 119 | - private function getPredecessors(TournamentHierarchyInterface $entity): array |
|
| 119 | + private function getPredecessors( TournamentHierarchyInterface $entity ): array |
|
| 120 | 120 | { |
| 121 | 121 | $res = []; |
| 122 | - while ($entity !== null) { |
|
| 122 | + while ( $entity !== null ) { |
|
| 123 | 123 | $res[] = $entity; |
| 124 | 124 | $entity = $entity->getParent(); |
| 125 | 125 | } |
@@ -17,8 +17,7 @@ discard block |
||
| 17 | 17 | * Class EntityComparerByTimeStartTimeAndLocalIdentifier |
| 18 | 18 | * @package Tfboe\FmLib\Service\RankingSystemListService |
| 19 | 19 | */ |
| 20 | -class EntityComparerByTimeStartTimeAndLocalIdentifier implements EntityComparerInterface |
|
| 21 | -{ |
|
| 20 | +class EntityComparerByTimeStartTimeAndLocalIdentifier implements EntityComparerInterface { |
|
| 22 | 21 | //<editor-fold desc="Fields"> |
| 23 | 22 | /** @var TimeServiceInterface */ |
| 24 | 23 | private $timeService; |
@@ -29,8 +28,7 @@ discard block |
||
| 29 | 28 | * EntityComparerByTimeStartTimeAndLocalIdentifier constructor. |
| 30 | 29 | * @param TimeServiceInterface $timeService |
| 31 | 30 | */ |
| 32 | - public function __construct(TimeServiceInterface $timeService) |
|
| 33 | - { |
|
| 31 | + public function __construct(TimeServiceInterface $timeService) { |
|
| 34 | 32 | $this->timeService = $timeService; |
| 35 | 33 | } |
| 36 | 34 | //</editor-fold desc="Constructor"> |
@@ -66,8 +64,7 @@ discard block |
||
| 66 | 64 | * entity2 are before the times of entity1 and 0 if they have the same times |
| 67 | 65 | */ |
| 68 | 66 | protected function compareEntityTimes(TournamentHierarchyInterface $entity1, |
| 69 | - TournamentHierarchyInterface $entity2) |
|
| 70 | - { |
|
| 67 | + TournamentHierarchyInterface $entity2) { |
|
| 71 | 68 | $time1 = $this->timeService->getTime($entity1); |
| 72 | 69 | $time2 = $this->timeService->getTime($entity2); |
| 73 | 70 | if ($time1 < $time2) { |
@@ -93,8 +90,7 @@ discard block |
||
| 93 | 90 | * and 0 if the two entities are equal (<=> all predecessors have same local identifiers) |
| 94 | 91 | */ |
| 95 | 92 | protected function compareLocalIdentifiersWithinTournament(TournamentHierarchyInterface $entity1, |
| 96 | - TournamentHierarchyInterface $entity2) |
|
| 97 | - { |
|
| 93 | + TournamentHierarchyInterface $entity2) { |
|
| 98 | 94 | //compare unique identifiers within tournament |
| 99 | 95 | $predecessors1 = $this->getPredecessors($entity1); |
| 100 | 96 | $predecessors2 = $this->getPredecessors($entity2); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | * tournament before the change |
| 40 | 40 | */ |
| 41 | 41 | public function updateRankingForTournament(RankingSystem $ranking, Tournament $tournament, |
| 42 | - ?\DateTime $oldInfluence); |
|
| 42 | + ?\DateTime $oldInfluence); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Updates the rankings assuming all changes happened after $from. |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * Created by PhpStorm. |
| 5 | 5 | * User: benedikt |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @return \DateTime|null the earliest influence or null iff no entity above the level of this ranking has the ranking |
| 30 | 30 | * in its rankingSystems |
| 31 | 31 | */ |
| 32 | - public function getEarliestInfluence(RankingSystem $ranking, Tournament $tournament): ?\DateTime; |
|
| 32 | + public function getEarliestInfluence( RankingSystem $ranking, Tournament $tournament ): ?\DateTime; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Updates the rankings for this tournament |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | * @param \DateTime|null $oldInfluence if the tournament changed this is the earliest influence of the |
| 39 | 39 | * tournament before the change |
| 40 | 40 | */ |
| 41 | - public function updateRankingForTournament(RankingSystem $ranking, Tournament $tournament, |
|
| 42 | - ?\DateTime $oldInfluence); |
|
| 41 | + public function updateRankingForTournament( RankingSystem $ranking, Tournament $tournament, |
|
| 42 | + ?\DateTime $oldInfluence ); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Updates the rankings assuming all changes happened after $from. |
| 46 | 46 | * @param RankingSystem $ranking |
| 47 | 47 | * @param \DateTime $from |
| 48 | 48 | */ |
| 49 | - public function updateRankingFrom(RankingSystem $ranking, \DateTime $from); |
|
| 49 | + public function updateRankingFrom( RankingSystem $ranking, \DateTime $from ); |
|
| 50 | 50 | //</editor-fold desc="Public Methods"> |
| 51 | 51 | } |
| 52 | 52 | \ No newline at end of file |
@@ -17,8 +17,7 @@ |
||
| 17 | 17 | * Interface RankingSystemInterface |
| 18 | 18 | * @package Tfboe\FmLib\Service\RankingSystemService |
| 19 | 19 | */ |
| 20 | -interface RankingSystemInterface |
|
| 21 | -{ |
|
| 20 | +interface RankingSystemInterface { |
|
| 22 | 21 | //<editor-fold desc="Public Methods"> |
| 23 | 22 | /** |
| 24 | 23 | * The earliest influence date of the given tournament for the ranking system. |