@@ -7,7 +7,6 @@ |
||
| 7 | 7 | namespace Zicht\Bundle\UrlBundle\Aliasing; |
| 8 | 8 | |
| 9 | 9 | use Doctrine\ORM\EntityManager; |
| 10 | -use Symfony\Component\HttpFoundation\Request; |
|
| 11 | 10 | use Zicht\Bundle\UrlBundle\Aliasing\Mapper\UrlMapperInterface; |
| 12 | 11 | use Zicht\Bundle\UrlBundle\Entity\Repository\UrlAliasRepository; |
| 13 | 12 | use Zicht\Bundle\UrlBundle\Entity\UrlAlias; |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @see addAlias |
| 25 | 25 | */ |
| 26 | - const STRATEGY_OVERWRITE = 'overwrite'; |
|
| 26 | + const STRATEGY_OVERWRITE = 'overwrite'; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Keep existing aliases and do nothing |
| 30 | 30 | * |
| 31 | 31 | * @see addAlias |
| 32 | 32 | */ |
| 33 | - const STRATEGY_KEEP = 'keep'; |
|
| 33 | + const STRATEGY_KEEP = 'keep'; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Suffix existing aliases. |
| 37 | 37 | * |
| 38 | 38 | * @see addAlias |
| 39 | 39 | */ |
| 40 | - const STRATEGY_SUFFIX = 'suffix'; |
|
| 40 | + const STRATEGY_SUFFIX = 'suffix'; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @see AddAlias |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $original = $publicUrl; |
| 278 | 278 | $i = 1; |
| 279 | 279 | do { |
| 280 | - $publicUrl = $original . '-' . ($i++); |
|
| 280 | + $publicUrl = $original.'-'.($i++); |
|
| 281 | 281 | } while ($this->hasInternalAlias($publicUrl)); |
| 282 | 282 | |
| 283 | 283 | $alias = new UrlAlias($publicUrl, $internalUrl, $type); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $this->isBatch = $isBatch; |
| 356 | 356 | $mgr = $this->manager; |
| 357 | 357 | $self = $this; |
| 358 | - return function () use ($mgr, $self) { |
|
| 358 | + return function() use ($mgr, $self) { |
|
| 359 | 359 | $mgr->flush(); |
| 360 | 360 | $self->setIsBatch(true); |
| 361 | 361 | }; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $this->manager->persist($alias); |
| 374 | 374 | |
| 375 | 375 | if ($this->isBatch) { |
| 376 | - $this->batch[$alias->getPublicUrl()]= $alias; |
|
| 376 | + $this->batch[$alias->getPublicUrl()] = $alias; |
|
| 377 | 377 | } else { |
| 378 | 378 | $this->manager->flush($alias); |
| 379 | 379 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | join( |
| 449 | 449 | ', ', |
| 450 | 450 | array_map( |
| 451 | - function ($v) use ($connection) { |
|
| 451 | + function($v) use ($connection) { |
|
| 452 | 452 | return $connection->quote($v, \PDO::PARAM_STR); |
| 453 | 453 | }, |
| 454 | 454 | $urls |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | $treeBuilder = new TreeBuilder(); |
| 23 | 23 | $rootNode = $treeBuilder->root('zicht_url'); |
| 24 | 24 | |
| 25 | - $isBool = function ($v) { |
|
| 25 | + $isBool = function($v) { |
|
| 26 | 26 | return is_bool($v); |
| 27 | 27 | }; |
| 28 | - $convertToEnabledKey = function ($v) { |
|
| 28 | + $convertToEnabledKey = function($v) { |
|
| 29 | 29 | return array('enabled' => $v); |
| 30 | 30 | }; |
| 31 | 31 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function load(array $configs, ContainerBuilder $container) |
| 29 | 29 | { |
| 30 | - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 30 | + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 31 | 31 | $loader->load('services.xml'); |
| 32 | 32 | |
| 33 | 33 | $config = $this->processConfiguration(new Configuration(), $configs); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $formResources = $container->getParameter('twig.form.resources'); |
| 74 | - $formResources[]= 'ZichtUrlBundle::form_theme.html.twig'; |
|
| 74 | + $formResources[] = 'ZichtUrlBundle::form_theme.html.twig'; |
|
| 75 | 75 | $container->setParameter('twig.form.resources', $formResources); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | public function __toString() |
| 96 | 96 | { |
| 97 | 97 | return (string)$this->message |
| 98 | - . ' @ ' . (string)($this->date_created ? $this->date_created->format('YmdHis') : ''); |
|
| 98 | + . ' @ '.(string)($this->date_created ? $this->date_created->format('YmdHis') : ''); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | $where = ['public_url' => $publicUrl]; |
| 23 | 23 | if (null !== $mode) { |
| 24 | - $where['mode']= $mode; |
|
| 24 | + $where['mode'] = $mode; |
|
| 25 | 25 | } |
| 26 | 26 | return $this->findOneBy($where); |
| 27 | 27 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | $where = ['internal_url' => $internalUrl]; |
| 35 | 35 | if (null !== $mode) { |
| 36 | - $where['mode']= $mode; |
|
| 36 | + $where['mode'] = $mode; |
|
| 37 | 37 | } |
| 38 | 38 | return $this->findOneBy($where); |
| 39 | 39 | } |
@@ -25,17 +25,17 @@ |
||
| 25 | 25 | * The alias is an internal rewrite, i.e. external url's are rewritten to internal on request, |
| 26 | 26 | * and vice versa when composing an url. |
| 27 | 27 | */ |
| 28 | - const REWRITE = 0; |
|
| 28 | + const REWRITE = 0; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * The MOVE type yields a 301 response with the internal url if the public url is matched |
| 32 | 32 | */ |
| 33 | - const MOVE = 301; |
|
| 33 | + const MOVE = 301; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * The ALIAS type yields a 302 response with the internal url if the public url is matched |
| 37 | 37 | */ |
| 38 | - const ALIAS = 302; |
|
| 38 | + const ALIAS = 302; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @ORM\Id |
@@ -108,13 +108,13 @@ |
||
| 108 | 108 | try { |
| 109 | 109 | $this->static_refs[$name] = $this->provider->url($name); |
| 110 | 110 | } catch (UnsupportedException $e) { |
| 111 | - $this->static_refs[$name] = '/[static_reference: '. $name . ']'; |
|
| 111 | + $this->static_refs[$name] = '/[static_reference: '.$name.']'; |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $ret = $this->static_refs[$name]; |
| 116 | 116 | if ($params) { |
| 117 | - $ret .= '?' . http_build_query($params, 0, '&'); |
|
| 117 | + $ret .= '?'.http_build_query($params, 0, '&'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return $ret; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $url = $this->refs[$object][$this->getLocale()]; |
| 103 | 103 | |
| 104 | 104 | if (!preg_match('/^(http|https)/', $url)) { |
| 105 | - $url = $this->request->getBaseUrl() . '/' . ltrim($url, '/'); |
|
| 105 | + $url = $this->request->getBaseUrl().'/'.ltrim($url, '/'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $url; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $locale = $this->request->get('_locale'); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if (! isset($locale)) { |
|
| 123 | + if (!isset($locale)) { |
|
| 124 | 124 | $locale = $this->fallback_locale; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $q->execute([UrlAlias::REWRITE]); |
| 38 | 38 | |
| 39 | 39 | return array_map( |
| 40 | - function ($url) { |
|
| 40 | + function($url) { |
|
| 41 | 41 | return ['value' => $url]; |
| 42 | 42 | }, |
| 43 | 43 | $q->fetchAll(\PDO::FETCH_COLUMN) |