Example #1
0
 /**
  * {@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;
 }
Example #2
0
 /**
  * {@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;
 }