Completed
Push — master ( 9bf308...234a08 )
by Tobias
161:07 queued 125:55
created

StorageTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 16
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getStorage() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[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 Translation\Bundle\Command;
13
14
use Translation\Bundle\Service\StorageManager;
15
16
trait StorageTrait
17
{
18
    /**
19
     * @var StorageManager
20
     */
21
    private $storageManager;
22
23
    private function getStorage($configName)
24
    {
25
        if (null === $storage = $this->storageManager->getStorage($configName)) {
26
            $availableStorages = $this->storageManager->getNames();
27
28
            throw new \InvalidArgumentException(sprintf('Unknown storage "%s". Available storages are "%s".', $configName, implode('", "', $availableStorages)));
29
        }
30
    }
31
}
32