Skip to content

Commit

Permalink
fix cs; add typehint
Browse files Browse the repository at this point in the history
  • Loading branch information
gimler committed Jan 10, 2012
1 parent 1622836 commit 30649bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion Controller/ThemeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ public function switchAction(Request $request)
$this->activeTheme->setName($theme);

$url = $request->headers->get('Referer');
$cookie = new Cookie($this->cookieOptions['name'], $theme, time() + $this->cookieOptions['lifetime'], $this->cookieOptions['path'], $this->cookieOptions['domain'], (bool) $this->cookieOptions['secure'], (bool) $this->cookieOptions['httponly']);
$cookie = new Cookie(
$this->cookieOptions['name'],
$theme,
time() + $this->cookieOptions['lifetime'],
$this->cookieOptions['path'],
$this->cookieOptions['domain'],
(Boolean) $this->cookieOptions['secure'],
(Boolean) $this->cookieOptions['httponly']
);

$response = new RedirectResponse($url);
$response->headers->setCookie($cookie);
Expand Down
8 changes: 4 additions & 4 deletions EventListener/ThemeRequestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ThemeRequestListener
* @param array $cookieOptions The options of the cookie we look for the theme to set
* @param DeviceDetectionInterface $autoDetect If to auto detect the theme based on the user agent
*/
public function __construct($activeTheme, $cookieOptions, $autoDetect = null)
public function __construct($activeTheme, $cookieOptions, DeviceDetectionInterface $autoDetect = null)
{
$this->activeTheme = $activeTheme;
$this->autoDetect = $autoDetect;
Expand All @@ -63,7 +63,7 @@ public function __construct($activeTheme, $cookieOptions, $autoDetect = null)
'path' => '/',
'domain' => '',
'secure' => false,
'httponly' => false
'httponly' => false,
);
$this->cookieOptions = array_merge($cookieDefaults, $cookieOptions);
}
Expand Down Expand Up @@ -101,8 +101,8 @@ public function onKernelResponse(FilterResponseEvent $event)
time() + $this->cookieOptions['lifetime'],
$this->cookieOptions['path'],
$this->cookieOptions['domain'],
(bool) $this->cookieOptions['secure'],
(bool) $this->cookieOptions['httponly']
(Boolean) $this->cookieOptions['secure'],
(Boolean) $this->cookieOptions['httponly']
);
$event->getResponse()->headers->setCookie($cookie);
}
Expand Down

0 comments on commit 30649bf

Please sign in to comment.