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

PortfolioCommentEdited::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
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