/** * Construct a directory adapter. If the $path isn't a directory, and * exception will be thrown. * * @param string $path * @throws FinderException */ public function __construct($path) { $fileInfo = new SplFileInfo($path); if (!$fileInfo->isDir()) { throw new FinderException("{$path} is not a directory."); } parent::__construct($fileInfo->getRealPath()); }
/** * Construct a phar data adapter. If the path isn't a file or if the path * isn't a file that phardata understands, an exception will be thrown. * * @param string $path * @throws FinderException if $path is not a file * @throws UnexpectedValueException if $path isn't a phardata file. */ public function __construct($path) { $fileInfo = new SplFileInfo($path); if (!$fileInfo->isFile()) { throw new FinderException("{$path} is not a file."); } parent::__construct(self::PHAR_PREFIX . $fileInfo->getRealPath()); }