Passed
Push — master ( 08d0fa...a886df )
by Fabio
06:03
created

TSocketException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 3
c 1
b 0
f 1
nc 2
nop 2
dl 0
loc 6
rs 10
1
<?php
2
/**
3
 * TSocketException class file
4
 *
5
 * @author Brad Anderson <[email protected]>
6
 * @link https://github.com/pradosoft/prado
7
 * @license https://github.com/pradosoft/prado/blob/master/LICENSE
8
 */
9
10
namespace Prado\Exceptions;
11
12
use Prado\TPropertyValue;
13
14
/**
15
 * TSocketException class
16
 *
17
 * TSocketException handles all socket related exceptions.  It manages the socket
18
 * errorCode and gets their translated message from PHP.
19
 *
20
 * @author Brad Anderson <[email protected]>
21
 * @since 4.2.3
22
 */
23
class TSocketException extends TNetworkException
24
{
25
	/**
26
	 * Constructor.
27
	 * @param int $errorCode Network error code.
28
	 * @param string $errorMessage error message.  default null to be filled in by
29
	 *   PHP `socket_strError($errorCode)`
30
	 */
31
	public function __construct($errorCode, $errorMessage = null)
32
	{
33
		if ($errorMessage === null) {
34
			$errorMessage = socket_strerror($errorCode);
35
		}
36
		parent::__construct($errorCode, $errorMessage);
37
	}
38
}
39