Completed
Push — FVSv2 ( daaaca...306d39 )
by Patrick
01:42
created

VolunteerObject   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 3
A __get() 0 4 1
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
    public function __get($propName)
23
    {
24
        return $this->dbData[$propName];
25
    }
26
}
27