OnBeforeGroupDelete::getTemplate()   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 0
1
<?php
2
3
namespace Arrilot\BitrixMigrations\Autocreate\Handlers;
4
5
use Arrilot\BitrixMigrations\Exceptions\StopHandlerException;
6
use CGroup;
7
8 View Code Duplication
class OnBeforeGroupDelete 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
     * Bitrix group id.
12
     *
13
     * @var int
14
     */
15
    protected $id;
16
17
    /**
18
     * Constructor.
19
     *
20
     * @param array $params
21
     *
22
     * @throws StopHandlerException
23
     */
24
    public function __construct($params)
25
    {
26
        $this->id = $params[0];
27
28
        $this->fields = CGroup::GetByID($this->id)->fetch();
29
    }
30
31
    /**
32
     * Get migration name.
33
     *
34
     * @return string
35
     */
36
    public function getName()
37
    {
38
        return "auto_delete_group_{$this->fields['STRING_ID']}";
39
    }
40
41
    /**
42
     * Get template name.
43
     *
44
     * @return string
45
     */
46
    public function getTemplate()
47
    {
48
        return 'auto_delete_group';
49
    }
50
51
    /**
52
     * Get array of placeholders to replace.
53
     *
54
     * @return array
55
     */
56
    public function getReplace()
57
    {
58
        return [
59
            'id' => $this->id,
60
        ];
61
    }
62
}
63