public static function mixedToString($mixed_)
 {
     if (is_array($mixed_)) {
         return Arrays::toString($mixed_);
     }
     if (is_object($mixed_) && false === method_exists($mixed_, '__toString')) {
         return get_class($mixed_);
     }
     return trim((string) $mixed_);
 }
Exemplo n.º 2
0
 /**
  * @see Components\Object::__toString() __toString
  */
 public function __toString()
 {
     return sprintf('%s@%s{type: %s, method: %s, params: %s}', __CLASS__, $this->hashCode(), $this->type, $this->method, Arrays::toString($this->params));
 }
 /**
  * Format log message and substitute placeholders.
  *
  * @param int $level_
  * @param mixed[] $args_
  *
  * @return string
  */
 protected function format($level_, array $args_ = [])
 {
     // FIXME Define scope of / pass scope to preg_replace_callback callback!?
     $this->__level = $level_;
     $this->__namespace = array_shift($args_);
     $message = array_shift($args_);
     foreach ($args_ as $key => $value) {
         if (is_array($value)) {
             $args_[$key] = Arrays::toString($value);
         }
     }
     $this->__message = vsprintf($message, $args_);
     return preg_replace_callback($this->m_patternPlaceholder, function ($placeholder_) {
         return $this->m_patternCallbacks[reset($placeholder_)]();
     }, $this->m_patternCompiled);
 }
 /**
  * @see \Components\Object::__toString() \Components\Object::__toString()
  */
 public function __toString()
 {
     return sprintf('%s@%s{read: %s, write: %s}', __CLASS__, $this->hashCode(), Arrays::toString($this->m_read), Arrays::toString($this->m_write));
 }
 /**
  * @see \Components\Enumeration::__toString() __toString
  */
 public function __toString()
 {
     return sprintf('%s@%s{name: %s, value: %s, options: %s}', __CLASS__, $this->hashCode(), $this->m_name, $this->m_value, Arrays::toString($this->m_options));
 }
 /**
  * @param mixed $object_
  *
  * @return string
  */
 public static function toString($object_)
 {
     return sprintf('%s@%s{%s}', get_class($object_), \math\hasho($object_), Arrays::toString(get_object_vars($object_)));
 }
 /**
  * @see \Components\Object::__toString() __toString
  */
 public function __toString()
 {
     return Arrays::toString($this->m_value);
 }