ListenerBuilder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 12 1
A getVerifier() 0 6 1
A getEventDispatcher() 0 4 1
getMessageFactory() 0 1 ?
getService() 0 1 ?
1
<?php
2
3
namespace Mdb\PayPal\Ipn;
4
5
use Symfony\Component\EventDispatcher\EventDispatcher;
6
7
abstract class ListenerBuilder
8
{
9
    public function build() : Listener
10
    {
11
        $verifier = $this->getVerifier();
12
        $messageFactory = $this->getMessageFactory();
13
        $eventDispatcher = $this->getEventDispatcher();
14
15
        return new Listener(
16
            $messageFactory,
17
            $verifier,
18
            $eventDispatcher
19
        );
20
    }
21
22
    private function getVerifier() : Verifier
23
    {
24
        $service = $this->getService();
25
26
        return new Verifier($service);
27
    }
28
29
    private function getEventDispatcher() : EventDispatcher
30
    {
31
        return new EventDispatcher();
32
    }
33
34
    abstract protected function getMessageFactory() : MessageFactory;
35
36
    abstract protected function getService() : Service;
37
}
38