System::tools()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Codexshaper\WooCommerce\Models;
4
5
use Codexshaper\WooCommerce\Facades\Query;
6
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
7
8
class System extends BaseModel
9
{
10
    use QueryBuilderTrait;
11
12
    protected $endpoint;
13
14
    /**
15
     * Retrieve all Items.
16
     *
17
     * @param array $options
18
     *
19
     * @return array
20
     */
21
    protected function status($options = [])
22
    {
23
        return Query::init()
24
            ->setEndpoint('system_status')
25
            ->all($options);
26
    }
27
28
    /**
29
     * Retrieve single tool.
30
     *
31
     * @param int   $id
32
     * @param array $options
33
     *
34
     * @return object
35
     */
36
    protected function tool($id, $options = [])
37
    {
38
        return Query::init()
39
            ->setEndpoint('system_status/tools')
40
            ->find($id, $options);
41
    }
42
43
    /**
44
     * Retrieve all tools.
45
     *
46
     * @param array $options
47
     *
48
     * @return array
49
     */
50
    protected function tools($options = [])
51
    {
52
        return Query::init()
53
            ->setEndpoint('system_status/tools')
54
            ->all($options);
55
    }
56
57
    /**
58
     * Run tool.
59
     *
60
     * @param int   $id
61
     * @param array $data
62
     *
63
     * @return object
64
     */
65
    protected function run($id, $data)
66
    {
67
        return Query::init()
68
            ->setEndpoint('system_status/tools')
69
            ->update($id, $data);
70
    }
71
}
72