* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\Employee; use PrestaShop\PrestaShop\Adapter\LegacyContext; use PrestaShop\PrestaShop\Core\Employee\NavigationMenuTogglerInterface; /** * Class NavigationMenuToggler handles collapsing/expanding the navigation for context employee. */ final class NavigationMenuToggler implements NavigationMenuTogglerInterface { /** * @var LegacyContext */ private $legacyContext; /** * @param LegacyContext $legacyContext */ public function __construct(LegacyContext $legacyContext) { $this->legacyContext = $legacyContext; } /** * {@inheritdoc} */ public function toggleNavigationMenuInCookies($shouldCollapse) { $this->legacyContext->getContext()->cookie->collapse_menu = (int) $shouldCollapse; $this->legacyContext->getContext()->cookie->write(); } }