original_string: protected function validateAspectRatio($width, $height)
      {
          /**
           * Allow aspect ratio given?
           */
          if ($this->allowAspectRatioX && $this->allowAspectRatioY) {
              $gcd = $this->gcd($width, $height);
              $x = $width / $gcd;
              $y = $height / $gcd;
  
              if ($x != $this->allowAspectRatioX || $y != $this->allowAspectRatioY) {
                  $this->setErrorMessage(sprintf(
                      $this->messages['aspect_ratio'],
                      $x . ':' . $y,
                      $this->allowAspectRatioX . ':' . $this->allowAspectRatioY
                  ));
                  return false;
              }
          }
  
          /**
           * Deny aspect ratio given?
           */
          if ($this->denyAspectRatioX && $this->denyAspectRatioY) {
              $gcd = $this->gcd($width, $height);
              $x = $width / $gcd;
              $y = $height / $gcd;
  
              if ($x == $this->denyAspectRatioX && $y == $this->denyAspectRatioY) {
                  $this->setErrorMessage(sprintf(
                      $this->messages['aspect_ratio_denied'],
                      $x . ':' . $y
                  ));
                  return false;
              }
          }
  
          return true;
      }
code: protected function validateAspectRatio($width, $height)
      {
          /**
           * Allow aspect ratio given?
           */
          if ($this->allowAspectRatioX && $this->allowAspectRatioY) {
              $gcd = $this->gcd($width, $height);
              $x = $width / $gcd;
              $y = $height / $gcd;
  
              if ($x != $this->allowAspectRatioX || $y != $this->allowAspectRatioY) {
                  $this->setErrorMessage(sprintf(
                      $this->messages['aspect_ratio'],
                      $x . ':' . $y,
                      $this->allowAspectRatioX . ':' . $this->allowAspectRatioY
                  ));
                  return false;
              }
          }
  
          /**
           * Deny aspect ratio given?
           */
          if ($this->denyAspectRatioX && $this->denyAspectRatioY) {
              $gcd = $this->gcd($width, $height);
              $x = $width / $gcd;
              $y = $height / $gcd;
  
              if ($x == $this->denyAspectRatioX && $y == $this->denyAspectRatioY) {
                  $this->setErrorMessage(sprintf(
                      $this->messages['aspect_ratio_denied'],
                      $x . ':' . $y
                  ));
                  return false;
              }
          }
  
          return true;
      }
code_tokens: protected function validateAspectRatio ( $ width , $ height ) { /**
           * Allow aspect ratio given?
           */ if ( $ this -> allowAspectRatioX && $ this -> allowAspectRatioY ) { $ gcd = $ this -> gcd ( $ width , $ height ) ; $ x = $ width / $ gcd ; $ y = $ height / $ gcd ; if ( $ x != $ this -> allowAspectRatioX || $ y != $ this -> allowAspectRatioY ) { $ this -> setErrorMessage ( sprintf ( $ this -> messages [ 'aspect_ratio' ] , $ x . ':' . $ y , $ this -> allowAspectRatioX . ':' . $ this -> allowAspectRatioY ) ) ; return false ; } } /**
           * Deny aspect ratio given?
           */ if ( $ this -> denyAspectRatioX && $ this -> denyAspectRatioY ) { $ gcd = $ this -> gcd ( $ width , $ height ) ; $ x = $ width / $ gcd ; $ y = $ height / $ gcd ; if ( $ x == $ this -> denyAspectRatioX && $ y == $ this -> denyAspectRatioY ) { $ this -> setErrorMessage ( sprintf ( $ this -> messages [ 'aspect_ratio_denied' ] , $ x . ':' . $ y ) ) ; return false ; } } return true ; }
docstring: Validate the aspect ratio. If the size is invalid, we will also push an error message with setErrorMessage.
  @param $width
  @param $height
  @return bool
docstring_tokens: Validate the aspect ratio . If the size is invalid we will also push an error message with setErrorMessage .