AbstractFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
getModuleName() 0 1 ?
A __construct() 0 6 2
A moduleIsInstalled() 0 8 2
1
<?php
2
3
namespace Dafiti\Silex\Cache\Factory;
4
5
use Dafiti\Silex\Exception\ModuleIsNotInstalled;
6
7
abstract class AbstractFactory implements Factorable
8
{
9
    abstract public function getModuleName();
10
11
    public function __construct()
12
    {
13
        if (!$this->moduleIsInstalled()) {
14
            throw new ModuleIsNotInstalled($this->getModuleName());
15
        }
16
    }
17
18
    public function moduleIsInstalled()
19
    {
20
        if (!extension_loaded($this->getModuleName())) {
21
            return false;
22
        }
23
24
        return true;
25
    }
26
}
27