@param array $datas

@return array
321200
private function parseRoutesFiles(array $datas) : array
    {
        $return = [];

        foreach ($datas as $key => $data) {
            if (isset($data['routes'])) {
                $route = new Group();
            } else {
                $route = new Route();
            }

            if (!empty($key)) {
                $route->setName($key);
            }

            if (isset($data['match'])) {
                $route->setMatch($data['match']);
            }

            if (isset($data['controller'])) {
                $route->setController($data['controller']);
            }

            if (isset($data['userInputs'])) {
                $userInputs = [];
                foreach ($data['userInputs'] as $name => $value) {
                    $userInputs[] = new UserInput($name, $value['type'], $value['mandatory'] ?? false);
                }
                $route->setUserInputs($userInputs);
            }

            if (isset($data['args'])) {
                $route->setArgs($data['args']);
            }

            if (isset($data['conditions'])) {
                $route->setConditions($data['conditions']);
            }

            if (isset($data['responseCode'])) {
                $route->setResponseCode($data['responseCode']);
            }

            if (isset($data['options'])) {
                $route->setOptions($data['options']);
            }

            if (isset($data['httpMethod'])) {
                $route->setHttpMethod($data['httpMethod']);
            }

            if (isset($data['routes'])) {
                $route->setRoutes($this->parseRoutesFiles($data['routes']));
            }

            $return[$key] = $route;
        }

        return $return;
    }
1342446
protected function prepareDatasourceFiles(array $datasourceFiles)
    {

        // initialize the array for the prepared datasources
        $ds = array();

        // prepare the datasources
        foreach ($datasourceFiles as $datasourceFile) {
            // explode the directoriy names from the app base path
            $contextPath = explode(DIRECTORY_SEPARATOR, ltrim(str_replace(sprintf('%s', $this->getAppBase()), '', $datasourceFile), DIRECTORY_SEPARATOR));
            // the first element IS the context name
            $contextName = reset($contextPath);
            // create the path to the web application
            $webappPath = $this->getDatasourceService()->getWebappsDir($this->getContainer()->getContainerNode(), $contextName);
            // append it to the array with the prepared datasources
            $ds[] = array($datasourceFile, $webappPath, $contextName);
        }

        // return the array with the prepared datasources
        return $ds;
    }
951046
final protected function serializeBasicDataset($dataset): array
    {
        $key = $this->resolveSerializerKey($dataset);

        if ($dataset instanceof Paginator) {
            $collection = $dataset->toArray();

            $collection[$key] = $collection['data'];
            unset($collection['data']);

            return $collection;
        }

        return [
            $key => $dataset->toArray(),
        ];
    }
1031110
protected function extractTypeValues(array $data, array $types)
    {
        $typeValues = array();

        foreach ($data as $k => $_) {
            $typeValues[] = isset($types[$k])
                ? $types[$k]
                : \PDO::PARAM_STR;
        }

        return $typeValues;
    }
67135
public function asArray(array $filters = [], $default = null) : array
    {
        $array = Validate::asArray($this->params[$this->key] ?? $this->params, []);

        foreach ($filters as $key => $dataType) {
            $dataType = 'as' . ucfirst($dataType);
            $array[$key] = Validate::$dataType($array[$key] ?? null, $default);
        }

        return $array;
    }
451356
public function parseHeaders(array $headers)
    {
        $parsed = [];

        foreach ($headers as $key => $val)
        {
            $parsed[] = $key . ': ' . $val;
        }

        return $parsed;
    }
709468
protected function toArray( array $items )
	{
		$data = [];

		foreach( $items as $item )
		{
			foreach( $item->toArray( true ) as $key => $value ) {
				$data[$key][] = $value;
			}
		}

		return $data;
	}
1337987
protected function parseResponseHeadersAsArray($headers)
    {
        if (empty($headers)) return [];

        $headersArray = [];

        foreach (preg_split('#[\r\n]+#', $headers) as $headerString) {

            if ( ! preg_match('#^\s*(?<name>.*?)\s*:\s*(?<value>.*)\s*$#', $headerString, $matches)) continue;

            $headersArray[ $matches['name'] ] = $matches['value'];
        }

        return $headersArray;
    }
806690
public function getMetadataArray(array $headers)
    {
        $metadata = [];
        foreach ($headers as $key => $value) {
            $isMetadataHeader = Utilities::startsWith(
                strtolower($key),
                Resources::X_MS_META_HEADER_PREFIX
            );

            if ($isMetadataHeader) {
                $MetadataName = str_replace(
                    Resources::X_MS_META_HEADER_PREFIX,
                    Resources::EMPTY_STRING,
                    strtolower($key)
                );

                $metadata[$MetadataName] = $value;
            }
        }

        return $metadata;
    }
104852
protected function propertiesToArray(array $data, array $aliases = []): array
    {
        $this->checkRequiredAttributes();

        foreach ($this->attributes as $property => $value) {
            if (is_null($value) && !$this->isRequired($property)) {
                continue;
            }
            $alias = array_search($property, $aliases, true);

            $data[$alias ?: $property] = $this->get($property);
        }

        return $data;
    }
982240
protected function asArray($data = []): array
    {
        if ($data instanceof Collection) {
            $data = $data->all();
        } elseif ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        return $data;
    }
1343928
public function propertiesToArray(array $data, array $aliases = []): array
    {
        return ['articles' => array_map(function ($item) {
            if ($item instanceof NewsItem) {
                return $item->toJsonArray();
            }
        }, $this->get('items'))];
    }
1321022
protected function applyExcludes(array $dataTypes): array
    {
        $exclusions = explode(',', $this->exclude);
        // Find any invalid data to exclude.
        $invalidExcludes = array_diff($exclusions, $dataTypes);
        if (count($invalidExcludes) > 0) {
            $errorMessage = 'WARNING: Invalid exlude(s)';
            $errorMessage .= ': '.implode(', ', $invalidExcludes).'.'.PHP_EOL;
            $errorMessage .= ' Valid exclusions are '.implode(', ', $dataTypes);

            // Output an error message outlining what invalid exclusions were specified.
            Schematic::warning($errorMessage);
        }
        // Remove any explicitly excluded data types from the list of data types to export.
        return array_diff($dataTypes, $exclusions);
    }
1162160
public static function toRealArr(array $data, array $maps) {
	    foreach ($data as $key => $item) {
	        if (!isset($maps[$key])) {
	            continue;
            }
            if (in_array($maps[$key], ['int', 'integer'])) {
	            $data[$key] = intval($data[$key]);
	            continue;
            }
            if ($maps[$key] == 'float') {
                $data[$key] = floatval($data[$key]);
                continue;
            }
            if ($maps[$key] == 'double') {
                $data[$key] = doubleval($data[$key]);
                continue;
            }
            if (in_array($maps[$key], ['bool', 'boolean'])) {
                $data[$key] = $data[$key] > 0;
                continue;
            }
        }
        return $data;
    }
425570
public function findByIds(array $ids): array
    {
        $result = [];
        if (count($ids) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select('i')
                         ->from(Item::class, 'i')
                         ->andWhere('i.id IN (:ids)')
                         ->setParameter('ids', array_values($ids));

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
504551
public static function applySerializers(array $serializers, $data) {
		return array_reduce($serializers, function ($serializedData, $serializer) {
			return $serializer->apply($serializedData);
		}, $data);
	}
377865
public static function getArrayData($data, $returns = array())
    {
        if (is_array($data)) {
            return $data;
        }
        else if (static::isJSON($data)) {
            return static::decode($data, true);
        }

        return $returns;
    }