Wrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 44
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A __call() 0 4 1
1
<?php
2
3
namespace Gregoriohc\LaravelPlesk;
4
5
use Illuminate\Config\Repository;
6
use PleskX\Api\Client;
7
8
class Wrapper
9
{
10
    /**
11
     * The config instance
12
     *
13
     * @var Repository
14
     */
15
    public $config;
16
17
    /**
18
     * The Plesk api client instance
19
     *
20
     * @var \PleskX\Api\Client
21
     */
22
    public $client;
23
24
    /**
25
     * Client constructor
26
     *
27
     * @param Repository $config
28
     */
29
    public function __construct(Repository $config)
30
    {
31
        // Get the config data
32
        $this->config = $config;
33
34
        // Make the client instance
35
        $this->client = new Client($this->config->get('plesk.host'));
36
        $this->client->setCredentials($this->config->get('plesk.login'), $this->config->get('plesk.password'));
37
    }
38
39
    /**
40
     * Handle dynamic calls to the client
41
     *
42
     * @param $name
43
     * @param $arguments
44
     *
45
     * @return mixed
46
     */
47
    public function __call($name, $arguments)
48
    {
49
        return call_user_func_array([$this->client, $name], $arguments);
50
    }
51
}