Passed
Pull Request — master (#24)
by
unknown
03:48
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 $delimiter = ",";
22 22
 	public static $skipsEmptyLines = true;
23 23
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	public function each(callable $function)
32 32
 	{
33 33
 		$this->start();
34
-		while($this->read()){
35
-			if($this->currentLineIsValid()){
34
+		while ($this->read()) {
35
+			if ($this->currentLineIsValid()) {
36 36
 				$function($this->getCurrentLineAsCollection());
37 37
 			}
38 38
 		}
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 		return $this;
50 50
 	}
51 51
 
52
-	private function close(){
53
-		if( ! fclose($this->reader)){
52
+	private function close() {
53
+		if ( ! fclose($this->reader)) {
54 54
 			throw new IncompleteParseException();
55 55
 		}
56 56
 	}
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	private function currentLineIsValid(): bool{
66
-		if(static::$skipsEmptyLines){
66
+		if (static::$skipsEmptyLines) {
67 67
 			return ! $this->currentLineIsEmpty();
68 68
 		}
69 69
 
70 70
 		return true;
71 71
 	}
72 72
 
73
-	private function currentLineIsEmpty(){
74
-		return $this->currentLine->reject(function($value){
73
+	private function currentLineIsEmpty() {
74
+		return $this->currentLine->reject(function($value) {
75 75
 			return $this->isEmptyValue($value);
76 76
 		})->isEmpty();
77 77
 	}
78 78
 
79
-	private function isEmptyValue($value){
79
+	private function isEmptyValue($value) {
80 80
 		return $value === "" || $value === null;
81 81
 	}
82 82
 
@@ -87,25 +87,25 @@  discard block
 block discarded – undo
87 87
 
88 88
 		return $headers->intersectByKeys($this->currentLine)
89 89
 			->combine($values->recursive())
90
-			->reject(function($value){
90
+			->reject(function($value) {
91 91
 				return $this->isEmptyValue($value);
92 92
 			});
93 93
 	}
94 94
 
95
-	private function formatCurrentLineValues(Collection $collection){
95
+	private function formatCurrentLineValues(Collection $collection) {
96 96
 		$this->explodeCollectionValues($collection);
97 97
 		return $collection;
98 98
 	}
99 99
 
100
-	private function explodeCollectionValues(Collection $collection){
101
-		$collection->transform(function($value){
100
+	private function explodeCollectionValues(Collection $collection) {
101
+		$collection->transform(function($value) {
102 102
 			(new Collection(static::$delimiters))->each(function($delimiter) use (&$value){
103
-				if( ! is_array($value) && strpos($value, $delimiter) !== false){
103
+				if ( ! is_array($value) && strpos($value, $delimiter) !== false) {
104 104
 					$value = explode($delimiter, $value);
105 105
 				}
106 106
 			});
107
-			if(is_array($value)){
108
-				return (new Collection($value))->reject(function($value){
107
+			if (is_array($value)) {
108
+				return (new Collection($value))->reject(function($value) {
109 109
 					return $this->isEmptyValue($value);
110 110
 				});
111 111
 			} else {
Please login to merge, or discard this patch.