class ExtensionManager

Modules class for TastyIgniter.

Provides utility functions for working with modules.

Traits

Singleton trait.

Properties

static protected $instance from  Singleton
protected $app

The application instance, since Extensions are an extension of a Service Provider

protected array $extensions
protected array $installedExtensions
protected array $registrationMethodCache
protected array $paths
protected array $booted
protected array $registered
protected string $metaFile

Methods

static 
instance()

Create a new instance of this singleton.

static 
forgetInstance()

Forget this singleton's instance if it exists

__construct()

Constructor.

initialize()

No description

__clone()

No description

__wakeup()

No description

string
path($extension = null, $folder = null)

Return the path to the extension and its specified folder.

bool|array
files(string $extensionName = null, string $subFolder = null)

Return an associative array of files within one or more extensions.

array
filesPath($extensionName, $path = null)

Search a extension folder for files.

array
folders()

Returns an array of the folders in which extensions may be stored.

array
listExtensions()

Returns a list of all extensions in the system.

array
findMissingDependencies()

Scans extensions to locate any dependencies that are not currently installed. Returns an array of extension codes that are needed.

void
loadDependencies()

Checks all extensions and their dependencies, if not met extensions are disabled.

bool|array
getDependencies(string $extension)

Returns the extension codes that are required by the supplied extension.

array
listByDependencies(array $extensions = null)

Sorts extensions, in the order that they should be actioned, according to their given dependencies. Least required come first.

array
paths()

Create a Directory Map of all extensions

array
loadExtensions()

Finds all available extensions and loads them in to the $extensions array.

object|bool
loadExtension(string $name, string $path)

Loads a single extension in to the manager.

void
bootExtensions()

Runs the boot() method on all extensions. Can only be called once.

void
bootExtension(BaseExtension $extension = null)

Boot a single extension.

void
registerExtensions()

Runs the register() method on all extensions. Can only be called once.

void
registerExtension($name, BaseExtension $extension = null)

Register a single extension.

getExtensions()

Returns an array with all registered extensions The index is the extension name, the value is the extension object.

mixed|null
findExtension($name)

Returns a extension registration class based on its name.

string
checkName($name)

Checks to see if an extension name is well formed.

getIdentifier($name)

No description

getNamePath($name)

No description

bool
hasExtension($name)

Checks to see if an extension has been registered.

hasVendor($path)

No description

namespaces()

Returns a flat array of extensions namespaces and their paths

bool
isDisabled($name)

Determines if an extension is disabled by looking at the installed extensions config.

array
getRegistrationMethodValues(string $methodName)

Spins over every extension object and collects the results of a method call.

loadInstalled()

Loads all installed extension from application config.

bool
updateInstalledExtensions(string $code, bool $enable = TRUE)

No description

bool
removeExtension(array $extCode = null)

Delete extension the filesystem

bool
extractExtension($zipPath)

Extract uploaded extension zip folder

bool
installExtension(string $code, string $version = null)

Install a new or existing extension by code

bool
uninstallExtension(string $code, bool $purgeData = FALSE)

Uninstall a new or existing extension by code

bool
deleteExtension(string $code, bool $purgeData = TRUE)

Delete a single extension by code

mergeConfigFrom(string $namespace, string $path)

No description

getComposerInstalledVersion($extensionCode)

No description

Details

in Singleton at line 18
final static instance()

Create a new instance of this singleton.

in Singleton at line 28
final static forgetInstance()

Forget this singleton's instance if it exists

in Singleton at line 36
final protected __construct()

Constructor.

at line 65
initialize()

No description

in Singleton at line 48
__clone()

No description

in Singleton at line 53
__wakeup()

No description

at line 85
string path($extension = null, $folder = null)

Return the path to the extension and its specified folder.

Parameters

$extension

string The name of the extension (must match the folder name).

$folder

string The folder name to search for (Optional).

Return Value

string

The path, relative to the front controller.

at line 121
bool|array files(string $extensionName = null, string $subFolder = null)

Return an associative array of files within one or more extensions.

Parameters

string $extensionName
string $subFolder

Return Value

bool|array

An associative array, like:


array(
    'extension_name' => array(
        'folder' => array('file1', 'file2')
    )
)

at line 143
array filesPath($extensionName, $path = null)

Search a extension folder for files.

Parameters

$extensionName

string If not null, will return only files from that extension.

$path

