JsonStorage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A writeRawContent() 0 4 1
A readJson() 0 8 2
1
<?php
2
3
namespace Rezzza\RestApiBehatExtension\Json;
4
5
use Rezzza\RestApiBehatExtension\Rest\ResponseStorage;
6
7
/**
8
 * Store the JSON that we could analyze it in JsonContext
9
 */
10
class JsonStorage implements ResponseStorage
11
{
12
    private $rawContent;
13
14
    public function writeRawContent($rawContent)
15
    {
16
        $this->rawContent = $rawContent;
17
    }
18
19
    public function readJson()
20
    {
21
        if ($this->rawContent === null) {
22
            throw new \LogicException('No content defined. You should use JsonStorage::writeRawContent method to inject content you want to analyze');
23
        }
24
25
        return new Json($this->rawContent);
26
    }
27
}
28