PHP Class NerdsAndCompany\Schematic\Models\Data

Encapsulates data that has been exported via schematic.
Author: Nerds & Company
Inheritance: extends Craft\BaseModel
Mostra file Open project: itmundi/schematic Class Usage Examples

Public Methods

Method Description
fromYaml ( string $yaml, string $overrideYaml ) : Data Populate data model from yaml.
getAttribute ( string $attribute, boolean | false $flattenValue = false, array $default = [] ) : array
replaceEnvVariables ( string $yaml ) : string Replace placeholders with enviroment variables.
toYaml ( array $data ) : Data Populate yaml from data model.

Protected Methods

Method Description
defineAttributes ( ) Define attributes.

Method Details

defineAttributes() protected method

protected defineAttributes ( )

fromYaml() public static method

Populate data model from yaml.
public static fromYaml ( string $yaml, string $overrideYaml ) : Data
$yaml string
$overrideYaml string
return Data

getAttribute() public method

public getAttribute ( string $attribute, boolean | false $flattenValue = false, array $default = [] ) : array
$attribute string
$flattenValue boolean | false
$default array
return array

replaceEnvVariables() public static method

Placeholders start with % and end with %. This will be replaced by the environment variable with the name SCHEMATIC_{PLACEHOLDER}. If the environment variable is not set an exception will be thrown.
public static replaceEnvVariables ( string $yaml ) : string
$yaml string
return string

toYaml() public static method

Populate yaml from data model.
public static toYaml ( array $data ) : Data
$data array
return Data