| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class TwigThemeFactory implements ThemeFactoryInterface |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var \Twig_Environment |
||
| 14 | */ |
||
| 15 | private $twig; |
||
| 16 | /** |
||
| 17 | * @var BlockRendererInterface |
||
| 18 | */ |
||
| 19 | private $blockRenderer; |
||
| 20 | |||
| 21 | public function __construct(\Twig_Environment $twig, BlockRendererInterface $blockRenderer) |
||
| 22 | { |
||
| 23 | $this->twig = $twig; |
||
| 24 | $this->blockRenderer = $blockRenderer; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Creates a theme object based on the descriptor object passed in parameter. |
||
| 29 | * |
||
| 30 | * @throws \TheCodingMachine\CMS\Theme\CannotHandleThemeDescriptorExceptionInterface Throws an exception if the factory cannot handle this descriptor. |
||
| 31 | */ |
||
| 32 | public function createTheme(ThemeDescriptorInterface $descriptor): RenderableInterface |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Returns true if this factory can handle the descriptor passed in parameter. False otherwise. |
||
| 42 | */ |
||
| 43 | public function canCreateTheme(ThemeDescriptorInterface $descriptor): bool |
||
| 46 | } |
||
| 47 | } |
||
| 48 |