Code Duplication    Length = 21-24 lines in 2 locations

src/Adapter/ElasticSearchAdapter.php 1 location

@@ 96-116 (lines=21) @@
93
     *
94
     * @return bool|mixed
95
     */
96
    public function get($key)
97
    {
98
        $key       = (string)$key;
99
        $this->hit = false;
100
101
        $inMemoryValue = InMemoryAdapter::getInstance()->get($key);
102
        if (InMemoryAdapter::getInstance()->isHit()) {
103
            $this->hit = true;
104
            return $inMemoryValue;
105
        }
106
107
        $value = $this->curl->get($key);
108
109
        if (null !== $value) {
110
            $this->hit = true;
111
            InMemoryAdapter::getInstance()->set($key, $value, 0);
112
            return $this->restoreDataStructure($value);
113
        }
114
115
        return (null !== $this->nextAdapter) ? $this->nextAdapter->get($key) : null;
116
    }
117
118
    /**
119
     * Delete a value identified by $key.

src/Adapter/Redis/AbstractAdapter.php 1 location

@@ 53-76 (lines=24) @@
50
     *
51
     * @return bool|mixed
52
     */
53
    public function get($key)
54
    {
55
        $this->hit = false;
56
57
        $inMemoryValue = InMemoryAdapter::getInstance()->get($key);
58
59
        if (InMemoryAdapter::getInstance()->isHit()) {
60
            $this->hit = true;
61
            return $inMemoryValue;
62
        }
63
64
        if ($this->isAvailable()) {
65
            $value = $this->redis->get($key);
66
67
            if ($value) {
68
                $this->hit = true;
69
                $value     = $this->restoreDataStructure($value);
70
                InMemoryAdapter::getInstance()->set($key, $value, 0);
71
                return $value;
72
            }
73
        }
74
75
        return (null !== $this->nextAdapter) ? $this->nextAdapter->get($key) : null;
76
    }
77
78
79
    /**