Completed
Push — master ( b7f699...e9d2a5 )
by Phil™
01:16
created

Staff::setURL()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace FLAIRUK\GoodTillSystem\Models;
4
5
use FLAIRUK\GoodTillSystem\API;
6
use Illuminate\Support\Facades\Config;
7
8
class Staff extends API {
9
10
    /**
11
     * The url attribute.
12
     *
13
     * @var string
14
     */
15
    protected $url = 'staffs';
16
17
    const STAFF = 'staffs';
18
19
    /**
20
     * Create a new Good Till Product instance.
21
     *
22
     * @param array $user
23
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
24
     */
25
    public function __construct(array $user) {
26
        parent::__construct($user, $this->url);
27
    }
28
29
    public function setURL($url = null): void {
30
        $this->url = $url ? $url : Config::get('goodtill.routes.api') . self::STAFF;
31
    }
32
33
    
34
    /**
35
     * Product Set Outlet ID
36
     * 
37
     * @param $id
38
     * @return object
39
     */
40
    public function setID($id): object {
41
        $this->id = $id;
0 ignored issues
show
Bug introduced by
The property id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
42
        return $this;
43
    }
44
45
    /**
46
     * Product Set Outlet ID
47
     * 
48
     * @param $id
49
     * @return object
50
     */
51
    public function setOutlet($id): object {
52
        $this->outlet_id = ['outlet_id' => $id];
0 ignored issues
show
Bug introduced by
The property outlet_id does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
53
        return $this;
54
    }
55
56
   /**
57
     * Product Set Outlet ID
58
     * 
59
     * @param $id
60
     * @return object
61
     */
62
    public function setName($name): object {
63
        $this->product_name = ['product_name' => $name];
0 ignored issues
show
Bug introduced by
The property product_name does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
64
        // $this->product_name = array_merge($this->payload, ['product_name' => $name ]);
65
        return $this;
66
    }
67
68
}