JsonStorage::writeRawContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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