original_string: public function is_image_from_storedfile(stored_file $file) {
          if (!$file->get_filesize()) {
              // An empty file cannot be an image.
              return false;
          }
  
          $mimetype = $file->get_mimetype();
          if (!preg_match('|^image/|', $mimetype)) {
              // The mimetype does not include image.
              return false;
          }
  
          // If it looks like an image, and it smells like an image, perhaps it's an image!
          return true;
      }
code: public function is_image_from_storedfile(stored_file $file) {
          if (!$file->get_filesize()) {
              // An empty file cannot be an image.
              return false;
          }
  
          $mimetype = $file->get_mimetype();
          if (!preg_match('|^image/|', $mimetype)) {
              // The mimetype does not include image.
              return false;
          }
  
          // If it looks like an image, and it smells like an image, perhaps it's an image!
          return true;
      }
code_tokens: public function is_image_from_storedfile ( stored_file $ file ) { if ( ! $ file -> get_filesize ( ) ) { // An empty file cannot be an image. return false ; } $ mimetype = $ file -> get_mimetype ( ) ; if ( ! preg_match ( '|^image/|' , $ mimetype ) ) { // The mimetype does not include image. return false ; } // If it looks like an image, and it smells like an image, perhaps it's an image! return true ; }
docstring: Attempt to determine whether the specified file is likely to be an
  image.
  Since this relies upon the mimetype stored in the files table, there
  may be times when this information is not 100% accurate.
  
  @param stored_file $file The file to check
  @return bool
docstring_tokens: Attempt to determine whether the specified file is likely to be an image . Since this relies upon the mimetype stored in the files table there may be times when this information is not 100% accurate .