MediaSearch_File
[ class tree: MediaSearch_File ] [ index: MediaSearch_File ] [ all elements ]

Source for file Abstract.php

Documentation is available at Abstract.php

  1. <?php
  2. /**
  3.  * MediaSearch
  4.  *
  5.  * LICENSE
  6.  *
  7.  * "THE BEER-WARE LICENSE" (Revision 42):
  8.  * "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
  9.  * As long as you retain this notice you can do whatever you want with
  10.  * this stuff. If we meet some day, and you think this stuff is worth it,
  11.  * you can buy me a beer in return.
  12.  *
  13.  * $Author$
  14.  * $Revision$
  15.  *
  16.  * @category    MediaSearch
  17.  * @package     MediaSearch_File
  18.  * @copyright   Copyright (c) 2009 Sven Strittmatter
  19.  */
  20.  
  21. /**
  22.  * @see MediaSearch_Interface_Visitable
  23.  */
  24. require_once('MediaSearch/Interface/Visitable.php');
  25.  
  26. /**
  27.   * An abstract file implemetnation. Thats part of tee composite pattern
  28.  * (see GoF for more information) used to build a file tree.
  29.   *
  30.   * @category   MediaSearch
  31.   * @package    MediaSearch_File
  32.   * @copyright  Copyright (c) 2009 Sven Strittmatter
  33.   */
  34. abstract class MediaSearch_File_Abstract implements MediaSearch_Interface_Visitable {
  35.     const TRACE_LELVEL 22;
  36.  
  37.     /**
  38.      * Holds the SplFileInfo object.
  39.      *
  40.      * @access protected
  41.      * @var SplFileInfo 
  42.      */
  43.     protected $fileInfo;
  44.  
  45.     /**
  46.      * Requires a filename as string or an SplFileInfo object of a file.
  47.      * If a string as parameter is passed a SplFileInfo object will be
  48.      * genarated automaticly.
  49.      *
  50.      * @access public
  51.      * @throws InvalidArgumentException If neither a filename string or a SplFileInfo is provided.
  52.      * @param mixed $fileInfo SplFileInfo or string
  53.      */
  54.     public function __construct($fileInfo{
  55.         if (is_string($fileInfo&& is_file($fileInfo)) {
  56.             $this->fileInfo = new SplFileInfo($fileInfo);
  57.         else if ($fileInfo instanceof SplFileInfo{
  58.                 $this->fileInfo = $fileInfo;
  59.         else {
  60.             $message  'This class needs either a filepath string or a ';
  61.             $message .= 'SplFileInfo instance as constructor paremetr!';
  62.             throw new InvalidArgumentException($message);
  63.         }
  64.     }
  65. }

Documentation generated on Mon, 17 Aug 2009 14:51:13 +0200 by phpDocumentor 1.4.2