DataSift\Storyplayer\Cli\Feature_DeviceValidator::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);
        }
        // the $value must be a valid environment name, but it's ok if it doesn't
        // exist if it's the default env as we might not have created it yet
        if (!$this->deviceList->hasEntry($value)) {
            $result->addError(static::MSG_NOTVALIDDEVICE);
            return $result;
        }
        return $result;
    }
Feature_DeviceValidator