Code Duplication    Length = 15-16 lines in 2 locations

src/cli/InstanceStateManager.php 2 locations

@@ 54-69 (lines=16) @@
51
	 *
52
	 * @param InstanceStateEvent $event
53
	 */
54
	public function onInstanceReachable(InstanceStateEvent $event)
55
	{
56
		$instance      = $event->getInstance();
57
		$instanceState = $this->getInstanceState($instance);
58
59
		// Update reachability state now that we know the instance is reachable
60
		if ($instanceState->getReachability() === InstanceState::MAYBE_REACHABLE)
61
		{
62
			$this->_logger->info('Instance {instanceName} is now reachable, will start polling for updates',
63
				[
64
					'instanceName' => $instance->getName(),
65
				]);
66
67
			$instanceState->setReachability(InstanceState::REACHABLE);
68
		}
69
	}
70
71
72
	/**
@@ 77-91 (lines=15) @@
74
	 *
75
	 * @param InstanceStateEvent $event
76
	 */
77
	public function onInstanceUnreachable(InstanceStateEvent $event)
78
	{
79
		$instance      = $event->getInstance();
80
		$instanceState = $this->getInstanceState($instance);
81
82
		// Mark the instance as unreachable
83
		$message = 'Instance {instanceName} not reachable, will wait for {cycles} cycles before retrying';
84
85
		$this->_logger->alert($message, [
86
			'instanceName' => $instance->getName(),
87
			'cycles'       => self::UNREACHABLE_CYCLES_UNTIL_RETRY,
88
		]);
89
90
		$instanceState->setReachability(InstanceState::UNREACHABLE);
91
	}
92
93
94
	/**