Class PluginAssetsCopyCommand
Command for copying plugin assets to app's webroot.
Property Summary
- 
        $_eventClass protectedstringDefault class name for new event objects. 
- 
        $_eventManager protectedCake\Event\EventManagerInterface|nullInstance of the Cake\Event\EventManager this object is using to dispatch inner events. 
- 
        $_tableLocator protectedCake\ORM\Locator\LocatorInterface|nullTable locator instance 
- 
        $args protectedCake\Console\ArgumentsArguments 
- 
        $defaultTable protectedstring|nullThis object's default table alias. 
- 
        $io protectedCake\Console\ConsoleIoConsole IO 
- 
        $name protectedstringThe name of this command. 
Method Summary
- 
          _copyDirectory() protectedCopy directory 
- 
          _createDirectory() protectedCreate directory 
- 
          _createSymlink() protectedCreate symlink 
- 
          _list() protectedGet list of plugins to process. Plugins without a webroot directory are skipped. 
- 
          _process() protectedProcess plugins 
- 
          _remove() protectedRemove folder/symlink. 
- 
          abort() publicHalt the current process with a StopException. 
- 
          buildOptionParser() publicGet the option parser. 
- 
          defaultName() public staticGet the command name. 
- 
          dispatchEvent() publicWrapper for creating and dispatching events. 
- 
          displayHelp() protectedOutput help content 
- 
          execute() publicExecute the command 
- 
          executeCommand() publicExecute another command with the provided set of arguments. 
- 
          fetchTable() publicConvenience method to get a table instance. 
- 
          getDescription() public staticGet the command description. 
- 
          getEventManager() publicReturns the Cake\Event\EventManager manager instance for this object. 
- 
          getName() publicGet the command name. 
- 
          getOptionParser() publicGet the option parser. 
- 
          getRootName() publicGet the root command name. 
- 
          getTableLocator() publicGets the table locator. 
- 
          initialize() publicHook method invoked by CakePHP when a command is about to be executed. 
- 
          log() publicConvenience method to write a message to Log. See Log::write() for more information on writing to logs. 
- 
          run() publicRun the command. 
- 
          setEventManager() publicReturns the Cake\Event\EventManagerInterface instance for this object. 
- 
          setName() publicSet the name this command uses in the collection. 
- 
          setOutputLevel() protectedSet the output level based on the Arguments. 
- 
          setTableLocator() publicSets the table locator. 
Method Detail
_copyDirectory() ¶ protected
_copyDirectory(string $source, string $destination): boolCopy directory
Parameters
- 
                string$source
- Source directory 
- 
                string$destination
- Destination directory 
Returns
bool_createDirectory() ¶ protected
_createDirectory(string $dir): boolCreate directory
Parameters
- 
                string$dir
- Directory name 
Returns
bool_createSymlink() ¶ protected
_createSymlink(string $target, string $link): boolCreate symlink
Parameters
- 
                string$target
- Target directory 
- 
                string$link
- Link name 
Returns
bool_list() ¶ protected
_list(string|null $name = null): array<string, mixed>Get list of plugins to process. Plugins without a webroot directory are skipped.
Parameters
- 
                string|null$name optional
- Name of plugin for which to symlink assets. If null all plugins will be processed. 
Returns
array<string, mixed>List of plugins with meta data.
_process() ¶ protected
_process(array<string, mixed> $plugins, bool $copy = false, bool $overwrite = false): voidProcess plugins
Parameters
- 
                array<string, mixed>$plugins
- List of plugins to process 
- 
                bool$copy optional
- Force copy mode. Default false. 
- 
                bool$overwrite optional
- Overwrite existing files. 
Returns
void_remove() ¶ protected
_remove(array<string, mixed> $config): boolRemove folder/symlink.
Parameters
- 
                array<string, mixed>$config
- Plugin config. 
Returns
boolabort() ¶ public
abort(int $code = self::CODE_ERROR): neverHalt the current process with a StopException.
Parameters
- 
                int$code optional
- The exit code to use. 
Returns
neverThrows
Cake\Console\Exception\StopExceptionbuildOptionParser() ¶ public
buildOptionParser(Cake\Console\ConsoleOptionParser $parser): Cake\Console\ConsoleOptionParserGet the option parser.
Parameters
- 
                Cake\Console\ConsoleOptionParser$parser
- The option parser to update 
Returns
Cake\Console\ConsoleOptionParserdefaultName() ¶ public static
defaultName(): stringGet the command name.
Returns the command name based on class name.
For e.g. for a command with class name UpdateTableCommand the default
name returned would be 'update_table'.
Returns
stringdispatchEvent() ¶ public
dispatchEvent(string $name, array $data = [], TSubject|null $subject = null): Cake\Event\EventInterface<TSubject>Wrapper for creating and dispatching events.
Returns a dispatched event.
Parameters
- 
                string$name
- Name of the event. 
- 
                array$data optional
- Any value you wish to be transported with this event to it can be read by listeners. 
- 
                TSubject|null$subject optional
