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


PHP Kint::maxLevels方法代码示例

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


在下文中一共展示了Kint::maxLevels方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUpKint

 protected function setUpKint()
 {
     if (class_exists('Kint')) {
         Kint::$cliDetection = true;
         Kint::$maxLevels = 10;
         Kint::$theme = 'aante-light';
         Kint::$displayCalledFrom = true;
         Kint::enabled(Kint::MODE_RICH);
     }
 }
开发者ID:bozhich,项目名称:PHP-on-Rails,代码行数:10,代码来源:Bootstrap.php

示例2: decorateTrace

 public static function decorateTrace($traceData)
 {
     $output = self::_title('TRACE');
     $lastStep = count($traceData);
     foreach ($traceData as $stepNo => $step) {
         $title = str_pad(++$stepNo . ': ', 4, ' ');
         $title .= self::_colorize(isset($step['file']) ? self::_buildCalleeString($step) : 'PHP internal call', 'title');
         if (!empty($step['function'])) {
             $title .= '    ' . $step['function'];
             if (isset($step['args'])) {
                 $title .= '(';
                 if (empty($step['args'])) {
                     $title .= ')';
                 } else {
                 }
                 $title .= PHP_EOL;
             }
         }
         $output .= $title;
         if (!empty($step['args'])) {
             $appendDollar = $step['function'] === '{closure}' ? '' : '$';
             $i = 0;
             foreach ($step['args'] as $name => $argument) {
                 $argument = kintParser::factory($argument, $name ? $appendDollar . $name : '#' . ++$i);
                 $argument->operator = $name ? ' =' : ':';
                 $maxLevels = Kint::$maxLevels;
                 if ($maxLevels) {
                     Kint::$maxLevels = $maxLevels + 2;
                 }
                 $output .= self::decorate($argument, 2);
                 if ($maxLevels) {
                     Kint::$maxLevels = $maxLevels;
                 }
             }
             $output .= '    )' . PHP_EOL;
         }
         if (!empty($step['object'])) {
             $output .= self::_colorize('    ' . self::_char('─', 27) . ' Callee object ' . self::_char('─', 34), 'title');
             $maxLevels = Kint::$maxLevels;
             if ($maxLevels) {
                 # in cli the terminal window is filled too quickly to display huge objects
                 Kint::$maxLevels = Kint::enabled() === Kint::MODE_CLI ? 1 : $maxLevels + 1;
             }
             $output .= self::decorate(kintParser::factory($step['object']), 1);
             if ($maxLevels) {
                 Kint::$maxLevels = $maxLevels;
             }
         }
         if ($stepNo !== $lastStep) {
             $output .= self::_colorize(self::_char('─', 80), 'title');
         }
     }
     return $output;
 }
开发者ID:karlpatrickespiritu,项目名称:kint,代码行数:54,代码来源:plain.php

示例3: decorateTrace

 public static function decorateTrace($traceData)
 {
     $output = self::_title('TRACE');
     $lastStep = count($traceData);
     foreach ($traceData as $stepNo => $step) {
         $title = str_pad(++$stepNo . ': ', 4, ' ');
         $title .= self::_colorize(isset($step['file']) ? self::_buildCalleeString($step) : 'PHP internal call', 'title');
         if (!empty($step['function'])) {
             $title .= '    ' . $step['function'];
             if (isset($step['args'])) {
                 $title .= '(';
                 if (empty($step['args'])) {
                     $title .= ')';
                 } else {
                 }
                 $title .= PHP_EOL;
             }
         }
         $output .= $title;
         if (!empty($step['args'])) {
             $appendDollar = $step['function'] !== '{closure}';
             foreach ($step['args'] as $name => $argument) {
                 $argument = kintParser::factory($argument, $appendDollar ? '$' : '' . $name);
                 $argument->operator = '=';
                 $maxLevels = Kint::$maxLevels;
                 if ($maxLevels) {
                     Kint::$maxLevels = $maxLevels + 2;
                 }
                 $output .= self::decorate($argument, 2);
                 if ($maxLevels) {
                     Kint::$maxLevels = $maxLevels;
                 }
             }
             $output .= '    )' . PHP_EOL;
         }
         if (!empty($step['object'])) {
             $output .= self::_colorize('    ' . self::_char('─', 27) . ' Callee object ' . self::_char('─', 34), 'title');
             $maxLevels = Kint::$maxLevels;
             if ($maxLevels) {
                 Kint::$maxLevels = $maxLevels + 1;
             }
             $output .= self::decorate(kintParser::factory($step['object']), 1);
             if ($maxLevels) {
                 Kint::$maxLevels = $maxLevels;
             }
         }
         if ($stepNo !== $lastStep) {
             $output .= self::_colorize(self::_char('─', 80), 'title');
         }
     }
     return $output;
 }
