Ejemplo n.º 1
0
 public function resolve(FeatureInterface $previous)
 {
     $status = $previous->getStatus();
     if ($status === Status::INACTIVE || $this->status === Status::UNKNOWN || $status === $this->status) {
         return $previous;
     }
     return $this;
 }
 /**
  * @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;
 }
Ejemplo n.º 3
0
 /**
  * Given a feature, resolves a status, reports on it and returns it
  *
  * @param FeatureInterface $feature
  * @return bool|null
  */
 protected function returnStatusFromFeature(FeatureInterface $feature)
 {
     $status = $feature->getStatus();
     $this->logger->info('Feature {feature} returned as {status} due to {provider} provider', ['feature' => $feature->getName(), 'status' => Status::$messages[$status], 'provider' => $feature->getProvider()->getName()]);
     return $status;
 }