kahlan\util\Text::_objectToString PHP Method

_objectToString() protected static method

Generate a string representation of an object.
protected static _objectToString ( array $value, $options ) : string
$value array The object.
return string The dumped string.
    protected static function _objectToString($value, $options)
    {
        if ($value instanceof Exception) {
            $msg = '`' . get_class($value) . '` Code(' . $value->getCode() . ') with ';
            $message = $value->getMessage();
            if ($message) {
                $msg .= 'message ' . static::dump($value->getMessage());
            } else {
                $msg .= 'no message';
            }
            return $msg . ' in ' . $value->getFile() . ':' . $value->getLine();
        }
        $method = $options['object']['method'];
        if (is_callable($method)) {
            return $method($value);
        }
        if (!$method || !method_exists($value, $method)) {
            return '`' . get_class($value) . '`';
        }
        return $value->{$method}();
    }