/**
  * @param FeatureInterface $value
  * @return FormFeature
  */
 public function transform($value)
 {
     if (!$value instanceof FeatureInterface) {
         throw new TransformationFailedException('Expected FeatureInterface');
     }
     $view = new FormFeature();
     $view->provider = $value->getProvider()->getName();
     $view->name = $value->getName();
     $view->status = $value->getStatus();
     $configuration = $value->getConfiguration();
     if (!empty($configuration['ratio']) && is_scalar($configuration['ratio'])) {
         $view->ratio = $configuration['ratio'];
     }
     return $view;
 }
 /**
  * Set the feature to the enclosed status, under the given context
  *
  * @param ContextInterface $context
  * @param FeatureInterface $feature
  * @return void
  */
 public function setFeature(ContextInterface $context, FeatureInterface $feature)
 {
     $this->bag->set($feature->getName(), $feature->getConfiguration());
     //$this->session->save();
 }
Esempio n. 3
0
 /**
  * @param FeatureInterface $feature
  * @return array
  */
 public function toConfiguration(FeatureInterface $feature)
 {
     return $feature->getConfiguration();
 }