PHP Class ApiPlatform\SchemaGenerator\TypesGenerator

Author: Kévin Dunglas ([email protected])
Show file Open project: api-platform/schema-generator Class Usage Examples

Public Methods

Method Description
__construct ( Twig_Environment $twig, Psr\Log\LoggerInterface $logger, array $graphs, CardinalitiesExtractor $cardinalitiesExtractor, GoodRelationsBridge $goodRelationsBridge )
generate ( array $config ) Generates files.

Private Methods

Method Description
createPropertiesMap ( array $types ) : array Creates a map between classes and properties.
fixCs ( array $files ) Uses PHP CS Fixer to make generated files following PSR and Symfony Coding Standards.
generateAdderAnnotations ( array $annotationGenerators, string $className, string $fieldName ) : array Generates adder's annotations.
generateClassAnnotations ( array $annotationGenerators, string $className ) : array Generates class' annotations.
generateClassUses ( ApiPlatform\SchemaGenerator\AnnotationGenerator\AnnotationGeneratorInterface[] $annotationGenerators, array $classes, string $className ) : array Generates uses.
generateConstantAnnotations ( array $annotationGenerators, string $className, string $constantName ) : array Generates constant's annotations.
generateField ( array $config, array $class, EasyRdf_Resource $type, string $typeName, string $propertyName, EasyRdf_Resource $property = null ) : array Updates generated $class with given field config.
generateFieldAnnotations ( ApiPlatform\SchemaGenerator\AnnotationGenerator\AnnotationGeneratorInterface[] $annotationGenerators, string $className, string $fieldName ) : array Generates field's annotations.
generateGetterAnnotations ( array $annotationGenerators, string $className, string $fieldName ) : array Generates getter's annotations.
generateInterfaceAnnotations ( array $annotationGenerators, string $className ) : array Generates interface's annotations.
generateRemoverAnnotations ( array $annotationGenerators, string $className, string $fieldName ) : array Generates remover's annotations.
generateSetterAnnotations ( array $annotationGenerators, string $className, string $fieldName ) : array Generates getter's annotations.
getParentClasses ( EasyRdf_Resource $resource, array $parentClasses = [] ) : array Gets the parent classes of the current one and add them to $parentClasses array.
isDatatype ( string $type ) : boolean Is this type a datatype?
isDateTime ( $type ) : boolean Is this type a \DateTime?
isEnum ( EasyRdf_Resource $type ) : boolean Tests if a type is an enum.
namespaceToDir ( array $config, string $namespace ) : string Converts a namespace to a directory path according to PSR-4.

Method Details

__construct() public method

public __construct ( Twig_Environment $twig, Psr\Log\LoggerInterface $logger, array $graphs, CardinalitiesExtractor $cardinalitiesExtractor, GoodRelationsBridge $goodRelationsBridge )
$twig Twig_Environment
$logger Psr\Log\LoggerInterface
$graphs array
$cardinalitiesExtractor CardinalitiesExtractor
$goodRelationsBridge GoodRelationsBridge

generate() public method

Generates files.
public generate ( array $config )
$config array