fix: use same terminology
This commit is contained in:
		
							parent
							
								
									0efd5343e3
								
							
						
					
					
						commit
						a31b283847
					
				@ -31,7 +31,7 @@ services:
 | 
				
			|||||||
        arguments:
 | 
					        arguments:
 | 
				
			||||||
            $available_currencies: '%app.currencies%'
 | 
					            $available_currencies: '%app.currencies%'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    App\Service\StubQRCodeGenerator:
 | 
					    App\Service\StubQRCodeProvider:
 | 
				
			||||||
        arguments:
 | 
					        arguments:
 | 
				
			||||||
            $imagePath: '%kernel.project_dir%/assets/images/wip.png'
 | 
					            $imagePath: '%kernel.project_dir%/assets/images/wip.png'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -47,7 +47,7 @@ services:
 | 
				
			|||||||
            $retryCount: 2
 | 
					            $retryCount: 2
 | 
				
			||||||
            $retryWaitSeconds: 0.5
 | 
					            $retryWaitSeconds: 0.5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    App\Service\CachedQRCodeGenerator:
 | 
					    App\Service\CachedQRCodeProvider:
 | 
				
			||||||
        arguments:
 | 
					        arguments:
 | 
				
			||||||
            $innerGenerator: '@App\Service\Remote\UsetrenoQRCodeProvider'
 | 
					            $innerGenerator: '@App\Service\Remote\UsetrenoQRCodeProvider'
 | 
				
			||||||
            $cacheDuration: 'PT60S'
 | 
					            $cacheDuration: 'PT60S'
 | 
				
			||||||
@ -55,7 +55,7 @@ services:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    App\Service\CurrencyListerInterface: '@App\Service\StaticCurrencyLister'
 | 
					    App\Service\CurrencyListerInterface: '@App\Service\StaticCurrencyLister'
 | 
				
			||||||
    App\Service\QRCodeQROptionsProviderInterface: '@App\Service\QRCodeQROptionsDefaultProvider'
 | 
					    App\Service\QRCodeQROptionsProviderInterface: '@App\Service\QRCodeQROptionsDefaultProvider'
 | 
				
			||||||
    App\Service\QRCodeGeneratorInterface: '@App\Service\CachedQRCodeGenerator'
 | 
					    App\Service\QRCodeProviderInterface: '@App\Service\CachedQRCodeProvider'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # add more service definitions when explicit configuration is needed
 | 
					    # add more service definitions when explicit configuration is needed
 | 
				
			||||||
    # please note that last definitions always *replace* previous ones
 | 
					    # please note that last definitions always *replace* previous ones
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ namespace App\Controller;
 | 
				
			|||||||
use App\Entity\Input\QRCode\QRCode;
 | 
					use App\Entity\Input\QRCode\QRCode;
 | 
				
			||||||
use App\Form\Type\QRCodeType;
 | 
					use App\Form\Type\QRCodeType;
 | 
				
			||||||
use App\Service\DTO\QRCodeEntityConverter;
 | 
					use App\Service\DTO\QRCodeEntityConverter;
 | 
				
			||||||
use App\Service\QRCodeGeneratorInterface;
 | 
					use App\Service\QRCodeProviderInterface;
 | 
				
			||||||
use App\Service\QRCodeQROptionsProviderInterface;
 | 
					use App\Service\QRCodeQROptionsProviderInterface;
 | 
				
			||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 | 
					use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 | 
				
			||||||
use Symfony\Component\HttpFoundation\Request;
 | 
					use Symfony\Component\HttpFoundation\Request;
 | 
				
			||||||
