Completed
Push — FVSv2 ( 427c44...e6ffd8 )
by Patrick
01:43
created

VolunteerObject   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 3
1
<?php
2
class VolunteerObject
3
{
4
    protected $dbData;
5
6
    public function __construct($id, $dbData, $tableName, $index)
7
    {
8
        if($dbData === null)
9
        {
10
            $dataTable = DataSetFactory::getDataTableByNames('fvs', $tableName);
11
            $filter = new \Data\Filter($index.' eq '.$id);
12
            $objs = $dataTable->read($filter);
13
            if(empty($objs))
14
            {
15
                throw new Exception('Unable to locate object with ID '.$id);
16
            }
17
            $dbData = $objs[0];
18
        }
19
        $this->dbData = $dbData;
20
    }
21
}
22