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;
}