It transfres a gining array to a collection of field

@param array $collection
@param string $localeGroup
@param array $languages
@param bool $isReadOnly

@return array
558198
public static function fromArray(array $collection, $localeGroup, array $languages = [], $isReadOnly = false)
    {
        $transformer = new self($collection, $localeGroup, $languages, $isReadOnly);

        return $transformer->transfer()->getFields();
    }
793455
public function load($locale, $group, $namespace = null)
    {
        $results = [];
        foreach ($this->loaders as $loader) {
            $results = array_merge($results, $loader->load($locale, $group, $namespace));
        }

        return $results;
    }
729618
public function loadSource($locale, $group, $namespace = '*')
    {
        $dotArray = $this->translationRepository->loadSource($locale, $namespace, $group);
        $undot    = [];
        foreach ($dotArray as $item => $text) {
            array_set($undot, $item, $text);
        }
        return $undot;
    }
601033
public static function groupBy($collection = null, $iterator = null)
    {
        $result = array();
        $collection = (array) $collection;
        foreach ($collection as $k => $item) {
            if (is_object($iterator) && is_callable($iterator)) {
                $key = $iterator($item, $k);
            } elseif (is_object($item)) {
                $key = $item->$iterator;
            } elseif (is_array($item)) {
                $key = $item[$iterator];
            }
            
            if (!array_key_exists($key, $result)) {
                $result[$key] = array();
            }
            $result[$key][$k] = $item;
        }
        return $result;
    }
1069841
private static function toArray(Translations $translations, $includeHeaders, $forceArray = false)
    {
        $pluralForm = $translations->getPluralForms();
        $pluralSize = is_array($pluralForm) ? ($pluralForm[0] - 1) : null;
        $messages = [];

        if ($includeHeaders) {
            $messages[''] = [
                '' => [self::generateHeaders($translations)],
            ];
        }

        foreach ($translations as $translation) {
            if ($translation->isDisabled()) {
                continue;
            }

            $context = $translation->getContext();
            $original = $translation->getOriginal();

            if (!isset($messages[$context])) {
                $messages[$context] = [];
            }

            if ($translation->hasPluralTranslations(true)) {
                $messages[$context][$original] = $translation->getPluralTranslations($pluralSize);
                array_unshift($messages[$context][$original], $translation->getTranslation());
            } elseif ($forceArray) {
                $messages[$context][$original] = [$translation->getTranslation()];
            } else {
                $messages[$context][$original] = $translation->getTranslation();
            }
        }

        return [
            'domain' => $translations->getDomain(),
            'plural-forms' => $translations->getHeader('Plural-Forms'),
            'messages' => $messages,
        ];
    }
565796
@Override
  public <T> boolean isCollectionReadonly(String collectionName) {
    CollectionMetaData cmd = cmdMap.get(collectionName);
    return cmd.isReadOnly();
  }
88
public static function collectionOf(IType $elementType, string $collectionClass = ITypedCollection::class) : CollectionType
    {
        $elementTypeString = $elementType->asTypeString();

        if (!isset(self::$collections[$collectionClass][$elementTypeString])) {
            self::$collections[$collectionClass][$elementTypeString] = new CollectionType($elementType, $collectionClass);
        }

        return self::$collections[$collectionClass][$elementTypeString];
    }
1267398
public function load($namespace, $group, $locale)
    {
        if ($this->isLoaded($namespace, $group, $locale)) {
            return;
        }

        // The loader is responsible for returning the array of language lines for the
        // given namespace, group, and locale. We'll set the lines in this array of
        // lines that have already been loaded so that we can easily access them.
        $lines = $this->loader->load($locale, $group, $namespace);

        $this->loaded[$namespace][$group][$locale] = $lines;
    }
1083909
public function insertFileLocalizations(array $collection) {
		$timeStamp = microtime(true);
		$countInserts = 0;
		$insertedItems = [];
		foreach($collection as $data){
			if($data instanceof BundleEntity\FileLocalization){
				$entity = $data;
				$this->em->persist($entity);
				$insertedItems[] = $entity;
				$countInserts++;
			}
			else{
				$file = $data['entity'];
				foreach($data['localizations'] as $locale => $translation){
					$entity = new BundleEntity\FileLocalization();
					$lModel = $this->kernel->getContainer()->get('multilanguagesupport.model');
					$response = $lModel->getLanguage($locale);
					if($response->error->exist){
						return $response;
					}
					$entity->setLanguage($response->result->set);
					unset($response);
					$entity->setFile($file);
					foreach($translation as $column => $value){
						$set = 'set'.$this->translateColumnName($column);
						switch($column){
							default:
								if(is_object($value) || is_array($value)){
									$value = json_encode($value);
								}
								$entity->$set($value);
								break;
						}
					}
					$this->em->persist($entity);
					$insertedItems[] = $entity;
					$countInserts++;
				}
			}
		}
		if($countInserts > 0){
			$this->em->flush();
			return new ModelResponse($insertedItems, $countInserts, 0, null, false, 'S:D:003', 'Selected entries have been successfully inserted into database.', $timeStamp, microtime(true));
		}
		return new ModelResponse(null, 0, 0, null, true, 'E:D:003', 'One or more entities cannot be inserted into database.', $timeStamp, microtime(true));
	}
