OnBeforeHLBlockAdd::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Arrilot\BitrixMigrations\Autocreate\Handlers;
4
5
use Arrilot\BitrixMigrations\Exceptions\SkipHandlerException;
6
use Bitrix\Main\Entity\Event;
7
8 View Code Duplication
class OnBeforeHLBlockAdd extends BaseHandler implements HandlerInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var Event
12
     */
13
    protected $event;
14
15
    /**
16
     * Constructor.
17
     *
18
     * @param array $params
19
     *
20
     * @throws SkipHandlerException
21
     */
22
    public function __construct($params)
23
    {
24
        $this->event = $params[0];
25
26
        $this->fields = $this->event->getParameter('fields');
27
    }
28
29
    /**
30
     * Get migration name.
31
     *
32
     * @return string
33
     */
34
    public function getName()
35
    {
36
        return 'auto_add_hlblock_'.$this->fields['TABLE_NAME'];
37
    }
38
39
    /**
40
     * Get template name.
41
     *
42
     * @return string
43
     */
44
    public function getTemplate()
45
    {
46
        return 'auto_add_hlblock';
47
    }
48
49
    /**
50
     * Get array of placeholders to replace.
51
     *
52
     * @return array
53
     */
54
    public function getReplace()
55
    {
56
        return [
57
            'fields' => var_export($this->fields, true),
58
        ];
59
    }
60
}
61