当前位置: 首页>>代码示例>>PHP>>正文


PHP Cli::beep方法代码示例

本文整理汇总了PHP中Cli::beep方法的典型用法代码示例。如果您正苦于以下问题:PHP Cli::beep方法的具体用法?PHP Cli::beep怎么用?PHP Cli::beep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cli的用法示例。


在下文中一共展示了Cli::beep方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
     }
 }
开发者ID:netspencer,项目名称:fuel,代码行数:60,代码来源:cli.php

示例2: main

 private function main()
 {
     \Cli::write(sprintf('Fuel %s - PHP %s (%s) (%s) [%s]', \Fuel::VERSION, phpversion(), php_sapi_name(), self::build_date(), PHP_OS));
     // Loop until they break it
     while (TRUE) {
         if (\Cli::$readline_support) {
             readline_completion_function(array(__CLASS__, 'tab_complete'));
         }
         if (!($__line = rtrim(trim(trim(\Cli::input('>>> ')), PHP_EOL), ';'))) {
             continue;
         }
         if ($__line == 'quit') {
             break;
         }
         // Add this line to history
         //$this->history[] = array_slice($this->history, 0, -99) + array($line);
         if (\Cli::$readline_support) {
             readline_add_history($__line);
         }
         if (self::is_immediate($__line)) {
             $__line = "return ({$__line})";
         }
         ob_start();
         // Unset the previous line and execute the new one
         $random_ret = \Str::random();
         try {
             $ret = eval("unset(\$__line); {$__line};");
         } catch (\Exception $e) {
             $ret = $random_ret;
             $__line = $e->getMessage();
         }
         // Error was returned
         if ($ret === $random_ret) {
             \Cli::error('Parse Error - ' . $__line);
             \Cli::beep();
         }
         if (ob_get_length() == 0) {
             if (is_bool($ret)) {
                 echo $ret ? 'true' : 'false';
             } elseif (is_string($ret)) {
                 echo addcslashes($ret, "....ÿ");
             } elseif (!is_null($ret)) {
                 var_export($ret);
             }
         }
         unset($ret);
         $out = ob_get_contents();
         ob_end_clean();
         if (strlen($out) > 0 && substr($out, -1) != PHP_EOL) {
             $out .= PHP_EOL;
         }
         echo $out;
         unset($out);
     }
 }
开发者ID:highestgoodlikewater,项目名称:webspider-1,代码行数:55,代码来源:console.php

示例3: main

 private function main()
 {
     echo sprintf('Fuel %s - PHP %s (%s) (%s) [%s]', \Fuel::VERSION, phpversion(), php_sapi_name(), self::build_date(), PHP_OS) . PHP_EOL;
     // Loop until they break it
     while (TRUE) {
         echo ">>> ";
         if (!($__line = rtrim(trim(trim(fgets(STDIN)), PHP_EOL), ';'))) {
             continue;
         }
         if ($__line == 'quit') {
             break;
         }
         if (self::is_immediate($__line)) {
             $__line = "return ({$__line})";
         }
         ob_start();
         // Unset the previous line and execute the new one
         $ret = eval("unset(\$__line); {$__line};");
         // Error was returned
         if ($ret === false) {
             \Cli::write(\Cli::color('Parse Error - ' . $__line, 'light_red'));
             \Cli::beep();
         }
         if (ob_get_length() == 0) {
             if (is_bool($ret)) {
                 echo $ret ? "true" : "false";
             } else {
                 if (is_string($ret)) {
                     echo addcslashes($ret, "....ÿ");
                 } else {
                     if (!is_null($ret)) {
                         var_export($ret);
                     }
                 }
             }
         }
         unset($ret);
         $out = ob_get_contents();
         ob_end_clean();
         if (strlen($out) > 0 && substr($out, -1) != PHP_EOL) {
             $out .= PHP_EOL;
         }
         echo $out;
         unset($out);
     }
 }
开发者ID:huglester,项目名称:fuel-uploadify,代码行数:46,代码来源:console.php