636032
public function resolveGenericTypes() : array
    {
        if (!$this->isCollection()) {
            throw InvalidArgumentException::create("Can't resolve collection type on non collection");
        }

        preg_match(self::COLLECTION_TYPE_REGEX, $this->type, $match);

        return [TypeDescriptor::create(trim($match[1]))];
    }
1169688
public function toArray($withTranslations = true)
    {
        $attributes = parent::toArray();

        if ($withTranslations && $this->hasTranslatedAttributes()) {
            foreach ($this->getTranslatedAttributes() as $field) {
                if ($translations = $this->getTranslation()) {
                    $attributes[$field] = $translations->$field;
                }
            }
        }

        return $attributes;
    }
448898
public function processRecords(Entity $entity, array $with, $records, $readOnly)
    {
        $pkField = $entity->getPrimaryKey();

        $objects          = [];
        $currentKey       = null;
        $object           = null;
        $recordsToProcess = [];

        $relations = array_map(
            [$entity, 'getRelation'],
            array_intersect($with, $entity->getRelationNames())
        );

        foreach ($records as $record) {
            //Extract columns that are relevant for the current metadata
            $key = $record[ $pkField ];
            if ($currentKey !== $key) {
                if ($object !== null) {
                    //Process and save the previous object
                    $this->processRelated(
                        $entity,
                        $object,
                        $readOnly,
                        $recordsToProcess,
                        $relations,
                        $with
                    );
                    $recordsToProcess       = [];
                    $objects[ $currentKey ] = $object;
                }
                $currentKey = $key;
                $object     = $this->createObject(
                    $entity,
                    $record,
                    $relations,
                    $readOnly
                );
            }
            //Store the record to be processed for the related entities
            $recordsToProcess[] = $record;
        }
        if ($object !== null) {
            //Process and save the last object
            $this->processRelated(
                $entity,
                $object,
                $readOnly,
                $recordsToProcess,
                $relations,
                $with
            );
            $objects[ $key ] = $object;
        }

        return $objects;
    }
1065076
public function parseManual(\Gettext\Translations $translations, $concrete5version)
    {
        if (class_exists('\GroupSet', true)) {
            foreach (\GroupSet::getList() as $gs) {
                $this->addTranslation($translations, $gs->getGroupSetName(), 'GroupSetName');
            }
        }
    }
132514
public static function findManyByNameOrCreate(array $tags, string $group = null, string $locale = null): Collection
    {
        // Expects array of tag names
        return collect($tags)->map(function ($tag) use ($group, $locale) {
            return static::findByNameOrCreate($tag, $group, $locale);
        });
    }
1079242
public function createLanguageSourceDataProvider($languageSources)
    {
        $data = [];
        foreach ($languageSources as $category => $messages) {
            foreach ($messages as $message => $boolean) {
                $data[] = [
                    'category' => $category,
                    'message' => $message,
                ];
            }
        }

        return new ArrayDataProvider([
            'allModels' => $data,
            'pagination' => false,
        ]);
    }
898126
private function getOrCreateCollection($key, $localizedTitles, $userId, $parent)
    {
        $locales = array_keys($localizedTitles);
        $firstLocale = array_shift($locales);

        $collection = $this->collectionManager->getByKey($key, $firstLocale);
        if (null === $collection) {
            $collection = $this->createCollection($localizedTitles[$firstLocale], $key, $firstLocale, $userId, $parent);
        } else {
            $collection->setTitle($localizedTitles[$firstLocale]);
        }

        foreach ($locales as $locale) {
            $this->createCollection($localizedTitles[$locale], $key, $locale, $userId, $parent, $collection->getId());
        }

        return $collection;
    }
79367
static function localeList( $asObject = false, $withVariations = true )
    {
        $locales =& $GLOBALS['eZLocaleLocaleStringList'];
        if ( !is_array( $locales ) )
        {
            $localeRegexp = eZLocale::localeRegexp( $withVariations, false );
            $locales = array();
            $dir = opendir( 'share/locale' );
            while( ( $file = readdir( $dir ) ) !== false )
            {
                if ( preg_match( "/^($localeRegexp)\.ini$/", $file, $regs ) )
                {
                    $locales[] = $regs[1];
                }
            }
            closedir( $dir );
            $locales = array_unique( $locales );
            sort( $locales );
            if ( $asObject )
            {
                $localeObjects = array();
                foreach ( $locales as $locale )
                {
                    $localeInstance = eZLocale::instance( $locale );
                    if ( $localeInstance )
                        $localeObjects[] = $localeInstance;
                }
                $locales = $localeObjects;
            }
        }
        return $locales;
    }