Passed
Push — master ( dc389c...49a2c9 )
by Thomas
11:35
created
app/Console/Commands/genderizeStudents.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     protected $description = 'Guess gender for existing students, based on their firstname';
14 14
 
15 15
     // wordpress implementation, from https://github.com/WordPress/WordPress/blob/a2693fd8602e3263b5925b9d799ddd577202167d/wp-includes/formatting.php#L1528
16
-    private function remove_accents( $string ) {
16
+    private function remove_accents($string) {
17 17
 
18 18
 		$chars = array(
19 19
 		// Decompositions for Latin-1 Supplement
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		'À' => 'A', 'Á' => 'A',
22 22
 		'Â' => 'A', 'Ã' => 'A',
23 23
 		'Ä' => 'A', 'Å' => 'A',
24
-		'Æ' => 'AE','Ç' => 'C',
24
+		'Æ' => 'AE', 'Ç' => 'C',
25 25
 		'È' => 'E', 'É' => 'E',
26 26
 		'Ê' => 'E', 'Ë' => 'E',
27 27
 		'Ì' => 'I', 'Í' => 'I',
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 		'Ö' => 'O', 'Ù' => 'U',
33 33
 		'Ú' => 'U', 'Û' => 'U',
34 34
 		'Ü' => 'U', 'Ý' => 'Y',
35
-		'Þ' => 'TH','ß' => 's',
35
+		'Þ' => 'TH', 'ß' => 's',
36 36
 		'à' => 'a', 'á' => 'a',
37 37
 		'â' => 'a', 'ã' => 'a',
38 38
 		'ä' => 'a', 'å' => 'a',
39
-		'æ' => 'ae','ç' => 'c',
39
+		'æ' => 'ae', 'ç' => 'c',
40 40
 		'è' => 'e', 'é' => 'e',
41 41
 		'ê' => 'e', 'ë' => 'e',
42 42
 		'ì' => 'i', 'í' => 'i',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		'Ĭ' => 'I', 'ĭ' => 'i',
76 76
 		'Į' => 'I', 'į' => 'i',
77 77
 		'İ' => 'I', 'ı' => 'i',
78
-		'IJ' => 'IJ','ij' => 'ij',
78
+		'IJ' => 'IJ', 'ij' => 'ij',
79 79
 		'Ĵ' => 'J', 'ĵ' => 'j',
80 80
 		'Ķ' => 'K', 'ķ' => 'k',
81 81
 		'ĸ' => 'k', 'Ĺ' => 'L',
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 		'Ō' => 'O', 'ō' => 'o',
92 92
 		'Ŏ' => 'O', 'ŏ' => 'o',
93 93
 		'Ő' => 'O', 'ő' => 'o',
94
-		'Œ' => 'OE','œ' => 'oe',
95
-		'Ŕ' => 'R','ŕ' => 'r',
96
-		'Ŗ' => 'R','ŗ' => 'r',
97
-		'Ř' => 'R','ř' => 'r',
98
-		'Ś' => 'S','ś' => 's',
99
-		'Ŝ' => 'S','ŝ' => 's',
100
-		'Ş' => 'S','ş' => 's',
94
+		'Œ' => 'OE', 'œ' => 'oe',
95
+		'Ŕ' => 'R', 'ŕ' => 'r',
96
+		'Ŗ' => 'R', 'ŗ' => 'r',
97
+		'Ř' => 'R', 'ř' => 'r',
98
+		'Ś' => 'S', 'ś' => 's',
99
+		'Ŝ' => 'S', 'ŝ' => 's',
100
+		'Ş' => 'S', 'ş' => 's',
101 101
 		'Š' => 'S', 'š' => 's',
102 102
 		'Ţ' => 'T', 'ţ' => 't',
103 103
 		'Ť' => 'T', 'ť' => 't',
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 
198 198
     public function handle()
199 199
     {
200
-        Student::whereNull('gender_id')->chunkById(10, function ($students) {
200
+        Student::whereNull('gender_id')->chunkById(10, function($students) {
201 201
             $query = $students->map(fn($student) => ['id' => $student->id, 'name' => $this->remove_accents(strtok($student->firstname, " "))]);
202 202
 
203
-            $response = Http::get('https://api.genderize.io/?name[]=' . $query->pluck('name')->implode('&name[]='));
203
+            $response = Http::get('https://api.genderize.io/?name[]='.$query->pluck('name')->implode('&name[]='));
204 204
             foreach ($students as $student) {
205 205
                 $firstname = $query->firstWhere('id', $student->id)['name'];
206 206
 
Please login to merge, or discard this patch.