forked from Solire/conf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProcessTrait.php
36 lines (33 loc) · 933 Bytes
/
ProcessTrait.php
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
<?php
namespace Solire\Conf;
/**
* Gestionnaire des fichiers de configurations
*
* @author Adrien <[email protected]>
* @license MIT http://mit-license.org/
*/
trait ProcessTrait
{
/**
* Applique les processus demandé à la configuration
*
* @param array $processList Liste des processus à jouer
* @param \Solire\Conf\Conf $conf Configuration a éditer
* @return type
* @throws Exception si un process n'est pas callable
*/
protected static function applyProcess(array $processList, Conf $conf)
{
foreach ($processList as $process) {
$callBack = array_shift($process);
if (is_callable($callBack) === false) {
throw new Exception('callback is not callable');
}
call_user_func(
$callBack,
$conf,
$process
);
}
}
}