Passed
Push — master ( f409da...03e09c )
by Petr
02:25
created

SharedInternal   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 14
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A remotePointer() 0 6 2
1
<?php
2
3
namespace kalanis\RemoteRequest\Sockets;
4
5
6
use kalanis\RemoteRequest\Interfaces\IConnectionParams;
7
use kalanis\RemoteRequest\RequestException;
8
9
10
/**
11
 * Class SharedInternal
12
 * @package kalanis\RemoteRequest\Sockets
13
 * Pointer to the local source (file, memory)
14
 * Good one for testing (put inside the content you want to get)
15
 */
16
class SharedInternal extends ASocket
17
{
18
    /**
19
     * @param IConnectionParams $params
20
     * @throws RequestException
21
     * @return resource
22
     * @codeCoverageIgnore because accessing volume
23
     */
24 5
    protected function remotePointer(IConnectionParams $params)
25
    {
26 5
        if (!$filePointer = fopen($params->getSchema() . $params->getHost(), 'r+')) {
27
            throw new RequestException($this->lang->rrSocketCannotConnect());
28
        }
29 5
        return $filePointer;
30
    }
31
}
32