BaseUriFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 3
1
<?php
2
/**
3
 * Dash
4
 *
5
 * @link      http://github.com/DASPRiD/Dash For the canonical source repository
6
 * @copyright 2013-2015 Ben Scholzen 'DASPRiD'
7
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
8
 */
9
10
namespace Dash;
11
12
use Dash\Exception\OutOfBoundsException;
13
use Interop\Container\ContainerInterface;
14
15
/**
16
 * Factory for a configured base URI.
17
 */
18
class BaseUriFactory
19
{
20
    /**
21
     * {@inheritdoc}
22
     *
23
     * @return string
24
     */
25
    public function __invoke(ContainerInterface $container)
26
    {
27
        $config = $container->has('config') ? $container->get('config') : [];
28
29
        if (!isset($config['dash']['base_uri'])) {
30
            throw new OutOfBoundsException('Missing "base_uri" key in "dash" section');
31
        }
32
33
        return $config['dash']['base_uri'];
34
    }
35
}
36