Test Setup Failed
Push — master ( ec638a...cb9435 )
by Julito
51:10
created

aiccResource   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 9
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
D __construct() 0 28 9
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Class defining the elements from an AICC Descriptor file.
6
 * Container for the aiccResource class that deals with elemens from AICC Descriptor file
7
 * @package chamilo.learnpath
8
 * @author  Yannick Warnier <[email protected]>
9
 * @license GNU/GPL
10
 */
11
class aiccResource
12
{
13
    public $identifier = '';
14
    public $title = '';
15
    public $description = '';
16
    public $developer_id = '';
17
18
    /**
19
     * Class constructor. Depending of the type of construction called ('db' or 'manifest'), will create a scormResource
20
     * object from database records or from the array given as second param
21
     * @param    string $type Type of construction needed ('db' or 'config', default = 'config')
22
     * @param    mixed  $params Depending on the type given, DB id for the lp_item or parameters array
23
     */
24
    public function __construct($type = 'config', $params)
25
    {
26
        if (isset($params)) {
27
            switch ($type) {
28
                case 'db':
29
                    // TODO: Implement this way of object creation.
30
                    break;
31
                case 'config': // Do the same as the default.
32
                default:
33
                    foreach ($params as $a => $value) {
34
                        switch ($a) {
35
                            case 'system_id':
36
                                $this->identifier = strtolower($value);
37
                                break;
38
                            case 'title':
39
                                $this->title = $value;
40
                                // no break - @todo check this, not sure the intention is to have description=title
41
                            case 'description':
42
                                $this->description = $value;
43
                                break;
44
                            case 'developer_id':
45
                                $this->developer_id = $value;
46
                                break;
47
                        }
48
                    }
49
            }
50
        }
51
    }
52
}
53