Completed
Push — master ( 112194...85285f )
by Julito
17:04
created

AbstractTool::getCategory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Tool;
5
6
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
7
8
/**
9
 * Class AbstractTool.
10
 */
11
abstract class AbstractTool implements ToolInterface
12
{
13
    protected $name;
14
    protected $category;
15
    protected $link;
16
    protected $image;
17
    protected $admin;
18
    protected $settings;
19
    protected $resourceTypes;
20
21
    /**
22
     * @var string
23
     *
24
     *  00 disabled tool
25
     *  01 course tool
26
     *  10 global tool
27
     *  11 global or course or both
28
     */
29
    protected $scope;
30
31
    /**
32
     * @param string          $name
33
     * @param string          $category
34
     * @param string          $link
35
     * @param SchemaInterface $settings
36
     * @param array           $resourceTypes
37
     * @param string          $scope
38
     */
39
    public function __construct($name, $category, $link, $settings = null, $resourceTypes = null)
40
    {
41
        $this->name = $name;
42
        $this->category = $category;
43
        $this->link = $link;
44
        $this->image = $name.'.png';
45
        $this->settings = $settings;
46
        $this->resourceTypes = $resourceTypes;
47
    }
48
49
    public function isCourseTool()
50
    {
51
        return false;
52
    }
53
54
    public function isGlobal()
55
    {
56
        return true;
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function getName()
63
    {
64
        return $this->name;
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function getLink()
71
    {
72
        return $this->link ? $this->link : '';
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public function getCategory()
79
    {
80
        return $this->category;
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86
    public function getTarget()
87
    {
88
        return '_self';
89
    }
90
91
    /**
92
     * {@inheritdoc}
93
     */
94
    public function getImage()
95
    {
96
        return $this->image;
97
    }
98
99
    /**
100
     * @return array
101
     */
102
    public function getResourceTypes()
103
    {
104
        return $this->resourceTypes;
105
    }
106
107
    public function setResourceTypes(array $resourceTypes): AbstractTool
108
    {
109
        $this->resourceTypes = $resourceTypes;
110
111
        return $this;
112
    }
113
}
114