DataSift\Storyplayer\Cli\ConfigFileValidator::validate PHP Method

validate() public method

public validate ( mixed $value, Phix_Project\ValidationLib4\ValidationResult $result = null ) : Phix_Project\ValidationLib4\ValidationResult
$value mixed
$result Phix_Project\ValidationLib4\ValidationResult
return Phix_Project\ValidationLib4\ValidationResult
    public function validate($value, ValidationResult $result = null)
    {
        if ($result === null) {
            $result = new ValidationResult($value);
        }
        if (!is_file($value)) {
            $result->addError(static::MSG_NOSUCHFILE);
            return $result;
        }
        $rawJson = file_get_contents($value);
        if (!@json_decode($rawJson)) {
            $result->addError(static::MSG_NOTVALIDCONFIG);
            return $result;
        }
        return $result;
    }
ConfigFileValidator