Code Duplication    Length = 15-17 lines in 6 locations

src/Comodojo/Cache/Manager.php 1 location

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

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/SimpleCache/Manager.php 3 locations

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