returns a textual description of given value

@param   \SebastianBergmann\Exporter\Exporter  $exporter
@param   mixed                                 $value
@return  string
355305
public function describeValue(Exporter $exporter, $value): string
    {
        if ($value instanceof \ArrayAccess) {
            return get_class($value) . ' implementing \ArrayAccess';
        }

        return parent::describeValue($exporter, $value);
    }
1152847
public function transform($value): string
    {
        if (method_exists($value, 'toJson')) {
            return $value->toJson();
        }

        if ($value instanceof JsonSerializable || $value instanceof StdClass) {
            return json_encode($value);
        }

        if (! method_exists($value, '__toString')) {
            throw Untransformable::cannotTransformObject($value);
        }

        return "'{$value}'";
    }
204551
public function serialize($value): string
    {
        if (is_array($value)) {
            return $this->packArray($value);
        }

        return $this->packValue($value);
    }
1073776
protected function parsePropertyValue($value)
    {
        $return = '';

        if (is_array($value)) {
            $withStringIndex = (bool) array_filter(array_keys($value), 'is_string');

            if ($withStringIndex) {
                $return = preg_replace(
                    ['/^(array ?\( *)/', '/\)$/'],
                    ['[', ']'],
                    str_replace("\n", '', var_export($value, true))
                );
            } else {
                $return =
                    '[' .
                    rtrim(
                        array_reduce(
                            $value,
                            function ($combined, $single) {
                                return $combined . var_export($single, true) . ', ';
                            },
                            ''
                        ),
                        ', '
                    ) .
                    ']';
            } // else
        } else {
            $return = var_export($value, true);
        } // else

        return $return;
    }
1184871
protected function get_value_as_string( $value ) {

		if ( is_object( $value ) && ! in_array( '__toString', get_class_methods( $value ) ) ) {
			$value = get_class( $value ) . ' object';
		} else if ( is_array( $value ) ) {
			$value = var_export( $value, TRUE );
		}

		return (string) $value;
	}
303441
public static function getText($value)
    {
        $enumItem = EnumParser::getInstance()->getEnumItem(static::class, $value);
        if($enumItem)
        {
            return $enumItem->text;
        }
        else
        {
            return null;
        }
    }
755376
private function getStatusString(Value $value): string
    {
        switch ($value->getStatus()) {
            case Value::STATUS_DRAFT:
                return 'DRAFT';
            case Value::STATUS_PUBLISHED:
                return 'PUBLISHED';
            case Value::STATUS_ARCHIVED:
                return 'ARCHIVED';
        }

        throw new RuntimeException(sprintf("Unknown status '%s'", var_export($value->getStatus(), true)));
    }
1348054
protected function getValueTypeDescription($value): string
    {
        if (is_resource($value)) {
            $valueType = get_resource_type($value) . " resource";
        } elseif (is_object($value)) {
            $valueType = get_class($value) . " object";
        } elseif (is_string($value)) {
            $valueType = "string \"{$value}\"";
        } else {
            $valueType = gettype($value);
        }

        return $valueType;
    }
1016533
protected function getDisplayValue($value)
    {
        if (is_numeric($value)) {
            $locale = SwatI18NLocale::get();
            $thousands_separator = $this->show_thousands_separator ? null : '';

            $value = $locale->formatNumber($value, null, array(
                'thousands_separator' => $thousands_separator
            ));
        } else {
            $value = parent::getDisplayValue($value);
        }

        return $value;
    }
437123
public function describeValue(Exporter $exporter, $value): string
    {
        $valueDescription = '';
        if (null !== $this->violatingKey) {
            $valueDescription .= 'element '
             . $exporter->export($this->violatingValue)
             . ' at key ' . $this->violatingKey . ' ';
        }

        return $valueDescription .  'in ' . $exporter->export($value);
    }
