AAPanelCategory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 15
c 1
b 0
f 0
dl 0
loc 61
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A List() 0 5 1
A Update() 0 7 1
A Delete() 0 6 1
A __construct() 0 3 1
A Create() 0 6 1
1
<?php
2
3
namespace DevOpsSantana\AAPanel;
4
5
/**
6
 * Class AAPanelCategory
7
 * @package DevOpsSantana\AAPanel
8
 * @author Rogério Santana <https://github.com/devopssantana>
9
 * @since : 2022
10
 */
11
class AAPanelCategory extends AAPanelConnect
12
{
13
    /**
14
     * Class Construct
15
     */
16
    public function __construct()
17
    {
18
        parent::__construct();
19
    }
20
21
22
    /**
23
     * @description List Category
24
     * @return mixed
25
     */
26
    public function List(): mixed
27
    {
28
        $url = $this->serverUrl .'/site?action=get_site_types';
29
        
30
        return (parent::Execute($url,$this->data));
31
    }
32
33
    /**
34
     * @description Create Category
35
     * @param string $name
36
     * @return mixed
37
     */
38
    public function Create(string $name): mixed
39
    {
40
        $url = $this->serverUrl .'/site?action=add_site_type';
41
        
42
        $this->data['name'] = $name;
43
        return (parent::Execute($url,$this->data));
44
    }
45
46
    /**
47
     * @description Update Category
48
     * @param int $id
49
     * @param string $name
50
     * @return mixed
51
     */
52
    public function Update(int $id, string $name): mixed
53
    {
54
        $url = $this->serverUrl .'/site?action=modify_site_type_name';
55
        
56
        $this->data['id']   = $id;
57
        $this->data['name'] = $name;
58
        return (parent::Execute($url,$this->data));
59
    }
60
61
    /**
62
     * @description Delete Category
63
     * @param int $id
64
     * @return mixed
65
     */
66
    public function Delete(int $id): mixed
67
    {
68
        $url = $this->serverUrl .'/site?action=remove_site_type';
69
        
70
        $this->data['id']   = $id;
71
        return (parent::Execute($url,$this->data));
72
    }
73
}