private function locateInjectionIndex(array $contents, string $type) : stdClass
    {
        $action = (object) [
            'index' => null,
            'type' => self::ACTION_NOT_FOUND,
        ];

        foreach ($contents as $index => $line) {
            if (! preg_match('/^### ' . $type . '/i', $line)) {
                continue;
            }

            $action->index = $index + 2;
            $action->type = preg_match('/^- Nothing/', $contents[$action->index])
                ? self::ACTION_REPLACE
                : self::ACTION_INJECT;
            break;
        }

        return $action;
    }