Php::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * @package    Fuel\Config
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2015 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
namespace Fuel\Config\Handler;
12
13
use Fuel\Config\Handler;
14
15
/**
16
 * PHP configuration loading and formatting logic
17
 */
18
class Php implements Handler
19
{
20
	/**
21
	 * {@inheritdoc}
22
	 */
23 4
	public function load($file)
24
	{
25 4
		return include $file;
26
	}
27
28
	/**
29
	 * {@inheritdoc}
30
	 */
31 2
	public function format($data)
32
	{
33 2
		$data = var_export($data, true);
34
35 2
		$formatted = str_replace(
36 2
			array('  ', 'array ('),
37 2
			array("\t", 'array('),
38
			$data
39
		);
40
41
		$output = <<<CONF
42
<?php
43
44 2
return {$formatted};
45
CONF;
46
47 2
		return $output;
48
	}
49
}
50