diff --git a/Uri/Argument.php b/Uri/Argument.php index 70857e905..b0060398f 100644 --- a/Uri/Argument.php +++ b/Uri/Argument.php @@ -317,9 +317,9 @@ final class Argument implements UriInterface /** * {@inheritdoc} */ - public function getPathElement(int $pos = 0) : string + public function getPathElement(int $pos = 0, bool $useOffset = true) : string { - return $this->pathElements[$pos + $this->pathOffset] ?? ''; + return $this->pathElements[$pos + ($useOffset ? $this->pathOffset : 0)] ?? ''; } /** diff --git a/Uri/HttpUri.php b/Uri/HttpUri.php index 023bfb9ba..3c7887453 100644 --- a/Uri/HttpUri.php +++ b/Uri/HttpUri.php @@ -384,9 +384,9 @@ final class HttpUri implements UriInterface /** * {@inheritdoc} */ - public function getPathElement(int $pos = 0) : string + public function getPathElement(int $pos = 0, bool $useOffset = true) : string { - return $this->pathElements[$pos + $this->pathOffset] ?? ''; + return $this->pathElements[$pos + ($useOffset ? $this->pathOffset : 0)] ?? ''; } /** diff --git a/Uri/UriInterface.php b/Uri/UriInterface.php index 8dc6d9c30..f0a402b2c 100644 --- a/Uri/UriInterface.php +++ b/Uri/UriInterface.php @@ -117,13 +117,14 @@ interface UriInterface /** * Get path element. * - * @param int $pos Position of the path + * @param int $pos Position of the path + * @param int $useOffset Uses internal path offset * * @return string * * @since 1.0.0 */ - public function getPathElement(int $pos = 0) : string; + public function getPathElement(int $pos = 0, bool $useOffset = true) : string; /** * Get path elements. diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 39e6270f5..d5a513f8b 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -236,7 +236,7 @@ $CONFIG = [ 'mssql' => [ 'admin' => [ 'db' => 'mssql', /* db type */ - 'host' => '127.0.0.1', /* db host address */ + 'host' => 'localhost', /* db host address */ 'port' => '1433', /* db host port */ 'login' => 'sa', /* db login name */ 'password' => 'c0MplicatedP@ssword', /* db login password */ @@ -246,7 +246,7 @@ $CONFIG = [ ], 'insert' => [ 'db' => 'mssql', /* db type */ - 'host' => '127.0.0.1', /* db host address */ + 'host' => 'localhost', /* db host address */ 'port' => '1433', /* db host port */ 'login' => 'sa', /* db login name */ 'password' => 'c0MplicatedP@ssword', /* db login password */ @@ -256,7 +256,7 @@ $CONFIG = [ ], 'select' => [ 'db' => 'mssql', /* db type */ - 'host' => '127.0.0.1', /* db host address */ + 'host' => 'localhost', /* db host address */ 'port' => '1433', /* db host port */ 'login' => 'sa', /* db login name */ 'password' => 'c0MplicatedP@ssword', /* db login password */ @@ -266,7 +266,7 @@ $CONFIG = [ ], 'update' => [ 'db' => 'mssql', /* db type */ - 'host' => '127.0.0.1', /* db host address */ + 'host' => 'localhost', /* db host address */ 'port' => '1433', /* db host port */ 'login' => 'sa', /* db login name */ 'password' => 'c0MplicatedP@ssword', /* db login password */ @@ -276,7 +276,7 @@ $CONFIG = [ ], 'delete' => [ 'db' => 'mssql', /* db type */ - 'host' => '127.0.0.1', /* db host address */ + 'host' => 'localhost', /* db host address */ 'port' => '1433', /* db host port */ 'login' => 'sa', /* db login name */ 'password' => 'c0MplicatedP@ssword', /* db login password */ @@ -286,7 +286,7 @@ $CONFIG = [ ], 'schema' => [ 'db' => 'mssql', /* db type */ - 'host' => '127.0.0.1', /* db host address */ + 'host' => 'localhost', /* db host address */ 'port' => '1433', /* db host port */ 'login' => 'sa', /* db login name */ 'password' => 'c0MplicatedP@ssword', /* db login password */