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

XApiPortfolioItemAddedHookObserver   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

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

1 Method

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