Code Duplication    Length = 15-17 lines in 3 locations

src/Comodojo/Extender/Schedule/Manager.php 3 locations

@@ 195-209 (lines=15) @@
192
193
    }
194
195
    public function remove($name) {
196
197
        $em = $this->getEntityManager();
198
199
        $schedule = $this->getByName($name);
200
201
        if ( is_null($schedule) ) throw new Exception("Cannot find scheule $name");
202
203
        $em->remove($schedule);
204
205
        $em->flush();
206
207
        return true;
208
209
    }
210
211
    public function enable($name) {
212
@@ 211-227 (lines=17) @@
208
209
    }
210
211
    public function enable($name) {
212
213
        $em = $this->getEntityManager();
214
215
        $schedule = $this->getByName($name);
216
217
        if ( is_null($schedule) ) throw new Exception("Cannot find scheule $name");
218
219
        $schedule->setEnabled(true);
220
221
        $em->persist($schedule);
222
223
        $em->flush();
224
225
        return true;
226
227
    }
228
229
    public function disable($name) {
230
@@ 229-245 (lines=17) @@
226
227
    }
228
229
    public function disable($name) {
230
231
        $em = $this->getEntityManager();
232
233
        $schedule = $this->getByName($name);
234
235
        if ( is_null($schedule) ) throw new Exception("Cannot find scheule $name");
236
237
        $schedule->setEnabled(false);
238
239
        $em->persist($schedule);
240
241
        $em->flush();
242
243
        return true;
244
245
    }
246
247
}
248