ApiException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 8
dl 0
loc 14
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php namespace Arcanedev\Stripe\Exceptions;
2
3
/**
4
 * Class     ApiException
5
 *
6
 * @package  Arcanedev\Stripe\Exceptions
7
 * @author   ARCANEDEV <[email protected]>
8
 */
9
class ApiException extends StripeException
10
{
11
    /* -----------------------------------------------------------------
12
     |  Constructor
13
     | -----------------------------------------------------------------
14
     */
15
16
    /**
17
     * API Exception Constructor.
18
     *
19
     * @param  string       $message
20
     * @param  int          $code
21
     * @param  string|null  $type
22
     * @param  string|null  $stripeCode
23
     * @param  string|null  $httpBody
24
     * @param  array        $jsonBody
25
     * @param  array        $params
26
     * @param  array        $headers
27
     */
28 34
    public function __construct(
29
        $message,
30
        $code = 500,
31
        $type = 'api_error',
32
        $stripeCode = null,
33
        $httpBody = null,
34
        $jsonBody = [],
35
        $params = [],
36
        $headers = []
37
    ) {
38 34
        parent::__construct(
39 34
            $message, $code, $type, $stripeCode, $httpBody, $jsonBody, $params, $headers
40
        );
41 34
    }
42
}
43