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

EnterOrder::execute()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 4
nc 4
nop 2
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