public function withFirstParent($parentClassName, callable $callback, callable $notFoundCallback = null)
    {
        $result = null;

        if ($this->hasParent($parentClassName)) {
            $parent = $this->getFirstParent($parentClassName);
            $result = call_user_func($callback, $parent);
        } elseif (null !== $notFoundCallback) {
            $result = call_user_func($notFoundCallback);
        }

        return $result;
    }
public function withFirstParent($parentClassName, callable $callback, callable $notFoundCallback = null)
    {
        $result = null;

        if ($this->hasParent($parentClassName)) {
            $parent = $this->getFirstParent($parentClassName);
            $result = call_user_func($callback, $parent);
        } elseif (null !== $notFoundCallback) {
            $result = call_user_func($notFoundCallback);
        }

        return $result;
    }
public function withFirstParent ( $ parentClassName , callable $ callback , callable $ notFoundCallback = null ) { $ result = null ; if ( $ this -> hasParent ( $ parentClassName ) ) { $ parent = $ this -> getFirstParent ( $ parentClassName ) ; $ result = call_user_func ( $ callback , $ parent ) ; } elseif ( null !== $ notFoundCallback ) { $ result = call_user_func ( $ notFoundCallback ) ; } return $ result ; }
Will fetch the first parent which matches the given class name.

If a parent is found, then `$callback` is called, and its returned value
is returned by this function.

If no parent is found, then `$notFoundCallBack` is called if it was
defined.

@param string   $parentClassName  Name of the class name of the wanted parent.
@param callable $callback         A closure which will be called if the parent is found.
@param callable $notFoundCallback A closure which is called if the parent is not found.
@return mixed|null
Will fetch the first parent which matches the given class name .