Completed
Push — master ( ef8e02...cd88cd )
by CodexShaper
11:14
created

Setting::all()   A

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 1
crap 2
1
<?php
2
3
namespace Codexshaper\WooCommerce\Models;
4
5
use Codexshaper\WooCommerce\Facades\WooCommerce;
6
use Codexshaper\WooCommerce\Traits\QueryBuilderTrait;
7
8
class Setting extends BaseModel
9
{
10
    use QueryBuilderTrait;
11
12
    protected $endpoint = 'settings';
13
14
    /**
15
     * Retrieve option.
16
     *
17
     * @param int   $group_id
18
     * @param int   $id
19
     * @param array $options
20
     *
21
     * @return array
22
     */
23
    protected function option($group_id, $id, $options = [])
24
    {
25
        $this->endpoint = "settings/{$group_id}";
26
27
        return self::find($id, $options);
28
    }
29
30
    /**
31
     * Retrieve options.
32
     *
33
     * @param int   $id
34
     * @param array $options
35
     *
36
     * @return array
37
     */
38
    protected function options($id, $options = [])
39
    {
40
        return self::find($id, $options);
41
    }
42
43
    /**
44
     * Update Existing Item.
45
     *
46
     * @param int   $group_id
47
     * @param int   $id
48
     * @param array $data
49
     *
50
     * @return object
51
     */
52
    protected function update($group_id, $id, $data)
53
    {
54
        $this->endpoint = "settings/{$group_id}";
55
56
        return self::update($id, $data);
0 ignored issues
show
Bug introduced by
The call to update() misses a required argument $data.

This check looks for function calls that miss required arguments.

Loading history...
Documentation introduced by
$data is of type array, but the function expects a integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
57
    }
58
59
    /**
60
     * Batch Update.
61
     *
62
     * @param array $data
63
     *
64
     * @return object
65
     */
66
    protected function batch($id, $data)
67
    {
68
        $this->endpoint = "settings/{$id}";
69
70
        return self::batch($data);
0 ignored issues
show
Bug introduced by
The call to batch() misses a required argument $data.

This check looks for function calls that miss required arguments.

Loading history...
71
    }
72
}
73