Completed
Push — master ( 8e5e55...6fad72 )
by Iqbal
10:57
created

StorageManager::buildInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

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 2
eloc 6
nc 2
nop 6
1
<?php
2
/*
3
 * This file is part of the Borobudur-Event-Sourcing package.
4
 *
5
 * (c) Hexacodelabs <http://hexacodelabs.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Borobudur\EventSourcing\Storage;
12
13
use Borobudur\EventSourcing\Storage\Mongo\MongoConfig;
14
use Borobudur\EventSourcing\Storage\Mongo\MongoStorage;
15
16
/**
17
 * @author      Iqbal Maulana <[email protected]>
18
 * @created     8/21/15
19
 */
20 View Code Duplication
class StorageManager extends AbstractStorageManager
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
{
22
    /**
23
     * @var StorageInterface[]
24
     */
25
    protected static $instances = array();
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected static function supportEngines()
31
    {
32
        return array('mongodb', 'mongo');
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    protected static function buildEngine($engine, $host, $port, $database, $user, $pass)
39
    {
40
        if (in_array($engine, array('mongodb', 'mongo'))) {
41
            return new MongoStorage(new MongoConfig($database, $host, $user, $pass, $port));
42
        }
43
44
        return null;
45
    }
46
}
47