Server : LiteSpeed
System : Linux quebec.us.hostns.io 5.14.0-687.42.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 27 11:55:12 EDT 2026 x86_64
User : gazetufm ( 1431)
PHP Version : 8.1.35
Disable Function : NONE
Directory :  /home2/gazetufm/leonora.al/wp-content/plugins/kirki/libraries/framework/Console/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: CommandManager.php

Path: //home2/gazetufm/leonora.al/wp-content/plugins/kirki/libraries/framework/Console/CommandManager.php

Size: 1.93 KB

Permissions: 0644

<?php

/**
 * Registers framework commands with WP-CLI under a configurable base prefix.
 * Resolves command classes from the container and validates they extend CommandBase.
 * Bridges the application container and WordPress CLI for artisan-style command discovery.
 *
 * @package    Framework
 * @subpackage Console
 * @since      1.0.0
 */
namespace Kirki\Framework\Console;

\defined('ABSPATH') || exit;
use RuntimeException;
use function Kirki\Framework\app;
class CommandManager
{
    /**
     * The base command name
     *
     * @var string
     *
     * @since 1.0.0
     */
    protected $command_base = 'kirki';
    /**
     * Register a command
     *
     * @param string $name The name.
     * @param mixed $command The command.
     *
     * @return void
     *
     * @since 1.0.0
     */
    public function register(string $name, $command)
    {
        $command = $this->resolve($command);
        $args = $command->args();
        \WP_CLI::add_command($this->make($name), $command, $args);
    }
    /**
     * Resolve the command
     *
     * @param mixed $command The command.
     *
     * @return CommandBase
     *
     * @throws \RuntimeException
     *
     * @since 1.0.0
     */
    protected function resolve($command)
    {
        if (\is_object($command)) {
            if (!$command instanceof CommandBase) {
                throw new RuntimeException(\sprintf("Command [%s] must extend [%s]", \get_class($command), CommandBase::class));
            }
            return $command;
        }
        if (!\class_exists($command)) {
            throw new RuntimeException(\sprintf("Command class [%s] not found", $command));
        }
        return app()->make($command);
    }
    /**
     * Make the command name
     *
     * @param mixed $command The command.
     *
     * @return string
     *
     * @since 1.0.0
     */
    protected function make($command)
    {
        return \sprintf('%s %s', $this->command_base, $command);
    }
}

← Back to Directory Edit File 🔒 Chmod

WP File Manager