public function writeArg($arg) { if (is_string($arg)) { $this->protocol->writeString($arg); } elseif (is_object($arg)) { if (!$arg instanceof JavaType) { error_log((string) new IllegalArgumentException($arg)); trigger_error("argument '" . get_class($arg) . "' is not a Java object,using NULL instead", E_USER_WARNING); $this->protocol->writeObject(null); } else { $this->protocol->writeObject($arg->get__java()); } } elseif (is_null($arg)) { $this->protocol->writeObject(null); } elseif (is_bool($arg)) { $this->protocol->writeBoolean($arg); } elseif (is_integer($arg)) { $this->protocol->writeLong($arg); } elseif (is_float($arg)) { $this->protocol->writeDouble($arg); } elseif (is_array($arg)) { $wrote_begin = false; foreach ($arg as $key => $val) { if (is_string($key)) { if (!$wrote_begin) { $wrote_begin = 1; $this->protocol->writeCompositeBegin_h(); } $this->protocol->writePairBegin_s($key); $this->writeArg($val); $this->protocol->writePairEnd(); } else { if (!$wrote_begin) { $wrote_begin = 1; $this->protocol->writeCompositeBegin_h(); } $this->protocol->writePairBegin_n($key); $this->writeArg($val); $this->protocol->writePairEnd(); } } if (!$wrote_begin) { $this->protocol->writeCompositeBegin_a(); } $this->protocol->writeCompositeEnd(); } }