| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | use Laminas\View\Renderer; | 
| 7 | 7 | use Laminas\ServiceManager\Factory\InvokableFactory; | 
| 8 | 8 | |
| 9 | -return (function () { | |
| 9 | +return (function() { | |
| 10 | 10 | $config = [ | 
| 11 | 11 | 'service_manager' => [ | 
| 12 | 12 | 'aliases' => [ | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 |          $config = $sm->get('AsseticConfiguration'); | 
| 45 | 45 |          if ($e->getName() === MvcEvent::EVENT_DISPATCH_ERROR) { | 
| 46 | 46 | $error = $e->getError(); | 
| 47 | -            if ($error && ! in_array($error, $config->getAcceptableErrors())) { | |
| 47 | +            if ($error && !in_array($error, $config->getAcceptableErrors())) { | |
| 48 | 48 | // break if not an acceptable error | 
| 49 | 49 | return; | 
| 50 | 50 | } | 
| @@ -52,7 +52,7 @@ discard block | ||
| 52 | 52 | |
| 53 | 53 | /** @var ResponseInterface|null $response */ | 
| 54 | 54 | $response = $e->getResponse(); | 
| 55 | -        if (! $response) { | |
| 55 | +        if (!$response) { | |
| 56 | 56 | $response = new Response(); | 
| 57 | 57 | $e->setResponse($response); | 
| 58 | 58 | } | 
| @@ -42,7 +42,7 @@ discard block | ||
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | 44 | $service = $this->container; | 
| 45 | -        if (! $service->has($alias)) { | |
| 45 | +        if (!$service->has($alias)) { | |
| 46 | 46 | throw new InvalidArgumentException( | 
| 47 | 47 | sprintf( | 
| 48 | 48 | 'There is no "%s" filter in Laminas service manager.', | 
| @@ -52,7 +52,7 @@ discard block | ||
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | 54 | $filter = $service->get($alias); | 
| 55 | -        if (! $filter instanceof FilterInterface) { | |
| 55 | +        if (!$filter instanceof FilterInterface) { | |
| 56 | 56 | $givenType = is_object($filter) ? FilterInterface::class : gettype($filter); | 
| 57 | 57 | $message = 'Retrieved filter "%s" is not instanceof ' | 
| 58 | 58 | . '"Assetic\Filter\FilterInterface", but type was given %s'; | 
| @@ -177,7 +177,7 @@ discard block | ||
| 177 | 177 | $option = null; | 
| 178 | 178 | $name = null; | 
| 179 | 179 |              if (is_array($options)) { | 
| 180 | -                if (! isset($options['name'])) { | |
| 180 | +                if (!isset($options['name'])) { | |
| 181 | 181 | throw new InvalidArgumentException( | 
| 182 | 182 | 'Filter "' . $alias . '" required option "name"' | 
| 183 | 183 | ); | 
| @@ -190,7 +190,7 @@ discard block | ||
| 190 | 190 | unset($options); | 
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | -            if (! is_string($name)) { | |
| 193 | +            if (!is_string($name)) { | |
| 194 | 194 | throw new InvalidArgumentException( | 
| 195 | 195 | 'Name of filter could not be found. ' | 
| 196 | 196 | . 'Did you provide the `name` option to the filter config?' | 
| @@ -204,8 +204,8 @@ discard block | ||
| 204 | 204 | // Filter Id should have optional filter indicator "?" | 
| 205 | 205 | $filterId = ltrim($alias, '?'); | 
| 206 | 206 | |
| 207 | -            if (! $fm->has($filterId)) { | |
| 208 | -                if (is_array($option) && ! empty($option)) { | |
| 207 | +            if (!$fm->has($filterId)) { | |
| 208 | +                if (is_array($option) && !empty($option)) { | |
| 209 | 209 | $r = new ReflectionClass($name); | 
| 210 | 210 | /** @var FilterInterface $filter */ | 
| 211 | 211 | $filter = $r->newInstanceArgs($option); | 
| @@ -310,7 +310,7 @@ discard block | ||
| 310 | 310 | |
| 311 | 311 | public function setupRendererFromOptions(Renderer $renderer, array $options): void | 
| 312 | 312 |      { | 
| 313 | -        if (! $this->hasStrategyForRenderer($renderer)) { | |
| 313 | +        if (!$this->hasStrategyForRenderer($renderer)) { | |
| 314 | 314 | throw new InvalidArgumentException(sprintf( | 
| 315 | 315 | 'no strategy defined for renderer "%s"', | 
| 316 | 316 | $this->getRendererName($renderer) | 
| @@ -345,12 +345,12 @@ discard block | ||
| 345 | 345 | */ | 
| 346 | 346 | public function getStrategyForRenderer(Renderer $renderer): ?StrategyInterface | 
| 347 | 347 |      { | 
| 348 | -        if (! $this->hasStrategyForRenderer($renderer)) { | |
| 348 | +        if (!$this->hasStrategyForRenderer($renderer)) { | |
| 349 | 349 | return null; | 
| 350 | 350 | } | 
| 351 | 351 | |
| 352 | 352 | $rendererName = $this->getRendererName($renderer); | 
| 353 | -        if (! isset($this->strategy[$rendererName])) { | |
| 353 | +        if (!isset($this->strategy[$rendererName])) { | |
| 354 | 354 | $strategyClass = $this->configuration->getStrategyNameForRenderer($rendererName); | 
| 355 | 355 | |
| 356 | 356 |              if (null === $strategyClass) { | 
| @@ -362,7 +362,7 @@ discard block | ||
| 362 | 362 | ); | 
| 363 | 363 | } | 
| 364 | 364 | |
| 365 | -            if (! class_exists($strategyClass, true)) { | |
| 365 | +            if (!class_exists($strategyClass, true)) { | |
| 366 | 366 | throw new InvalidArgumentException( | 
| 367 | 367 | sprintf( | 
| 368 | 368 | 'strategy class "%s" dosen\'t exists', | 
| @@ -373,7 +373,7 @@ discard block | ||
| 373 | 373 | |
| 374 | 374 | $instance = new $strategyClass(); | 
| 375 | 375 | |
| 376 | -            if (! $instance instanceof StrategyInterface) { | |
| 376 | +            if (!$instance instanceof StrategyInterface) { | |
| 377 | 377 | throw new Exception\DomainException( | 
| 378 | 378 | sprintf( | 
| 379 | 379 | 'strategy class "%s" is not instanceof "Fabiang\AsseticBundle\View\StrategyInterface"', | 
| @@ -440,9 +440,9 @@ discard block | ||
| 440 | 440 | $sourcePath = $value->getSourcePath() ?? ''; | 
| 441 | 441 | |
| 442 | 442 |              if ($disableSourcePath) { | 
| 443 | - $value->setTargetPath(( $targetPath ?? '' ) . basename($sourcePath)); | |
| 443 | + $value->setTargetPath(($targetPath ?? '') . basename($sourcePath)); | |
| 444 | 444 |              } else { | 
| 445 | - $value->setTargetPath(( $targetPath ?? '' ) . $sourcePath); | |
| 445 | + $value->setTargetPath(($targetPath ?? '') . $sourcePath); | |
| 446 | 446 | } | 
| 447 | 447 | |
| 448 | 448 | $value = $this->cacheAsset($value); | 
| @@ -457,7 +457,7 @@ discard block | ||
| 457 | 457 | $options = $options['options'] ?? []; | 
| 458 | 458 | $options['output'] = $options['output'] ?? $name; | 
| 459 | 459 | $moveRaw = isset($options['move_raw']) && $options['move_raw']; | 
| 460 | - $targetPath = ! empty($options['targetPath']) ? $options['targetPath'] : ''; | |
| 460 | + $targetPath = !empty($options['targetPath']) ? $options['targetPath'] : ''; | |
| 461 | 461 |          if (substr($targetPath, -1) !== DIRECTORY_SEPARATOR) { | 
| 462 | 462 | $targetPath .= DIRECTORY_SEPARATOR; | 
| 463 | 463 | } | 
| @@ -490,12 +490,12 @@ discard block | ||
| 490 | 490 | public function writeAsset(AssetInterface $asset, AssetFactory $factory): void | 
| 491 | 491 |      { | 
| 492 | 492 | // We're not interested in saving assets on request | 
| 493 | -        if (! $this->configuration->getBuildOnRequest()) { | |
| 493 | +        if (!$this->configuration->getBuildOnRequest()) { | |
| 494 | 494 | return; | 
| 495 | 495 | } | 
| 496 | 496 | |
| 497 | 497 | // Write asset on disk on every request | 
| 498 | -        if (! $this->configuration->getWriteIfChanged()) { | |
| 498 | +        if (!$this->configuration->getWriteIfChanged()) { | |
| 499 | 499 | $this->write($asset, $factory); | 
| 500 | 500 | |
| 501 | 501 | return; | 
| @@ -515,7 +515,7 @@ discard block | ||
| 515 | 515 | } | 
| 516 | 516 | |
| 517 | 517 | // And long requested optimization | 
| 518 | -        if (! $created || $isChanged) { | |
| 518 | +        if (!$created || $isChanged) { | |
| 519 | 519 | $this->write($asset, $factory); | 
| 520 | 520 | } | 
| 521 | 521 | } | 
| @@ -532,7 +532,7 @@ discard block | ||
| 532 | 532 | } | 
| 533 | 533 | |
| 534 | 534 | if ( | 
| 535 | - $this->configuration->isDebug() && ! $this->configuration->isCombine() && $asset instanceof AssetCollection | |
| 535 | + $this->configuration->isDebug() && !$this->configuration->isCombine() && $asset instanceof AssetCollection | |
| 536 | 536 |          ) { | 
| 537 | 537 |              foreach ($asset as $item) { | 
| 538 | 538 | $this->writeAsset($item, $factory); | 
| @@ -193,11 +193,11 @@ discard block | ||
| 193 | 193 | |
| 194 | 194 | public function setDefault(array $default): void | 
| 195 | 195 |      { | 
| 196 | -        if (! isset($default['assets'])) { | |
| 196 | +        if (!isset($default['assets'])) { | |
| 197 | 197 | $default['assets'] = []; | 
| 198 | 198 | } | 
| 199 | 199 | |
| 200 | -        if (! isset($default['options'])) { | |
| 200 | +        if (!isset($default['options'])) { | |
| 201 | 201 | $default['options'] = []; | 
| 202 | 202 | } | 
| 203 | 203 | |
| @@ -321,7 +321,7 @@ discard block | ||
| 321 | 321 |          $parts  = explode('_', $key); | 
| 322 | 322 |          $parts  = array_map('ucfirst', $parts); | 
| 323 | 323 |          $setter = 'set' . implode('', $parts); | 
| 324 | -        if (! method_exists($this, $setter)) { | |
| 324 | +        if (!method_exists($this, $setter)) { | |
| 325 | 325 | throw new Exception\BadMethodCallException( | 
| 326 | 326 | 'The configuration key "' . $key . '" does not ' | 
| 327 | 327 | . 'have a matching ' . $setter . ' setter method ' | 
| @@ -24,7 +24,7 @@ | ||
| 24 | 24 | $baseUrl = $this->str($this->getBaseUrl()); | 
| 25 | 25 | $basePath = $this->str($this->getBasePath()); | 
| 26 | 26 | |
| 27 | -        if ($this->isDebug() && ! $this->isCombine() && $asset instanceof AssetCollection) { | |
| 27 | +        if ($this->isDebug() && !$this->isCombine() && $asset instanceof AssetCollection) { | |
| 28 | 28 | // Move assets as single instance not as a collection | 
| 29 | 29 | /** @var AssetCollection $value */ | 
| 30 | 30 |              foreach ($asset as $value) { | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | /** | 
| 47 | 47 | * @psalm-suppress UndefinedDocblockClass Upstram bug in `@return` | 
| 48 | 48 | */ | 
| 49 | -        if (! $this->service->getAssetManager()->has($collectionName)) { | |
| 49 | +        if (!$this->service->getAssetManager()->has($collectionName)) { | |
| 50 | 50 | throw new Exception\InvalidArgumentException( | 
| 51 | 51 | 'Collection "' . $collectionName . '" does not exist.' | 
| 52 | 52 | ); | 
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | |
| 64 | 64 | if ( | 
| 65 | 65 | $this->service->getConfiguration()->isDebug() | 
| 66 | - && ! $this->service->getConfiguration()->isCombine() | |
| 66 | + && !$this->service->getConfiguration()->isCombine() | |
| 67 | 67 | && $asset instanceof AssetCollection | 
| 68 | 68 |          ) { | 
| 69 | 69 | // Move assets as single instance not as a collection | 
| @@ -107,16 +107,16 @@ discard block | ||
| 107 | 107 | |
| 108 | 108 | protected function getScriptTag(string $path, array $options = []): string | 
| 109 | 109 |      { | 
| 110 | - $type = isset($options['type']) && ! empty($options['type']) ? $options['type'] : 'text/javascript'; | |
| 110 | + $type = isset($options['type']) && !empty($options['type']) ? $options['type'] : 'text/javascript'; | |
| 111 | 111 | |
| 112 | 112 | return '<script type="' . $this->escape($type) . '" src="' . $this->escape($path) . '"></script>'; | 
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | 115 | protected function getStylesheetTag(string $path, array $options = []): string | 
| 116 | 116 |      { | 
| 117 | - $media = isset($options['media']) && ! empty($options['media']) ? $options['media'] : 'screen'; | |
| 118 | - $type = isset($options['type']) && ! empty($options['type']) ? $options['type'] : 'text/css'; | |
| 119 | - $rel = isset($options['rel']) && ! empty($options['rel']) ? $options['rel'] : 'stylesheet'; | |
| 117 | + $media = isset($options['media']) && !empty($options['media']) ? $options['media'] : 'screen'; | |
| 118 | + $type = isset($options['type']) && !empty($options['type']) ? $options['type'] : 'text/css'; | |
| 119 | + $rel = isset($options['rel']) && !empty($options['rel']) ? $options['rel'] : 'stylesheet'; | |
| 120 | 120 | |
| 121 | 121 | return '<link href="' . $this->escape($path) | 
| 122 | 122 | . '" media="' . $this->escape($media) | 
| @@ -35,12 +35,12 @@ discard block | ||
| 35 | 35 | protected function execute(InputInterface $input, OutputInterface $output): int | 
| 36 | 36 |      { | 
| 37 | 37 | $config = $this->assetic->getConfiguration(); | 
| 38 | - $mode = null !== ($mode = $config->getUmask()) ? $mode : 0775; | |
| 38 | + $mode = null !== ($mode = $config->getUmask()) ? $mode : 0775; | |
| 39 | 39 | |
| 40 | -        if (! $this->createPath($output, 'Cache', $config->getCachePath() ?? '', $mode)) { | |
| 40 | +        if (!$this->createPath($output, 'Cache', $config->getCachePath() ?? '', $mode)) { | |
| 41 | 41 | return 1; | 
| 42 | 42 | } | 
| 43 | -        if (! $this->createPath($output, 'Web', $config->getWebPath() ?? '', $mode)) { | |
| 43 | +        if (!$this->createPath($output, 'Web', $config->getWebPath() ?? '', $mode)) { | |
| 44 | 44 | return 1; | 
| 45 | 45 | } | 
| 46 | 46 | |
| @@ -54,12 +54,12 @@ discard block | ||
| 54 | 54 |      { | 
| 55 | 55 | $displayMode = decoct($mode); | 
| 56 | 56 | $pathExists = is_dir($path); | 
| 57 | -        if (! $path) { | |
| 57 | +        if (!$path) { | |
| 58 | 58 |              $output->writeln('Creation of ' . $which . ' path skipped - no path provided'); | 
| 59 | 59 | |
| 60 | 60 | return true; | 
| 61 | 61 | } | 
| 62 | -        if (! $pathExists) { | |
| 62 | +        if (!$pathExists) { | |
| 63 | 63 |              if (mkdir($path, $mode, true)) { | 
| 64 | 64 | $output->writeln($which . ' path created "' . $path . '" with mode "' . $displayMode . '"'); | 
| 65 | 65 | |
| @@ -79,13 +79,13 @@ discard block | ||
| 79 | 79 | ); | 
| 80 | 80 | |
| 81 | 81 | return true; | 
| 82 | -        } elseif (! $readable && ! $writable) { | |
| 82 | +        } elseif (!$readable && !$writable) { | |
| 83 | 83 | $output->writeln( | 
| 84 | 84 | '<error>Creation of ' . $which . ' path "' | 
| 85 | 85 | . $path | 
| 86 | 86 | . '" failed - path exists but is neither readable nor writable</error>' | 
| 87 | 87 | ); | 
| 88 | -        } elseif (! $readable) { | |
| 88 | +        } elseif (!$readable) { | |
| 89 | 89 | $output->writeln( | 
| 90 | 90 | '<error>Creation of ' . $which . ' path "' | 
| 91 | 91 | . $path . '" failed - path exists but is not readable</error>' |