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
static protected $directories

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

static 
addDirectory($directory)

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 $code, 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($code, 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($code)

Returns a extension registration class based on its name.

string
checkName($code)

Checks to see if an extension name is well formed.

getIdentifier($namespace)

No description

getNamePath($code)

No description

getExtensionPath($code, $path = '')

No description

bool
hasExtension($code)

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($code)

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

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 77
static addDirectory($directory)

No description

Parameters

$directory

at line 90
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 126
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 148
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 175
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 184
array listExtensions()

Returns a list of all extensions in the system.

Return Value

array

A list of all extensions in the system.

at line 194
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 220
protected void loadDependencies()

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

Return Value

void

at line 246
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 271
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 307
array paths()

Create a Directory Map of all extensions

Return Value

array

A list of all extensions in the system.

at line 334
array loadExtensions()

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

Return Value

array

Exceptions

SystemException

at line 354
object|bool loadExtension(string $code, string $path)

Loads a single extension in to the manager.

Parameters

string $code

Eg: extension code

string $path

Eg: base_path().'/extensions/vendor/extension';

Return Value

object|bool

Exceptions

SystemException

at line 391
void bootExtensions()

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

Return Value

void

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

Boot a single extension.

Parameters

BaseExtension $extension

Return Value

void

at line 428
void registerExtensions()

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

Return Value

void

at line 448
void registerExtension($code, BaseExtension $extension = null)

Register a single extension.

Parameters

$code
BaseExtension $extension

Return Value

void

at line 499
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 517
mixed|null findExtension($code)

Returns a extension registration class based on its name.

Parameters

$code

Return Value

mixed|null

at line 533
string checkName($code)

Checks to see if an extension name is well formed.

Parameters

$code

Return Value

string

at line 538
getIdentifier($namespace)

No description

Parameters

$namespace

at line 545
getNamePath($code)

No description

Parameters

$code

at line 550
getExtensionPath($code, $path = '')

No description

Parameters

$code
$path

at line 562
bool hasExtension($code)

Checks to see if an extension has been registered.

Parameters

$code

Return Value

bool

at line 567
hasVendor($path)

No description

Parameters

$path

at line 575
namespaces()

Returns a flat array of extensions namespaces and their paths

at line 595
bool isDisabled($code)

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

Parameters

$code

Return Value

bool

at line 605
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 627
loadInstalled()

Loads all installed extension from application config.

at line 640
bool updateInstalledExtensions(string $code, bool $enable = true)

No description

Parameters

string $code
bool $enable

Return Value

bool

at line 668
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 696
bool extractExtension($zipPath)

Extract uploaded extension zip folder

Parameters

$zipPath

Return Value

bool

TRUE on success, FALSE on failure

at line 731
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 765
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 784
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 801
protected mergeConfigFrom(string $namespace, string $path)

No description

Parameters

string $namespace
string $path