mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
51 lines
986 B
PHP
51 lines
986 B
PHP
<?php
|
|
/*
|
|
*/
|
|
namespace Chill\AMLI\FamilyMembersBundle\Config;
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
*/
|
|
class ConfigRepository
|
|
{
|
|
/**
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $links;
|
|
|
|
public function __construct($links)
|
|
{
|
|
$this->links = $links;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return array where keys are the resource'key and label the ressource label
|
|
*/
|
|
public function getLinksLabels()
|
|
{
|
|
$links = array();
|
|
|
|
foreach ($this->links as $definition) {
|
|
$links[$definition['key']] = $this->normalizeLabel($definition['labels']);
|
|
}
|
|
|
|
return $links;
|
|
}
|
|
|
|
private function normalizeLabel($labels)
|
|
{
|
|
$normalizedLabels = array();
|
|
|
|
foreach ($labels as $labelDefinition) {
|
|
$normalizedLabels[$labelDefinition['lang']] = $labelDefinition['label'];
|
|
}
|
|
|
|
return $normalizedLabels;
|
|
}
|
|
|
|
}
|