DneCustomJsCss::install()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace DneCustomJsCss;
4
5
use DneCustomJsCss\Components\CompilerPass\ReplaceThemeCompilerPass;
6
use Shopware\Components\Plugin;
0 ignored issues
show
Bug introduced by
The type Shopware\Components\Plugin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Shopware\Components\Plugin\Context\ActivateContext;
0 ignored issues
show
Bug introduced by
The type Shopware\Components\Plugin\Context\ActivateContext was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Shopware\Components\Plugin\Context\InstallContext;
0 ignored issues
show
Bug introduced by
The type Shopware\Components\Plugin\Context\InstallContext was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Shopware\Components\Plugin\Context\UninstallContext;
0 ignored issues
show
Bug introduced by
The type Shopware\Components\Plug...ontext\UninstallContext was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Shopware\Components\Plugin\Context\UpdateContext;
0 ignored issues
show
Bug introduced by
The type Shopware\Components\Plugin\Context\UpdateContext was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Symfony\Component\DependencyInjection\ContainerBuilder;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
/**
14
 * Class DneCustomJsCss
15
 */
16
class DneCustomJsCss extends Plugin
17
{
18
    /**
19
     * @param ContainerBuilder $container
20
     */
21
    public function build(ContainerBuilder $container)
22
    {
23
        $container->setParameter('dne_custom_js_css.plugin_dir', $this->getPath());
24
25
        parent::build($container);
26
27
        $container->addCompilerPass(new ReplaceThemeCompilerPass());
28
    }
29
30
    /**
31
     * @param InstallContext $context
32
     */
33
    public function install(InstallContext $context)
34
    {
35
        $sql = file_get_contents($this->getPath() . '/Resources/sql/install.sql');
36
37
        $this->container->get('shopware.db')->query($sql);
38
    }
39
40
    /**
41
     * @param ActivateContext $context
42
     */
43
    public function activate(ActivateContext $context)
44
    {
45
        $context->scheduleClearCache(InstallContext::CACHE_LIST_ALL);
46
    }
47
48
    /**
49
     * @param UpdateContext $context
50
     */
51
    public function update(UpdateContext $context)
52
    {
53
        $context->scheduleClearCache(InstallContext::CACHE_LIST_ALL);
54
    }
55
56
    /**
57
     * @param UninstallContext $context
58
     */
59
    public function uninstall(UninstallContext $context)
60
    {
61
        $sql = file_get_contents($this->getPath() . '/Resources/sql/uninstall.sql');
62
63
        $this->container->get('dbal_connection')->query($sql);
64
    }
65
}
66