PatientFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 9 2
1
<?php
2
namespace Hospitalplugin\Entities;
3
4
class PatientFactory
5
{
6
7
    public static function build($type)
8
    {
9
        $type = 'Hospitalplugin\Entities\Patient' . $type;
10
        if (class_exists($type)) {
11
            return new $type();
12
        } else {
13
            throw new Exception("Invalid type given.");
14
        }
15
    }
16
}