开发者ID:subtonix,项目名称:aouka_lunch,代码行数:52,代码来源:plain.php

示例4: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     \Kint::enabled($config['enabled']);
     \Kint::$maxLevels = $config['nesting_depth'];
     \Kint::$maxStrLength = $config['string_length'];
     $container->setParameter('cg_kint.enabled', $config['enabled']);
     $container->setParameter('cg_kint.nesting_depth', $config['nesting_depth']);
     $container->setParameter('cg_kint.string_length', $config['string_length']);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
 }
开发者ID:intermike,项目名称:CgKintBundle,代码行数:16,代码来源:CgKintExtension.php

示例5: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     //file_delete(file_glob(path_join(config('view.compiled'), '*')));
     ini_set('memory_limit', '500M');
     \Kint::$maxLevels = 20;
     \Route::get('test', function () {
         $f = app(Phpdoc::class);
         $f->generateDoc('codex');
         $doc = $f->getDoc('codex');
         $i = $doc->getElement('\\Codex\\Addon\\Defaults\\Phpdoc\\PhpdocDocument');
         d($i);
     });
 }
开发者ID:codex-project,项目名称:develop,代码行数:18,代码来源:AppServiceProvider.php

示例6: dump

 /**
  * dump information about variables
  *
  * @param mixed $data
  *
  * @return void|string
  */
 public static function dump($data = null)
 {
     if (!Kint::enabled()) {
         return;
     }
     # find caller information
     $trace = debug_backtrace();
     list($names, $modifier, $callee, $previousCaller) = self::_getPassedNames($trace);
     if ($names === array(null) && func_num_args() === 1 && $data === 1) {
         $call = reset($trace);
         if (!isset($call['file']) && isset($call['class']) && $call['class'] === __CLASS__) {
             array_shift($trace);
             $call = reset($trace);
         }
         while (isset($call['file']) && $call['file'] === __FILE__) {
             array_shift($trace);
             $call = reset($trace);
         }
         self::trace($trace);
         return;
     }
     # process modifiers: @, + and -
     switch ($modifier) {
         case '-':
             self::$_firstRun = true;
             while (ob_get_level()) {
                 ob_end_clean();
             }
             break;
         case '!':
             self::$expandedByDefault = true;
             break;
         case '+':
             $maxLevelsOldValue = self::$maxLevels;
             self::$maxLevels = false;
             break;
         case '@':
             $firstRunOldValue = self::$_firstRun;
             self::$_firstRun = true;
             break;
     }
     $data = func_num_args() === 0 ? array("[[no arguments passed]]") : func_get_args();
     $output = Kint_Decorators_Rich::_css();
     $output .= Kint_Decorators_Rich::_wrapStart($callee);
     foreach ($data as $k => $argument) {
         $output .= self::_dump($argument, $names[$k]);
     }
     $output .= Kint_Decorators_Rich::_wrapEnd($callee, $previousCaller);
     self::$_firstRun = false;
     switch ($modifier) {
         case '+':
             self::$maxLevels = $maxLevelsOldValue;
             echo $output;
             break;
         case '@':
             self::$_firstRun = $firstRunOldValue;
             return $output;
             break;
         default:
             echo $output;
             break;
     }
     return '';
 }
