for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Core\Theme;
use Doctrine\DBAL\DBALException;
use Sylius\Bundle\ThemeBundle\Context\ThemeContextInterface;
use Sylius\Bundle\ThemeBundle\Repository\ThemeRepositoryInterface;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Channel\Context\ChannelNotFoundException;
use Sylius\Component\Core\Model\ChannelInterface;
/**
* @author Kamil Kokot <[email protected]>
final class ChannelBasedThemeContext implements ThemeContextInterface
{
* @var ChannelContextInterface
private $channelContext;
* @param ChannelContextInterface $channelContext
public function __construct(ChannelContextInterface $channelContext)
$this->channelContext = $channelContext;
}
* {@inheritdoc}
public function getTheme()
try {
/** @var ChannelInterface $channel */
$channel = $this->channelContext->getChannel();
return $channel->getTheme();
} catch (ChannelNotFoundException $exception) {
return null;
} catch (\Exception $exception) {