/** * {@inheritdoc} */ public function validate(&$value, \sndsgd\form\Validator $validator = null) : bool { if ($value instanceof \sndsgd\fs\entity\EntityInterface) { $file = $value; } else { $file = \sndsgd\fs::file($value); } if (!$file->test($this->tests)) { return false; } $value = $file; return true; }
/** * {@inheritdoc} */ public function validate(&$value, \sndsgd\form\Validator $validator = null) : bool { if ($value instanceof \sndsgd\fs\entity\EntityInterface) { $file = $value; } else { $file = \sndsgd\fs::file($value); } foreach ($this->parentPaths as $parent) { if (strpos($file, $parent) === 0) { return true; } } return false; }