@@ -19,6 +19,6 @@ |
||
19 | 19 | |
20 | 20 | public function registerContainerConfiguration(LoaderInterface $loader) |
21 | 21 | { |
22 | - $loader->load(__DIR__.'/../config/config.yml'); |
|
22 | + $loader->load(__DIR__ . '/../config/config.yml'); |
|
23 | 23 | } |
24 | 24 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | $_SERVER['env'] = 'test'; |
4 | 4 | use Doctrine\Common\Annotations\AnnotationRegistry; |
5 | -if (!is_file($loaderFile = __DIR__.'/../vendor/autoload.php')) { |
|
5 | +if (!is_file($loaderFile = __DIR__ . '/../vendor/autoload.php')) { |
|
6 | 6 | throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?'); |
7 | 7 | } |
8 | 8 | $loader = require $loaderFile; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * The parameter $locale must be defined in your |
49 | 49 | * symfony configuration file under parameters. |
50 | 50 | * |
51 | - * @param $locale String |
|
51 | + * @param string $locale String |
|
52 | 52 | * @return $this |
53 | 53 | */ |
54 | 54 | public function setDefaultLocale($locale) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Check if the machineName is valid |
80 | 80 | * |
81 | - * @param $machineName |
|
81 | + * @param string $machineName |
|
82 | 82 | * @return bool |
83 | 83 | */ |
84 | 84 | public static function isValidMachineName($machineName) |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * Retrun null or a KnpMenuItem instance |
95 | 95 | * |
96 | - * @return null|KnpMenuItem |
|
96 | + * @return KnpMenuItem |
|
97 | 97 | */ |
98 | 98 | public function getKnpMenu() |
99 | 99 | { |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $this->setKnpMenu($this->factory->createItem('root')); |
147 | 147 | |
148 | 148 | $menu = $this->entityManager |
149 | - ->getRepository('AlpixelMenuBundle:Menu') |
|
150 | - ->findOneMenuByMachineNameAndLocale($machineName, $locale); |
|
149 | + ->getRepository('AlpixelMenuBundle:Menu') |
|
150 | + ->findOneMenuByMachineNameAndLocale($machineName, $locale); |
|
151 | 151 | |
152 | 152 | $items = $menu->getItems()->toArray(); |
153 | 153 | |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | if (($uri = $item->getUri()) !== null) { |
177 | 177 | if($uri[0] == '/') { |
178 | 178 | $baseUri = $this->request->getBasePath(). |
179 | - $this->request->getBaseURL(). |
|
180 | - $uri; |
|
179 | + $this->request->getBaseURL(). |
|
180 | + $uri; |
|
181 | 181 | $uri = $this->request->getSchemeAndHttpHost().$baseUri; |
182 | 182 | |
183 | 183 | if ($baseUri === $this->currentUri) { |
@@ -175,10 +175,10 @@ |
||
175 | 175 | |
176 | 176 | if (($uri = $item->getUri()) !== null) { |
177 | 177 | if ($uri[0] == '/') { |
178 | - $baseUri = $this->request->getBasePath(). |
|
179 | - $this->request->getBaseURL(). |
|
178 | + $baseUri = $this->request->getBasePath() . |
|
179 | + $this->request->getBaseURL() . |
|
180 | 180 | $uri; |
181 | - $uri = $this->request->getSchemeAndHttpHost().$baseUri; |
|
181 | + $uri = $this->request->getSchemeAndHttpHost() . $baseUri; |
|
182 | 182 | |
183 | 183 | if ($baseUri === $this->currentUri) { |
184 | 184 | $menuItem->setCurrent(true); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * Get parent Item |
117 | 117 | * |
118 | - * @return null\Item |
|
118 | + * @return null|ItemInterface |
|
119 | 119 | */ |
120 | 120 | public function getParent() |
121 | 121 | { |
@@ -125,7 +125,6 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * Set parent Item |
127 | 127 | * |
128 | - * @param ItemInterface $menu |
|
129 | 128 | * |
130 | 129 | * @return self |
131 | 130 | */ |
@@ -209,6 +208,7 @@ discard block |
||
209 | 208 | * Set name displayed in Item |
210 | 209 | * |
211 | 210 | * @param string |
211 | + * @param string $name |
|
212 | 212 | * |
213 | 213 | * @return self |
214 | 214 | */ |
@@ -232,7 +232,6 @@ discard block |
||
232 | 232 | /** |
233 | 233 | * Set URL |
234 | 234 | * |
235 | - * @param string $url |
|
236 | 235 | * |
237 | 236 | * @return self |
238 | 237 | */ |
@@ -111,7 +111,7 @@ |
||
111 | 111 | { |
112 | 112 | $item = new Item(); |
113 | 113 | $item->setMenu($menu); |
114 | - $item->setName('Item '.$i); |
|
114 | + $item->setName('Item ' . $i); |
|
115 | 115 | $item->setPosition($i); |
116 | 116 | $item->setUri('http://alpixel.fr'); |
117 | 117 |
@@ -74,6 +74,9 @@ discard block |
||
74 | 74 | $this->assertInstanceOf(MenuItem::class, $knpMenu); |
75 | 75 | } |
76 | 76 | |
77 | + /** |
|
78 | + * @param string $locale |
|
79 | + */ |
|
77 | 80 | public function getMenuContext($locale) |
78 | 81 | { |
79 | 82 | $menuData = $this->getMenuData()[$locale]; |
@@ -103,6 +106,9 @@ discard block |
||
103 | 106 | return $menu; |
104 | 107 | } |
105 | 108 | |
109 | + /** |
|
110 | + * @param integer $i |
|
111 | + */ |
|
106 | 112 | public function newItem(Menu $menu, $i, Item $parentItem = null) |
107 | 113 | { |
108 | 114 | $item = new Item(); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $configuration = new Configuration(); |
28 | 28 | $this->processConfiguration($configuration, $configs); |
29 | 29 | |
30 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
30 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
31 | 31 | $loader->load('services.yml'); |
32 | 32 | |
33 | 33 | $menuBuilder = $container->getDefinition('alpixel_menu.builder'); |
@@ -87,6 +87,7 @@ discard block |
||
87 | 87 | * Set the machineName the key for querying a menu. |
88 | 88 | * |
89 | 89 | * @param string |
90 | + * @param string $machineName |
|
90 | 91 | * |
91 | 92 | * @return self |
92 | 93 | */ |
@@ -100,7 +101,7 @@ discard block |
||
100 | 101 | /** |
101 | 102 | * Get the name the value displayed to the administrator. |
102 | 103 | * |
103 | - * @return self |
|
104 | + * @return string |
|
104 | 105 | */ |
105 | 106 | public function getName() |
106 | 107 | { |
@@ -110,6 +111,7 @@ discard block |
||
110 | 111 | /** |
111 | 112 | * Set the name the value displayed to the administrator. |
112 | 113 | * |
114 | + * @param string $name |
|
113 | 115 | * @return self |
114 | 116 | */ |
115 | 117 | public function setName($name) |
@@ -167,9 +169,9 @@ discard block |
||
167 | 169 | /** |
168 | 170 | * Set items for the menu. |
169 | 171 | * @deprecated |
170 | - * @param null\ItemInterface $item |
|
172 | + * @param ItemInterface $item |
|
171 | 173 | * |
172 | - * @return Item |
|
174 | + * @return Menu |
|
173 | 175 | */ |
174 | 176 | public function setItem(ItemInterface $item) |
175 | 177 | { |
@@ -179,9 +181,9 @@ discard block |
||
179 | 181 | /** |
180 | 182 | * Set items for the menu. |
181 | 183 | * |
182 | - * @param null\ItemInterface $item |
|
184 | + * @param ItemInterface $item |
|
183 | 185 | * |
184 | - * @return Item |
|
186 | + * @return Menu |
|
185 | 187 | */ |
186 | 188 | public function addItem(ItemInterface $item) |
187 | 189 | { |
@@ -204,6 +206,7 @@ discard block |
||
204 | 206 | /** |
205 | 207 | * Set the locale language. |
206 | 208 | * |
209 | + * @param string $locale |
|
207 | 210 | * @return self |
208 | 211 | */ |
209 | 212 | public function setLocale($locale) |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | public function createQuery($context = 'list') |
13 | 13 | { |
14 | 14 | $query = parent::createQuery($context); |
15 | - $query->addOrderBy($query->getRootAlias().'.locale', 'ASC'); |
|
15 | + $query->addOrderBy($query->getRootAlias() . '.locale', 'ASC'); |
|
16 | 16 | |
17 | 17 | return $query; |
18 | 18 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | protected function configureRoutes(RouteCollection $collection) |
21 | 21 | { |
22 | 22 | $collection->clearExcept(['list']); |
23 | - $collection->add('item', $this->getRouterIdParameter().'/item'); |
|
23 | + $collection->add('item', $this->getRouterIdParameter() . '/item'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | protected function configureFormFields(FormMapper $formMapper) |
@@ -20,8 +20,8 @@ |
||
20 | 20 | $match = false; |
21 | 21 | if (strpos($value, '/') === 0) { |
22 | 22 | $context = $this->router->getContext(); |
23 | - $baseUrl = $context->getScheme().'://'.$context->getHost().$context->getBaseUrl(); |
|
24 | - $value = $baseUrl.$value; |
|
23 | + $baseUrl = $context->getScheme() . '://' . $context->getHost() . $context->getBaseUrl(); |
|
24 | + $value = $baseUrl . $value; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $handle = curl_init($value); |