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

aiccBlock   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 10
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
D __construct() 0 29 10
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Class aiccBlock
6
 * Class defining the Block elements in an AICC Course Structure file.
7
 *
8
 * Container for the aiccResource class that deals with elemens from AICC Course Structure file
9
 * @package chamilo.learnpath
10
 * @author  Yannick Warnier <[email protected]>
11
 * @license GNU/GPL
12
 */
13
class aiccBlock extends learnpathItem
14
{
15
    public $identifier = '';
16
    public $members = array();
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 'member':
39
                                if (strstr($value, ',') !== false) {
40
                                    $temp = explode(',', $value);
41
                                    foreach ($temp as $val) {
42
                                        if (!empty($val)) {
43
                                            $this->members[] = $val;
44
                                        }
45
                                    }
46
                                }
47
                                break;
48
                        }
49
                    }
50
            }
51
        }
52
    }
53
}
54