Completed
Push — master ( 44391b...87bc43 )
by Julito
13:49
created

CourseControllerTrait   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 43
rs 10
c 1
b 0
f 0
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setSession() 0 3 1
A getCourse() 0 3 1
A getSession() 0 3 1
A setCourse() 0 3 1
A getSessionId() 0 3 2
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CourseBundle\Controller;
5
6
use Chamilo\CoreBundle\Entity\Course;
7
use Chamilo\CoreBundle\Entity\Session;
8
9
/**
10
 * Trait CourseControllerTrait.
11
 * Implements the functions defined by the CourseControllerInterface.
12
 */
13
trait CourseControllerTrait
14
{
15
    protected $course;
16
    protected $session;
17
18
    /**
19
     * @return mixed
20
     */
21
    public function setCourse(Course $course)
22
    {
23
        $this->course = $course;
24
    }
25
26
    /**
27
     * @return mixed
28
     */
29
    public function setSession(Session $session)
30
    {
31
        $this->session = $session;
32
    }
33
34
    /**
35
     * @return Course
36
     */
37
    public function getCourse()
38
    {
39
        return $this->course;
40
    }
41
42
    /**
43
     * @return Session
44
     */
45
    public function getSession()
46
    {
47
        return $this->session;
48
    }
49
50
    /**
51
     * @return int
52
     */
53
    public function getSessionId()
54
    {
55
        return $this->session ? $this->getSession()->getId() : 0;
56
    }
57
}
58