EdmundsAPI   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A get_data() 0 8 2
1
<?php
2
/**
3
 * requires external API
4
 *
5
 */
6
7
8
class EdmundsAPI extends Edmunds\SDK\ApiClient
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
    private static $api_key = "";
0 ignored issues
show
Unused Code introduced by
The property $api_key is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
11
12
    private static $secret = "";
0 ignored issues
show
Unused Code introduced by
The property $secret is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
13
14
    private static $_cache = null;
15
16
    public function __construct()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
17
    {
18
        if (!self::$_cache) {
19
            self::$_cache = new Edmunds\SDK\ApiCache(TEMP_FOLDER);
20
        }
21
        return parent::__construct(Config::inst()->get("EdmundsAPI", "api_key"), self::$_cache);
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
22
    }
23
24
    public static function get_data($call, $params)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
25
    {
26
        if (substr($call, 0, 1) !== "/") {
27
            $call = "/".$call;
28
        }
29
        $obj = Injector::inst()->get("EdmundsAPI");
30
        return $obj->makeCall($call, $params);
31
    }
32
}
33