Mixlib
in package
The Mixlib class is a utility for downloading/listing available mixins.
It is used by some test-infra and by civix.
Table of Contents
Properties
- $cache : mixed
- $mixlibDir : string|null
- Local path to the mixlib folder.
- $mixlibUrl : string|null
- Public URL of the mixlib folder.
Methods
- __construct() : mixed
- Mixlib constructor.
- assertValid() : array<string|int, mixed>
- consolidate() : array<string|int, mixed>
- Consolidate and retrieve the listed mixins.
- get() : array<string|int, mixed>
- getList() : array<string|int, mixed>
- resolve() : array<string|int, mixed>
- Consolidate and retrieve the listed mixins.
- getSourceCode() : string
- parseComment() : array<string|int, mixed>
- parseString() : array<string|int, mixed>
Properties
$cache
private
mixed
$cache
= []
$mixlibDir
Local path to the mixlib folder.
private
string|null
$mixlibDir
$mixlibUrl
Public URL of the mixlib folder.
private
string|null
$mixlibUrl
Methods
__construct()
Mixlib constructor.
public
__construct([string|null $mixlibDir = NULL ][, string|null $mixlibUrl = NULL ]) : mixed
Parameters
- $mixlibDir : string|null = NULL
-
Ex: Civi::paths()->getPath('[civicrm.root]/mixin')
- $mixlibUrl : string|null = NULL
-
Ex: "https://raw.githubusercontent.com/civicrm/civicrm-core/5.45/mixin" Ex: "https://raw.githubusercontent.com/totten/civicrm-core/master-mix-dec/mixin"
assertValid()
public
assertValid(array<string|int, mixed> $mixin) : array<string|int, mixed>
Parameters
- $mixin : array<string|int, mixed>
Return values
array<string|int, mixed>consolidate()
Consolidate and retrieve the listed mixins.
public
consolidate(array<string|int, mixed> $mixinConstraints) : array<string|int, mixed>
Parameters
- $mixinConstraints : array<string|int, mixed>
-
Ex: ['foo@1.0', 'bar@1.2', 'bar@1.3']
Return values
array<string|int, mixed> —Ex: ['foo@1.0' => array, 'bar@1.3' => array]
get()
public
get(string $mixin) : array<string|int, mixed>
Parameters
- $mixin : string
Return values
array<string|int, mixed> —Item with keys:
- mixinName: string, eg 'mgd-php'
- mixinVersion: string, eg '1.0.2'
- mixinConstraint: string, eg 'mgd-php@1.0.2'
- mixinFile: string, eg 'mgd-php@1.0.2.mixin.php'
- src: string, unevaluated PHP source
getList()
public
getList() : array<string|int, mixed>
Return values
array<string|int, mixed>resolve()
Consolidate and retrieve the listed mixins.
public
resolve(array<string|int, mixed> $mixinConstraints) : array<string|int, mixed>
Parameters
- $mixinConstraints : array<string|int, mixed>
-
Ex: ['foo@1.0', 'bar@1.2', 'bar@1.3']
Return values
array<string|int, mixed> —Ex: ['foo@1.0' => array, 'bar@1.3' => array]
getSourceCode()
protected
getSourceCode(string $mixin) : string
Parameters
- $mixin : string
-
Ex: 'foo@1.2.3', 'foo-bar@4.5.6', 'polyfill',
Return values
stringparseComment()
protected
parseComment(string $comment) : array<string|int, mixed>
Parameters
- $comment : string
Return values
array<string|int, mixed>parseString()
protected
parseString(string $phpCode) : array<string|int, mixed>
Parameters
- $phpCode : string