SharedInternal::remotePointer()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
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
    protected function remotePointer(IConnectionParams $params)
25
    {
26
        if (!$filePointer = fopen($params->getSchema() . $params->getHost(), 'r+')) {
27
            throw new RequestException($this->getRRLang()->rrSocketCannotConnect());
28
        }
29
        return $filePointer;
30
    }
31
}
32