Code Duplication    Length = 50-50 lines in 2 locations

lib/Command/Index.php 1 location

@@ 278-327 (lines=50) @@
275
	/**
276
	 * @param $key
277
	 */
278
	public function onKeyPressed($key) {
279
		$key = strtolower($key);
280
		if ($key === 'q') {
281
			try {
282
				$this->runner->stop();
283
			} catch (TickDoesNotExistException $e) {
284
				/** we do nohtin' */
285
			}
286
			exit();
287
		}
288
289
		$current = $this->cliService->currentPanel('commands');
290
		if ($current === self::PANEL_COMMANDS_ROOT && $key === 'p') {
291
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_PAUSED);
292
			$this->runner->pause(true);
293
		}
294
		if ($current === self::PANEL_COMMANDS_PAUSED && $key === 'u') {
295
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_ROOT);
296
			$this->runner->pause(false);
297
		}
298
299
		if ($key === 'x') {
300
			$this->displayResult(-99);
301
		}
302
		if ($key === 'c') {
303
			$this->displayResult(-1);
304
		}
305
		if ($key === 'v') {
306
			$this->displayResult(1);
307
		}
308
		if ($key === 'b') {
309
			$this->displayResult(99);
310
		}
311
312
		if ($key === 'f') {
313
			$this->displayError(-99);
314
		}
315
		if ($key === 'h') {
316
			$this->displayError(-1);
317
		}
318
		if ($key === 'j') {
319
			$this->displayError(1);
320
		}
321
		if ($key === 'l') {
322
			$this->displayError(99);
323
		}
324
		if ($key === 'd') {
325
			$this->deleteError();
326
		}
327
	}
328
329
330
	/**

lib/Command/Live.php 1 location

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