Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #48 from sunrise-php/release/v1.2.0
Browse files Browse the repository at this point in the history
v1.2.0
  • Loading branch information
fenric committed Dec 25, 2020
2 parents dfe7db6 + 401c5fa commit 9c450a7
Show file tree
Hide file tree
Showing 24 changed files with 1,508 additions and 1,545 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

[*.php]
indent_style = tab

[*.yml]
indent_size = 2
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.php_cs.cache
.phpunit.result.cache
composer.lock
coverage.xml
phpcs.xml
phpunit.xml
vendor/
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ matrix:
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4
- php: nightly
fast_finish: true

before_install:
Expand All @@ -13,4 +15,4 @@ before_install:
install:
- travis_retry composer install --no-interaction --prefer-source --no-suggest

script: vendor/bin/phpunit --colors=always --coverage-text
script: php vendor/bin/phpunit --colors=always --coverage-text
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Anatoly Fenric
Copyright (c) 2018 Sunrise // PHP

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
23 changes: 18 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
{
"name": "sunrise/uri",
"description": "Simple URI wrapper for PHP 7.1+ based on RFC-3986, PSR-7 & PSR-17",
"keywords": ["fenric", "sunrise", "uri", "parser", "rfc-3986", "psr-7", "psr-17"],
"homepage": "https://github.com/sunrise-php/uri",
"description": "Simple URI wrapper for PHP 7.1+ based on RFC-3986, PSR-7 & PSR-17",
"license": "MIT",
"keywords": [
"fenric",
"sunrise",
"http",
"uri",
"parser",
"rfc-3986",
"psr-7",
"psr-17",
"php7",
"php8"
],
"authors": [
{
"name": "Anatoly Fenric",
Expand All @@ -17,12 +28,13 @@
}
],
"require": {
"php": "^7.1",
"php": "^7.1|^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "7.5.6"
"phpunit/phpunit": "7.5.20|9.5.0",
"sunrise/coding-standard": "1.0.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
Expand All @@ -34,7 +46,8 @@
},
"scripts": {
"test": [
"phpunit --colors=always --coverage-text"
"phpunit --colors=always --coverage-text",
"phpcs"
]
}
}
7 changes: 7 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<ruleset name="Sunrise Coding Standard">
<rule ref="./vendor/sunrise/coding-standard/ruleset.xml"/>

<file>src</file>
<file>tests</file>
</ruleset>
12 changes: 6 additions & 6 deletions src/Component/ComponentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
interface ComponentInterface
{

/**
* Presents the component value
*
* @return mixed
*/
public function present();
/**
* Presents the component value
*
* @return mixed
*/
public function present();
}
73 changes: 35 additions & 38 deletions src/Component/Fragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,44 @@
class Fragment implements ComponentInterface
{

/**
* The component value
*
* @var string
*/
protected $value = '';
/**
* The component value
*
* @var string
*/
protected $value = '';

/**
* Constructor of the class
*
* @param mixed $value
*
* @throws InvalidUriComponentException
*/
public function __construct($value)
{
if ('' === $value)
{
return;
}
else if (! \is_string($value))
{
throw new InvalidUriComponentException('URI component "fragment" must be a string');
}
/**
* Constructor of the class
*
* @param mixed $value
*
* @throws InvalidUriComponentException
*/
public function __construct($value)
{
if ('' === $value) {
return;
}

$regex = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/\?]+)|(.?))/u';
if (! \is_string($value)) {
throw new InvalidUriComponentException('URI component "fragment" must be a string');
}

$this->value = \preg_replace_callback($regex, function($match)
{
return isset($match[1]) ? \rawurlencode($match[1]) : $match[0];
$regex = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=\:@\/\?]+)|(.?))/u';

}, $value);
}
$this->value = \preg_replace_callback($regex, function ($match) {
return isset($match[1]) ? \rawurlencode($match[1]) : $match[0];
}, $value);
}

/**
* {@inheritDoc}
*
* @return string
*/
public function present() : string
{
return $this->value;
}
/**
* {@inheritDoc}
*
* @return string
*/
public function present() : string
{
return $this->value;
}
}
73 changes: 35 additions & 38 deletions src/Component/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,44 @@
class Host implements ComponentInterface
{

/**
* The component value
*
* @var string
*/
protected $value = '';
/**
* The component value
*
* @var string
*/
protected $value = '';

/**
* Constructor of the class
*
* @param mixed $value
*
* @throws InvalidUriComponentException
*/
public function __construct($value)
{
if ('' === $value)
{
return;
}
else if (! \is_string($value))
{
throw new InvalidUriComponentException('URI component "host" must be a string');
}
/**
* Constructor of the class
*
* @param mixed $value
*
* @throws InvalidUriComponentException
*/
public function __construct($value)
{
if ('' === $value) {
return;
}

$regex = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u';
if (! \is_string($value)) {
throw new InvalidUriComponentException('URI component "host" must be a string');
}

$this->value = \preg_replace_callback($regex, function($match)
{
return isset($match[1]) ? \rawurlencode($match[1]) : $match[0];
$regex = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u';

}, $value);
}
$this->value = \preg_replace_callback($regex, function ($match) {
return isset($match[1]) ? \rawurlencode($match[1]) : $match[0];
}, $value);
}

/**
* {@inheritDoc}
*
* @return string
*/
public function present() : string
{
return \strtolower($this->value);
}
/**
* {@inheritDoc}
*
* @return string
*/
public function present() : string
{
return \strtolower($this->value);
}
}
73 changes: 35 additions & 38 deletions src/Component/Pass.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,44 @@
class Pass implements ComponentInterface
{

/**
* The component value
*
* @var string
*/
protected $value = '';
/**
* The component value
*
* @var string
*/
protected $value = '';

/**
* Constructor of the class
*
* @param mixed $value
*
* @throws InvalidUriComponentException
*/
public function __construct($value)
{
if ('' === $value)
{
return;
}
else if (! \is_string($value))
{
throw new InvalidUriComponentException('URI component "pass" must be a string');
}
/**
* Constructor of the class
*
* @param mixed $value
*
* @throws InvalidUriComponentException
*/
public function __construct($value)
{
if ('' === $value) {
return;
}

$regex = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u';
if (! \is_string($value)) {
throw new InvalidUriComponentException('URI component "pass" must be a string');
}

$this->value = \preg_replace_callback($regex, function($match)
{
return isset($match[1]) ? \rawurlencode($match[1]) : $match[0];
$regex = '/(?:(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-\._~\!\$&\'\(\)\*\+,;\=]+)|(.?))/u';

}, $value);
}
$this->value = \preg_replace_callback($regex, function ($match) {
return isset($match[1]) ? \rawurlencode($match[1]) : $match[0];
}, $value);
}

/**
* {@inheritDoc}
*
* @return string
*/
public function present() : string
{
return $this->value;
}
/**
* {@inheritDoc}
*
* @return string
*/
public function present() : string
{
return $this->value;
}
}

0 comments on commit 9c450a7

Please sign in to comment.