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

Public Member Functions

 __construct ($path, $flags=null, $splFileInfoClass=null)
 
 current ()
 
 getChildren ()
 
 setSplFileInfoClass ($splFileInfoClass)
 
 getRelativePath ()
 

Protected Attributes

 $_splFileInfoClass = null
 
 $_relativePath = 0
 

Static Private Attributes

static $_handlePath = null
 

Detailed Description

Class .

Extending the SPL RecursiveDirectoryIterator class.

Definition at line 47 of file Directory.php.

Constructor & Destructor Documentation

Hoa\Iterator\Recursive\Directory::__construct (   $path,
  $flags = null,
  $splFileInfoClass = null 
)

Constructor. Please, see ::__construct() method. We add the $splFileInfoClass parameter.

Parameters
string$pathPath.
int$flagsFlags.
string$splFileInfoClassSplFileInfo classname.

Definition at line 81 of file Directory.php.

82  {
83  if (null === $flags) {
84  parent::__construct($path);
85  } else {
86  parent::__construct($path, $flags);
87  }
88 
89  if (null !== self::$_handlePath) {
90  $this->_relativePath = self::$_handlePath;
91  self::$_handlePath = null;
92  } else {
93  $this->_relativePath = $path;
94  }
95 
96  $this->setSplFileInfoClass($splFileInfoClass);
97 
98  return;
99  }
setSplFileInfoClass($splFileInfoClass)
Definition: Directory.php:148

Here is the call graph for this function:

Member Function Documentation

Hoa\Iterator\Recursive\Directory::current ( )

Current. Please, see ::current() method.

Returns
mixed

Definition at line 107 of file Directory.php.

108  {
109  $out = parent::current();
110 
111  if (null !== $this->_splFileInfoClass &&
112  $out instanceof \SplFileInfo) {
113  $out->setInfoClass($this->_splFileInfoClass);
114  $out = $out->getFileInfo();
115 
116  if ($out instanceof \Hoa\Iterator\SplFileInfo) {
117  $out->setRelativePath($this->getRelativePath());
118  }
119  }
120 
121  return $out;
122  }

Here is the call graph for this function:

Hoa\Iterator\Recursive\Directory::getChildren ( )

Get children. Please, see ::getChildren() method.

Returns
mixed

Definition at line 130 of file Directory.php.

131  {
132  self::$_handlePath = $this->getRelativePath();
133  $out = parent::getChildren();
134 
135  if ($out instanceof \RecursiveDirectoryIterator) {
136  $out->setSplFileInfoClass($this->_splFileInfoClass);
137  }
138 
139  return $out;
140  }

Here is the call graph for this function:

Hoa\Iterator\Recursive\Directory::getRelativePath ( )

Get relative path (if given).

Returns
string

Definition at line 160 of file Directory.php.

161  {
162  return $this->_relativePath;
163  }
Hoa\Iterator\Recursive\Directory::setSplFileInfoClass (   $splFileInfoClass)

Set SplFileInfo classname.

Parameters
string$splFileInfoClassSplFileInfo classname.
Returns
void

Definition at line 148 of file Directory.php.

149  {
150  $this->_splFileInfoClass = $splFileInfoClass;
151 
152  return;
153  }

Here is the caller graph for this function:

Member Data Documentation

Hoa\Iterator\Recursive\Directory::$_handlePath = null
staticprivate

Definition at line 68 of file Directory.php.

Hoa\Iterator\Recursive\Directory::$_relativePath = 0
protected

Definition at line 61 of file Directory.php.

Hoa\Iterator\Recursive\Directory::$_splFileInfoClass = null
protected

Definition at line 54 of file Directory.php.


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