protected static function is_eligible_for_deletion(array &$pathstoskip, \context $context) : bool {
        $shouldskip = false;
        // Check whether any of the child contexts are ineligble.
        $shouldskip = !empty(array_filter($pathstoskip, function($path) use ($context) {
            // If any child context has already been skipped then it will appear in this list.
            // Since paths include parents, test if the context under test appears as the haystack in the skipped
            // context's needle.
            return false !== (strpos($context->path, $path));
        }));

        if (!$shouldskip && $context instanceof \context_user) {
            $shouldskip = !self::are_user_context_dependencies_expired($context);
        }

        if ($shouldskip) {
            // Add this to the list of contexts to skip for parentage checks.
            $pathstoskip[] = $context->path;
        }

        return !$shouldskip;
    }
protected static function is_eligible_for_deletion(array &$pathstoskip, \context $context) : bool {
        $shouldskip = false;
        // Check whether any of the child contexts are ineligble.
        $shouldskip = !empty(array_filter($pathstoskip, function($path) use ($context) {
            // If any child context has already been skipped then it will appear in this list.
            // Since paths include parents, test if the context under test appears as the haystack in the skipped
            // context's needle.
            return false !== (strpos($context->path, $path));
        }));

        if (!$shouldskip && $context instanceof \context_user) {
            $shouldskip = !self::are_user_context_dependencies_expired($context);
        }

        if ($shouldskip) {
            // Add this to the list of contexts to skip for parentage checks.
            $pathstoskip[] = $context->path;
        }

        return !$shouldskip;
    }
protected static function is_eligible_for_deletion ( array & $ pathstoskip , \ context $ context ) : bool { $ shouldskip = false ; // Check whether any of the child contexts are ineligble. $ shouldskip = ! empty ( array_filter ( $ pathstoskip , function ( $ path ) use ( $ context ) { // If any child context has already been skipped then it will appear in this list. // Since paths include parents, test if the context under test appears as the haystack in the skipped // context's needle. return false !== ( strpos ( $ context -> path , $ path ) ) ; } ) ) ; if ( ! $ shouldskip && $ context instanceof \ context_user ) { $ shouldskip = ! self :: are_user_context_dependencies_expired ( $ context ) ; } if ( $ shouldskip ) { // Add this to the list of contexts to skip for parentage checks. $ pathstoskip [ ] = $ context -> path ; } return ! $ shouldskip ; }
Check whether the supplied context would be elible for deletion.

@param   array       $pathstoskip A set of paths which should be skipped
@param   \context    $context
@return  bool
Check whether the supplied context would be elible for deletion .