| Total Complexity | 7 | 
| Total Lines | 63 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | abstract class Socket  | 
            ||
| 10 | { | 
            ||
| 11 | /**  | 
            ||
| 12 | * @var string  | 
            ||
| 13 | */  | 
            ||
| 14 | private $host;  | 
            ||
| 15 | |||
| 16 | /**  | 
            ||
| 17 | * @var int  | 
            ||
| 18 | */  | 
            ||
| 19 | private $port;  | 
            ||
| 20 | |||
| 21 | /**  | 
            ||
| 22 | * @var resource  | 
            ||
| 23 | */  | 
            ||
| 24 | protected $socket;  | 
            ||
| 25 | |||
| 26 | /**  | 
            ||
| 27 | * Socket constructor.  | 
            ||
| 28 | * @param string $host  | 
            ||
| 29 | * @param int $port  | 
            ||
| 30 | */  | 
            ||
| 31 | public function __construct(string $host, int $port)  | 
            ||
| 32 |     { | 
            ||
| 33 | $this->host = $host;  | 
            ||
| 34 | $this->port = $port;  | 
            ||
| 35 | }  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * @return void  | 
            ||
| 39 | */  | 
            ||
| 40 | abstract public function initialize();  | 
            ||
| 41 | |||
| 42 | /**  | 
            ||
| 43 | * @return bool  | 
            ||
| 44 | */  | 
            ||
| 45 | private function connect(): bool  | 
            ||
| 46 |     { | 
            ||
| 47 | return socket_connect($this->socket, $this->host, $this->port);  | 
            ||
| 48 | }  | 
            ||
| 49 | |||
| 50 | /**  | 
            ||
| 51 | * @param string $message  | 
            ||
| 52 | * @return int  | 
            ||
| 53 | */  | 
            ||
| 54 | public function send(string $message): int  | 
            ||
| 61 | }  | 
            ||
| 62 | |||
| 63 | /**  | 
            ||
| 64 | * @return bool  | 
            ||
| 65 | */  | 
            ||
| 66 | public function close(): bool  | 
            ||
| 72 | }  | 
            ||
| 73 | }  |