开发者ID:dfanica,项目名称:Daniel-Fanica-Personal-Website,代码行数:71,代码来源:kint.class.php

示例7: dump

 /**
  * Dump information about a variable
  *
  * @param mixed $data,...
  * @access public
  * @static
  */
 public static function dump()
 {
     if (!Kint::enabled()) {
         return;
     }
     // decide what action to take baset on parameter count
     if (func_num_args() === 0) {
         // todo if no arguments were provided, dump the whole environment
         // self::env(); // todo
         return;
     }
     // find caller information
     $prevCaller = array();
     $trace = debug_backtrace();
     while ($callee = array_pop($trace)) {
         if (strtolower($callee['function']) === 'd' || strtolower($callee['function']) === 'dd' || isset($callee['class']) && strtolower($callee['class']) === strtolower(__CLASS__)) {
             break;
         } else {
             $prevCaller = $callee;
         }
     }
     list($names, $modifier) = self::_getPassedNames($callee, '');
     // catches !, + and -
     switch ($modifier) {
         case '-':
             self::$_firstRun = TRUE;
             ob_clean();
             break;
         case '+':
             // todo revert after dumping
             self::$maxLevels = FALSE;
             break;
     }
     self::_css();
     echo self::_wrapStart();
     foreach (func_get_args() as $k => $argument) {
         $dump = self::_dump($argument);
         list($class, $plus) = self::_collapsed();
         echo "<dl><dt{$class}>{$plus}" . (!empty($names[$k]) ? "<dfn>{$names[$k]}</dfn> " : "") . "{$dump}</dl>";
     }
     echo self::_wrapEnd($callee, $prevCaller);
     self::$_firstRun = FALSE;
     //todo add ability to echo just prettily formatted code without html
     //if ( self::_isAjax() ) {
     //	echo "\n\n" . strip_tags( $dump );
     //}
 }
开发者ID:sagittaros,项目名称:dealschrome,代码行数:54,代码来源:Kint.php

