Code Duplication    Length = 33-35 lines in 3 locations

src/Comodojo/Cache/Providers/Memory.php 1 location

@@ 26-60 (lines=35) @@
23
 * THE SOFTWARE.
24
 */
25
26
class Memory extends AbstractEnhancedProvider {
27
28
    public function __construct(array $properties = [], LoggerInterface $logger = null) {
29
30
        try {
31
32
            parent::__construct($properties, $logger);
33
34
            $this->driver = new MemoryDriver();
35
36
            $this->test();
37
38
        } catch (Exception $e) {
39
40
            throw new CacheException($e->getMessage());
41
42
        }
43
44
    }
45
46
    public function getStats() {
47
48
        $info = $this->driver->stats();
49
50
        return new EnhancedCacheItemPoolStats(
51
            $this->getId(),
52
            $this->driver->getName(),
53
            $this->getState(),
54
            $info['objects'],
55
            []
56
        );
57
58
    }
59
60
}
61

src/Comodojo/SimpleCache/Providers/Memory.php 1 location

@@ 26-60 (lines=35) @@
23
 * THE SOFTWARE.
24
 */
25
26
class Memory extends AbstractEnhancedProvider {
27
28
    public function __construct(array $properties = [], LoggerInterface $logger = null) {
29
30
        try {
31
32
            parent::__construct($properties, $logger);
33
34
            $this->driver = new MemoryDriver();
35
36
            $this->test();
37
38
        } catch (Exception $e) {
39
40
            throw new SimpleCacheException($e->getMessage());
41
42
        }
43
44
    }
45
46
    public function getStats() {
47
48
        $info = $this->driver->stats();
49
50
        return new EnhancedCacheItemPoolStats(
51
            $this->getId(),
52
            $this->driver->getName(),
53
            $this->getState(),
54
            $info['objects'],
55
            []
56
        );
57
58
    }
59
60
}
61

src/Comodojo/SimpleCache/Providers/Vacuum.php 1 location

@@ 26-58 (lines=33) @@
23
 * THE SOFTWARE.
24
 */
25
26
class Vacuum extends AbstractEnhancedProvider {
27
28
    public function __construct(array $properties = [], LoggerInterface $logger = null) {
29
30
        try {
31
32
            parent::__construct($properties, $logger);
33
34
            $this->driver = new VoidDriver();
35
36
            $this->test();
37
38
        } catch (Exception $e) {
39
40
            throw new SimpleCacheException($e->getMessage());
41
42
        }
43
44
    }
45
46
    public function getStats() {
47
48
        return new EnhancedCacheItemPoolStats(
49
            $this->getId(),
50
            $this->driver->getName(),
51
            $this->getState(),
52
            0,
53
            []
54
        );
55
56
    }
57
58
}
59