public function scaleTo($width=null, $height=null)
    {
        if (!$width && !$height) {
            throw new UnderflowException('You have to pass at least width or height.');
        }

        if ($width instanceof Size) {
            return new static($width->width(), $width->height());
        }

        if ($width && $height) {
            return new static($width, $height);
        }

        if (!$width) {
            return new static($height * $this->aspectRatio(), $height);
        }

        return new static($width, $width / $this->aspectRatio());

    }
public function scaleTo($width=null, $height=null)
    {
        if (!$width && !$height) {
            throw new UnderflowException('You have to pass at least width or height.');
        }

        if ($width instanceof Size) {
            return new static($width->width(), $width->height());
        }

        if ($width && $height) {
            return new static($width, $height);
        }

        if (!$width) {
            return new static($height * $this->aspectRatio(), $height);
        }

        return new static($width, $width / $this->aspectRatio());

    }
public function scaleTo ( $ width = null , $ height = null ) { if ( ! $ width && ! $ height ) { throw new UnderflowException ( 'You have to pass at least width or height.' ) ; } if ( $ width instanceof Size ) { return new static ( $ width -> width ( ) , $ width -> height ( ) ) ; } if ( $ width && $ height ) { return new static ( $ width , $ height ) ; } if ( ! $ width ) { return new static ( $ height * $ this -> aspectRatio ( ) , $ height ) ; } return new static ( $ width , $ width / $ this -> aspectRatio ( ) ) ; }
Scale the size to new dimensions. Left out either width
or height to keep the aspect ratio.
Returns a new Size.

@param float|Size $width (optional)
@param float      $height (optional)

@return static
Scale the size to new dimensions . Left out either width or height to keep the aspect ratio . Returns a new Size .