Applies h() recursively

@param string|array $value
@return array|string
767766
public static function specialcharsDeep($value) {
		$value = is_array($value) ? array_map('self::specialcharsDeep', $value) : htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
		return $value;
	}
383671
protected function _compileRawEchos($value)
    {
        $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->_rawTags[0], $this->_rawTags[1]);

        $callback = function ($matches) {
            $whitespace = empty($matches[3]) ? '' : $matches[3];

            return $matches[1] ? substr($matches[0], 1) : '<?= ' . $this->_compileEchoDefaults($matches[2]) . '; ?>' . $whitespace;
        };

        return preg_replace_callback($pattern, $callback, $value);
    }
697852
protected function generateArrayValue(array $value)
    {
        $value = $this->prepareArrayValue($value);
        $outputMode = count($value) > 1 ? $this->outputMode : self::OUTPUT_SINGLE_LINE;

        $code = 'array(';
        if ($outputMode === self::OUTPUT_MULTI_LINE) {
            $code .= $this->getLineFeed() . $this->getIndentation() . $this->getIndentationString() . $this->getIndentationString();
        }

        $outputParts = array();
        $noKeyIndex = 0;
        foreach ($value as $n => $v) {
            $v->setIndentationLevel($this->getIndentationLevel() + 1);
            $v->setOutputMode($this->outputMode);
            $partV = $v->generate();
            if ($n === $noKeyIndex) {
                $outputParts[] = $partV;
                $noKeyIndex++;
            } else {
                $outputParts[] = (is_int($n) === true ? $n : $this->escapeStringValue($n)) . ' => ' . $partV;
            }
        }

        if ($outputMode === self::OUTPUT_MULTI_LINE) {
            $padding = $this->getLineFeed() . $this->getIndentation() . $this->getIndentationString() . $this->getIndentationString();
        } else {
            $padding = ' ';
        }

        $code .= implode(',' . $padding, $outputParts);
        if ($outputMode === self::OUTPUT_MULTI_LINE) {
            $code .= $this->getLineFeed() . $this->getIndentation() . $this->getIndentationString();
        }
        $code .= ')';

        return $code;
    }
208072
protected function fixValue(array $value)/*# : array */
    {
        $result = [];
        foreach ($value as $k => $v) {
            if (false !== strpos($k, $this->field_splitter)) {
                $res = &$this->searchTree($k, $result, true);
                $res = is_array($v) ? $this->fixValue($v) : $v;
            } else {
                $result[$k] = is_array($v) ? $this->fixValue($v) : $v;
            }
        }
        return $result;
    }
859502
protected function cleanUpValue( $value ) {
		$cleanValue = [];
		if ( !is_array( $value ) ) {
			return $cleanValue;
		}
		foreach ( $value as $singleValue ) {
			$singleValue = parent::cleanUpValue( $singleValue );
			// Remove options that we don't have here
			if ( !isset( $this->fields[ $singleValue ] ) ) {
				continue;
			}
			$cleanValue[] = $singleValue;
		}
		return $cleanValue;
	}
937809
public function reverseTransform($value)
    {
        if ($value === null) {
            $value = [];
        }

        $arrayCollection = new ArrayCollection();

        foreach ($value as $v) {
            $arrayCollection->add($v);
        }

        return $arrayCollection;
    }
1016607
public static function clean_vars($value){
        if(is_array($value)){
            foreach($value as $key => $val) {
                $value[$key] = self::clean_vars($val);
            }
        }
        else{
            $value= self::filter_simple_xss($value);
        }
        return $value;
    }
668206
public function serialize($value)
    {
        $this->recursiveSetValues($value);
        $this->recursiveUnset($value, [Serializer::CLASS_IDENTIFIER_KEY]);
        $this->recursiveFlattenOneElementObjectsToScalarType($value);

        return $value;
    }
1174514
private function escapeArray($value) {
        if (!is_array($value)) {
            return $this->escape($value);
        }
        foreach ($value as $key => $prop) {
            $value[$key] = $this->escape($prop);
        }
        return $value;
    }
370804
protected function formatValue($value)
    {
        if (is_array($value)) {
            return Formatter::formatArray($value);
        }

        return Formatter::formatScalar($value);
    }
487596
protected function preSerialization(array $value)
    {
        /** @var \NilPortugues\Api\Mapping\Mapping $mapping */
        foreach ($this->mappings as $class => $mapping) {
            RecursiveDeleteHelper::deleteProperties($this->mappings, $value, $class);
            RecursiveRenamerHelper::renameKeyValue($this->mappings, $value, $class);
        }

        return $value;
    }
1280751
private static function convertToArrayAccess($value)
    {
        if ($value instanceof \ArrayAccess) {
            $array = $value;
        } elseif ($value instanceof \Traversable) {
            $array = SequenceType::convertToRewindable($value);
            if ($array instanceof \Traversable) {
                set_error_handler(function ($severity, $message) {
                    return $severity === E_WARNING
                        ? $message === 'Illegal offset type'
                        : preg_match('/^Resource ID#([0-9]+) used as offset, casting to integer \\(\\1\\)$/', $message);
                }, E_WARNING | (PHP_MAJOR_VERSION === 5 ? E_STRICT : E_NOTICE));
                $array = iterator_to_array($array);
                restore_error_handler();
            }
        } else {
            $array = (array)$value;
        }
        
        return $array;
    }
1360224
public function apply($value)
    {
        return htmlspecialchars((string) $value, $this->quoteStyle, $this->charset, $this->doubleEncode);
    }
87917
private static function stringify($value)
    {
        if (is_string($value)) {
            return sprintf('"%s"', preg_replace('/\n/', '\n', $value));
        }

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

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

        if (is_array($value)) {
            return sprintf('[%s]', implode(', ', array_map(
                function ($value) {
                    return self::stringify($value);
                },
                $value
            )));
        }

        return (string) $value;
    }
87824
private function getIterator($value)
    {
        if ($value instanceof \Iterator) {

            return $value;
        }

        if (is_array($value)) {

            return new \ArrayIterator($value);
        }

        return new \ArrayIterator([$value]);
    }
1045058
public function apply($value)
    {
        if (is_int($value) || is_float($value)) {
            return $this->compare($value);
        } elseif (is_array($value)) {
            return $this->compare(count($value));
        } else {
            $value = (string) $value;

            return $this->compare(strlen($value));
        }
    }
598220
public function setValue($value)
	{
		$this->value = $value;

		if ( ! is_array($value) )
		{
			$value = [$value];
		}

		$this->recursiveAssignValue($value, $this->getContents());

		return $this;
	}