Code Duplication    Length = 37-37 lines in 2 locations

lib/Command/Index.php 1 location

@@ 266-302 (lines=37) @@
263
	/**
264
	 * @param $key
265
	 */
266
	public function onKeyPressed($key) {
267
		$key = strtolower($key);
268
		if ($key === 'q') {
269
			try {
270
				$this->runner->stop();
271
			} catch (TickDoesNotExistException $e) {
272
				/** we do nohtin' */
273
			}
274
			exit();
275
		}
276
277
		$current = $this->cliService->currentPanel('commands');
278
		if ($current === self::PANEL_COMMANDS_ROOT && $key === 'p') {
279
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_PAUSED);
280
			$this->runner->pause(true);
281
		}
282
		if ($current === self::PANEL_COMMANDS_PAUSED && $key === 'u') {
283
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_ROOT);
284
			$this->runner->pause(false);
285
		}
286
287
		if ($key === 'f') {
288
			$this->displayError(-99);
289
		}
290
		if ($key === 'h') {
291
			$this->displayError(-1);
292
		}
293
		if ($key === 'j') {
294
			$this->displayError(1);
295
		}
296
		if ($key === 'l') {
297
			$this->displayError(99);
298
		}
299
		if ($key === 'd') {
300
			$this->deleteError();
301
		}
302
	}
303
304
	/**
305
	 * @param string $action

lib/Command/Live.php 1 location

@@ 268-304 (lines=37) @@
265
	/**
266
	 * @param $key
267
	 */
268
	public function onKeyPressed($key) {
269
		$key = strtolower($key);
270
		if ($key === 'q') {
271
			try {
272
				$this->runner->stop();
273
			} catch (TickDoesNotExistException $e) {
274
				/** we do nohtin' */
275
			}
276
			exit();
277
		}
278
279
		$current = $this->cliService->currentPanel('commands');
280
		if ($current === self::PANEL_COMMANDS_ROOT && $key === 'p') {
281
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_PAUSED);
282
			$this->runner->pause(true);
283
		}
284
		if ($current === self::PANEL_COMMANDS_PAUSED && $key === 'u') {
285
			$this->cliService->switchPanel('commands', self::PANEL_COMMANDS_ROOT);
286
			$this->runner->pause(false);
287
		}
288
289
		if ($key === 'f') {
290
			$this->displayError(-99);
291
		}
292
		if ($key === 'h') {
293
			$this->displayError(-1);
294
		}
295
		if ($key === 'j') {
296
			$this->displayError(1);
297
		}
298
		if ($key === 'l') {
299
			$this->displayError(99);
300
		}
301
		if ($key === 'd') {
302
			$this->deleteError();
303
		}
304
	}
305
306
307
	/**