itsmelepassos /
cafeapi
| 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
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
|
|||
| 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
|
|||
| 68 | } |
||
| 69 | } |