Passed
Push — master ( 95b92f...37aede )
by Yannick
10:09 queued 01:17
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
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\PluginBundle\XApi\ToolExperience\Statement;
8
9
use Chamilo\PluginBundle\XApi\ToolExperience\Activity\PortfolioComment as PortfolioCommentActivity;
10
use Chamilo\PluginBundle\XApi\ToolExperience\Actor\User;
11
use Chamilo\PluginBundle\XApi\ToolExperience\Verb\Edited;
12
use Xabbuh\XApi\Model\Statement;
13
14
class PortfolioCommentEdited extends PortfolioComment
15
{
16
    use PortfolioAttachmentsTrait;
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 Edited();
24
        $object = new PortfolioCommentActivity($this->comment);
25
        $context = $this->generateContext();
26
        $attachements = $this->generateAttachmentsForComment($this->comment);
27
28
        return new Statement(
29
            $this->generateStatementId('portfolio-comment'),
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
            $attachements
39
        );
40
    }
41
}
42