Code Duplication    Length = 50-50 lines in 2 locations

lib/Command/Index.php 1 location

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

lib/Command/Live.php 1 location

@@ 333-382 (lines=50) @@
330
	/**
331
	 * @param string $key
332
	 */
333
	public function onKeyPressed(string $key) {
334
		$key = strtolower($key);
335
		if ($key === 'q') {
336
			try {
337
				$this->runner->stop();
338
			} catch (TickDoesNotExistException $e) {
339
				/** we do nohtin' */
340
			}
341
			exit();
342
		}
343
344
		$current = $this->cliService->currentPanel('commands');
345
		if ($current === self::PANEL_COMMANDS_ROOT && $key === 'p') {
346
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_PAUSED);
347
			$this->runner->pause(true);
348
		}
349
		if ($current === self::PANEL_COMMANDS_PAUSED && $key === 'u') {
350
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_ROOT);
351
			$this->runner->pause(false);
352
		}
353
354
		if ($key === 'x') {
355
			$this->displayResult(-99);
356
		}
357
		if ($key === 'c') {
358
			$this->displayResult(-1);
359
		}
360
		if ($key === 'v') {
361
			$this->displayResult(1);
362
		}
363
		if ($key === 'b') {
364
			$this->displayResult(99);
365
		}
366
367
		if ($key === 'f') {
368
			$this->displayError(-99);
369
		}
370
		if ($key === 'h') {
371
			$this->displayError(-1);
372
		}
373
		if ($key === 'j') {
374
			$this->displayError(1);
375
		}
376
		if ($key === 'l') {
377
			$this->displayError(99);
378
		}
379
		if ($key === 'd') {
380
			$this->deleteError();
381
		}
382
	}
383
384
385
	/**