Code Duplication    Length = 13-13 lines in 2 locations

src/CRUDlex/AbstractData.php 1 location

@@ 225-237 (lines=13) @@
222
     * true on successful execution of the full chain or false if it broke at
223
     * any point (and stopped the execution)
224
     */
225
    public function shouldExecuteEvents(Entity $entity, $moment, $action)
226
    {
227
        if (!isset($this->events[$moment.'.'.$action])) {
228
            return true;
229
        }
230
        foreach ($this->events[$moment.'.'.$action] as $event) {
231
            $result = $event($entity);
232
            if (!$result) {
233
                return false;
234
            }
235
        }
236
        return true;
237
    }
238
239
    /**
240
     * Adds an event to fire for the given parameters. The event function must

src/CRUDlex/EntityEvents.php 1 location

@@ 40-52 (lines=13) @@
37
     * true on successful execution of the full chain or false if it broke at
38
     * any point (and stopped the execution)
39
     */
40
    public function shouldExecuteEvents(Entity $entity, $moment, $action)
41
    {
42
        if (!isset($this->events[$moment.'.'.$action])) {
43
            return true;
44
        }
45
        foreach ($this->events[$moment.'.'.$action] as $event) {
46
            $result = $event($entity);
47
            if (!$result) {
48
                return false;
49
            }
50
        }
51
        return true;
52
    }
53
54
    /**
55
     * Adds an event to fire for the given parameters. The event function must