original_string: public static function extension($check, $extensions = ['gif', 'jpeg', 'png', 'jpg'])
      {
          if ($check instanceof UploadedFileInterface) {
              return static::extension($check->getClientFilename(), $extensions);
          }
          if (is_array($check)) {
              $check = isset($check['name']) ? $check['name'] : array_shift($check);
  
              return static::extension($check, $extensions);
          }
          $extension = strtolower(pathinfo($check, PATHINFO_EXTENSION));
          foreach ($extensions as $value) {
              if ($extension === strtolower($value)) {
                  return true;
              }
          }
  
          return false;
      }
code: public static function extension($check, $extensions = ['gif', 'jpeg', 'png', 'jpg'])
      {
          if ($check instanceof UploadedFileInterface) {
              return static::extension($check->getClientFilename(), $extensions);
          }
          if (is_array($check)) {
              $check = isset($check['name']) ? $check['name'] : array_shift($check);
  
              return static::extension($check, $extensions);
          }
          $extension = strtolower(pathinfo($check, PATHINFO_EXTENSION));
          foreach ($extensions as $value) {
              if ($extension === strtolower($value)) {
                  return true;
              }
          }
  
          return false;
      }
code_tokens: public static function extension ( $ check , $ extensions = [ 'gif' , 'jpeg' , 'png' , 'jpg' ] ) { if ( $ check instanceof UploadedFileInterface ) { return static :: extension ( $ check -> getClientFilename ( ) , $ extensions ) ; } if ( is_array ( $ check ) ) { $ check = isset ( $ check [ 'name' ] ) ? $ check [ 'name' ] : array_shift ( $ check ) ; return static :: extension ( $ check , $ extensions ) ; } $ extension = strtolower ( pathinfo ( $ check , PATHINFO_EXTENSION ) ) ; foreach ( $ extensions as $ value ) { if ( $ extension === strtolower ( $ value ) ) { return true ; } } return false ; }
docstring: Checks that value has a valid file extension.
  
  @param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check
  @param array $extensions file extensions to allow. By default extensions are 'gif', 'jpeg', 'png', 'jpg'
  @return bool Success
docstring_tokens: Checks that value has a valid file extension .