Hoa central
SplFileInfo.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\File;
38 
39 use Hoa\Iterator;
40 
50 {
56  protected $_stream = null;
57 
58 
59 
66  public function open()
67  {
68  if (true === $this->isFile()) {
69  return $this->_stream = new ReadWrite($this->getPathname());
70  } elseif (true === $this->isDir()) {
71  return $this->_stream = new Directory($this->getPathname());
72  } elseif (true === $this->isLink()) {
73  return $this->_stream = new Link\ReadWrite($this->getPathname());
74  }
75 
76  throw new Exception('%s has an unknown type.', 0, $this->getPathname());
77  }
78 
84  public function close()
85  {
86  if (null === $this->_stream) {
87  return;
88  }
89 
90  return $this->_stream->close();
91  }
92 
98  public function __destruct()
99  {
100  $this->close();
101 
102  return;
103  }
104 }