• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP typeOf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中typeOf函数的典型用法代码示例。如果您正苦于以下问题:PHP typeOf函数的具体用法?PHP typeOf怎么用?PHP typeOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: read

 public function read(DOMElement $e) {
     $tn = end(explode(':',$e->tagName));
     switch($tn) {
       case 'function':
       
         foreach($e->childNodes as $cnn) {
             if (typeOf($cnn) == 'DOMElement') {
                 $cnt = end(explode(':',$cnn->tagName));
                 if ($cnt == 'from') {
                     $this->from[] = $cnn->nodeValue;
                 } elseif ($cnt == 'to') {
                     $this->to = $cnn->nodeValue;
                 } else {
                     printf("Warning: Didn't expect %s here\n", $cnn->nodeName); 
                 }
             }
         }
         
         printf(__astr("[\b{phprefactor}] Refactoring{%s} --> %s\n"), join(', ',$this->from), $this->to);
         break;
         
       default:
         printf("I don't know what to do with %s!\n", $tn);
         
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:26,代码来源:css.php


示例2: inspectArray

 static function inspectArray($data)
 {
     $ret = '<table>';
     foreach ($data as $key => $value) {
         $ret .= '<tr><th>' . htmlentities($key) . ' <br><em style="font-size:10px; font-weight:normal">' . typeOf($value) . '</em></th><td>';
         if (typeOf($value) == 'boolean') {
             if ($value) {
                 $ret .= '<img src="data:image/gif;base64,R0lGODlhEwAHAIABAAAAAP///yH5BAEKAAEALAAAAAATAAcAAAIajI+ZwMFgoHMt2imhPNn2x0XVt1zZuSkqUgAAOw==" alt="true">';
             } else {
                 $ret .= '<img src="data:image/gif;base64,R0lGODlhFwAHAIABAAAAAP///yH5BAEKAAEALAAAAAAXAAcAAAIejI+pB20eAGqSPnblxczp2nmQFlkkdpJfWY3QAi8FADs=" alt="false">';
             }
         } else {
             if (is_array($value) || is_a($value, 'StdClass')) {
                 $ret .= self::inspectArray((array) $value);
             } else {
                 if ($value === null) {
                     $ret .= '<img src="data:image/gif;base64,R0lGODdhEwAHAKECAAAAAPj4/////////ywAAAAAEwAHAAACHYSPmWIB/KKBkznIKI0iTwlKXuR8B9aUXdYprlsAADs=" alt="null">';
                 } else {
                     $ret .= htmlentities($value);
                 }
             }
         }
         $ret .= '</td></tr>';
     }
     $ret .= '</table>';
     return $ret;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:27,代码来源:debug.php


示例3: e

 /**
  * Escapes (secures) data for output.<br>
  *
  * <p>Array values are converted to space-separated value string lists.
  * > A useful use case for an array attribute is the `class` attribute.
  *
  * Object values generate either:
  * - a space-separated list of keys who's corresponding value is truthy;
  * - a semicolon-separated list of key:value elements if at least one value is a string.
  *
  * Boolean values will generate the string "true" or "false".
  *
  * NULL is converted to an empty string.
  *
  * Strings are HTML-encoded.
  *
  * @param mixed $o
  * @return string
  */
 function e($o)
 {
     switch (gettype($o)) {
         case 'string':
             break;
         case 'boolean':
             return $o ? 'true' : 'false';
         case 'integer':
         case 'double':
             return strval($o);
         case 'array':
             $at = [];
             $s = ' ';
             foreach ($o as $k => $v) {
                 if (!is_string($v) && !is_numeric($v)) {
                     throw new \InvalidArgumentException("Can't output an array with values of type " . gettype($v));
                 }
                 if (is_numeric($k)) {
                     $at[] = $v;
                 } else {
                     $at[] = "{$k}:{$v}";
                     $s = ';';
                 }
             }
             $o = implode($s, $at);
             break;
         case 'NULL':
             return '';
         default:
             return typeOf($o);
     }
     return htmlentities($o, ENT_QUOTES, 'UTF-8', false);
 }
开发者ID:php-kit,项目名称:tools,代码行数:52,代码来源:expressions.php


示例4: testShouldFormatManyAccordingToConvertMethod

 public function testShouldFormatManyAccordingToConvertMethod()
 {
     $items = ['foo', 'bar', 'baz'];
     $formatter = new MockFormatter();
     $result = $formatter->formatMany($items);
     assertThat('The result of `formatMany` should be an array of arrays.', $result, everyItem(is(typeOf('array'))));
     assertThat('The result should be the same size as the number of items passed to `formatMany`.', $result, is(arrayWithSize(count($items))));
     assertThat('The result should be correctly formatted.', $result, is(anArray([['count' => 1], ['count' => 2], ['count' => 3]])));
 }
开发者ID:graze,项目名称:formatter,代码行数:9,代码来源:AbstractFormatterTest.php


示例5: addAnimator

 public function addAnimator($property, ILpfAnimator $animator, $frstart, $frend)
 {
     if (arr::hasKey($this->_properties, $property)) {
         $this->_animators[$property][] = array('animator' => $animator, 'framestart' => $frstart, 'frameend' => $frend);
         console::writeLn("Attached animator: %s => %s", typeOf($animator), $property);
     } else {
         logger::warning("Animator attached to nonexisting property %s of object %s", $property, (string) $this->_object);
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:9,代码来源:scenegraph.php


示例6: decodeRecursive

 /**
  * @brief Recursive decoder
  * @private
  * 
  * @param String $json The JSON data to process
  * @return Mixed The parsed data
  */
 private static function decodeRecursive($json)
 {
     $arr = (array) $json;
     foreach ($arr as $k => $v) {
         if (typeOf($v) == 'stdClass' || typeOf($v) == 'array') {
             $arr[$k] = (array) self::decodeRecursive($v);
         }
     }
     return $arr;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:17,代码来源:json.php


示例7: theRequestTimeShouldBeVeryRecent

 /**
  * @Then the SpikeApi Request Time should be very recent
  */
 public function theRequestTimeShouldBeVeryRecent()
 {
     $now = time();
     $data = json_decode($this->response);
     $actual = $data->request_time;
     assertThat($actual, typeOf('integer'));
     #assertInternalType('integer', $actual);
     // we need to allow some fuzz-time, a few seconds should be OK
     assertThat("request time should be close", $now, closeTo($actual, 3));
     // We give it a little fuzz to allow for potential clock drift between machines
 }
开发者ID:alister,项目名称:expenses-avenger,代码行数:14,代码来源:SpikeApi.php


示例8: mixedValueSummary

/**
* @param Any? $value a value or null
*/
function mixedValueSummary($value, $valueIfEmpty = null, $returnKind = false)
{
    $valueToReturn = $value ? $value : (isset($valueIfEmpty) ? $valueIfEmpty : $value);
    if (!$returnKind) {
        return $valueToReturn;
    } else {
        $r = array();
        $r['kind'] = typeOf($valueToReturn);
        $r['value'] = $valueToReturn;
        return $r;
    }
}
开发者ID:GitHubTianPeng,项目名称:101worker,代码行数:15,代码来源:megalib_leftover.php


示例9: exception

 function exception(Exception $e)
 {
     if (ob_get_length() != false) {
         @ob_end_clean();
     }
     $et = typeOf($e);
     if ($et == 'FileNotFoundException' || $et == 'NavigationException') {
         response::setStatus(404);
         header('HTTP/1.1 404 Not Found', true);
         printf("<h1>404: Not Found</h1>");
         return;
     }
     if ($et == 'HttpException') {
         response::setStatus($e->getCode());
         $code = $e->getMessage();
         list($code) = explode(':', $code);
         $code = str_replace('Error ', '', $code);
         $msg = HttpException::getHttpMessage($code);
         header('HTTP/1.1 ' . $code . ' ' . $msg . ' ' . $msg);
         printf("<h1>%s: %s</h1>\n<pre>%s</pre>", $code, $msg, $msg);
         return;
     }
     response::setStatus(500);
     logger::emerg("Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     header('HTTP/1.1 501 Server Error', true);
     $id = uniqid();
     $dbg = sprintf("Unhandled exception: (%s) %s\n  in %s:%d", get_class($e), $e->getMessage(), str_replace(SYS_PATH, '', $e->getFile()), $e->getLine()) . Console::backtrace(0, $e->getTrace(), true) . "\n" . "Loaded modules:\n" . ModuleManager::debug() . "\n" . request::getDebugInformation();
     logger::emerg($dbg);
     if (config::get('lepton.mvc.exception.log', false) == true) {
         $logfile = config::get('lepton.mvc.exception.logfile', "/tmp/" . $_SERVER['HTTP_HOST'] . "-debug.log");
         $log = "=== Unhandled Exception ===\n\n" . $dbg . "\n";
         $lf = @fopen($logfile, "a+");
         if ($lf) {
             fputs($lf, $log);
             fclose($lf);
         }
     }
     $ico_error = resource::get('warning.png');
     header('content-type: text/html; charset=utf-8');
     echo '<html><head><title>Unhandled Exception</title>' . self::$css . self::$js . '</head><body>' . '<div id="box"><div id="left"><img src="' . $ico_error . '" width="32" height="32"></div><div id="main">' . '<h1>An Unhandled Exception Occured</h1>' . '<hr noshade>' . '<p>This means that something didn\'t go quite go as planned. This could be ' . 'caused by one of several reasons, so please be patient and try ' . 'again in a little while.</p>';
     if (config::get('lepton.mvc.exception.feedback', false) == true) {
         echo '<p>The administrator of the website has been notified about this error. You ' . 'can help us find and fix the problem by writing a line or two about what you were doing when this ' . 'error occured.</p>';
         echo '<p id="feedbacklink"><a href="javascript:doFeedback();">If you would like to assist us with more information, please click here</a>.</p>';
         echo '<div id="feedback" style="display:none;"><p>Describe in a few short lines what you were doing right before you encountered this error:</p><form action="/errorevent.feedback/' . $id . '" method="post"><div><textarea name="text" style="width:100%; height:50px;"></textarea></div><div style="padding-top:5px; text-align:right;"><input type="button" value=" Close " onclick="closeFeedback();"> <input type="submit" value=" Submit Feedback "></div></form></div>';
     }
     if (config::get('lepton.mvc.exception.showdebug', false) == true) {
         echo '<hr noshade>' . '<a href="javascript:toggleAdvanced();">Details &raquo;</a>' . '<pre id="advanced" style="display:none; height:300px;">' . $dbg . '</pre>';
     }
     echo '<div>' . '</body></html>';
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:50,代码来源:exception.php


示例10: loadYmlData

 /**
  * @param $file
  *
  * @return array
  *
  * @throws \Stefanius\LaravelFixtures\Exception\FileNotFoundException
  */
 public function loadYmlData($file)
 {
     if (is_null($file)) {
         throw new \InvalidArgumentException(sprintf('The argument has to be a string. NULL given.'));
     }
     if (!is_string($file)) {
         throw new \InvalidArgumentException(sprintf('The argument has to be a string. %s given.', typeOf($file)));
     }
     $ymlFilename = sprintf($this->fixtureDataPath . DIRECTORY_SEPARATOR . '%s.yml', $file);
     if (!file_exists($ymlFilename)) {
         throw new FileNotFoundException($ymlFilename);
     }
     return Yaml::parse(file_get_contents($ymlFilename));
 }
开发者ID:stefanius,项目名称:laravel-fixtures,代码行数:21,代码来源:Loader.php


示例11: testShouldFormatTraversableAccordingToConvertMethod

 public function testShouldFormatTraversableAccordingToConvertMethod()
 {
     $items = ['foo', 'bar', 'baz'];
     /** @var Generator **/
     $result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
     assertThat('The result of `formatTraversable` should be a Generator.', $result, is(anInstanceOf('Generator')));
     /** @var Generator **/
     $result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
     assertThat('Every item in the result should be an array.', iterator_to_array($result), everyItem(is(typeOf('array'))));
     /** @var Generator **/
     $result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
     assertThat('The result should be the same size as the number of items passed to `formatTraversable`.', $result, is(traversableWithSize(count($items))));
     /** @var Generator **/
     $result = (new MockFormatter())->formatTraversable(new ArrayIterator($items));
     assertThat('The result should be correctly formatted.', iterator_to_array($result), is(anArray([['count' => 1], ['count' => 2], ['count' => 3]])));
 }
开发者ID:graze,项目名称:formatter,代码行数:16,代码来源:AbstractTraversableFormatterTest.php


示例12: _e

/**
 * Extracts and escapes text from the given value, for outputting to the HTTP client.
 *
 * <p>Note: this returns escaped text, except if the given argument is a {@see RawText} instance, in which case it
 * returns raw text.
 *
 * @param string|RawText $s
 * @return string
 */
function _e($s)
{
    if (!is_scalar($s)) {
        if (is_null($s)) {
            return '';
        }
        if ($s instanceof RawText) {
            return $s->toString();
        }
        if ($s instanceof RenderableInterface) {
            $s = $s->getRendering();
        } elseif (is_object($s) && method_exists($s, '__toString')) {
            $s = (string) $s;
        } else {
            if (is_iterable($s)) {
                return iteratorOf($s)->current();
            }
            return sprintf('[%s]', typeOf($s));
        }
    }
    return htmlentities($s, ENT_QUOTES, 'UTF-8', false);
}
开发者ID:electro-modules,项目名称:matisse,代码行数:31,代码来源:globals.php


示例13: formatErrorArg

 /**
  * @internal
  * @param mixed $arg
  * @return string
  */
 public static function formatErrorArg($arg)
 {
     if (is_object($arg)) {
         switch (get_class($arg)) {
             case \ReflectionMethod::class:
                 /** @var \ReflectionMethod $arg */
                 return sprintf('ReflectionMethod<%s::$s>', $arg->getDeclaringClass()->getName(), $arg->getName());
             case \ReflectionFunction::class:
                 /** @var \ReflectionFunction $arg */
                 return sprintf('ReflectionFunction<function at %s line %d>', $arg->getFileName(), $arg->getStartLine());
             case \ReflectionParameter::class:
                 /** @var \ReflectionParameter $arg */
                 return sprintf('ReflectionParameter<$%s>', $arg->getName());
             default:
                 return typeOf($arg);
         }
     }
     if (is_array($arg)) {
         return sprintf('[%s]', implode(',', map($arg, [__CLASS__, 'formatErrorArg'])));
     }
     return str_replace('\\\\', '\\', var_export($arg, true));
 }
开发者ID:electro-framework,项目名称:framework,代码行数:27,代码来源:ConsoleBootloader.php


示例14: __inspect_recurs

 function __inspect_recurs($data, $head = '')
 {
     $maxlenk = 30;
     $maxlent = 8;
     foreach ($data as $k => $v) {
         if (strlen($k) > $maxlenk) {
             $maxlenk = strlen($k);
         }
         if (strlen(typeOf($v)) > $maxlent) {
             $maxlent = strlen(typeOf($v));
         }
     }
     $maxlent += 2;
     $itemcount = count($data);
     $idx = 0;
     foreach ($data as $k => $v) {
         $idx++;
         if (typeOf($v) == 'array' || typeOf($v) == 'stdClass') {
             $ttl = $head . $k . ' ';
             console::writeLn($ttl);
             $myend = '|_';
             $nhead = $head;
             if ($idx++ > 0) {
                 $nhead = substr($head, 0, strlen($head) - 1) . ' ';
             }
             self::__inspect_recurs($v, $nhead . $myend);
         } else {
             switch (typeOf($v)) {
                 case 'boolean':
                     $sv = $v ? 'true' : 'false';
                     break;
                 default:
                     $sv = '"' . $v . '"';
             }
             console::writeLn('%s = %s', $head . sprintf('%s<%s>', $k, typeOf($v)), $sv);
         }
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:38,代码来源:debug.php


示例15: run

 /**
  * @brief Run the application. Invoked by Lepton.
  * Will parse the arguments and make sure everything is in order.
  *
  */
 function run()
 {
     global $argc, $argv;
     if (isset($this->arguments)) {
         if (is_string($this->arguments)) {
             $strargs = $this->arguments;
             $longargs = array();
         } elseif (is_array($this->arguments)) {
             $strargs = '';
             $longargs = array();
             foreach ($this->arguments as $arg) {
                 $strargs .= $arg[0];
                 // Scope is the : or ::
                 $scope = substr($arg[0], 1);
                 $longargs[] = $arg[1] . $scope;
             }
         } elseif (typeOf($this->arguments) == 'AppArgumentList') {
             $args = $this->arguments->getData();
             $strargs = '';
             $longargs = array();
             foreach ($args as $arg) {
                 $strargs .= $arg[0];
                 // Scope is the : or ::
                 $scope = substr($arg[0], 1);
                 $longargs[] = $arg[1] . $scope;
             }
         } else {
             console::warn('Application->$arguments is set but format is not understood');
         }
         list($args, $params) = $this->parseArguments($strargs, $longargs);
         foreach ($args as $arg => $val) {
             if (in_array($arg, $longargs)) {
                 foreach ($args as $argsrc => $v) {
                     if ($argsrc == $arg) {
                         $args[$argsrc[0]] = $val;
                         $olarg = $argsrc[0];
                     }
                 }
             } else {
                 foreach ($args as $argsrc => $v) {
                     if ($argsrc == $arg) {
                         $arg[$argsrc] = $val;
                         $olarg = $argsrc[0];
                         // Do any matching we need here
                     }
                 }
             }
         }
         $this->_args = $args;
         $this->_params = $params;
     }
     if (isset($args['h'])) {
         if (method_exists($this, 'usage')) {
             $this->usage();
         }
         return 1;
     }
     return $this->main($argc, $argv);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:64,代码来源:application.php


示例16: CountItems

function CountItems()
{
    global $db;
    $cat = $db->query('SELECT ID,type,access,sc FROM ' . PRE . 'cats')->fetchAll(3);
    //FETCH_NUM
    $ile = count($cat);
    if ($ile > 0) {
        #Dla każdej kategorii policz liczbę zawartości
        for ($i = 0; $i < $ile; ++$i) {
            $id = $cat[$i][0];
            $num[$id] = dbCount(typeOf($cat[$i][1]) . ' WHERE cat=' . $id . ' AND access=1');
            #ID kategorii nadrzędnej
            $sub[$id] = $cat[$i][3];
            #Tablica będzie zawierać ilość kategorii w podkategoriach
            $total[$id] = $num[$id];
        }
        for ($i = 0; $i < $ile; $i++) {
            #Jeżeli dostępna - znajdź podkategorie i dolicz ilość zawartości
            if ($cat[$i][2] != 2 && $cat[$i][2] != 3) {
                $x = $cat[$i][3];
                #Nadkategoria
                while ($x != 0 && is_numeric($x)) {
                    $total[$x] += $total[$cat[$i][0]];
                    $x = $sub[$x];
                }
            }
        }
        #Zapisz ilość dla każdej kategorii
        $q = $db->prepare('UPDATE ' . PRE . 'cats SET num=?, nums=? WHERE ID=?');
        foreach ($total as $k => $x) {
            if (is_numeric($x) && is_numeric($num[$k])) {
                $q->execute(array($num[$k], $x, $k));
            }
        }
    }
}
开发者ID:BGCX067,项目名称:f3site-svn-to-git,代码行数:36,代码来源:categories.php


示例17: route

 /**
  * Performs the actual routing.
  *
  * @param mixed                  $routable
  * @param ServerRequestInterface $request
  * @param ResponseInterface      $response
  * @param callable               $next
  * @return ResponseInterface
  */
 function route($routable, ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     if (is_null($routable)) {
         return $next();
     }
     if (is_callable($routable)) {
         if ($routable instanceof FactoryRoutable) {
             $instance = $this->runFactory($routable);
             return $this->route($instance, $request, $response, $next);
         } else {
             $response = $this->callHandler($routable, $request, $response, $next);
         }
     } else {
         if ($routable instanceof \IteratorAggregate) {
             $routable = $routable->getIterator();
         } elseif (is_array($routable)) {
             $routable = new \ArrayIterator($routable);
         }
         if ($routable instanceof Iterator) {
             $response = $this->iteration_start($routable, $request, $response, $next, ++self::$stackCounter);
         } elseif (is_string($routable)) {
             $routable = $this->injector->make($routable);
             if (is_callable($routable)) {
                 $response = $this->callHandler($routable, $request, $response, $next);
             } else {
                 throw new \RuntimeException(sprintf("Instances of class <span class=class>%s</span> are not routable.", Debug::getType($routable)));
             }
         } else {
             throw new \RuntimeException(sprintf("Invalid routable type <span class=type>%s</span>.", typeOf($routable)));
         }
     }
     return $response;
 }
开发者ID:electro-framework,项目名称:framework,代码行数:42,代码来源:BaseRouter.php


示例18: testDecribesActualTypeInMismatchMessage

 public function testDecribesActualTypeInMismatchMessage()
 {
     $this->assertMismatchDescription('was null', typeOf('boolean'), null);
     $this->assertMismatchDescription('was an integer <5>', typeOf('float'), 5);
 }
开发者ID:zhangjingli35,项目名称:hamcrest,代码行数:5,代码来源:IsTypeOfTest.php


示例19: _inspect

 /**
  * For internal use.
  *
  * @param Component $component
  * @param bool      $deep
  * @throws ComponentException
  */
 private static function _inspect(Component $component, $deep = true)
 {
     if (self::$recursionMap->contains($component)) {
         echo "<i>recursion</i>";
         return;
     }
     self::$recursionMap->attach($component);
     $COLOR_BIND = '#5AA';
     $COLOR_CONST = '#5A5';
     $COLOR_INFO = '#CCC';
     $COLOR_PROP = '#B00';
     $COLOR_TAG = '#000;font-weight:bold';
     $COLOR_TYPE = '#55A';
     $COLOR_VALUE = '#333';
     $COLOR_SHADOW_DOM = '#5AA;font-weight:bold';
     $Q = "<i style='color:#CCC'>\"</i>";
     $tag = $component->getTagName();
     $hasContent = false;
     echo "<div class=__component><span style='color:{$COLOR_TAG}'>&lt;{$tag}</span>";
     $isDoc = $component instanceof DocumentFragment;
     if (!$component->parent && !$isDoc) {
         echo "&nbsp;<span style='color:{$COLOR_INFO}'>(detached)</span>";
     }
     $type = typeOf($component) . ' #' . Debug::objectId($component);
     echo "<span class='icon hint--rounded hint--right' data-hint='Component:\n{$type}'><i class='fa fa-info-circle'></i></span>";
     $type1 = str_pad('#' . Debug::objectId($component->context), 4, ' ', STR_PAD_LEFT);
     $type2 = str_pad('#' . Debug::objectId($component->getDataBinder()), 4, ' ', STR_PAD_LEFT);
     $type3 = str_pad('#' . Debug::objectId($component->getViewModel()), 4, ' ', STR_PAD_LEFT);
     $type4 = str_pad('#' . Debug::objectId($component->getDataBinder()->getViewModel()), 4, ' ', STR_PAD_LEFT);
     $type5 = str_pad('#' . Debug::objectId($component->getDataBinder()->getProps()), 4, ' ', STR_PAD_LEFT);
     echo "<span class='icon hint--rounded hint--bottom' data-hint='Context:    {$type1}  Data binder:       {$type2}\nView model: {$type3}  Binder view model: {$type4}\nProperties: {$type5}'><i class='fa fa-database'></i></span>";
     // Handle text node
     if ($component instanceof Text) {
         echo "<span style='color:{$COLOR_TAG}'>&gt;</span><div style='margin:0 0 0 15px'>";
         try {
             if ($component->isBound('value')) {
                 /** @var Expression $exp */
                 $exp = $component->getBinding('value');
                 $exp = self::inspectString((string) $exp);
                 echo "<span style='color:{$COLOR_BIND}'>{$exp}</span> = ";
                 $v = self::getBindingValue('value', $component, $error);
                 if ($error) {
                     echo $v;
                     return;
                 }
                 if (!is_string($v)) {
                     echo Debug::typeInfoOf($v);
                     return;
                 }
             } else {
                 $v = $component->props->value;
             }
             $v = strlen(trim($v)) ? HtmlSyntaxHighlighter::highlight($v) : "<i>'{$v}'</i>";
             echo $v;
         } finally {
             echo "</div><span style='color:{$COLOR_TAG}'>&lt;/{$tag}&gt;<br></span></div>";
         }
         return;
     }
     // Handle other node types
     if ($component instanceof DocumentFragment) {
         self::inspectViewModel($component);
     }
     if ($component->supportsProperties()) {
         /** @var ComponentProperties $propsObj */
         $propsObj = $component->props;
         if ($propsObj) {
             $props = $propsObj->getAll();
         } else {
             $props = null;
         }
         if ($props) {
             ksort($props);
         }
         if ($props) {
             $type = typeOf($propsObj);
             $tid = Debug::objectId($propsObj);
             echo "<span class='icon hint--rounded hint--right' data-hint='Properties: #{$tid}\n{$type}'><i class='fa fa-list'></i></span>";
             echo "<table class='__console-table' style='color:{$COLOR_VALUE}'>";
             // Display all scalar properties.
             foreach ($props as $k => $v) {
                 $t = $component->props->getTypeOf($k);
                 $isModified = $component->props->isModified($k);
                 $modifStyle = $isModified ? ' class=__modified' : ' class=__original';
                 if ($t != type::content && $t != type::collection && $t != type::metadata) {
                     $tn = $component->props->getTypeNameOf($k);
                     echo "<tr{$modifStyle}><td style='color:{$COLOR_PROP}'>{$k}<td><i style='color:{$COLOR_TYPE}'>{$tn}</i><td>";
                     // Display data-binding
                     if ($component->isBound($k)) {
                         /** @var Expression $exp */
                         $exp = $component->getBinding($k);
                         $exp = self::inspectString((string) $exp);
                         echo "<span style='color:{$COLOR_BIND}'>{$exp}</span> = ";
//.........这里部分代码省略.........
开发者ID:electro-modules,项目名称:matisse,代码行数:101,代码来源:ComponentInspector.php


示例20: esc_sql

 function esc_sql($value, $colType = null) {
   if (is_number($value)) return $value;
   if (typeOf($value) === 'NULL') return 'NULL';
   return app('db')->getPdo()->quote($value);
 }
开发者ID:pkirkaas,项目名称:PkExtensions,代码行数:5,代码来源:pkhelpers.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP type_options函数代码示例发布时间:2022-05-23
下一篇:
PHP type函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap