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

Http   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A exists() 0 14 3
A valid() 0 6 2
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