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;
    }