/**
  * {@inheritdoc}
  */
 public function getBox(Media $media, array $settings)
 {
     $size = $media->getBox();
     if ($settings['width'] == null && $settings['height'] == null) {
         throw new \RuntimeException(sprintf('Width/Height parameter is missing in context "%s" for provider "%s". Please add at least one parameter.', $media->getContext(), $media->getProviderName()));
     }
     if ($settings['height'] == null) {
         $settings['height'] = (int) ($settings['width'] * $size->getHeight() / $size->getWidth());
     }
     if ($settings['width'] == null) {
         $settings['width'] = (int) ($settings['height'] * $size->getWidth() / $size->getHeight());
     }
     return $this->computeBox($media, $settings);
 }
 /**
  * {@inheritdoc}
  */
 public function getBox(Media $media, array $settings)
 {
     $size = $media->getBox();
     if (null != $settings['height']) {
         if ($size->getHeight() > $size->getWidth()) {
             $higher = $size->getHeight();
             $lower = $size->getWidth();
         } else {
             $higher = $size->getWidth();
             $lower = $size->getHeight();
         }
         if ($higher - $lower > 0) {
             return new Box($lower, $lower);
         }
     }
     $settings['height'] = (int) ($settings['width'] * $size->getHeight() / $size->getWidth());
     if ($settings['height'] < $size->getHeight() && $settings['width'] < $size->getWidth()) {
         return new Box($settings['width'], $settings['height']);
     }
     return $size;
 }