Code Duplication    Length = 47-47 lines in 2 locations

lib/Command/Index.php 1 location

@@ 528-574 (lines=47) @@
525
	/**
526
	 * @param int $pos
527
	 */
528
	private function displayError($pos = 0) {
529
		$total = sizeof($this->errors);
530
531
		if ($total === 0) {
532
			$this->runner->setInfoArray(
533
				[
534
					'errorCurrent' => 0,
535
					'errorTotal'   => 0,
536
				]
537
			);
538
539
			return;
540
		}
541
542
		$current = key($this->errors) + 1;
543
		$error = $this->getNavigationError($pos, ($current === 1), ($current === $total));
544
		$current = key($this->errors) + 1;
545
546
		if ($error === false) {
547
			return;
548
		}
549
550
		/** @var ModelIndex $index */
551
		$index = $error['index'];
552
		$errorIndex = '';
553
		if ($index !== null) {
554
			$errorIndex = $index->getProviderId() . ':' . $index->getDocumentId();
555
		}
556
557
		$width = $this->terminal->getWidth() - 13;
558
		$message = MiscService::get('message', $error, '');
559
		$err1 = substr($message, 0, $width);
560
		$err2 = substr($message, $width, $width + 10);
561
		$err3 = substr($message, $width + $width + 10, $width + 10);
562
563
		$this->runner->setInfoArray(
564
			[
565
				'errorCurrent'   => $current,
566
				'errorTotal'     => $total,
567
				'errorMessageA'  => trim($err1),
568
				'errorMessageB'  => trim($err2),
569
				'errorMessageC'  => trim($err3),
570
				'errorException' => MiscService::get('exception', $error, ''),
571
				'errorIndex'     => $errorIndex
572
			]
573
		);
574
	}
575
576
577
	/**

lib/Command/Live.php 1 location

@@ 455-501 (lines=47) @@
452
	/**
453
	 * @param int $pos
454
	 */
455
	private function displayError($pos = 0) {
456
		$total = sizeof($this->errors);
457
458
		if ($total === 0) {
459
			$this->runner->setInfoArray(
460
				[
461
					'errorCurrent' => 0,
462
					'errorTotal'   => 0,
463
				]
464
			);
465
466
			return;
467
		}
468
469
		$current = key($this->errors) + 1;
470
		$error = $this->getNavigationError($pos, ($current === 1), ($current === $total));
471
		$current = key($this->errors) + 1;
472
473
		if ($error === false) {
474
			return;
475
		}
476
477
		/** @var ModelIndex $index */
478
		$index = $error['index'];
479
		$errorIndex = '';
480
		if ($index !== null) {
481
			$errorIndex = $index->getProviderId() . ':' . $index->getDocumentId();
482
		}
483
484
		$width = $this->terminal->getWidth() - 13;
485
		$message = MiscService::get('message', $error, '');
486
		$err1 = substr($message, 0, $width);
487
		$err2 = substr($message, $width, $width + 10);
488
		$err3 = substr($message, $width + $width + 10, $width + 10);
489
490
		$this->runner->setInfoArray(
491
			[
492
				'errorCurrent'   => $current,
493
				'errorTotal'     => $total,
494
				'errorMessageA'  => trim($err1),
495
				'errorMessageB'  => trim($err2),
496
				'errorMessageC'  => trim($err3),
497
				'errorException' => MiscService::get('exception', $error, ''),
498
				'errorIndex'     => $errorIndex
499
			]
500
		);
501
	}
502
503
504
	/**