Moved translation helpers to sub namespace

This commit is contained in:
Igor Scheller 2019-07-08 01:31:59 +02:00
parent e9f157ec5c
commit f90ab26fee
14 changed files with 28 additions and 27 deletions

View File

@ -17,7 +17,7 @@ return [
\Engelsystem\Database\DatabaseServiceProvider::class,
\Engelsystem\Http\RequestServiceProvider::class,
\Engelsystem\Http\SessionServiceProvider::class,
\Engelsystem\Helpers\TranslationServiceProvider::class,
\Engelsystem\Helpers\Translation\TranslationServiceProvider::class,
\Engelsystem\Http\ResponseServiceProvider::class,
\Engelsystem\Http\Psr7ServiceProvider::class,
\Engelsystem\Helpers\AuthenticatorServiceProvider::class,

View File

@ -1,5 +1,6 @@
<?php
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Mail\EngelsystemMailer;
use Engelsystem\Models\User\User;
use Psr\Log\LogLevel;
@ -17,7 +18,7 @@ function engelsystem_email_to_user($recipientUser, $title, $message, $notIfItsMe
return true;
}
/** @var \Engelsystem\Helpers\Translator $translator */
/** @var Translator $translator */
$translator = app()->get('translator');
$locale = $translator->getLocale();

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Helpers;
namespace Engelsystem\Helpers\Translation;
use Engelsystem\Config\Config;
use Engelsystem\Container\ServiceProvider;

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Helpers;
namespace Engelsystem\Helpers\Translation;
class Translator
{

View File

@ -3,7 +3,7 @@
namespace Engelsystem\Middleware;
use Engelsystem\Helpers\Authenticator;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Http\Request;
use Engelsystem\Http\Response;
use Psr\Container\ContainerInterface;

View File

@ -2,7 +2,7 @@
namespace Engelsystem\Middleware;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;

View File

@ -2,7 +2,7 @@
namespace Engelsystem\Renderer\Twig\Extensions;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Twig_Extension as TwigExtension;
use Twig_Extensions_TokenParser_Trans as TranslationTokenParser;
use Twig_Filter as TwigFilter;

View File

@ -4,7 +4,7 @@
use Engelsystem\Application;
use Engelsystem\Config\Config;
use Engelsystem\Helpers\Authenticator;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Http\Request;
use Engelsystem\Http\Response;
use Engelsystem\Http\UrlGeneratorInterface;

View File

@ -1,10 +1,10 @@
<?php
namespace Engelsystem\Test\Unit\Helpers;
namespace Engelsystem\Test\Unit\Helpers\Translation;
use Engelsystem\Config\Config;
use Engelsystem\Helpers\TranslationServiceProvider;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\TranslationServiceProvider;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Session\Session;
@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Session\Session;
class TranslationServiceProviderTest extends ServiceProviderTest
{
/**
* @covers \Engelsystem\Helpers\TranslationServiceProvider::register()
* @covers \Engelsystem\Helpers\Translation\TranslationServiceProvider::register()
*/
public function testRegister()
{

View File

@ -1,8 +1,8 @@
<?php
namespace Engelsystem\Test\Unit\Helpers;
namespace Engelsystem\Test\Unit\Helpers\Translation;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit\Framework\MockObject\MockObject;
use stdClass;
@ -10,12 +10,12 @@ use stdClass;
class TranslatorTest extends ServiceProviderTest
{
/**
* @covers \Engelsystem\Helpers\Translator::__construct
* @covers \Engelsystem\Helpers\Translator::getLocale
* @covers \Engelsystem\Helpers\Translator::getLocales
* @covers \Engelsystem\Helpers\Translator::hasLocale
* @covers \Engelsystem\Helpers\Translator::setLocale
* @covers \Engelsystem\Helpers\Translator::setLocales
* @covers \Engelsystem\Helpers\Translation\Translator::__construct
* @covers \Engelsystem\Helpers\Translation\Translator::getLocale
* @covers \Engelsystem\Helpers\Translation\Translator::getLocales
* @covers \Engelsystem\Helpers\Translation\Translator::hasLocale
* @covers \Engelsystem\Helpers\Translation\Translator::setLocale
* @covers \Engelsystem\Helpers\Translation\Translator::setLocales
*/
public function testInit()
{
@ -47,8 +47,8 @@ class TranslatorTest extends ServiceProviderTest
}
/**
* @covers \Engelsystem\Helpers\Translator::replaceText
* @covers \Engelsystem\Helpers\Translator::translate
* @covers \Engelsystem\Helpers\Translation\Translator::replaceText
* @covers \Engelsystem\Helpers\Translation\Translator::translate
*/
public function testTranslate()
{
@ -70,7 +70,7 @@ class TranslatorTest extends ServiceProviderTest
}
/**
* @covers \Engelsystem\Helpers\Translator::translatePlural
* @covers \Engelsystem\Helpers\Translation\Translator::translatePlural
*/
public function testTranslatePlural()
{

View File

@ -6,7 +6,7 @@ use Engelsystem\Application;
use Engelsystem\Config\Config;
use Engelsystem\Container\Container;
use Engelsystem\Helpers\Authenticator;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Http\Request;
use Engelsystem\Http\Response;
use Engelsystem\Http\UrlGeneratorInterface;

View File

@ -3,7 +3,7 @@
namespace Engelsystem\Test\Unit\Middleware;
use Engelsystem\Helpers\Authenticator;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Http\Request;
use Engelsystem\Middleware\LegacyMiddleware;
use PHPUnit\Framework\MockObject\MockObject;

View File

@ -2,7 +2,7 @@
namespace Engelsystem\Test\Unit\Middleware;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Middleware\SetLocale;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

View File

@ -2,7 +2,7 @@
namespace Engelsystem\Test\Unit\Renderer\Twig\Extensions;
use Engelsystem\Helpers\Translator;
use Engelsystem\Helpers\Translation\Translator;
use Engelsystem\Renderer\Twig\Extensions\Translation;
use PHPUnit\Framework\MockObject\MockObject;
use Twig_Extensions_TokenParser_Trans as TranslationTokenParser;