AbstractFactory::getModuleName()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
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