WP_CLI\Dispatcher
CommandFactory::create_namespace()
Create a new command namespace instance.
Method of the class: CommandFactory{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = CommandFactory::create_namespace( $parent, $name, $callable );
- $parent(mixed) (required)
- The new namespace's parent Root or Composite command.
- $name(string) (required)
- Represents how the command should be invoked
- $callable(mixed) (required)
- -
CommandFactory::create_namespace() CommandFactory::create namespace code WP-CLI 2.8.0-alpha
private static function create_namespace( $parent, $name, $callable ) { $reflection = new ReflectionClass( $callable ); $doc_comment = self::get_doc_comment( $reflection ); if ( ! $doc_comment ) { WP_CLI::debug( null === $doc_comment ? "Failed to get doc comment for {$name}." : "No doc comment for {$name}.", 'commandfactory' ); } $docparser = new DocParser( $doc_comment ); return new CommandNamespace( $parent, $name, $docparser ); }