Passed
Pull Request — master (#5629)
by Angel Fernando Quiroz
10:06 queued 01:32
created

PortfolioItemHighlighted   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 0 21 1
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