@@ -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 | } |
@@ -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); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php namespace BestServedCold\PhalueObjects; |
2 | 2 | |
3 | -use BestServedCold\PhalueObjects\Format\Json; |
|
4 | -use BestServedCold\PhalueObjects\Format\Xml; |
|
3 | +use BestServedCold\PhalueObjects\Format\Json; |
|
4 | +use BestServedCold\PhalueObjects\Format\Xml; |
|
5 | 5 | use BestServedCold\PhalueObjects\Format\Yaml; |
6 | 6 | |
7 | 7 | class File extends ValueObject |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function getContents() |
32 | 32 | { |
33 | - return ! $this->mustExist || $this->exists() |
|
33 | + return !$this->mustExist || $this->exists() |
|
34 | 34 | ? file_get_contents($this->getValue()) |
35 | 35 | : false; |
36 | 36 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param $option |
53 | - * @param bool|true $value |
|
53 | + * @param integer $value |
|
54 | 54 | * @return $this |
55 | 55 | */ |
56 | 56 | public function setOption($option, $value = true) |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php namespace BestServedCold\PhalueObjects\Access; |
2 | 2 | |
3 | -use BestServedCold\PhalueObjects\Utility\Native\Constant; |
|
3 | +use BestServedCold\PhalueObjects\Utility\Native\Constant; |
|
4 | 4 | use BestServedCold\PhalueObjects\ValueObject; |
5 | 5 | |
6 | 6 | final class Curl extends ValueObject |
@@ -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 | |
18 | 18 | public function __construct($value) |
19 | 19 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | private function init() |
33 | 33 | { |
34 | - if (! $this->value = curl_init($this->getValue())) { |
|
34 | + if (!$this->value = curl_init($this->getValue())) { |
|
35 | 35 | throw new \Exception; |
36 | 36 | } |
37 | 37 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function getOption($option) |
47 | 47 | { |
48 | - return isset($this->options[$option]) ? $this->options[$option] : null; |
|
48 | + return isset($this->options[ $option ]) ? $this->options[ $option ] : null; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function setOption($option, $value = true) |
57 | 57 | { |
58 | 58 | if (curl_setopt($this->getValue(), $option, $value)) { |
59 | - $this->options[Constant::init()->curl($option)] = $value; |
|
59 | + $this->options[ Constant::init()->curl($option) ] = $value; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this; |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace BestServedCold\PhalueObjects\DateTime\Unit\Day; |
4 | 4 | |
5 | -use BestServedCold\PhalueObjects\DateTime\DateTimeInterface; |
|
6 | -use BestServedCold\PhalueObjects\DateTime\DateTimeTrait; |
|
7 | -use BestServedCold\PhalueObjects\Mathematical\Integer; |
|
5 | +use BestServedCold\PhalueObjects\DateTime\DateTimeInterface; |
|
6 | +use BestServedCold\PhalueObjects\DateTime\DateTimeTrait; |
|
7 | +use BestServedCold\PhalueObjects\Mathematical\Integer; |
|
8 | 8 | use BestServedCold\PhalueObjects\Mathematical\Range\RangeTrait; |
9 | 9 | |
10 | 10 | /** |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php namespace BestServedCold\PhalueObjects\File; |
2 | 2 | |
3 | +use BestServedCold\PhalueObjects\Access\Curl; |
|
3 | 4 | use BestServedCold\PhalueObjects\File; |
4 | -use BestServedCold\PhalueObjects\Access\Curl; |
|
5 | 5 | |
6 | 6 | 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 |
@@ -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 |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | |
19 | 19 | public function parse() |
20 | 20 | { |
21 | - return [$this->getValue()->documentElement->tagName => |
|
22 | - $this->convert($this->value->documentElement)]; |
|
21 | + return [ $this->getValue()->documentElement->tagName => |
|
22 | + $this->convert($this->value->documentElement) ]; |
|
23 | 23 | } |
24 | 24 | |
25 | - public function convert($node, $output = []) |
|
25 | + public function convert($node, $output = [ ]) |
|
26 | 26 | { |
27 | 27 | switch ($node->nodeType) { |
28 | 28 | case XML_CDATA_SECTION_NODE: |
29 | - $output['@cdata'] = trim($node->textContent); |
|
29 | + $output[ '@cdata' ] = trim($node->textContent); |
|
30 | 30 | break; |
31 | 31 | case XML_TEXT_NODE: |
32 | 32 | $output = trim($node->textContent); |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | |
48 | 48 | private function childNode($node) |
49 | 49 | { |
50 | - foreach($node->childNodes as $child) { |
|
50 | + foreach ($node->childNodes as $child) { |
|
51 | 51 | $children = $this->convert($child); |
52 | 52 | |
53 | - if(isset($child->tagName)) { |
|
53 | + if (isset($child->tagName)) { |
|
54 | 54 | $tagName = $child->tagName; |
55 | - $output[$tagName] = isset($output[$tagName]) |
|
56 | - ? $output[$tagName] |
|
57 | - : []; |
|
55 | + $output[ $tagName ] = isset($output[ $tagName ]) |
|
56 | + ? $output[ $tagName ] |
|
57 | + : [ ]; |
|
58 | 58 | |
59 | - $output[$tagName][] = $children; |
|
60 | - } elseif($children !== '') { |
|
59 | + $output[ $tagName ][ ] = $children; |
|
60 | + } elseif ($children !== '') { |
|
61 | 61 | $output = $children; |
62 | 62 | } |
63 | 63 | } |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | return $output; |
66 | 66 | } |
67 | 67 | |
68 | - private function loopAttributes($attributes, $array = []) |
|
68 | + private function loopAttributes($attributes, $array = [ ]) |
|
69 | 69 | { |
70 | 70 | // Loop through the attributes and collect them. |
71 | - foreach($attributes as $key => $node) { |
|
72 | - $array[$key] = (string) $node->value; |
|
71 | + foreach ($attributes as $key => $node) { |
|
72 | + $array[ $key ] = (string) $node->value; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $array; |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | private function attributes($node, $output) |
79 | 79 | { |
80 | 80 | // If there are attributes. |
81 | - if($node->attributes->length) { |
|
82 | - $output = is_array($output) ? $output : ['@value' => $output]; |
|
83 | - $output['@attributes'] = $this->loopAttributes($node->attributes); |
|
81 | + if ($node->attributes->length) { |
|
82 | + $output = is_array($output) ? $output : [ '@value' => $output ]; |
|
83 | + $output[ '@attributes' ] = $this->loopAttributes($node->attributes); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $output; |
87 | 87 | } |
88 | 88 | |
89 | - private function addChildNodes ($output) |
|
89 | + private function addChildNodes($output) |
|
90 | 90 | { |
91 | - if(is_array($output)) { |
|
91 | + if (is_array($output)) { |
|
92 | 92 | foreach ($output as $key => $value) { |
93 | - $output[$key] = is_array($value) && count($value) === 1 |
|
94 | - ? $value[0] |
|
93 | + $output[ $key ] = is_array($value) && count($value) === 1 |
|
94 | + ? $value[ 0 ] |
|
95 | 95 | : $value; |
96 | 96 | } |
97 | 97 |