original_string: protected function getSafeResizeOffset(\Imagick $image, $targetWidth, $targetHeight)
      {
          $source = $image->getImageGeometry();
          if (0 == $targetHeight || ($source['width'] / $source['height']) < ($targetWidth / $targetHeight)) {
              $scale = $source['width'] / $targetWidth;
          } else {
              $scale = $source['height'] / $targetHeight;
          }
  
          return array('width' => (int) ($source['width'] / $scale), 'height' => (int) ($source['height'] / $scale));
      }
code: protected function getSafeResizeOffset(\Imagick $image, $targetWidth, $targetHeight)
      {
          $source = $image->getImageGeometry();
          if (0 == $targetHeight || ($source['width'] / $source['height']) < ($targetWidth / $targetHeight)) {
              $scale = $source['width'] / $targetWidth;
          } else {
              $scale = $source['height'] / $targetHeight;
          }
  
          return array('width' => (int) ($source['width'] / $scale), 'height' => (int) ($source['height'] / $scale));
      }
code_tokens: protected function getSafeResizeOffset ( \ Imagick $ image , $ targetWidth , $ targetHeight ) { $ source = $ image -> getImageGeometry ( ) ; if ( 0 == $ targetHeight || ( $ source [ 'width' ] / $ source [ 'height' ] ) < ( $ targetWidth / $ targetHeight ) ) { $ scale = $ source [ 'width' ] / $ targetWidth ; } else { $ scale = $ source [ 'height' ] / $ targetHeight ; } return array ( 'width' => ( int ) ( $ source [ 'width' ] / $ scale ) , 'height' => ( int ) ( $ source [ 'height' ] / $ scale ) ) ; }
docstring: Returns width and height for resizing the image, keeping the aspect ratio
  and allow the image to be larger than either the width or height
  
  @param  \Imagick $image
  @param  int      $targetWidth
  @param  int      $targetHeight
  @return array
docstring_tokens: Returns width and height for resizing the image keeping the aspect ratio and allow the image to be larger than either the width or height