Completed
Push — master ( 682375...dc1ac9 )
by Ekin
01:56
created

Configuration::getIniDirectives()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Container for the configuration of OpCache
4
 *
5
 * PHP version 5.5
6
 *
7
 * @category   OpCacheGUI
8
 * @package    OpCache
9
 * @author     Pieter Hordijk <[email protected]>
10
 * @copyright  Copyright (c) 2013 Pieter Hordijk <https://github.com/PeeHaa>
11
 * @license    http://www.opensource.org/licenses/mit-license.html  MIT License
12
 * @version    1.0.0
13
 */
14
namespace OpCacheGUI\OpCache;
15
16
use OpCacheGUI\Format\Byte;
17
18
/**
19
 * Container for the configuration of OpCache
20
 *
21
 * @category   OpCacheGUI
22
 * @package    OpCache
23
 * @author     Pieter Hordijk <[email protected]>
24
 */
25
class Configuration
26
{
27
    /**
28
     * @var array The (unfiltered) output of opcache_get_configuration()
29
     */
30
    private $configData;
31
32
    /**
33
     * @var \OpCacheGUI\Format\Byte Formatter of byte values
34
     */
35
    private $byteFormatter;
36
37
    /**
38
     * Creates instance
39
     *
40
     * @param \OpCacheGUI\Format\Byte $byteFormatter Formatter of byte values
41
     * @param array                   $configData    The configuration data from opcache
42
     */
43 2
    public function __construct(Byte $byteFormatter, array $configData)
44
    {
45 2
        $this->byteFormatter = $byteFormatter;
46 2
        $this->configData    = $configData;
47 2
    }
48
49
    /**
50
     * Gets the ini directives of OpCache
51
     *
52
     * @return array The ini directives
53
     */
54 1
    public function getIniDirectives()
55
    {
56 1
        $directives = $this->configData['directives'];
57
58 1
        $directives['opcache.memory_consumption'] = $this->byteFormatter->format($directives['opcache.memory_consumption']);
59
60 1
        return $directives;
61
    }
62
63
    /**
64
     * Gets blacklisted files
65
     *
66
     * @return array List of blacklisted files
67
     */
68 1
    public function getBlackList()
69
    {
70 1
        return $this->configData['blacklist'];
71
    }
72
}
73