本文整理汇总了PHP中String::clazz方法的典型用法代码示例。如果您正苦于以下问题:PHP String::clazz方法的具体用法?PHP String::clazz怎么用?PHP String::clazz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::clazz方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
self::$classCRC32Cache = new IdentityHashMap();
self::$CLASS_TO_SERIALIZER_INSTANCE = new IdentityHashMap();
self::$NO_SUCH_SERIALIZER = new SerializabilityUtilEx_NoSuchSerializer();
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES = new HashMap();
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES = new HashSet();
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Boolean::typeClass()->getFullName(), "Z");
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Byte::typeClass()->getFullName(), "B");
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Character::typeClass()->getFullName(), "C");
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Double::typeClass()->getFullName(), "D");
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Float::typeClass()->getFullName(), "F");
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Integer::typeClass()->getFullName(), "I");
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Long::typeClass()->getFullName(), "J");
self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->put(Short::typeClass()->getFullName(), "S");
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Boolean::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Byte::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Character::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Double::clazz());
//TODO Exception class
//self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Exception::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Float::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Integer::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Long::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Object::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Short::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(String::clazz());
self::$TYPES_WHOSE_IMPLEMENTATION_IS_EXCLUDED_FROM_SIGNATURES->add(Classes::classOf('Throwable'));
}
示例2: writeValue
public function writeValue(Clazz $clazz, $instance)
{
if ($clazz === Boolean::typeClass()) {
$this->writeObject(new Boolean($instance));
} else {
if ($clazz === Byte::typeClass()) {
$this->writeObject(new Byte($instance));
} else {
if ($clazz === Character::typeClass()) {
$this->writeObject(new Character($instance));
} else {
if ($clazz === Double::typeClass()) {
$this->writeObject(new Double($instance));
} else {
if ($clazz === Float::typeClass()) {
$this->writeObject(new Float($instance));
} else {
if ($clazz === Integer::typeClass()) {
$this->writeObject(new Integer($instance));
} else {
if ($clazz === Long::typeClass()) {
$this->writeObject(new Long($instance));
} else {
if ($clazz === Short::typeClass()) {
$this->writeObject(new Short($instance));
} else {
if ($clazz === String::clazz()) {
$this->writeString($instance);
} else {
if ($clazz->isEnum()) {
$this->writeEnum($clazz, $instance);
} else {
$this->writeObject($instance);
}
}
}
}
}
}
}
}
}
}
}
示例3: getTargetType
public function getTargetType()
{
return String::clazz();
}
示例4: deserializeStringTable
private function deserializeStringTable()
{
$typeNameCount = $this->readInt();
$buffer = new SSSR_BoundedList(String::clazz(), $typeNameCount);
for ($typeNameIndex = 0; $typeNameIndex < $typeNameCount; ++$typeNameIndex) {
$str = $this->extract();
// Change quoted characters back.
$idx = mb_strpos($str, '\\');
if ($idx !== false) {
$buf = '';
$pos = 0;
while ($idx >= 0) {
$buf .= mb_substr($str, $pos, $idx - $pos);
if (++$idx == mb_strlen($str)) {
throw new SerializationException("Unmatched backslash: \"{$str}\"");
}
$ch = mb_substr($str, $idx, 1);
$pos = $idx + 1;
switch (Character::ord($ch)) {
case Character::ord('0'):
$buf .= '\\u0000';
break;
case Character::ord('!'):
$buf .= self::RPC_SEPARATOR_CHAR;
break;
case Character::ord('\\'):
$buf .= $ch;
break;
case Character::ord('u'):
try {
$ch = Character::chr(Integer::parseHex(mb_substr($str, $idx + 1, 4)));
} catch (NumberFormatException $e) {
throw new SerializationException("Invalid Unicode escape sequence \"{$str}\"");
}
$buf .= $ch;
$pos += 4;
break;
default:
throw new SerializationException("Unexpected escape character {$ch} after backslash: \"{$str}\"");
}
$idx = mb_strpos($str, '\\', $pos);
}
$buf .= mb_substr($str, $pos);
$str = buf;
}
$buffer->add($str);
}
if ($buffer->size() != $buffer->getExpectedSize()) {
throw new SerializationException('Expected ' . $buffer->getExpectedSize() . ' string table elements; received ' . $buffer->size());
}
$this->stringTable = $buffer->toArray();
}
示例5: init
public static function init()
{
$JRE_BLACKLIST = array(Boolean::clazz(), Byte::clazz(), Clazz::clazz(), Double::clazz(), Float::clazz(), Integer::clazz(), Long::clazz(), Short::clazz(), String::clazz(), Classes::classOf('ArrayList'), Classes::classOf('Date'), Classes::classOf('HashMap'), Classes::classOf('HashSet'), Classes::classOf('Stack'), Classes::classOf('Vector'));
self::$JRE_BLACKSET = new HashSet(self::$JRE_BLACKLIST);
self::$sInstance = new LegacySerializationPolicy();
}
示例6: init
public static function init()
{
self::$JS_CHARS_ESCAPED[chr(0)] = '0';
self::$JS_CHARS_ESCAPED[""] = 'b';
self::$JS_CHARS_ESCAPED["\t"] = 't';
self::$JS_CHARS_ESCAPED["\n"] = 'n';
self::$JS_CHARS_ESCAPED["\f"] = 'f';
self::$JS_CHARS_ESCAPED["\r"] = 'r';
self::$JS_CHARS_ESCAPED[self::JS_ESCAPE_CHAR] = self::JS_ESCAPE_CHAR;
self::$JS_CHARS_ESCAPED[self::JS_QUOTE_CHAR] = self::JS_QUOTE_CHAR;
self::$CLASS_TO_VALUE_WRITER = new IdentityHashMap();
self::$CLASS_TO_VECTOR_WRITER = new IdentityHashMap();
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('boolean[]'), SSSW_VectorWriter::$BOOLEAN_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('byte[]'), SSSW_VectorWriter::$BYTE_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('char[]'), SSSW_VectorWriter::$CHAR_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('double[]'), SSSW_VectorWriter::$DOUBLE_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('float[]'), SSSW_VectorWriter::$FLOAT_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('int[]'), SSSW_VectorWriter::$INT_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('long[]'), SSSW_VectorWriter::$LONG_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('Object[]'), SSSW_VectorWriter::$OBJECT_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('short[]'), SSSW_VectorWriter::$SHORT_VECTOR);
self::$CLASS_TO_VECTOR_WRITER->put(Classes::classOf('String[]'), SSSW_VectorWriter::$STRING_VECTOR);
self::$CLASS_TO_VALUE_WRITER->put(Boolean::typeClass(), SSSW_ValueWriter::$BOOLEAN);
self::$CLASS_TO_VALUE_WRITER->put(Byte::typeClass(), SSSW_ValueWriter::$BYTE);
self::$CLASS_TO_VALUE_WRITER->put(Character::typeClass(), SSSW_ValueWriter::$CHAR);
self::$CLASS_TO_VALUE_WRITER->put(Double::typeClass(), SSSW_ValueWriter::$DOUBLE);
self::$CLASS_TO_VALUE_WRITER->put(Float::typeClass(), SSSW_ValueWriter::$FLOAT);
self::$CLASS_TO_VALUE_WRITER->put(Integer::typeClass(), SSSW_ValueWriter::$INT);
self::$CLASS_TO_VALUE_WRITER->put(Long::typeClass(), SSSW_ValueWriter::$LONG);
self::$CLASS_TO_VALUE_WRITER->put(Object::clazz(), SSSW_ValueWriter::$OBJECT);
self::$CLASS_TO_VALUE_WRITER->put(Short::typeClass(), SSSW_ValueWriter::$SHORT);
self::$CLASS_TO_VALUE_WRITER->put(String::clazz(), SSSW_ValueWriter::$STRING);
}
示例7: JavaClazz
Classes::register('Long', new JavaClazz('Long', $objClass));
Classes::register('Short', new JavaClazz('Short', $objClass));
Classes::register('Integer', new JavaClazz('Integer', $objClass));
Classes::register('Character', new JavaClazz('Character', $objClass));
Classes::register('String', new JavaClazz('String', $objClass));
Classes::register('Float', new JavaClazz('Float', $objClass));
Classes::register('Double', new JavaClazz('Double', $objClass));
Classes::register('Void', new JavaClazz('Void', $objClass));
// Aliases
Classes::registerAlias('string', String::clazz());
Classes::registerAlias('bool', Boolean::typeClass());
// Signatures
Classes::registerSignature(Boolean::SIGNATURE, Boolean::typeClass());
Classes::registerSignature(Byte::SIGNATURE, Byte::typeClass());
Classes::registerSignature(Character::SIGNATURE, Character::typeClass());
Classes::registerSignature(Double::SIGNATURE, Double::typeClass());
Classes::registerSignature(Float::SIGNATURE, Float::typeClass());
Classes::registerSignature(Integer::SIGNATURE, Integer::typeClass());
Classes::registerSignature(Long::SIGNATURE, Long::typeClass());
Classes::registerSignature(Short::SIGNATURE, Short::typeClass());
// Assignable From
Long::typeClass()->registerAssignableFrom(array(Double::typeClass(), Integer::typeClass(), Character::typeClass(), Short::typeClass(), Byte::typeClass()));
Integer::typeClass()->registerAssignableFrom(array(Character::typeClass(), Short::typeClass(), Byte::typeClass()));
Character::typeClass()->registerAssignableFrom(array(Integer::typeClass(), Short::typeClass(), Byte::typeClass()));
Short::typeClass()->registerAssignableFrom(array(Integer::typeClass(), Byte::typeClass()));
Byte::typeClass()->registerAssignableFrom(array(Integer::typeClass()));
Double::typeClass()->registerAssignableFrom(array(Float::typeClass()));
Float::typeClass()->registerAssignableFrom(array(Double::typeClass()));
Character::typeClass()->registerAssignableFrom(array(String::clazz()));
String::clazz()->registerAssignableFrom(array(Character::typeClass()));