示例#1
0
 /**
  * Search the database or local cache for the supplied label key, optionally
  * replacing the result with the markers array.
  *
  * @param  string $key     Label key
  * @param  array  $markers Optional array of markes to replace in the translation.
  *                         Key/value pairs
  * @return string          Found label, or the key if key could not be found
  */
 public function get($key, $markers = [])
 {
     if ($this->labelCache === null) {
         if (($this->labelCache = $this->getCache()->get('tev_labels')) === false) {
             $this->labelCache = $this->labelRepo->findAllKeysAndValues();
             $this->getCache()->set('tev_labels', $this->labelCache);
         }
     }
     if (isset($this->labelCache[$key])) {
         return $this->replaceValues($this->labelCache[$key], $markers);
     } else {
         return $key;
     }
 }