protected function printMessages(string $type, array $messages = []) : void
    {
        $this->out('');

        $plural = Inflector::pluralize($type);
        if (empty($messages)) {
            $this->success("No $plural found in module.");

            return;
        }

        // Minimize output to only unique messages
        $messages = array_unique($messages);

        $plural = ucfirst($plural);
        $this->{$type}("$plural (" . count($messages) . "):");

        // Remove ROOT path for shorter output
        $messages = preg_replace('#' . ROOT . DS . '#', '', $messages);
        if (null === $messages) {
            return;
        }

        // Prefix all messages as list items
        $messages = preg_replace('/^/', ' - ', $messages);
        if (null === $messages) {
            return;
        }

        $this->{$type}($messages);
    }