/** * {@inheritdoc} */ public function validate() { $classname = Cname::toString($this->value); if (preg_match(self::REGEX, $classname) === 1) { $this->value = $classname; return true; } return false; }
protected function getClassFromFile(\SplFileInfo $file) : string { if (!$file->isFile()) { return ""; } $file = new \sndsgd\fs\entity\FileEntity($file); $extension = $file->getExtension(); if (strtolower($extension) !== "php") { return ""; } $contents = $file->read(); if ($contents === false) { throw new \RuntimeException($file->getError()); } return \sndsgd\Classname::fromContents($contents); }