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

SharedInternal::remotePointer()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
c 0
b 0
f 0
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