DoctrineZendDataFactory::getAdapter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of php-cache organization.
5
 *
6
 * (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Cache\AdapterBundle\Factory;
13
14
use Cache\Adapter\Doctrine\DoctrineCachePool;
15
use Doctrine\Common\Cache\ZendDataCache;
16
17
/**
18
 * @author Tobias Nyholm <[email protected]>
19
 */
20
final class DoctrineZendDataFactory extends AbstractDoctrineAdapterFactory
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getAdapter(array $config)
26
    {
27
        return new DoctrineCachePool(new ZendDataCache());
28
    }
29
30
    protected static function verifyDependencies()
31
    {
32
        if ('apache2handler' !== php_sapi_name()) {
33
            throw new \LogicException('Zend Data Cache only works in apache2handler SAPI.');
34
        }
35
36
        parent::verifyDependencies();
37
    }
38
}
39