Passed
Pull Request — master (#6)
by
unknown
03:19
created

VariableResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 21
ccs 0
cts 6
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 11 2
1
<?php
2
3
namespace Slides\Connector\Auth\Clients\Mandrill;
4
5
use Exception;
6
7
/**
8
 * Class VariableResolver
9
 *
10
 * @package Slides\Connector\Auth\Clients\Mandrill
11
 */
12
class VariableResolver
13
{
14
    /**
15
     * @param string $name
16
     * @param string $email
17
     *
18
     * @return array
19
     *
20
     * @throws Exception
21
     */
22
    final public function resolve(string $name, string $email): array
23
    {
24
        $method = 'get' . ucfirst($name) . 'Variable';
25
26
        if (!method_exists($this, $method)) {
27
            throw new Exception('Method ' . $method . ' should be defined.');
28
        }
29
30
        return [
31
            'name' => $name,
32
            'content' => call_user_func([$this, $method], $email)
33
        ];
34
    }
35
}