Completed
Push — test-rewrite ( 58cd6f...f92d09 )
by Laurent
01:16
created

EnterOrder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 12 4
1
<?php
2
3
namespace Order\Domain\UseCase;
4
5
use Order\Domain\Model\Order;
6
7
final class EnterOrder
8
{
9
    public function execute(Order $order, array $data): void
10
    {
11
        $articles = $order->articles()->toArray();
12
13
        foreach ($data as $datum) {
14
            foreach ($articles as $article) {
15
                if ($article->label() === $datum['label']) {
16
                    $article->updateOrderedQuantity($datum['quantityToOrder']);
17
                }
18
            }
19
        }
20
    }
21
}
22