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


PHP Type::typeof方法代码示例

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


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

示例1: executeModule

 public function executeModule($classPath)
 {
     $cls = Type::resolveClass($classPath);
     if (is_object($_t = Type::typeof($cls)) && !$_t instanceof Enum ? $_t !== ValueType::$TNull : $_t != ValueType::$TNull) {
         try {
             Reflect::callMethod($cls, Reflect::field($cls, "main"), new _hx_array(array()));
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $error = $_ex_;
         }
         zcale_core_web_ModuleLoader::$loadedModules->push($classPath);
         $this->loadNextModule();
     } else {
         $this->event->dispatchError($this->eventData, $this, "executeModule", "Class not found: " . _hx_string_or_null($classPath));
     }
 }
开发者ID:adrianmm44,项目名称:zcale,代码行数:16,代码来源:ModuleLoader.class.php

示例2: load

 public function load($filePath)
 {
     if (Lambda::has(zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts, $filePath) === false) {
         $classPath = null;
         $s = zcale_PathTools::removeLastElement($filePath, null);
         $classPath = str_replace("/", ".", $s);
         $cls = Type::resolveClass($classPath);
         if (is_object($_t = Type::typeof($cls)) && !$_t instanceof Enum ? $_t !== ValueType::$TNull : $_t != ValueType::$TNull) {
             try {
                 Reflect::callMethod($cls, Reflect::field($cls, "main"), new _hx_array(array()));
             } catch (Exception $__hx__e) {
                 $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
                 $error = $_ex_;
             }
             zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts->push($filePath);
             $this->event->dispatch($this->eventKeys->complete);
         } else {
             $this->event->dispatchError($this->eventData, $this, "load", "Class not found: " . _hx_string_or_null($classPath));
         }
     } else {
         $this->event->dispatch($this->eventKeys->complete);
     }
 }
开发者ID:adrianmm44,项目名称:zcale,代码行数:23,代码来源:SystemScriptLoader.class.php

