Converts 1.0 manifest vehicles to 1.1 format.

@static
@access private
@param array $vehicles A structure representing vehicles from a pre-1.1 manifest format.
@return array Vehicle definition structures converted to 1.1 format.
349770
protected static function _convertManifestVer1_1($vehicles) {
        $manifest = array();
        foreach ($vehicles as $vKey => $vehicle) {
            $entry = $vehicle;
            if (!isset($vehicle['vehicle_class'])) {
                $entry['vehicle_class'] = 'xPDOObjectVehicle';
            }
            if (!isset($vehicle['vehicle_package'])) {
                $entry['vehicle_package'] = 'transport';
            }
            $manifest[] = $entry;
        }
        return $manifest;
    }
891934
public function formatInherited(array $parents)
    {
        $privileges = array_keys($this->getInheritedPrivileges($parents));
        return $this->formatPrivileges($privileges);
    }
804934
protected function flatten($attributes)
    {
        foreach ($attributes as $name => $value) {
            
            if (is_array($value)) {
                $attributes[$name] = implode(' ', array_filter($value));
            }
            
        }
        
        return $attributes;
    }
1083022
protected static function formatContainer($container)
    {
        if (!is_array($container)) {
            $container = [$container];
        }

        $instance = array_shift($container);

        if (!$method = array_shift($container)) {
            if ($instance instanceof \ArrayAccess) {
                $method = 'offsetGet';
            } else {
                $method = 'get';
            }
        }

        return [$instance, $method];
    }
374756
private static function convertFilesArray($files) {
		
		$result = [];

		foreach($files as $field => $data) {
			
			foreach($data as $key => $val) {
				
				$result[$field] = [];
				
				if(false === is_array($val)) {
					$result[$field] = $data;
				} 
				else {
					
					$res = [];
					static :: filesFlip($res, [], $data);
					$result[$field] += $res;
				}
			}
		}

		return $result;
	}
980213
public static function getSimpleAppFormat(array $apps):array
    {
        $narray = array();
        foreach ($apps as $oneapp => $val) {
            $e = AppConfig::getInstance($oneapp);
            if ($e->checkVisibility()) {
                array_push($narray, array("name" => $oneapp, "value" => $val));
            }
        }
        return ($narray);
    }
731245
public function normalizeMounts(array $mounts)
    {
        $normalized = [];
        foreach ($mounts as $path => $definition) {
            $normalized[$this->normalizeRelativePath($path)] = $this->normalizeDefinition($definition);
        }

        return $normalized;
    }
1018478
protected function prepare($models)
    {
        return !is_null($models) ?
        ((Collection::count($models) > 0)
            ? ((Collection::count($models) == 1)
                ? $models[0]
                : $models
            )
            : null
        )
        : null;
    }
574694
public function toArray($keys=array()) {
        $vars = get_object_vars($this);

        $results = array();
        if (count($keys) == 0) {
            foreach($vars as $name=>$value) {
                if (is_string($value) || is_numeric($value) || is_bool($value)) {
                    $results[$name] = $value;
                }
            }

            return $results;
        }

        foreach($keys as $key) {
            if (!isset($vars[$key])) continue;
            $results[$key] = $vars[$key];
        }
        return $results;
    }
911950
private function getTransformerTag(array $tags)
    {
        $transFormerTags = array_values(
            array_filter($tags, function ($tag) {
                return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']);
            })
        );

        return array_first($transFormerTags);
    }
10493
protected function format(array $services): array
    {
        return Collection::make($services)->map(function (array $service) {
            return [
                'id'   => $service['ID'],
                'name' => $service['Service'],
                'host' => $service['Address'],
                'port' => $service['Port'],
            ];
        })->groupBy('name')->toArray();
    }
690585
protected function convertUploadedFiles(array $files)
    {
        $fileObjects = [];
        
        foreach ($files as $fieldName => $file) {
            if ($file instanceof UploadedFileInterface) {
                $fileObjects[$fieldName] = $file;
            } elseif (!isset($file['tmp_name']) && !isset($file['error'])) {
                $fileObjects[$fieldName] = $this->convertUploadedFiles($file);
            } else {
                $fileObjects[$fieldName] = new UploadedFile($file);
            }
        }
        
        return $fileObjects;
    }
774596
public function controllersWithoutPrefix(array $controllers)
    {
        $group = new Group;
        foreach ($controllers as $controller)
            $group->set($this->controllerWithoutPrefix($controller));
        return $group;
    }
1059730
public static function serializeTags(array $tags)
    {
        if (empty($tags))
            return '';

        self::validateTags($tags);
        $tagstrs = array();
        foreach ($tags as $tag)
            $tagstrs[] = $tag->toString(true);

        return implode(';', $tagstrs);
    }
491708
public static function init(array $attributes) {
        $obj = new Attributes;
        foreach ($attributes as $attribute) {
            $obj->{$attribute->key} = $attribute;
        }
        return $obj;
    }
124296
public static function convert(array $array)
    {
        if (function_exists('yaml_emit')) {
            $yaml = yaml_emit($array);

            // PHP-Yaml adds strange separators to the outputted YAML, we do
            // some manipulation of the outputted string to remove these.
            $yaml = explode("\n", $yaml);
            array_shift($yaml);
            array_pop($yaml);
            array_pop($yaml);

            return implode("\n", $yaml);
        }

        return spyc_dump($array);
    }
1117615
private function arrayMergeRecursive(array ...$arrays)
    {
        $base = array_shift($arrays);
        if ( ! is_array($base)) {
            $base = empty($base) ? [] : [$base];
        }

        foreach ($arrays as $append) {
            if ( ! is_array($append)) {
                $append = [$append];
            }
            foreach ($append as $key => $value) {
                if ( ! array_key_exists($key, $base) && ! is_numeric($key)) {
                    $base[$key] = $append[$key];
                    continue;
                }

                if ((is_array($value) || (isset($base[$key]) && is_array($base[$key]))) && $this->isAssoc($value)) {
                    $base[$key] = $this->arrayMergeRecursive(
                        (array) $base[$key],
                        (array) $append[$key]
                    );
                } else {
                    if (is_numeric($key)) {
                        if ( ! in_array($value, $base)) {
                            $base[] = $value;
                        }
                    } else {
                        $base[$key] = $value;
                    }
                }
            }
        }

        return $base;
    }