Code Duplication    Length = 36-36 lines in 2 locations

src/Controllers/SubmitControllerCreate.php 2 locations

@@ 139-174 (lines=36) @@
136
	 *
137
	 * @since   1.0
138
	 */
139
	private function checkCMSVersion(string $version)
140
	{
141
		$version = $this->validateVersionNumber($version);
142
143
		// If the version number is invalid, don't go any further
144
		if ($version === false)
145
		{
146
			return false;
147
		}
148
149
		// Joomla only uses major.minor.patch so everything else is invalid
150
		$explodedVersion = explode('.', $version);
151
152
		if (count($explodedVersion) > 3)
153
		{
154
			return false;
155
		}
156
157
		// Import the valid release listing
158
		$path = APPROOT . '/versions/joomla.json';
159
160
		if (!file_exists($path))
161
		{
162
			throw new \RuntimeException('Missing Joomla! release listing', 500);
163
		}
164
165
		$validVersions = json_decode(file_get_contents($path), true);
166
167
		// Check that the version is in our valid release list
168
		if (!in_array($version, $validVersions))
169
		{
170
			return false;
171
		}
172
173
		return $version;
174
	}
175
176
	/**
177
	 * Check the database type
@@ 204-239 (lines=36) @@
201
	 *
202
	 * @since   1.0
203
	 */
204
	private function checkPHPVersion(string $version)
205
	{
206
		$version = $this->validateVersionNumber($version);
207
208
		// If the version number is invalid, don't go any further
209
		if ($version === false)
210
		{
211
			return false;
212
		}
213
214
		// We only track versions based on major.minor.patch so everything else is invalid
215
		$explodedVersion = explode('.', $version);
216
217
		if (count($explodedVersion) > 3)
218
		{
219
			return false;
220
		}
221
222
		// Import the valid release listing
223
		$path = APPROOT . '/versions/php.json';
224
225
		if (!file_exists($path))
226
		{
227
			throw new \RuntimeException('Missing PHP release listing', 500);
228
		}
229
230
		$validVersions = json_decode(file_get_contents($path), true);
231
232
		// Check that the version is in our valid release list
233
		if (!in_array($version, $validVersions))
234
		{
235
			return false;
236
		}
237
238
		return $version;
239
	}
240
}
241