Passed
Push — master ( 95b92f...37aede )
by Yannick
10:09 queued 01:17
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
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