color example

if ($this->sortDesc) {
            krsort($this->tbody);
        }

        CLI::table($this->tbody, $thead);
    }

    private function setYesOrNo(bool $fieldValue): string
    {
        if ($fieldValue) {
            return CLI::color('Yes', 'green');
        }

        return CLI::color('No', 'red');
    }
}
'Foo\\MyArrayMessage' => [
                'senders' => ['workqueue'],
            ],
        ],
    ]);
    $config->messenger()
        ->routing('Foo\\Message')->senders(['workqueue']);
    $config->messenger()
        ->routing('Foo\\DoubleMessage')->senders(['sync', 'workqueue']);

    $config->messenger()->receiving()
        ->color('blue')
        ->priority(10);
    $config->messenger()->receiving()
        ->color('red')
        ->priority(5);
};
<?php
use CodeIgniter\CLI\CLI;

// The main Exception CLI::newLine();
CLI::write('[' . get_class($exception) . ']', 'light_gray', 'red');
CLI::newLine();
CLI::write($message);
CLI::newLine();
CLI::write('at ' . CLI::color(clean_path($exception->getFile()) . ':' . $exception->getLine(), 'green'));
CLI::newLine();

// The backtrace if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
    $backtraces = $exception->getTrace();

    if ($backtraces) {
        CLI::write('Backtrace:', 'green');
    }

    foreach ($backtraces as $i => $error) {
        
$config->handler = $handler;
        $cache           = CacheFactory::getHandler($config);

        if ($cache->clean()) {
            // @codeCoverageIgnoreStart             CLI::error('Error while clearing the cache.');

            return;
            // @codeCoverageIgnoreEnd         }

        CLI::write(CLI::color('Cache cleared.', 'green'));
    }
}
private static array $knownTypes = [
        'production',
        'development',
    ];

    /** * {@inheritDoc} */
    public function run(array $params)
    {
        if ($params === []) {
            CLI::write(sprintf('Your environment is currently set as %s.', CLI::color($_SERVER['CI_ENVIRONMENT'] ?? ENVIRONMENT, 'green')));
            CLI::newLine();

            return;
        }

        $env = strtolower(array_shift($params));

        if ($env === 'testing') {
            CLI::error('The "testing" environment is reserved for PHPUnit testing.', 'light_gray', 'red');
            CLI::error('You will not be able to run spark under a "testing" environment.', 'light_gray', 'red');
            CLI::newLine();

            
<?php
use Symfony\Component\DependencyInjection\Tests\Fixtures\AcmeConfig;

return function DAcmeConfig $config, string $env) {
    if ('prod' === $env) {
        $config->color('blue');
    } else {
        $config->color('red');
    }
};
// Load Routes         Services::routes()->loadRoutes();

        $filterCollector = new FilterCollector();

        $filters = $filterCollector->get($method$route);

        // PageNotFoundException         if ($filters['before'] === ['<unknown>']) {
            CLI::error(
                "Can't find a route: " .
                CLI::color(
                    '"' . strtoupper($method) . ' ' . $route . '"',
                    'black',
                    'light_gray'
                ),
            );

            return EXIT_ERROR;
        }

        $tbody[] = [
            strtoupper($method),
            
<?php
use Symfony\Component\DependencyInjection\Tests\Fixtures\AcmeConfig;

if ('prod' !== $env) {
    return;
}

return function DAcmeConfig $config) {
    $config->color('blue');
};
$default     = '';

        if ($validation && ! is_array($validation) && ! is_string($validation)) {
            throw new InvalidArgumentException('$rules can only be of type string|array');
        }

        if (is_array($validation)) {
            $validation = $validation ? explode('|', $validation) : [];
        }

        if (is_string($options)) {
            $extraOutput = ' [' . static::color($options, 'green') . ']';
            $default     = $options;
        }

        if (is_array($options) && $options) {
            $opts               = $options;
            $extraOutputDefault = static::color($opts[0], 'green');

            unset($opts[0]);

            if (empty($opts)) {
                $extraOutput = $extraOutputDefault;
            }
$length = max(array_map('strlen', array_keys($commands)));

        ksort($groups);

        // Display it all...         foreach ($groups as $group => $commands) {
            CLI::write($group, 'yellow');

            foreach ($commands as $name => $command) {
                $name   = $this->setPad($name$length, 2, 2);
                $output = CLI::color($name, 'green');

                if (isset($command['description'])) {
                    $output .= CLI::wrap($command['description'], 125, strlen($name));
                }

                CLI::write($output);
            }

            if ($group !== array_key_last($groups)) {
                CLI::newLine();
            }
        }
