Completed
Pull Request — master (#1854)
by Rico
09:04
created
app/Http/Controllers/BranchesController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
     public function page(Request $request): Response
44 44
     {
45 45
         $surname     = $request->get('surname', '');
46
-        $soundex_std = (bool)$request->get('soundex_std');
47
-        $soundex_dm  = (bool)$request->get('soundex_dm');
46
+        $soundex_std = (bool) $request->get('soundex_std');
47
+        $soundex_dm  = (bool) $request->get('soundex_dm');
48 48
 
49 49
         if ($surname !== '') {
50 50
             /* I18N: %s is a surname */
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function list(Request $request, Tree $tree, User $user): Response
73 73
     {
74
-        $soundex_dm  = (bool)$request->get('soundex_dm');
75
-        $soundex_std = (bool)$request->get('soundex_std');
74
+        $soundex_dm  = (bool) $request->get('soundex_dm');
75
+        $soundex_std = (bool) $request->get('soundex_std');
76 76
         $surname     = $request->get('surname', '');
77 77
 
78 78
         // Highlight direct-line ancestors of this individual.
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             $sdx = Soundex::russell($surname);
161 161
             if ($sdx !== '') {
162 162
                 foreach (explode(':', $sdx) as $value) {
163
-                    $sql    .= " OR n_soundex_surn_std LIKE CONCAT('%', ?, '%')";
163
+                    $sql .= " OR n_soundex_surn_std LIKE CONCAT('%', ?, '%')";
164 164
                     $args[] = $value;
165 165
                 }
166 166
             }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             $sdx = Soundex::daitchMokotoff($surname);
171 171
             if ($sdx !== '') {
172 172
                 foreach (explode(':', $sdx) as $value) {
173
-                    $sql    .= " OR n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
173
+                    $sql .= " OR n_soundex_surn_dm LIKE CONCAT('%', ?, '%')";
174 174
                     $args[] = $value;
175 175
                 }
176 176
             }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      */
341 341
     private static function sosaGeneration($sosa)
342 342
     {
343
-        $generation = (int)log($sosa, 2) + 1;
343
+        $generation = (int) log($sosa, 2) + 1;
344 344
 
345 345
         return '<sup title="' . I18N::translate('Generation') . '">' . $generation . '</sup>';
346 346
     }
Please login to merge, or discard this patch.
app/Module/BatchUpdate/BatchUpdateSearchReplacePlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@
 block discarded – undo
175 175
             'words'     => I18N::translate('Match the exact text, unless it occurs in the middle of a word.'),
176 176
             'wildcards' => I18N::translate('Use a “?” to match a single character, use “*” to match zero or more characters.'),
177 177
             /* I18N: http://en.wikipedia.org/wiki/Regular_expression */
178
-            'regex'     => I18N::translate('Regular expressions are an advanced pattern matching technique.') . '<br>' .  I18N::translate('See %s for more information.', '<a href="http://php.net/manual/regexp.reference.php">php.net/manual/regexp.reference.php</a>'),
178
+            'regex'     => I18N::translate('Regular expressions are an advanced pattern matching technique.') . '<br>' . I18N::translate('See %s for more information.', '<a href="http://php.net/manual/regexp.reference.php">php.net/manual/regexp.reference.php</a>'),
179 179
         ];
180 180
 
181 181
         return
Please login to merge, or discard this patch.
app/Http/Controllers/LifespansChartController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $this->checkModuleIsActive($tree, 'lifespans_chart');
54 54
 
55
-        $xrefs     = (array)$request->get('xrefs', []);
55
+        $xrefs     = (array) $request->get('xrefs', []);
56 56
         $addxref   = $request->get('addxref', '');
57
-        $addfam    = (bool)$request->get('addfam', false);
57
+        $addfam    = (bool) $request->get('addfam', false);
58 58
         $placename = $request->get('placename', '');
59 59
         $start     = $request->get('start', '');
60 60
         $end       = $request->get('end', '');
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $this->checkModuleIsActive($tree, 'lifespans_chart');
113 113
 
114
-        $xrefs = (array)$request->get('xrefs', []);
114
+        $xrefs = (array) $request->get('xrefs', []);
115 115
         $xrefs = array_unique($xrefs);
116 116
 
117 117
         /** @var Individual[] $individuals */
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
         $subtitle = $request->get('subtitle');
132 132
 
133 133
         // Round to whole decades
134
-        $start_year = (int)floor($this->minYear($individuals) / 10) * 10;
135
-        $end_year   = (int)ceil($this->maxYear($individuals) / 10) * 10;
134
+        $start_year = (int) floor($this->minYear($individuals) / 10) * 10;
135
+        $end_year   = (int) ceil($this->maxYear($individuals) / 10) * 10;
136 136
 
137 137
         $lifespans = $this->layoutIndividuals($individuals);
138 138
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             'U' => new ColorGenerator(120, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE),
168 168
         ];
169 169
 
170
-        $current_year = (int)date('Y');
170
+        $current_year = (int) date('Y');
171 171
 
172 172
         // Latest year used in each row
173 173
         $rows = [];
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             // Fill the row up to the year (leaving a small gap)
197 197
             $rows[$next_row] = $death_year;
198 198
 
199
-            $lifespans[] = (object)[
199
+            $lifespans[] = (object) [
200 200
                 'background' => $colors[$individual->getSex()]->getNextColor(),
201 201
                 'birth_year' => $birth_year,
202 202
                 'death_year' => $death_year,
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $year = $this->jdToYear($jd);
226 226
 
227 227
         // Don't show future dates
228
-        return min($year, (int)date('Y'));
228
+        return min($year, (int) date('Y'));
229 229
     }
230 230
 
231 231
     /**
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/RegisterController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             ->setPreference('sessiontime', '0');
119 119
 
120 120
         // Create a dummy user, so we can send messages from the tree.
121
-        $sender = new User((object)[
121
+        $sender = new User((object) [
122 122
             'user_id'   => null,
123 123
             'user_name' => '',
124 124
             'real_name' => $tree->getTitle(),
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         );
138 138
 
139 139
         // Tell the genealogy contact about the registration.
140
-        $webmaster = User::find((int)$tree->getPreference('WEBMASTER_USER_ID'));
140
+        $webmaster = User::find((int) $tree->getPreference('WEBMASTER_USER_ID'));
141 141
 
142 142
         if ($webmaster !== null) {
143 143
             I18N::init($webmaster->getPreference('language'));
Please login to merge, or discard this patch.
app/Census/CensusColumnAge.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,6 +34,6 @@
 block discarded – undo
34 34
      */
35 35
     public function generate(Individual $individual, Individual $head)
36 36
     {
37
-        return (string)Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
37
+        return (string) Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
app/Theme/AbstractTheme.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
     {
215 215
         if ($analytics_id) {
216 216
             // Add extra dimensions (i.e. filtering categories)
217
-            $dimensions = (object)[
217
+            $dimensions = (object) [
218 218
                 'dimension1' => $this->tree ? $this->tree->getName() : '-',
219 219
                 'dimension2' => $this->tree ? Auth::accessLevel($this->tree) : '-',
220 220
             ];
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         if ($project_id && $security_id) {
277 277
             return
278 278
                 '<script>' .
279
-                'var sc_project=' . (int)$project_id . ',sc_invisible=1,sc_security="' . $security_id .
279
+                'var sc_project=' . (int) $project_id . ',sc_invisible=1,sc_security="' . $security_id .
280 280
                 '",scJsHost = (("https:"===document.location.protocol)?"https://secure.":"http://www.");' .
281 281
                 'document.write("<sc"+"ript src=\'"+scJsHost+"statcounter.com/counter/counter.js\'></"+"script>");' .
282 282
                 '</script>';
@@ -1803,7 +1803,7 @@  discard block
 block discarded – undo
1803 1803
     public function menuSearchPhonetic()
1804 1804
     {
1805 1805
         /* I18N: search using “sounds like”, rather than exact spelling */
1806
-        return new Menu(I18N::translate('Phonetic search'), route('search-phonetic', ['ged'    => $this->tree->getName(), 'action' => 'soundex',]), 'menu-search-soundex', ['rel' => 'nofollow']);
1806
+        return new Menu(I18N::translate('Phonetic search'), route('search-phonetic', ['ged'    => $this->tree->getName(), 'action' => 'soundex', ]), 'menu-search-soundex', ['rel' => 'nofollow']);
1807 1807
     }
1808 1808
 
1809 1809
     /**
Please login to merge, or discard this patch.
app/Individual.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         // Dead people...
124 124
         if ($this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
125 125
             $keep_alive             = false;
126
-            $KEEP_ALIVE_YEARS_BIRTH = (int)$this->tree->getPreference('KEEP_ALIVE_YEARS_BIRTH');
126
+            $KEEP_ALIVE_YEARS_BIRTH = (int) $this->tree->getPreference('KEEP_ALIVE_YEARS_BIRTH');
127 127
             if ($KEEP_ALIVE_YEARS_BIRTH) {
128 128
                 preg_match_all('/\n1 (?:' . WT_EVENTS_BIRT . ').*(?:\n[2-9].*)*(?:\n2 DATE (.+))/', $this->gedcom, $matches, PREG_SET_ORDER);
129 129
                 foreach ($matches as $match) {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                     }
135 135
                 }
136 136
             }
137
-            $KEEP_ALIVE_YEARS_DEATH = (int)$this->tree->getPreference('KEEP_ALIVE_YEARS_DEATH');
137
+            $KEEP_ALIVE_YEARS_DEATH = (int) $this->tree->getPreference('KEEP_ALIVE_YEARS_DEATH');
138 138
             if ($KEEP_ALIVE_YEARS_DEATH) {
139 139
                 preg_match_all('/\n1 (?:' . WT_EVENTS_DEAT . ').*(?:\n[2-9].*)*(?:\n2 DATE (.+))/', $this->gedcom, $matches, PREG_SET_ORDER);
140 140
                 foreach ($matches as $match) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             }
151 151
         }
152 152
         // Consider relationship privacy (unless an admin is applying download restrictions)
153
-        $user_path_length = (int)$this->tree->getUserPreference(Auth::user(), 'RELATIONSHIP_PATH_LENGTH');
153
+        $user_path_length = (int) $this->tree->getUserPreference(Auth::user(), 'RELATIONSHIP_PATH_LENGTH');
154 154
         $gedcomid         = $this->tree->getUserPreference(Auth::user(), 'gedcomid');
155 155
         if ($gedcomid !== '' && $user_path_length > 0) {
156 156
             return self::isRelated($this, $user_path_length);
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function isDead()
324 324
     {
325
-        $MAX_ALIVE_AGE = (int)$this->tree->getPreference('MAX_ALIVE_AGE');
325
+        $MAX_ALIVE_AGE = (int) $this->tree->getPreference('MAX_ALIVE_AGE');
326 326
 
327 327
         // "1 DEAT Y" or "1 DEAT/2 DATE" or "1 DEAT/2 PLAC"
328 328
         if (preg_match('/\n1 (?:' . WT_EVENTS_DEAT . ')(?: Y|(?:\n[2-9].+)*\n2 (DATE|PLAC) )/', $this->gedcom)) {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
                 if ($min && $max) {
712 712
                     $gregorian_calendar = new GregorianCalendar();
713 713
 
714
-                    list($year) = $gregorian_calendar->jdToYmd((int)((max($min) + min($max)) / 2));
714
+                    list($year) = $gregorian_calendar->jdToYmd((int) ((max($min) + min($max)) / 2));
715 715
                     $this->estimated_birth_date = new Date('EST ' . $year);
716 716
                 } else {
717 717
                     $this->estimated_birth_date = new Date(''); // always return a date object
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
             }
739 739
             if ($this->estimated_death_date === null) {
740 740
                 if ($this->getEstimatedBirthDate()->minimumJulianDay()) {
741
-                    $max_alive_age              = (int)$this->tree->getPreference('MAX_ALIVE_AGE');
741
+                    $max_alive_age              = (int) $this->tree->getPreference('MAX_ALIVE_AGE');
742 742
                     $this->estimated_death_date = $this->getEstimatedBirthDate()->addYears($max_alive_age, 'BEF');
743 743
                 } else {
744 744
                     $this->estimated_death_date = new Date(''); // always return a date object
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
         if ($display) {
1107 1107
             $txt .= ' style="display:' . $display . '"';
1108 1108
         }
1109
-        $txt  .= '>';
1109
+        $txt .= '>';
1110 1110
         $husb = $fam->getHusband();
1111 1111
         if ($husb) {
1112 1112
             // Temporarily reset the 'prefered' display name, as we always
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
         // Extract the structured name parts - use for "sortable" names and indexes
1174 1174
         ////////////////////////////////////////////////////////////////////////////
1175 1175
 
1176
-        $sublevel = 1 + (int)$gedcom[0];
1176
+        $sublevel = 1 + (int) $gedcom[0];
1177 1177
         $NPFX     = preg_match("/\n{$sublevel} NPFX (.+)/", $gedcom, $match) ? $match[1] : '';
1178 1178
         $GIVN     = preg_match("/\n{$sublevel} GIVN (.+)/", $gedcom, $match) ? $match[1] : '';
1179 1179
         $SURN     = preg_match("/\n{$sublevel} SURN (.+)/", $gedcom, $match) ? $match[1] : '';
Please login to merge, or discard this patch.
app/Module/PedigreeMapModule.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class PedigreeMapModule extends AbstractModule implements ModuleChartInterface
37 37
 {
38
-    const LINE_COLORS  = [
38
+    const LINE_COLORS = [
39 39
         '#FF0000',
40 40
         // Red
41 41
         '#00FF00',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                     $color            = self::LINE_COLORS[log($id, 2) % $color_count];
141 141
                     $icon['color']    = $color; //make icon color the same as the line
142 142
                     $sosa_points[$id] = $event->getLatLonJSArray();
143
-                    $sosa_parent      = (int)floor($id / 2);
143
+                    $sosa_parent      = (int) floor($id / 2);
144 144
                     if (array_key_exists($sosa_parent, $sosa_points)) {
145 145
                         // Would like to use a GeometryCollection to hold LineStrings
146 146
                         // rather than generate polylines but the MarkerCluster library
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                             'icon'     => $icon,
169 169
                             'tooltip'  => $event->toolTip(),
170 170
                             'summary'  => view('modules/pedigree-map/event-sidebar', $event->shortSummary('pedigree', $id)),
171
-                            'zoom'     => (int)$event->getZoom(),
171
+                            'zoom'     => (int) $event->getZoom(),
172 172
                         ],
173 173
                     ];
174 174
                 }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     {
189 189
         $xref        = $request->get('reference');
190 190
         $individual  = Individual::getInstance($xref, $tree);
191
-        $generations = (int)$request->get(
191
+        $generations = (int) $request->get(
192 192
             'generations',
193 193
             $tree->getPreference('DEFAULT_PEDIGREE_GENERATIONS')
194 194
         );
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
                         function ($item) {
242 242
                             return preg_replace('/[^a-z\d]/i', '', strtolower($item));
243 243
                         },
244
-                        (array)$provider->styles
244
+                        (array) $provider->styles
245 245
                     );
246 246
 
247
-                    $key = preg_replace('/[^a-z\d]/i', '', strtolower((string)$provider->name));
247
+                    $key = preg_replace('/[^a-z\d]/i', '', strtolower((string) $provider->name));
248 248
 
249 249
                     self::$map_providers[$key] = [
250
-                        'name'   => (string)$provider->name,
251
-                        'styles' => array_combine($style_keys, (array)$provider->styles),
250
+                        'name'   => (string) $provider->name,
251
+                        'styles' => array_combine($style_keys, (array) $provider->styles),
252 252
                     ];
253 253
                 }
254 254
             } catch (Exception $ex) {
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                     'provider' => 'openstreetmap',
258 258
                     'style'    => 'mapnik',
259 259
                 ];
260
-                self::$map_providers  = [
260
+                self::$map_providers = [
261 261
                     'openstreetmap' => [
262 262
                         'name'   => 'OpenStreetMap',
263 263
                         'styles' => ['mapnik' => 'Mapnik'],
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             throw new IndividualAccessDeniedException();
319 319
         }
320 320
         
321
-        return (object)[
321
+        return (object) [
322 322
             'name' => 'modules/pedigree-map/pedigree-map-page',
323 323
             'data' => [
324 324
                 'module'         => $this->getName(),
Please login to merge, or discard this patch.
app/Database.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,8 +88,7 @@  discard block
 block discarded – undo
88 88
         self::$table_prefix = $config['tblpfx'];
89 89
 
90 90
         $dsn = (substr($config['dbhost'], 0, 1) === '/' ?
91
-            "mysql:unix_socket='{$config['dbhost']};dbname={$config['dbname']}" :
92
-            "mysql:host={$config['dbhost']};dbname={$config['dbname']};port={$config['dbport']}"
91
+            "mysql:unix_socket='{$config['dbhost']};dbname={$config['dbname']}" : "mysql:host={$config['dbhost']};dbname={$config['dbname']};port={$config['dbport']}"
93 92
         );
94 93
 
95 94
         // Create the underlying PDO object.
@@ -222,7 +221,7 @@  discard block
 block discarded – undo
222 221
     public static function updateSchema($namespace, $schema_name, $target_version)
223 222
     {
224 223
         try {
225
-            $current_version = (int)Site::getPreference($schema_name);
224
+            $current_version = (int) Site::getPreference($schema_name);
226 225
         } catch (PDOException $ex) {
227 226
             DebugBar::addThrowable($ex);
228 227
 
@@ -239,7 +238,7 @@  discard block
 block discarded – undo
239 238
             $migration = new $class();
240 239
             $migration->upgrade();
241 240
             $current_version++;
242
-            Site::setPreference($schema_name, (string)$current_version);
241
+            Site::setPreference($schema_name, (string) $current_version);
243 242
             $updates_applied = true;
244 243
         }
245 244
 
Please login to merge, or discard this patch.