Me::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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