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