Passed
Pull Request — master (#5629)
by Angel Fernando Quiroz
08:49
created

XApiPortfolioItemScoredHookObserver   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A hookItemScored() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
use Chamilo\CoreBundle\Entity\Portfolio;
8
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioItemScored;
9
10
class XApiPortfolioItemScoredHookObserver extends XApiActivityHookObserver implements HookPortfolioItemScoredObserverInterface
11
{
12
    public function hookItemScored(HookPortfolioItemScoredEventInterface $hookEvent): void
13
    {
14
        /** @var Portfolio $item */
15
        $item = $hookEvent->getEventData()['item'];
16
17
        $statement = (new PortfolioItemScored($item))->generate();
18
19
        $this->saveSharedStatement($statement);
20
    }
21
}
22