Total Complexity | 5 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
20 | class CategoryTypesEvent extends CommonEvent |
||
21 | { |
||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $types = []; |
||
26 | |||
27 | /** |
||
28 | * Returns the array of Category Types. |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | public function getCategoryTypes() |
||
33 | { |
||
34 | if (!array_key_exists('global', $this->types)) { |
||
35 | // Alphabetize once |
||
36 | asort($this->types); |
||
37 | |||
38 | $this->types = array_merge( |
||
39 | ['global' => 'mautic.category.global'], |
||
40 | $this->types |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | return $this->types; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Adds the category type and label. |
||
49 | * |
||
50 | * @param string $type |
||
51 | * @param string $label |
||
52 | */ |
||
53 | public function addCategoryType($type, $label = null) |
||
64 | } |
||
65 | } |
||
66 |