From c8316bfe573537f94772124d3a86a75f020a443e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 7 Oct 2019 16:16:42 -0400 Subject: [PATCH] Use Dice instantiation to access App\Arguments - Remove App->args accessors --- src/App.php | 10 ---------- src/BaseModule.php | 8 -------- src/Module/BaseSearchModule.php | 5 ++++- src/Module/Search/Index.php | 5 ++++- src/Module/Search/Saved.php | 8 ++++++-- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/App.php b/src/App.php index 8a36c3bfeb..c6ed818dd1 100644 --- a/src/App.php +++ b/src/App.php @@ -132,16 +132,6 @@ class App */ private $process; - /** - * Returns the arguments of the query - * - * @return Arguments - */ - public function getArgs() - { - return $this->args; - } - /** * Returns the current config cache of this node * diff --git a/src/BaseModule.php b/src/BaseModule.php index 76ed901110..5185771d1c 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -155,12 +155,4 @@ abstract class BaseModule extends BaseObject throw new \Friendica\Network\HTTPException\ForbiddenException(); } } - - /** - * @return App\Arguments - */ - protected static function getArgs() - { - return self::getApp()->getArgs(); - } } diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearchModule.php index 902f2e8a08..9766c000cc 100644 --- a/src/Module/BaseSearchModule.php +++ b/src/Module/BaseSearchModule.php @@ -2,6 +2,7 @@ namespace Friendica\Module; +use Friendica\App\Arguments; use Friendica\BaseModule; use Friendica\Content\ContactSelector; use Friendica\Content\Pager; @@ -63,7 +64,9 @@ class BaseSearchModule extends BaseModule $header = L10n::t('Forum Search - %s', $search); } - $pager = new Pager(self::getArgs()->getQueryString()); + /** @var Arguments $args */ + $args = self::getClass(Arguments::class); + $pager = new Pager($args->getQueryString()); if ($localSearch && empty($results)) { $pager->setItemsPerPage(80); diff --git a/src/Module/Search/Index.php b/src/Module/Search/Index.php index 93eeca90fe..8cd6448a27 100644 --- a/src/Module/Search/Index.php +++ b/src/Module/Search/Index.php @@ -2,6 +2,7 @@ namespace Friendica\Module\Search; +use Friendica\App\Arguments; use Friendica\Content\Nav; use Friendica\Content\Pager; use Friendica\Content\Text\HTML; @@ -125,7 +126,9 @@ class Index extends BaseSearchModule // OR your own posts if you are a logged in member // No items will be shown if the member has a blocked profile wall. - $pager = new Pager(self::getArgs()->getQueryString()); + /** @var Arguments $args */ + $args = self::getClass(Arguments::class); + $pager = new Pager($args->getQueryString()); if ($tag) { Logger::info('Start tag search for "' . $search . '"'); diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php index abd9cfa798..772f4782c2 100644 --- a/src/Module/Search/Saved.php +++ b/src/Module/Search/Saved.php @@ -2,6 +2,7 @@ namespace Friendica\Module\Search; +use Friendica\App\Arguments; use Friendica\BaseModule; use Friendica\Core\L10n; use Friendica\Database\DBA; @@ -11,8 +12,11 @@ class Saved extends BaseModule { public static function rawContent() { - $action = self::getArgs()->get(2, 'none'); - $search = Strings::escapeTags(trim(rawurldecode(self::getArgs()->get(3, '')))); + /** @var Arguments $args */ + $args = self::getClass(Arguments::class); + + $action = $args->get(2, 'none'); + $search = Strings::escapeTags(trim(rawurldecode($args->get(3, '')))); $return_url = $_GET['return_url'] ?? 'search?q=' . urlencode($search);