ClientException   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getError() 0 4 3
A getCause() 0 4 3
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