Customer::setURL()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace FLAIRUK\GoodTillSystem\Models;
4
5
use FLAIRUK\GoodTillSystem\API;
6
use Illuminate\Support\Facades\Config;
7
8 View Code Duplication
class Customer extends API {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
10
    /**
11
     * The url attribute.
12
     *
13
     * @var
14
     */
15
    protected $id;
16
17
    /**
18
     * Create a new Good Till Customer instance.
19
     *
20
     * @param array $user
21
     * @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...
22
     * 
23
     * @source https://apidoc.thegoodtill.com/#api-Outlet
24
     */
25
    public function __construct(array $user) {
26
        parent::__construct($user, $this->url);
27
    }
28
29
    /**
30
     * Set Outlet URL
31
     * 
32
     * @param string|null $id
33
     * @return void
34
     */
35
    public function setURL($id = null): void { 
36
        $this->url = Config::get('goodtill.routes.api') . 'customers/' . $id ?? $id;
37
        // if (!is_null($id)) {
38
        //     $this->url = Config::get('goodtill.routes.api') . 'customers/' . $this->id ?? $this->id;
39
        // } else {
40
        //     $this->url = $url;
41
        // }
42
    }
43
    /**
44
     * Set Product Outlet ID
45
     * 
46
     * @param string $id
47
     * @return object
48
     */
49
    public function setID(string $id): object {
50
        $this->id = $id;
51
        return $this;
52
    }
53
}
54