original_string: public function deepCopy($from, $to)
      {
          if (!is_file($from)) {
              throw new \InvalidArgumentException("File not found: {$from}");
          }
  
          $to = str_replace('//', '/', $this->stageDir . '/' . $to);
          $dir = dirname($to);
  
          if (!is_dir($dir)) {
              if (!mkdir($dir, 0777, true)) {
                  throw new \RuntimeException("Unable to create directory: $dir");
              }
          }
  
          if (!copy($from, $to)) {
              throw new \RuntimeException("Unable to copy $from to $to");
          }
      }
code: public function deepCopy($from, $to)
      {
          if (!is_file($from)) {
              throw new \InvalidArgumentException("File not found: {$from}");
          }
  
          $to = str_replace('//', '/', $this->stageDir . '/' . $to);
          $dir = dirname($to);
  
          if (!is_dir($dir)) {
              if (!mkdir($dir, 0777, true)) {
                  throw new \RuntimeException("Unable to create directory: $dir");
              }
          }
  
          if (!copy($from, $to)) {
              throw new \RuntimeException("Unable to copy $from to $to");
          }
      }
code_tokens: public function deepCopy ( $ from , $ to ) { if ( ! is_file ( $ from ) ) { throw new \ InvalidArgumentException ( "File not found: {$from}" ) ; } $ to = str_replace ( '//' , '/' , $ this -> stageDir . '/' . $ to ) ; $ dir = dirname ( $ to ) ; if ( ! is_dir ( $ dir ) ) { if ( ! mkdir ( $ dir , 0777 , true ) ) { throw new \ RuntimeException ( "Unable to create directory: $dir" ) ; } } if ( ! copy ( $ from , $ to ) ) { throw new \ RuntimeException ( "Unable to copy $from to $to" ) ; } }
docstring: Copies a file and creates the destination directory if needed.
  
  @param string $from File to copy
  @param string $to   Destination to copy the file to, relative to the
  base staging directory.
  @throws \InvalidArgumentException if the file cannot be found
  @throws \RuntimeException if the directory cannot be created.
  @throws \RuntimeException if the file cannot be copied.
docstring_tokens: Copies a file and creates the destination directory if needed .