Passed
Pull Request — 1.11.x (#4501)
by Angel Fernando Quiroz
09:49
created

PortfolioItemHighlighted::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 21
rs 9.7
cc 1
nc 1
nop 0
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
use Chamilo\PluginBundle\XApi\ToolExperience\Activity\PortfolioItem as PortfolioItemActivity;
6
use Chamilo\PluginBundle\XApi\ToolExperience\Actor\User;
7
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioAttachmentsTrait;
8
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioItem as PortfolioItemStatement;
9
use Chamilo\PluginBundle\XApi\ToolExperience\Verb\Highlighted;
10
use Xabbuh\XApi\Model\Statement;
11
12
class PortfolioItemHighlighted extends PortfolioItemStatement
13
{
14
    use PortfolioAttachmentsTrait;
0 ignored issues
show
Bug introduced by
The trait Chamilo\PluginBundle\XAp...rtfolioAttachmentsTrait requires the property $comment which is not provided by PortfolioItemHighlighted.
Loading history...
15
16
    public function generate(): Statement
17
    {
18
        $user = api_get_user_entity(api_get_user_id());
19
20
        $actor = new User($user);
21
        $verb = new Highlighted();
22
        $object = new PortfolioItemActivity($this->item);
23
        $context = $this->generateContext();
24
        $attachments = $this->generateAttachmentsForItem($this->item);
25
26
        return new Statement(
27
            $this->generateStatementId('portfolio-item'),
28
            $actor->generate(),
29
            $verb->generate(),
30
            $object->generate(),
31
            null,
32
            null,
33
            api_get_utc_datetime(null, false, true),
34
            null,
35
            $context,
36
            $attachments
37
        );
38
    }
39
}
40