protected function setAuthors($docBlock, $authors)
    {
        $newAuthors = array_unique(array_values($authors));
        $lines      = \explode("\n", $docBlock);
        $lastAuthor = 0;
        $indention  = ' * @author     ';
        $cleaned    = [];

        foreach ($lines as $number => $line) {
            if (\strpos($line, '@author') === false) {
                continue;
            }
            $lastAuthor = $number;
            $suffix     = \trim(\substr($line, (\strpos($line, '@author') + 7)));
            $indention  = \substr($line, 0, (\strlen($line) - \strlen($suffix)));

            $index = $this->searchAuthor($line, $newAuthors);

            // Obsolete entry, remove it.
            if (false === $index) {
                $lines[$number] = null;
                $cleaned[]      = $number;
            } else {
                unset($newAuthors[$index]);
            }
        }

        $lines = $this->addNewAuthors($lines, $newAuthors, $cleaned, $lastAuthor, $indention);

        return \implode("\n", \array_filter($lines, function ($value) {
            return null !== $value;
        }));
    }