@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php namespace BestServedCold\PhalueObjects\File; |
2 | 2 | |
3 | -use BestServedCold\PhalueObjects\File; |
|
4 | 3 | use BestServedCold\PhalueObjects\Access\Curl; |
4 | +use BestServedCold\PhalueObjects\File; |
|
5 | 5 | |
6 | 6 | final class Http extends File |
7 | 7 | { |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function exists() |
9 | 9 | { |
10 | - if (! $this->valid()) { |
|
10 | + if (!$this->valid()) { |
|
11 | 11 | throw new \Exception; |
12 | 12 | } |
13 | 13 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | public $returnTransfer = CURLOPT_RETURNTRANSFER; |
14 | 14 | public $timeout = CURLOPT_TIMEOUT; |
15 | 15 | |
16 | - private $options = []; |
|
16 | + private $options = [ ]; |
|
17 | 17 | private $constants; |
18 | 18 | |
19 | 19 | public function __construct($value) |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | private function init() |
35 | 35 | { |
36 | - if (! $this->value = curl_init($this->getValue())) { |
|
36 | + if (!$this->value = curl_init($this->getValue())) { |
|
37 | 37 | throw new \Exception; |
38 | 38 | } |
39 | 39 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function getOption($option) |
49 | 49 | { |
50 | - return isset($this->options[$option]) ? $this->options[$option] : null; |
|
50 | + return isset($this->options[ $option ]) ? $this->options[ $option ] : null; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function setOption($option, $value = true) |
59 | 59 | { |
60 | 60 | if (curl_setopt($this->getValue(), $option, $value)) { |
61 | - $this->options[Constant::init()->curl($option)] = $value; |
|
61 | + $this->options[ Constant::init()->curl($option) ] = $value; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $this; |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @param $option |
55 | - * @param bool|true $value |
|
55 | + * @param integer $value |
|
56 | 56 | * @return $this |
57 | 57 | */ |
58 | 58 | public function setOption($option, $value = true) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function nullIfNotSet(array $array, $key = false) |
80 | 80 | { |
81 | - return isset($array[$key]) ? $array[$key] : null; |
|
81 | + return isset($array[ $key ]) ? $array[ $key ] : null; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -88,6 +88,6 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public static function falseIfNotSet(array $array, $key = false) |
90 | 90 | { |
91 | - return isset($array[$key]) ? $array[$key] : false; |
|
91 | + return isset($array[ $key ]) ? $array[ $key ] : false; |
|
92 | 92 | } |
93 | 93 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function __call($category, array $key) |
33 | 33 | { |
34 | - $category = $this->definedConstants[$category]; |
|
34 | + $category = $this->definedConstants[ $category ]; |
|
35 | 35 | return empty($key) ? $category : array_search(reset($key), $category); |
36 | 36 | } |
37 | 37 |
@@ -6,6 +6,9 @@ |
||
6 | 6 | protected $timeout; |
7 | 7 | protected $mustExist; |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $value |
|
11 | + */ |
|
9 | 12 | public function __construct($value, $mustExist = true, $timeout = 10) |
10 | 13 | { |
11 | 14 | parent::__construct($value); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function getContents() |
28 | 28 | { |
29 | - return ! $this->mustExist || $this->exists() |
|
29 | + return !$this->mustExist || $this->exists() |
|
30 | 30 | ? file_get_contents($this->getValue()) |
31 | 31 | : false; |
32 | 32 | } |