mirror of
https://github.com/friendica/friendica
synced 2025-04-22 01:50:11 +00:00
Revert "Revert "Replace Module::init() with Constructors""
This reverts commit 89d6c89b67
.
This commit is contained in:
parent
942001b04d
commit
645e4edc63
43 changed files with 1226 additions and 922 deletions
|
@ -22,6 +22,7 @@
|
|||
namespace Friendica;
|
||||
|
||||
use Friendica\Capabilities\ICanHandleRequests;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Model\User;
|
||||
|
||||
|
@ -39,16 +40,33 @@ abstract class BaseModule implements ICanHandleRequests
|
|||
/** @var array */
|
||||
protected $parameters = [];
|
||||
|
||||
public function __construct(array $parameters = [])
|
||||
/** @var L10n */
|
||||
protected $l10n;
|
||||
|
||||
public function __construct(L10n $l10n, array $parameters = [])
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
$this->l10n = $l10n;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Wraps the L10n::t() function for Modules
|
||||
*
|
||||
* @see L10n::t()
|
||||
*/
|
||||
public function init()
|
||||
protected function t(string $s, ...$args): string
|
||||
{
|
||||
return $this->l10n->t($s, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the L10n::tt() function for Modules
|
||||
*
|
||||
* @see L10n::tt()
|
||||
*/
|
||||
protected function tt(string $singular, string $plurarl, int $count): string
|
||||
{
|
||||
return $this->l10n->tt($singular, $plurarl, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue