Json::preFormatDatas()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @version 1.0
5
 * @author Vermeulen Maxime (bulton-fr) <[email protected]>
6
 * @package bultonFr
7
 */
8
9
namespace bultonFr\CallCurl\Parser;
10
11
use \Exception;
12
13
class Json implements \bultonFr\CallCurl\Parser
14
{
15
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function preFormatDatas(&$datas)
20
    {
21
        $datas = json_encode($datas);
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function formatCallReturn(&$callReturn)
28
    {
29
        $callReturn = json_decode($callReturn);
30
        
31
        if($callReturn === null) {
32
            throw new Exception(json_last_error_msg());
33
        }
34
    }
35
36
}
37