@param array $value

@return array
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;
    }
912287
public function reverseTransform($value)
    {
        $result = array();
        if (is_array($value)) {
            array_walk_recursive($value, function($item, $key) use (&$result) {
                if ($item) {
                    $result[] = $key;
                }
            });
        }

        return $result;
    }
376820
public static final function cast($value): array {
		if (is_array($value)){
			return $value;
		}

		if (is_object($value) && method_exists($value, 'toArray')){
			return $value->toArray();
		}

		if ($value instanceof \Generator){
			return iterator_to_array($value);
		}

		return [$value];
	}
687571
private function calculateRequiredSizes(array $value): array
    {
        $sizes = [];
        while (is_array($value)) {
            $sizes[] = count($value);
            if (!count($value) || array_keys($value) !== range(0, count($value) - 1)) {
                if (0 === $this->itemConverter->dimensions()) {
                    // scalar base type? "weird" sub-array is not allowed
                    throw TypeConversionException::unexpectedValue(
                        $this,
                        'output',
                        'non-empty array with 0-based numeric indexes',
                        $value
                    );
                }
                // assume that we reached an array representing base type
                array_pop($sizes);
                return $sizes;
            }
            if (null === ($value = $value[0])) {
                // null sub-arrays are not allowed, so that should be a base-type null
                return $sizes;
            }
        }
        if ($this->itemConverter->dimensions() > 0) {
            // check whether we have an object representing base type
            if (is_object($value)) {
                try {
                    $this->itemConverter->output($value);
                    return $sizes;
                } catch (PackageException $e) {
                }
            }
            array_splice($sizes, -$this->itemConverter->dimensions());
        }
        return $sizes;
    }
38570
protected function convert(array $value)
    {
        $return = array();
        foreach ($value as $name => $elements) {
            if (is_array($elements)) {
                // We have a checkbox hit for a subform/fieldset,
                if (isset($elements['__all__'])) {
                    if ('0' == $elements['__all__']) {
                        // The whole subform/fieldset shall be disabled, so add it and continue.
                        $return[] = $name;
                        continue;
                    } else {
                        // We do not need the toggle all checkbox value anymore.
                        unset($elements['__all__']);
                    }
                }
                // recurse with the subform/fieldset element toggle checkboxes.
                $result = $this->convert($elements);

                if (count($result)) {
                    // Some elements on the subform shall be disabled, so add the result array.
                    $return[$name] = $result;
                }
                continue;
            }

            if ('0' == $elements) {
                // We have a disabled element, add it to the array.
                $return[] = $name;
            }
        }
        return $return;
    }
217533
public static function toArray($value)
    {
        # If it's already an array then just pass it back
        if (is_array($value)) {
            return $value;
        }

        if ($value instanceof SerialObject) {
            return $value->asArray();
        }

        if ($value instanceof \ArrayObject) {
            return $value->getArrayCopy();
        }

        # If it's not an array then create a new array to be returned
        $array = [];

        # If a value was passed as a string/int then include it in the new array
        if ($value) {
            $array[] = $value;
        }

        return $array;
    }
1244366
protected function _emptyValue($value)
    {
        if ($value === true) {
            return ['' => ''];
        }
        if (is_scalar($value)) {
            return ['' => $value];
        }
        if (is_array($value)) {
            return $value;
        }

        return [];
    }
1108472
public function searchByValue($value):array{

		$matches = [];

		foreach($this->iterator as $v){

			if($v === $value){
				$matches[$this->getPath()] = $value;
			}

		}

		return $matches;
	}
858732
public function format($value): array
    {
        $coupons = [];

        foreach ($value as $coupon) {
            $coupons[] = $coupon->identifier();
        }

        return $coupons;
    }
334152
protected function serializeArray(array $value)
    {
        if (\array_key_exists(self::MAP_TYPE, $value)) {
            return $value;
        }

        $toArray = [self::MAP_TYPE => 'array', self::SCALAR_VALUE => []];
        foreach ($value as $key => $field) {
            $toArray[self::SCALAR_VALUE][$key] = $this->serializeData($field);
        }

        return $this->serializeData($toArray);
    }
1157854
public static function intToArray($value)
    {
        if ($value <= 0){
            return [];
        }else{
            $arr=[];
            $nLeave = $value;
            $nT = 0x01;
            while ($nLeave > 0){
                if (($nLeave & 1) == 1){
                    $arr[]=$nT;
                }
                $nLeave = ($nLeave >> 1);
                if ($nLeave > 0){
                    $nT = ($nT << 1);
                }
            }
            return $arr;
        }
    }
1043884
protected function serialization(array &$value)
    {
        $data = [
            self::DATA_KEY => \array_merge(
                PropertyHelper::setResponseDataTypeAndId($this->mappings, $value),
                DataAttributesHelper::setResponseDataAttributes($this->mappings, $value),
                DataLinksHelper::setResponseDataLinks($this->mappings, $value),
                DataLinksHelper::setResponseDataRelationship($this->mappings, $value, $value)
            ),
        ];

        DataIncludedHelper::setResponseDataIncluded($this->mappings, $value, $data);

        $this->setResponseLinks($value, $data);
        $this->setResponseMeta($data);
        $this->setResponseVersion($data);

        return $data;
    }
336314
protected function serializeObject(array $value)
    {
        $value = $this->transformUnmappedObjectsToArray($value);
        $value = $this->preSerialization($value);
        $data = $this->serialization($value);

        return $this->postSerialization($data);
    }
1163366
protected function getPossibleTypes($value): array
    {
        $type = $this->getTypeOf($value);

        switch ($type) {
            case 'boolean':
            case 'integer':
            case 'float':
            case 'string':
                return $this->getPossibleScalarTypes($value);
            case 'array':
                return $this->getPossibleArrayTypes($value);
            case 'assoc':
                return $this->getPossibleAssocTypes($value);
            case 'object':
                return $this->getPossibleObjectTypes($value);
            case 'resource':
            default:
                return array_intersect($this->types, [$type]);
        }
    }
503605
protected static function export(array $value)
	{
		$pairs = [];
		foreach ($value as $k => $v)
		{
			$pairs[] = var_export($k, true) . '=>' . var_export($v, true);
		}

		return '[' . implode(',', $pairs) . ']';
	}
582302
public static function parseHeaderValue(string $value): array
    {
        $parts = \explode(';', $value);
        $type = \trim($parts[0]);
        unset($parts[0]);

        $parameters = [];
        foreach ($parts as $part) {
            [$k, $v] = \explode('=', $part, 2);

            $key = \strtolower(\trim($k));
            $parameters[$key] = \trim($v, ' "');
        }

        return [$type, $parameters];
    }
823074
public function unserialize($value)
    {
        $array = (array) \simplexml_load_string($value);
        self::castToArray($array);
        self::recoverArrayNumericKeyValues($array);
        $replacements = \array_flip($this->replacements);
        $array = self::replaceKeys($replacements, $array);

        return $array;
    }