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;
    }
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;
    }
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 ; }
Locates the location within the changelog where the injection should occur.
Also determines if the injection is a replacement or an addition.
Locates the location within the changelog where the injection should occur . Also determines if the injection is a replacement or an addition .