Passed
Push — master ( d57c11...8c6e4f )
by Joao
03:16 queued 36s
created

BaseWrapper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 23
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A validate() 0 10 3
1
<?php
2
/**
3
 * User: jg
4
 * Date: 28/05/17
5
 * Time: 12:31
6
 */
7
8
namespace ByJG\Mail\Wrapper;
9
10
use ByJG\Mail\Envelope;
11
use ByJG\Util\Uri;
12
13
abstract class BaseWrapper implements MailWrapperInterface
14
{
15
    /**
16
     * @var \ByJG\Util\Uri
17
     */
18
    protected $uri = null;
19
20 14
    public function __construct(Uri $uri)
21
    {
22 14
        $this->uri = $uri;
23 14
    }
24
25 12
    public function validate(Envelope $envelope)
26
    {
27 12
        if (0 === count($envelope->getTo())) {
28
            throw new \Exception("Destination Email was not provided");
29
        }
30
31 12
        if ($envelope->getFrom() == "") {
32
            throw new \Exception("From email was not provided");
33
        }
34 12
    }
35
}
36