/**
  * @param ConfigInterface $config
  * @return \WidRestApiDocumentator\ResourceSet\StandardSet
  * @throws \WidRestApiDocumentator\Exception\InvalidArgumentException   If definition od resource is not valid
  */
 public function parse(ConfigInterface $config)
 {
     $resultSet = new ResourceSet\StandardSet();
     $this->generalParams = new ParamSet();
     $this->parseGeneral($config->getGeneral());
     foreach ($config->getResources() as $definition => $options) {
         $this->validateDefinition($definition, $options);
         $resource = $this->createNewResource();
         // Do the magic.
         $this->parseOptions($options, $resource);
         $this->parseDefinition($definition, $resource);
         $this->parseUrlParams($resource);
         $this->parseQuery($resource);
         $resultSet->append($resource);
     }
     return $resultSet;
 }
 public function toArrayConfig(ConfigInterface $config)
 {
     // TODO add general params
     return array('name' => $config->getName(), 'baseUrl' => $config->getBaseUrl(), 'version' => $config->getVersion(), 'general' => $this->toArrayGeneral($config->getGeneral()));
 }