OptimusManager   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 7
dl 0
loc 41
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigName() 0 3 1
A getFactory() 0 3 1
A createConnection() 0 3 1
A __construct() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of Laravel Optimus.
5
 *
6
 * (c) Anton Komarev <[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
declare(strict_types=1);
13
14
namespace Cog\Laravel\Optimus;
15
16
use GrahamCampbell\Manager\AbstractManager;
17
use Illuminate\Contracts\Config\Repository;
18
use Jenssegers\Optimus\Optimus;
19
20
class OptimusManager extends AbstractManager
21
{
22
    /**
23
     * The factory instance.
24
     */
25
    private OptimusFactory $factory;
26
27
    public function __construct(
28
        Repository $config,
29
        OptimusFactory $factory
30
    ) {
31
        parent::__construct($config);
32
33
        $this->factory = $factory;
34
    }
35
36
    /**
37
     * Create the connection instance.
38
     *
39
     * @param array $config
40
     * @return \Jenssegers\Optimus\Optimus
41
     */
42
    protected function createConnection(array $config): Optimus
43
    {
44
        return $this->factory->make($config);
45
    }
46
47
    /**
48
     * Get the configuration name.
49
     */
50
    protected function getConfigName(): string
51
    {
52
        return 'optimus';
53
    }
54
55
    /**
56
     * Get the factory instance.
57
     */
58
    public function getFactory(): OptimusFactory
59
    {
60
        return $this->factory;
61
    }
62
}
63