original_string: public function handleRequest($preset_key, $file)
      {
          //do it at the beginning for early validation
          $preset = $this->getPresetActions($preset_key, $file);
  
          $source_file =  $this->getOriginalFilename($file);
  
          $original_file = $this->getOriginalFile($source_file);
  
          $final_file = $this->localUrl($preset_key, $file);
  
          $this->verifyDirectoryExistence($this->options['path_local'], dirname($final_file));
  
          $final_file = $this->options['path_local'] . '/' . $final_file;
  
          if (file_exists($final_file)) {
              return $final_file;
          }
  
          $image = $this->loadImage($original_file);
  
          return $this->buildImage($preset, $image, $final_file)->source;
      }
code: public function handleRequest($preset_key, $file)
      {
          //do it at the beginning for early validation
          $preset = $this->getPresetActions($preset_key, $file);
  
          $source_file =  $this->getOriginalFilename($file);
  
          $original_file = $this->getOriginalFile($source_file);
  
          $final_file = $this->localUrl($preset_key, $file);
  
          $this->verifyDirectoryExistence($this->options['path_local'], dirname($final_file));
  
          $final_file = $this->options['path_local'] . '/' . $final_file;
  
          if (file_exists($final_file)) {
              return $final_file;
          }
  
          $image = $this->loadImage($original_file);
  
          return $this->buildImage($preset, $image, $final_file)->source;
      }
code_tokens: public function handleRequest ( $ preset_key , $ file ) { //do it at the beginning for early validation $ preset = $ this -> getPresetActions ( $ preset_key , $ file ) ; $ source_file = $ this -> getOriginalFilename ( $ file ) ; $ original_file = $ this -> getOriginalFile ( $ source_file ) ; $ final_file = $ this -> localUrl ( $ preset_key , $ file ) ; $ this -> verifyDirectoryExistence ( $ this -> options [ 'path_local' ] , dirname ( $ final_file ) ) ; $ final_file = $ this -> options [ 'path_local' ] . '/' . $ final_file ; if ( file_exists ( $ final_file ) ) { return $ final_file ; } $ image = $ this -> loadImage ( $ original_file ) ; return $ this -> buildImage ( $ preset , $ image , $ final_file ) -> source ; }
docstring: Take a preset and a file and return a transformed image
  
  @param $preset_key string
  @param $file string
  @throws Exceptions\InvalidPresetException
  @throws Exceptions\NotFoundException
  @throws \RuntimeException
  @return string
docstring_tokens: Take a preset and a file and return a transformed image