示例3: serialize

 public function serialize($v)
 {
     $_g = Type::typeof($v);
     switch ($_g->index) {
         case 0:
             $this->buf->add("n");
             break;
         case 1:
             $v1 = $v;
             if ($v1 === 0) {
                 $this->buf->add("z");
                 return;
             }
             $this->buf->add("i");
             $this->buf->add($v1);
             break;
         case 2:
             $v2 = $v;
             if (Math::isNaN($v2)) {
                 $this->buf->add("k");
             } else {
                 if (!Math::isFinite($v2)) {
                     $this->buf->add($v2 < 0 ? "m" : "p");
                 } else {
                     $this->buf->add("d");
                     $this->buf->add($v2);
                 }
             }
             break;
         case 3:
             $this->buf->add($v ? "t" : "f");
             break;
         case 6:
             $c = _hx_deref($_g)->params[0];
             if (is_object($_t = $c) && !$_t instanceof Enum ? $_t === _hx_qtype("String") : $_t == _hx_qtype("String")) {
                 $this->serializeString($v);
                 return;
             }
             if ($this->useCache && $this->serializeRef($v)) {
                 return;
             }
             switch ($c) {
                 case _hx_qtype("Array"):
                     $ucount = 0;
                     $this->buf->add("a");
                     $l = _hx_len($v);
                     $_g1 = 0;
                     while ($_g1 < $l) {
                         $i = $_g1++;
                         if ($v[$i] === null) {
                             $ucount++;
                         } else {
                             if ($ucount > 0) {
                                 if ($ucount === 1) {
                                     $this->buf->add("n");
                                 } else {
                                     $this->buf->add("u");
                                     $this->buf->add($ucount);
                                 }
                                 $ucount = 0;
                             }
                             $this->serialize($v[$i]);
                         }
                         unset($i);
                     }
                     if ($ucount > 0) {
                         if ($ucount === 1) {
                             $this->buf->add("n");
                         } else {
                             $this->buf->add("u");
                             $this->buf->add($ucount);
                         }
                     }
                     $this->buf->add("h");
                     break;
                 case _hx_qtype("List"):
                     $this->buf->add("l");
                     $v3 = $v;
                     if (null == $v3) {
                         throw new HException('null iterable');
                     }
                     $__hx__it = $v3->iterator();
                     while ($__hx__it->hasNext()) {
                         unset($i1);
                         $i1 = $__hx__it->next();
                         $this->serialize($i1);
                     }
                     $this->buf->add("h");
                     break;
                 case _hx_qtype("Date"):
                     $d = $v;
                     $this->buf->add("v");
                     $this->buf->add($d->getTime());
                     break;
                 case _hx_qtype("haxe.ds.StringMap"):
                     $this->buf->add("b");
                     $v4 = $v;
                     if (null == $v4) {
                         throw new HException('null iterable');
                     }
//.........这里部分代码省略.........
开发者ID:kevinresol,项目名称:mvc-platform-test,代码行数:101,代码来源:Serializer.class.php

示例4: areNotEqual

 /**
  * Comprueba si los dos objetos especificados NO son iguales. En caso de que sí lo sean,
  * emite una advertencia.
  *
  *
  * @param  string $msg Custom message to append on assert failed.
  * @return  boolean true si NO son iguales; false, en caso contrario.
  * */
 public static function areNotEqual($notExpected, $actual, $msg = '')
 {
     $not_equals = !self::Equals($notExpected, $actual);
     if (!$not_equals) {
         $a_string = $actual;
         $ne_string = $notExpected;
         if (is_array($actual)) {
             $a_string = implode(', ', $actual);
         }
         if (is_array($notExpected)) {
             $ne_string = implode(', ', $notExpected);
         }
         if (is_bool($actual)) {
             $a_string = $actual ? 'true' : 'false';
         }
         if (is_bool($notExpected)) {
             $ne_string = $notExpected ? 'true' : 'false';
         }
         $error = sprintf(dgettext('nml', '%5$s failed. Not expected: (%3$s) "%4$s". Actual: (%1$s) "%2$s".'), Type::typeof($actual), $a_string, Type::typeof($notExpected), $ne_string, __METHOD__);
         if ($msg) {
             $error .= ' ' . sprintf(dgettext('nml', 'Message: %s'), $msg);
         }
         trigger_error($error, E_USER_WARNING);
     }
     return $not_equals;
 }
开发者ID:nelson6e65,项目名称:php_nml,代码行数:34,代码来源:Assert.php

示例5: write

 public function write($k, $v)
 {
     if ($this->replacer !== null) {
         $v = $this->replacer($k, $v);
     }
     $_g = Type::typeof($v);
     switch ($_g->index) {
         case 8:
             $this->buf->add("\"???\"");
             break;
         case 4:
             $this->fieldsString($v, Reflect::fields($v));
             break;
         case 1:
             $v1 = $v;
             $this->buf->add($v1);
             break;
         case 2:
             $v2 = null;
             if (Math::isFinite($v)) {
                 $v2 = $v;
             } else {
                 $v2 = "null";
             }
             $this->buf->add($v2);
             break;
         case 5:
             $this->buf->add("\"<fun>\"");
             break;
         case 6:
             $c = _hx_deref($_g)->params[0];
             if (is_object($_t = $c) && !$_t instanceof Enum ? $_t === _hx_qtype("String") : $_t == _hx_qtype("String")) {
                 $this->quote($v);
             } else {
                 if (is_object($_t2 = $c) && !$_t2 instanceof Enum ? $_t2 === _hx_qtype("Array") : $_t2 == _hx_qtype("Array")) {
                     $v3 = $v;
                     $this->buf->b .= "[";
                     $len = $v3->length;
                     $last = $len - 1;
                     $_g1 = 0;
                     while ($_g1 < $len) {
                         $i = $_g1++;
                         if ($i > 0) {
                             $this->buf->b .= ",";
                         } else {
                             $this->nind++;
                         }
                         if ($this->pretty) {
                             $this->buf->b .= "\n";
                         }
                         if ($this->pretty) {
                             $v4 = null;
                             $c1 = $this->indent;
                             $l = $this->nind * strlen($this->indent);
                             if (strlen($c1) === 0 || strlen("") >= $l) {
                                 $v4 = "";
                             } else {
                                 $v4 = str_pad("", Math::ceil(($l - strlen("")) / strlen($c1)) * strlen($c1) + strlen(""), $c1, STR_PAD_LEFT);
                             }
                             unset($l, $c1);
                             $this->buf->add($v4);
                             unset($v4);
                         }
                         $this->write($i, $v3[$i]);
                         if ($i === $last) {
                             $this->nind--;
                             if ($this->pretty) {
                                 $this->buf->b .= "\n";
                             }
                             if ($this->pretty) {
                                 $v5 = null;
                                 $c2 = $this->indent;
                                 $l1 = $this->nind * strlen($this->indent);
                                 if (strlen($c2) === 0 || strlen("") >= $l1) {
                                     $v5 = "";
                                 } else {
                                     $v5 = str_pad("", Math::ceil(($l1 - strlen("")) / strlen($c2)) * strlen($c2) + strlen(""), $c2, STR_PAD_LEFT);
                                 }
                                 unset($l1, $c2);
                                 $this->buf->add($v5);
                                 unset($v5);
                             }
                         }
                         unset($i);
                     }
                     $this->buf->b .= "]";
                 } else {
                     if (is_object($_t3 = $c) && !$_t3 instanceof Enum ? $_t3 === _hx_qtype("haxe.ds.StringMap") : $_t3 == _hx_qtype("haxe.ds.StringMap")) {
                         $v6 = $v;
                         $o = _hx_anonymous(array());
                         if (null == $v6) {
                             throw new HException('null iterable');
                         }
                         $__hx__it = $v6->keys();
                         while ($__hx__it->hasNext()) {
                             unset($k1);
                             $k1 = $__hx__it->next();
                             $value = $v6->get($k1);
                             $o->{$k1} = $value;
                             unset($value);
//.........这里部分代码省略.........
开发者ID:sp-ruben-simon,项目名称:daff-php,代码行数:101,代码来源:JsonPrinter.class.php

示例6: getValueType

 static function getValueType($value)
 {
     if (Std::is($value, _hx_qtype("String"))) {
         return "String";
     }
     if (Std::is($value, _hx_qtype("Class"))) {
         return Type::getClassName($value);
     }
     if (Std::is($value, _hx_qtype("Enum"))) {
         return Type::getEnumName($value);
     }
     $name = null;
     $_g = Type::typeof($value);
     switch ($_g->index) {
         case 1:
             $name = "Int";
             break;
         case 3:
             $name = "Bool";
             break;
         case 6:
             $c = _hx_deref($_g)->params[0];
             $name = Type::getClassName($c);
             break;
         case 7:
             $e = _hx_deref($_g)->params[0];
             $name = Type::getEnumName($e);
             break;
         default:
             $name = null;
             break;
     }
     if ($name !== null) {
         return $name;
     }
     throw new HException("Could not determine type name of " . Std::string($value));
 }
开发者ID:kevinresol,项目名称:mvc-platform-test,代码行数:37,代码来源:Injector.class.php

示例7: save_pay_source

 public function save_pay_source($q)
 {
     $account = php_Lib::hashOfAssociativeArray($q->get("account"));
     haxe_Log::trace(Std::string($account) . ":" . Std::string(model_Clients_15($this, $account, $q)), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 676, "className" => "model.Clients", "methodName" => "save_pay_source")));
     $pIt = $account->keys();
     $user = S::$user;
     while ($pIt->hasNext()) {
         $pay_source_id = $pIt->next();
         $log_id = $this->save_pay_source_log($pay_source_id, null);
         if (!$log_id) {
             return false;
         }
         $sql = new StringBuf();
         $uFields = model_Clients::$pay_source_fields;
         $uFields->remove("pay_source_id");
         $bindTypes = "";
         $values2bind = null;
         $i = 0;
         $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes")));
         $sets = new _hx_array(array());
         $sql->add("UPDATE fly_crm.pay_source SET ");
         $_g = 0;
         while ($_g < $uFields->length) {
             $c = $uFields[$_g];
             ++$_g;
             haxe_Log::trace(_hx_string_or_null($c) . ":" . Std::string(Type::typeof($q->get($c))), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 699, "className" => "model.Clients", "methodName" => "save_pay_source")));
             $p = $q->get($c);
             $val = null;
             if ($p !== null) {
                 if (!Std::is($p, _hx_qtype("String"))) {
                     $valMap = php_Lib::hashOfAssociativeArray($q->get($c));
                     $val = $valMap->get(Std::string($pay_source_id));
                     unset($valMap);
                 } else {
                     $val = $p;
                 }
                 $values2bind[$i++] = $val;
                 $type = $dbFieldTypes->get($c);
                 if (Util::any2bool($type)) {
                     $bindTypes .= _hx_string_or_null($type);
                 } else {
                     $bindTypes .= "s";
                 }
                 $sets->push(_hx_string_or_null($c) . "=?");
                 unset($type);
             }
             unset($val, $p, $c);
         }
         unset($_g);
         if ($sets->length === 0) {
             continue;
         }
         $sql->add($sets->join(","));
         $sql->add(" WHERE pay_source_id=" . _hx_string_rec($pay_source_id, ""));
         $stmt = S::$my->stmt_init();
         haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 727, "className" => "model.Clients", "methodName" => "save_pay_source")));
         $success = $stmt->prepare($sql->b);
         if (!$success) {
             haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 731, "className" => "model.Clients", "methodName" => "save_pay_source")));
             return false;
         }
         haxe_Log::trace($values2bind, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 735, "className" => "model.Clients", "methodName" => "save_pay_source")));
         $success = myBindParam($stmt, $values2bind, $bindTypes);
         haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 737, "className" => "model.Clients", "methodName" => "save_pay_source")));
         if ($success) {
             $success = $stmt->execute();
             if (!$success) {
                 haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 743, "className" => "model.Clients", "methodName" => "save_pay_source")));
                 return false;
             }
             $this->save_pay_source_log($pay_source_id, $log_id);
             if (!$pIt->hasNext()) {
                 return true;
             }
         }
         unset($values2bind, $uFields, $success, $stmt, $sql, $sets, $pay_source_id, $log_id, $i, $dbFieldTypes, $bindTypes);
     }
     return false;
 }
