Completed
Push — master ( c612e7...f3e1c8 )
by Christian
06:23
created

TensideJsonConfig   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSecret() 0 4 2
A getLocalDomain() 0 4 2
1
<?php
2
3
/**
4
 * This file is part of tenside/core.
5
 *
6
 * (c) Christian Schiffler <[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
 * This project is provided in good faith and hope to be usable by anyone.
12
 *
13
 * @package    tenside/core
14
 * @author     Christian Schiffler <[email protected]>
15
 * @copyright  2015 Christian Schiffler <[email protected]>
16
 * @license    https://github.com/tenside/core/blob/master/LICENSE MIT
17
 * @link       https://github.com/tenside/core
18
 * @filesource
19
 */
20
21
namespace Tenside\Core\Config;
22
23
/**
24
 * Main tenside configuration (abstraction over tenside.json).
25
 */
26
class TensideJsonConfig extends SourceJson
27
{
28
    /**
29
     * Create a new instance.
30
     *
31
     * @param string $directory The directory where the tenside.json shall be placed.
32
     */
33
    public function __construct($directory)
34
    {
35
        parent::__construct($directory . DIRECTORY_SEPARATOR . 'tenside.json');
36
    }
37
38
    /**
39
     * Retrieve the secret.
40
     *
41
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be array|string|integer|null? Also, consider making the array more specific, something like array<String>, or String[].

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

If the return type contains the type array, this check recommends the use of a more specific type like String[] or array<String>.

Loading history...
42
     */
43
    public function getSecret()
44
    {
45
        return $this->has('secret') ? $this->get('secret') : null;
46
    }
47
48
    /**
49
     * Retrieve the secret.
50
     *
51
     * @return string|null
0 ignored issues
show
Documentation introduced by
Should the return type not be array|string|integer|null? Also, consider making the array more specific, something like array<String>, or String[].

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

If the return type contains the type array, this check recommends the use of a more specific type like String[] or array<String>.

Loading history...
52
     */
53
    public function getLocalDomain()
54
    {
55
        return $this->has('domain') ? $this->get('domain') : null;
56
    }
57
}
58