/** * * @param mixed $value * @param ValidationResult $result * @return 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; }
/** * * @param mixed $value * @param ValidationResult $result * @return ValidationResult */ public function validate($value, ValidationResult $result = null) { if ($result === null) { $result = new ValidationResult($value); } // the $value must be one that we support $value = strtolower($value); if (!isset($this->supportedValues[$value])) { $result->addError(static::MSG_UNKNOWNCOLORLEVEL); return $result; } return $result; }
/** * * @param mixed $value * @param ValidationResult $result * @return ValidationResult */ public function validate($value, ValidationResult $result = null) { if ($result === null) { $result = new ValidationResult($value); } // strip off .json if it is there $value = basename($value, ".json"); // the $value must be a valid system-under-test name if (!$this->sutList->hasEntry($value)) { $result->addError(static::MSG_NOTVALIDSUT); return $result; } return $result; }
/** * * @param mixed $value * @param ValidationResult $result * @return ValidationResult */ public function validate($value, ValidationResult $result = null) { if ($result === null) { $result = new ValidationResult($value); } // strip off .json if it is there // // this helps if the user has copy and pasted the filename $value = basename($value, '.json'); // 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->envList->hasEntry($value)) { $result->addError(static::MSG_NOTVALIDENVIRONMENT); return $result; } return $result; }
/** * * @param mixed $value * @param ValidationResult $result * @return 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; }
public function validate($value, ValidationResult $result = null) { if ($result === null) { $result = new ValidationResult($value); } // we need a valid PHP class if (!class_exists($value)) { $result->addError(static::MSG_NOTVALIDCLASS); return $result; } // the class must be a StoryTemplate $refClass = new ReflectionClass($value); if (!$refClass->isSubclassOf('DataSift\\Storyplayer\\PlayerLib\\StoryTemplate')) { $result->addError(static::MSG_NOTVALIDTEMPLATE); return $result; } // all done return $result; }