class ScaffoldOptions (View source)

internal  
 

Per-project options from the 'extras' section of the composer.json file.

Projects that describe scaffold files do so via their scaffold options. This data is pulled from the 'drupal-scaffold' portion of the extras section of the project data.

Properties

protected array $options

The raw data from the 'extras' section of the top-level composer.json file.

Methods

__construct(array $options)

ScaffoldOptions constructor.

static bool
hasOptions(array $extras)

Determines if the provided 'extras' section has scaffold options.

static ScaffoldOptions
create(array $extras)

Creates a scaffold options object.

override(array $options)

Creates a new scaffold options object with some values overridden.

overrideSymlink(bool $symlink)

Creates a new scaffold options object with an overridden 'symlink' value.

bool
hasAllowedPackages()

Determines whether any allowed packages were defined.

array
allowedPackages()

Gets allowed packages from these options.

array
locations()

Gets the location mapping table, e.g. 'webroot' => './'.

bool
hasLocation(string $name)

Determines whether a given named location is defined.

string
getLocation(string $name)

Gets a specific named location.

bool
symlink()

Determines if symlink mode is set.

bool
hasFileMapping()

Determines if there are file mappings.

array
fileMapping()

Returns the actual file mappings.

bool
hasGitIgnore()

Determines if there is defined a value for the 'gitignore' option.

bool
gitIgnore()

Gets the value of the 'gitignore' option.

Details

protected __construct(array $options)

ScaffoldOptions constructor.

Parameters

array $options

The scaffold options taken from the 'drupal-scaffold' section.

static bool hasOptions(array $extras)

Determines if the provided 'extras' section has scaffold options.

Parameters

array $extras

The contents of the 'extras' section.

Return Value

bool

True if scaffold options have been declared

static ScaffoldOptions create(array $extras)

Creates a scaffold options object.

Parameters

array $extras

The contents of the 'extras' section.

Return Value

ScaffoldOptions

The scaffold options object representing the provided scaffold options

protected ScaffoldOptions override(array $options)

Creates a new scaffold options object with some values overridden.

Parameters

array $options

Override values.

Return Value

ScaffoldOptions

The scaffold options object representing the provided scaffold options

Creates a new scaffold options object with an overridden 'symlink' value.

Parameters

bool $symlink

Whether symlinking should be enabled or not.

Return Value

ScaffoldOptions

The scaffold options object representing the provided scaffold options

bool hasAllowedPackages()

Determines whether any allowed packages were defined.

Return Value

bool

Whether there are allowed packages

array allowedPackages()

Gets allowed packages from these options.

Return Value

array

The list of allowed packages

array locations()

Gets the location mapping table, e.g. 'webroot' => './'.

Return Value

array

A map of name : location values

protected bool hasLocation(string $name)

Determines whether a given named location is defined.

Parameters

string $name

The location name to search for.

Return Value

bool

True if the specified named location exist.

string getLocation(string $name)

Gets a specific named location.

Parameters

string $name

The name of the location to fetch.

Return Value

string

The value of the provided named location

Determines if symlink mode is set.

Return Value

bool

Whether or not 'symlink' mode

bool hasFileMapping()

Determines if there are file mappings.

Return Value

bool

Whether or not the scaffold options contain any file mappings

array fileMapping()

Returns the actual file mappings.

Return Value

array

File mappings for just this config type.

bool hasGitIgnore()

Determines if there is defined a value for the 'gitignore' option.

Return Value

bool

Whether or not there is a 'gitignore' option setting

bool gitIgnore()

Gets the value of the 'gitignore' option.

Return Value

bool

The 'gitignore' option, or TRUE if undefined.