protected function resolvePredicate(?PredicateInterface $predicate, string $fallback): PredicateInterface
    {
        $is_a_predicate = function(string $class_name): bool
        {
            if(!class_exists($class_name))
                return false;
            $reflector = new \ReflectionClass($class_name);
            return $reflector->implementsInterface(PredicateInterface::class);
        };

        if(!is_null($predicate) && $is_a_predicate(get_class($predicate)) ) {
            return $predicate;
        }
        else {
            $predicate_class = get_class($this)."Predicate";
            if($is_a_predicate($predicate_class)) {
                return new $predicate_class;
            }
            else if($is_a_predicate($fallback)) {
                return new $fallback;
            }
            else {
                return new Predicate();
            }
        }
    }
protected function resolvePredicate(?PredicateInterface $predicate, string $fallback): PredicateInterface
    {
        $is_a_predicate = function(string $class_name): bool
        {
            if(!class_exists($class_name))
                return false;
            $reflector = new \ReflectionClass($class_name);
            return $reflector->implementsInterface(PredicateInterface::class);
        };

        if(!is_null($predicate) && $is_a_predicate(get_class($predicate)) ) {
            return $predicate;
        }
        else {
            $predicate_class = get_class($this)."Predicate";
            if($is_a_predicate($predicate_class)) {
                return new $predicate_class;
            }
            else if($is_a_predicate($fallback)) {
                return new $fallback;
            }
            else {
                return new Predicate();
            }
        }
    }
protected function resolvePredicate ( ? PredicateInterface $ predicate , string $ fallback ) : PredicateInterface { $ is_a_predicate = function ( string $ class_name ) : bool { if ( ! class_exists ( $ class_name ) ) return false ; $ reflector = new \ ReflectionClass ( $ class_name ) ; return $ reflector -> implementsInterface ( PredicateInterface :: class ) ; } ; if ( ! is_null ( $ predicate ) && $ is_a_predicate ( get_class ( $ predicate ) ) ) { return $ predicate ; } else { $ predicate_class = get_class ( $ this ) . "Predicate" ; if ( $ is_a_predicate ( $ predicate_class ) ) { return new $ predicate_class ; } else if ( $ is_a_predicate ( $ fallback ) ) { return new $ fallback ; } else { return new Predicate ( ) ; } } }
Resolves the predicate of this class.

The predicate may be given. Or it may be resolved by the name of this class. Or it may be given
a fallback. As a last resort, it may use the Predicate class available in pho-lib-graph.

@param PredicateInterface|null $predicate Predicate may be given.
@param string $fallback or the fallback class may be given, asking the method find something more specific if available.

@return PredicateInterface A predicate object.
Resolves the predicate of this class .