/**
  * @param InMemoryCollection $toggleCollection
  * @return array
  */
 public function serialize(InMemoryCollection $toggleCollection)
 {
     $serializer = new ToggleSerializer(new OperatorConditionSerializer(new OperatorSerializer()));
     $ret = array();
     foreach ($toggleCollection->all() as $key => $toggle) {
         $ret[$key] = $serializer->serialize($toggle);
     }
     return $ret;
 }
 /**
  * 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);
         }
     }
 }