/**
  * @covers Corgi\File\Helpers\FileSystemHelper::isReadableDirectory
  */
 public function testIsReadableDirectory()
 {
     $this->assertBool(FileSystemHelper::isReadableDirectory());
 }
 /**
  * Returns directory contents as an array of FileSystemNode objects
  * @return array
  * @throws NotReadableException
  */
 public function toArray()
 {
     if (!FileSystemHelper::isReadableDirectory($this->directory)) {
         throw new NotReadableException($this->directory);
     }
     $contents = new \stdClass();
     $contents->data = [];
     /**
      * @param \SplFileInfo $currentItem
      */
     $closure = function ($currentItem) use($contents) {
         $contents->data[] = $currentItem->isDir() ? new Directory($currentItem->getRealPath()) : new File($currentItem->getRealPath());
     };
     $this->getDirectory()->iterate($closure, \RecursiveIteratorIterator::CHILD_FIRST);
     return $contents->data;
 }