Completed
Push — master ( 76b5db...d28136 )
by Julito
13:35
created

AbstractTool::getManager()   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 Sonata\CoreBundle\Model\BaseEntityManager;
7
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
8
9
/**
10
 * Class AbstractTool.
11
 */
12
abstract class AbstractTool implements ToolInterface
13
{
14
    protected $name;
15
    protected $category;
16
    protected $link;
17
    protected $image;
18
    protected $admin;
19
    protected $courseSettings;
20
    protected $resourceTypes;
21
22
    /**
23
     * @param string $name
24
     * @param string $category
25
     * @param string $link
26
     * @param        $courseSettings
27
     * @param array  $resourceTypes
28
     * @param array  $admin
29
     */
30
    public function __construct($name, $category, $link, $courseSettings, $resourceTypes, $admin)
31
    {
32
        $this->name = $name;
33
        $this->category = $category;
34
        $this->link = $link;
35
        $this->image = $name.'.png';
36
        $this->admin = (int) $admin;
37
        $this->courseSettings = $courseSettings;
38
        $this->resourceTypes = $resourceTypes;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getName()
45
    {
46
        return $this->name;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getLink()
53
    {
54
        return $this->link ? $this->link : '';
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getCategory()
61
    {
62
        return $this->category;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getTarget()
69
    {
70
        return '_self';
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function getImage()
77
    {
78
        return $this->image;
79
    }
80
81
    /**
82
     * @param int $admin
83
     */
84
    public function setAdmin($admin)
85
    {
86
        $this->admin = $admin;
87
    }
88
89
    public function getAdmin(): int
90
    {
91
        return (int) $this->admin;
92
    }
93
94
    /**
95
     * @param $settings
96
     *
97
     * @return int
98
     */
99
    public function setCourseSettings($settings)
100
    {
101
        $this->courseSettings = $settings;
102
    }
103
104
    /**
105
     * @return SchemaInterface
106
     */
107
    public function getCourseSettings()
108
    {
109
        return $this->courseSettings;
110
    }
111
112
    /**
113
     * @return array
114
     */
115
    public function getResourceTypes(): array
116
    {
117
        return $this->resourceTypes;
118
    }
119
120
    /**
121
     * @param array $resourceTypes
122
     *
123
     * @return AbstractTool
124
     */
125
    public function setResourceTypes(array $resourceTypes): AbstractTool
126
    {
127
        $this->resourceTypes = $resourceTypes;
128
129
        return $this;
130
    }
131
}
132