src/Viserio/Component/Profiler/DataCollector/AbstractDataCollector.php
private function decorateVar($var)
    {
        if (\is_array($var)) {
            if (isset($var[0], $var[1]) && \is_callable($var)) {
                return ClassStub::wrapCallable($var);
            }

            foreach ($var as $k => $v) {
                if ($v !== $d = $this->decorateVar($v)) {
                    $var[$k] = $d;
                }
            }

            return $var;
        }

        if (\is_string($var)) {
            if (isset(self::$stubsCache[$var])) {
                return self::$stubsCache[$var];
            }

            if (\mb_strpos($var, '\\') !== false) {
                $i = \mb_strpos($var, '::');
                $c = ($i !== false) ? \mb_substr($var, 0, $i) : $var;

                if (\class_exists($c, false) || \interface_exists($c, false) || \trait_exists($c, false)) {
                    return self::$stubsCache[$var] = new ClassStub($var);
                }
            }

            if (\mb_strpos($var, \DIRECTORY_SEPARATOR) !== false &&
                \mb_strpos($var, '://') !== false &&
                \mb_strpos($var, "\0") && @\is_file($var) === false
            ) {
                return self::$stubsCache[$var] = new LinkStub($var);
            }
        }

        return $var;
    }
private function decorateVar($var)
    {
        if (\is_array($var)) {
            if (isset($var[0], $var[1]) && \is_callable($var)) {
                return ClassStub::wrapCallable($var);
            }

            foreach ($var as $k => $v) {
                if ($v !== $d = $this->decorateVar($v)) {
                    $var[$k] = $d;
                }
            }

            return $var;
        }

        if (\is_string($var)) {
            if (isset(self::$stubsCache[$var])) {
                return self::$stubsCache[$var];
            }

            if (\mb_strpos($var, '\\') !== false) {
                $i = \mb_strpos($var, '::');
                $c = ($i !== false) ? \mb_substr($var, 0, $i) : $var;

                if (\class_exists($c, false) || \interface_exists($c, false) || \trait_exists($c, false)) {
                    return self::$stubsCache[$var] = new ClassStub($var);
                }
            }

            if (\mb_strpos($var, \DIRECTORY_SEPARATOR) !== false &&
                \mb_strpos($var, '://') !== false &&
                \mb_strpos($var, "\0") && @\is_file($var) === false
            ) {
                return self::$stubsCache[$var] = new LinkStub($var);
            }
        }

        return $var;
    }
@param mixed $var

@return mixed