public function recursiveCopy(
        $sourceDir,
        $destDir,
        $extensions = array('php')
    ) {
        if (!realpath($sourceDir)) {
            throw new \InvalidArgumentException("$sourceDir not found");
        }

        if (!$extensions) {
            throw new \InvalidArgumentException('$extensions is empty!');
        }

        $sourceDir = realpath($sourceDir);
        $exts = array_fill_keys($extensions, true);
        $iter = new \RecursiveDirectoryIterator($sourceDir);
        $iter = new \RecursiveIteratorIterator($iter);
        $total = 0;

        $this->startSection('copy');
        $this->debug("Starting to copy files from $sourceDir");

        foreach ($iter as $file) {
            if (isset($exts[$file->getExtension()])
                || $file->getBaseName() == 'LICENSE'
            ) {
                // Remove the source directory from the destination path
                $toPath = str_replace($sourceDir, '', (string) $file);
                $toPath = $destDir . '/' . $toPath;
                $toPath = str_replace('//', '/', $toPath);
                $this->deepCopy((string) $file, $toPath);
                $total++;
            }
        }

        $this->debug("Copied $total files from $sourceDir");
        $this->endSection();
    }