- The object that this event applies to ($this by default). 
Returns
Cake\Event\EventInterface<TSubject>displayHelp() ¶ protected
displayHelp(Cake\Console\ConsoleOptionParser $parser, Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): voidOutput help content
Parameters
- 
                Cake\Console\ConsoleOptionParser$parser
- The option parser. 
- 
                Cake\Console\Arguments$args
- The command arguments. 
- 
                Cake\Console\ConsoleIo$io
- The console io 
Returns
voidexecute() ¶ public
execute(Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): int|nullExecute the command
Copying plugin assets to app's webroot. For vendor namespaced plugin, parent folder for vendor name are created if required.
Parameters
- 
                Cake\Console\Arguments$args
- The command arguments. 
- 
                Cake\Console\ConsoleIo$io
- The console io 
Returns
int|nullThe exit code or null for success
executeCommand() ¶ public
executeCommand(Cake\Console\CommandInterface|string $command, array $args = [], Cake\Console\ConsoleIo|null $io = null): int|nullExecute another command with the provided set of arguments.
If you are using a string command name, that command's dependencies will not be resolved with the application container. Instead you will need to pass the command as an object with all of its dependencies.
Parameters
- 
                Cake\Console\CommandInterface|string$command
- The command class name or command instance. 
- 
                array$args optional
- The arguments to invoke the command with. 
- 
                Cake\Console\ConsoleIo|null$io optional
- The ConsoleIo instance to use for the executed command. 
Returns
int|nullThe exit code or null for success of the command.
fetchTable() ¶ public
fetchTable(string|null $alias = null, array<string, mixed> $options = []): Cake\ORM\TableConvenience method to get a table instance.
Parameters
- 
                string|null$alias optional
- The alias name you want to get. Should be in CamelCase format. If - nullthen the value of $defaultTable property is used.
- 
                array<string, mixed>$options optional
- The options you want to build the table with. If a table has already been loaded the registry options will be ignored. 
Returns
Cake\ORM\TableThrows
Cake\Core\Exception\CakeExceptionIf `$alias` argument and `$defaultTable` property both are `null`.
See Also
getDescription() ¶ public static
getDescription(): stringGet the command description.
Returns
stringgetEventManager() ¶ public
getEventManager(): Cake\Event\EventManagerInterfaceReturns the Cake\Event\EventManager manager instance for this object.
You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Returns
Cake\Event\EventManagerInterfacegetOptionParser() ¶ public
getOptionParser(): Cake\Console\ConsoleOptionParserGet the option parser.
You can override buildOptionParser() to define your options & arguments.
Returns
Cake\Console\ConsoleOptionParserThrows
Cake\Core\Exception\CakeExceptionWhen the parser is invalid
getTableLocator() ¶ public
getTableLocator(): Cake\ORM\Locator\LocatorInterfaceGets the table locator.
Returns
Cake\ORM\Locator\LocatorInterfaceinitialize() ¶ public
initialize(): voidHook method invoked by CakePHP when a command is about to be executed.
Override this method and implement expensive/important setup steps that should not run on every command run. This method will be called before the options and arguments are validated and processed.
Returns
voidlog() ¶ public
log(Stringable|string $message, string|int $level = LogLevel::ERROR, array|string $context = []): boolConvenience method to write a message to Log. See Log::write() for more information on writing to logs.
Parameters
- 
                Stringable|string$message
- Log message. 
- 
                string|int$level optional
- Error level. 
- 
                array|string$context optional
- Additional log data relevant to this message. 
Returns
boolSuccess of log write.
run() ¶ public
run(array $argv, Cake\Console\ConsoleIo $io): int|nullRun the command.
Parameters
- 
                array$argv
- 
                Cake\Console\ConsoleIo$io
Returns
int|nullsetEventManager() ¶ public
setEventManager(Cake\Event\EventManagerInterface $eventManager): $thisReturns the Cake\Event\EventManagerInterface instance for this object.
You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Parameters
- 
                Cake\Event\EventManagerInterface$eventManager
- the eventManager to set 
Returns
$thissetName() ¶ public
setName(string $name): $thisSet the name this command uses in the collection.
Generally invoked by the CommandCollection when the command is added. Required to have at least one space in the name so that the root command can be calculated.
Parameters
- 
                string$name
Returns
$thissetOutputLevel() ¶ protected
setOutputLevel(Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): voidSet the output level based on the Arguments.
Parameters
- 
                Cake\Console\Arguments$args
- The command arguments. 
- 
                Cake\Console\ConsoleIo$io
- The console io 
Returns
voidsetTableLocator() ¶ public
setTableLocator(Cake\ORM\Locator\LocatorInterface $tableLocator): $thisSets the table locator.
Parameters
- 
                Cake\ORM\Locator\LocatorInterface$tableLocator
- LocatorInterface instance. 
Returns
$thisProperty Detail
$_eventManager ¶ protected
Instance of the Cake\Event\EventManager this object is using to dispatch inner events.
Type
Cake\Event\EventManagerInterface|null