Example #1
0
 function next()
 {
     $this->entry = $this->dirObject->read();
     if ($this->entry) {
         parent::__construct($this->entry);
     }
 }
Example #2
0
 /**
  * Constructs a new file from the given path.
  *
  * @param string $path The path to the file
  *
  * @throws FileNotFoundException If the given path is not a file
  *
  * @api
  */
 public function __construct($path)
 {
     if (!is_file($path)) {
         throw new FileNotFoundException($path);
     }
     parent::__construct($path);
 }
Example #3
0
 /**
  * Constructs a new file from the given path.
  *
  * @param string $path The path to the file
  */
 public function __construct($path)
 {
     if (!is_file($path)) {
         throw new \RuntimeException(sprintf('Runtime Error: File Not Found: "%s"', $path));
     }
     parent::__construct($path);
 }
Example #4
0
 /**
  * File constructor.
  *
  * @param string     $fileName
  * @param FileSystem $fileSystem
  * @param bool       $fileNameCpFs
  */
 public function __construct($fileName, FileSystem $fileSystem, $fileNameCpFs = false)
 {
     $this->fileSystem = $fileSystem;
     if (!$fileNameCpFs) {
     }
     parent::__construct($fileName);
 }
Example #5
0
 /**
  * @param	string	$filename
  * @return	void
  */
 public function __construct($filename)
 {
     if (substr($filename, 0, 1) == '~') {
         $filename = getenv('HOME') . substr($filename, 1);
     }
     parent::__construct($filename);
 }
Example #6
0
 /**
  * Constructs a new file from the given path.
  *
  * @param string  $path  The path to the file
  * @param boolean $check Whether to check the path or not
  *
  * @throws \OutOfRangeException If the given path is not a file
  */
 public function __construct($path, $check = true)
 {
     if ($check && !is_file($path)) {
         throw new \OutOfRangeException("path {$path} is not a file");
     }
     parent::__construct($path);
 }
Example #7
0
 /**
  * Constructor
  *
  * @param string $filePathname Absolute path to uploaded file on disk
  * @param string $newName      Desired file name (with extension) of uploaded file
  */
 public function __construct($filePathname, $newName = null)
 {
     $desiredName = is_null($newName) ? $filePathname : $newName;
     $this->name = pathinfo($desiredName, PATHINFO_FILENAME);
     $this->extension = strtolower(pathinfo($desiredName, PATHINFO_EXTENSION));
     parent::__construct($filePathname);
 }
Example #8
0
File: Csv.php Project: schpill/thin
 public function __construct($fileName, $delimiter = self::DEFAULT_DELIMITER, $enclosure = self::DEFAULT_ENCLOSURE, $escapedBy = "")
 {
     parent::__construct($fileName);
     $this->_escapedBy = $escapedBy;
     $this->_setDelimiter($delimiter);
     $this->_setEnclosure($enclosure);
 }
Example #9
0
 /**
  * Constructs a new file from the given path.
  * @param $path The path to the file
  * @param bool $checkPath Whether to check the path or not
  * @throws FileNotFoundException If the given path is not a file
  */
 public function __construct($path, $checkPath = true)
 {
     if ($checkPath && !is_file($path)) {
         throw new FileNotFoundException($path);
     }
     parent::__construct($path);
 }
Example #10
0
 /**
  * Constructor
  *
  * @param string $filename
  * @param string $openMode
  */
 public function __construct($filename, $openMode = 'r')
 {
     $this->_file = @fopen($filename, $openMode);
     if (!$this->_file) {
         throw new \RuntimeException("Error opening file '{$filename}', mode '{$openMode}'");
     }
     parent::__construct($filename);
 }
Example #11
0
 /**
  * Create new uploaded file
  *
  * @param  string $path         Local filesystem path to uploaded file
  * @param  string $originalName The original file name provided by the HTTP client
  *
  * @throws \InvalidArgumentException If file path is not a valid uploaded file
  */
 public function __construct($path, $originalName = null)
 {
     if (!$this->isUploadedFile($path)) {
         throw new \InvalidArgumentException('File path is not a valid uploaded file');
     }
     $this->originalName = $originalName;
     parent::__construct($path);
 }
