/** * @param $name * @return Dictionary */ public function getDictionary($name) { // If there is no dictionary by that name in the dictionaries // attached to the current file, if (0 == count($this->dictionaries) || !array_key_exists($name, $this->dictionaries)) { //if this file is root file (no parent), error! if (null == $this->parentFile) { return null; } //otherwise, search the parent file's dictionaries for the dictionary with specified name. return $this->parentFile->getDictionary($name); } //This will throw an exception if the entry is not found //in the current file's named dictionary, instead of searching parent's hierarchy for //dictionaries with the same name. return $this->dictionaries[$name]; }