idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
13,200
private function parseHostAndPath ( array $ locationParts ) : void { $ path = $ locationParts [ 'path' ] ?? '' ; $ host = $ locationParts [ 'host' ] ?? '' ; if ( $ this -> getScheme ( ) === 'file' ) { $ this -> path = $ host . $ path ; } else { $ this -> host = $ host ; $ this -> path = $ path ; } }
Validates and sets the host and path properties
13,201
private function parsePort ( array $ locationParts ) : void { if ( ! isset ( $ locationParts [ 'port' ] ) ) { if ( $ this -> getScheme ( ) === 'git+http' ) { $ this -> port = 80 ; } elseif ( $ this -> getScheme ( ) === 'git+https' ) { $ this -> port = 443 ; } else { $ this -> port = 0 ; } } else { $ this -> port = ( in...
Validates and sets the port property
13,202
private function parseQuery ( array $ locationParts ) : void { if ( isset ( $ locationParts [ 'query' ] ) ) { $ queryParts = explode ( '&' , $ locationParts [ 'query' ] ) ; foreach ( $ queryParts as $ part ) { $ option = $ this -> splitKeyValuePair ( $ part ) ; $ this -> query [ $ option [ 0 ] ] = $ option [ 1 ] ; } } ...
validates and sets the query property
13,203
private function parseParameters ( array $ dsnParts ) : void { foreach ( $ dsnParts as $ part ) { $ option = $ this -> splitKeyValuePair ( $ part ) ; $ this -> parameters [ $ option [ 0 ] ] = $ option [ 1 ] ; } }
validates and sets the parameters property
13,204
private function splitKeyValuePair ( string $ pair ) : array { $ option = explode ( '=' , $ pair ) ; if ( count ( $ option ) !== 2 ) { throw new InvalidArgumentException ( sprintf ( '"%s" is not a valid query or parameter.' , $ pair ) ) ; } return $ option ; }
Splits a key - value pair
13,205
public function find ( $ object , $ query ) { if ( $ query ) { $ node = $ this -> walkObjectTree ( $ object , $ query ) ; if ( ! is_array ( $ node ) && ( ! $ node instanceof \ Traversable ) ) { $ node = [ $ node ] ; } return $ node ; } return [ $ object ] ; }
Combines the query and an object to retrieve a list of nodes that are to be used as node - point in a template .
13,206
public function setTarget ( string $ target ) : void { $ path = realpath ( $ target ) ; if ( false === $ path ) { if ( @ mkdir ( $ target , 0755 , true ) ) { $ path = realpath ( $ target ) ; } else { throw new InvalidArgumentException ( 'Target directory (' . $ target . ') does not exist and could not be created' ) ; }...
Sets the target location where to output the artifacts .
13,207
public function setOption ( string $ name , string $ value ) : void { $ this -> options [ $ name ] = $ value ; }
Sets an option with the given name .
13,208
protected function getDestinationFilename ( Metadata \ TableOfContents \ File $ file ) : string { return $ this -> definition -> getOutputFormat ( ) -> convertFilename ( $ file -> getRealPath ( ) ) ; }
Returns the filename used for the output path .
13,209
public function getInheritedElement ( ) { $ associatedClass = $ this -> getParent ( ) ; if ( ( $ associatedClass instanceof ClassDescriptor || $ associatedClass instanceof InterfaceDescriptor ) && ( $ associatedClass -> getParent ( ) instanceof ClassDescriptor || $ associatedClass -> getParent ( ) instanceof InterfaceD...
Returns the property from which this one should inherit if any .
13,210
public function fromDefaultLocations ( ) : Configuration { foreach ( $ this -> defaultFiles as $ file ) { try { return $ this -> fromUri ( new Uri ( $ file ) ) ; } catch ( \ InvalidArgumentException $ e ) { continue ; } } return new Configuration ( $ this -> applyMiddleware ( Version3 :: buildDefault ( ) ) ) ; }
Attempts to load a configuration from the default locations for phpDocumentor
13,211
public function fromUri ( Uri $ uri ) : Configuration { $ filename = ( string ) $ uri ; if ( ! file_exists ( $ filename ) ) { throw new \ InvalidArgumentException ( sprintf ( 'File %s could not be found' , $ filename ) ) ; } $ xml = new \ SimpleXMLElement ( $ filename , 0 , true ) ; foreach ( $ this -> strategies as $ ...
Converts the phpDocumentor configuration xml to an array .
13,212
private function applyMiddleware ( array $ configuration ) : array { foreach ( $ this -> middlewares as $ middleware ) { $ configuration = $ middleware ( $ configuration ) ; } return $ configuration ; }
Applies all middleware callbacks onto the configuration .
13,213
protected function addClasses ( array $ classes , FileDescriptor $ fileDescriptor ) : void { foreach ( $ classes as $ class ) { $ classDescriptor = $ this -> getBuilder ( ) -> buildDescriptor ( $ class ) ; if ( $ classDescriptor ) { $ classDescriptor -> setLocation ( $ fileDescriptor , $ class -> getLocation ( ) -> get...
Registers the child classes with the generated File Descriptor .
13,214
public function isVisibilityAllowed ( $ visibility ) { $ visibilityAllowed = $ this -> getSettings ( ) ? $ this -> getSettings ( ) -> getVisibility ( ) : Settings :: VISIBILITY_DEFAULT ; return ( bool ) ( $ visibilityAllowed & $ visibility ) ; }
Checks whether the Project supports the given visibility .
13,215
public function get ( $ input_format , $ output_format ) { return new Definition ( $ this -> format_collection [ $ input_format ] , $ this -> format_collection [ $ output_format ] ) ; }
Creates a definition of the given input and output formats .
13,216
public function setParent ( $ parent ) { if ( ! $ parent instanceof ClassDescriptor && ! $ parent instanceof InterfaceDescriptor && $ parent !== null ) { throw new \ InvalidArgumentException ( 'Constants can only have an interface or class as parent' ) ; } $ fqsen = $ parent !== null ? $ parent -> getFullyQualifiedStru...
Registers a parent class or interface with this constant .
13,217
public function register ( callable $ matcher , AssemblerInterface $ assembler ) : void { $ this -> assemblers [ ] = new AssemblerMatcher ( $ matcher , $ assembler ) ; }
Registers an assembler instance to this factory .
13,218
public function registerFallback ( callable $ matcher , AssemblerInterface $ assembler ) : void { $ this -> fallbackAssemblers [ ] = new AssemblerMatcher ( $ matcher , $ assembler ) ; }
Registers an assembler instance to this factory that is to be executed after all other assemblers have been checked .
13,219
protected function addVariadicArgument ( Method $ data , MethodDescriptor $ methodDescriptor ) : void { if ( ! $ data -> getDocBlock ( ) ) { return ; } $ paramTags = $ data -> getDocBlock ( ) -> getTagsByName ( 'param' ) ; $ lastParamTag = end ( $ paramTags ) ; if ( ! $ lastParamTag ) { return ; } if ( $ lastParamTag -...
Checks if there is a variadic argument in the
13,220
public function offsetSet ( $ index , $ newval ) { if ( ! $ newval instanceof WriterAbstract ) { throw new \ InvalidArgumentException ( 'The Writer Collection may only contain objects descending from WriterAbstract' ) ; } if ( ! preg_match ( '/^[a-zA-Z0-9\-\_\/]{3,}$/' , $ index ) ) { throw new \ InvalidArgumentExcepti...
Registers a writer with a given name .
13,221
public function offsetGet ( $ index ) { if ( ! $ this -> offsetExists ( $ index ) ) { throw new \ InvalidArgumentException ( 'Writer "' . $ index . '" does not exist' ) ; } return parent :: offsetGet ( $ index ) ; }
Retrieves a writer from the collection .
13,222
public function logStats ( $ fatal , Logger $ logger ) { if ( ! $ this -> getErrors ( ) && ! $ fatal ) { return ; } foreach ( $ this -> getErrors ( ) as $ error ) { $ logger -> warning ( ' ' . $ error -> getMessage ( ) ) ; } if ( $ fatal ) { $ logger -> error ( ' ' . $ fatal -> getMessage ( ) ) ; } }
Sends the errors of the given Rst document to the logger as a block .
13,223
protected function appendPhpdocStatsElement ( \ DOMDocument $ document ) { $ stats = $ document -> createElement ( 'phpdoc-stats' ) ; $ stats -> setAttribute ( 'version' , Application :: VERSION ( ) ) ; $ document -> appendChild ( $ stats ) ; return $ document ; }
Append phpdoc - stats element to the document .
13,224
protected function appendStatElement ( \ DOMDocument $ document , ProjectDescriptor $ project , $ date ) { $ stat = $ document -> createDocumentFragment ( ) ; $ stat -> appendXML ( <<<STAT<stat date="${date}"> <counters> <files>{$this->getFilesCounter($project)}</files> <deprecated>{$this->...
Appends a stat fragment .
13,225
protected function getErrorCounter ( ProjectDescriptor $ project ) { $ errorCounter = 0 ; foreach ( $ project -> getFiles ( ) -> getAll ( ) as $ fileDescriptor ) { $ errorCounter += count ( $ fileDescriptor -> getAllErrors ( ) -> getAll ( ) ) ; } return $ errorCounter ; }
Get number of errors .
13,226
protected function getMarkerCounter ( ProjectDescriptor $ project ) { $ markerCounter = 0 ; foreach ( $ project -> getFiles ( ) -> getAll ( ) as $ fileDescriptor ) { $ markerCounter += $ fileDescriptor -> getMarkers ( ) -> count ( ) ; } return $ markerCounter ; }
Get number of markers .
13,227
public function convert ( \ DOMElement $ parent , PropertyDescriptor $ property ) { $ fullyQualifiedNamespaceName = $ property -> getNamespace ( ) instanceof NamespaceDescriptor ? $ property -> getNamespace ( ) -> getFullyQualifiedStructuralElementName ( ) : $ parent -> getAttribute ( 'namespace' ) ; $ child = new \ DO...
Export the given reflected property definition to the provided parent element .
13,228
public function setProcessorParameters ( TransformationObject $ transformation , $ proc ) { foreach ( $ this -> xsl_variables as $ key => $ variable ) { if ( ( strpos ( $ variable , '"' ) !== false ) && ( ( strpos ( $ variable , "'" ) !== false ) ) ) { $ this -> logger -> warning ( 'XSLT does not allow both double and ...
Sets the parameters of the XSLT processor .
13,229
private function getArtifactPath ( Transformation $ transformation ) { return $ transformation -> getArtifact ( ) ? $ transformation -> getTransformer ( ) -> getTarget ( ) . DIRECTORY_SEPARATOR . $ transformation -> getArtifact ( ) : null ; }
Returns the path to the location where the artifact should be written or null to automatically detect the location using the router .
13,230
protected function setValueAndCheckIfModified ( $ propertyName , $ value ) { if ( $ this -> { $ propertyName } !== $ value ) { $ this -> isModified = true ; } $ this -> { $ propertyName } = $ value ; }
Sets a property s value and if it differs from the previous then mark these settings as modified .
13,231
public function load ( $ nameOrPath ) { $ template = $ this -> factory -> get ( $ nameOrPath ) ; foreach ( $ template as $ transformation ) { $ writer = $ this -> writerCollection [ $ transformation -> getWriter ( ) ] ; if ( $ writer ) { $ writer -> checkRequirements ( ) ; } } $ this [ $ template -> getName ( ) ] = $ t...
Loads a template with the given name or file path .
13,232
public function getTransformations ( ) { $ result = [ ] ; foreach ( $ this as $ template ) { foreach ( $ template as $ transformation ) { $ result [ ] = $ transformation ; } } return $ result ; }
Returns a list of all transformations contained in the templates of this collection .
13,233
public function filter ( $ value ) { if ( $ value instanceof VisibilityInterface && ! $ this -> builder -> isVisibilityAllowed ( $ value -> getVisibility ( ) ) ) { return null ; } return $ value ; }
Filter Descriptor with based on visibility .
13,234
protected function addConstants ( array $ constants , ClassDescriptor $ classDescriptor ) : void { foreach ( $ constants as $ constant ) { $ constantDescriptor = $ this -> getBuilder ( ) -> buildDescriptor ( $ constant ) ; if ( $ constantDescriptor instanceof ConstantDescriptor ) { $ constantDescriptor -> setParent ( $...
Registers the child constants with the generated Class Descriptor .
13,235
private function constructExamplePath ( string $ directory , string $ file ) : string { return rtrim ( $ directory , '\\/' ) . DIRECTORY_SEPARATOR . $ file ; }
Returns a path to the example file in the given directory ..
13,236
private function getExamplePathFromSource ( string $ file ) : string { return sprintf ( '%s%s%s' , trim ( $ this -> getSourceDirectory ( ) , '\\/' ) , DIRECTORY_SEPARATOR , trim ( $ file , '"' ) ) ; }
Get example filepath based on sourcecode .
13,237
public function match ( $ node ) { foreach ( clone $ this as $ router ) { $ rule = $ router -> match ( $ node ) ; if ( $ rule ) { return $ rule ; } } return null ; }
Tries to match the given node with a rule defined in one of the routers .
13,238
protected function addTags ( \ DOMElement $ docBlock , $ descriptor ) { foreach ( $ descriptor -> getTags ( ) as $ tagGroup ) { if ( ! $ tagGroup ) { continue ; } foreach ( $ tagGroup as $ tag ) { $ this -> tagConverter -> convert ( $ docBlock , $ tag ) ; } } }
Adds each tag to the XML Node representing the DocBlock .
13,239
public function getAllNames ( ) { $ files = new \ DirectoryIterator ( $ this -> getTemplatePath ( ) ) ; $ template_names = [ ] ; while ( $ files -> valid ( ) ) { $ name = $ files -> getBasename ( ) ; if ( ! $ files -> isDir ( ) || in_array ( $ name , [ '.' , '..' ] , true ) ) { $ files -> next ( ) ; continue ; } $ temp...
Returns a list of all template names .
13,240
protected function createTemplateFromXml ( $ xml ) { $ template = $ this -> serializer -> deserialize ( $ xml , 'phpDocumentor\Transformer\Template' , 'xml' ) ; $ template -> propagateParameters ( ) ; return $ template ; }
Creates and returns a template object based on the provided template definition .
13,241
private function forceRebuildIfSettingsHaveModified ( ProjectDescriptorBuilder $ builder ) { if ( $ builder -> getProjectDescriptor ( ) -> getSettings ( ) -> isModified ( ) ) { $ this -> setForced ( true ) ; $ this -> log ( 'One of the project\'s settings have changed, forcing a complete rebuild' , LogLevel :: NOTICE )...
Checks if the settings of the project have changed and forces a complete rebuild if they have .
13,242
private function logAfterParsingAllFiles ( ) { if ( ! $ this -> stopwatch ) { return ; } $ event = $ this -> stopwatch -> stop ( 'parser.parse' ) ; $ this -> log ( 'Elapsed time to parse all files: ' . round ( $ event -> getDuration ( ) / 1000 , 2 ) . 's' ) ; $ this -> log ( 'Peak memory usage: ' . round ( $ event -> g...
Writes the complete parsing cycle to log .
13,243
public function filter ( $ value ) { if ( $ value ) { $ namespace = $ value -> getNamespace ( ) === '' ? '\\' . $ this -> namespacePrefix : $ value -> getNamespace ( ) ; $ value -> setNamespace ( $ this -> namespaceFromLegacyNamespace ( $ namespace , $ value -> getName ( ) ) ) ; $ value -> setName ( $ this -> className...
Overrides the name and namespace of an element with a separated version of the class name .
13,244
private function namespaceFromLegacyNamespace ( $ namespace , $ className ) { $ qcn = str_replace ( '_' , '\\' , $ className ) ; $ lastBackslash = strrpos ( $ qcn , '\\' ) ; if ( $ lastBackslash ) { $ namespace = rtrim ( $ namespace , '\\' ) . '\\' . substr ( $ qcn , 0 , $ lastBackslash ) ; } return $ namespace ; }
Extracts the namespace from the class name .
13,245
private function classNameFromLegacyNamespace ( $ className ) { $ lastUnderscore = strrpos ( $ className , '_' ) ; if ( $ lastUnderscore ) { $ className = substr ( $ className , $ lastUnderscore + 1 ) ; } return $ className ; }
Extracts the class name without prefix from the full class name .
13,246
public function execute ( ProjectDescriptor $ project ) : void { $ this -> elementCollection = $ project -> getIndexes ( ) -> get ( 'elements' ) ; foreach ( $ this -> elementCollection as $ descriptor ) { $ this -> resolveSeeAndLinkTags ( $ descriptor ) ; } }
Iterates through each element in the project and replaces its inline
13,247
private function resolveElement ( DescriptorAbstract $ element , $ link , ? string $ description = null ) : string { $ rule = $ this -> router -> match ( $ element ) ; if ( $ rule ) { $ url = '..' . $ rule -> generate ( $ element ) ; $ link = $ this -> generateMarkdownLink ( $ url , $ description ? : ( string ) $ link ...
Generates a Markdown link to the given Descriptor or returns the link text if no route to the Descriptor could be matched .
13,248
private function getLinkText ( Tag $ tagReflector ) : ? string { if ( $ tagReflector instanceof See ) { return ( string ) $ tagReflector -> getReference ( ) ; } if ( $ tagReflector instanceof Link ) { return ( string ) $ tagReflector -> getLink ( ) ; } return null ; }
Returns the link for the given reflector .
13,249
public function isVisibilityAllowed ( $ visibility ) { switch ( $ visibility ) { case 'public' : $ visibility = Settings :: VISIBILITY_PUBLIC ; break ; case 'protected' : $ visibility = Settings :: VISIBILITY_PROTECTED ; break ; case 'private' : $ visibility = Settings :: VISIBILITY_PRIVATE ; break ; case 'internal' : ...
Verifies whether the given visibility is allowed to be included in the Descriptors .
13,250
public static function getInstance ( string $ name = 'default' ) : self { if ( ! isset ( self :: $ instances [ $ name ] ) ) { self :: setInstance ( $ name , new self ( ) ) ; } return self :: $ instances [ $ name ] ; }
Returns a named instance of the Event Dispatcher .
13,251
public static function setInstance ( string $ name , self $ instance ) : void { self :: $ instances [ $ name ] = $ instance ; }
Sets a names instance of the Event Dispatcher .
13,252
public function transform ( ProjectDescriptor $ project , Transformation $ transformation ) : void { $ template_path = $ this -> getTemplatePath ( $ transformation ) ; $ finder = new Pathfinder ( ) ; $ nodes = $ finder -> find ( $ project , $ transformation -> getQuery ( ) ) ; foreach ( $ nodes as $ node ) { if ( ! $ n...
This method combines the ProjectDescriptor and the given target template and creates a static html page at the artifact location .
13,253
protected function initializeEnvironment ( ProjectDescriptor $ project , Transformation $ transformation , string $ destination ) : Twig_Environment { $ callingTemplatePath = $ this -> getTemplatePath ( $ transformation ) ; $ baseTemplatesPath = $ transformation -> getTransformer ( ) -> getTemplates ( ) -> getTemplates...
Initializes the Twig environment with the template base extension and additionally defined extensions .
13,254
protected function addPhpDocumentorExtension ( ProjectDescriptor $ project , Transformation $ transformation , string $ destination , Twig_Environment $ twigEnvironment ) : void { $ base_extension = new Extension ( $ project , $ transformation ) ; $ base_extension -> setDestination ( substr ( $ destination , strlen ( $...
Adds the phpDocumentor base extension to the Twig Environment .
13,255
protected function getTemplatePath ( Transformation $ transformation ) : string { $ parts = preg_split ( '[\\\\|/]' , $ transformation -> getSource ( ) ) ; return $ parts [ 0 ] . DIRECTORY_SEPARATOR . $ parts [ 1 ] ; }
Returns the path belonging to the template .
13,256
public function convert ( \ DOMElement $ parent , MethodDescriptor $ method ) { $ fullyQualifiedNamespaceName = $ method -> getNamespace ( ) instanceof NamespaceDescriptor ? $ method -> getNamespace ( ) -> getFullyQualifiedStructuralElementName ( ) : $ parent -> getAttribute ( 'namespace' ) ; $ child = new \ DOMElement...
Export the given reflected method definition to the provided parent element .
13,257
public function getAllErrors ( ) { $ errors = $ this -> getErrors ( ) ; $ types = $ this -> getClasses ( ) -> merge ( $ this -> getInterfaces ( ) ) -> merge ( $ this -> getTraits ( ) ) ; $ elements = $ this -> getFunctions ( ) -> merge ( $ this -> getConstants ( ) ) -> merge ( $ types ) ; foreach ( $ elements as $ elem...
Returns a list of all errors in this file and all its child elements .
13,258
protected function configure ( ) { $ this -> addOption ( 'target' , 't' , InputOption :: VALUE_OPTIONAL , 'target location for output' , 'build' ) -> addOption ( 'input-format' , 'i' , InputOption :: VALUE_OPTIONAL , 'which input format does the documentation sources have?' , 'rst' ) -> addOption ( 'title' , null , Inp...
Configures the options and default help text .
13,259
protected function getTemplate ( InputInterface $ input ) { $ template = $ this -> getTemplateFactory ( ) -> get ( 'twig' ) ; $ template -> setName ( $ input -> getOption ( 'template' ) ) ; return $ template ; }
Returns a template object based off the human - readable template name .
13,260
protected function getConverter ( InputInterface $ input ) { return $ this -> getConverterFactory ( ) -> get ( $ input -> getOption ( 'input-format' ) , $ this -> output_format ) ; }
Returns the converter for this operation .
13,261
protected function visitSection ( \ DOMNode $ root , \ ezcDocumentRstNode $ node ) { if ( $ node instanceof ezcDocumentRstSectionNode || $ node instanceof ezcDocumentRstDocumentNode ) { if ( $ node -> depth === 1 ) { $ toc = $ this -> getTableOfContents ( ) ; $ file = $ toc [ $ this -> getFilenameWithoutExtension ( ) ]...
Visitor for the section heading used to populate the TableOfContents .
13,262
public function addFileToLastHeading ( TableOfContents \ File $ file ) { $ this -> last_heading -> addChild ( $ file ) ; $ file -> setParent ( $ this -> last_heading ) ; }
Adds a TableOfContents File object to the last heading that was discovered .
13,263
protected function addProperties ( array $ properties , TraitDescriptor $ traitDescriptor ) : void { foreach ( $ properties as $ property ) { $ propertyDescriptor = $ this -> getBuilder ( ) -> buildDescriptor ( $ property ) ; if ( $ propertyDescriptor instanceof PropertyDescriptor ) { $ propertyDescriptor -> setParent ...
Registers the child properties with the generated Trait Descriptor .
13,264
public function setVersion ( string $ version ) { if ( ! preg_match ( '/^\d+\.\d+\.\d+$/' , $ version ) ) { throw new \ InvalidArgumentException ( 'Version number is invalid; ' . $ version . ' does not match ' . 'x.x.x (where x is a number)' ) ; } $ this -> version = $ version ; }
Sets the version number for this template .
13,265
public function offsetSet ( $ offset , $ value ) { if ( ! $ value instanceof Transformation ) { throw new \ InvalidArgumentException ( '\phpDocumentor\Transformer\Template may only contain items of ' . 'type \phpDocumentor\Transformer\Transformation' ) ; } $ this -> transformations [ $ offset ] = $ value ; }
Sets a transformation at the given offset .
13,266
public function propagateParameters ( ) { foreach ( $ this -> transformations as $ transformation ) { $ transformation -> setParameters ( array_merge ( $ transformation -> getParameters ( ) , $ this -> getParameters ( ) ) ) ; } }
Pushes the parameters of this template into the transformations .
13,267
public function get ( string $ input_format , string $ output_format ) : ConverterInterface { $ definition = $ this -> definition_factory -> get ( $ input_format , $ output_format ) ; foreach ( $ this -> converters as $ class => $ formats ) { if ( [ $ input_format , $ output_format ] === $ formats ) { $ assets = new Me...
Retrieves a new instance of the converter necessary to convert the give input format to the given output format .
13,268
public function getSupportedInputFormats ( string $ given_output_format ) : array { $ result = [ ] ; foreach ( $ this -> converters as $ formats ) { list ( $ input_format , $ output_format ) = $ formats ; if ( $ given_output_format === $ output_format ) { $ result [ ] = $ input_format ; } } return $ result ; }
Returns a list of supported input formats for the given output format .
13,269
public function getSourceAsPath ( ) : string { if ( $ this -> getParameter ( 'template_path' ) !== null ) { $ path = rtrim ( $ this -> getParameter ( 'template_path' ) -> getValue ( ) , '/\\' ) ; if ( file_exists ( $ path . DIRECTORY_SEPARATOR . $ this -> source ) ) { return $ path . DIRECTORY_SEPARATOR . $ this -> sou...
Returns the source as a path instead of a regular value .
13,270
public function save ( ProjectDescriptor $ projectDescriptor ) : void { $ keys = [ ] ; $ cache = $ this -> getCache ( ) ; foreach ( $ cache as $ key ) { $ keys [ ] = $ key ; } $ cache -> setItem ( self :: KEY_SETTINGS , $ projectDescriptor -> getSettings ( ) ) ; $ usedKeys = [ self :: KEY_SETTINGS ] ; foreach ( $ proje...
Stores a Project Descriptor in the Cache .
13,271
public function toDocbook ( \ DOMDocument $ document , \ DOMElement $ root ) { $ this -> storeAsset ( ) ; parent :: toDocbook ( $ document , $ root ) ; }
Converts the Image directive to aDocBook image tag .
13,272
protected function storeAsset ( ) { if ( ! $ this -> visitor instanceof Discover ) { return ; } $ assets = $ this -> getAssetManager ( ) ; $ project_root = $ assets -> getProjectRoot ( ) ; $ asset_path = trim ( $ this -> node -> parameters ) ; $ file_path = $ this -> visitor -> getDocument ( ) -> getFile ( ) -> getReal...
Stores the asset in the asset manager .
13,273
public function execute ( ProjectDescriptor $ project ) : void { $ markerTerms = $ project -> getSettings ( ) -> getMarkers ( ) ; foreach ( $ project -> getFiles ( ) as $ file ) { $ marker_data = [ ] ; $ matches = [ ] ; preg_match_all ( '~//[\s]*(' . implode ( '|' , $ markerTerms ) . ')\:?[\s]*(.*)~' , $ file -> getSou...
Scans the files for markers and records them in the markers property of a file .
13,274
public function transform ( ProjectDescriptor $ project , Transformation $ transformation ) { $ artifact = $ this -> getDestinationPath ( $ transformation ) ; $ this -> checkForSpacesInPath ( $ artifact ) ; $ this -> xml = new \ DOMDocument ( '1.0' , 'utf-8' ) ; $ this -> xml -> formatOutput = true ; $ document_element...
This method generates the AST output
13,275
protected function finalize ( ProjectDescriptor $ projectDescriptor ) { $ behaviour = new AuthorTag ( ) ; $ behaviour -> process ( $ this -> xml ) ; $ behaviour = new CoversTag ( ) ; $ behaviour -> process ( $ this -> xml ) ; $ behaviour = new IgnoreTag ( ) ; $ behaviour -> process ( $ this -> xml ) ; $ behaviour = new...
Finalizes the processing and executing all post - processing actions .
13,276
protected function buildDeprecationList ( \ DOMDocument $ dom ) { $ nodes = $ this -> getNodeListForTagBasedQuery ( $ dom , 'deprecated' ) ; $ node = new \ DOMElement ( 'deprecated' ) ; $ dom -> documentElement -> appendChild ( $ node ) ; $ node -> setAttribute ( 'count' , ( string ) $ nodes -> length ) ; }
Adds a node to the xml for deprecations and the count value
13,277
protected function getNodeListForTagBasedQuery ( $ dom , $ marker ) { $ xpath = new \ DOMXPath ( $ dom ) ; $ query = '/project/file/markers/' . $ marker . '|' ; $ query .= '/project/file/docblock/tag[@name="' . $ marker . '"]|' ; $ query .= '/project/file/class/docblock/tag[@name="' . $ marker . '"]|' ; $ query .= '/pr...
Build a tag based query string and return result
13,278
protected function configureConverterFromInputOptions ( $ converter , $ input ) { if ( ! $ converter instanceof ToLatexInterface ) { throw new \ InvalidArgumentException ( 'The converter used to process ' . $ input -> getOption ( 'input-format' ) . ' should implement the ' . 'phpDocumentor\Plugin\Scrybe\Converter\ToPdf...
Configures the converter with the options provided by the Input options .
13,279
public function create ( array $ paths , array $ ignore , array $ extensions ) : SpecificationInterface { $ pathSpec = null ; foreach ( $ paths as $ path ) { $ pathSpec = $ this -> orSpec ( $ this -> inPath ( $ path ) , $ pathSpec ) ; } $ ignoreSpec = null ; if ( isset ( $ ignore [ 'paths' ] ) ) { foreach ( $ ignore [ ...
Creates a SpecificationInterface object based on the ignore and extension parameters .
13,280
private function buildVersion ( SimpleXMLElement $ version ) : array { $ apis = [ ] ; $ guides = [ ] ; foreach ( $ version -> children ( ) as $ child ) { switch ( $ child -> getName ( ) ) { case 'api' : $ apis [ ] = $ this -> buildApi ( $ child ) ; break ; case 'guide' : $ guides [ ] = $ this -> buildGuide ( $ child ) ...
Builds the versions part of the array from the configuration xml .
13,281
private function buildApi ( SimpleXMLElement $ api ) : array { $ extensions = [ ] ; foreach ( $ api -> extensions -> children ( ) as $ extension ) { if ( ( string ) $ extension !== '' ) { $ extensions [ ] = ( string ) $ extension ; } } $ ignoreHidden = filter_var ( $ api -> ignore -> attributes ( ) -> hidden , FILTER_V...
Builds the api part of the array from the configuration xml .
13,282
private function buildGuide ( SimpleXMLElement $ guide ) : array { return [ 'format' => ( ( string ) $ guide -> attributes ( ) -> format ) ? : 'rst' , 'source' => [ 'dsn' => ( ( string ) $ guide -> source -> attributes ( ) -> dsn ) ? : 'file://.' , 'paths' => ( ( array ) $ guide -> source -> path ) ? : [ '' ] , ] , ] ;...
Builds the guide part of the array from the configuration xml .
13,283
private function validate ( SimpleXMLElement $ phpDocumentor ) : void { libxml_clear_errors ( ) ; $ priorSetting = libxml_use_internal_errors ( true ) ; $ dom = new \ DOMDocument ( ) ; $ domElement = dom_import_simplexml ( $ phpDocumentor ) ; $ domElement = $ dom -> importNode ( $ domElement , true ) ; $ dom -> appendC...
Validates the configuration xml structure against the schema defined in the schemaPath .
13,284
public function get ( $ index , $ valueIfEmpty = null ) { if ( ! $ this -> offsetExists ( $ index ) && $ valueIfEmpty !== null ) { $ this -> offsetSet ( $ index , $ valueIfEmpty ) ; } return $ this -> offsetGet ( $ index ) ; }
Retrieves a specific item from the Collection with its index .
13,285
public function offsetSet ( $ offset , $ value ) { if ( $ offset === '' || $ offset === null ) { throw new \ InvalidArgumentException ( 'The key of a collection must always be set' ) ; } $ this -> items [ $ offset ] = $ value ; }
Sets an item at the given index .
13,286
public function copyTo ( $ destination ) { foreach ( $ this as $ source_path => $ asset_path ) { if ( ! is_readable ( $ source_path ) ) { if ( $ this -> logger ) { $ this -> logger -> error ( 'Asset "' . $ source_path . '" could not be found or is not readable' ) ; } continue ; } $ destination_path = $ destination . '/...
Copies all assets in this collection to their given destination location .
13,287
public function filter ( $ value ) { $ isInternalAllowed = $ this -> builder -> isVisibilityAllowed ( Settings :: VISIBILITY_INTERNAL ) ; if ( $ isInternalAllowed ) { $ value -> setDescription ( preg_replace ( '/\{@internal\s(.+?)\}\}/' , '$1' , $ value -> getDescription ( ) ) ) ; return $ value ; } $ value -> setDescr...
If the ProjectDescriptor s settings allow internal tags then return the Descriptor otherwise null to filter it .
13,288
public function getFilename ( ) { $ converter = $ this -> getDocument ( ) -> getConverter ( ) ; return $ converter -> getDestinationFilenameRelativeToProjectRoot ( $ this -> getDocument ( ) -> getFile ( ) ) ; }
Returns the filename for this visitor .
13,289
public function getFilenameWithoutExtension ( ) { $ filename = $ this -> getDocument ( ) -> getFile ( ) -> getFilename ( ) ; return substr ( $ filename , 0 , strrpos ( $ filename , '.' ) ) ; }
Returns the filename for this visitor without an extension .
13,290
public function convertToRootPath ( $ relative_path ) : ? string { $ path_parts = explode ( DIRECTORY_SEPARATOR , $ this -> getDestination ( ) ) ; $ path_to_root = ( count ( $ path_parts ) > 1 ) ? implode ( '/' , array_fill ( 0 , count ( $ path_parts ) - 1 , '..' ) ) . '/' : '' ; if ( is_string ( $ relative_path ) && (...
Converts the given path to be relative to the root of the documentation target directory .
13,291
protected function renderASeriesOfLinks ( $ value , $ presentation ) : array { if ( $ value instanceof Collection ) { $ value = $ value -> getAll ( ) ; } $ result = [ ] ; foreach ( $ value as $ path ) { $ result [ ] = $ this -> render ( $ path , $ presentation ) ; } return $ result ; }
Returns a series of anchors and strings for the given collection of routable items .
13,292
protected function renderTypeCollection ( $ value , $ presentation ) { $ baseType = $ this -> render ( $ value -> getBaseType ( ) , $ presentation ) ; $ keyTypes = $ this -> render ( $ value -> getKeyTypes ( ) , $ presentation ) ; $ types = $ this -> render ( $ value -> getTypes ( ) , $ presentation ) ; $ arguments = [...
Renders the view representation for an array or collection .
13,293
public function create ( Dsn $ dsn ) { $ dsnId = hash ( 'md5' , ( string ) $ dsn ) ; try { $ filesystem = $ this -> mountManager -> getFilesystem ( $ dsnId ) ; } catch ( LogicException $ e ) { if ( $ dsn -> getScheme ( ) === 'file' ) { $ path = $ dsn -> getPath ( ) ; $ filesystem = new Filesystem ( new Local ( $ path ,...
Returns a Filesystem instance based on the scheme of the provided Dsn
13,294
protected function getSubElements ( DescriptorAbstract $ element ) : array { $ subElements = [ ] ; if ( $ element instanceof ClassInterface ) { $ subElements = array_merge ( $ element -> getMethods ( ) -> getAll ( ) , $ element -> getConstants ( ) -> getAll ( ) , $ element -> getProperties ( ) -> getAll ( ) ) ; } if ( ...
Returns any sub - elements for the given element .
13,295
protected function addElementsToIndexes ( $ elements , array $ indexes ) : void { if ( ! is_array ( $ elements ) ) { $ elements = [ $ elements ] ; } foreach ( $ elements as $ element ) { foreach ( $ indexes as $ collection ) { $ collection -> set ( $ this -> getIndexKey ( $ element ) , $ element ) ; } } }
Adds a series of descriptors to the given list of collections .
13,296
protected function defineIniSettings ( ) : void { $ this -> setTimezone ( ) ; ini_set ( 'memory_limit' , '-1' ) ; if ( extension_loaded ( 'Zend OPcache' ) && ini_get ( 'opcache.enable' ) && ini_get ( 'opcache.enable_cli' ) ) { if ( ini_get ( 'opcache.save_comments' ) ) { ini_set ( 'opcache.load_comments' , '1' ) ; } el...
Adjust php . ini settings .
13,297
protected function addArgumentsToFunctionDescriptor ( array $ arguments , FunctionDescriptor $ functionDescriptor ) : void { foreach ( $ arguments as $ argument ) { $ this -> addArgumentDescriptorToFunction ( $ functionDescriptor , $ this -> createArgumentDescriptor ( $ functionDescriptor , $ argument ) ) ; } }
Converts each argument reflector to an argument descriptor and adds it to the function descriptor .
13,298
protected function addArgumentDescriptorToFunction ( FunctionDescriptor $ functionDescriptor , ArgumentDescriptor $ argumentDescriptor ) : void { $ functionDescriptor -> getArguments ( ) -> set ( $ argumentDescriptor -> getName ( ) , $ argumentDescriptor ) ; }
Adds the given argument to the function .
13,299
public function fromNamespace ( $ fqnn ) { $ name = str_replace ( '\\' , '.' , ltrim ( ( string ) $ fqnn , '\\' ) ) ; if ( $ name === '' ) { $ name = 'default' ; } return $ name ; }
Converts the provided FQCN into a file name by replacing all slashes with dots .