OnBeforeIBlockAdd::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
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 View Code Duplication
class OnBeforeIBlockAdd 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...
6
{
7
    /**
8
     * Constructor.
9
     *
10
     * @param array $params
11
     */
12
    public function __construct($params)
13
    {
14
        $this->fields = $params[0];
15
    }
16
17
    /**
18
     * Get migration name.
19
     *
20
     * @return string
21
     */
22
    public function getName()
23
    {
24
        return "auto_add_iblock_{$this->fields['CODE']}";
25
    }
26
27
    /**
28
     * Get template name.
29
     *
30
     * @return string
31
     */
32
    public function getTemplate()
33
    {
34
        return 'auto_add_iblock';
35
    }
36
37
    /**
38
     * Get array of placeholders to replace.
39
     *
40
     * @return array
41
     */
42
    public function getReplace()
43
    {
44
        return [
45
            'fields' => var_export($this->fields, true),
46
            'code'   => "'".$this->fields['CODE']."'",
47
        ];
48
    }
49
}
50