Service   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 43
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
A setEndPoint() 0 4 1
1
<?php
2
3
namespace Onurkacmaz\LaravelN11;
4
5
use Onurkacmaz\LaravelN11\Exceptions\N11Exception;
6
use SoapClient;
7
8
class Service
9
{
10
11
    /**
12
     * @var int
13
     */
14
    public const GENERAL_LIMIT = 100;
15
16
    /**
17
     * @var array[]|null
18
     */
19
    protected $_parameters = null;
20
21
    /**
22
     * @var string
23
     */
24
    private $_baseUrl = "https://api.n11.com/ws";
25
26
    /**
27
     * Service constructor.
28
     * @throws N11Exception
29
     */
30
    public function __construct()
31
    {
32
        if (is_null(config("laravel-n11.api_key")) || is_null(config("laravel-n11.api_secret"))) {
33
            {
34
                throw new N11Exception("API KEY or API SECRET cannot be null");
35
            }
36
        }
37
        $this->_parameters = ['auth' => ['appKey' => config("laravel-n11.api_key"), 'appSecret' => config("laravel-n11.api_secret")]];
0 ignored issues
show
Documentation Bug introduced by
It seems like array('auth' => array('a...avel-n11.api_secret'))) of type array<string,array<strin..."appSecret\":\"?\"}>"}> is incompatible with the declared type array<integer,array>|null of property $_parameters.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
38
    }
39
40
    /**
41
     * @param string $endPoint
42
     * @return SoapClient
43
     * @throws \SoapFault
44
     */
45
    protected function setEndPoint(string $endPoint): SoapClient
46
    {
47
        return new SoapClient($this->_baseUrl . "/" . $endPoint);
48
    }
49
50
}
51