mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 06:14:59 +00:00
initial commit
This commit is contained in:
50
Config/ConfigRepository.php
Normal file
50
Config/ConfigRepository.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user