ClientException::getCause()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 2
nc 4
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * MercadoLibre PHP SDK
4
 *
5
 * Licensed under The MIT License
6
 * For full copyright and license information, please see the LICENSE file
7
 * Redistributions of files must retain the above copyright notice.
8
 *
9
 * @copyright 2018 Lucas Banegas <[email protected]>
10
 * @license https://opensource.org/licenses/MIT MIT License
11
 * @author Lucas Banegas <[email protected]>
12
 * @link https://github.com/docta/mercadolibre Repository
13
 * @link https://docta.github.io/mercadolibre Documentation
14
 */
15
namespace Docta\MercadoLibre\Exception;
16
17
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
18
19
/**
20
 * Represents an exception for the client.
21
 */
22
class ClientException extends IdentityProviderException
23
{
24
    /**
25
     * Returns the short error message
26
     *
27
     * @return string|null
28
     */
29 2
    public function getError()
30
    {
31 2
        return is_array($this->response) && array_key_exists('message', $this->response)
32 2
            ? $this->response['message'] : null;
33
    }
34
35
    /**
36
     * Returns causes of error
37
     *
38
     * @return array|null
39
     */
40 2
    public function getCause()
41
    {
42 2
        return is_array($this->response) && array_key_exists('cause', $this->response)
43 2
            ? $this->response['cause'] : null;
44
    }
45
}
46