Code Duplication    Length = 12-13 lines in 3 locations

PHPDaemon/Clients/Asterisk/Connection.php 1 location

@@ 131-143 (lines=13) @@
128
	 * @return void
129
	 */
130
	public function onConnected($cb) {
131
		if ($this->state === self::CONN_STATE_HANDSHAKED_ERROR) {
132
			$cb($this);
133
		}
134
		elseif ($this->state === self::CONN_STATE_HANDSHAKED_OK) {
135
			$cb($this);
136
		}
137
		else {
138
			if (!$this->onConnected) {
139
				$this->onConnected = new StackCallbacks();
140
			}
141
142
			$this->onConnected->push($cb);
143
		}
144
	}
145
146
	/**

PHPDaemon/Clients/MySQL/Connection.php 1 location

@@ 198-209 (lines=12) @@
195
	 * @return void
196
	 */
197
	public function onConnected($cb) {
198
		if ($this->phase === self::PHASE_AUTH_ERR) {
199
			$cb($this, false);
200
		}
201
		elseif ($this->phase === self::PHASE_HANDSHAKED) {
202
			$cb($this, true);
203
		}
204
		else {
205
			if (!$this->onConnected) {
206
				$this->onConnected = new StackCallbacks();
207
			}
208
			$this->onConnected->push($cb);
209
		}
210
	}
211
212
	/**

PHPDaemon/Clients/PostgreSQL/Connection.php 1 location

@@ 137-148 (lines=12) @@
134
	 * @return void
135
	 */
136
	public function onConnected($cb) {
137
		if ($this->state === self::STATE_AUTH_ERROR) {
138
			$cb($this, false);
139
		}
140
		elseif ($this->state === self::STATE_AUTH_OK) {
141
			$cb($this, true);
142
		}
143
		else {
144
			if (!$this->onConnected) {
145
				$this->onConnected = new StackCallbacks();
146
			}
147
			$this->onConnected->push($cb);
148
		}
149
	}
150
151
	/**