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

ItemPresenter::present()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
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