src/Listeners/Renderer/Validations/JsonFileRenderer.php
/**
     * Renders the validations to some output, in that case as table to the console.
     *
     * @param array $validations The validations to render
     *
     * @return void
     */
Renders the validations to some output, in that case as table to the console.
@param array $validations The validations to render

@return void
Renders the validations to some output in that case as table to the console . @param array $validations The validations to render @return void
public function render(array $validations = array())
    {
        if (sizeof($validations) === 0) {
            return;
        }
        $registryProcessor = $this->getRegistryProcessor();
        $status = $registryProcessor->getAttribute(RegistryKeys::STATUS);
        if (isset($status[RegistryKeys::TARGET_DIRECTORY])) {
            $filename = implode(DIRECTORY_SEPARATOR, array($status[RegistryKeys::TARGET_DIRECTORY], 'validations.json'));
            file_put_contents($filename, json_encode($validations, JSON_PRETTY_PRINT));
            $registryProcessor->mergeAttributesRecursive(RegistryKeys::STATUS, array(RegistryKeys::FILES => array($filename => array())));
        }
    }
public function render ( array $ validations = array ( ) ) { if ( sizeof ( $ validations ) === 0 ) { return ; } $ registryProcessor = $ this -> getRegistryProcessor ( ) ; $ status = $ registryProcessor -> getAttribute ( RegistryKeys :: STATUS ) ; if ( isset ( $ status [ RegistryKeys :: TARGET_DIRECTORY ] ) ) { $ filename = implode ( DIRECTORY_SEPARATOR , array ( $ status [ RegistryKeys :: TARGET_DIRECTORY ] , 'validations.json' ) ) ; file_put_contents ( $ filename , json_encode ( $ validations , JSON_PRETTY_PRINT ) ) ; $ registryProcessor -> mergeAttributesRecursive ( RegistryKeys :: STATUS , array ( RegistryKeys :: FILES => array ( $ filename => array ( ) ) ) ) ; } }
Renders the validations to some output, in that case as table to the console.
Renders the validations to some output in that case as table to the console .
// do nothing, if no validation error messages are available // load the registry processor // try to load the status // query whether or not a target directory is available // prepare the filename to save the validation messsages to // create the files inside the target directory // register the file as artefact in the registry