private function processFile(SplFileInfo $file, $replaceExisting, $dryRun)
    {
        if ($file->isDir()) {
            return;
        }

        $tokens = token_get_all($file->getContents());

        $licenseTokenIndex = $this->getLicenseTokenIndex($tokens);

        if (null !== $licenseTokenIndex && true === $replaceExisting) {
            $this->removeExistingLicense($file, $tokens, $licenseTokenIndex, $dryRun);
        }

        if (null === $licenseTokenIndex || true === $replaceExisting) {
            $this->log(sprintf('<fg=green>[+]</> Adding license header for <options=bold>%s</>', $file->getRealPath()));

            if (true === $dryRun) {
                return;
            }

            $license = $this->getLicenseAsComment();
            $content = preg_replace('/<\?php/', '<?php' . PHP_EOL . PHP_EOL . $license, $file->getContents(), 1);
            file_put_contents($file->getRealPath(), $content);
        } else {
            $this->log(sprintf('<fg=cyan>[S]</> Skipping <options=bold>%s</>', $file->getRealPath()));
        }
    }