PHP Class FluentDOM\Loaders

The list is iterated until a valid document is returned by the loader
Inheritance: implements IteratorAggregate, implements fluentdom\Loadable
Show file Open project: fluentdom/fluentdom Class Usage Examples

Public Methods

Method Description
__construct ( array | Traversable $list = NULL ) Store the a list of loaders if provided.
add ( fluentdom\Loadable $loader ) Add a loader to the list
getIterator ( ) : Traversable Allow to iterate all added loaders
load ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : DOMDocument | Result | null Load a data source, the content type allows the loader to decide if it supports the data source
loadFragment ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : DOMDocumentFragment | null Load a data source as a fragment, the content type allows the loader to decide if it supports the data source
remove ( fluentdom\Loadable $loader ) Remove a loader to the list
supports ( string $contentType ) : boolean Validate if the list contains a loader that supports the given content type

Method Details

__construct() public method

Store the a list of loaders if provided.
public __construct ( array | Traversable $list = NULL )
$list array | Traversable

add() public method

Add a loader to the list
public add ( fluentdom\Loadable $loader )
$loader fluentdom\Loadable

getIterator() public method

Allow to iterate all added loaders
public getIterator ( ) : Traversable
return Traversable

load() public method

Load a data source, the content type allows the loader to decide if it supports the data source
public load ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : DOMDocument | Result | null
$source mixed
$contentType string
$options array | Traversable | Options
return DOMDocument | FluentDOM\Loader\Result | null

loadFragment() public method

Load a data source as a fragment, the content type allows the loader to decide if it supports the data source
public loadFragment ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : DOMDocumentFragment | null
$source mixed
$contentType string
$options array | Traversable | Options
return DOMDocumentFragment | null

remove() public method

Remove a loader to the list
public remove ( fluentdom\Loadable $loader )
$loader fluentdom\Loadable

supports() public method

Validate if the list contains a loader that supports the given content type
public supports ( string $contentType ) : boolean
$contentType string
return boolean