@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public function getFunctions() |
| 20 | 20 | { |
| 21 | 21 | return [ |
| 22 | - new \Twig_SimpleFunction('assemble_url', [$this, 'assembleUrl']) |
|
| 22 | + new \Twig_SimpleFunction('assemble_url', [ $this, 'assembleUrl' ]) |
|
| 23 | 23 | ]; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param bool|true $inherit |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public function assembleUrl($name = null, $routeParams = [], $queryParams = [], $inherit = false) |
|
| 33 | + public function assembleUrl($name = null, $routeParams = [ ], $queryParams = [ ], $inherit = false) |
|
| 34 | 34 | { |
| 35 | 35 | return $this->routeAssembler->assembleUrl($name, $routeParams, $queryParams, $inherit); |
| 36 | 36 | } |
@@ -13,14 +13,14 @@ |
||
| 13 | 13 | public function getFunctions() |
| 14 | 14 | { |
| 15 | 15 | return [ |
| 16 | - new \Twig_SimpleFunction('recaptcha_public', [$this, 'getRecapcthaPublicKey']), |
|
| 17 | - new \Twig_SimpleFunction('recaptcha_input', [$this, 'renderInput'], ['is_safe' => ['html']]), |
|
| 16 | + new \Twig_SimpleFunction('recaptcha_public', [ $this, 'getRecapcthaPublicKey' ]), |
|
| 17 | + new \Twig_SimpleFunction('recaptcha_input', [ $this, 'renderInput' ], [ 'is_safe' => [ 'html' ] ]), |
|
| 18 | 18 | ]; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function getRecapcthaPublicKey() |
| 22 | 22 | { |
| 23 | - return $this->config['public_key']; |
|
| 23 | + return $this->config[ 'public_key' ]; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function renderInput($lang = 'en') |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | public function getFunctions() |
| 19 | 19 | { |
| 20 | 20 | return [ |
| 21 | - new \Twig_SimpleFunction('translate', [$this, 'translate']), |
|
| 22 | - new \Twig_SimpleFunction('translate_plural', [$this, 'translatePlural']), |
|
| 23 | - new \Twig_SimpleFunction('locale', [$this, 'getLocale']), |
|
| 21 | + new \Twig_SimpleFunction('translate', [ $this, 'translate' ]), |
|
| 22 | + new \Twig_SimpleFunction('translate_plural', [ $this, 'translatePlural' ]), |
|
| 23 | + new \Twig_SimpleFunction('locale', [ $this, 'getLocale' ]), |
|
| 24 | 24 | ]; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function __construct( |
| 23 | 23 | TranslatorInterface $translator, |
| 24 | 24 | RouteAssemblerInterface $routeAssembler, |
| 25 | - array $config = [] |
|
| 25 | + array $config = [ ] |
|
| 26 | 26 | ) { |
| 27 | 27 | $this->translator = $translator; |
| 28 | 28 | $this->routeAssembler = $routeAssembler; |
@@ -32,32 +32,32 @@ discard block |
||
| 32 | 32 | public function getFunctions() |
| 33 | 33 | { |
| 34 | 34 | return [ |
| 35 | - new \Twig_SimpleFunction('render_menu', [$this, 'renderMenu'], ['is_safe' => ['html']]), |
|
| 36 | - new \Twig_SimpleFunction('render_langs_menu', [$this, 'renderLanguagesMenu'], ['is_safe' => ['html']]), |
|
| 35 | + new \Twig_SimpleFunction('render_menu', [ $this, 'renderMenu' ], [ 'is_safe' => [ 'html' ] ]), |
|
| 36 | + new \Twig_SimpleFunction('render_langs_menu', [ $this, 'renderLanguagesMenu' ], [ 'is_safe' => [ 'html' ] ]), |
|
| 37 | 37 | ]; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function renderMenu() |
| 41 | 41 | { |
| 42 | - $pages = isset($this->config['menu']) ? $this->config['menu'] : []; |
|
| 43 | - $listElements = []; |
|
| 42 | + $pages = isset($this->config[ 'menu' ]) ? $this->config[ 'menu' ] : [ ]; |
|
| 43 | + $listElements = [ ]; |
|
| 44 | 44 | $elementPattern = |
| 45 | 45 | '<li class="%s">' . |
| 46 | 46 | '<a href="%s" %s><i class="fa %s"></i> %s</a>' . |
| 47 | 47 | '</li>'; |
| 48 | 48 | $currentRoute = $this->routeAssembler->getCurrentRouteResult(); |
| 49 | 49 | foreach ($pages as $page) { |
| 50 | - $active = isset($page['route']) && $currentRoute->getMatchedRouteName() === $page['route'] ? 'active' : ''; |
|
| 51 | - $target = isset($page['target']) ? 'target="_blank"' : ''; |
|
| 52 | - $route = isset($page['uri']) ? $page['uri'] : $this->routeAssembler->assembleUrl($page['route'], true); |
|
| 50 | + $active = isset($page[ 'route' ]) && $currentRoute->getMatchedRouteName() === $page[ 'route' ] ? 'active' : ''; |
|
| 51 | + $target = isset($page[ 'target' ]) ? 'target="_blank"' : ''; |
|
| 52 | + $route = isset($page[ 'uri' ]) ? $page[ 'uri' ] : $this->routeAssembler->assembleUrl($page[ 'route' ], true); |
|
| 53 | 53 | |
| 54 | - $listElements[] = sprintf( |
|
| 54 | + $listElements[ ] = sprintf( |
|
| 55 | 55 | $elementPattern, |
| 56 | 56 | $active, |
| 57 | 57 | $route, |
| 58 | 58 | $target, |
| 59 | - $page['icon'], |
|
| 60 | - $this->translator->translate($page['label']) |
|
| 59 | + $page[ 'icon' ], |
|
| 60 | + $this->translator->translate($page[ 'label' ]) |
|
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function renderLanguagesMenu() |
| 68 | 68 | { |
| 69 | - $pages = isset($this->config['lang_menu']) ? $this->config['lang_menu'] : []; |
|
| 70 | - $listElements = []; |
|
| 69 | + $pages = isset($this->config[ 'lang_menu' ]) ? $this->config[ 'lang_menu' ] : [ ]; |
|
| 70 | + $listElements = [ ]; |
|
| 71 | 71 | $elementPattern = |
| 72 | 72 | '<li>' . |
| 73 | 73 | '<a href="%s" class="%s">%s</a>' . |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | foreach ($pages as $page) { |
| 78 | 78 | // Inherit current route if it is not an error page |
| 79 | 79 | $routeName = $pageResult->isSuccess() ? null : 'home'; |
| 80 | - $route = $this->routeAssembler->assembleUrl($routeName, $page['params']); |
|
| 80 | + $route = $this->routeAssembler->assembleUrl($routeName, $page[ 'params' ]); |
|
| 81 | 81 | |
| 82 | - $listElements[] = sprintf( |
|
| 82 | + $listElements[ ] = sprintf( |
|
| 83 | 83 | $elementPattern, |
| 84 | 84 | $route, |
| 85 | - $page['class'], |
|
| 86 | - $page['label'] |
|
| 85 | + $page[ 'class' ], |
|
| 86 | + $page[ 'label' ] |
|
| 87 | 87 | ); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -10,6 +10,6 @@ |
||
| 10 | 10 | public function __invoke(ContainerInterface $container) |
| 11 | 11 | { |
| 12 | 12 | $config = $container->get('config'); |
| 13 | - return new MailOptions(isset($config['mail']) ? $config['mail'] : []); |
|
| 13 | + return new MailOptions(isset($config[ 'mail' ]) ? $config[ 'mail' ] : [ ]); |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -31,19 +31,19 @@ |
||
| 31 | 31 | * @param bool $inherit Tells if route and query params should be inherited from current route |
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - public function assembleUrl($name = null, $routeParams = [], $queryParams = [], $inherit = false) |
|
| 34 | + public function assembleUrl($name = null, $routeParams = [ ], $queryParams = [ ], $inherit = false) |
|
| 35 | 35 | { |
| 36 | 36 | $routeResult = $this->getCurrentRouteResult(); |
| 37 | 37 | $name = $name ?: $routeResult->getMatchedRouteName(); |
| 38 | 38 | |
| 39 | 39 | if (is_bool($routeParams)) { |
| 40 | 40 | $inherit = $routeParams; |
| 41 | - $routeParams = []; |
|
| 41 | + $routeParams = [ ]; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (is_bool($queryParams)) { |
| 45 | 45 | $inherit = $queryParams; |
| 46 | - $queryParams = []; |
|
| 46 | + $queryParams = [ ]; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if ($inherit) { |
@@ -43,10 +43,10 @@ |
||
| 43 | 43 | private function createMessage(array $messageData) |
| 44 | 44 | { |
| 45 | 45 | return \Swift_Message::newInstance($this->options->getSubject()) |
| 46 | - ->setTo($this->options->getTo()) |
|
| 47 | - ->setFrom($this->options->getFrom()) |
|
| 48 | - ->setReplyTo($messageData['email']) |
|
| 49 | - ->setBody($this->composeBody($messageData), 'text/html'); |
|
| 46 | + ->setTo($this->options->getTo()) |
|
| 47 | + ->setFrom($this->options->getFrom()) |
|
| 48 | + ->setReplyTo($messageData['email']) |
|
| 49 | + ->setBody($this->composeBody($messageData), 'text/html'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | private function composeBody(array $messageData) |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | return \Swift_Message::newInstance($this->options->getSubject()) |
| 46 | 46 | ->setTo($this->options->getTo()) |
| 47 | 47 | ->setFrom($this->options->getFrom()) |
| 48 | - ->setReplyTo($messageData['email']) |
|
| 48 | + ->setReplyTo($messageData[ 'email' ]) |
|
| 49 | 49 | ->setBody($this->composeBody($messageData), 'text/html'); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | * @param bool $inherit Tells if route and query params should be inherited from current route |
| 16 | 16 | * @return string |
| 17 | 17 | */ |
| 18 | - public function assembleUrl($name = null, $routeParams = [], $queryParams = [], $inherit = false); |
|
| 18 | + public function assembleUrl($name = null, $routeParams = [ ], $queryParams = [ ], $inherit = false); |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @return RouteResult |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function __invoke(ContainerInterface $container) |
| 10 | 10 | { |
| 11 | - $translatorConfig = $container->get('config')['translator']; |
|
| 11 | + $translatorConfig = $container->get('config')[ 'translator' ]; |
|
| 12 | 12 | return Translator::factory($translatorConfig); |
| 13 | 13 | } |
| 14 | 14 | } |