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


PHP Kint::getIdeLink方法代码示例

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


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

示例1: _parse_object

 private static function _parse_object(&$variable, kintVariableData $variableData)
 {
     if (function_exists('spl_object_hash')) {
         $hash = spl_object_hash($variable);
     } else {
         ob_start();
         var_dump($variable);
         preg_match('[#(\\d+)]', ob_get_clean(), $match);
         $hash = $match[1];
     }
     $castedArray = (array) $variable;
     $variableData->type = get_class($variable);
     $variableData->size = count($castedArray);
     if (isset(self::$_objects[$hash])) {
         $variableData->value = '*RECURSION*';
         return false;
     }
     if (self::_checkDepth()) {
         $variableData->extendedValue = "*DEPTH TOO GREAT*";
         return false;
     }
     # ArrayObject (and maybe ArrayIterator, did not try yet) unsurprisingly consist of mainly dark magic.
     # What bothers me most, var_dump sees no problem with it, and ArrayObject also uses a custom,
     # undocumented serialize function, so you can see the properties in internal functions, but
     # can never iterate some of them if the flags are not STD_PROP_LIST. Fun stuff.
     if ($variableData->type === 'ArrayObject' || is_subclass_of($variable, 'ArrayObject')) {
         $arrayObjectFlags = $variable->getFlags();
         $variable->setFlags(ArrayObject::STD_PROP_LIST);
     }
     self::$_objects[$hash] = true;
     // todo store reflectorObject here for alternatives cache
     $reflector = new \ReflectionObject($variable);
     # add link to definition of userland objects
     if (Kint::enabled() === Kint::MODE_RICH && Kint::$fileLinkFormat && $reflector->isUserDefined()) {
         $url = Kint::getIdeLink($reflector->getFileName(), $reflector->getStartLine());
         $class = strpos($url, 'http://') === 0 ? 'class="kint-ide-link" ' : '';
         $variableData->type = "<a {$class}href=\"{$url}\">{$variableData->type}</a>";
     }
     $variableData->size = 0;
     $extendedValue = array();
     $encountered = array();
     # copy the object as an array as it provides more info than Reflection (depends)
     foreach ($castedArray as $key => $value) {
         /* casting object to array:
          * integer properties are inaccessible;
          * private variables have the class name prepended to the variable name;
          * protected variables have a '*' prepended to the variable name.
          * These prepended values have null bytes on either side.
          * http://www.php.net/manual/en/language.types.array.php#language.types.array.casting
          */
         if ($key[0] === "") {
             $access = $key[1] === "*" ? "protected" : "private";
             // Remove the access level from the variable name
             $key = substr($key, strrpos($key, "") + 1);
         } else {
             $access = "public";
         }
         $encountered[$key] = true;
         $output = kintParser::factory($value, self::escape($key));
         $output->access = $access;
         $output->operator = '->';
         $extendedValue[] = $output;
         $variableData->size++;
     }
     foreach ($reflector->getProperties() as $property) {
         $name = $property->name;
         if ($property->isStatic() || isset($encountered[$name])) {
             continue;
         }
         if ($property->isProtected()) {
             $property->setAccessible(true);
             $access = "protected";
         } elseif ($property->isPrivate()) {
             $property->setAccessible(true);
             $access = "private";
         } else {
             $access = "public";
         }
         $value = $property->getValue($variable);
         $output = kintParser::factory($value, self::escape($name));
         $output->access = $access;
         $output->operator = '->';
         $extendedValue[] = $output;
         $variableData->size++;
     }
     if (isset($arrayObjectFlags)) {
         $variable->setFlags($arrayObjectFlags);
     }
     if ($variableData->size) {
         $variableData->extendedValue = $extendedValue;
     }
 }
开发者ID:subtonix,项目名称:aouka_lunch,代码行数:92,代码来源:parser.class.php

示例2: _buildCalleeString

 private static function _buildCalleeString($callee)
 {
     $url = Kint::getIdeLink($callee['file'], $callee['line']);
     $shortenedName = Kint::shortenPath($callee['file']) . ':' . $callee['line'];
     if (Kint::enabled() === Kint::MODE_PLAIN) {
         if (strpos($url, 'http://') === 0) {
             $calleeInfo = "<a href=\"#\"onclick=\"" . "X=new XMLHttpRequest;" . "X.open('GET','{$url}');" . "X.send();" . "return!1\">{$shortenedName}</a>";
         } else {
             $calleeInfo = "<a href=\"{$url}\">{$shortenedName}</a>";
         }
     } else {
         $calleeInfo = $shortenedName;
     }
     return $calleeInfo;
 }
开发者ID:subtonix,项目名称:aouka_lunch,代码行数:15,代码来源:plain.php

示例3: ideLink

 private static function ideLink($file, $line)
 {
     $shortenedPath = Kint_Object_Blob::escape(Kint::shortenPath($file));
     if (!Kint::$file_link_format) {
         return $shortenedPath . ':' . $line;
     }
     $ideLink = Kint::getIdeLink($file, $line);
     $class = strpos($ideLink, 'http://') === 0 ? 'class="kint-ide-link" ' : '';
     return "<a {$class}href=\"{$ideLink}\">{$shortenedPath}:{$line}</a>";
 }
开发者ID:jnvsor,项目名称:kint,代码行数:10,代码来源:Rich.php


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