This repository has been archived by the owner on Dec 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
IrozgarGulpRevVersionsBundle.php
47 lines (41 loc) · 1.86 KB
/
IrozgarGulpRevVersionsBundle.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
38
39
40
41
42
43
44
45
46
47
<?php
namespace Irozgar\GulpRevVersionsBundle;
use Irozgar\GulpRevVersionsBundle\DependencyInjection\Compiler\SetVersionStrategyCompiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\Kernel;
class IrozgarGulpRevVersionsBundle extends Bundle
{
public function __construct()
{
$deprecationMessage = 'The bundle IrozgarGulpRevVersionsBundle is deprecated and will be abandoned when '.
'symfony 2.8 support finishes on November 2019. ';
if (Kernel::VERSION_ID >= 30300) {
$deprecationMessage .= 'Since version 3.3, symfony includes the option "json_manifest_path" that does the '.
'same as this bundle, I recommend using that instead of this bundle.';
}
if (Kernel::VERSION_ID < 30300) {
$deprecationMessage .= 'I recommend updating your symfony version to the last stable version and use '.
'the option "json_manifest_path" included in symfony since version 3.3.';
}
trigger_error($deprecationMessage, E_USER_DEPRECATED);
}
public function build(ContainerBuilder $container)
{
parent::build($container);
// Register only for versions lower than Symfony 3.1 because the don't have the option for
// setting the version_strategy
$this->addCompilerPassWhenVersionIsLowerThan($container, new SetVersionStrategyCompiler(), 30100);
}
public function addCompilerPassWhenVersionIsLowerThan(
ContainerBuilder $container,
CompilerPassInterface $compilerPass,
$maxVersion,
$currentVersion = Kernel::VERSION_ID
) {
if ($currentVersion < $maxVersion) {
$container->addCompilerPass($compilerPass);
}
}
}