Completed
Push — master ( 50f6e4...48039e )
by Hidde
09:27 queued 03:53
created

TransIPManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 53
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createConnection() 0 4 1
A getConfigName() 0 4 1
A getFactory() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Laravel TransIP.
5
 *
6
 * (c) Hidde Beydals <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace TransIP\Laravel;
13
14
use GrahamCampbell\Manager\AbstractManager;
15
use Illuminate\Contracts\Config\Repository;
16
17
/**
18
 * @method \TransIP\Api\Colocation colocation()
19
 * @method \TransIP\Api\Colocation colocation_service()
20
 * @method \TransIP\Api\Colocation colocationService()
21
 * @method \TransIP\Api\Domain     domain()
22
 * @method \TransIP\Api\Domain     domain_service()
23
 * @method \TransIP\Api\Domain     domainService()
24
 * @method \TransIP\Api\Forward    forward()
25
 * @method \TransIP\Api\Forward    forward_service()
26
 * @method \TransIP\Api\Forward    forwardService()
27
 * @method \TransIP\Api\Vps        vps()
28
 * @method \TransIP\Api\Vps        vps_service()
29
 * @method \TransIP\Api\Vps        vpsService()
30
 * @method \TransIP\Api\WebHosting hosting()
31
 * @method \TransIP\Api\WebHosting web_hosting()
32
 * @method \TransIP\Api\WebHosting webHosting()
33
 * @method \TransIP\Api\WebHosting web_hosting_service()
34
 * @method \TransIP\Api\WebHosting webHostingService()
35
 *
36
 * @author Hidde Beydals <[email protected]>
37
 */
38
class TransIPManager extends AbstractManager
39
{
40
    /**
41
     * The factory instance.
42
     *
43
     * @var \TransIP\Laravel\TransIPFactory
44
     */
45
    protected $factory;
46
47
    /**
48
     * Create a new TransIP manager instance.
49
     *
50
     * @param \Illuminate\Contracts\Config\Repository $config
51
     * @param \TransIP\Laravel\TransIPFactory  $factory
52
     */
53
    public function __construct(Repository $config, TransIPFactory $factory)
54
    {
55
        parent::__construct($config);
56
        $this->factory = $factory;
57
    }
58
59
    /**
60
     * Create the connection instance.
61
     *
62
     * @param array $config
63
     *
64
     * @return \HiddeCo\TransIP\Client
65
     */
66
    protected function createConnection(array $config)
67
    {
68
        return $this->factory->create($config);
69
    }
70
71
    /**
72
     * Get the configuration name.
73
     *
74
     * @return string
75
     */
76
    protected function getConfigName()
77
    {
78
        return 'transip';
79
    }
80
81
    /**
82
     * Get the factory instance.
83
     *
84
     * @return \TransIP\Laravel\TransIPFactory
85
     */
86
    public function getFactory()
87
    {
88
        return $this->factory;
89
    }
90
}
91