protected function render($tool, $source, $targetFile)
    {
        if (count($this->filterChains) == 0) {
            $this->renderFile($tool, $source, $targetFile);
            return;
        }

        $tmpTarget = tempnam(sys_get_temp_dir(), 'rST-');
        $this->renderFile($tool, $source, $tmpTarget);

        $this->fileUtils->copyFile(
            new PhingFile($tmpTarget),
            new PhingFile($targetFile),
            $this->getProject(),
            true,
            false,
            $this->filterChains,
            $this->mode
        );
        unlink($tmpTarget);
    }