function propInNot($prop, array $values, $strict = false) { return compose('not', propIn($prop, $values, $strict)); }
/** * Retrieve a translation with a key preference. */ public function get($string) { $localeChain = (array) $this->localeChain; // Map translations with the hash of $string. $cache = (array) $this->loadCache(md5($string)); // Only search when something is loaded. if ($cache) { // Search the cache based on locale chain. $cache = array_filter($cache, propIn('locale', $localeChain)); // Search by preferred key, if nothing is found just fall back to the whole cache. $_cache = array_filter($cache, propIs('key', $this->bundle)); if ($_cache) { $cache = $_cache; } unset($_cache); /*! Note * For anything survives the search, return the first one. This allows * $bundle fall back mechanism, because the specified bundle could be of * inexistance. */ if ($cache) { $string = reset($cache); $string = @$string['value']; } } else { $this->set($string, $this->bundle); } // note: sprintf() only when there are more arguments if (func_num_args() > 1) { return sprintf($string, array_slice(func_get_args(), 1)); } else { return $string; } }