1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the smsmode-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2019 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\SMSModeBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\FileLocator; |
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
16
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
17
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* sMsmode extension. |
21
|
|
|
* |
22
|
|
|
* @author webeweb <https://github.com/webeweb/> |
23
|
|
|
* @package WBW\Bundle\SMSModeBundle\DependencyInjection |
24
|
|
|
*/ |
25
|
|
|
class WBWSMSModeExtension extends Extension { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* {@inheritDoc} |
29
|
|
|
*/ |
30
|
|
|
public function getAlias(){ |
31
|
|
|
return "wbw_smsmode"; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* {@inheritdoc} |
36
|
|
|
*/ |
37
|
|
|
public function load(array $configs, ContainerBuilder $container) { |
38
|
|
|
|
39
|
|
|
$fileLocator = new FileLocator(__DIR__ . "/../Resources/config"); |
40
|
|
|
|
41
|
|
|
$serviceLoader = new YamlFileLoader($container, $fileLocator); |
42
|
|
|
$serviceLoader->load("services.yml"); |
43
|
|
|
|
44
|
|
|
$configuration = $this->getConfiguration($configs, $container); |
45
|
|
|
|
46
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
|
|
|
|
47
|
|
|
|
48
|
|
|
if (true === array_key_exists("authentication", $config)) { |
49
|
|
|
if (true === array_key_exists("access_token", $config["authentication"])) { |
50
|
|
|
$container->setParameter("smsmode.access_token", $config["authentication"]["access_token"]); |
51
|
|
|
} |
52
|
|
|
if (true === array_key_exists("pseudo", $config["authentication"])) { |
53
|
|
|
$container->setParameter("smsmode.pseudo", $config["authentication"]["pseudo"]); |
54
|
|
|
} |
55
|
|
|
if (true === array_key_exists("pass", $config["authentication"])) { |
56
|
|
|
$container->setParameter("smsmode.pass", $config["authentication"]["pass"]); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
if (true === $config["event_listeners"]) { |
61
|
|
|
$serviceLoader->load("event_listeners.yml"); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: