Nexmo::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
1
<?php
2
3
namespace DoS\SMSBundle\SMS\Provider;
4
5
use DoS\SMSBundle\SMS\ProviderInterface;
6
use SmsSender\HttpAdapter\HttpAdapterInterface;
7
use SmsSender\Provider\NexmoProvider;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
10
class Nexmo extends NexmoProvider implements ProviderInterface
11
{
12
    use ProviderTrait;
13
14
    public function __construct(HttpAdapterInterface $adapter, $api_key, $api_secret, $international_prefix = '+66')
15
    {
16
        $this->validateOptions(array(
17
            'api_key' => $api_key,
18
            'api_secret' => $api_secret,
19
            'international_prefix' => $international_prefix,
20
        ));
21
22
        parent::__construct($adapter, $api_key, $api_secret, $international_prefix);
23
    }
24
25
    public function configureOptions(OptionsResolver $resolver)
26
    {
27
        $resolver->setDefaults(array(
28
            'api_key' => null,
29
            'api_secret' => null,
30
            'international_prefix' => '+66',
31
        ));
32
33
        $resolver->setRequired(array(
34
            'api_key',
35
            'api_secret',
36
        ));
37
    }
38
}
39