示例#1
0
 public function testSetFilesystem()
 {
     $file = new File($this->filesystem, 'fixtures/images/2-top-right.jpg');
     $filesystem = new Filesystem(new Local(__DIR__));
     $file->setFilesystem($filesystem);
     $this->assertInstanceOf('Bolt\\Filesystem\\Filesystem', $file->getFilesystem());
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function get($path, HandlerInterface $handler = null)
 {
     $path = $this->normalizePath($path);
     if ($handler === null) {
         $this->assertPresent($path);
         $type = $this->doGetType($path);
         if ($type === 'dir') {
             $handler = new Handler\Directory($this, $path);
         } elseif ($type === 'image') {
             $handler = new Handler\Image($this, $path);
         } elseif ($type === 'json') {
             $handler = new Handler\JsonFile($this, $path);
         } elseif ($type === 'yaml') {
             $handler = new Handler\YamlFile($this, $path);
         } else {
             $handler = new Handler\File($this, $path);
         }
     }
     $handler->setPath($path);
     $handler->setFilesystem($this);
     if ($handler instanceof MountPointAwareInterface) {
         $handler->setMountPoint($this->mountPoint);
     }
     return $handler;
 }