예제 #1
0
 public function parsePath($path)
 {
     $url = parse_url($path);
     if (!isset($url['path'])) {
         $url['path'] = '/';
     }
     $fs = StreamRegistry::instance()->get($url['scheme'], $url['host']);
     return [$url, $fs];
 }
예제 #2
0
파일: junk.php 프로젝트: shabbyrobe/defile
                    $objects[$hash] = ++$ocnt;
                    $name .= '#' . $ocnt;
                } else {
                    $fmt = "'%s'";
                }
                $margin = str_repeat(' ', $indent * $spaces);
                $out .= $name . " (\n";
                foreach ((array) $var as $k => $v) {
                    $k = str_replace("", ':', trim($k));
                    $out .= $margin . sprintf($fmt, $k) . " => " . dump_var($v, $depth) . "\n";
                }
                $out .= str_repeat(' ', ($indent - 1) * $spaces) . ")";
            }
            --$indent;
            break;
    }
    if ($indent == 0) {
        $objects = array();
        $ocnt = 0;
        $out .= "\n";
    }
    return $out;
}
set_error_handler(function ($code, $msg, $file, $line, $context) {
    throw new \ErrorException($msg, null, $code, $file, $line);
});
StreamRegistry::instance()->add("foo", "pants", new MemoryFileSystem());
$fs = StreamRegistry::instance()->get('foo', 'pants');
file_put_contents('foo://pants/path', 'test', FILE_APPEND);
var_dump($fs->getNode('/path'));
var_dump(file_get_contents('foo://pants/path'));