/** * load dictionary content * * @return array */ protected function loadDictionary() { $dictFile = __DIR__ . '/data/dict.php'; $ceditDictFile = __DIR__ . '/data/cedict/cedict_ts.u8'; if (!file_exists($dictFile)) { // parse and cache $dictionary = $this->parseDictionary($ceditDictFile); $this->cache($dictFile, $dictionary); // load from cache } else { $dictionary = $this->loadFromCache($dictFile); } return self::$dictionary = $dictionary; }