Fixed yoda comparisons

pull/567/head
fadrian06 11 months ago
parent 3fba60ca7f
commit 253c86482e

@ -67,9 +67,7 @@ use flight\net\Route;
*/ */
class Engine class Engine
{ {
/** /** @var array<string> List of methods that can be extended in the Engine class. */
* @var array<string> List of methods that can be extended in the Engine class.
*/
private const MAPPABLE_METHODS = [ private const MAPPABLE_METHODS = [
'start', 'stop', 'route', 'halt', 'error', 'notFound', 'start', 'stop', 'route', 'halt', 'error', 'notFound',
'render', 'redirect', 'etag', 'lastModified', 'json', 'jsonp', 'render', 'redirect', 'etag', 'lastModified', 'json', 'jsonp',
@ -298,7 +296,7 @@ class Engine
*/ */
public function get(?string $key = null) public function get(?string $key = null)
{ {
if (null === $key) { if ($key === null) {
return $this->vars; return $this->vars;
} }
@ -344,8 +342,9 @@ class Engine
*/ */
public function clear(?string $key = null): void public function clear(?string $key = null): void
{ {
if (null === $key) { if ($key === null) {
$this->vars = []; $this->vars = [];
return; return;
} }
@ -367,7 +366,7 @@ class Engine
* *
* @param array<int, callable> $middleware Middleware attached to the route. * @param array<int, callable> $middleware Middleware attached to the route.
* @param array<mixed> $params `$route->params`. * @param array<mixed> $params `$route->params`.
* @param string $event_name If this is the before or after method. * @param 'before'|'after' $event_name If this is the before or after method.
*/ */
protected function processMiddleware(array $middleware, array $params, string $event_name): bool protected function processMiddleware(array $middleware, array $params, string $event_name): bool
{ {
@ -376,23 +375,23 @@ class Engine
foreach ($middleware as $middleware) { foreach ($middleware as $middleware) {
$middleware_object = false; $middleware_object = false;
if ($event_name === 'before') { if ($event_name === $this->dispatcher::FILTER_BEFORE) {
// can be a callable or a class // can be a callable or a class
$middleware_object = (is_callable($middleware) === true $middleware_object = (is_callable($middleware) === true
? $middleware ? $middleware
: (method_exists($middleware, 'before') === true : (method_exists($middleware, $this->dispatcher::FILTER_BEFORE) === true
? [$middleware, 'before'] ? [$middleware, $this->dispatcher::FILTER_BEFORE]
: false : false
) )
); );
} elseif ($event_name === 'after') { } elseif ($event_name === $this->dispatcher::FILTER_AFTER) {
// must be an object. No functions allowed here // must be an object. No functions allowed here
if ( if (
is_object($middleware) === true is_object($middleware) === true
&& !($middleware instanceof Closure) && !($middleware instanceof Closure)
&& method_exists($middleware, 'after') === true && method_exists($middleware, $this->dispatcher::FILTER_AFTER) === true
) { ) {
$middleware_object = [$middleware, 'after']; $middleware_object = [$middleware, $this->dispatcher::FILTER_AFTER];
} }
} }
@ -532,9 +531,7 @@ class Engine
public function _error(Throwable $e): void public function _error(Throwable $e): void
{ {
$msg = sprintf( $msg = sprintf(
'<h1>500 Internal Server Error</h1>' . '<h1>500 Internal Server Error</h1><h3>%s (%s)</h3><pre>%s</pre>',
'<h3>%s (%s)</h3>' .
'<pre>%s</pre>',
$e->getMessage(), $e->getMessage(),
$e->getCode(), $e->getCode(),
$e->getTraceAsString() $e->getTraceAsString()
@ -565,7 +562,7 @@ class Engine
$response = $this->response(); $response = $this->response();
if (!$response->sent()) { if (!$response->sent()) {
if (null !== $code) { if ($code !== null) {
$response->status($code); $response->status($code);
} }
@ -633,8 +630,12 @@ class Engine
* @param callable $callback Callback function * @param callable $callback Callback function
* @param bool $pass_route Pass the matching route object to the callback * @param bool $pass_route Pass the matching route object to the callback
*/ */
public function _patch(string $pattern, callable $callback, bool $pass_route = false, string $route_alias = ''): void public function _patch(
{ string $pattern,
callable $callback,
bool $pass_route = false,
string $route_alias = ''
): void {
$this->router()->map('PATCH ' . $pattern, $callback, $pass_route, $route_alias); $this->router()->map('PATCH ' . $pattern, $callback, $pass_route, $route_alias);
} }
@ -645,8 +646,12 @@ class Engine
* @param callable $callback Callback function * @param callable $callback Callback function
* @param bool $pass_route Pass the matching route object to the callback * @param bool $pass_route Pass the matching route object to the callback
*/ */
public function _delete(string $pattern, callable $callback, bool $pass_route = false, string $route_alias = ''): void public function _delete(
{ string $pattern,
callable $callback,
bool $pass_route = false,
string $route_alias = ''
): void {
$this->router()->map('DELETE ' . $pattern, $callback, $pass_route, $route_alias); $this->router()->map('DELETE ' . $pattern, $callback, $pass_route, $route_alias);
} }
@ -688,14 +693,10 @@ class Engine
*/ */
public function _redirect(string $url, int $code = 303): void public function _redirect(string $url, int $code = 303): void
{ {
$base = $this->get('flight.base_url'); $base = $this->get('flight.base_url') ?? $this->request()->base;
if (null === $base) {
$base = $this->request()->base;
}
// Append base url to redirect url // Append base url to redirect url
if ('/' !== $base && false === strpos($url, '://')) { if ($base !== '/' && strpos($url, '://') === false) {
$url = $base . preg_replace('#/+#', '/', '/' . $url); $url = $base . preg_replace('#/+#', '/', '/' . $url);
} }
@ -717,8 +718,9 @@ class Engine
*/ */
public function _render(string $file, ?array $data = null, ?string $key = null): void public function _render(string $file, ?array $data = null, ?string $key = null): void
{ {
if (null !== $key) { if ($key !== null) {
$this->view()->set($key, $this->view()->fetch($file, $data)); $this->view()->set($key, $this->view()->fetch($file, $data));
return; return;
} }
@ -790,7 +792,7 @@ class Engine
*/ */
public function _etag(string $id, string $type = 'strong'): void public function _etag(string $id, string $type = 'strong'): void
{ {
$id = (('weak' === $type) ? 'W/' : '') . $id; $id = (($type === 'weak') ? 'W/' : '') . $id;
$this->response()->header('ETag', '"' . str_replace('"', '\"', $id) . '"'); $this->response()->header('ETag', '"' . str_replace('"', '\"', $id) . '"');

@ -151,7 +151,7 @@ class Request
'method' => self::getMethod(), 'method' => self::getMethod(),
'referrer' => self::getVar('HTTP_REFERER'), 'referrer' => self::getVar('HTTP_REFERER'),
'ip' => self::getVar('REMOTE_ADDR'), 'ip' => self::getVar('REMOTE_ADDR'),
'ajax' => 'XMLHttpRequest' === self::getVar('HTTP_X_REQUESTED_WITH'), 'ajax' => self::getVar('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest',
'scheme' => self::getScheme(), 'scheme' => self::getScheme(),
'user_agent' => self::getVar('HTTP_USER_AGENT'), 'user_agent' => self::getVar('HTTP_USER_AGENT'),
'type' => self::getVar('CONTENT_TYPE'), 'type' => self::getVar('CONTENT_TYPE'),
@ -160,7 +160,7 @@ class Request
'data' => new Collection($_POST), 'data' => new Collection($_POST),
'cookies' => new Collection($_COOKIE), 'cookies' => new Collection($_COOKIE),
'files' => new Collection($_FILES), 'files' => new Collection($_FILES),
'secure' => 'https' === self::getScheme(), 'secure' => self::getScheme() === 'https',
'accept' => self::getVar('HTTP_ACCEPT'), 'accept' => self::getVar('HTTP_ACCEPT'),
'proxy_ip' => self::getProxyIpAddress(), 'proxy_ip' => self::getProxyIpAddress(),
'host' => self::getVar('HTTP_HOST'), 'host' => self::getVar('HTTP_HOST'),
@ -188,7 +188,7 @@ class Request
// This rewrites the url in case the public url and base directories match // This rewrites the url in case the public url and base directories match
// (such as installing on a subdirectory in a web server) // (such as installing on a subdirectory in a web server)
// @see testInitUrlSameAsBaseDirectory // @see testInitUrlSameAsBaseDirectory
if ('/' !== $this->base && '' !== $this->base && 0 === strpos($this->url, $this->base)) { if ($this->base !== '/' && $this->base !== '' && strpos($this->url, $this->base) === 0) {
$this->url = substr($this->url, \strlen($this->base)); $this->url = substr($this->url, \strlen($this->base));
} }
@ -203,9 +203,10 @@ class Request
} }
// Check for JSON input // Check for JSON input
if (0 === strpos($this->type, 'application/json')) { if (strpos($this->type, 'application/json') === 0) {
$body = $this->getBody(); $body = $this->getBody();
if ('' !== $body) {
if ($body !== '') {
$data = json_decode($body, true); $data = json_decode($body, true);
if (is_array($data)) { if (is_array($data)) {
$this->data->setData($data); $this->data->setData($data);
@ -225,14 +226,17 @@ class Request
{ {
$body = $this->body; $body = $this->body;
if ('' !== $body) { if ($body !== '') {
return $body; return $body;
} }
$method = self::getMethod(); switch (self::getMethod()) {
case 'POST':
if ('POST' === $method || 'PUT' === $method || 'DELETE' === $method || 'PATCH' === $method) { case 'PUT':
$body = file_get_contents($this->stream_path); case 'DELETE':
case 'PATCH':
$body = file_get_contents($this->stream_path);
break;
} }
$this->body = $body; $this->body = $body;
@ -277,7 +281,8 @@ class Request
foreach ($forwarded as $key) { foreach ($forwarded as $key) {
if (\array_key_exists($key, $_SERVER)) { if (\array_key_exists($key, $_SERVER)) {
sscanf($_SERVER[$key], '%[^,]', $ip); sscanf($_SERVER[$key], '%[^,]', $ip);
if (false !== filter_var($ip, \FILTER_VALIDATE_IP, $flags)) {
if (filter_var($ip, \FILTER_VALIDATE_IP, $flags) !== false) {
return $ip; return $ip;
} }
} }
@ -321,13 +326,15 @@ class Request
public static function getHeaders(): array public static function getHeaders(): array
{ {
$headers = []; $headers = [];
foreach ($_SERVER as $key => $value) { foreach ($_SERVER as $key => $value) {
if (0 === strpos($key, 'HTTP_')) { if (strpos($key, 'HTTP_') === 0) {
// converts headers like HTTP_CUSTOM_HEADER to Custom-Header // converts headers like HTTP_CUSTOM_HEADER to Custom-Header
$key = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5))))); $key = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
$headers[$key] = $value; $headers[$key] = $value;
} }
} }
return $headers; return $headers;
} }
@ -336,10 +343,8 @@ class Request
* *
* @param string $header Header name. Can be caps, lowercase, or mixed. * @param string $header Header name. Can be caps, lowercase, or mixed.
* @param string $default Default value if the header does not exist * @param string $default Default value if the header does not exist
*
* @return string
*/ */
public static function header(string $header, $default = '') public static function header(string $header, $default = ''): string
{ {
return self::getHeader($header, $default); return self::getHeader($header, $default);
} }
@ -354,21 +359,13 @@ class Request
return self::getHeaders(); return self::getHeaders();
} }
/** /** Gets the full request URL. */
* Gets the full request URL.
*
* @return string URL
*/
public function getFullUrl(): string public function getFullUrl(): string
{ {
return $this->scheme . '://' . $this->host . $this->url; return $this->scheme . '://' . $this->host . $this->url;
} }
/** /** Grabs the scheme and host. Does not end with a / */
* Grabs the scheme and host. Does not end with a /
*
* @return string
*/
public function getBaseUrl(): string public function getBaseUrl(): string
{ {
return $this->scheme . '://' . $this->host; return $this->scheme . '://' . $this->host;
@ -396,18 +393,18 @@ class Request
/** /**
* Gets the URL Scheme * Gets the URL Scheme
* *
* @return string 'http'|'https' * @return 'http'|'https'
*/ */
public static function getScheme(): string public static function getScheme(): string
{ {
if ( if (
(isset($_SERVER['HTTPS']) && 'on' === strtolower($_SERVER['HTTPS'])) (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on')
|| ||
(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO']) (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
|| ||
(isset($_SERVER['HTTP_FRONT_END_HTTPS']) && 'on' === $_SERVER['HTTP_FRONT_END_HTTPS']) (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && $_SERVER['HTTP_FRONT_END_HTTPS'] === 'on')
|| ||
(isset($_SERVER['REQUEST_SCHEME']) && 'https' === $_SERVER['REQUEST_SCHEME']) (isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] === 'https')
) { ) {
return 'https'; return 'https';
} }

@ -139,7 +139,7 @@ class Response
*/ */
public function status(?int $code = null) public function status(?int $code = null)
{ {
if (null === $code) { if ($code === null) {
return $this->status; return $this->status;
} }
@ -263,19 +263,22 @@ class Response
*/ */
public function cache($expires): self public function cache($expires): self
{ {
if (false === $expires) { if ($expires === false) {
$this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; $this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
$this->headers['Cache-Control'] = [ $this->headers['Cache-Control'] = [
'no-store, no-cache, must-revalidate', 'no-store, no-cache, must-revalidate',
'post-check=0, pre-check=0', 'post-check=0, pre-check=0',
'max-age=0', 'max-age=0',
]; ];
$this->headers['Pragma'] = 'no-cache'; $this->headers['Pragma'] = 'no-cache';
} else { } else {
$expires = \is_int($expires) ? $expires : strtotime($expires); $expires = \is_int($expires) ? $expires : strtotime($expires);
$this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT'; $this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT';
$this->headers['Cache-Control'] = 'max-age=' . ($expires - time()); $this->headers['Cache-Control'] = 'max-age=' . ($expires - time());
if (isset($this->headers['Pragma']) && 'no-cache' == $this->headers['Pragma']) {
if (isset($this->headers['Pragma']) && $this->headers['Pragma'] === 'no-cache') {
unset($this->headers['Pragma']); unset($this->headers['Pragma']);
} }
} }
@ -291,7 +294,7 @@ class Response
public function sendHeaders(): self public function sendHeaders(): self
{ {
// Send status code header // Send status code header
if (false !== strpos(\PHP_SAPI, 'cgi')) { if (strpos(\PHP_SAPI, 'cgi') !== false) {
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$this->setRealHeader( $this->setRealHeader(
sprintf( sprintf(

@ -95,7 +95,7 @@ class Route
public function matchUrl(string $url, bool $case_sensitive = false): bool public function matchUrl(string $url, bool $case_sensitive = false): bool
{ {
// Wildcard or exact match // Wildcard or exact match
if ('*' === $this->pattern || $this->pattern === $url) { if ($this->pattern === '*' || $this->pattern === $url) {
return true; return true;
} }
@ -110,8 +110,9 @@ class Route
for ($i = 0; $i < $len; $i++) { for ($i = 0; $i < $len; $i++) {
if ($url[$i] === '/') { if ($url[$i] === '/') {
$n++; ++$n;
} }
if ($n === $count) { if ($n === $count) {
break; break;
} }
@ -136,24 +137,20 @@ class Route
$regex $regex
); );
if ('/' === $last_char) { // Fix trailing slash $regex .= $last_char === '/' ? '?' : '/?';
$regex .= '?';
} else { // Allow trailing slash
$regex .= '/?';
}
// Attempt to match route and named parameters // Attempt to match route and named parameters
if (preg_match('#^' . $regex . '(?:\?[\s\S]*)?$#' . (($case_sensitive) ? '' : 'i'), $url, $matches)) { if (!preg_match('#^' . $regex . '(?:\?[\s\S]*)?$#' . (($case_sensitive) ? '' : 'i'), $url, $matches)) {
foreach ($ids as $k => $v) { return false;
$this->params[$k] = (\array_key_exists($k, $matches)) ? urldecode($matches[$k]) : null; }
}
$this->regex = $regex;
return true; foreach (array_keys($ids) as $k) {
$this->params[$k] = (\array_key_exists($k, $matches)) ? urldecode($matches[$k]) : null;
} }
return false; $this->regex = $regex;
return true;
} }
/** /**

@ -96,7 +96,7 @@ class Router
$methods = ['*']; $methods = ['*'];
if (false !== strpos($url, ' ')) { if (strpos($url, ' ') !== false) {
[$method, $url] = explode(' ', $url, 2); [$method, $url] = explode(' ', $url, 2);
$url = trim($url); $url = trim($url);
$methods = explode('|', $method); $methods = explode('|', $method);
@ -211,10 +211,12 @@ class Router
public function route(Request $request) public function route(Request $request)
{ {
$url_decoded = urldecode($request->url); $url_decoded = urldecode($request->url);
while ($route = $this->current()) { while ($route = $this->current()) {
if ($route->matchMethod($request->method) && $route->matchUrl($url_decoded, $this->case_sensitive)) { if ($route->matchMethod($request->method) && $route->matchUrl($url_decoded, $this->case_sensitive)) {
return $route; return $route;
} }
$this->next(); $this->next();
} }

@ -88,7 +88,7 @@ class View
*/ */
public function clear(?string $key = null): self public function clear(?string $key = null): self
{ {
if (null === $key) { if ($key === null) {
$this->vars = []; $this->vars = [];
} else { } else {
unset($this->vars[$key]); unset($this->vars[$key]);
@ -169,7 +169,7 @@ class View
$is_windows = \strtoupper(\substr(PHP_OS, 0, 3)) === 'WIN'; $is_windows = \strtoupper(\substr(PHP_OS, 0, 3)) === 'WIN';
if (('/' == \substr($file, 0, 1)) || ($is_windows === true && ':' == \substr($file, 1, 1))) { if ((\substr($file, 0, 1) === '/') || ($is_windows && \substr($file, 1, 1) === ':')) {
return $file; return $file;
} }

@ -95,7 +95,7 @@ class Collection implements ArrayAccess, Iterator, Countable, JsonSerializable
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function offsetSet($offset, $value): void public function offsetSet($offset, $value): void
{ {
if (null === $offset) { if ($offset === null) {
$this->data[] = $value; $this->data[] = $value;
} else { } else {
$this->data[$offset] = $value; $this->data[$offset] = $value;
@ -166,9 +166,7 @@ class Collection implements ArrayAccess, Iterator, Countable, JsonSerializable
*/ */
public function valid(): bool public function valid(): bool
{ {
$key = key($this->data); return key($this->data) !== null;
return null !== $key;
} }
/** /**

@ -3,7 +3,6 @@
declare(strict_types=1); declare(strict_types=1);
// This file is only here so that the PHP8 attribute for doesn't throw an error in files // This file is only here so that the PHP8 attribute for doesn't throw an error in files
// phpcs:ignoreFile PSR1.Classes.ClassDeclaration.MissingNamespace
class ReturnTypeWillChange class ReturnTypeWillChange
{ {
} }

@ -18,31 +18,34 @@
<exclude name="Generic.PHP.UpperCaseConstant.Found" /> <exclude name="Generic.PHP.UpperCaseConstant.Found" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" /> <exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
<exclude name="Generic.Files.EndFileNoNewline.Found" /> <exclude name="Generic.Files.EndFileNoNewline.Found" />
<exclude name="Generic.Files.LowercasedFilename.NotFound" />
<exclude name="Generic.Commenting.DocComment.TagValueIndent" /> <exclude name="Generic.Commenting.DocComment.TagValueIndent" />
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" /> <exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" /> <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<exclude name="Generic.Files.LowercasedFilename.NotFound" /> <exclude name="Generic.Commenting.DocComment.ContentAfterOpen" />
<exclude name="Generic.Commenting.DocComment.ContentBeforeClose" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Commenting.DocComment.SpacingBeforeShort" />
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" /> <exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" /> <exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
<exclude name="Generic.Formatting.SpaceAfterNot.Incorrect" />
<exclude name="Generic.Commenting.DocComment.SpacingBeforeShort" />
<exclude name="Generic.Commenting.DocComment.ContentAfterOpen" />
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine" /> <exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine" />
<exclude name="Generic.PHP.DisallowRequestSuperglobal.Found" /> <exclude name="Generic.PHP.DisallowRequestSuperglobal.Found" />
<exclude name="Generic.Commenting.DocComment.ContentBeforeClose" />
<exclude name="Generic.ControlStructures.DisallowYodaConditions.Found" />
<exclude name="Generic.Strings.UnnecessaryStringConcat.Found" />
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags" />
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen" />
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose" />
</rule> </rule>
<rule ref="Generic.Files.LineLength"> <rule ref="Generic.Files.LineLength">
<properties> <properties>
<property name="ignoreComments" value="true" /> <property name="ignoreComments" value="true" />
</properties> </properties>
</rule> </rule>
<rule ref="Generic.Formatting.SpaceAfterNot">
<properties>
<property name="spacing" value="0" />
</properties>
</rule>
<rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<file>flight/</file> <file>flight/</file>
<file>tests/</file> <file>tests/</file>
<exclude-pattern>tests/views/*</exclude-pattern> <exclude-pattern>tests/views/*</exclude-pattern>

@ -21,7 +21,7 @@ class RedirectTest extends TestCase
public function getBaseUrl($base, $url) public function getBaseUrl($base, $url)
{ {
if ('/' !== $base && false === strpos($url, '://')) { if ($base !== '/' && strpos($url, '://') === false) {
$url = preg_replace('#/+#', '/', $base . '/' . $url); $url = preg_replace('#/+#', '/', $base . '/' . $url);
} }
@ -67,11 +67,7 @@ class RedirectTest extends TestCase
public function testBaseOverride() public function testBaseOverride()
{ {
$url = 'login'; $url = 'login';
if (null !== $this->app->get('flight.base_url')) { $base = $this->app->get('flight.base_url') ?? $this->app->request()->base;
$base = $this->app->get('flight.base_url');
} else {
$base = $this->app->request()->base;
}
self::assertEquals('/testdir/login', $this->getBaseUrl($base, $url)); self::assertEquals('/testdir/login', $this->getBaseUrl($base, $url));
} }

Loading…
Cancel
Save