-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleIntegrator.php
More file actions
52 lines (44 loc) · 945 Bytes
/
ModuleIntegrator.php
File metadata and controls
52 lines (44 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* Class Loader
*
* @since 1.0.0
* @package Translationmanager\Module
*/
namespace Translationmanager\Module;
use Traversable;
/**
* Class Loader
*
* @package Translationmanager\Module
*/
class ModuleIntegrator
{
const POST_DATA_NAMESPACE = 'POST';
/**
* @var array
*/
private $modulesProvider;
/**
* Loader constructor
*
* @param Traversable $modulesProvider
*/
public function __construct(Traversable $modulesProvider)
{
$this->modulesProvider = $modulesProvider;
}
/**
* Register the integrations instances
*/
public function integrate()
{
/** @var Integrable $moduleInstance */
foreach ($this->modulesProvider as $pluginFilePath => $moduleInstance) {
if (!$moduleInstance instanceof Integrable) {
continue;
}
$moduleInstance->integrate();
}
}
}