-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeff Roedel
committed
Jul 19, 2022
1 parent
79ef8b9
commit 9015a68
Showing
1 changed file
with
21 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |