Changeset 313 for trunk/classes

Show
Ignore:
Timestamp:
11/17/07 04:20:58 (1 year ago)
Author:
hans
Message:

General cleanup tasks.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/classes/phing/system/io/File.php

    r312 r313  
    3131class File { 
    3232 
    33     /** separator string, static, obtained from FileSystem */ 
     33    /** 
     34     * Separator string, static, obtained from FileSystem. 
     35     * @see FileSystem::getSeparator() 
     36         */ 
    3437    public static $separator; 
    3538 
    36     /** path separator string, static, obtained from FileSystem (; or :)*/ 
     39    /** 
     40         * Path separator string, static, obtained from FileSystem (; or :) 
     41         * @see FileSystem::getSeparator() 
     42         */ 
    3743    public static $pathSeparator; 
    3844     
     
    4147     * pathname string uses the default name-separator character and does not 
    4248     * contain any duplicate or redundant separators. 
    43      */ 
    44     private $path = null; 
    45  
    46     /** The length of this abstract pathname's prefix, or zero if it has no prefix. */ 
     49     * @var string 
     50     */ 
     51    private $path; 
     52 
     53    /** 
     54         * The length of this abstract pathname's prefix, or zero if it has no prefix. 
     55         * @var int 
     56         */ 
    4757    private $prefixLength = 0; 
    4858 
    4959    /** 
    5060     * Create a new File object. 
    51      * Valid constructor signatures include: 
    52      *  File(File parent, string filename) 
    53      *  File(string filename) 
    54      *  File(string parent, string filename) 
    55          */ 
    56     function __construct($arg1 = null, $arg2 = null) { 
     61     *  
     62     * This method supports sevarl valid signatures: 
     63     *  new File(File parent, string filename) 
     64     *  new File(string filename) 
     65     *  new File(string parent, string filename) 
     66         */ 
     67    function __construct($arg1, $arg2 = null) { 
    5768         
    5869        if (self::$separator === null || self::$pathSeparator === null) { 
     
    6273        } 
    6374 
    64         /* simulate signature identified constructors */ 
     75        /* simulate constructor overloading */ 
    6576        if ($arg1 instanceof File && is_string($arg2)) { 
    66             $this->_constructFileParentStringChild($arg1, $arg2); 
     77            $this->__constructFileParentStringChild($arg1, $arg2); 
    6778        } elseif (is_string($arg1) && ($arg2 === null)) { 
    68             $this->_constructPathname($arg1); 
     79            $this->__constructPathname($arg1); 
    6980        } elseif(is_string($arg1) && is_string($arg2)) { 
    70             $this->_constructStringParentStringChild($arg1, $arg2); 
     81            $this->__constructStringParentStringChild($arg1, $arg2); 
    7182        } else { 
    7283            if ($arg1 === null) { 
     
    7788        } 
    7889    } 
    79  
    80     /** Returns the length of this abstract pathname's prefix. */ 
    81     function getPrefixLength() { 
    82         return (int) $this->prefixLength; 
    83     } 
    8490     
    85     /* -- constructors not called by signature match, so we need some helpers --*/ 
    86  
    87     function _constructPathname($pathname) { 
     91    /** 
     92         * Private overloaded constructor when passed a File parent path and string child path. 
     93         * @param File $parent The parent path 
     94         * @param string $child (optional) The child path 
     95         */ 
     96    private function __constructFileParentStringChild(File $parent, $child) { 
     97        // obtain ref to the filesystem layer 
     98        $fs = FileSystem::getFileSystem(); 
     99 
     100        if ($child === null) { 
     101            throw new NullPointerException("Argument to function must not be null"); 
     102        } 
     103 
     104        if ($parent !== null) { 
     105            if ($parent->getPath() === "") { 
     106                $this->path = $fs->resolve($fs->getDefaultParent(), $fs->normalize($child)); 
     107            } else { 
     108                $this->path = $fs->resolve($parent->getPath(), $fs->normalize($child)); 
     109            } 
     110        } else { 
     111            $this->path = $fs->normalize($child); 
     112        } 
     113        $this->prefixLength = $fs->prefixLength($this->path); 
     114    } 
     115     
     116        /** 
     117         * Private constructor when passed a single path string. 
     118         * 
     119         * @param string $pathname 
     120         */ 
     121    private function __constructPathname($pathname) { 
    88122        // obtain ref to the filesystem layer 
    89123        $fs = FileSystem::getFileSystem(); 
     
    96130        $this->prefixLength = (int) $fs->prefixLength($this->path); 
    97131    } 
    98  
    99     function _constructStringParentStringChild($parent, $child = null) { 
     132         
     133    /** 
     134         * Private overloaded constructor when passed a string parent path and child paths. 
     135         * @param string $parent The parent path 
     136         * @param string $child (optional) The child path 
     137         */ 
     138    private function __constructStringParentStringChild($parent, $child) { 
    100139        // obtain ref to the filesystem layer 
    101140        $fs = FileSystem::getFileSystem(); 
     
    115154        $this->prefixLength = (int) $fs->prefixLength($this->path); 
    116155    } 
    117  
    118     function _constructFileParentStringChild($parent, $child = null) { 
    119         // obtain ref to the filesystem layer 
    120         $fs = FileSystem::getFileSystem(); 
    121  
    122         if ($child === null) { 
    123             throw new NullPointerException("Argument to function must not be null"); 
    124         } 
    125  
    126         if ($parent !== null) { 
    127             if ($parent->path === "") { 
    128                 $this->path = $fs->resolve($fs->getDefaultParent(), $fs->normalize($child)); 
    129             } else { 
    130                 $this->path = $fs->resolve($parent->path, $fs->normalize($child)); 
    131             } 
    132         } else { 
    133             $this->path = $fs->normalize($child); 
    134         } 
    135         $this->prefixLength = $fs->prefixLength($this->path); 
     156         
     157    /** 
     158         * Returns the length of this abstract pathname's prefix. 
     159         * @return int 
     160         */ 
     161    function getPrefixLength() { 
     162        return (int) $this->prefixLength; 
    136163    } 
    137164 
     
    144171     * string is returned. 
    145172     * 
    146      * @return  The name of the file or directory denoted by this abstract 
    147      *          pathname, or the empty string if this pathname's name sequence 
    148      *          is empty 
    149      */ 
    150     function getName() { 
     173     * @return string The name of the file or directory. 
     174     */ 
     175    public function getName() { 
    151176        // that's a lastIndexOf 
    152177        $index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res); 
     
    166191     * directory. 
    167192     * 
    168      * @return  The pathname string of the parent directory named by this 
    169      *          abstract pathname, or null if this pathname does not name a parent 
    170      */ 
    171     function getParent() { 
     193     * @return string The pathname string of the parent directory. 
     194     */ 
     195    public function getParent() { 
    172196        // that's a lastIndexOf 
    173197        $index = ((($res = strrpos($this->path, self::$separator)) === false) ? -1 : $res); 
     
    182206 
    183207    /** 
    184      * Returns the abstract pathname of this abstract pathname's parent, 
    185      * or null if this pathname does not name a parent directory. 
    186      * 
    187      * The parent of an abstract pathname consists of the pathname's prefix, 
    188      * if any, and each name in the pathname's name sequence except for the 
    189      * last.  If the name sequence is empty then the pathname does not name 
    190      * a parent directory. 
    191      * 
    192      * @return  The abstract pathname of the parent directory named by this 
    193      *          abstract pathname, or null if this pathname 
    194      *          does not name a parent 
    195      */ 
    196     function getParentFile() { 
     208     * Returns the parent directory as File object. 
     209     * 
     210     * @return File A File of the parent directory for this file.  
     211     */ 
     212    public function getParentFile() { 
    197213        $p = $this->getParent(); 
    198214        if ($p === null) { 
     
    207223     * in the name sequence. 
    208224     * 
    209      * @return The string form of this abstract pathname 
    210      */ 
    211     function getPath() { 
     225     * @return string The string form of this abstract pathname 
     226     */ 
     227    public function getPath() { 
    212228        return (string) $this->path; 
    213229    } 
     
    220236     * is "\\". 
    221237     * 
    222      * @return true if this abstract pathname is absolute, false otherwise 
    223      */ 
    224     function isAbsolute() { 
     238     * @return boolean true if this abstract pathname is absolute, false otherwise 
     239     */ 
     240    public function isAbsolute() { 
    225241        return ($this->prefixLength !== 0); 
    226242    } 
    227  
    228243 
    229244    /** 
     
    242257     * directory. 
    243258     * 
    244      * @return  The absolute pathname string denoting the same file or 
    245      *          directory as this abstract pathname 
    246      * @see     #isAbsolute() 
    247      */ 
    248     function getAbsolutePath() { 
     259     * @return  string The absolute pathname of this file/directory. 
     260     * @see     isAbsolute() 
     261     */ 
     262    public function getAbsolutePath() { 
    249263        $fs = FileSystem::getFileSystem();         
    250264        return $fs->resolveFile($this); 
     
    252266 
    253267    /** 
    254      * Returns the absolute form of this abstract pathname.  Equivalent to 
    255      * getAbsolutePath. 
    256      * 
    257      * @return  The absolute abstract pathname denoting the same file or 
    258      *          directory as this abstract pathname 
    259      */ 
    260     function getAbsoluteFile() { 
     268     * Returns a File object containing abs path to this file/dir. 
     269     * 
     270     * @see getAbsolutePath() 
     271     * @return File A File object containing the absolute path to this file/dir. 
     272     */ 
     273    public function getAbsoluteFile() { 
    261274        return new File((string) $this->getAbsolutePath()); 
    262275    } 
    263  
    264276 
    265277    /** 
     
    284296     * pathname after the file or directory is deleted. 
    285297     * 
    286      * @return  The canonical pathname string denoting the same file or 
    287      *          directory as this abstract pathname 
    288      */ 
    289     function getCanonicalPath() { 
     298     * @return string The canonical path to this file/dir. 
     299     */ 
     300    public function getCanonicalPath() { 
    290301        $fs = FileSystem::getFileSystem(); 
    291302        return $fs->canonicalize($this->path); 
    292303    } 
    293304 
    294  
    295     /** 
    296      * Returns the canonical form of this abstract pathname.  Equivalent to 
    297      * getCanonicalPath(. 
    298      * 
    299      * @return  File The canonical pathname string denoting the same file or 
    300      *          directory as this abstract pathname 
    301      */ 
    302     function getCanonicalFile() { 
     305    /** 
     306     * Returns the canonical form of this abstract pathname. 
     307     * 
     308     * @see getCanonicalPath() 
     309     * @return File The canonical File to tihs file/dir. 
     310     */ 
     311    public function getCanonicalFile() { 
    303312        return new File($this->getCanonicalPath()); 
    304313    } 
    305  
    306     /** 
    307      * Converts this abstract pathname into a file: URL.  The 
    308      * exact form of the URL is system-dependent.  If it can be determined that 
    309      * the file denoted by this abstract pathname is a directory, then the 
    310      * resulting URL will end with a slash. 
    311      * 
    312      * Usage note: This method does not automatically escape 
    313      * characters that are illegal in URLs.  It is recommended that new code 
    314      * convert an abstract pathname into a URL by first converting it into a 
    315      * URI, via the toURI() method, and then converting the URI 
    316      * into a URL via the URI::toURL() 
    317      * 
    318      * @return  A URL object representing the equivalent file URL 
    319      * 
    320      * 
    321      */ 
    322     function toURL() { 
    323         /* 
    324         // URL class not implemented yet 
    325         return new URL("file", "", $this->_slashify($this->getAbsolutePath(), $this->isDirectory())); 
    326         */ 
    327     } 
    328  
    329     /** 
    330      * Constructs a file: URI that represents this abstract pathname. 
    331      * Not implemented yet 
    332      */ 
    333     function toURI() { 
    334         /* 
    335         $f = $this->getAbsoluteFile(); 
    336            $sp = (string) $this->slashify($f->getPath(), $f->isDirectory()); 
    337            if (StringHelper::startsWith('//', $sp)) 
    338         $sp = '//' + sp; 
    339            return new URI('file', null, $sp, null); 
    340         */ 
    341     } 
    342  
    343     function _slashify($path, $isDirectory) { 
     314         
     315    /** 
     316     * Normalizes the directory separators in the path and adds a trailing '/' to directories. 
     317     * 
     318     * @param string $path 
     319     * @param boolean $isDirectory 
     320     * @return string 
     321     */ 
     322    private function _slashify($path, $isDirectory) { 
    344323        $p = (string) $path; 
    345324 
     
    365344     * abstract pathname. 
    366345     * 
    367      * @return  true if and only if the file specified by this 
    368      *          abstract pathname exists and can be read by the 
    369      *          application; false otherwise 
    370      */ 
    371     function canRead() { 
     346     * @return boolean Whether file/dir can be read by application. 
     347     */ 
     348    public function canRead() { 
    372349        $fs = FileSystem::getFileSystem(); 
    373350 
     
    382359     * abstract pathname. 
    383360     * 
    384      * @return  true if and only if the file system actually 
    385      *          contains a file denoted by this abstract pathname and 
    386      *          the application is allowed to write to the file; 
    387      *          false otherwise. 
    388      * 
    389      */ 
    390     function canWrite() { 
     361     * @return boolean Whether file/dir can be written to. 
     362     * 
     363     */ 
     364    public function canWrite() { 
    391365        $fs = FileSystem::getFileSystem(); 
    392366        return $fs->checkAccess($this, true); 
     
    396370     * Tests whether the file denoted by this abstract pathname exists. 
    397371     * 
    398      * @return  true if and only if the file denoted by this 
    399      *          abstract pathname exists; false otherwise 
    400      * 
    401      */ 
    402     function exists() {                 
     372     * @return boolean Whether file/dir exists. 
     373     */ 
     374    public function exists() {                 
    403375                clearstatcache(); 
    404376        if ($this->isFile()) { 
     
    410382 
    411383    /** 
    412      * Tests whether the file denoted by this abstract pathname is a 
    413      * directory. 
    414      * 
    415      * @return true if and only if the file denoted by this 
    416      *         abstract pathname exists and is a directory; 
    417      *         false otherwise 
    418      * 
    419      */ 
    420     function isDirectory() { 
     384     * Tests whether the path represented by this object corresponds to a directory. 
     385     * 
     386     * @return boolean Whether path represented is a directory. 
     387     */ 
     388    public function isDirectory() { 
    421389                clearstatcache(); 
    422390        $fs = FileSystem::getFileSystem(); 
     
    428396 
    429397    /** 
    430      * Tests whether the file denoted by this abstract pathname is a normal 
    431      * file.  A file is normal if it is not a directory and, in 
    432      * addition, satisfies other system-dependent criteria.  Any non-directory 
    433      * file created by a Java application is guaranteed to be a normal file. 
    434      * 
    435      * @return  true if and only if the file denoted by this 
    436      *          abstract pathname exists and is a normal file; 
    437      *          false otherwise 
    438      */ 
    439     function isFile() { 
     398     * Tests whether the path represented by this object corresponds to a normal file. 
     399     *  
     400     * @return boolean Whether path represents a file. 
     401     */ 
     402    public function isFile() { 
    440403                clearstatcache(); 
    441404        //$fs = FileSystem::getFileSystem(); 
     
    444407 
    445408    /** 
    446      * Tests whether the file named by this abstract pathname is a hidden 
    447      * file.  The exact definition of hidden is system-dependent.  On 
    448      * UNIX systems, a file is considered to be hidden if its name begins with 
    449      * a period character ('.').  On Win32 systems, a file is considered to be 
    450      * hidden if it has been marked as such in the filesystem. Currently there 
    451      * seems to be no way to dermine isHidden on Win file systems via PHP 
    452      * 
    453      * @return  true if and only if the file denoted by this 
    454      *          abstract pathname is hidden according to the conventions of the 
    455      *          underlying platform 
    456      */ 
    457     function isHidden() { 
     409     * Tests whether the path represented by this object is a hidden file. 
     410     *   
     411     * @return boolean Whether file/dir is hidden. 
     412     */ 
     413    public function isHidden() { 
    458414        $fs = FileSystem::getFileSystem(); 
    459415        if ($fs->checkAccess($this) !== true) { 
     
    467423     * last modified. 
    468424     * 
    469      * @return A integer value representing the time the file was 
     425     * @return int A integer value representing the time the file was 
    470426     *          last modified, measured in milliseconds since the epoch 
    471427     *          (00:00:00 GMT, January 1, 1970), or 0 if the 
    472428     *          file does not exist or if an I/O error occurs 
    473429     */ 
    474     function lastModified() { 
     430    public function lastModified() { 
    475431        $fs = FileSystem::getFileSystem(); 
    476432        if ($fs->checkAccess($this) !== true) { 
     
    484440     * The return value is unspecified if this pathname denotes a directory. 
    485441     * 
    486      * @return  The length, in bytes, of the file denoted by this abstract 
    487      *          pathname, or 0 if the file does not exist 
    488      */ 
    489     function length() { 
     442     * @return int The length, in bytes, of the file denoted by this abstract 
     443     *                  pathname, or 0 if the file does not exist 
     444     * @throws IOException - if file cannot be read 
     445     */ 
     446    public function length() { 
    490447        $fs = FileSystem::getFileSystem(); 
    491448        if ($fs->checkAccess($this) !== true) { 
     
    499456     * This method uses file_get_contents() to read file in an optimized way. 
    500457     * @return string 
    501      * @throws Exception - if file cannot be read 
    502      */ 
    503     function contents() { 
     458     * @throws IOException - if file cannot be read 
     459     */ 
     460    public function contents() { 
    504461        if (!$this->canRead() || !$this->isFile()) { 
    505462            throw new IOException("Cannot read file contents!"); 
     
    522479     * @throws IOException if file can't be created 
    523480     */ 
    524     function createNewFile($parents=true, $mode=0777) { 
     481    public function createNewFile($parents=true, $mode=0777) { 
    525482        $file = FileSystem::getFileSystem()->createNewFile($this->path); 
    526483        return $file; 
     
    535492     *          successfully deleted; false otherwise 
    536493     */ 
    537     function delete() { 
     494    public function delete() { 
    538495        $fs = FileSystem::getFileSystem(); 
    539496        if ($fs->canDelete($this) !== true) { 
     
    553510     * 
    554511     */ 
    555     function deleteOnExit() { 
     512    public function deleteOnExit() { 
    556513        $fs = FileSystem::getFileSystem(); 
    557514        $fs->deleteOnExit($this); 
     
    559516 
    560517    /** 
    561      * Returns an array of strings naming the files and directories in the 
    562      * directory denoted by this abstract pathname. 
     518     * Return an array of names for contents of directory represented by this object. 
    563519     * 
    564520     * If this abstract pathname does not denote a directory, then this 
    565      * method returns null  Otherwise an array of strings is 
    566      * returned, one for each file or directory in the directory.  Names 
    567      * denoting the directory itself and the directory's parent directory are 
    568      * not included in the result.  Each string is a file name rather than a 
    569      * complete path. 
    570      * 
    571      * There is no guarantee that the name strings in the resulting array 
    572      * will appear in any specific order; they are not, in particular, 
    573      * guaranteed to appear in alphabetical order. 
    574      * 
    575      * @return  An array of strings naming the files and directories in the 
    576      *          directory denoted by this abstract pathname.  The array will be 
    577      *          empty if the directory is empty.  Returns null if 
    578      *          this abstract pathname does not denote a directory, or if an 
    579      *          I/O error occurs. 
    580      * 
    581      */ 
    582     function listDir($filter = null) { 
     521     * method returns null. 
     522     *  
     523     * @return array string[] An array of file and directory names  
     524     */ 
     525    public function listDir($filter = null) { 
    583526        $fs = FileSystem::getFileSystem(); 
    584527        return $fs->lister($this, $filter); 
    585528    } 
    586  
    587     function listFiles($filter = null) { 
     529         
     530    /** 
     531     * Return an array of File objects for contents of directory represented by this object. 
     532     * 
     533     * @param unknown_type $filter 
     534     * @return array File[] 
     535     */ 
     536    public function listFiles($filter = null) { 
    588537        $ss = $this->listDir($filter); 
    589538        if ($ss === null) { 
     
    609558     * @throws  IOException 
    610559     */ 
    611     function mkdirs() { 
     560    public function mkdirs() { 
    612561        if ($this->exists()) { 
    613562            return false; 
     
    628577     * 
    629578     * @return  true if and only if the directory was created; false otherwise 
    630      * @throws  IOException 
    631      */ 
    632     function mkdir() { 
     579     * @throws  IOException - If no write access 
     580     */ 
     581    public function mkdir() { 
    633582        $fs = FileSystem::getFileSystem(); 
    634583 
     
    645594     * @return  true if and only if the renaming succeeded; false otherwise 
    646595     */ 
    647     function renameTo(File $destFile) { 
     596    public function renameTo(File $destFile) { 
    648597        $fs = FileSystem::getFileSystem(); 
    649598        if ($fs->checkAccess($this) !== true) { 
     
    660609     * @return true if and only if the renaming succeeded; false otherwise 
    661610     */ 
    662     function copyTo(File $destFile) { 
     611    public function copyTo(File $destFile) { 
    663612        $fs = FileSystem::getFileSystem(); 
    664613 
     
    684633     * that was passed to this method. 
    685634     * 
    686      * @param  time  The new last-modified time, measured in milliseconds since 
     635     * @param  int $time  The new last-modified time, measured in milliseconds since 
    687636     *               the epoch (00:00:00 GMT, January 1, 1970) 
    688      * @return true if and only if the operation succeeded; false otherwise 
    689      */ 
    690     function setLastModified($time) { 
     637     * @return boolean Whether operation succeeded 
     638     */ 
     639    public function setLastModified($time) { 
    691640        $time = (int) $time; 
    692641        if ($time < 0) { 
     
    704653    /** 
    705654     * Marks the file or directory named by this abstract pathname so that 
    706      * only read operations are allowed.  After invoking this method the file 
    707      * or directory is guaranteed not to change until it is either deleted or 
    708      * marked to allow write access.  Whether or not a read-only file or 
    709      * directory may be deleted depends upon the underlying system. 
    710      * 
    711      * @return true if and only if the operation succeeded; false otherwise 
    712      */ 
    713     function setReadOnly() { 
     655     * only read operations are allowed. 
     656     *  
     657     * @return boolean Whether operation succeeded 
     658     */ 
     659    public function setReadOnly() { 
    714660        $fs = FileSystem::getFileSystem(); 
    715661        if ($fs->checkAccess($this, true) !== true) { 
     
    724670     * @param int $mode Ocatal mode. 
    725671     */ 
    726     function setMode($mode) { 
     672    public function setMode($mode) { 
    727673        $fs = FileSystem::getFileSystem(); 
    728674        return $fs->chmod($this->getPath(), $mode); 
     
    733679     * @return int 
    734680     */ 
    735     function getMode() { 
     681    public function getMode() { 
    736682        return @fileperms($this->getPath()); 
    737683    } 
     
    767713     * objects containing UNC pathnames will not be returned by this method. 
    768714     * 
    769      * @return  An array of File objects denoting the available 
     715     * @return  array File[] An array of File objects denoting the available 
    770716     *          filesystem roots, or null if the set of roots 
    771717     *          could not be determined.  The array will be empty if there are 
    772718     *          no filesystem roots. 
    773719     */ 
    774     function listRoots() { 
     720    public function listRoots() { 
    775721        $fs = FileSystem::getFileSystem(); 
    776722        return (array) $fs->listRoots(); 
     
    781727    /** 
    782728     * Returns the path to the temp directory. 
    783      */ 
    784     function getTempDir() { 
     729     * @return string 
     730     */ 
     731    public function getTempDir() { 
    785732        return Phing::getProperty('php.tmpdir'); 
    786733    } 
     
    792739     * Then, the file is locked for exclusive reading/writing. 
    793740     * 
    794      * @author      manuel holtgrewe, grin@gmx.net 
    795      * @throws      IOException 
    796      * @access      public 
    797      */ 
    798     function createTempFile($prefix, $suffix, File $directory) { 
     741     * @throws IOException 
     742     */ 
     743    public static function createTempFile($prefix, $suffix, File $directory) { 
    799744         
    800745        // quick but efficient hack to create a unique filename ;-) 
     
    817762     * @access      public 
    818763     */ 
    819     function removeTempFile() { 
     764    public function removeTempFile() { 
    820765        $fs = FileSystem::getFileSystem(); 
    821766        // catch IO Exception 
     
    841786     *        greater than the argument 
    842787     */ 
    843     function compareTo(File $file) { 
     788    public function compareTo(File $file) { 
    844789        $fs = FileSystem::getFileSystem(); 
    845790        return $fs->compare($this, $file); 
     
    847792 
    848793    /** 
    849      * Tests this abstract pathname for equality with the given object. 
    850      * Returns <code>true</code> if and only if the argument is not 
    851      * <code>null</code> and is an abstract pathname that denotes the same file 
    852      * or directory as this abstract pathname.  Whether or not two abstract 
    853      * pathnames are equal depends upon the underlying system.  On UNIX 
    854      * systems, alphabetic case is significant in comparing pathnames; on Win32 
    855      * systems it is not. 
     794     * Tests to see whether two File objects are equal. 
    856795     * @return boolean 
    857796     */ 
    858     function equals($obj) { 
     797    public function equals($obj) { 
    859798        if (($obj !== null) && ($obj instanceof File)) { 
    860799            return ($this->compareTo($obj) === 0); 
     
    863802    } 
    864803 
    865     /** Backwards compatibility -- use PHP5's native __tostring method. */ 
    866     function toString() { 
     804    /** 
     805         * Backwards compatibility -- use PHP5's native __tostring method. 
     806         * @deprecated 
     807         */ 
     808    public function toString() { 
    867809        return $this->getPath(); 
    868810    } 
    869811     
    870     /** PHP5's native method. */ 
    871     function __toString() { 
     812    /** 
     813         * PHP5's semi-magic __toString() method. 
     814         * @return string  
     815         */ 
     816    public function __toString() { 
    872817        return $this->getPath(); 
    873818    } 
    874819} 
    875 ?> 
  • trunk/classes/phing/system/io/FileSystem.php

    r309 r313  
    5151    const BA_HIDDEN    = 0x08; 
    5252     
    53     /** Instance for getFileSystem() method. */ 
     53    /** 
     54     * Singleton instance for getFileSystem() method. 
     55     * @var FileSystem 
     56     */ 
    5457    private static $fs; 
    5558     
     
    6366            switch(Phing::getProperty('host.fstype')) { 
    6467                case 'UNIX': 
    65                      
    6668                    self::$fs = new UnixFileSystem(); 
    6769                break; 
    6870                case 'WIN32': 
    69                      
    7071                    self::$fs = new Win32FileSystem(); 
    7172                break; 
    7273                case 'WINNT': 
    73                      
    7474                    self::$fs = new WinNTFileSystem(); 
    7575                break;