Skip to content

Commit

Permalink
Code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Roedel committed Jul 19, 2022
1 parent 79ef8b9 commit 9015a68
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions src/Service/CountriesFactory.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
<?php
namespace JTranslate\Service;

use Laminas\ServiceManager\Factory\FactoryInterface;
use Interop\Container\ContainerInterface;
use Laminas\Json\Json;
use JTranslate\Model\CountriesInfo;

/**
* Factory responsible of priming the CountriesInfo service
*
* @author Jeff Roedel <jeff.roedel@schoenstatt-fathers.org>
*/
class CountriesFactory implements FactoryInterface
{
/**
* Create an object
*
* @inheritdoc
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$countries = Json::decode(file_get_contents("vendor/mledoze/countries/dist/countries.json"));
$obj = new CountriesInfo($countries);
return $obj;
}
}
<?php

declare(strict_types=1);

namespace JTranslate\Service;

use JTranslate\Model\CountriesInfo;
use Laminas\Json\Json;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;

use function file_get_contents;

class CountriesFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$countries = Json::decode(file_get_contents("vendor/mledoze/countries/dist/countries.json"));
return new CountriesInfo($countries);
}
}

0 comments on commit 9015a68

Please sign in to comment.