filename = $this->getLocalizedFile($filename); $this->type = "ScummVM\Objects\\$type"; } /** * @return array */ public function getAllData(bool $assignIdsToArray = true) : array { $objects = $this->getFromCache(); if (is_null($objects)) { $data = @Yaml::parseFile($this->filename); if (!$data || !\is_array($data)) { throw new \ErrorException(\sprintf(self::YAML_PARSE_FAILED, $this->filename)); } $objects = []; foreach ($data as $item) { $obj = new $this->type($item); if ($assignIdsToArray && method_exists($obj, "getId")) { $objects[$obj->getId()] = $obj; } else { $objects[] = $obj; } } $this->saveToCache($objects, $this->type); } return $objects; } }