diff --git a/app/views/main-menu.php b/app/views/main-menu.php
index c6b45276..42d40d66 100644
--- a/app/views/main-menu.php
+++ b/app/views/main-menu.php
@@ -5,13 +5,13 @@ namespace Aviat\AnimeClient;
$whose = $config->get('whose_list') . "'s ";
$lastSegment = $urlGenerator->lastSegment();
$extraSegment = $lastSegment === 'list' ? '/list' : '';
-$hasAnime = stripos($GLOBALS['_SERVER']['REQUEST_URI'], 'anime') !== FALSE;
-$hasManga = stripos($GLOBALS['_SERVER']['REQUEST_URI'], 'manga') !== FALSE;
+$hasAnime = str_contains($GLOBALS['_SERVER']['REQUEST_URI'], 'anime');
+$hasManga = str_contains($GLOBALS['_SERVER']['REQUEST_URI'], 'manga');
?>
-
+
= $helper->a(
$urlGenerator->defaultUrl($url_type),
$whose . ucfirst($url_type) . ' List',
diff --git a/src/AnimeClient/API/APIRequestBuilder.php b/src/AnimeClient/API/APIRequestBuilder.php
index 631b43a6..00bcffa5 100644
--- a/src/AnimeClient/API/APIRequestBuilder.php
+++ b/src/AnimeClient/API/APIRequestBuilder.php
@@ -272,7 +272,7 @@ abstract class APIRequestBuilder {
throw new InvalidArgumentException('Invalid HTTP method');
}
- $realUrl = (strpos($uri, '//') !== FALSE)
+ $realUrl = (str_contains($uri, '//'))
? $uri
: $this->baseUrl . $uri;
@@ -297,7 +297,7 @@ abstract class APIRequestBuilder {
*/
private function buildUri(): Request
{
- $url = (strpos($this->path, '//') !== FALSE)
+ $url = (str_contains($this->path, '//'))
? $this->path
: $this->baseUrl . $this->path;
@@ -314,11 +314,11 @@ abstract class APIRequestBuilder {
/**
* Reset the class state for a new request
*
- * @param string $url
+ * @param string|null $url
* @param string $type
* @return void
*/
- private function resetState($url, $type = 'GET'): void
+ private function resetState(?string $url, $type = 'GET'): void
{
$requestUrl = $url ?: $this->baseUrl;
diff --git a/src/AnimeClient/Controller.php b/src/AnimeClient/Controller.php
index 3f6a1cc3..f96318d8 100644
--- a/src/AnimeClient/Controller.php
+++ b/src/AnimeClient/Controller.php
@@ -141,7 +141,7 @@ class Controller {
$util = $this->container->get('util');
$doubleFormPage = $serverParams['HTTP_REFERER'] === $this->request->getUri();
- $isLoginPage = (bool) strpos($serverParams['HTTP_REFERER'], 'login');
+ $isLoginPage = str_contains($serverParams['HTTP_REFERER'], 'login');
// Don't attempt to set the redirect url if
// the page is one of the form type pages,
@@ -198,9 +198,6 @@ class Controller {
* @param HtmlView $view
* @param string $template
* @param array $data
- * @throws InvalidArgumentException
- * @throws ContainerException
- * @throws NotFoundException
* @return string
*/
protected function loadPartial(HtmlView $view, string $template, array $data = []): string
@@ -233,8 +230,6 @@ class Controller {
* @param string $template
* @param array $data
* @return HtmlView
- * @throws ContainerException
- * @throws NotFoundException
*/
protected function renderFullPage(HtmlView $view, string $template, array $data): HtmlView
{
diff --git a/src/AnimeClient/Controller/Anime.php b/src/AnimeClient/Controller/Anime.php
index d5503e24..90aa63c5 100644
--- a/src/AnimeClient/Controller/Anime.php
+++ b/src/AnimeClient/Controller/Anime.php
@@ -251,7 +251,7 @@ final class Anime extends BaseController {
{
$this->checkAuth();
- if (stripos($this->request->getHeader('content-type')[0], 'application/json') !== FALSE)
+ if (str_contains($this->request->getHeader('content-type')[0], 'application/json'))
{
$data = Json::decode((string)$this->request->getBody());
}
diff --git a/src/AnimeClient/Controller/Manga.php b/src/AnimeClient/Controller/Manga.php
index 049be5a1..d0aa83ce 100644
--- a/src/AnimeClient/Controller/Manga.php
+++ b/src/AnimeClient/Controller/Manga.php
@@ -251,7 +251,7 @@ final class Manga extends Controller {
{
$this->checkAuth();
- if (stripos($this->request->getHeader('content-type')[0], 'application/json') !== FALSE)
+ if (str_contains($this->request->getHeader('content-type')[0], 'application/json'))
{
$data = Json::decode((string)$this->request->getBody());
}
diff --git a/src/AnimeClient/Helper/Picture.php b/src/AnimeClient/Helper/Picture.php
index 75dc0038..32334ebd 100644
--- a/src/AnimeClient/Helper/Picture.php
+++ b/src/AnimeClient/Helper/Picture.php
@@ -68,12 +68,12 @@ final class Picture {
// If it is a placeholder image, make the
// fallback a png, not a jpg
- if (strpos($uri, 'placeholder') !== FALSE)
+ if (str_contains($uri, 'placeholder'))
{
$fallbackExt = 'png';
}
- if (strpos($uri, '//') === FALSE)
+ if ( ! str_contains($uri, '//'))
{
$uri = $urlGenerator->assetUrl($uri);
}