SendgridApiService   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bindHook() 0 4 1
A bind() 0 6 1
1
<?php
2
3
namespace Swm\Bundle\MailHookBundle\ApiService;
4
5
use Swm\Bundle\MailHookBundle\Hook\DefaultHook;
6
7
class SendgridApiService extends BaseApiService
8
{
9
    /**
10
     * @param  array  $hook
11
     * @return HookInterface
12
     */
13
    private function bindHook(array $hook)
14
    {
15
        return new DefaultHook($hook['event'], $hook['email'], 'sendgrid', $hook);
0 ignored issues
show
Bug introduced by
The call to DefaultHook::__construct() misses a required argument $eventDispatched.

This check looks for function calls that miss required arguments.

Loading history...
16
    }
17
18
    /**
19
     * @return array<HookInterface>
20
     */
21
    public function bind()
22
    {
23
        $metaData = json_decode($this->request->getContent(), true);
24
25
        return array_map(array($this, 'bindHook'), $metaData);
26
    }
27
}
28