1 | <?php |
||
12 | class BaristaFactory implements FactoryInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var AssetManifestFactory |
||
16 | */ |
||
17 | private $manifest_factory; |
||
18 | |||
19 | /** |
||
20 | * @var BaristaInterface[] |
||
21 | */ |
||
22 | private static $baristas = []; |
||
23 | |||
24 | /** |
||
25 | * @var LoaderInterface $loader |
||
26 | */ |
||
27 | protected $loader; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * BaristaFactory constructor. |
||
32 | * |
||
33 | * @param AssetManifestFactory $manifest_factory |
||
34 | * @param LoaderInterface $loader |
||
35 | */ |
||
36 | public function __construct(AssetManifestFactory $manifest_factory, LoaderInterface $loader) |
||
41 | |||
42 | |||
43 | /** |
||
44 | * @param string $domain_fqcn |
||
45 | * @return BaristaInterface |
||
46 | */ |
||
47 | public function createFromDomainClass($domain_fqcn) |
||
53 | |||
54 | |||
55 | /** |
||
56 | * @param DomainInterface $domain |
||
57 | * @return BaristaInterface |
||
58 | */ |
||
59 | public function createFromDomainObject(DomainInterface $domain) |
||
64 | |||
65 | |||
66 | /** |
||
67 | * @param string $domain_fqcn Fully Qualified Class Name for the applicable DomainInterface class |
||
68 | * @param array $domain_arguments arguments required by the applicable DomainInterface class |
||
69 | * @return BaristaInterface |
||
70 | */ |
||
71 | public function create($domain_fqcn = '', array $domain_arguments = []) |
||
77 | |||
78 | |||
79 | /** |
||
80 | * @param AssetManifestInterface $asset_manifest |
||
81 | * @param DomainInterface $domain |
||
82 | * @return BaristaInterface |
||
83 | */ |
||
84 | private function getBaristaForDomain(AssetManifestInterface $asset_manifest, DomainInterface $domain) |
||
95 | |||
96 | |||
97 | /** |
||
98 | * @param string $domain_fqcn Fully Qualified Class Name for the applicable DomainInterface class |
||
99 | * @param array $arguments |
||
100 | * @return DomainInterface |
||
101 | */ |
||
102 | private function getDomain($domain_fqcn, array $arguments = []) |
||
124 | } |
||
125 |