Passed
Push — master ( 9dda0c...c240f3 )
by Victor
02:31
created

ItemPresenter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A present() 0 10 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Shoot\Shoot\Tests\Fixtures;
5
6
use Shoot\Shoot\Context;
7
use Shoot\Shoot\HasDataTrait;
8
use Shoot\Shoot\PresentationModel;
9
use Shoot\Shoot\PresenterInterface;
10
11
final class ItemPresenter implements PresenterInterface
12
{
13
    use HasDataTrait;
14
15
    /**
16
     * @param Context           $context
17
     * @param PresentationModel $presentationModel
18
     *
19
     * @return PresentationModel
20
     */
21
    public function present(Context $context, PresentationModel $presentationModel): PresentationModel
22
    {
23
        if (!$this->hasData($presentationModel)) {
24
            $presentationModel = $presentationModel->withVariables([
25
                'name' => 'item',
26
                'description' => 'description',
27
            ]);
28
        }
29
30
        return $presentationModel;
31
    }
32
}
33