OptimusManager::getConfigName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
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