Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa\Iterator\SplFileInfo Class Reference
Inheritance diagram for Hoa\Iterator\SplFileInfo:

Public Member Functions

 __construct ($filename, $relativePath=null)
 
 getHash ()
 
 getMTime ()
 
 setRelativePath ($relativePath)
 
 getRelativePath ()
 
 getRelativePathname ()
 

Protected Attributes

 $_hash = null
 
 $_relativePath = null
 

Detailed Description

Class .

Enhance SplFileInfo implementation.

Definition at line 47 of file SplFileInfo.php.

Constructor & Destructor Documentation

Hoa\Iterator\SplFileInfo::__construct (   $filename,
  $relativePath = null 
)

Construct.

Parameters
string$filenameFilename.
string$relativePathRelative path.
Returns
void

Definition at line 72 of file SplFileInfo.php.

73  {
74  parent::__construct($filename);
75 
76  if (-1 !== $mtime = $this->getMTime()) {
77  $this->_hash = md5($this->getPathname() . $mtime);
78  }
79 
80  $this->_relativePath = $relativePath;
81 
82  return;
83  }

Here is the call graph for this function:

Member Function Documentation

Hoa\Iterator\SplFileInfo::getHash ( )

Get the hash.

Returns
string

Definition at line 90 of file SplFileInfo.php.

91  {
92  return $this->_hash;
93  }
Hoa\Iterator\SplFileInfo::getMTime ( )

Get the MTime.

Returns
int

Definition at line 100 of file SplFileInfo.php.

101  {
102  try {
103  return parent::getMTime();
104  } catch (\RuntimeException $e) {
105  return -1;
106  }
107  }

Here is the caller graph for this function:

Hoa\Iterator\SplFileInfo::getRelativePath ( )

Get relative path (if given).

Returns
string

Definition at line 128 of file SplFileInfo.php.

129  {
130  return $this->_relativePath;
131  }

Here is the caller graph for this function:

Hoa\Iterator\SplFileInfo::getRelativePathname ( )

Get relative pathname (if possible).

Returns
string

Definition at line 138 of file SplFileInfo.php.

139  {
140  if (null === $relative = $this->getRelativePath()) {
141  return $this->getPathname();
142  }
143 
144  return substr($this->getPathname(), strlen($relative));
145  }

Here is the call graph for this function:

Hoa\Iterator\SplFileInfo::setRelativePath (   $relativePath)

Set relative path.

Parameters
string$relativePathRelative path.
Returns
string

Definition at line 115 of file SplFileInfo.php.

116  {
117  $old = $this->_relativePath;
118  $this->_relativePath = $relativePath;
119 
120  return $old;
121  }

Member Data Documentation

Hoa\Iterator\SplFileInfo::$_hash = null
protected

Definition at line 54 of file SplFileInfo.php.

Hoa\Iterator\SplFileInfo::$_relativePath = null
protected

Definition at line 61 of file SplFileInfo.php.


The documentation for this class was generated from the following file: