Completed
Push — v5.1 ( 72dbea...9eedb6 )
by Georges
02:42
created

CustomMemcachedCacheClass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
3
/**
4
 * @author Khoa Bui (khoaofgod)  <[email protected]> http://www.phpfastcache.com
5
 * @author Georges.L (Geolim4)  <[email protected]>
6
 */
7
8
use phpFastCache\Drivers\Memcached\Driver as MemcachedDriver;
9
use phpFastCache\Proxy\phpFastCacheAbstractProxy;
10
11
12
chdir(__DIR__);
13
require_once __DIR__ . '/../vendor/autoload.php';
14
15
$status = 0;
16
echo "Testing phpFastCacheAbstractProxy class\n";
17
18
/**
19
 * Dynamic driver-based example
20
 * Class myCustomCacheClass
21
 * @package MyCustom\Project
22
 */
23
class CustomMemcachedCacheClass extends phpFastCacheAbstractProxy
24
{
25
    public function __construct($driver = '', array $config = [])
26
    {
27
        $driver = 'Memcached';
28
        parent::__construct($driver, $config);
29
        /**
30
         * That's all !! Your cache class is ready to use
31
         */
32
    }
33
}
34
35
36
/**
37
 * Testing memcached as it is declared in .travis.yml
38
 */
39
$driverInstance = new CustomMemcachedCacheClass();
40
41 View Code Duplication
if (!is_object($driverInstance)) {
1 ignored issue
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
42
    echo '[FAIL] $driverInstance returned an invalid variable type:' . gettype($driverInstance) . "\n";
43
    $status = 1;
44
}else if(!($driverInstance instanceof MemcachedDriver)){
45
    echo '[FAIL] $driverInstance returned an invalid class:' . get_class($driverInstance) . "\n";
46
    $status = 1;
47
}else{
48
    echo '[PASS] $driverInstance returned a valid MemcachedDriver (as a class alias) object: ' . get_class($driverInstance) . "\n";
49
}
50
51
exit($status);