@@ -137,14 +137,14 @@ |
||
| 137 | 137 | */ |
| 138 | 138 | public function getReference($name) |
| 139 | 139 | { |
| 140 | - if (!$this->hasReference($name)) { |
|
| 140 | + if ( ! $this->hasReference($name)) { |
|
| 141 | 141 | throw new \OutOfBoundsException("Reference to: ({$name}) does not exist"); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $reference = $this->references[$name]; |
| 145 | 145 | $meta = $this->manager->getClassMetadata(get_class($reference)); |
| 146 | 146 | |
| 147 | - if (!$this->manager->contains($reference) && isset($this->identities[$name])) { |
|
| 147 | + if ( ! $this->manager->contains($reference) && isset($this->identities[$name])) { |
|
| 148 | 148 | $reference = $this->manager->getReference( |
| 149 | 149 | $meta->name, |
| 150 | 150 | $this->identities[$name] |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function loadFromDirectory($dir) |
| 56 | 56 | { |
| 57 | - if (!is_dir($dir)) { |
|
| 57 | + if ( ! is_dir($dir)) { |
|
| 58 | 58 | throw new \InvalidArgumentException(sprintf('"%s" does not exist', $dir)); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function loadFromFile($fileName) |
| 75 | 75 | { |
| 76 | - if (!is_readable($fileName)) { |
|
| 76 | + if ( ! is_readable($fileName)) { |
|
| 77 | 77 | throw new \InvalidArgumentException(sprintf('"%s" does not exist or is not readable', $fileName)); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function getFixture($className) |
| 103 | 103 | { |
| 104 | - if (!isset($this->fixtures[$className])) { |
|
| 104 | + if ( ! isset($this->fixtures[$className])) { |
|
| 105 | 105 | throw new \InvalidArgumentException(sprintf( |
| 106 | 106 | '"%s" is not a registered fixture', |
| 107 | 107 | $className |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $fixtureClass = get_class($fixture); |
| 122 | 122 | |
| 123 | - if (!isset($this->fixtures[$fixtureClass])) { |
|
| 123 | + if ( ! isset($this->fixtures[$fixtureClass])) { |
|
| 124 | 124 | if ($fixture instanceof OrderedFixtureInterface && $fixture instanceof DependentFixtureInterface) { |
| 125 | 125 | throw new \InvalidArgumentException(sprintf('Class "%s" can\'t implement "%s" and "%s" at the same time.', |
| 126 | 126 | get_class($fixture), |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $this->orderFixturesByNumber = true; |
| 135 | 135 | } elseif ($fixture instanceof DependentFixtureInterface) { |
| 136 | 136 | $this->orderFixturesByDependencies = true; |
| 137 | - foreach($fixture->getDependencies() as $class) { |
|
| 137 | + foreach ($fixture->getDependencies() as $class) { |
|
| 138 | 138 | if (class_exists($class)) { |
| 139 | 139 | $this->addFixture($this->createFixture($class)); |
| 140 | 140 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $this->orderFixturesByDependencies(); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if (!$this->orderFixturesByNumber && !$this->orderFixturesByDependencies) { |
|
| 163 | + if ( ! $this->orderFixturesByNumber && ! $this->orderFixturesByDependencies) { |
|
| 164 | 164 | $this->orderedFixtures = $this->fixtures; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | if ($this->orderFixturesByNumber) { |
| 237 | 237 | $count = count($this->orderedFixtures); |
| 238 | 238 | |
| 239 | - for ($i = 0 ; $i < $count ; ++$i) { |
|
| 240 | - if (!($this->orderedFixtures[$i] instanceof OrderedFixtureInterface)) { |
|
| 239 | + for ($i = 0; $i < $count; ++$i) { |
|
| 240 | + if ( ! ($this->orderedFixtures[$i] instanceof OrderedFixtureInterface)) { |
|
| 241 | 241 | unset($this->orderedFixtures[$i]); |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | $this->validateDependencies($dependenciesClasses); |
| 256 | 256 | |
| 257 | - if (!is_array($dependenciesClasses) || empty($dependenciesClasses)) { |
|
| 257 | + if ( ! is_array($dependenciesClasses) || empty($dependenciesClasses)) { |
|
| 258 | 258 | throw new \InvalidArgumentException(sprintf('Method "%s" in class "%s" must return an array of classes which are dependencies for the fixture, and it must be NOT empty.', 'getDependencies', $fixtureClass)); |
| 259 | 259 | } |
| 260 | 260 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $loadedFixtureClasses = array_keys($this->fixtures); |
| 318 | 318 | |
| 319 | 319 | foreach ($dependenciesClasses as $class) { |
| 320 | - if (!in_array($class, $loadedFixtureClasses)) { |
|
| 320 | + if ( ! in_array($class, $loadedFixtureClasses)) { |
|
| 321 | 321 | throw new \RuntimeException(sprintf('Fixture "%s" was declared as a dependency, but it should be added in fixture loader first.', $class)); |
| 322 | 322 | } |
| 323 | 323 | } |
@@ -176,7 +176,9 @@ |
||
| 176 | 176 | public function isTransient($className) |
| 177 | 177 | { |
| 178 | 178 | $rc = new \ReflectionClass($className); |
| 179 | - if ($rc->isAbstract()) return true; |
|
| 179 | + if ($rc->isAbstract()) { |
|
| 180 | + return true; |
|
| 181 | + } |
|
| 180 | 182 | |
| 181 | 183 | $interfaces = class_implements($className); |
| 182 | 184 | return in_array(FixtureInterface::class, $interfaces) ? false : true; |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | { |
| 44 | 44 | $that = $this; |
| 45 | 45 | |
| 46 | - $function = function ($dm) use ($append, $that, $fixtures) { |
|
| 46 | + $function = function($dm) use ($append, $that, $fixtures) { |
|
| 47 | 47 | if ($append === false) { |
| 48 | 48 | $that->purge(); |
| 49 | 49 | } |
@@ -105,9 +105,9 @@ |
||
| 105 | 105 | if ($this->logger) { |
| 106 | 106 | $prefix = ''; |
| 107 | 107 | if ($fixture instanceof OrderedFixtureInterface) { |
| 108 | - $prefix = sprintf('[%d] ',$fixture->getOrder()); |
|
| 108 | + $prefix = sprintf('[%d] ', $fixture->getOrder()); |
|
| 109 | 109 | } |
| 110 | - $this->log('loading ' . $prefix . get_class($fixture)); |
|
| 110 | + $this->log('loading '.$prefix.get_class($fixture)); |
|
| 111 | 111 | } |
| 112 | 112 | // additionally pass the instance of reference repository to shared fixtures |
| 113 | 113 | if ($fixture instanceof SharedFixtureInterface) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function load($baseCacheName) |
| 98 | 98 | { |
| 99 | - $filename = $baseCacheName . '.ser'; |
|
| 99 | + $filename = $baseCacheName.'.ser'; |
|
| 100 | 100 | |
| 101 | 101 | if ( ! file_exists($filename) || ($serializedData = file_get_contents($filename)) === false) { |
| 102 | 102 | return false; |
@@ -116,6 +116,6 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $serializedData = $this->serialize(); |
| 118 | 118 | |
| 119 | - file_put_contents($baseCacheName . '.ser', $serializedData); |
|
| 119 | + file_put_contents($baseCacheName.'.ser', $serializedData); |
|
| 120 | 120 | } |
| 121 | 121 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | private $purgeMode = self::PURGE_MODE_DELETE; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * Table/view names to be excleded from purge |
|
| 34 | - * |
|
| 35 | - * @var string[] |
|
| 36 | - */ |
|
| 33 | + * Table/view names to be excleded from purge |
|
| 34 | + * |
|
| 35 | + * @var string[] |
|
| 36 | + */ |
|
| 37 | 37 | private $excluded; |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function setEntityManager(EntityManagerInterface $em) |
| 78 | 78 | { |
| 79 | - $this->em = $em; |
|
| 79 | + $this->em = $em; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $classes = []; |
| 96 | 96 | |
| 97 | 97 | foreach ($this->em->getMetadataFactory()->getAllMetadata() as $metadata) { |
| 98 | - if (! $metadata->isMappedSuperclass && ! (isset($metadata->isEmbeddedClass) && $metadata->isEmbeddedClass)) { |
|
| 98 | + if ( ! $metadata->isMappedSuperclass && ! (isset($metadata->isEmbeddedClass) && $metadata->isEmbeddedClass)) { |
|
| 99 | 99 | $classes[] = $metadata; |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | $connection = $this->em->getConnection(); |
| 127 | 127 | $filterExpr = $connection->getConfiguration()->getFilterSchemaAssetsExpression(); |
| 128 | 128 | $emptyFilterExpression = empty($filterExpr); |
| 129 | - foreach($orderedTables as $tbl) { |
|
| 130 | - if(($emptyFilterExpression||preg_match($filterExpr, $tbl)) && array_search($tbl, $this->excluded) === false){ |
|
| 129 | + foreach ($orderedTables as $tbl) { |
|
| 130 | + if (($emptyFilterExpression || preg_match($filterExpr, $tbl)) && array_search($tbl, $this->excluded) === false) { |
|
| 131 | 131 | if ($this->purgeMode === self::PURGE_MODE_DELETE) { |
| 132 | - $connection->executeUpdate("DELETE FROM " . $tbl); |
|
| 132 | + $connection->executeUpdate("DELETE FROM ".$tbl); |
|
| 133 | 133 | } else { |
| 134 | 134 | $connection->executeUpdate($platform->getTruncateTableSQL($tbl, true)); |
| 135 | 135 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | private function getTableName($class, $platform) |
| 225 | 225 | { |
| 226 | - if (isset($class->table['schema']) && !method_exists($class, 'getSchemaName')) { |
|
| 226 | + if (isset($class->table['schema']) && ! method_exists($class, 'getSchemaName')) { |
|
| 227 | 227 | return $class->table['schema'].'.'.$this->em->getConfiguration()->getQuoteStrategy()->getTableName($class, $platform); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | private function getJoinTableName($assoc, $class, $platform) |
| 241 | 241 | { |
| 242 | - if (isset($assoc['joinTable']['schema']) && !method_exists($class, 'getSchemaName')) { |
|
| 242 | + if (isset($assoc['joinTable']['schema']) && ! method_exists($class, 'getSchemaName')) { |
|
| 243 | 243 | return $assoc['joinTable']['schema'].'.'.$this->em->getConfiguration()->getQuoteStrategy()->getJoinTableName($assoc, $class, $platform); |
| 244 | 244 | } |
| 245 | 245 | |