Completed
Push — master ( d19dfb...5b8d73 )
by Adam
13:31
created

Http::valid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php namespace BestServedCold\PhalueObjects\File;
2
3
use BestServedCold\PhalueObjects\File;
4
use BestServedCold\PhalueObjects\Access\Curl;
5
6
final class Http extends File
7
{
8
    public function exists()
0 ignored issues
show
Coding Style introduced by
function exists() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
9
    {
10
        if (! $this->valid()) {
11
            throw new \Exception;
12
        }
13
14
        $curl = Curl::fromString($this->getValue());
15
        $curl->setOption($curl->noBody)
16
            ->setOption($curl->returnTransfer)
17
            ->setOption($curl->followRedirects)
18
            ->setOption($curl->maxRedirects)
19
            ->exec();
20
        return $curl->error() ? false : true;
21
    }
22
23
    public function valid()
0 ignored issues
show
Coding Style introduced by
function valid() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
24
    {
25
        return filter_var($this->getValue(), FILTER_VALIDATE_URL) === false
26
            ? false
27
            : true;
28
    }
29
}
30