Code Duplication    Length = 14-16 lines in 4 locations

src/SmartGamma/Behat/PactExtension/Context/PactContext.php 4 locations

@@ 105-118 (lines=14) @@
102
    /**
103
     * @Given :providerName request :method to :uri should return response with :status
104
     */
105
    public function registerInteraction(
106
        string $providerName,
107
        string $method,
108
        string $uri,
109
        int $status
110
    ): void
111
    {
112
        $headers = $this->getHeaders($providerName);
113
        $request       = new InteractionRequestDTO($providerName, self::$stepName, $uri, $method, $headers);
114
        $response      = new InteractionResponseDTO($status);
115
        $providerState = self::$providerState->getStateDescription($providerName);
116
117
        self::$pact->registerInteraction($request, $response, $providerState);
118
    }
119
120
    /**
121
     * @Given :providerName request :method to :uri should return response with :status and body:
@@ 123-137 (lines=15) @@
120
    /**
121
     * @Given :providerName request :method to :uri should return response with :status and body:
122
     */
123
    public function registerInteractionWithBody(
124
        string $providerName,
125
        string $method,
126
        string $uri,
127
        int $status,
128
        TableNode $responseTable
129
    ): void
130
    {
131
        $headers = $this->getHeaders($providerName);
132
        $request       = new InteractionRequestDTO($providerName, self::$stepName, $uri, $method, $headers);
133
        $response      = new InteractionResponseDTO($status, $responseTable->getHash(), $this->matchingObjectStructures);
134
        $providerState = self::$providerState->getStateDescription($providerName);
135
136
        self::$pact->registerInteraction($request, $response, $providerState);
137
    }
138
139
    /**
140
     * @Given :providerName request :method to :uri with :query should return response with :status
@@ 142-156 (lines=15) @@
139
    /**
140
     * @Given :providerName request :method to :uri with :query should return response with :status
141
     */
142
    public function registerInteractionWithQuery(
143
        string $providerName,
144
        string $method,
145
        string $uri,
146
        string $query,
147
        int $status
148
    ): void
149
    {
150
        $headers = $this->getHeaders($providerName);
151
        $request       = new InteractionRequestDTO($providerName, self::$stepName, $uri, $method, $headers, $query);
152
        $response      = new InteractionResponseDTO($status);
153
        $providerState = self::$providerState->getStateDescription($providerName);
154
155
        self::$pact->registerInteraction($request, $response, $providerState);
156
    }
157
158
    /**
159
     * @Given :providerName request :method to :uri with :query should return response with :status and body:
@@ 161-176 (lines=16) @@
158
    /**
159
     * @Given :providerName request :method to :uri with :query should return response with :status and body:
160
     */
161
    public function registerInteractionWithQueryAndBody(
162
        string $providerName,
163
        string $method,
164
        string $uri,
165
        string $query,
166
        int $status,
167
        TableNode $responseTable
168
    ): void
169
    {
170
        $headers = $this->getHeaders($providerName);
171
        $request       = new InteractionRequestDTO($providerName, self::$stepName, $uri, $method, $headers, $query);
172
        $response      = new InteractionResponseDTO($status, $responseTable->getHash(), $this->matchingObjectStructures);
173
        $providerState = self::$providerState->getStateDescription($providerName);
174
175
        self::$pact->registerInteraction($request, $response, $providerState);
176
    }
177
178
    /**
179
     * @Given :providerName request :method to :uri with parameters: