NullReactionTotal   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 11
c 1
b 0
f 0
dl 0
loc 48
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getCount() 0 3 1
A decrementWeight() 0 4 1
A incrementCount() 0 4 1
A incrementWeight() 0 4 1
A __construct() 0 4 1
A getReactant() 0 3 1
A decrementCount() 0 4 1
A getWeight() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Laravel Love.
5
 *
6
 * (c) Anton Komarev <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cog\Laravel\Love\Reactant\ReactionTotal\Models;
15
16
use Cog\Contracts\Love\Reactant\Models\Reactant as ReactantInterface;
17
use Cog\Contracts\Love\Reactant\ReactionTotal\Exceptions\ReactionTotalInvalid;
18
use Cog\Contracts\Love\Reactant\ReactionTotal\Models\ReactionTotal as ReactionTotalInterface;
19
20
final class NullReactionTotal implements
21
    ReactionTotalInterface
22
{
23
    private ReactantInterface $reactant;
24
25
    public function __construct(
26
        ReactantInterface $reactant,
27
    ) {
28
        $this->reactant = $reactant;
29
    }
30
31
    public function getReactant(): ReactantInterface
32
    {
33
        return $this->reactant;
34
    }
35
36
    public function getCount(): int
37
    {
38
        return 0;
39
    }
40
41
    public function getWeight(): float
42
    {
43
        return 0.0;
44
    }
45
46
    public function incrementCount(
47
        int $amount,
48
    ): void {
49
        throw ReactionTotalInvalid::notExists();
50
    }
51
52
    public function decrementCount(
53
        int $amount,
54
    ): void {
55
        throw ReactionTotalInvalid::notExists();
56
    }
57
58
    public function incrementWeight(
59
        float $amount,
60
    ): void {
61
        throw ReactionTotalInvalid::notExists();
62
    }
63
64
    public function decrementWeight(
65
        float $amount,
66
    ): void {
67
        throw ReactionTotalInvalid::notExists();
68
    }
69
}
70