Completed
Pull Request — master (#366)
by Beñat
14:40
created

NotificationBody   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A body() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\Notifier\Domain\Model\Inbox;
16
17
class NotificationBody
18
{
19
    private $body;
20
21
    public function __construct(string $body)
22
    {
23
        if ('' === $body) {
24
            throw new NotificationBodyIsEmpty($body);
0 ignored issues
show
Unused Code introduced by
The call to NotificationBodyIsEmpty::__construct() has too many arguments starting with $body.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
25
        }
26
        $this->body = $body;
27
    }
28
29
    public function body() : string
30
    {
31
        return $this->body;
32
    }
33
34
    public function __toString() : string
35
    {
36
        return (string) $this->body;
37
    }
38
}
39