Example #12
0
File: File.php Project: phpj/phpj
 public function __construct($file_name)
 {
     $this->fs = DefaultFileSystem::getFileSystem();
     $path = $this->fs->fromURIPath(new String($file_name));
     $this->path = $this->fs->normalize($path);
     $this->prefixLength = $this->fs->prefixLength($this->path);
     parent::__construct($this->path);
 }
Example #13
0
 public function __construct(array $uploadedFile)
 {
     parent::__construct($uploadedFile['tmp_name']);
     $this->setFilename($uploadedFile['name']);
     $this->setMimeType();
     $this->setMd5();
     $this->setExtension();
 }
Example #14
0
 /**
  * @param string $prefix prefix to uniqid()
  * @throws \pharext\Exception
  */
 public function __construct($prefix)
 {
     $temp = new Tempname($prefix);
     if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
         throw new Exception("Could not create tempdir: " . error_get_last()["message"]);
     }
     parent::__construct($temp);
 }
 public function __construct($name, $isDir, $isWritable)
 {
     parent::__construct($name);
     $this->fname = $name;
     $this->pathInfo = pathinfo($this->fname);
     $this->isDir = $isDir;
     $this->isWritable = $isWritable;
 }
 /**
  * Constructor
  *
  * @param string $file_name
  */
 public function __construct($path_name, sfFilebasePlugin $filebase)
 {
     $this->filebase = $filebase;
     // get rid of trainling slash
     parent::__construct(sfFilebasePluginUtil::unifySlashes($path_name));
     $this->setInfoClass('sfFilebasePluginFile');
     $this->setFileClass('sfFilebasePluginFileObject');
 }
Example #17
0
 public function __construct($fileName)
 {
     $prefix = self::COG_PREFIX . '://';
     if (substr($fileName, 0, strlen($prefix)) === $prefix) {
         $this->_reference = $fileName;
     }
     parent::__construct($fileName);
 }
Example #18
0
 public function __construct($filename)
 {
     parent::__construct($filename);
     if (!$this->isFile()) {
         throw new \InvalidArgumentException(sprintf('The given path %s is not a valid file', $filename));
     }
     $this->dismemberFile($filename);
 }
Example #19
0
 public function __construct($path, $uploadedName, $mimeType = null, $size = null, $error = null)
 {
     $this->uploadedName = $uploadedName;
     $this->mimeType = $mimeType ?: 'application/octet-stream';
     $this->size = $size;
     $this->error = $error ?: UPLOAD_ERR_OK;
     parent::__construct($path);
 }
Example #20
0
 /**
  * Construct.
  *
  * @param Filesystem $fileSystem
  * @param string $path
  * @param bool $checkPath
  *
  * @throws FileNotFoundException
  */
 public function __construct(Filesystem $fileSystem, $path, $checkPath = true)
 {
     if ($checkPath && !is_file($path)) {
         throw new FileNotFoundException($path);
     }
     $this->fileSystem = $fileSystem;
     parent::__construct($path);
 }
 /**
  * Create new font object
  *
  * @param string  $font     font path
  * @param integer $fontsize font fontsize
  *
  * @throws \InvalidArgumentException
  */
 public function __construct($font, $fontsize = 9)
 {
     parent::__construct($font);
     if (!$this->isFile() || !$this->isReadable()) {
         throw new \InvalidArgumentException(sprintf('Font File "%s" Is Not Readable', $font));
     }
     $this->font = (string) $font;
     $this->setFontSize($fontsize);
 }
 /**
  * Construct a new WebFileInfo object
  *
  * To be valid for reading, the file `$root_dir / $file_name` must exist.
  *
  * @param string $file_name The path of the file
  * @param string $root_dir The absolute path of the root directory
  * @param int $flags The flags (object's constants) to set for the instance, default is `STAT_DATETIME_FIELD | STAT_SIZE_FIELD`
  */
 public function __construct($file_name, $root_dir = null, $flags = 272)
 {
     $this->setFlags($flags);
     $this->setWebPath(dirname($file_name));
     if (!is_null($root_dir)) {
         $this->setRootDir($root_dir);
     }
     parent::__construct(DirectoryHelper::slashDirname($this->getRootDir()) . $file_name);
 }
