本文整理汇总了PHP中Psy\Shell::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::debug方法的具体用法?PHP Shell::debug怎么用?PHP Shell::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psy\Shell
的用法示例。
在下文中一共展示了Shell::debug方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$application = $this->getApplication();
$application->setCatchExceptions(false);
$application->setAutoExit(false);
$container = $this->getContainer();
$shell = new Shell();
$shell->debug(['container' => $container, 'kernel' => $container->get('kernel'), 'parameters' => $container->getParameterBag()->all()]);
}
示例2: onException
/**
* Handle uncaught exceptions
*
* @param \Exception $exception
*/
public function onException(\Exception $exception)
{
$this->outputDriver->send(PHP_EOL);
$this->sendErrorLine('');
$this->sendErrorLine('Error: an exception has occurred');
$this->sendErrorLine('');
$this->sendErrorLine('Message: ' . $exception->getMessage());
$this->sendErrorLine('');
$this->sendErrorLine('File: ' . $exception->getFile());
$this->sendErrorLine('Line: ' . $exception->getLine());
$this->sendErrorLine('');
$this->sendErrorLine('For more details please check the logs');
$this->sendErrorLine('');
$this->outputDriver->send(PHP_EOL);
if ($this->inputDriver->readChoice("Debug exception in console ?", ['y', 'n']) == 'y') {
Shell::debug(['exception' => $exception]);
}
}
示例3: __invoke
/**
* Interactive PHP console.
*
* ## DESCRIPTION
*
* `wp shell` allows you to evaluate PHP statements and expressions interactively, from within a WordPress environment. This means that you have access to all the functions, classes and globals that you would have access to from inside a WordPress plugin, for example.
*
* ## OPTIONS
*
* [--basic]
* : Start in fail-safe mode, even if Boris is available.
*/
public function __invoke($_, $assoc_args)
{
$implementations = array('\\Psy\\Shell', '\\Boris\\Boris', '\\WP_CLI\\REPL');
if (\WP_CLI\Utils\get_flag_value($assoc_args, 'basic')) {
$class = '\\WP_CLI\\REPL';
} else {
foreach ($implementations as $candidate) {
if (class_exists($candidate)) {
$class = $candidate;
break;
}
}
}
if ('\\Psy\\Shell' == $class) {
\Psy\Shell::debug();
} else {
$repl = new $class("\nwp> ");
$repl->start();
}
}
示例4: execute
/**
* This method will be called if this command is triggered
*
* @param ArgumentsContainer $arguments
*
* @return mixed
*/
public function execute(ArgumentsContainer $arguments)
{
Shell::debug();
exit(0);
}
示例5: Application
<?php
namespace YOUR_NAMESPACE_HERE;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Psy;
/** @var $app \Silex\Application */
$console = new Application("YOUR_APPLICATION_NAME_HERE", '0.0.1');
$console->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
$console->register('shell')->setDescription('PHP Shell with $app loaded for quick scripting')->setCode(function (InputInterface $input, OutputInterface $output) use($app) {
Psy\Shell::debug(['app' => $app]);
});
return $console;
示例6: breakpoint
/**
* Command to return the eval-able code to startup PsySH in interactive debugger
* Works the same way as eval(\Psy\sh());
* psy/psysh must be loaded in your project
* @link http://psysh.org/
* @link https://github.com/cakephp/cakephp/blob/master/src/basics.php
* @return string
*/
function breakpoint()
{
if (!WP_DEBUG) {
return;
}
if ((PHP_SAPI === 'cli-server' || PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && class_exists('\\Psy\\Shell')) {
if (Strata::isBundledServer()) {
Strata::app()->getLogger("StrataConsole")->debug("\n\nLaunching debugger...\n\n");
}
list(, $caller) = debug_backtrace(false);
extract(\Psy\Shell::debug(get_defined_vars(), isset($caller) ? $caller : null));
return;
}
trigger_error("psy/psysh must be installed and you must be in a CLI environment to use the breakpoint function", E_USER_WARNING);
}
示例7: doRequest
$this->credentials = null;
}
protected function doRequest($request)
{
if ($this->credentials !== null) {
$request->attributes->set('indieauth.client.token', $this->credentials);
}
return parent::doRequest($request);
}
}
$console = new Application("Shrewdness", '0.0.1');
$console->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
$console->register('shell')->setDescription('PHP Shell with $app loaded for quick scripting')->setCode(function (InputInterface $input, OutputInterface $output) use($app) {
$app['exception_handler']->disable();
$app['debug'] = True;
Psy\Shell::debug(['app' => $app, 'client' => new LoginableClient($app)]);
});
$console->register('resubscribe')->setDescription('Resubscribe to all subscriptions')->addOption('unsubscribe', 'u', InputArgument::OPTIONAL, 'Unsubscribe from each feed before re-subscribing', False)->setCode(function (InputInterface $input, OutputInterface $output) use($app) {
/** @var Subscriptions\SubscriptionStorage $ss */
$ss = $app['subscriptions.storage'];
/** @var Subscriptions\PushHub $dh */
$dh = $app['subscriptions.defaulthub'];
$rq = new Routing\RequestContext(null, null, $app['host'], 'https');
$app['url_generator']->setContext($rq);
foreach ($ss->getSubscriptions() as $subscription) {
if ($input->getOption('unsubscribe')) {
$output->writeln("Unsubscribing from {$subscription['topic']}");
if ($subscription['hub'] == $dh->getUrl()) {
$unsubhub = $dh;
} else {
$unsubhub = new Subscriptions\PushHub($subscription['hub']);
示例8: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->psysh->debug($this->psysh->getScopeVariables());
}