Passed
Push — 1.11.x ( 0dd652...0c2073 )
by Angel Fernando Quiroz
11:42 queued 14s
created

H5pImportCreateCourseHookObserver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
class H5pImportCreateCourseHookObserver extends HookObserver implements HookCreateCourseObserverInterface
6
{
7
    /**
8
     * H5pImportCreatecourseHookObserver constructor.
9
     */
10
    protected function __construct()
11
    {
12
        parent::__construct(
13
            'plugin/h5pimport/H5pImportPlugin.php',
14
            'h5pimport'
15
        );
16
    }
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function hookCreateCourse(HookCreateCourseEventInterface $hook)
22
    {
23
        $data = $hook->getEventData();
24
25
        $type = $data['type'];
26
        $courseInfo = $data['course_info'];
27
28
        $plugin = H5pImportPlugin::create();
29
30
        if (HOOK_EVENT_TYPE_POST == $type) {
31
            $plugin->addCourseTool($courseInfo['real_id']);
32
        }
33
    }
34
}
35