DnViewSnapshots   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A activate() 0 3 1
A install() 0 5 1
A build() 0 5 1
A update() 0 3 1
A uninstall() 0 5 1
1
<?php
2
3
namespace DnViewSnapshots;
4
5
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...
6
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...
7
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...
8
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...
9
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...
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
12
/**
13
 * Class DnViewSnapshots
14
 * @package DnViewSnapshots
15
 */
16
class DnViewSnapshots extends Plugin
17
{
18
    /**
19
     * @param ContainerBuilder $container
20
     */
21
    public function build(ContainerBuilder $container)
22
    {
23
        $container->setParameter('dn_view_snapshots.plugin_dir', $this->getPath());
24
25
        parent::build($container);
26
    }
27
28
    /**
29
     * @param InstallContext $context
30
     */
31
    public function install(InstallContext $context)
32
    {
33
        $sql = file_get_contents($this->getPath() . '/Resources/sql/install.sql');
34
35
        $this->container->get('dbal_connection')->query($sql);
36
    }
37
38
    /**
39
     * @param ActivateContext $context
40
     */
41
    public function activate(ActivateContext $context)
42
    {
43
        $context->scheduleClearCache(InstallContext::CACHE_LIST_ALL);
44
    }
45
46
    /**
47
     * @param UpdateContext $context
48
     */
49
    public function update(UpdateContext $context)
50
    {
51
        $context->scheduleClearCache(InstallContext::CACHE_LIST_ALL);
52
    }
53
54
    /**
55
     * @param UninstallContext $context
56
     */
57
    public function uninstall(UninstallContext $context)
58
    {
59
        $sql = file_get_contents($this->getPath() . '/Resources/sql/uninstall.sql');
60
61
        $this->container->get('dbal_connection')->query($sql);
62
    }
63
}