Farm::create()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Cowsayphp;
4
5
class Farm
6
{
7
    /**
8
     * @param $animal
9
     * @return AnimalInterface
10
     */
11
    public static function create($animal)
12
    {
13
        $result = null;
14
        if(class_exists($animal)) {
15
            $result = new $animal;
16
        }
17
        return $result;
18
    }
19
}