134521
public function export(&$value, int $depth = null): string
    {
        if (null === $depth) {
            $depth = $this->depth;
        }

        $final = (object) [];
        $stack = [[&$value, $final, 0, gettype($value)]];
        $results = [];
        $seenWrappers = new SplObjectStorage();
        $seenObjects = new SplObjectStorage();
        $seenArrays = [];
        $arrayResults = [];
        $arrayId = 0;

        while (!empty($stack)) {
            $entry = array_shift($stack);
            $value = &$entry[0];
            $result = $entry[1];
            $currentDepth = $entry[2];
            $type = $entry[3];
            $results[] = $result;

            switch ($type) {
                case 'NULL':
                    $result->type = 'null';

                    break;

                case 'boolean':
                    if ($value) {
                        $result->type = 'true';
                    } else {
                        $result->type = 'false';
                    }

                    break;

                case 'integer':
                    $result->type = strval($value);

                    break;

                case 'double':
                    $result->type = sprintf('%e', $value);

                    break;

                case 'resource':
                    $result->type = 'resource#' . intval($value);

                    break;

                case 'string':
                    $result->type = json_encode($value, $this->jsonFlags);

                    break;

                case 'array':
                    if (isset($value[self::ARRAY_ID_KEY])) {
                        $id = $value[self::ARRAY_ID_KEY];
                    } else {
                        $id = $value[self::ARRAY_ID_KEY] = $arrayId++;
                    }

                    $seenArrays[$id] = &$value;

                    if (isset($arrayResults[$id])) {
                        $result->type = '&' . $id . '[]';

                        break;
                    }

                    $result->type = '#' . $id;

                    if ($depth > -1 && $currentDepth >= $depth) {
                        $count = count($value) - 1;

                        if ($count) {
                            $result->type .= '[~' . $count . ']';
                        } else {
                            $result->type .= '[]';
                        }

                        break;
                    }

                    $arrayResults[$id] = $result;

                    $result->children = [];
                    $result->sequence = true;
                    $sequenceKey = 0;

                    foreach ($value as $key => &$childValue) {
                        if (self::ARRAY_ID_KEY === $key) {
                            continue;
                        }

                        if ($result->sequence) {
                            if ($key !== $sequenceKey++) {
                                $result->map = true;
                                $result->sequence = false;
                            }
                        }

                        $keyResult = (object) [];
                        $valueResult = (object) [];
                        $result->children[] = [$keyResult, $valueResult];

                        $stack[] = [
                            $key,
                            $keyResult,
                            $currentDepth + 1,
                            gettype($key),
                        ];
                        $stack[] = [
                            &$childValue,
                            $valueResult,
                            $currentDepth + 1,
                            gettype($childValue),
                        ];
                    }

                    break;

                case 'object':
                    $hash = spl_object_hash($value);

                    if (isset($this->objectIds[$hash])) {
                        $id = $this->objectIds[$hash];
                    } else {
                        $id = $this->objectIds[$hash] =
                            $this->objectSequencer->next();
                    }

                    if ($seenWrappers->contains($value)) {
                        $result->type = '&' . $id . '()';

                        break;
                    }

                    if ($seenObjects->contains($value)) {
                        $result->type = '&' . $id . '{}';

                        break;
                    }

                    if ($value instanceof Closure) {
                        $isWrapper = false;
                        $isClosure = true;
                        $isException = false;
                        $isHandle = false;
                        $isSpy = false;
                        $isStub = false;
                        $isGeneratorSpy = false;
                        $isIterableSpy = false;
                    } elseif ($value instanceof Throwable) {
                        $isWrapper = false;
                        $isClosure = false;
                        $isException = true;
                        $isHandle = false;
                        $isSpy = false;
                        $isStub = false;
                        $isGeneratorSpy = false;
                        $isIterableSpy = false;
                    } elseif ($value instanceof Generator) {
                        $isWrapper = isset($value->_phonySubject);
                        $isClosure = false;
                        $isException = false;
                        $isHandle = false;
                        $isSpy = false;
                        $isStub = false;
                        $isGeneratorSpy = $isWrapper;
                        $isIterableSpy = false;
                    } elseif ($value instanceof Handle) {
                        $isWrapper = true;
                        $isClosure = false;
                        $isException = false;
                        $isHandle = true;
                        $isSpy = false;
                        $isStub = false;
                        $isGeneratorSpy = false;
                        $isIterableSpy = false;

                        $isStaticHandle = $value instanceof StaticHandle;
                    } elseif ($value instanceof Stub) {
                        $isWrapper = true;
                        $isClosure = false;
                        $isException = false;
                        $isHandle = false;
                        $isSpy = false;
                        $isStub = true;
                        $isGeneratorSpy = false;
                        $isIterableSpy = false;

                        $isStubVerifier = $value instanceof StubVerifier;
                    } elseif ($value instanceof Spy) {
                        $isWrapper = true;
                        $isClosure = false;
                        $isException = false;
                        $isHandle = false;
                        $isSpy = true;
                        $isStub = false;
                        $isGeneratorSpy = false;
                        $isIterableSpy = false;

                        $isSpyVerifier = $value instanceof SpyVerifier;
                    } elseif ($value instanceof IterableSpy) {
                        $isWrapper = true;
                        $isClosure = false;
                        $isException = false;
                        $isHandle = false;
                        $isSpy = false;
                        $isStub = false;
                        $isGeneratorSpy = false;
                        $isIterableSpy = true;
                    } else {
                        $isWrapper = false;
                        $isClosure = false;
                        $isException = false;
                        $isHandle = false;
                        $isSpy = false;
                        $isStub = false;
                        $isGeneratorSpy = false;
                        $isIterableSpy = false;
                    }

                    $isMock = $value instanceof Mock;

                    if ($isClosure) {
                        $result->type = 'Closure';
                    } elseif ($isHandle) {
                        if ($isStaticHandle) {
                            $result->type = 'static-handle';
                        } else {
                            $result->type = 'handle';
                        }
                    } elseif ($isStub) {
                        $result->type = 'stub';
                    } elseif ($isSpy) {
                        $result->type = 'spy';
                    } elseif ($isGeneratorSpy) {
                        $result->type = 'generator-spy';
                    } elseif ($isIterableSpy) {
                        $result->type = 'iterable-spy';
                    } else {
                        $result->type = get_class($value);
                    }

                    $phpValues = (array) $value;

                    if ($isHandle) {
                        if ($isStaticHandle) {
                            $result->child = (object) [
                                'final' => $phpValues[
                                    "\0" . StaticHandle::class . "\0class"
                                ]->getName(),
                            ];
                        } else {
                            $result->child = (object) [];
                            $stack[] = [
                                $phpValues[
                                    "\0" . InstanceHandle::class . "\0mock"
                                ],
                                $result->child,
                                $currentDepth,
                                'object',
                            ];
                        }
                    } elseif ($isSpy) {
                        if ($isSpyVerifier) {
                            $phpValues = (array) $phpValues[
                                "\0" . SpyVerifier::class . "\0spy"
                            ];
                        }

                        if (!$phpValues["\0*\0isAnonymous"]) {
                            $result->child = (object) [
                                'final' => $this->exportCallable(
                                    $phpValues["\0*\0callback"]
                                ),
                            ];
                        }

                        $result->label = $phpValues["\0*\0label"];
                    } elseif ($isStub) {
                        if ($isStubVerifier) {
                            $phpValues = (array) $phpValues[
                                "\0" . StubVerifier::class . "\0stub"
                            ];
                        }

                        if (!$phpValues["\0*\0isAnonymous"]) {
                            $result->child = (object) [
                                'final' => $this->exportCallable(
                                    $phpValues["\0*\0callback"]
                                ),
                            ];
                        }

                        $result->label = $phpValues["\0*\0label"];
                    } elseif ($isGeneratorSpy) {
                        $result->child = (object) [];
                        $stack[] = [
                            $value->_phonySubject,
                            $result->child,
                            $currentDepth,
                            'object',
                        ];
                    } elseif ($isIterableSpy) {
                        $iterable = $value->iterable();
                        $result->child = (object) [];
                        $stack[] = [
                            $iterable,
                            $result->child,
                            $currentDepth,
                            gettype($iterable),
                        ];
                    }

                    if ($isWrapper) {
                        $result->wrapper = true;
                        $result->type .= '#' . $id;
                        $seenWrappers->offsetSet($value, true);
                    } else {
                        unset($phpValues["\0gcdata"]);

                        if ($isMock) {
                            $handleProperty =
                                "\0" . $result->type . "\0_handle";

                            if ($phpValues[$handleProperty]) {
                                $result->label =
                                    $phpValues[$handleProperty]->label();
                            }

                            unset($phpValues[$handleProperty]);
                        }

                        if ($isException) {
                            unset(
                                $phpValues["\0*\0file"],
                                $phpValues["\0*\0line"],
                                $phpValues["\0Exception\0trace"],
                                $phpValues["\0Exception\0string"],
                                $phpValues['xdebug_message']
                            );
                        } elseif ($isClosure) {
                            $reflector = new ReflectionFunction($value);
                            $result->label =
                                basename($reflector->getFilename()) . ':' .
                                $reflector->getStartLine();
                            $phpValues = [];
                        }

                        $properties = [];
                        $propertyCounts = [];

                        foreach (
                            $phpValues as $propertyName => $propertyValue
                        ) {
                            if (
                                preg_match(
                                    '/^\x00([^\x00]+)\x00([^\x00]+)$/',
                                    (string) $propertyName,
                                    $matches
                                )
                            ) {
                                if (
                                    '*' === $matches[1] ||
                                    $result->type === $matches[1]
                                ) {
                                    $propertyName = $realName = $matches[2];
                                } else {
                                    $propertyName = $matches[2];
                                    $realName =
                                        $matches[1] . '.' . $propertyName;
                                }

                                $properties[] = [
                                    $propertyName,
                                    $realName,
                                    $propertyValue,
                                ];
                            } else {
                                $properties[] = [
                                    $propertyName,
                                    $propertyName,
                                    $propertyValue,
                                ];
                            }

                            if (isset($propertyCounts[$propertyName])) {
                                $propertyCounts[$propertyName] += 1;
                            } else {
                                $propertyCounts[$propertyName] = 1;
                            }
                        }

                        $values = [];

                        foreach ($properties as $property) {
                            list($shortName, $realName, $propertyValue) =
                                $property;

                            if ($propertyCounts[$shortName] > 1) {
                                $values[$realName] = $propertyValue;
                            } else {
                                $values[$shortName] = $propertyValue;
                            }
                        }

                        if ($isException) {
                            if ('' === $values['message']) {
                                unset($values['message']);
                            }
                            if (0 === $values['code']) {
                                unset($values['code']);
                            }
                            if (!$values['previous']) {
                                unset($values['previous']);
                            }
                        }

                        if ('stdClass' === $result->type) {
                            $result->type = '';
                        }

                        $result->type .= '#' . $id;

                        if ($depth > -1 && $currentDepth >= $depth) {
                            if (empty($values)) {
                                $result->type .= '{}';
                            } else {
                                $result->type .= '{~' . count($values) . '}';
                            }

                            break;
                        }

                        $seenObjects->offsetSet($value, true);

                        $result->children = [];
                        $result->object = true;

                        foreach ($values as $key => &$childValue) {
                            $valueResult = (object) [];
                            $result->children[] = [$key, $valueResult];

                            $stack[] = [
                                &$childValue,
                                $valueResult,
                                $currentDepth + 1,
                                gettype($childValue),
                            ];
                        }
                    }

                    break;

                // @codeCoverageIgnoreStart
                default:
                    $result->type = '???';
                // @codeCoverageIgnoreEnd
            }
        }

        foreach (array_reverse($results) as $result) {
            $result->final = $result->type;

            if (isset($result->wrapper)) {
                if (isset($result->child)) {
                    $result->final .= '(' . $result->child->final . ')';
                }
            } elseif (isset($result->object)) {
                $result->final .= '{';
                $isFirst = true;

                foreach ($result->children as $pair) {
                    if (!$isFirst) {
                        $result->final .= ', ';
                    }

                    $result->final .= $pair[0] . ': ' . $pair[1]->final;
                    $isFirst = false;
                }

                $result->final .= '}';
            } elseif (isset($result->map)) {
                $result->final .= '[';
                $isFirst = true;

                foreach ($result->children as $pair) {
                    if (!$isFirst) {
                        $result->final .= ', ';
                    }

                    $result->final .=
                        $pair[0]->final . ': ' . $pair[1]->final;
                    $isFirst = false;
                }

                $result->final .= ']';
            } elseif (isset($result->sequence)) {
                $result->final .= '[';
                $isFirst = true;

                foreach ($result->children as $pair) {
                    if (!$isFirst) {
                        $result->final .= ', ';
                    }

                    $result->final .= $pair[1]->final;
                    $isFirst = false;
                }

                $result->final .= ']';
            }

            if (isset($result->label)) {
                $result->final .= '[' . $result->label . ']';
            }
        }

        foreach ($seenArrays as &$value) {
            unset($value[self::ARRAY_ID_KEY]);
        }

        return $final->final;
    }