string If not null, will return only files within that sub-folder of each extension (ie 'views').

Return Value

array

at line 170
array folders()

Returns an array of the folders in which extensions may be stored.

Return Value

array

The folders in which extensions may be stored.

at line 179
array listExtensions()

Returns a list of all extensions in the system.

Return Value

array

A list of all extensions in the system.

at line 201
array findMissingDependencies()

Scans extensions to locate any dependencies that are not currently installed. Returns an array of extension codes that are needed.

Return Value

array

at line 227
protected void loadDependencies()

Checks all extensions and their dependencies, if not met extensions are disabled.

Return Value

void

at line 253
bool|array getDependencies(string $extension)

Returns the extension codes that are required by the supplied extension.

Parameters

string $extension

Return Value

bool|array

at line 278
array listByDependencies(array $extensions = null)

Sorts extensions, in the order that they should be actioned, according to their given dependencies. Least required come first.

Parameters

array $extensions

Array to sort, or null to sort all.

Return Value

array

Collection of sorted extension identifiers

at line 314
array paths()

Create a Directory Map of all extensions

Return Value

array

A list of all extensions in the system.

at line 348
array loadExtensions()

Finds all available extensions and loads them in to the $extensions array.

Return Value

array

Exceptions

SystemException

at line 368
object|bool loadExtension(string $name, string $path)

Loads a single extension in to the manager.

Parameters

string $name

Eg: directory_name

string $path

Eg: base_path().'/extensions/directory_name';

Return Value

object|bool

Exceptions

SystemException

at line 406
void bootExtensions()

Runs the boot() method on all extensions. Can only be called once.

Return Value

void

at line 426
void bootExtension(BaseExtension $extension = null)

Boot a single extension.

Parameters

BaseExtension $extension

Return Value

void

at line 443
void registerExtensions()

Runs the register() method on all extensions. Can only be called once.

Return Value

void

at line 463
void registerExtension($name, BaseExtension $extension = null)

Register a single extension.

Parameters

$name
BaseExtension $extension

Return Value

void

at line 515
BaseExtension[] getExtensions()

Returns an array with all registered extensions The index is the extension name, the value is the extension object.

Return Value

BaseExtension[]

at line 533
mixed|null findExtension($name)

Returns a extension registration class based on its name.

Parameters

$name

Return Value

mixed|null

at line 549
string checkName($name)

Checks to see if an extension name is well formed.

Parameters

$name

Return Value

string

at line 554
getIdentifier($name)

No description

Parameters

$name

at line 561
getNamePath($name)

No description

Parameters

$name

at line 573
bool hasExtension($name)

Checks to see if an extension has been registered.

Parameters

$name

Return Value

bool

at line 578
hasVendor($path)

No description

Parameters

$path

at line 586
namespaces()

Returns a flat array of extensions namespaces and their paths

at line 608
bool isDisabled($name)

Determines if an extension is disabled by looking at the installed extensions config.

Parameters

$name

Return Value

bool

at line 618
array getRegistrationMethodValues(string $methodName)

Spins over every extension object and collects the results of a method call.

Parameters

string $methodName

Return Value

array

at line 640
loadInstalled()

Loads all installed extension from application config.

at line 653
bool updateInstalledExtensions(string $code, bool $enable = TRUE)

No description

Parameters

string $code
bool $enable

Return Value

bool

at line 681
bool removeExtension(array $extCode = null)

Delete extension the filesystem

Parameters

array $extCode

The extension to delete

Return Value

bool

TRUE on success, FALSE on failure

at line 708
bool extractExtension($zipPath)

Extract uploaded extension zip folder

Parameters

$zipPath

Return Value

bool

TRUE on success, FALSE on failure

at line 743
bool installExtension(string $code, string $version = null)

Install a new or existing extension by code

Parameters

string $code
string $version

Return Value

bool

at line 777
bool uninstallExtension(string $code, bool $purgeData = FALSE)

Uninstall a new or existing extension by code

Parameters

string $code
bool $purgeData

Return Value

bool

at line 796
bool deleteExtension(string $code, bool $purgeData = TRUE)

Delete a single extension by code

Parameters

string $code
bool $purgeData

Return Value

bool

Exceptions

Exception

at line 813
protected mergeConfigFrom(string $namespace, string $path)

No description

Parameters

string $namespace
string $path

at line 826
protected getComposerInstalledVersion($extensionCode)

No description

Parameters

$extensionCode