/**
  * StandardDirectory constructor.
  *
  * @param DriverInterface  $driver
  * @param                  $path
  * @param array|null       $contents
  */
 public function __construct(DriverInterface $driver, $path, array $contents = null)
 {
     $this->driver = $driver;
     $this->path = $path;
     $this->position = 0;
     $this->contents = [];
     // Check contents
     foreach ((array) $contents as $content) {
         $adapterClass = get_class($this->driver);
         if (is_string($content)) {
             $content = $this->driver->info($content);
         }
         if (!$content instanceof InfoInterface) {
             // Throw or ignore?
             continue;
         }
         // Wrong adapter
         if (get_class($content->getDriver()) != $adapterClass) {
             // Throw or ignore?
             continue;
         }
         $this->contents[] = $content;
     }
 }
 /**
  * @return mixed
  */
 public function getFileInfo()
 {
     return $this->driver->info($this->path);
 }