StackFormation\Preprocessor::processJson PHP Метод

processJson() публичный Метод

public processJson ( $json, $basePath )
    public function processJson($json, $basePath)
    {
        if (!is_string($json)) {
            throw new \InvalidArgumentException('Expected json string');
        }
        // TODO: refactor to use a pipeline
        $json = $this->stripComments($json);
        $json = $this->parseRefInDoubleQuotedStrings($json);
        $json = $this->expandPort($json);
        $json = $this->injectFilecontent($json, $basePath);
        $json = $this->base64encodedJson($json);
        $json = $this->split($json);
        $json = $this->replaceFnGetAttr($json);
        $json = $this->replaceRef($json);
        $json = $this->replaceMarkers($json);
        return $json;
    }

Usage Example

Пример #1
0
 /**
  * @param string $inputJson
  * @param string $expectedJson
  * @throws \Exception
  * @test
  * @dataProvider processJsonDataProvider
  */
 public function processJson($inputJson, $expectedJson)
 {
     $this->assertEquals($this->preprocessor->processJson($inputJson, sys_get_temp_dir()), $expectedJson);
 }