示例8: dump

 public static function dump($data = null)
 {
     if (!self::enabled()) {
         return '';
     }
     list($names, $modifiers, $callee, $previousCaller, $miniTrace) = self::_getCalleeInfo(defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace());
     $modeOldValue = self::enabled();
     $firstRunOldValue = self::$_firstRun;
     # process modifiers: @, +, !, ~ and -
     if (strpos($modifiers, '-') !== false) {
         self::$_firstRun = true;
         while (ob_get_level()) {
             ob_end_clean();
         }
     }
     if (strpos($modifiers, '!') !== false) {
         $expandedByDefaultOldValue = self::$expandedByDefault;
         self::$expandedByDefault = true;
     }
     if (strpos($modifiers, '+') !== false) {
         $maxLevelsOldValue = self::$maxLevels;
         self::$maxLevels = false;
     }
     if (strpos($modifiers, '@') !== false) {
         $returnOldValue = self::$returnOutput;
         self::$returnOutput = true;
         self::$_firstRun = true;
     }
     if (strpos($modifiers, '~') !== false) {
         self::enabled(self::MODE_WHITESPACE);
     }
     # set mode for current run
     $mode = self::enabled();
     if ($mode === true) {
         $mode = PHP_SAPI === 'cli' ? self::MODE_CLI : self::MODE_RICH;
     }
     self::enabled($mode);
     $decorator = self::enabled() === self::MODE_RICH ? 'Kint_Decorators_Rich' : 'Kint_Decorators_Plain';
     $output = '';
     if (self::$_firstRun) {
         $output .= call_user_func(array($decorator, 'init'));
     }
     $trace = false;
     if ($names === array(null) && func_num_args() === 1 && $data === 1) {
         # Kint::dump(1) shorthand
         $trace = KINT_PHP53 ? debug_backtrace(true) : debug_backtrace();
     } elseif (func_num_args() === 1 && is_array($data)) {
         $trace = $data;
         # test if the single parameter is result of debug_backtrace()
     }
     $trace and $trace = self::_parseTrace($trace);
     $output .= call_user_func(array($decorator, 'wrapStart'));
     if ($trace) {
         $output .= call_user_func(array($decorator, 'decorateTrace'), $trace);
     } else {
         $data = func_num_args() === 0 ? array("[[no arguments passed]]") : func_get_args();
         foreach ($data as $k => $argument) {
             kintParser::reset();
             # when the dump arguments take long to generate output, user might have changed the file and
             # Kint might not parse the arguments correctly, so check if names are set and while the
             # displayed names might be wrong, at least don't throw an error
             $output .= call_user_func(array($decorator, 'decorate'), kintParser::factory($argument, isset($names[$k]) ? $names[$k] : ''));
         }
     }
     $output .= call_user_func(array($decorator, 'wrapEnd'), $callee, $miniTrace, $previousCaller);
     self::enabled($modeOldValue);
     self::$_firstRun = false;
     if (strpos($modifiers, '~') !== false) {
         self::$_firstRun = $firstRunOldValue;
     } else {
         self::enabled($modeOldValue);
     }
     if (strpos($modifiers, '!') !== false) {
         self::$expandedByDefault = $expandedByDefaultOldValue;
     }
     if (strpos($modifiers, '+') !== false) {
         self::$maxLevels = $maxLevelsOldValue;
     }
     if (strpos($modifiers, '@') !== false) {
         self::$returnOutput = $returnOldValue;
         self::$_firstRun = $firstRunOldValue;
         return $output;
     }
     if (self::$returnOutput) {
         return $output;
     }
     echo $output;
 }
开发者ID:Tacit007,项目名称:Calenda,代码行数:88,代码来源:Kint.class.php

示例9: dump

 /**
  * Dump information about a variable
  *
  * @param mixed $data
  * @return void|string
  */
 public static function dump($data)
 {
     if (!Kint::enabled()) {
         return;
     }
     // decide what action to take based on parameter count
     if (func_num_args() === 0) {
         // todo if no arguments were provided, dump the whole environment
         // self::env(); // todo
         return;
     }
     // find caller information
     $prevCaller = array();
     $trace = debug_backtrace();
     while ($callee = array_pop($trace)) {
         if (strtolower($callee['function']) === 'd' || strtolower($callee['function']) === 'dd' || isset($callee['class']) && strtolower($callee['class']) === strtolower(__CLASS__)) {
             break;
         } else {
             $prevCaller = $callee;
         }
     }
     list($names, $modifier) = self::_getPassedNames($callee, '');
     // catches @, + and -
     switch ($modifier) {
         case '-':
             self::$_firstRun = TRUE;
             ob_clean();
             break;
         case '+':
             $prevLevels = self::$maxLevels;
             self::$maxLevels = 0;
             break;
     }
     $ret = self::_css() . self::_wrapStart($callee);
     foreach (func_get_args() as $k => $argument) {
         $dump = self::_dump($argument);
         list($class, $plus) = self::_collapsed();
         $ret .= "<dl><dt{$class}>{$plus}" . (!empty($names[$k]) ? "<dfn>{$names[$k]}</dfn> " : "") . "{$dump}</dl>";
     }
     $ret .= self::_wrapEnd($callee, $prevCaller);
     self::$_firstRun = FALSE;
     if ($modifier === '+') {
         self::$maxLevels = $prevLevels;
     }
     if ($modifier === '@') {
         self::$_firstRun = TRUE;
         return $ret;
     }
     ob_start('kint_debug_globals');
     echo $ret;
     ob_end_flush();
 }
开发者ID:fdelarosa191,项目名称:iftheme-docs,代码行数:58,代码来源:Kint.class.php

