Пример #1
0
 public function load($resource, $format, $locale)
 {
     $this->locale = $locale;
     $content = $this->getLoader($format)->load($resource);
     if (null === $this->data) {
         $this->data = array();
     }
     if (null === $this->messages) {
         $this->messages = array();
     }
     foreach ($content as $dataKey => $dataInfos) {
         $trans = array_key_exists('trans', $dataInfos) ? $dataInfos['trans'] : null;
         $type = array_key_exists('type', $dataInfos) ? $dataInfos['type'] : null;
         $sources = array_key_exists('sources', $dataInfos) ? $dataInfos['sources'] : null;
         $data = new Data($dataKey);
         $data->setMessage($trans);
         $data->setType($type);
         $data->setSources($sources);
         $this->data[$data->getKey()] = $data;
         $this->addMessage($dataKey, $data->getMessage());
     }
 }