1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the `liip/LiipImagineBundle` project. |
5
|
|
|
* |
6
|
|
|
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE.md |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Liip\ImagineBundle\DependencyInjection\Factory\Loader; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\DependencyInjection\ChildDefinition; |
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
16
|
|
|
use Symfony\Component\DependencyInjection\Definition; |
17
|
|
|
use Symfony\Component\DependencyInjection\DefinitionDecorator; |
18
|
|
|
|
19
|
|
|
abstract class AbstractLoaderFactory implements LoaderFactoryInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected static $namePrefix = 'liip_imagine.binary.loader'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return ChildDefinition|DefinitionDecorator |
28
|
|
|
*/ |
29
|
|
|
final protected function getChildLoaderDefinition() |
30
|
|
|
{ |
31
|
|
|
$parent = sprintf('%s.prototype.%s', static::$namePrefix, $this->getName()); |
32
|
|
|
|
33
|
|
|
return class_exists('\Symfony\Component\DependencyInjection\ChildDefinition') ? |
34
|
|
|
new ChildDefinition($parent) : new DefinitionDecorator($parent); |
|
|
|
|
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param string $name |
39
|
|
|
* @param Definition $definition |
40
|
|
|
* @param ContainerBuilder $container |
41
|
|
|
* |
42
|
|
|
* @return string |
43
|
|
|
*/ |
44
|
|
|
final protected function setTaggedLoaderDefinition($name, Definition $definition, ContainerBuilder $container) |
45
|
|
|
{ |
46
|
|
|
$definition->addTag(static::$namePrefix, array( |
47
|
|
|
'loader' => $name, |
48
|
|
|
)); |
49
|
|
|
|
50
|
|
|
$container->setDefinition( |
51
|
|
|
$id = sprintf('%s.%s', static::$namePrefix, $name), |
52
|
|
|
$definition |
53
|
|
|
); |
54
|
|
|
|
55
|
|
|
return $id; |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.