示例4: 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();
     }
 }
开发者ID:469306621,项目名称:Languages,代码行数:91,代码来源:command.php

示例5: 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 '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.");
                 }
                 // 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');
                 \Cli::write('Tests Running...This may take a few moments.', 'green');
                 foreach (explode(';', $command) as $c) {
                     passthru($c);
                 }
                 break;
//.........这里部分代码省略.........
开发者ID:simonfork,项目名称:phpmark,代码行数:101,代码来源:command.php

示例6: _create_admin

 private function _create_admin()
 {
     \Cli::beep(1);
     // get attention
     $create_admin = \Cli::prompt("\nCreate an admin user?", array('y', 'n'));
     if ($create_admin === 'y') {
         $data = array('username' => \Cli::prompt("Please enter an admin username"), 'email' => \Cli::prompt("Please enter an admin email"), 'password' => \Cli::prompt("Please enter an admin password"));
         try {
             $user = new \Model_User($data);
             if (\Config::get('warden.confirmable.in_use') === true) {
                 $user->is_confirmed = true;
             }
             $user->roles[] = new \Model_Role(array('name' => 'Admin', 'description' => 'Site admin role.'));
             $user->save();
             $roles = array();
             foreach ($user->roles as $role) {
                 $roles[] = "<id: {$role->id}, name: {$role->name}>";
             }
             \Cli::write(\Cli::color("\nUsername : {$user->username}", 'blue'));
             \Cli::write(\Cli::color("Email    : {$user->email}", 'blue'));
             \Cli::write(\Cli::color("Password : {$data['password']}", 'blue'));
             if (!empty($roles)) {
                 \Cli::write(\Cli::color('Roles	 : ' . join(', ', $roles), 'blue'));
             }
         } catch (\Exception $e) {
             \Cli::error("\n:( Failed to create admin user because: " . $e->getMessage());
         }
     }
 }
开发者ID:nsbasicus,项目名称:warden,代码行数:29,代码来源:warden.php

示例7: print_exception

 private static function print_exception(\Exception $ex)
 {
     \Cli::error('Uncaught exception ' . get_class($ex) . ': ' . $ex->getMessage());
     \Cli::error('Callstack: ');
     \Cli::error($ex->getTraceAsString());
     \Cli::beep();
     \Cli::option('speak') and `say --voice="Trinoids" "{$ex->getMessage()}"`;
     if (($previous = $ex->getPrevious()) != null) {
         \Cli::error('');
         \Cli::error('Previous exception: ');
         static::print_exception($previous);
     }
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:13,代码来源:command.php

示例8: register_shutdown_function

 */
register_shutdown_function(function () {
    // reset the autoloader
    \Autoloader::_reset();
    // make sure we're having an output filter so we can display errors
    // occuring before the main config file is loaded
    \Config::get('security.output_filter', null) or \Config::set('security.output_filter', 'Security::htmlentities');
    try {
        // fire any app shutdown events
        \Event::instance()->trigger('shutdown', '', 'none', true);
        // fire any framework shutdown events
        \Event::instance()->trigger('fuel-shutdown', '', 'none', true);
    } catch (\Exception $e) {
        if (\Fuel::$is_cli) {
            \Cli::error("Error: " . $e->getMessage() . " in " . $e->getFile() . " on " . $e->getLine());
            \Cli::beep();
            exit(1);
        }
    }
    return \Error::shutdown_handler();
});
set_exception_handler(function (\Exception $e) {
    // reset the autoloader
    \Autoloader::_reset();
    // deal with PHP bugs #42098/#54054
    if (!class_exists('Error')) {
        include COREPATH . 'classes/error.php';
        class_alias('\\Fuel\\Core\\Error', 'Error');
        class_alias('\\Fuel\\Core\\PhpErrorException', 'PhpErrorException');
    }
    return \Error::exception_handler($e);
开发者ID:marietta-adachi,项目名称:website,代码行数:31,代码来源:bootstrap.php


注:本文中的Cli::beep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。