开发者ID:axelhuizinga,项目名称:gem,代码行数:79,代码来源:Clients.class.php

示例8: dumpObjectRsafe

 static function dumpObjectRsafe($ob, $i = null)
 {
     $tClass = Type::getClass($ob);
     $m = "dumpObjectRsafe:" . Std::string($ob !== null ? Type::getClass($ob) : $ob) . "\n";
     $names = new _hx_array(array());
     if (Type::getClass($ob) !== null) {
         $names = Type::getInstanceFields(Type::getClass($ob));
     } else {
         $names = Reflect::fields($ob);
     }
     if (Type::getClass($ob) !== null) {
         $m = _hx_string_or_null(Type::getClassName(Type::getClass($ob))) . ":\n";
     }
     $_g = 0;
     while ($_g < $names->length) {
         $name = $names[$_g];
         ++$_g;
         try {
             $t = Std::string(Type::typeof(Reflect::field($ob, $name)));
             if (me_cunity_debug_Out::$skipFunctions && $t === "TFunction") {
                 null;
             }
             if ($name === "parentView" || $name === "ContextMenu" || $name === "cMenu") {
                 $m .= _hx_string_or_null($name) . ":" . Std::string($ob->parentView->id) . "\n";
             } else {
                 $m .= _hx_string_or_null($name) . ":" . Std::string(Reflect::field($ob, $name)) . ":" . _hx_string_or_null($t) . "\n";
             }
             unset($t);
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $ex = $_ex_;
             $m .= _hx_string_or_null($name) . ":" . Std::string($ex);
         }
         unset($name, $ex);
     }
     me_cunity_debug_Out::_trace($m, $i);
 }
开发者ID:axelhuizinga,项目名称:gem,代码行数:37,代码来源:Out.class.php


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