Example #23
0
 /**
  * ( excerpt from http://php.net/manual/en/pharfileinfo.construct.php )
  *
  * This should not be called directly. Instead, a PharFileInfo object is
  * initialized by calling Phar::offsetGet() through array access.
  *
  * @filename   mixed   The full url to retrieve a file. If you wish to
  *                     retrieve the information for the file my/file.php
  *                     from the phar boo.phar, the entry should be
  *                     phar://boo.phar/my/file.php.
  */
 public function __construct($filename, $data)
 {
     if (!$data instanceof __SystemLib\ArchiveEntryStat) {
         throw new UnexpectedValueException("PharFileInfo can only be constructed via Phar::offsetGet()");
     }
     parent::__construct($filename);
     $this->name = $filename;
     $this->stat = $data;
 }
Example #24
0
 /**
  * Construct.
  *
  * @param   string  $filename        Filename.
  * @param   string  $relativePath    Relative path.
  * @return  void
  */
 public function __construct($filename, $relativePath = null)
 {
     parent::__construct($filename);
     if (-1 !== ($mtime = $this->getMTime())) {
         $this->_hash = md5($this->getPathname() . $mtime);
     }
     $this->_relativePath = $relativePath;
     return;
 }
Example #25
0
 /**
  * Instanciate a new file
  *
  * @param Repository $repository The Git repository hosting the file.
  * @param string $file_name Opened file full path name
  */
 public function __construct(Repository $repository, $file_name)
 {
     if ('/' != $file_name[0]) {
         $file_name = $repository->getDir() . '/' . $file_name;
     }
     parent::__construct($file_name);
     $this->repository = $repository;
     $this->setInfoClass(__CLASS__);
 }
Example #26
0
	/**
	 * Constructs the file info object and sets defaults.
	 * 
	 * @param string $file
	 * @return Interspire_FileInfo
	 */
	public function __construct($file)
	{
		// construct SplFileInfo to set defaults
		parent::__construct($file);

		// set classes to use
		$this->setFileClass('Interspire_File');
		$this->setFileInfoClass('Interspire_FileInfo');
	}
Example #27
0
 /**
  * Constructor
  * @param string $fileName Path to the file
  */
 public function __construct($fileName = '')
 {
     $this->name = $fileName;
     $this->uploadPath = FILE . 'tmp' . _DS_;
     $this->defaultImageFilterSet();
     if ($fileName) {
         parent::__construct($fileName);
     }
 }
Example #28
0
 public function __construct($filename)
 {
     parent::__construct($filename);
     if (!$this->isDir()) {
         throw new Exception\DirectoryNotFoundException();
     }
     $this->setFileClass('Stalxed\\FileSystem\\FileObject');
     $this->setInfoClass('Stalxed\\FileSystem\\FileInfo');
 }
Example #29
0
 function __construct($path = '', $status = null, $originalName = null)
 {
     if (!file_exists($path)) {
         //throw new FileDoesNotExistException($path);
     } else {
         parent::__construct($path);
     }
     $this->status = $status;
     $this->originalName = $originalName;
 }
Example #30
0
 /**
  * Open file for reading, and if it doesn't exist create it.
  *
  * @param string|\SplFileInfo $file
  *
  * @throws \InvalidArgumentException if an invalid type was passed
  */
 public function __construct($file)
 {
     if ($file instanceof \SplFileInfo) {
         $file = $file->getPathname();
     }
     if (!is_string($file)) {
         throw new \InvalidArgumentException('Expected filename or object of type SplFileInfo but received' . get_class($file));
     }
     parent::__construct($file);
 }