Passed
Push — master ( 1ed9d2...698c63 )
by Sergio
01:13
created
src/Parsers/CSVParser.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 {
18 18
 	protected $reader, $source, $headers, $currentLine;
19 19
 
20
-	public static $delimiters = [",", ";"];
20
+	public static $delimiters = [ ",", ";" ];
21 21
 	public static $skipsEmptyLines = true;
22 22
 
23 23
 	public function from(String $source): StreamParserInterface
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	public function each(callable $function)
31 31
 	{
32 32
 		$this->start();
33
-		while($this->read()){
34
-			if($this->currentLineIsValid()){
33
+		while ($this->read()) {
34
+			if ($this->currentLineIsValid()) {
35 35
 				$function($this->getCurrentLineAsCollection());
36 36
 			}
37 37
 		}
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		return $this;
49 49
 	}
50 50
 
51
-	private function close(){
52
-		if( ! fclose($this->reader)){
51
+	private function close() {
52
+		if ( ! fclose($this->reader)) {
53 53
 			throw new IncompleteParseException();
54 54
 		}
55 55
 	}
@@ -62,20 +62,20 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	private function currentLineIsValid(): bool{
65
-		if(static::$skipsEmptyLines){
65
+		if (static::$skipsEmptyLines) {
66 66
 			return ! $this->currentLineIsEmpty();
67 67
 		}
68 68
 
69 69
 		return true;
70 70
 	}
71 71
 
72
-	private function currentLineIsEmpty(){
73
-		return $this->currentLine->reject(function($value){
72
+	private function currentLineIsEmpty() {
73
+		return $this->currentLine->reject(function($value) {
74 74
 			return $this->isEmptyValue($value);
75 75
 		})->isEmpty();
76 76
 	}
77 77
 
78
-	private function isEmptyValue($value){
78
+	private function isEmptyValue($value) {
79 79
 		return $value === "" || $value === null;
80 80
 	}
81 81
 
@@ -86,25 +86,25 @@  discard block
 block discarded – undo
86 86
 
87 87
 		return $headers->intersectByKeys($this->currentLine)
88 88
 			->combine($values->recursive())
89
-			->reject(function($value){
89
+			->reject(function($value) {
90 90
 				return $this->isEmptyValue($value);
91 91
 			});
92 92
 	}
93 93
 
94
-	private function formatCurrentLineValues(Collection $collection){
94
+	private function formatCurrentLineValues(Collection $collection) {
95 95
 		$this->explodeCollectionValues($collection);
96 96
 		return $collection;
97 97
 	}
98 98
 
99
-	private function explodeCollectionValues(Collection $collection){
100
-		$collection->transform(function($value){
99
+	private function explodeCollectionValues(Collection $collection) {
100
+		$collection->transform(function($value) {
101 101
 			(new Collection(static::$delimiters))->each(function($delimiter) use (&$value){
102
-				if( ! is_array($value) && strpos($value, $delimiter) !== false){
102
+				if ( ! is_array($value) && strpos($value, $delimiter) !== false) {
103 103
 					$value = explode($delimiter, $value);
104 104
 				}
105 105
 			});
106
-			if(is_array($value)){
107
-				return (new Collection($value))->reject(function($value){
106
+			if (is_array($value)) {
107
+				return (new Collection($value))->reject(function($value) {
108 108
 					return $this->isEmptyValue($value);
109 109
 				});
110 110
 			} else {
Please login to merge, or discard this patch.
src/StreamParser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 	private function __construct()
23 23
 	{
24
-		Collection::macro('recursive', function () {
25
-			return $this->map(function ($value) {
24
+		Collection::macro('recursive', function() {
25
+			return $this->map(function($value) {
26 26
 				if (is_array($value) || is_object($value)) {
27 27
 					return (new Collection($value))->recursive();
28 28
 				}
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 		});
32 32
 	}
33 33
 
34
-	private function xml(String $source){
34
+	private function xml(String $source) {
35 35
 		return (new XMLParser())->from($source);
36 36
 	}
37 37
 
38
-	private function json(String $source){
38
+	private function json(String $source) {
39 39
 		return (new JSONParser())->from($source);
40 40
 	}
41 41
 
42
-	private function csv(String $source){
42
+	private function csv(String $source) {
43 43
 		return (new CSVParser())->from($source);
44 44
 	}
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.