Wrapper::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 4
nc 1
nop 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
}