Passed
Pull Request — master (#7)
by
unknown
02:07
created
src/Parsers/CSVParser.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  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
 
22 22
 	public static $allowEmptyString = false;
23 23
 
24 24
 	public function __construct()
25 25
 	{
26
-		Collection::macro('recursive', function () {
27
-			return $this->map(function ($value) {
26
+		Collection::macro('recursive', function() {
27
+			return $this->map(function($value) {
28 28
 				if (is_array($value) || is_object($value)) {
29 29
 					return (new Collection($value))->recursive();
30 30
 				}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	public function each(callable $function)
44 44
 	{
45 45
 		$this->start();
46
-		while($this->read()){
46
+		while ($this->read()) {
47 47
 			$function($this->getCurrentLineAsCollection());
48 48
 		}
49 49
 		$this->close();
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		return $this;
60 60
 	}
61 61
 
62
-	private function close(){
63
-		if( ! fclose($this->reader)){
62
+	private function close() {
63
+		if ( ! fclose($this->reader)) {
64 64
 			throw new IncompleteParseException();
65 65
 		}
66 66
 	}
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
 			$line = fgetcsv($this->reader);
71 71
 
72 72
 			$this->currentLine = (new Collection($line))->filter(function($value) {
73
-				if(!self::$allowEmptyString && $value === '') {
73
+				if ( ! self::$allowEmptyString && $value === '') {
74 74
 					return false;
75 75
 				}
76 76
 
77 77
 				return $value !== null && $value !== false;
78 78
 			});
79 79
 
80
-			if($this->currentLine->isNotEmpty()) {
80
+			if ($this->currentLine->isNotEmpty()) {
81 81
 				return true;
82 82
 			}
83
-		} while($line !== null && $line !== false);
83
+		} while ($line !== null && $line !== false);
84 84
 
85 85
 		return false;
86 86
 	}
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 		return $headers->intersectByKeys($this->currentLine)->combine($values->recursive());
94 94
 	}
95 95
 
96
-	private function formatCurrentLineValues(Collection $collection){
96
+	private function formatCurrentLineValues(Collection $collection) {
97 97
 		$this->explodeCollectionValues($collection);
98 98
 		return $collection;
99 99
 	}
100 100
 
101
-	private function explodeCollectionValues(Collection $collection){
102
-		$collection->transform(function($value){
101
+	private function explodeCollectionValues(Collection $collection) {
102
+		$collection->transform(function($value) {
103 103
 			(new Collection(static::$delimiters))->each(function($delimiter) use (&$value){
104
-				if( ! is_array($value) && strpos($value, $delimiter) !== false){
104
+				if ( ! is_array($value) && strpos($value, $delimiter) !== false) {
105 105
 					$value = explode($delimiter, $value);
106 106
 				}
107 107
 			});
108
-			if(is_array($value)){
109
-				return (new Collection($value))->reject(function($value){
108
+			if (is_array($value)) {
109
+				return (new Collection($value))->reject(function($value) {
110 110
 					return $value === null || $value === false || $value === '';
111 111
 				});
112 112
 			} else {
Please login to merge, or discard this patch.