/
DriverCompilerPass.php
37 lines (32 loc) · 1.13 KB
/
DriverCompilerPass.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/*
* This file is part of the `liip/LiipImagineBundle` project.
*
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace Liip\ImagineBundle\DependencyInjection\Compiler;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Give a helpful exception message in case the imagine driver does not exist.
*
* Third parties can provide a driver, and thus we can only validate after the container has been built.
*/
class DriverCompilerPass extends AbstractCompilerPass
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
$liipImagineDriver = $container->getParameter('liip_imagine.driver_service');
if (!$container->hasDefinition($liipImagineDriver)) {
throw new InvalidConfigurationException(sprintf(
"Specified driver '%s' is not defined.", $liipImagineDriver
));
}
}
}