Code Duplication    Length = 50-50 lines in 2 locations

lib/Command/Index.php 1 location

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

lib/Command/Live.php 1 location

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