/** * Import from module configuration. * * @param string $module The module name. * @param ToggleCollection $collection The toggle colleciton. * * @return void */ private function importFromModule($module, ToggleCollection $collection) { $file = TL_ROOT . '/system/modules/' . $module . '/config/features.php'; if (file_exists($file)) { $data = (include $file); foreach ($data as $name => $serializedToggle) { $toggle = $this->toggleSerializer->deserialize($serializedToggle); $collection->set($name, $toggle); } } }
/** * @param array $data * @return InMemoryCollection */ public function deserialize(array $data) { $collection = new InMemoryCollection(); $serializer = new ToggleSerializer(new OperatorConditionSerializer(new OperatorSerializer())); foreach ($data as $name => $serializedToggle) { $toggle = $serializer->deserialize($serializedToggle); $collection->set($name, $toggle); } return $collection; }