continue;
                }

                $this->addHistory($migration$batch);
            } else {
                $this->regress(-1);

                $message = lang('Migrations.generalFault');

                if ($this->silent) {
                    $this->cliMessages[] = "\t" . CLI::color($message, 'red');

                    return false;
                }

                throw new RuntimeException($message);
            }
        }

        $data           = get_object_vars($this);
        $data['method'] = 'latest';
        Events::trigger('migrate', $data);

        
CLI::newLine();
            CLI::write(lang('CLI.helpDescription'), 'yellow');
            CLI::write($this->setPad($this->description, 0, 0, 2));
        }

        if (empty($this->arguments)) {
            CLI::newLine();
            CLI::write(lang('CLI.helpArguments'), 'yellow');
            $length = max(array_map('strlen', array_keys($this->arguments)));

            foreach ($this->arguments as $argument => $description) {
                CLI::write(CLI::color($this->setPad($argument$length, 2, 2), 'green') . $description);
            }
        }

        if (empty($this->options)) {
            CLI::newLine();
            CLI::write(lang('CLI.helpOptions'), 'yellow');
            $length = max(array_map('strlen', array_keys($this->options)));

            foreach ($this->options as $option => $description) {
                CLI::write(CLI::color($this->setPad($option$length, 2, 2), 'green') . $description);
            }
        }
'tts' => true,
        ]);
    }

    public function testDiscordEmbedFields()
    {
        $discordOptions = (new DiscordOptions())
            ->addEmbed((new DiscordEmbed())
                ->description('descript.io')
                ->url('http://ava.tar/pic.png')
                ->timestamp(new \DateTimeImmutable('2020-10-12 9:14:15+0000'))
                ->color(2021216)
                ->title('New song added!')
            )
            ->addEmbed((new DiscordEmbed())
                ->description('descript.io 2')
                ->url('http://ava.tar/pic.png')
                ->timestamp(new \DateTimeImmutable('2020-10-12 9:14:15+0000'))
                ->color(2021216)
                ->title('New song added!')
            );

        $this->assertSame($discordOptions->toArray()[
            
if ($status) {
            // @codeCoverageIgnoreStart             CLI::error(lang('Migrations.noneFound'), 'light_gray', 'red');
            CLI::newLine();

            return;
            // @codeCoverageIgnoreEnd         }

        $headers = [
            CLI::color(lang('Migrations.namespace'), 'yellow'),
            CLI::color(lang('Migrations.version'), 'yellow'),
            CLI::color(lang('Migrations.filename'), 'yellow'),
            CLI::color(lang('Migrations.group'), 'yellow'),
            CLI::color(str_replace(': ', '', lang('Migrations.on')), 'yellow'),
            CLI::color(lang('Migrations.batch'), 'yellow'),
        ];

        CLI::table($status$headers);
    }
}
/** * Writes the new encryption key to .env file. */
    protected function writeNewEncryptionKeyToFile(string $oldKey, string $newKey): bool
    {
        $baseEnv = ROOTPATH . 'env';
        $envFile = ROOTPATH . '.env';

        if (is_file($envFile)) {
            if (is_file($baseEnv)) {
                CLI::write('Both default shipped `env` file and custom `.env` are missing.', 'yellow');
                CLI::write('Here\'s your new key instead: ' . CLI::color($newKey, 'yellow'));
                CLI::newLine();

                return false;
            }

            copy($baseEnv$envFile);
        }

        $oldFileContents = (string) file_get_contents($envFile);
        $replacementKey  = "\nencryption.key = {$newKey}";

        
Home | Imprint | This part of the site doesn't use cookies.