MeController::photo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
nc 1
nop 1
dl 0
loc 12
c 0
b 0
f 0
cc 1
rs 10
1
<?php
2
3
namespace ItsMeLePassos\CafeApi;
4
5
use ItsMeLePassos\CafeApi\API\CafeApiController;
6
7
/**
8
 * 
9
 * @package Source\App\CafeApi
10
 */
11
class MeController extends CafeApiController
12
{
13
    /**
14
     * Me constructor
15
     * @param string $apiUrl
16
     * @param string $email
17
     * @param string $password
18
     */
19
    public function __construct(string $apiUrl, string $email, string $password)
20
    {
21
        parent::__construct($apiUrl, $email, $password);
22
    }
23
24
    /**
25
     * @return Me
26
     */
27
    public function me(): MeController
28
    {
29
        $this->request(
30
            "GET",
31
            "/me"
32
        );
33
34
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ItsMeLePassos\CafeApi\MeController which is incompatible with the documented return type ItsMeLePassos\CafeApi\Me.
Loading history...
35
    }
36
37
    /**
38
     * @param array $fields
39
     * @return Me
40
     */
41
    public function update(array $fields): MeController
42
    {
43
        $this->request(
44
            "PUT",
45
            "/me",
46
            $fields
47
        );
48
49
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ItsMeLePassos\CafeApi\MeController which is incompatible with the documented return type ItsMeLePassos\CafeApi\Me.
Loading history...
50
    }
51
52
    /**
53
     * @param array $files
54
     * @return Me
55
     */
56
    public function photo(array $files): MeController
57
    {
58
        $this->request(
59
            "POST",
60
            "/me/photo",
61
            [
62
                "files" => true,
63
                "photo" => curl_file_create($files["tmp_name"], $files["type"])
64
            ]
65
        );
66
67
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ItsMeLePassos\CafeApi\MeController which is incompatible with the documented return type ItsMeLePassos\CafeApi\Me.
Loading history...
68
    }
69
}