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

PortfolioCommentEdited   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
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\PluginBundle\XApi\ToolExperience\Statement;
6
7
use Chamilo\PluginBundle\XApi\ToolExperience\Activity\PortfolioComment as PortfolioCommentActivity;
8
use Chamilo\PluginBundle\XApi\ToolExperience\Actor\User;
9
use Chamilo\PluginBundle\XApi\ToolExperience\Verb\Edited;
10
use Xabbuh\XApi\Model\Statement;
11
12
class PortfolioCommentEdited extends PortfolioComment
13
{
14
    use PortfolioAttachmentsTrait;
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 Edited();
22
        $object = new PortfolioCommentActivity($this->comment);
23
        $context = $this->generateContext();
24
        $attachements = $this->generateAttachmentsForComment($this->comment);
25
26
        return new Statement(
27
            $this->generateStatementId('portfolio-comment'),
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
            $attachements
37
        );
38
    }
39
}
40