XApiPortfolioItemViewedHookObserver   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A hookItemViewed() 0 8 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
use Chamilo\CoreBundle\Entity\Portfolio;
6
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioItemViewed;
7
use Doctrine\ORM\OptimisticLockException;
8
use Doctrine\ORM\ORMException;
9
10
class XApiPortfolioItemViewedHookObserver extends XApiActivityHookObserver implements HookPortfolioItemViewedObserverInterface
11
{
12
    /**
13
     * @throws OptimisticLockException
14
     * @throws ORMException
15
     */
16
    public function hookItemViewed(HookPortfolioItemViewedEventInterface $hookEvent)
17
    {
18
        /** @var Portfolio $item */
19
        $item = $hookEvent->getEventData()['portfolio'];
20
21
        $statement = (new PortfolioItemViewed($item))->generate();
22
23
        $this->saveSharedStatement($statement);
24
    }
25
}
26