AAPanelCategory::Create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 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
}