From 5637cb444d535ee4ed48db23478886eb41382426 Mon Sep 17 00:00:00 2001 From: Grummfy Date: Fri, 4 Aug 2017 22:41:49 +0200 Subject: [PATCH 1/2] undef(resolve) adding Hoa namespace to resolve to avoid confliuct --- Bin/Resolve.php | 2 +- Test/Unit/Wrapper.php | 2 +- Wrapper.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Bin/Resolve.php b/Bin/Resolve.php index 4e61ef4..1325c9a 100644 --- a/Bin/Resolve.php +++ b/Bin/Resolve.php @@ -148,7 +148,7 @@ public function main() ' is equivalent to:', "\n"; } - $resolved = resolve($path, $exists, $unfold); + $resolved = \Hoa\resolve($path, $exists, $unfold); foreach ((array) $resolved as $r) { echo $r, "\n"; diff --git a/Test/Unit/Wrapper.php b/Test/Unit/Wrapper.php index 813a317..1858d37 100644 --- a/Test/Unit/Wrapper.php +++ b/Test/Unit/Wrapper.php @@ -902,7 +902,7 @@ protected function openDirectory(SUT $wrapper, array $children = []) $wrapper->dir_opendir('hoa://Test/Vfs/Bar?type=directory', 0); foreach ($children as $child) { - resolve('hoa://Test/Vfs/Bar/' . $child . '?type=file'); + \Hoa\resolve('hoa://Test/Vfs/Bar/' . $child . '?type=file'); } return $wrapper; diff --git a/Wrapper.php b/Wrapper.php index 779357b..c62c46c 100644 --- a/Wrapper.php +++ b/Wrapper.php @@ -583,7 +583,7 @@ public function getStreamName() } -namespace +namespace Hoa { /** From d7d4965b383a3c8ffbd1643c46538dac1cf0fd2e Mon Sep 17 00:00:00 2001 From: Grummfy Date: Mon, 7 Aug 2017 22:50:09 +0200 Subject: [PATCH 2/2] removing resolve function --- Bin/Resolve.php | 2 +- Test/Unit/Wrapper.php | 2 +- Wrapper.php | 21 --------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/Bin/Resolve.php b/Bin/Resolve.php index 1325c9a..c183708 100644 --- a/Bin/Resolve.php +++ b/Bin/Resolve.php @@ -148,7 +148,7 @@ public function main() ' is equivalent to:', "\n"; } - $resolved = \Hoa\resolve($path, $exists, $unfold); + $resolved = Protocol\Protocol::getInstance()->resolve($path, $exists, $unfold); foreach ((array) $resolved as $r) { echo $r, "\n"; diff --git a/Test/Unit/Wrapper.php b/Test/Unit/Wrapper.php index 1858d37..ccf5cf8 100644 --- a/Test/Unit/Wrapper.php +++ b/Test/Unit/Wrapper.php @@ -902,7 +902,7 @@ protected function openDirectory(SUT $wrapper, array $children = []) $wrapper->dir_opendir('hoa://Test/Vfs/Bar?type=directory', 0); foreach ($children as $child) { - \Hoa\resolve('hoa://Test/Vfs/Bar/' . $child . '?type=file'); + LUT::getInstance()->resolve('hoa://Test/Vfs/Bar/' . $child . '?type=file'); } return $wrapper; diff --git a/Wrapper.php b/Wrapper.php index c62c46c..bcda7b3 100644 --- a/Wrapper.php +++ b/Wrapper.php @@ -582,24 +582,3 @@ public function getStreamName() stream_wrapper_register('hoa', Wrapper::class); } - -namespace Hoa -{ - -/** - * Alias of `Hoa\Protocol::resolve` method. - * - * @param string $path Path to resolve. - * @param bool $exists If `true`, try to find the first that exists, - * else return the first solution. - * @param bool $unfold Return all solutions instead of one. - * @return mixed - */ -if (!function_exists('resolve')) { - function resolve($path, $exists = true, $unfold = false) - { - return Hoa\Protocol::getInstance()->resolve($path, $exists, $unfold); - } -} - -}