Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa\Test\Protocol\Vfs Class Reference
Inheritance diagram for Hoa\Test\Protocol\Vfs:

Public Member Functions

 reach ($queue=null)
 

Protected Attributes

 $_name = 'Vfs'
 
 $_streams = []
 

Detailed Description

Class .

Create the hoa://Test/Vfs/ component.

Definition at line 50 of file Vfs.php.

Member Function Documentation

Hoa\Test\Protocol\Vfs::reach (   $queue = null)

Queue of the component.

Parameters
string$queueQueue of the component (generally, a filename, with probably a query).
Returns
mixed

Definition at line 75 of file Vfs.php.

76  {
77  if (null === $queue) {
78  return null;
79  }
80 
81  $components = parse_url($queue);
82  $path = &$components['path'];
83 
84  if (isset($components['query'])) {
85  parse_str($components['query'], $queries);
86  } else {
87  $queries = ['type' => 'file'];
88  }
89 
90  if (isset($queries['type']) &&
91  'directory' === $queries['type']) {
92  $file = atoum\mock\streams\fs\directory::get($path);
93  $file->dir_opendir = true;
94  } else {
95  $file = atoum\mock\streams\fs\file::get($path);
96  }
97 
98  $parentDirectory = dirname($path);
99 
100  if (isset($this->_streams[$parentDirectory])) {
101  $this->_streams[$parentDirectory]->dir_readdir[] = $file;
102  }
103 
104  foreach ($queries as $query => $value) {
105  switch ($query) {
106  case 'atime':
107  case 'ctime':
108  case 'mtime':
109  $file->getStat()[$query] = intval($value);
110 
111  break;
112 
113  case 'permissions':
114  $value = sprintf('%04d', $value);
115  $file->setPermissions($value);
116 
117  break;
118  }
119  }
120 
121  $this->_streams[$path] = $file;
122 
123  return (string) $file;
124  }

Member Data Documentation

Hoa\Test\Protocol\Vfs::$_name = 'Vfs'
protected

Definition at line 57 of file Vfs.php.

Hoa\Test\Protocol\Vfs::$_streams = []
protected

Definition at line 64 of file Vfs.php.


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