Code Duplication    Length = 50-50 lines in 2 locations

lib/Command/Index.php 1 location

@@ 301-350 (lines=50) @@
298
	/**
299
	 * @param string $key
300
	 */
301
	public function onKeyPressed(string $key) {
302
		$key = strtolower($key);
303
		if ($key === 'q') {
304
			try {
305
				$this->runner->stop();
306
			} catch (TickDoesNotExistException $e) {
307
				/** we do nohtin' */
308
			}
309
			exit();
310
		}
311
312
		$current = $this->cliService->currentPanel('commands');
313
		if ($current === self::PANEL_COMMANDS_ROOT && $key === 'p') {
314
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_PAUSED);
315
			$this->runner->pause(true);
316
		}
317
		if ($current === self::PANEL_COMMANDS_PAUSED && $key === 'u') {
318
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_ROOT);
319
			$this->runner->pause(false);
320
		}
321
322
		if ($key === 'x') {
323
			$this->displayResult(-99);
324
		}
325
		if ($key === 'c') {
326
			$this->displayResult(-1);
327
		}
328
		if ($key === 'v') {
329
			$this->displayResult(1);
330
		}
331
		if ($key === 'b') {
332
			$this->displayResult(99);
333
		}
334
335
		if ($key === 'f') {
336
			$this->displayError(-99);
337
		}
338
		if ($key === 'h') {
339
			$this->displayError(-1);
340
		}
341
		if ($key === 'j') {
342
			$this->displayError(1);
343
		}
344
		if ($key === 'l') {
345
			$this->displayError(99);
346
		}
347
		if ($key === 'd') {
348
			$this->deleteError();
349
		}
350
	}
351
352
353
	/**

lib/Command/Live.php 1 location

@@ 312-361 (lines=50) @@
309
	/**
310
	 * @param string $key
311
	 */
312
	public function onKeyPressed(string $key) {
313
		$key = strtolower($key);
314
		if ($key === 'q') {
315
			try {
316
				$this->runner->stop();
317
			} catch (TickDoesNotExistException $e) {
318
				/** we do nohtin' */
319
			}
320
			exit();
321
		}
322
323
		$current = $this->cliService->currentPanel('commands');
324
		if ($current === self::PANEL_COMMANDS_ROOT && $key === 'p') {
325
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_PAUSED);
326
			$this->runner->pause(true);
327
		}
328
		if ($current === self::PANEL_COMMANDS_PAUSED && $key === 'u') {
329
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_ROOT);
330
			$this->runner->pause(false);
331
		}
332
333
		if ($key === 'x') {
334
			$this->displayResult(-99);
335
		}
336
		if ($key === 'c') {
337
			$this->displayResult(-1);
338
		}
339
		if ($key === 'v') {
340
			$this->displayResult(1);
341
		}
342
		if ($key === 'b') {
343
			$this->displayResult(99);
344
		}
345
346
		if ($key === 'f') {
347
			$this->displayError(-99);
348
		}
349
		if ($key === 'h') {
350
			$this->displayError(-1);
351
		}
352
		if ($key === 'j') {
353
			$this->displayError(1);
354
		}
355
		if ($key === 'l') {
356
			$this->displayError(99);
357
		}
358
		if ($key === 'd') {
359
			$this->deleteError();
360
		}
361
	}
362
363
364
	/**