Json::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
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
 * JSON configuration loading and formatting logic
17
 */
18
class Json implements Handler
19
{
20
	/**
21
	 * {@inheritdoc}
22
	 */
23 1
    public function load($file)
24
    {
25 1
        $contents = file_get_contents($file);
26
27 1
        return json_decode($contents, true);
28
    }
29
30
	/**
31
	 * {@inheritdoc}
32
	 */
33 1
    public function format($data)
34
    {
35 1
        return json_encode($data);
36
    }
37
}
38