Classes/Service/AbstractService.php
protected function delay($priority, callable $callback)
    {
        if (false === MathUtility::canBeInterpretedAsInteger($priority)) {
            throw new InvalidTypeException(
                'The priority must be an integer, ' . gettype($priority) . ' was given.',
                1457014282
            );
        }
        if (false === isset(static::$delayedCallbacks[$priority])) {
            static::$delayedCallbacks[$priority] = [];
        }

        static::$delayedCallbacks[$priority][] = $callback;
    }
protected function delay($priority, callable $callback)
    {
        if (false === MathUtility::canBeInterpretedAsInteger($priority)) {
            throw new InvalidTypeException(
                'The priority must be an integer, ' . gettype($priority) . ' was given.',
                1457014282
            );
        }
        if (false === isset(static::$delayedCallbacks[$priority])) {
            static::$delayedCallbacks[$priority] = [];
        }

        static::$delayedCallbacks[$priority][] = $callback;
    }
protected function delay ( $ priority , callable $ callback ) { if ( false === MathUtility :: canBeInterpretedAsInteger ( $ priority ) ) { throw new InvalidTypeException ( 'The priority must be an integer, ' . gettype ( $ priority ) . ' was given.' , 1457014282 ) ; } if ( false === isset ( static :: $ delayedCallbacks [ $ priority ] ) ) { static :: $ delayedCallbacks [ $ priority ] = [ ] ; } static :: $ delayedCallbacks [ $ priority ] [ ] = $ callback ; }
Use this function to delay a certain part of the script during an event
dispatch. This allows to run parts of the script in a sorted way, based
on a priority value.

The higher the priority is, the faster the script will run.

Please note that the usage of this function is not needed in every event.

@param int      $priority Priority: the higher it is, the faster the script will run.
@param callable $callback Function which will be called later.
@throws InvalidTypeException
Use this function to delay a certain part of the script during an event dispatch . This allows to run parts of the script in a sorted way based on a priority value .