示例10: dump

 /**
  * Dump information about variables, accepts any number of parameters, supports modifiers:
  *
  *  clean up any output before kint and place the dump at the top of page:
  *   - Kint::dump()
  *  *****
  *  expand all nodes on display:
  *   ! Kint::dump()
  *  *****
  *  dump variables disregarding their depth:
  *   + Kint::dump()
  *  *****
  *  return output instead of displaying it:
  *   @ Kint::dump()
  *  *****
  *  force output as plain text
  *   ~ Kint::dump()
  *
  * Modifiers are supported by all dump wrapper functions, including Kint::trace(). Space is optional.
  *
  *
  * You can also use the following shorthand to display debug_backtrace():
  *   Kint::dump( 1 );
  *
  * Passing the result from debug_backtrace() to kint::dump() as a single parameter will display it as trace too:
  *   $trace = debug_backtrace( true );
  *   Kint::dump( $trace );
  *  Or simply:
  *   Kint::dump( debug_backtrace() );
  *
  *
  * @param mixed $data
  *
  * @return void|string
  */
 public static function dump($data = null)
 {
     if (!self::enabled()) {
         return '';
     }
     list($names, $modifiers, $callee, $previousCaller, $miniTrace) = self::_getCalleeInfo(defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace());
     $modeOldValue = self::enabled();
     # process modifiers: @, +, !, ~ and -
     if (strpos($modifiers, '-') !== false) {
         self::$_firstRun = true;
         while (ob_get_level()) {
             ob_end_clean();
         }
     }
     if (strpos($modifiers, '!') !== false) {
         $expandedByDefaultOldValue = self::$expandedByDefault;
         self::$expandedByDefault = true;
     }
     if (strpos($modifiers, '+') !== false) {
         $maxLevelsOldValue = self::$maxLevels;
         self::$maxLevels = false;
     }
     if (strpos($modifiers, '@') !== false) {
         $returnOldValue = self::$returnOutput;
         $firstRunOldValue = self::$_firstRun;
         self::$returnOutput = true;
         self::$_firstRun = true;
     }
     if (strpos($modifiers, '~') !== false) {
         self::enabled(self::MODE_WHITESPACE);
     }
     # set mode for current run
     $mode = self::enabled();
     if ($mode === true) {
         $mode = PHP_SAPI === 'cli' ? self::MODE_CLI : self::MODE_RICH;
     }
     self::enabled($mode);
     /** @var Kint_Decorators_Rich|Kint_Decorators_Plain $decorator */
     $decorator = self::enabled() === self::MODE_RICH ? 'Kint_Decorators_Rich' : 'Kint_Decorators_Plain';
     $output = '';
     if (self::$_firstRun) {
         $output .= $decorator::init();
     }
     $trace = false;
     if ($names === array(null) && func_num_args() === 1 && $data === 1) {
         $trace = debug_backtrace(true);
         # Kint::dump(1) shorthand
     } elseif (func_num_args() === 1 && is_array($data)) {
         $trace = $data;
         # test if the single parameter is result of debug_backtrace()
     }
     $trace and $trace = self::_parseTrace($trace);
     $output .= $decorator::wrapStart();
     if ($trace) {
         $output .= $decorator::decorateTrace($trace);
     } else {
         $data = func_num_args() === 0 ? array("[[no arguments passed]]") : func_get_args();
         foreach ($data as $k => $argument) {
             kintParser::reset();
             $output .= $decorator::decorate(kintParser::factory($argument, $names[$k]));
         }
     }
     $output .= $decorator::wrapEnd($callee, $miniTrace, $previousCaller);
     self::enabled($modeOldValue);
     if (strpos($modifiers, '~') === false) {
//.........这里部分代码省略.........
开发者ID:subtonix,项目名称:aouka_lunch,代码行数:101,代码来源:Kint.class.php

示例11: dump

 /**
  * Dump information about variables, accepts any number of parameters, supports modifiers:
  *
  *  clean up any output before kint and place the dump at the top of page:
  *   - Kint::dump()
  *  *****
  *  expand all nodes on display:
  *   ! Kint::dump()
  *  *****
  *  dump variables disregarding their depth:
  *   + Kint::dump()
  *  *****
  *  return output instead of displaying it (also disables ajax/cli detection):
  *   @ Kint::dump()
  *  *****
  *  disable ajax and cli auto-detection and just output as requested (plain/rich):
  *   ~ Kint::dump()
  *
  * Modifiers are supported by all dump wrapper functions, including Kint::trace(). Space is optional.
  *
  *
  * You can also use the following shorthand to display debug_backtrace():
  *   Kint::dump( 1 );
  *
  * Passing the result from debug_backtrace() to kint::dump() as a single parameter will display it as trace too:
  *   $trace = debug_backtrace( true );
  *   Kint::dump( $trace );
  *  Or simply:
  *   Kint::dump( debug_backtrace() );
  *
  *
  * @param mixed $data
  *
  * @return void|string
  */
 public static function dump($data = null)
 {
     if (!Kint::enabled()) {
         return '';
     }
     # find caller information
     list($names, $modifiers, $callee, $previousCaller, $miniTrace) = self::_getPassedNames(defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace());
     # process modifiers: @, +, !, ~ and -
     if (strpos($modifiers, '-') !== false) {
         self::$_firstRun = true;
         while (ob_get_level()) {
             ob_end_clean();
         }
     }
     if (strpos($modifiers, '!') !== false) {
         $expandedByDefaultOldValue = self::$expandedByDefault;
         self::$expandedByDefault = true;
     }
     if (strpos($modifiers, '+') !== false) {
         $maxLevelsOldValue = self::$maxLevels;
         self::$maxLevels = false;
     }
     if (strpos($modifiers, '@') !== false) {
         $firstRunOldValue = self::$_firstRun;
         self::$_firstRun = true;
     }
     # disable mode detection
     if (strpos($modifiers, '@') !== false || strpos($modifiers, '~') === false) {
         $modeOldValue = self::$mode;
         $isAjaxOldValue = self::$_isAjax;
         if (self::$_detected === 'ajax') {
             self::$_isAjax = true;
         } elseif (self::$_detected === 'cli' && self::$cliDetection) {
             # cli detection is checked here as you can toggle the feature for individual dumps
             self::$mode = self::$cliColors ? 'cli' : 'whitespace';
         }
     }
     $decoratorsMap = array('cli' => 'Kint_Decorators_Cli', 'plain' => 'Kint_Decorators_Plain', 'rich' => 'Kint_Decorators_Rich', 'whitespace' => 'Kint_Decorators_Whitespace');
     $decorator = $decoratorsMap[self::$mode];
     $output = $decorator::wrapStart($callee);
     $trace = false;
     if ($names === array(null) && func_num_args() === 1 && $data === 1) {
         $trace = debug_backtrace(true);
         # Kint::dump(1) shorthand
     } elseif (func_num_args() === 1 && is_array($data)) {
         $trace = $data;
         # test if the single parameter is result of debug_backtrace()
     }
     $trace and $trace = self::_parseTrace($trace);
     if ($trace) {
         $output .= $decorator::decorateTrace($trace);
     } else {
         $data = func_num_args() === 0 ? array("[[no arguments passed]]") : func_get_args();
         foreach ($data as $k => $argument) {
             kintParser::reset();
             $output .= $decorator::decorate(kintParser::factory($argument, $names[$k]));
         }
     }
     $output .= $decorator::wrapEnd($callee, $miniTrace, $previousCaller);
     if (strpos($modifiers, '~') === false) {
         self::$mode = $modeOldValue;
     }
     if (strpos($modifiers, '!') !== false) {
         self::$expandedByDefault = $expandedByDefaultOldValue;
     }
//.........这里部分代码省略.........
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:101,代码来源:Kint.class.php


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