Code Duplication    Length = 15-17 lines in 6 locations

src/Comodojo/Cache/Traits/GenericManagerTrait.php 2 locations

@@ 55-71 (lines=17) @@
52
53
    }
54
55
    public function clear() {
56
57
        if ( $this->align_cache === false && $this->pick_mode < 5) {
58
            return $this->selectProvider()->clear();
59
        }
60
61
        $result = [];
62
63
        foreach ($this->stack as $provider) {
64
65
            $result[] = $provider[0]->clear();
66
67
        }
68
69
        return !in_array(false, $result);
70
71
    }
72
73
    public function setNamespace($namespace = null) {
74
@@ 85-99 (lines=15) @@
82
83
    }
84
85
    public function clearNamespace() {
86
87
        if ( $this->align_cache === false && $this->pick_mode < 5) {
88
            return $this->selectProvider()->clearNamespace();
89
        }
90
91
        $result = [];
92
93
        foreach ($this->stack->getAll() as $provider) {
94
            $result[] = $provider->clearNamespace();
95
        }
96
97
        return !in_array(false, $result);
98
99
    }
100
101
    public function getStats() {
102

src/Comodojo/Cache/Manager.php 1 location

@@ 97-113 (lines=17) @@
94
95
    }
96
97
    public function deleteItem($key) {
98
99
        if ( $this->align_cache === false && $this->pick_mode < 5) {
100
            return $this->selectProvider()->deleteItem($key);
101
        }
102
103
        $result = [];
104
105
        foreach ($this->stack as $provider) {
106
107
            $result[] = $provider[0]->deleteItem($key);
108
109
        }
110
111
        return !in_array(false, $result);
112
113
    }
114
115
    public function save(CacheItemInterface $item) {
116

src/Comodojo/SimpleCache/Manager.php 3 locations

@@ 112-128 (lines=17) @@
109
110
    }
111
112
    public function delete($key) {
113
114
        if ( $this->align_cache === false && $this->pick_mode < 5) {
115
            return $this->selectProvider()->delete($key);
116
        }
117
118
        $result = [];
119
120
        foreach ($this->stack as $provider) {
121
122
            $result[] = $provider[0]->delete($key);
123
124
        }
125
126
        return !in_array(false, $result);
127
128
    }
129
130
    public function getMultiple($keys, $default = null) {
131
@@ 136-152 (lines=17) @@
133
134
    }
135
136
    public function setMultiple($values, $ttl = null) {
137
138
        if ( $this->align_cache === false && $this->pick_mode < 5) {
139
            return $this->selectProvider()->setMultiple($values, $ttl);
140
        }
141
142
        $result = [];
143
144
        foreach ($this->stack as $provider) {
145
146
            $result[] = $provider[0]->setMultiple($values, $ttl);
147
148
        }
149
150
        return !in_array(false, $result);
151
152
    }
153
154
    public function deleteMultiple($keys) {
155
@@ 154-170 (lines=17) @@
151
152
    }
153
154
    public function deleteMultiple($keys) {
155
156
        if ( $this->align_cache === false && $this->pick_mode < 5) {
157
            return $this->selectProvider()->deleteMultiple($keys);
158
        }
159
160
        $result = [];
161
162
        foreach ($this->stack as $provider) {
163
164
            $result[] = $provider[0]->deleteMultiple($keys);
165
166
        }
167
168
        return !in_array(false, $result);
169
170
    }
171
172
    public function has($key) {
173