Setting::options()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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