mirror of
https://github.com/friendica/friendica
synced 2025-04-22 01:10:13 +00:00
Fix errors in Module namespace
This commit is contained in:
parent
650e65d4b4
commit
b35c45bf5a
9 changed files with 79 additions and 59 deletions
|
@ -7,12 +7,14 @@
|
|||
|
||||
namespace Friendica\Module\Special;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\App\Arguments;
|
||||
use Friendica\App\Request;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Model\UserSession;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException as NetworkHTTPException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
@ -26,7 +28,7 @@ class HTTPException
|
|||
protected $l10n;
|
||||
/** @var LoggerInterface */
|
||||
protected $logger;
|
||||
/** @var App\Arguments */
|
||||
/** @var Arguments */
|
||||
protected $args;
|
||||
/** @var bool */
|
||||
protected $isSiteAdmin;
|
||||
|
@ -35,7 +37,7 @@ class HTTPException
|
|||
/** @var string */
|
||||
protected $requestId;
|
||||
|
||||
public function __construct(L10n $l10n, LoggerInterface $logger, App\Arguments $args, UserSession $session, App\Request $request, array $server = [])
|
||||
public function __construct(L10n $l10n, LoggerInterface $logger, Arguments $args, UserSession $session, Request $request, array $server = [])
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->l10n = $l10n;
|
||||
|
@ -50,11 +52,9 @@ class HTTPException
|
|||
*
|
||||
* Fills in the blanks if title or descriptions aren't provided by the exception.
|
||||
*
|
||||
* @param \Friendica\Network\HTTPException $e
|
||||
*
|
||||
* @return array ['$title' => ..., '$description' => ...]
|
||||
*/
|
||||
private function getVars(\Friendica\Network\HTTPException $e)
|
||||
private function getVars(NetworkHTTPException $e)
|
||||
{
|
||||
// Explanations are mostly taken from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
$vars = [
|
||||
|
@ -76,11 +76,9 @@ class HTTPException
|
|||
/**
|
||||
* Displays a bare message page with no theming at all.
|
||||
*
|
||||
* @param \Friendica\Network\HTTPException $e
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function rawContent(\Friendica\Network\HTTPException $e)
|
||||
public function rawContent(NetworkHTTPException $e)
|
||||
{
|
||||
$content = '';
|
||||
|
||||
|
@ -101,8 +99,9 @@ class HTTPException
|
|||
|
||||
// We can't use a constructor parameter for this response object because we
|
||||
// are in an Exception context where we don't want an existing Response.
|
||||
$reason = ($e instanceof NetworkHTTPException) ? $e->getDescription() : $e->getMessage();
|
||||
$response = new Response();
|
||||
$response->setStatus($e->getCode(), $e->getDescription());
|
||||
$response->setStatus($e->getCode(), $reason);
|
||||
$response->addContent($content);
|
||||
System::echoResponse($response->generate());
|
||||
System::exit();
|
||||
|
@ -111,12 +110,10 @@ class HTTPException
|
|||
/**
|
||||
* Returns a content string that can be integrated in the current theme.
|
||||
*
|
||||
* @param \Friendica\Network\HTTPException $e
|
||||
*
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function content(\Friendica\Network\HTTPException $e): string
|
||||
public function content(NetworkHTTPException $e): string
|
||||
{
|
||||
if ($e->getCode() >= 400) {
|
||||
$this->logger->debug('Exit with error',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue