OnBeforeIBlockPropertyDelete   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 45
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 4 1
A getTemplate() 0 4 1
A getReplace() 0 7 1
1
<?php
2
3
namespace Arrilot\BitrixMigrations\Autocreate\Handlers;
4
5
use CIBlockProperty;
6
7
class OnBeforeIBlockPropertyDelete extends BaseHandler implements HandlerInterface
8
{
9
    /**
10
     * Constructor.
11
     *
12
     * @param array $params
13
     */
14
    public function __construct($params)
15
    {
16
        $this->fields = CIBlockProperty::getByID($params[0])->fetch();
17
    }
18
19
    /**
20
     * Get migration name.
21
     *
22
     * @return string
23
     */
24
    public function getName()
25
    {
26
        return "auto_delete_iblock_element_property_{$this->fields['CODE']}_in_ib_{$this->fields['IBLOCK_ID']}";
27
    }
28
29
    /**
30
     * Get template name.
31
     *
32
     * @return string
33
     */
34
    public function getTemplate()
35
    {
36
        return 'auto_delete_iblock_element_property';
37
    }
38
39
    /**
40
     * Get array of placeholders to replace.
41
     *
42
     * @return array
43
     */
44
    public function getReplace()
45
    {
46
        return [
47
            'iblockId' => $this->fields['IBLOCK_ID'],
48
            'code'     => "'".$this->fields['CODE']."'",
49
        ];
50
    }
51
}
52