PHP Class CraftCli\Application

Inheritance: extends Symfony\Component\Console\Application
Afficher le fichier Open project: rsanchez/craft-cli

Protected Properties

Свойство Type Description
$addonAuthorName string Author name for generated addons
$addonAuthorUrl string Author url for generated addons
$config array Configuration items
$craftPath string Path to the craft folder
$hasValidCraftPath boolean Whether the craft folder has been set/guessed correctly
$userDefinedCommandDirs array A list of Command dirs
$userDefinedCommands array A list of Command objects
$vendorPath string Path to the Composer vendor folder

Méthodes publiques

Méthode Description
__construct ( $vendorPath = null )
addComposerCommands ( ) : void Find any Command plugins installed via composer or supplied by the main composer.json and add them to the Application
addComposerPlugins ( ) : void Find any Command plugins installed via composer and add them to the Application
addCustomComposerCommands ( ) : void Find any Command plugins upplied by the main composer.json and add them to the Application
addUserDefinedCommands ( ) : void Find any user-defined Commands in the config and add them to the Application
bootstrap ( ) : Craft\ConsoleApp Boot up craft
canBeBootstrapped ( ) : boolean Whether or not a valid system folder was found
findClassInDir ( string $subclassOf, string $dir, string $namespace = null ) : array Get a list of classes in the specified directory
findCommandsInDir ( string $dir, string $namespace = null ) : array Get a list of Symfony Console Commands classes in the specified directory
getAddonAuthorName ( ) : string Get the default addon author name
getAddonAuthorUrl ( ) : string Get the default addon author URL
getComposerConfig ( ) : array Get craft-cli configuration stored in the root composer.json
getConfig ( ) : array Get all configuration items
getConfigItem ( string $key ) : mixed Get the specified config item
getCraftFolder ( ) : string Get the name of the craft folder
getCraftPath ( ) : string Get the path to the craft folder
onCommand ( Symfony\Component\Console\Event\ConsoleCommandEvent $event ) : void On Command Event Handler
registerCommand ( string | callable $class ) : void Add a command to the Application by class name or callback that return a Command class
setVendorPath ( string $vendorPath ) Set the path to the Composer vendor folder

Méthodes protégées

Méthode Description
findConfigFile ( string | null $dir = null ) : string | null Traverse up a directory to find a config file
getEnvironmentOption ( ) : string | null Get the environment from the --environment option or from the CRAFT_ENVIRONMENT env variable
isCommandExemptFromBootstrap ( Command $command ) : boolean Check whether a command should be exempt from bootstrapping
loadConfig ( ) : void Looks for ~/.craft-cli.php and ./.craft-cli.php and combines them into an array

Method Details

__construct() public méthode

public __construct ( $vendorPath = null )

addComposerCommands() public méthode

Find any Command plugins installed via composer or supplied by the main composer.json and add them to the Application
public addComposerCommands ( ) : void
Résultat void

addComposerPlugins() public méthode

Find any Command plugins installed via composer and add them to the Application
public addComposerPlugins ( ) : void
Résultat void

addCustomComposerCommands() public méthode

Find any Command plugins upplied by the main composer.json and add them to the Application
public addCustomComposerCommands ( ) : void
Résultat void

addUserDefinedCommands() public méthode

Find any user-defined Commands in the config and add them to the Application
public addUserDefinedCommands ( ) : void
Résultat void

bootstrap() public méthode

Boot up craft
public bootstrap ( ) : Craft\ConsoleApp
Résultat Craft\ConsoleApp

canBeBootstrapped() public méthode

Whether or not a valid system folder was found
public canBeBootstrapped ( ) : boolean
Résultat boolean

findClassInDir() public méthode

Get a list of classes in the specified directory
public findClassInDir ( string $subclassOf, string $dir, string $namespace = null ) : array
$subclassOf string
$dir string
$namespace string
Résultat array

findCommandsInDir() public méthode

Get a list of Symfony Console Commands classes in the specified directory
public findCommandsInDir ( string $dir, string $namespace = null ) : array
$dir string
$namespace string
Résultat array

findConfigFile() protected méthode

Traverse up a directory to find a config file
protected findConfigFile ( string | null $dir = null ) : string | null
$dir string | null defaults to getcwd if null
Résultat string | null

getAddonAuthorName() public méthode

Get the default addon author name
public getAddonAuthorName ( ) : string
Résultat string

getAddonAuthorUrl() public méthode

Get the default addon author URL
public getAddonAuthorUrl ( ) : string
Résultat string

getComposerConfig() public méthode

Get craft-cli configuration stored in the root composer.json
public getComposerConfig ( ) : array
Résultat array

getConfig() public méthode

Get all configuration items
public getConfig ( ) : array
Résultat array

getConfigItem() public méthode

Get the specified config item
public getConfigItem ( string $key ) : mixed
$key string
Résultat mixed

getCraftFolder() public méthode

Get the name of the craft folder
public getCraftFolder ( ) : string
Résultat string

getCraftPath() public méthode

Get the path to the craft folder
public getCraftPath ( ) : string
Résultat string

getEnvironmentOption() protected méthode

Get the environment from the --environment option or from the CRAFT_ENVIRONMENT env variable
protected getEnvironmentOption ( ) : string | null
Résultat string | null

isCommandExemptFromBootstrap() protected méthode

Check whether a command should be exempt from bootstrapping
protected isCommandExemptFromBootstrap ( Command $command ) : boolean
$command Symfony\Component\Console\Command\Command
Résultat boolean

loadConfig() protected méthode

Looks for ~/.craft-cli.php and ./.craft-cli.php and combines them into an array
protected loadConfig ( ) : void
Résultat void

onCommand() public méthode

Check if the current command requires EE bootstrapping and throw an exception if EE is not bootstrapped
public onCommand ( Symfony\Component\Console\Event\ConsoleCommandEvent $event ) : void
$event Symfony\Component\Console\Event\ConsoleCommandEvent
Résultat void

registerCommand() public méthode

Add a command to the Application by class name or callback that return a Command class
public registerCommand ( string | callable $class ) : void
$class string | callable class name or callback that returns a command
Résultat void

setVendorPath() public méthode

Set the path to the Composer vendor folder
public setVendorPath ( string $vendorPath )
$vendorPath string

Property Details

$addonAuthorName protected_oe property

Author name for generated addons
protected string $addonAuthorName
Résultat string

$addonAuthorUrl protected_oe property

Author url for generated addons
protected string $addonAuthorUrl
Résultat string

$config protected_oe property

Configuration items
protected array $config
Résultat array

$craftPath protected_oe property

Path to the craft folder
protected string $craftPath
Résultat string

$hasValidCraftPath protected_oe property

Whether the craft folder has been set/guessed correctly
protected bool $hasValidCraftPath
Résultat boolean

$userDefinedCommandDirs protected_oe property

A list of Command dirs
protected array $userDefinedCommandDirs
Résultat array

$userDefinedCommands protected_oe property

A list of Command objects
protected array $userDefinedCommands
Résultat array

$vendorPath protected_oe property

Path to the Composer vendor folder
protected string $vendorPath
Résultat string