Factory   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 16
rs 10
c 1
b 0
f 0
ccs 11
cts 11
cp 1
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPointer() 0 14 6
1
<?php
2
3
namespace kalanis\RemoteRequest\Sockets;
4
5
6
use kalanis\RemoteRequest\Interfaces\IRRTranslations;
7
use kalanis\RemoteRequest\Interfaces\ISocket;
8
9
10
/**
11
 * Class Factory
12
 * @package kalanis\RemoteRequest\Sockets
13
 * Network sockets to the remote server - which can be used
14
 */
15
class Factory
16
{
17 1
    public static function getPointer(int $type = ISocket::SOCKET_STREAM, ?IRRTranslations $lang = null): ASocket
18
    {
19
        switch ($type) {
20 1
            case ISocket::SOCKET_INTERNAL:
21 1
                return new SharedInternal($lang);
22 1
            case ISocket::SOCKET_STREAM:
23 1
                return new Stream($lang);
24 1
            case ISocket::SOCKET_PFSOCKET:
25 1
                return new PfSocket($lang);
26 1
            case ISocket::SOCKET_SOCKET:
27 1
                return new Socket($lang);
28 1
            case ISocket::SOCKET_FSOCKET:
29
            default:
30 1
                return new FSocket($lang);
31
        }
32
    }
33
}
34