Code Duplication    Length = 36-36 lines in 2 locations

src/Controllers/SubmitControllerCreate.php 2 locations

@@ 156-191 (lines=36) @@
153
	 *
154
	 * @since   1.0
155
	 */
156
	private function checkCMSVersion(string $version)
157
	{
158
		$version = $this->validateVersionNumber($version);
159
160
		// If the version number is invalid, don't go any further
161
		if ($version === false)
162
		{
163
			return false;
164
		}
165
166
		// Joomla only uses major.minor.patch so everything else is invalid
167
		$explodedVersion = explode('.', $version);
168
169
		if (count($explodedVersion) > 3)
170
		{
171
			return false;
172
		}
173
174
		// Import the valid release listing
175
		$path = APPROOT . '/versions/joomla.json';
176
177
		if (!file_exists($path))
178
		{
179
			throw new \RuntimeException('Missing Joomla! release listing', 500);
180
		}
181
182
		$validVersions = json_decode(file_get_contents($path), true);
183
184
		// Check that the version is in our valid release list
185
		if (!in_array($version, $validVersions))
186
		{
187
			return false;
188
		}
189
190
		return $version;
191
	}
192
193
	/**
194
	 * Check the database type
@@ 221-256 (lines=36) @@
218
	 *
219
	 * @since   1.0
220
	 */
221
	private function checkPHPVersion(string $version)
222
	{
223
		$version = $this->validateVersionNumber($version);
224
225
		// If the version number is invalid, don't go any further
226
		if ($version === false)
227
		{
228
			return false;
229
		}
230
231
		// We only track versions based on major.minor.patch so everything else is invalid
232
		$explodedVersion = explode('.', $version);
233
234
		if (count($explodedVersion) > 3)
235
		{
236
			return false;
237
		}
238
239
		// Import the valid release listing
240
		$path = APPROOT . '/versions/php.json';
241
242
		if (!file_exists($path))
243
		{
244
			throw new \RuntimeException('Missing PHP release listing', 500);
245
		}
246
247
		$validVersions = json_decode(file_get_contents($path), true);
248
249
		// Check that the version is in our valid release list
250
		if (!in_array($version, $validVersions))
251
		{
252
			return false;
253
		}
254
255
		return $version;
256
	}
257
}
258