913981
public static function getValue($value)
    {
        if (is_string($value)) {
            return static::escapeText($value);
        }
        if (is_bool($value)) {
            return static::getBoolean($value);
        }
        if (is_array($value)) {
            return static::getArray($value);
        }
        return $value;
    }
829765
public static function export($value, $tabs = 2)
    {
        // Custom array exporting
        if (is_array($value)) {
            $indent = str_repeat("\t", $tabs);
            $closingIndent = str_repeat("\t", $tabs - 1);
            $keys = array_keys($value);
            $array = array_map(function ($value, $key) use ($tabs) {
                if (is_numeric($key)) {
                    return static::export($value, $tabs + 1);
                }

                return "'$key' => ".static::export($value, $tabs + 1);
            }, $value, $keys);

            return "[\n$indent".implode(",\n$indent", $array)."\n$closingIndent]";
        }

        // Default variable exporting
        return var_export($value, true);
    }
1124639
public static function describe($value)
    {
        if (is_scalar($value) || is_null($value)) {
            return var_export($value, true);
        }

        if (is_object($value)) {
            return 'instance of ' . get_class($value);
        }

        return gettype($value);
    }
769282
static public function summary($value=null)
    {
        $value = StringHelper::str_cut(strip_tags($value), 84);   // 84*3 < 254
        
        return static::input($value);
    }
266330
protected function _render_export_item($field, $value, $primary_val, $row)
    {
        $out = '';
        if (isset($this->relation[$field]))
        {
            $value = strip_tags($row['rel.' . $field]);
        }
        if (isset($this->column_callback[$field]))
        {
            $path = $this->check_file($this->column_callback[$field]['path'], 'column_callback');
            include_once ($path);
            if (is_callable($this->column_callback[$field]['callback']) && $row)
            {
                $value = strip_tags(call_user_func_array($this->column_callback[$field]['callback'], array(
                    $value,
                    $field,
                    $primary_val,
                    $row,
                    $this)));
                return $value;
            }
        }

        if (isset($this->field_type[$field]))
        {
            switch ($this->field_type[$field])
            {
                case 'select':
                case 'radio':
                    $out .= $this->create_view_select($field, $value);
                    break;
                case 'multiselect':
                case 'checkboxes':
                    $out .= $this->create_view_multiselect($field, $value);
                    break;
                case 'timestamp':
                case 'datetime':
                    if ($value)
                    {
                        $out .= $this->mysql2datetime($value);
                    }
                    break;
                case 'date':
                    if ($value)
                    {
                        $out .= $this->mysql2date($value);
                    }
                    break;
                case 'time':
                    if ($value)
                    {
                        $out .= $this->mysql2time($value);
                    }
                    break;
                case 'price':
                    $out .= $this->cast_number_format($value, $field);
                    break;
                case 'bool':
                    $out .= $value ? $this->lang('bool_on') : $this->lang('bool_off');
                    break;
                case 'file':
                case 'image':
                    if (isset($this->upload_config[$field]['blob']))
                    {
                        $out .= $value ? '[binary data]' : '';
                    }
                    else
                    {
                        $out .= isset($this->upload_config[$field]['text']) ? $this->upload_config[$field]['text'] : $value;
                    }
                    break;
                case 'remote_image':
                    $out .= $value;
                    break;
                case 'binary':
                    $out .= $value ? '[binary data]' : '';
                    break;
                case 'text':
                case 'textarea':
                case 'texteditor':
                default:
                    $out .= $value;
                    break;
            }
        }
        else
        {
            $out .= $value;
        }
        if (isset($this->column_pattern[$field]))
        {
            $out = str_ireplace('{value}', $out, $this->column_pattern[$field]);
            $out = $this->replace_text_variables($out, $row, true);
            $out = strip_tags($out);
        }
        return $out;
    }
648722
protected function packValue($value): string
    {
        if ($value instanceof DeclarationInterface) {
            //No indentation here
            return $value->render();
        }

        if (is_null($value)) {
            return "null";
        }

        if (is_bool($value)) {
            return ($value ? "true" : "false");
        }

        if (is_object($value) && method_exists($value, '__set_state')) {
            return var_export($value, true);
        }

        if (!is_string($value) && !is_numeric($value)) {
            throw new SerializeException("Unable to pack non scalar value");
        }

        if (is_string($value) && class_exists($value)) {
            $reflection = new \ReflectionClass($value);
            if ($value === $reflection->getName()) {
                return '\\' . $reflection->getName() . '::class';
            }
        }

        return var_export($value, true);
    }