original_string: protected function createFromUrl($file)
      {
          $ch = curl_init();
  
          curl_setopt_array($ch, [
              CURLOPT_URL => $file,
              CURLOPT_RETURNTRANSFER => 1,
              CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
              CURLOPT_FOLLOWLOCATION => 1,
          ]);
  
          $raw_file = curl_exec($ch);
  
          curl_close($ch);
  
          // Get the mime type of the file
          $size_info = getimagesizefromstring($raw_file);
          $mime = $size_info['mime'];
  
          // Create a file path for the file by storing it on disk.
          $file_path = @tempnam(sys_get_temp_dir(), 'STP');
          file_put_contents($file_path, $raw_file);
  
          // Get the original filename
          $name = strtok(pathinfo($file, PATHINFO_BASENAME), '?');
  
          // Append missing file extension
          if (empty(pathinfo($file, PATHINFO_EXTENSION))) {
              $name = $name . '.' . $this->getExtension($mime);
          }
  
          // Get the length of the file
          if (function_exists('mb_strlen')) {
              $size = mb_strlen($raw_file, '8bit');
          }
          else {
              $size = strlen($raw_file);
          }
  
          return new UploadedFile($file_path, $name, $mime, $size, 0);
      }
code: protected function createFromUrl($file)
      {
          $ch = curl_init();
  
          curl_setopt_array($ch, [
              CURLOPT_URL => $file,
              CURLOPT_RETURNTRANSFER => 1,
              CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
              CURLOPT_FOLLOWLOCATION => 1,
          ]);
  
          $raw_file = curl_exec($ch);
  
          curl_close($ch);
  
          // Get the mime type of the file
          $size_info = getimagesizefromstring($raw_file);
          $mime = $size_info['mime'];
  
          // Create a file path for the file by storing it on disk.
          $file_path = @tempnam(sys_get_temp_dir(), 'STP');
          file_put_contents($file_path, $raw_file);
  
          // Get the original filename
          $name = strtok(pathinfo($file, PATHINFO_BASENAME), '?');
  
          // Append missing file extension
          if (empty(pathinfo($file, PATHINFO_EXTENSION))) {
              $name = $name . '.' . $this->getExtension($mime);
          }
  
          // Get the length of the file
          if (function_exists('mb_strlen')) {
              $size = mb_strlen($raw_file, '8bit');
          }
          else {
              $size = strlen($raw_file);
          }
  
          return new UploadedFile($file_path, $name, $mime, $size, 0);
      }
code_tokens: protected function createFromUrl ( $ file ) { $ ch = curl_init ( ) ; curl_setopt_array ( $ ch , [ CURLOPT_URL => $ file , CURLOPT_RETURNTRANSFER => 1 , CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' , CURLOPT_FOLLOWLOCATION => 1 , ] ) ; $ raw_file = curl_exec ( $ ch ) ; curl_close ( $ ch ) ; // Get the mime type of the file $ size_info = getimagesizefromstring ( $ raw_file ) ; $ mime = $ size_info [ 'mime' ] ; // Create a file path for the file by storing it on disk. $ file_path = @ tempnam ( sys_get_temp_dir ( ) , 'STP' ) ; file_put_contents ( $ file_path , $ raw_file ) ; // Get the original filename $ name = strtok ( pathinfo ( $ file , PATHINFO_BASENAME ) , '?' ) ; // Append missing file extension if ( empty ( pathinfo ( $ file , PATHINFO_EXTENSION ) ) ) { $ name = $ name . '.' . $ this -> getExtension ( $ mime ) ; } // Get the length of the file if ( function_exists ( 'mb_strlen' ) ) { $ size = mb_strlen ( $ raw_file , '8bit' ) ; } else { $ size = strlen ( $ raw_file ) ; } return new UploadedFile ( $ file_path , $ name , $ mime , $ size , 0 ) ; }
docstring: Fetch a remote file using a string URL and convert it into
  an instance of Torann\MediaSort\File\UploadedFile.
  
  @param string $file
  
  @return \Torann\MediaSort\File\UploadedFile
docstring_tokens: Fetch a remote file using a string URL and convert it into an instance of Torann \ MediaSort \ File \ UploadedFile .