Code Duplication    Length = 37-37 lines in 2 locations

lib/Command/Index.php 1 location

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

lib/Command/Live.php 1 location

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