Marcelgwerder\ApiHandler\Parser::isRelation PHP Метод

isRelation() защищенный Метод

Check if there exists a method marked with the "@Relation" annotation on the given model.
protected isRelation ( Illuminate\Database\Eloquent\Model $model, string $relationName ) : boolean
$model Illuminate\Database\Eloquent\Model
$relationName string
Результат boolean
    protected function isRelation($model, $relationName)
    {
        if (!method_exists($model, $relationName)) {
            return false;
        }
        $reflextionObject = new ReflectionObject($model);
        $doc = $reflextionObject->getMethod($relationName)->getDocComment();
        if ($doc && strpos($doc, '@Relation') !== false) {
            return true;
        } else {
            return false;
        }
    }