@ -17,7 +17,7 @@ class IndexController extends AbstractController {
 | 
				
			|||||||
    #[Route('/', name: 'homepage')]
 | 
					    #[Route('/', name: 'homepage')]
 | 
				
			||||||
    public function indexAction(
 | 
					    public function indexAction(
 | 
				
			||||||
        Request                 $request,
 | 
					        Request                 $request,
 | 
				
			||||||
        QRCodeGeneratorInterface $qrCodeGenerator,
 | 
					        QRCodeProviderInterface $qrCodeGenerator,
 | 
				
			||||||
    ): Response
 | 
					    ): Response
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $qrCodeImage = null;
 | 
					        $qrCodeImage = null;
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ namespace App\Service;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Entity\DTO\QRCode\QRCode;
 | 
					use App\Entity\DTO\QRCode\QRCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface CacheableQRCodeGeneratorInterface extends QRCodeGeneratorInterface
 | 
					interface CacheableQRCodeProviderInterface extends QRCodeProviderInterface
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // We can't calculate cache key directly from QRCode
 | 
					    // We can't calculate cache key directly from QRCode
 | 
				
			||||||
    public function getCacheKey(QRCode $entity): string;
 | 
					    public function getCacheKey(QRCode $entity): string;
 | 
				
			||||||
@ -10,14 +10,14 @@ use Symfony\Contracts\Cache\CacheInterface;
 | 
				
			|||||||
use Symfony\Contracts\Cache\ItemInterface;
 | 
					use Symfony\Contracts\Cache\ItemInterface;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
final readonly class CachedQRCodeGenerator implements QRCodeGeneratorInterface
 | 
					final readonly class CachedQRCodeProvider implements QRCodeProviderInterface
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private \DateInterval $cacheDuration;
 | 
					    private \DateInterval $cacheDuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @throws Exception
 | 
					     * @throws Exception
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function __construct(private CacheableQRCodeGeneratorInterface $innerGenerator, private CacheInterface $cache, private LoggerInterface $logger, string $cacheDuration)
 | 
					    public function __construct(private CacheableQRCodeProviderInterface $innerGenerator, private CacheInterface $cache, private LoggerInterface $logger, string $cacheDuration)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->cacheDuration = new \DateInterval($cacheDuration);
 | 
					        $this->cacheDuration = new \DateInterval($cacheDuration);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -6,7 +6,7 @@ namespace App\Service;
 | 
				
			|||||||
use App\Entity\DTO\QRCode\QRCode;
 | 
					use App\Entity\DTO\QRCode\QRCode;
 | 
				
			||||||
use App\Service\Exception\QRCodeGeneratorException;
 | 
					use App\Service\Exception\QRCodeGeneratorException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface QRCodeGeneratorInterface
 | 
					interface QRCodeProviderInterface
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Generates QR code from entity
 | 
					     * Generates QR code from entity
 | 
				
			||||||
@ -4,7 +4,7 @@ declare(strict_types=1);
 | 
				
			|||||||
namespace App\Service\Remote;
 | 
					namespace App\Service\Remote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Entity\DTO\QRCode\QRCode;
 | 
					use App\Entity\DTO\QRCode\QRCode;
 | 
				
			||||||
use App\Service\CacheableQRCodeGeneratorInterface;
 | 
					use App\Service\CacheableQRCodeProviderInterface;
 | 
				
			||||||
use App\Service\Remote\Edge\QRCodeEntityConverter;
 | 
					use App\Service\Remote\Edge\QRCodeEntityConverter;
 | 
				
			||||||
use App\Service\Remote\Exception\UsetrenoQRCodeException;
 | 
					use App\Service\Remote\Exception\UsetrenoQRCodeException;
 | 
				
			||||||
use App\Service\Remote\Exception\UsetrenoQRCodeRemoteServerErrorException;
 | 
					use App\Service\Remote\Exception\UsetrenoQRCodeRemoteServerErrorException;
 | 
				
			||||||
@ -12,7 +12,7 @@ use Nubium\Exception\ThisShouldNeverHappenException;
 | 
				
			|||||||
use Psr\Log\LoggerInterface;
 | 
					use Psr\Log\LoggerInterface;
 | 
				
			||||||
use Symfony\Component\HttpClient\Exception\TransportException;
 | 
					use Symfony\Component\HttpClient\Exception\TransportException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class UsetrenoQRCodeProvider implements CacheableQRCodeGeneratorInterface
 | 
					class UsetrenoQRCodeProvider implements CacheableQRCodeProviderInterface
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    use RetryingFailClientTrait;
 | 
					    use RetryingFailClientTrait;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ namespace App\Service;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Entity\DTO\QRCode\QRCode;
 | 
					use App\Entity\DTO\QRCode\QRCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
readonly final class StubQRCodeGenerator implements QRCodeGeneratorInterface
 | 
					readonly final class StubQRCodeProvider implements QRCodeProviderInterface
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function __construct(private string $imagePath) {}
 | 
					    public function __construct(private string $imagePath) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -3,7 +3,7 @@ declare(strict_types=1);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Tests\Controller;
 | 
					namespace App\Tests\Controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Service\QRCodeGeneratorInterface;
 | 
					use App\Service\QRCodeProviderInterface;
 | 
				
			||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
 | 
					use Symfony\Bundle\FrameworkBundle\KernelBrowser;
 | 
				
			||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
 | 
					use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -76,7 +76,7 @@ class IndexControllerTest extends WebTestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function generateClientForSubmitTest(): KernelBrowser
 | 
					    private function generateClientForSubmitTest(): KernelBrowser
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $mock = $this->createMock(QRCodeGeneratorInterface::class);
 | 
					        $mock = $this->createMock(QRCodeProviderInterface::class);
 | 
				
			||||||
        $mock->expects($this->any())
 | 
					        $mock->expects($this->any())
 | 
				
			||||||
            ->method('generateQRCodeFromEntity')
 | 
					            ->method('generateQRCodeFromEntity')
 | 
				
			||||||
            ->will($this->returnValue('foo'));
 | 
					            ->will($this->returnValue('foo'));
 | 
				
			||||||
@ -85,7 +85,7 @@ class IndexControllerTest extends WebTestCase
 | 
				
			|||||||
        $client = static::createClient();
 | 
					        $client = static::createClient();
 | 
				
			||||||
        $client->disableReboot();
 | 
					        $client->disableReboot();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self::getContainer()->set('App\Service\QRCodeGeneratorInterface', $mock);
 | 
					        self::getContainer()->set('App\Service\QRCodeProviderInterface', $mock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $client;
 | 
					        return $client;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user