/** * Set the namespace directory. * * @param Directory|string $dir The namespace directory. * * @throws CarbonException Throws if the directory is invalid. */ public function setDirectory($dir) { // Parse the directory if (($dir = DirectoryHelper::asDirectory($dir, null)) === null) { throw new CarbonException("Failed to set the directory of the file loader, the directory is invalid."); } // Set the directory instance $this->dir = $dir; }
/** * Set the directory to scan * * @param Directory|string $dir Directory instance or a directory path as string. * * @return bool True on success, false on failure. */ public function setDirectory($dir) { // Convert $dir into a Directory instance, return false on failure if (($dir = DirectoryHelper::asDirectory($dir)) === null) { return false; } // Set the directory $this->dir = $dir; // Set the directory in the directory handler if it's initialized, return the result if ($this->handler !== null) { return $this->handler->setDirectory($dir); } return true; }
/** * Check whether the directory is valid. The directory doesn't need to exist. * The directory may not be an existing file or symbolic link. * * @return bool True if the directory seems to be valid, false otherwise. */ public function isValid() { return DirectoryHelper::isValid($this); }