Skip to content

Commit

Permalink
Address sensio labs insights issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Riimu committed Nov 8, 2015
1 parent f10a5cd commit 3ee7efd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.idea
api
coverage
vendor
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ before_install:

install:
- composer require --no-update --no-interaction "phpunit/phpunit:*" "squizlabs/php_codesniffer:*" "fabpot/php-cs-fixer:*"
- travis_retry composer install --no-interaction --prefer-source
- travis_retry composer update --no-interaction --prefer-source
- travis_retry wget https://scrutinizer-ci.com/ocular.phar

script:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 changes: 7 additions & 2 deletions examples/parsing.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
echo $uri->getQuery() . PHP_EOL; // outputs: action=login&prev=index
echo $uri->getFragment() . PHP_EOL; // outputs: form

print_r($uri->getPathSegments()); // [0 => 'site', 1 => 'index.php']
print_r($uri->getQueryParameters()); // ['action' => 'login', 'prev' => 'index']
// [0 => 'site', 1 => 'index.php']
echo implode(', ', $uri->getPathSegments()) . PHP_EOL;

// ['action' => 'login', 'prev' => 'index']
foreach ($uri->getQueryParameters() as $name => $value) {
echo "$name: $value" . PHP_EOL;
}

// Outputs: http://jane:pass123@www.example.com:8080/site/index.php?action=login&prev=index#form
echo $uri;
7 changes: 3 additions & 4 deletions examples/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

require __DIR__ . '/../vendor/autoload.php';

function getValidUrl($url)
{
$getValidUrl = function ($url) {
$parser = new \Riimu\Kit\UrlParser\UriParser();
$parser->setMode(\Riimu\Kit\UrlParser\UriParser::MODE_UTF8);
$uri = $parser->parse($url);
Expand All @@ -17,12 +16,12 @@ function getValidUrl($url)
}

return (string) $uri;
}
};

$normalized = null;

if (isset($_POST['url'])) {
$normalized = getValidUrl($_POST['url']);
$normalized = $getValidUrl($_POST['url']);
}

?>
Expand Down

0 comments on commit 3ee7efd

Please sign in to comment.