Me   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 57
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 9 1
A __construct() 0 3 1
A photo() 0 12 1
A me() 0 8 1
1
<?php
2
3
namespace CarlosBrito\CafeApi;
4
5
/**
6
 * Class Me
7
 * @package RobsonVLeite\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
}