Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
fix(resolve) Remove the global resolve function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Aug 30, 2017
2 parents b53223f + e969306 commit a832ea9
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 25 deletions.
57 changes: 57 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
language: php

matrix:
include:
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
env:
- ENABLE_XDEBUG=true
- php: 7.1
env:
- ENABLE_DEVTOOLS=true
- php: nightly
- php: hhvm-3.12
sudo: required
dist: trusty
group: edge
- php: hhvm
sudo: required
dist: trusty
group: edge
allow_failures:
- php: nightly
- php: hhvm-3.12
- php: hhvm
fast_finish: true

os:
- linux

notifications:
irc: "chat.freenode.net#hoaproject"

sudo: false

env:
global:
- secure: "AAAAB3NzaC1yc2EAAAADAQABAAACAQChL/P+1zOcJlmDYIDkZaINkRbs1HRsw5ERmmtS7SOlVv2uNSLJi2UdfRg+6oJWpZZ5bOShlfecQOEfz0/v4gn3kJWfoiprv26817fjheW0Z48DbxClzuIfn/mksosj1CfoKxJtaV0mNoaRbndDDGiNpM4P2/7PEzq5OLGTDDmM4R32D0UkqSbLaJHLGQWrCV1GbUvUdpYgR9bs7bxx8yO19o6j7CfHjfN69sLm/RsqMjCrEkkI+r1lwzxV2efLNKgtjhjdec4Yycfz1S3PcL8sD4YQUOtAqQI5BBPn732lQ8l2FILvc2UHnxo5sjrdw+Z58/yd5amemm4ou25HPPcbnXLM1KkqhgdTPphZQxgPNZMoF6QBg1wSwOcEGrhLbXMIjV5Bl4yphCDs5vQYoyS+AxvFfZuef2nEMemNkBfaunLz7hFuBKfufnsxSebMBfYoV3/mdfYb5WM5XxIhWAO92uEqPomjcQXp2uX78OmRaLE4HvbZY+uncMjjnbIzhUDGojZNc8ZPZUCcf8UCabenFCTadhLrSRsyIiezx/Vskf3+M2LvBySLefDZvJHqZFAkcebXfl6fJI44BKgQfBxexLmmUtPeKdLC8kFdSkoM+AXJJe2vP5ldi7ypnBTWHM+oi3UGi/qoCH0anxE/UgyecXstJJvioqaKnevOlIiV+Q=="

cache:
directories:
- vendor/

before_script:
- export PATH="$PATH:$HOME/.composer/vendor/bin"
- if [[ ! $ENABLE_XDEBUG ]]; then
phpenv config-rm xdebug.ini || echo "ext-xdebug is not available, cannot remove it.";
fi

script:
- composer install
- vendor/bin/hoa test:run
- if [[ $ENABLE_DEVTOOLS ]]; then
composer global require friendsofphp/php-cs-fixer;
vendor/bin/hoa devtools:cs --diff --dry-run .;
fi
2 changes: 1 addition & 1 deletion Bin/Resolve.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function main()
' is equivalent to:', "\n";
}

$resolved = resolve($path, $exists, $unfold);
$resolved = Protocol\Protocol::getInstance()->resolve($path, $exists, $unfold);

foreach ((array) $resolved as $r) {
echo $r, "\n";
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
---

<p align="center">
<a href="https://travis-ci.org/hoaproject/protocol"><img src="https://img.shields.io/travis/hoaproject/protocol/master.svg" alt="Build status" /></a>
<a href="https://coveralls.io/github/hoaproject/protocol?branch=master"><img src="https://img.shields.io/coveralls/hoaproject/protocol/master.svg" alt="Code coverage" /></a>
<a href="https://travis-ci.org/hoaproject/Protocol"><img src="https://img.shields.io/travis/hoaproject/Protocol/master.svg" alt="Build status" /></a>
<a href="https://coveralls.io/github/hoaproject/Protocol?branch=master"><img src="https://img.shields.io/coveralls/hoaproject/Protocol/master.svg" alt="Code coverage" /></a>
<a href="https://packagist.org/packages/hoa/protocol"><img src="https://img.shields.io/packagist/dt/hoa/protocol.svg" alt="Packagist" /></a>
<a href="https://hoa-project.net/LICENSE"><img src="https://img.shields.io/packagist/l/hoa/protocol.svg" alt="License" /></a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
LUT::getInstance()->resolve('hoa://Test/Vfs/Bar/' . $child . '?type=file');
}

return $wrapper;
Expand Down
21 changes: 0 additions & 21 deletions Wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,24 +582,3 @@ public function getStreamName()
stream_wrapper_register('hoa', Wrapper::class);

}

namespace
{

/**
* 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);
}
}

}

0 comments on commit a832ea9

Please sign in to comment.