private function injectEntry(array $contents, stdClass $action, string $entry) : array
    {
        switch ($action->type) {
            case self::ACTION_REPLACE:
                array_splice($contents, $action->index, 1, $this->formatEntry($entry));
                break;
            case self::ACTION_INJECT:
                array_splice($contents, $action->index, 0, $this->formatEntry($entry, self::APPEND_NEWLINE));
                break;
            default:
                break;
        }
        return $contents;
    }
private function injectEntry(array $contents, stdClass $action, string $entry) : array
    {
        switch ($action->type) {
            case self::ACTION_REPLACE:
                array_splice($contents, $action->index, 1, $this->formatEntry($entry));
                break;
            case self::ACTION_INJECT:
                array_splice($contents, $action->index, 0, $this->formatEntry($entry, self::APPEND_NEWLINE));
                break;
            default:
                break;
        }
        return $contents;
    }
private function injectEntry ( array $ contents , stdClass $ action , string $ entry ) : array { switch ( $ action -> type ) { case self :: ACTION_REPLACE : array_splice ( $ contents , $ action -> index , 1 , $ this -> formatEntry ( $ entry ) ) ; break ; case self :: ACTION_INJECT : array_splice ( $ contents , $ action -> index , 0 , $ this -> formatEntry ( $ entry , self :: APPEND_NEWLINE ) ) ; break ; default : break ; } return $ contents ; }
Injects the new entry at the detected index, replacing the line if required.
Injects the new entry at the detected index replacing the line if required .