Passed
Pull Request — master (#5629)
by Angel Fernando Quiroz
10:06 queued 01:32
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
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
use Chamilo\PluginBundle\XApi\ToolExperience\Activity\PortfolioItem as PortfolioItemActivity;
8
use Chamilo\PluginBundle\XApi\ToolExperience\Actor\User;
9
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioAttachmentsTrait;
10
use Chamilo\PluginBundle\XApi\ToolExperience\Statement\PortfolioItem as PortfolioItemStatement;
11
use Chamilo\PluginBundle\XApi\ToolExperience\Verb\Highlighted;
12
use Xabbuh\XApi\Model\Statement;
13
14
class PortfolioItemHighlighted extends PortfolioItemStatement
15
{
16
    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...
17
18
    public function generate(): Statement
19
    {
20
        $user = api_get_user_entity(api_get_user_id());
21
22
        $actor = new User($user);
23
        $verb = new Highlighted();
24
        $object = new PortfolioItemActivity($this->item);
25
        $context = $this->generateContext();
26
        $attachments = $this->generateAttachmentsForItem($this->item);
27
28
        return new Statement(
29
            $this->generateStatementId('portfolio-item'),
30
            $actor->generate(),
31
            $verb->generate(),
32
            $object->generate(),
33
            null,
34
            null,
35
            api_get_utc_datetime(null, false, true),
36
            null,
37
            $context,
38
            $attachments
39
        );
40
    }
41
}
42