PHP Class Raml\Parser

Datei anzeigen Open project: alecsammon/php-raml-parser Class Usage Examples

Public Methods

Method Description
__construct ( array $schemaParsers = null, array $securitySettingsParsers = null, array $fileLoaders = null, raml\ParseConfiguration $config = null ) Create a new parser object - Optionally pass a list of parsers to use - If null is passed then the default schemaParsers are used
addFileLoader ( Raml\FileLoader\FileLoaderInterface $fileLoader ) Add a file loader
addSchemaParser ( Raml\Schema\SchemaParserInterface $schemaParser ) Add a new schema parser
addSecuritySettingParser ( Raml\SecurityScheme\SecuritySettingsParserInterface $securitySettingsParser ) Add a new security scheme
parse ( string $rawFileName ) : ApiDefinition Parse a RAML spec from a file
parseFromString ( string $ramlString, string $rootDir ) : ApiDefinition Parse a RAML spec from a string
setConfiguration ( raml\ParseConfiguration $config ) Set the parse configuration

Private Methods

Method Description
applyTraitVariables ( array $values, array $trait ) : mixed Add trait variables
getCachedFilePath ( string $data ) : string
includeAndParseFiles ( array | string $structure, string $rootDir ) : array Recurse through the structure and load includes
loadAndParseFile ( string $fileName, string $rootDir ) : array Load and parse a file
parseRamlData ( string $ramlData, string $rootDir ) : ApiDefinition Parse RAML data
parseRamlString ( string $ramlString, string $rootDir ) : array Parse a RAML or YAML content
parseResourceTypes ( $ramlData ) : array Parse the resource types
parseSecuritySettings ( $schemesArray ) : array Parse the security settings data into an array
parseTraits ( $ramlData ) : array Parse the traits
parseYaml ( string $fileData ) : array Convert a yaml string into an array
recurseAndParseSchemas ( array $array, string $rootDir ) : array Recurses though resources and replaces schema strings
replaceSchemas ( array $array, array $schemas ) : array Replaces schema into the raml file
replaceTraits ( array $raml, array $traits, string $path, string $name ) : array Insert the traits into the RAML file
replaceTypes ( array $raml, array $types, string $path, string $name, string $parentKey = null ) : array Insert the types into the RAML file

Method Details

__construct() public method

Create a new parser object - Optionally pass a list of parsers to use - If null is passed then the default schemaParsers are used
public __construct ( array $schemaParsers = null, array $securitySettingsParsers = null, array $fileLoaders = null, raml\ParseConfiguration $config = null )
$schemaParsers array
$securitySettingsParsers array
$fileLoaders array
$config raml\ParseConfiguration

addFileLoader() public method

Add a file loader
public addFileLoader ( Raml\FileLoader\FileLoaderInterface $fileLoader )
$fileLoader Raml\FileLoader\FileLoaderInterface

addSchemaParser() public method

Add a new schema parser
public addSchemaParser ( Raml\Schema\SchemaParserInterface $schemaParser )
$schemaParser Raml\Schema\SchemaParserInterface

addSecuritySettingParser() public method

Add a new security scheme
public addSecuritySettingParser ( Raml\SecurityScheme\SecuritySettingsParserInterface $securitySettingsParser )
$securitySettingsParser Raml\SecurityScheme\SecuritySettingsParserInterface

parse() public method

Parse a RAML spec from a file
public parse ( string $rawFileName ) : ApiDefinition
$rawFileName string
return ApiDefinition

parseFromString() public method

Parse a RAML spec from a string
public parseFromString ( string $ramlString, string $rootDir ) : ApiDefinition
$ramlString string
$rootDir string
return ApiDefinition

setConfiguration() public method

Set the parse configuration
public setConfiguration ( raml\ParseConfiguration $config )
$config raml\ParseConfiguration