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

aiccObjective   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
require_once 'learnpathItem.class.php';
5
6
/**
7
 * Class aiccObjective
8
 * Class defining the Block elements in an AICC Course Structure file.
9
 * Container for the aiccResource class that deals with elemens from AICC Objectives file
10
 * @package chamilo.learnpath
11
 * @author  Yannick Warnier <[email protected]>
12
 * @license GNU/GPL
13
 */
14
class aiccObjective extends learnpathItem
15
{
16
    public $identifier = '';
17
    public $members = array();
18
19
    /**
20
     * Class constructor. Depending of the type of construction called ('db' or 'manifest'), will create a scormResource
21
     * object from database records or from the array given as second param
22
     * @param    string    Type of construction needed ('db' or 'config', default = 'config')
23
     * @param    mixed    Depending on the type given, DB id for the lp_item or parameters array
24
     */
25
    public function __construct($type = 'config', $params)
26
    {
27
        if (isset($params)) {
28
            switch ($type) {
29
                case 'db':
30
                    // TODO: Implement this way of object creation.
31
                    break;
32
                case 'config': // Do the same as the default.
33
                default:
34
                    foreach ($params as $a => $value) {
35
                        switch ($a) {
36
                            case 'system_id':
37
                                $this->identifier = strtolower($value);
38
                                break;
39
                            case 'member':
40
                                if (strstr($value, ',') !== false) {
41
                                    $temp = explode(',', $value);
42
                                    foreach ($temp as $val) {
43
                                        if (!empty($val)) {
44
                                            $this->members[] = $val;
45
                                        }
46
                                    }
47
                                }
48
                                break;
49
                        }
50
                    }
51
            }
52
        }
53
    }
54
}
55