ApiPlatform\SchemaGenerator\CardinalitiesExtractor::extractForProperty PHP Method

extractForProperty() private method

Based on Geraint Luff work.
private extractForProperty ( EasyRdf_Resource $property ) : string
$property EasyRdf_Resource
return string The cardinality
    private function extractForProperty(\EasyRdf_Resource $property)
    {
        $localName = $property->localName();
        $fromGoodRelations = $this->goodRelationsBridge->extractCardinality($localName);
        if (false !== $fromGoodRelations) {
            return $fromGoodRelations;
        }
        $comment = $property->get('rdfs:comment')->getValue();
        if (preg_match('/\\(s\\)/', $comment) || preg_match('/^The most generic uni-directional social relation./', $comment) || preg_match('/one or more/i', $comment)) {
            return self::CARDINALITY_0_N;
        }
        if (preg_match('/^is/', $localName) || preg_match('/^The /', $comment)) {
            return self::CARDINALITY_0_1;
        }
        return self::CARDINALITY_UNKNOWN;
    }