PHP Class M1\Vars\Resource\FileResource

Since: 0.1.0
Inheritance: extends AbstractResource, use trait M1\Vars\Traits\FileTrait, use trait M1\Vars\Traits\ResourceFlagsTrait
Show file Open project: m1/Vars

Public Methods

Method Description
__construct ( ResourceProvider $provider, string $file ) The file resource constructor to get and parse the content from files
checkBooleanValue ( string $value, mixed $import ) : boolean Checks if the passed boolean value is true or false
getFilename ( ) : string Returns the filename of the resource
getRawContent ( ) : array | mixed Returns the raw content of the resource

Private Methods

Method Description
createImportName ( string $resource ) : string Creates the correctly formatted resource name with paths
createResource ( array | string $import ) : ResourceProvider Creates resource from the import
getBooleanValue ( string $value ) : boolean Gets the boolean value from the string
import2Resource ( array | string $import, array $imported_resources ) : array Creates the resource from the import then imports it
importResource ( ResourceProvider $provider, array $imported_resources ) : array Import resource into the imported resources and merge contents
isAssoc ( array $array ) : boolean Returns whether the passed array is associative
makePaths ( string $file ) Make the paths used for the filename variable
parseContent ( mixed $key, mixed $value, array $returned_content, string $prefix ) : array Parses the contents inside the content array
parseText ( string $text ) : string | null Parses the text for option and environment replacements and replaces the text
processImport ( mixed $import, array $imported_resources ) : array Processes the import and gets individual import if set and passes them off to import2Resources()
searchForResources ( mixed $content = [], string $prefix = '' ) : array Search for imports in the files and does the replacement variables
useImports ( mixed $imports ) : array Use the import arrays to import resources

Method Details

__construct() public method

The file resource constructor to get and parse the content from files
public __construct ( ResourceProvider $provider, string $file )
$provider ResourceProvider The parent ResourceProvider
$file string The passed file

checkBooleanValue() public method

Checks if the passed boolean value is true or false
public checkBooleanValue ( string $value, mixed $import ) : boolean
$value string The value to check
$import mixed The passed import
return boolean Returns the value of the boolean

getFilename() public method

Returns the filename of the resource
public getFilename ( ) : string
return string The filename

getRawContent() public method

Returns the raw content of the resource
public getRawContent ( ) : array | mixed
return array | mixed The raw content