Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSR-7 - Tests and refactoring #14154

Merged
merged 16 commits into from
Jun 3, 2019
Merged
Prev Previous commit
Next Next commit
Changed getters with zephir get syntax
  • Loading branch information
niden committed Jun 2, 2019
commit cf90256588cf888301d02e05d77b6224a33f05e7
150 changes: 48 additions & 102 deletions phalcon/Http/Message/Uri.zep
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,78 @@ use Psr\Http\Message\UriInterface;
final class Uri extends AbstractCommon implements UriInterface
{
/**
* Retrieve the fragment component of the URI.
* Returns the fragment of the URL
*
* @var string
* @return string
*/
private fragment = "";
private fragment = "" { get };

/**
* @var string
* Retrieve the host component of the URI.
*
* If no host is present, this method MUST return an empty string.
*
* The value returned MUST be normalized to lowercase, per RFC 3986
* Section 3.2.2.
*
* @see http://tools.ietf.org/html/rfc3986#section-3.2.2
*
* @return string
*/
private host = "";
private host = "" { get };

/**
* @var string
*/
private $pass = "";

/**
* Retrieve the path component of the URI.
* Returns the path of the URL
*
* @var string
* @return string
*/
private path = "";
private path = "" { get };

/**
* @var null | int
* Retrieve the port component of the URI.
*
* If a port is present, and it is non-standard for the current scheme,
* this method MUST return it as an integer. If the port is the standard
* port used with the current scheme, this method SHOULD return null.
*
* If no port is present, and no scheme is present, this method MUST return
* a null value.
*
* If no port is present, but a scheme is present, this method MAY return
* the standard port for that scheme, but SHOULD return null.
*
* @return int|null
*/
private port = null;
private port = null { get };

/**
* Retrieve the query string of the URI.
* Returns the query of the URL
*
* @var string
* @return string
*/
private query = "";
private query = "" { get };

/**
* @var string
* Retrieve the scheme component of the URI.
*
* If no scheme is present, this method MUST return an empty string.
*
* The value returned MUST be normalized to lowercase, per RFC 3986
* Section 3.1.
*
* The trailing ":" character is not part of the scheme and MUST NOT be
* added.
*
* @see https://tools.ietf.org/html/rfc3986#section-3.1
*
* @return string
*/
private scheme = "https";
private scheme = "https" { get };

/**
* @var string
Expand Down Expand Up @@ -173,93 +206,6 @@ final class Uri extends AbstractCommon implements UriInterface
return authority;
}

/**
* Returns the fragment of the URL
*
* @return string
*/
public function getFragment() -> string
{
return this->fragment;
}

/**
* Retrieve the host component of the URI.
*
* If no host is present, this method MUST return an empty string.
*
* The value returned MUST be normalized to lowercase, per RFC 3986
* Section 3.2.2.
*
* @see http://tools.ietf.org/html/rfc3986#section-3.2.2
*
* @return string
*/
public function getHost() -> string
{
return this->host;
}

/**
* Returns the path of the URL
*
* @return string
*/
public function getPath() -> string
{
return this->path;
}

/**
* Retrieve the port component of the URI.
*
* If a port is present, and it is non-standard for the current scheme,
* this method MUST return it as an integer. If the port is the standard
* port used with the current scheme, this method SHOULD return null.
*
* If no port is present, and no scheme is present, this method MUST return
* a null value.
*
* If no port is present, but a scheme is present, this method MAY return
* the standard port for that scheme, but SHOULD return null.
*
* @return int|null
*/
public function getPort() -> int
{
return this->port;
}

/**
* Returns the query of the URL
*
* @return string
*/
public function getQuery() -> string
{
return this->query;
}

/**
* Retrieve the scheme component of the URI.
*
* If no scheme is present, this method MUST return an empty string.
*
* The value returned MUST be normalized to lowercase, per RFC 3986
* Section 3.1.
*
* The trailing ":" character is not part of the scheme and MUST NOT be
* added.
*
* @see https://tools.ietf.org/html/rfc3986#section-3.1
*
* @return string
*/
public function getScheme() -> string
{
return this->scheme;
}

/**
* Retrieve the user information component of the URI.
*
Expand Down