本文整理汇总了PHP中Package::help方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::help方法的具体用法?PHP Package::help怎么用?PHP Package::help使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::help方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init($args)
{
try {
if (!isset($args[1])) {
static::help();
return;
}
switch ($args[1]) {
case 'g':
case 'generate':
switch ($args[2]) {
case 'controller':
case 'model':
case 'view':
case 'views':
case 'migration':
call_user_func('Oil\\Generate::' . $args[2], array_slice($args, 3));
break;
case 'scaffold':
call_user_func('Oil\\Scaffold::generate', array_slice($args, 3));
break;
default:
Generate::help();
}
break;
case 'c':
case 'console':
new Console();
case 'r':
case 'refine':
$task = isset($args[2]) ? $args[2] : null;
call_user_func('Oil\\Refine::run', $task, array_slice($args, 3));
break;
case 'p':
case 'package':
switch ($args[2]) {
case 'install':
case 'uninstall':
call_user_func_array('Oil\\Package::' . $args[2], array_slice($args, 3));
break;
default:
Package::help();
}
break;
case '-v':
case '--version':
\Cli::write('Fuel: ' . \Fuel::VERSION);
break;
case 'test':
\Fuel::add_package('octane');
call_user_func('\\Fuel\\Octane\\Tests::run_' . $args[2], array_slice($args, 3));
break;
default:
static::help();
}
} catch (Exception $e) {
\Cli::write(\Cli::color('Error: ' . $e->getMessage(), 'light_red'));
\Cli::beep();
}
}
示例2: init
public static function init($args)
{
// Remove flag options from the main argument list
for ($i = 0; $i < count($args); $i++) {
if (strpos($args[$i], '-') === 0) {
unset($args[$i]);
}
}
try {
if (!isset($args[1])) {
if (\Cli::option('v', \Cli::option('version'))) {
\Cli::write('Fuel: ' . \Fuel::VERSION);
return;
}
static::help();
return;
}
switch ($args[1]) {
case 'g':
case 'generate':
$action = isset($args[2]) ? $args[2] : 'help';
$subfolder = 'default';
if (is_int(strpos($action, 'scaffold/'))) {
$subfolder = str_replace('scaffold/', '', $action);
$action = 'scaffold';
}
switch ($action) {
case 'controller':
case 'model':
case 'views':
case 'migration':
call_user_func('Oil\\Generate::' . $action, array_slice($args, 3));
break;
case 'scaffold':
call_user_func('Oil\\Scaffold::generate', array_slice($args, 3), $subfolder);
break;
default:
Generate::help();
}
break;
case 'c':
case 'console':
new Console();
case 'r':
case 'refine':
// Developers of third-party tasks may not be displaying PHP errors. Report any error and quit
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
\Cli::error("Error: {$errstr} in {$errfile} on {$errline}");
\Cli::beep();
exit;
});
$task = isset($args[2]) ? $args[2] : null;
call_user_func('Oil\\Refine::run', $task, array_slice($args, 3));
break;
case 'p':
case 'package':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'install':
case 'uninstall':
call_user_func_array('Oil\\Package::' . $action, array_slice($args, 3));
break;
default:
Package::help();
}
break;
case 't':
case 'test':
// Suppressing this because if the file does not exist... well thats a bad thing and we can't really check
// I know that supressing errors is bad, but if you're going to complain: shut up. - Phil
@(include_once 'PHPUnit/Autoload.php');
// Attempt to load PHUnit. If it fails, we are done.
if (!class_exists('PHPUnit_Framework_TestCase')) {
throw new Exception('PHPUnit does not appear to be installed.' . PHP_EOL . PHP_EOL . "\tPlease visit http://phpunit.de and install.");
}
// CD to the root of Fuel and call up phpunit with a path to our config
$command = 'cd ' . DOCROOT . '; phpunit -c "' . COREPATH . 'phpunit.xml"';
// Respect the group option
\Cli::option('group') and $command .= ' --group ' . \Cli::option('group');
// Respect the coverage-html option
\Cli::option('coverage-html') and $command .= ' --coverage-html ' . \Cli::option('coverage-html');
passthru($command);
break;
default:
static::help();
}
} catch (Exception $e) {
\Cli::error('Error: ' . $e->getMessage());
\Cli::beep();
}
}
示例3: init
public static function init($args)
{
\Config::load('oil', true);
// Remove flag options from the main argument list
$args = self::_clear_args($args);
try {
if (!isset($args[1])) {
if (\Cli::option('v', \Cli::option('version'))) {
\Cli::write('Fuel: ' . \Fuel::VERSION . ' running in "' . \Fuel::$env . '" mode');
return;
}
static::help();
return;
}
switch ($args[1]) {
case 'g':
case 'generate':
$action = isset($args[2]) ? $args[2] : 'help';
$subfolder = 'orm';
if (is_int(strpos($action, '/'))) {
list($action, $subfolder) = explode('/', $action);
}
switch ($action) {
case 'config':
case 'controller':
case 'model':
case 'migration':
case 'task':
call_user_func('Oil\\Generate::' . $action, array_slice($args, 3));
break;
case 'views':
call_user_func('Oil\\Generate::views', array_slice($args, 3), $subfolder);
break;
case 'admin':
call_user_func('Oil\\Generate_Admin::forge', array_slice($args, 3), $subfolder);
break;
case 'scaffold':
call_user_func('Oil\\Generate_Scaffold::forge', array_slice($args, 3), $subfolder);
break;
default:
Generate::help();
}
break;
case 'c':
case 'console':
new Console();
case 'p':
case 'package':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'install':
case 'uninstall':
call_user_func_array('Oil\\Package::' . $action, array_slice($args, 3));
break;
default:
Package::help();
}
break;
case 'r':
case 'refine':
$task = isset($args[2]) ? $args[2] : null;
call_user_func('Oil\\Refine::run', $task, array_slice($args, 3));
break;
case 'cell':
case 'cells':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'list':
call_user_func('Oil\\Cell::all');
break;
case 'search':
case 'install':
case 'upgrade':
case 'uninstall':
call_user_func_array('Oil\\Cell::' . $action, array_slice($args, 3));
break;
case 'info':
case 'details':
call_user_func_array('Oil\\Cell::info', array_slice($args, 3));
break;
default:
Cell::help();
}
break;
case 't':
case 'test':
// Suppressing this because if the file does not exist... well thats a bad thing and we can't really check
// I know that supressing errors is bad, but if you're going to complain: shut up. - Phil
$phpunit_autoload_path = \Config::get('oil.phpunit.autoload_path', 'PHPUnit/Autoload.php');
@(include_once $phpunit_autoload_path);
// Attempt to load PHUnit. If it fails, we are done.
if (!class_exists('PHPUnit_Framework_TestCase')) {
throw new Exception('PHPUnit does not appear to be installed.' . PHP_EOL . PHP_EOL . "\tPlease visit http://phpunit.de and install.");
}
// Check for a custom phpunit config, but default to the one from core
if (file_exists(APPPATH . 'phpunit.xml')) {
$phpunit_config = APPPATH . 'phpunit.xml';
} else {
$phpunit_config = COREPATH . 'phpunit.xml';
}
//.........这里部分代码省略.........
示例4: init
public static function init($args)
{
// Remove flag options from the main argument list
$args = self::_clear_args($args);
try {
if (!isset($args[1])) {
if (\Cli::option('v', \Cli::option('version'))) {
\Cli::write('Fuel: ' . \Fuel::VERSION);
return;
}
static::help();
return;
}
switch ($args[1]) {
case 'g':
case 'generate':
$action = isset($args[2]) ? $args[2] : 'help';
$subfolder = 'orm';
if (is_int(strpos($action, '/'))) {
list($action, $subfolder) = explode('/', $action);
}
switch ($action) {
case 'config':
case 'controller':
case 'model':
case 'migration':
call_user_func('Oil\\Generate::' . $action, array_slice($args, 3));
break;
case 'views':
call_user_func('Oil\\Generate::views', array_slice($args, 3), $subfolder);
break;
case 'admin':
call_user_func('Oil\\Generate_Admin::forge', array_slice($args, 3), $subfolder);
break;
case 'scaffold':
call_user_func('Oil\\Generate_Scaffold::forge', array_slice($args, 3), $subfolder);
break;
default:
Generate::help();
}
break;
case 'c':
case 'console':
new Console();
case 'p':
case 'package':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'install':
case 'uninstall':
call_user_func_array('Oil\\Package::' . $action, array_slice($args, 3));
break;
default:
Package::help();
}
break;
case 'r':
case 'refine':
// Developers of third-party tasks may not be displaying PHP errors. Report any error and quit
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
if (!error_reporting()) {
return;
}
// If the error was supressed with an @ then we ignore it!
\Cli::error("Error: {$errstr} in {$errfile} on {$errline}");
\Cli::beep();
exit;
});
$task = isset($args[2]) ? $args[2] : null;
call_user_func('Oil\\Refine::run', $task, array_slice($args, 3));
break;
case 'cell':
case 'cells':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'list':
call_user_func('Oil\\Cell::all');
break;
case 'search':
case 'install':
case 'upgrade':
case 'uninstall':
call_user_func_array('Oil\\Cell::' . $action, array_slice($args, 3));
break;
case 'info':
case 'details':
call_user_func_array('Oil\\Cell::info', array_slice($args, 3));
break;
default:
Cell::help();
}
break;
case 't':
case 'test':
// Suppressing this because if the file does not exist... well thats a bad thing and we can't really check
// I know that supressing errors is bad, but if you're going to complain: shut up. - Phil
@(include_once 'PHPUnit/Autoload.php');
// Attempt to load PHUnit. If it fails, we are done.
if (!class_exists('PHPUnit_Framework_TestCase')) {
throw new Exception('PHPUnit does not appear to be installed.' . PHP_EOL . PHP_EOL . "\tPlease visit http://phpunit.de and install.");
//.........这里部分代码省略.........
示例5: init
public static function init($args)
{
\Config::load('oil', true);
// Remove flag options from the main argument list
$args = self::_clear_args($args);
try {
if (!isset($args[1])) {
if (\Cli::option('v', \Cli::option('version'))) {
\Cli::write('Fuel: ' . \Fuel::VERSION . ' running in "' . \Fuel::$env . '" mode');
return;
}
static::help();
return;
}
switch ($args[1]) {
case 'g':
case 'generate':
$action = isset($args[2]) ? $args[2] : 'help';
$subfolder = 'orm';
if (is_int(strpos($action, '/'))) {
list($action, $subfolder) = explode('/', $action);
}
switch ($action) {
case 'config':
case 'controller':
case 'model':
case 'module':
case 'migration':
case 'task':
case 'package':
call_user_func('Oil\\Generate::' . $action, array_slice($args, 3));
break;
case 'views':
call_user_func('Oil\\Generate::views', array_slice($args, 3), $subfolder);
break;
case 'admin':
call_user_func('Oil\\Generate_Admin::forge', array_slice($args, 3), $subfolder);
break;
case 'scaffold':
call_user_func('Oil\\Generate_Scaffold::forge', array_slice($args, 3), $subfolder);
break;
default:
Generate::help();
}
break;
case 'c':
case 'console':
if (isset($args[2]) and $args[2] == 'help') {
Console::help();
} else {
new Console();
}
break;
case 'p':
case 'package':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'install':
case 'uninstall':
call_fuel_func_array('Oil\\Package::' . $action, array_slice($args, 3));
break;
default:
Package::help();
}
break;
case 'r':
case 'refine':
$task = isset($args[2]) ? $args[2] : null;
call_user_func('Oil\\Refine::run', $task, array_slice($args, 3));
break;
case 'cell':
case 'cells':
$action = isset($args[2]) ? $args[2] : 'help';
switch ($action) {
case 'list':
call_user_func('Oil\\Cell::all');
break;
case 'search':
case 'install':
case 'upgrade':
case 'uninstall':
call_fuel_func_array('Oil\\Cell::' . $action, array_slice($args, 3));
break;
case 'info':
case 'details':
call_fuel_func_array('Oil\\Cell::info', array_slice($args, 3));
break;
default:
Cell::help();
}
break;
case 't':
case 'test':
if (isset($args[2]) and $args[2] == 'help') {
$output = <<<HELP
Usage:
php oil [t|test]
Runtime options:
//.........这里部分代码省略.........