/** * Load config. * * @param string $filename * * @return Config * * @throws \InvalidArgumentException */ public function load($filename) { $data = file_get_contents($filename); try { $config = $this->serializer->deserialize($data, Config::class, 'json'); } catch (UnexpectedValueException $exception) { throw new \InvalidArgumentException('Invalid configuration file', 0, $exception); } return $config; }
static function deSerializeArray($array) { $newArray = array(); foreach ($array as $string) { array_push($newArray, Serializer::deserialize($string)); } return $newArray; }
/** * @param array $data * @param string $type * @return object */ private function reconstructType(array $data, string $type) { return $this->serializer->deserialize($this->serializer->serialize($data), $type); }