Completed
Push — master ( 5da9ea...eef579 )
by Angel Fernando Quiroz
50:18 queued 17:36
created
src/Chamilo/InstallerBundle/Requirement/Requirement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
         $help = null
30 30
     ) {
31 31
         $this->label = $label;
32
-        $this->fulfilled = (Boolean)$fulfilled;
32
+        $this->fulfilled = (Boolean) $fulfilled;
33 33
         $this->expected = $expected;
34 34
         $this->actual = $actual;
35
-        $this->required = (Boolean)$required;
35
+        $this->required = (Boolean) $required;
36 36
         $this->help = $help;
37 37
     }
38 38
 
Please login to merge, or discard this patch.
src/Chamilo/InstallerBundle/Requirement/ExtensionsRequirements.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
             'requirements'
34 34
         );
35 35
 
36
-        $pcreVersion = defined('PCRE_VERSION') ? (float)PCRE_VERSION : null;
36
+        $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
37 37
 
38 38
         $this
39 39
             ->add(
Please login to merge, or discard this patch.
src/Chamilo/UserBundle/Form/UserType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
         // Update Author id
72 72
         $builder->addEventListener(
73 73
             FormEvents::POST_SUBMIT,
74
-            function (FormEvent $event) use ($currentUser) {
74
+            function(FormEvent $event) use ($currentUser) {
75 75
                 /** @var User $user */
76 76
                 $user = $event->getData();
77 77
                 $extraFields = $user->getExtrafields();
Please login to merge, or discard this patch.
app/ChamiloRequirements.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
         $this->addPhpIniRequirement(
169 169
             'memory_limit',
170
-            function ($cfgValue) use ($mem) {
170
+            function($cfgValue) use ($mem) {
171 171
                 return $mem >= 256 * 1024 * 1024 || -1 == $mem;
172 172
             },
173 173
             false,
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     {
302 302
         return array_filter(
303 303
             $this->getRequirements(),
304
-            function ($requirement) {
304
+            function($requirement) {
305 305
                 return !($requirement instanceof PhpIniRequirement)
306 306
                 && !($requirement instanceof ChamiloRequirement)
307 307
                 && !($requirement instanceof CliRequirement);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     {
319 319
         return array_filter(
320 320
             $this->getRequirements(),
321
-            function ($requirement) {
321
+            function($requirement) {
322 322
                 return $requirement instanceof PhpIniRequirement;
323 323
             }
324 324
         );
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     {
334 334
         return array_filter(
335 335
             $this->getRequirements(),
336
-            function ($requirement) {
336
+            function($requirement) {
337 337
                 return $requirement instanceof ChamiloRequirement;
338 338
             }
339 339
         );
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     {
347 347
         return array_filter(
348 348
             $this->getRequirements(),
349
-            function ($requirement) {
349
+            function($requirement) {
350 350
                 return $requirement instanceof CliRequirement;
351 351
             }
352 352
         );
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         preg_match('/([\-0-9]+)[\s]*([a-z]*)$/i', trim($val), $matches);
366 366
 
367 367
         if (isset($matches[1])) {
368
-            $val = (int)$matches[1];
368
+            $val = (int) $matches[1];
369 369
         }
370 370
 
371 371
         switch (strtolower($matches[2])) {
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             // no break
384 384
         }
385 385
 
386
-        return (float)$val;
386
+        return (float) $val;
387 387
     }
388 388
 
389 389
     /**
Please login to merge, or discard this patch.
main/inc/lib/exercise_show_functions.lib.php 4 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -434,8 +434,7 @@
 block discarded – undo
434 434
             } else {
435 435
                 echo $question->options[2];
436 436
             }
437
-        }
438
-        else {
437
+        } else {
439 438
             echo '-';
440 439
         }
441 440
         ?>
Please login to merge, or discard this patch.
Doc Comments   +33 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,6 +72,11 @@  discard block
 block discarded – undo
72 72
      * @param string    Answer text
73 73
      * @param int       Exercise ID
74 74
      * @param int       Question ID
75
+     * @param integer $feedback_type
76
+     * @param string $answer
77
+     * @param integer $id
78
+     * @param integer $questionId
79
+     * @param boolean|string $showTotalScoreAndUserChoices
75 80
      * @return void
76 81
      */
77 82
     public static function display_calculated_answer(
@@ -111,6 +116,9 @@  discard block
 block discarded – undo
111 116
      * @param string    Answer text
112 117
      * @param int       Exercise ID
113 118
      * @param int       Question ID
119
+     * @param integer $feedback_type
120
+     * @param integer $exe_id
121
+     * @param integer $questionId
114 122
      * @return void
115 123
      */
116 124
     public static function display_free_answer(
@@ -140,11 +148,10 @@  discard block
 block discarded – undo
140 148
     }
141 149
 
142 150
     /**
143
-    * @param $feedback_type
151
+    * @param integer $feedback_type
144 152
     * @param $answer
145
-    * @param $id
146
-    * @param $questionId
147
-    * @param null $nano
153
+    * @param integer $id
154
+    * @param integer $questionId
148 155
     * @param int $results_disabled
149 156
      */
150 157
     public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $fileUrl = null, $results_disabled = 0)
@@ -194,6 +201,7 @@  discard block
 block discarded – undo
194 201
      * @param string $answerComment
195 202
      * @param int $resultsDisabled
196 203
      * @param int $orderColor
204
+     * @param boolean $showTotalScoreAndUserChoices
197 205
      */
198 206
     public static function display_hotspot_answer(
199 207
         $feedback_type,
@@ -375,6 +383,14 @@  discard block
 block discarded – undo
375 383
      * @param integer Exercise ID
376 384
      * @param integer Question ID
377 385
      * @param boolean Whether to show the answer comment or not
386
+     * @param integer $feedback_type
387
+     * @param integer $answerType
388
+     * @param string $answer
389
+     * @param string $answerComment
390
+     * @param integer $answerCorrect
391
+     * @param integer $id
392
+     * @param integer $questionId
393
+     * @param boolean $showTotalScoreAndUserChoices
378 394
      * @return void
379 395
      */
380 396
     public static function display_multiple_answer_true_false(
@@ -479,6 +495,14 @@  discard block
 block discarded – undo
479 495
      * @param integer Exercise ID
480 496
      * @param integer Question ID
481 497
      * @param boolean Whether to show the answer comment or not
498
+     * @param integer $feedback_type
499
+     * @param integer $answerType
500
+     * @param string $answer
501
+     * @param string $answerComment
502
+     * @param integer $answerCorrect
503
+     * @param integer $id
504
+     * @param integer $questionId
505
+     * @param boolean $showTotalScoreAndUserChoices
482 506
      * @return void
483 507
      */
484 508
     public static function display_multiple_answer_combination_true_false(
@@ -571,6 +595,11 @@  discard block
 block discarded – undo
571 595
         <?php
572 596
     }
573 597
 
598
+    /**
599
+     * @param integer $feedback_type
600
+     * @param integer $exe_id
601
+     * @param integer $questionId
602
+     */
574 603
     public static function displayAnnotationAnswer(
575 604
         $feedback_type,
576 605
         $exe_id,
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
     }
141 141
 
142 142
     /**
143
-    * @param $feedback_type
144
-    * @param $answer
145
-    * @param $id
146
-    * @param $questionId
147
-    * @param null $nano
148
-    * @param int $results_disabled
143
+     * @param $feedback_type
144
+     * @param $answer
145
+     * @param $id
146
+     * @param $questionId
147
+     * @param null $nano
148
+     * @param int $results_disabled
149 149
      */
150 150
     public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $fileUrl = null, $results_disabled = 0)
151 151
     {
@@ -468,19 +468,19 @@  discard block
 block discarded – undo
468 468
         <?php
469 469
     }
470 470
 
471
-     /**
472
-     * Display the answers to a multiple choice question
473
-     *
474
-     * @param integer Answer type
475
-     * @param integer Student choice
476
-     * @param string  Textual answer
477
-     * @param string  Comment on answer
478
-     * @param string  Correct answer comment
479
-     * @param integer Exercise ID
480
-     * @param integer Question ID
481
-     * @param boolean Whether to show the answer comment or not
482
-     * @return void
483
-     */
471
+        /**
472
+         * Display the answers to a multiple choice question
473
+         *
474
+         * @param integer Answer type
475
+         * @param integer Student choice
476
+         * @param string  Textual answer
477
+         * @param string  Comment on answer
478
+         * @param string  Correct answer comment
479
+         * @param integer Exercise ID
480
+         * @param integer Question ID
481
+         * @param boolean Whether to show the answer comment or not
482
+         * @return void
483
+         */
484 484
     public static function display_multiple_answer_combination_true_false(
485 485
         $feedback_type,
486 486
         $answerType,
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
             <?php
548 548
             //@todo replace this harcoded value
549 549
             if ($studentChoice) {
550
-                 $color = "black";
550
+                    $color = "black";
551 551
                 if ($studentChoice == $answerCorrect) {
552 552
                     $color = "green";
553 553
                 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -309,11 +309,11 @@
 block discarded – undo
309 309
             }
310 310
         }
311 311
 
312
-        $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox';
313
-        $icon .= $studentChoice?'_on':'_off';
312
+        $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox';
313
+        $icon .= $studentChoice ? '_on' : '_off';
314 314
         $icon .= '.gif';
315
-        $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox';
316
-        $iconAnswer .= $answerCorrect?'_on':'_off';
315
+        $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox';
316
+        $iconAnswer .= $answerCorrect ? '_on' : '_off';
317 317
         $iconAnswer .= '.gif';
318 318
 
319 319
         ?>
Please login to merge, or discard this patch.
main/inc/lib/access_url_edit_users_to_url_functions.lib.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
             // search users where username or firstname or lastname begins likes $needle
41 41
             $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
42 42
             $sql = 'SELECT u.user_id, username, lastname, firstname FROM '.$tbl_user.' u '.
43
-                   ' WHERE (username LIKE "'.$needle.'%" '.
44
-                   ' OR firstname LIKE "'.$needle.'%" '.
45
-                   ' OR lastname LIKE "'.$needle.'%") '.
43
+                    ' WHERE (username LIKE "'.$needle.'%" '.
44
+                    ' OR firstname LIKE "'.$needle.'%" '.
45
+                    ' OR lastname LIKE "'.$needle.'%") '.
46 46
                     $order_clause .
47
-                   ' LIMIT 11';
47
+                    ' LIMIT 11';
48 48
 
49 49
             $rs = Database::query($sql);
50 50
             $i=0;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,22 +43,22 @@
 block discarded – undo
43 43
                    ' WHERE (username LIKE "'.$needle.'%" '.
44 44
                    ' OR firstname LIKE "'.$needle.'%" '.
45 45
                    ' OR lastname LIKE "'.$needle.'%") '.
46
-                    $order_clause .
46
+                    $order_clause.
47 47
                    ' LIMIT 11';
48 48
 
49 49
             $rs = Database::query($sql);
50
-            $i=0;
50
+            $i = 0;
51 51
 
52 52
             while ($user = Database::fetch_array($rs)) {
53 53
                 $i++;
54
-                if ($i<=10) {
54
+                if ($i <= 10) {
55 55
                     $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($user['user_id']).'\',\''.api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])).' ('.addslashes($user['username']).')'.'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
56 56
                 } else {
57 57
                     $return .= '...<br />';
58 58
                 }
59 59
             }
60 60
         }
61
-        $xajax_response -> addAssign('ajax_list_users','innerHTML',api_utf8_encode($return));
61
+        $xajax_response -> addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
62 62
         return $xajax_response;
63 63
     }
64 64
 }
Please login to merge, or discard this patch.
src/Chamilo/ThemeBundle/EventListener/ContextListener.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     public function getUser()
42 42
     {
43 43
         if (!$this->container->has('security.context')) {
44
-           return false;
44
+            return false;
45 45
         }
46 46
 
47 47
         if (null === $token = $this->container->get('security.context')->getToken()) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@
 block discarded – undo
13 13
 use Symfony\Component\Security\Core\User\User;
14 14
 use Symfony\Component\Security\Core\User\UserInterface;
15 15
 
16
-class ContextListener {
16
+class ContextListener
17
+{
17 18
 
18 19
     protected $indicator = '^/admin';
19 20
     protected $container = null;
Please login to merge, or discard this patch.
src/Chamilo/ThemeBundle/EventListener/NavbarTaskListDemoListener.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
     protected function getTasks()
27 27
     {
28 28
         return array(
29
-         new TaskModel('make stuff', 30, TaskModel::COLOR_GREEN),
30
-         new TaskModel('make more stuff', 60),
31
-         new TaskModel('some more tasks to do', 10, TaskModel::COLOR_RED)
29
+            new TaskModel('make stuff', 30, TaskModel::COLOR_GREEN),
30
+            new TaskModel('make more stuff', 60),
31
+            new TaskModel('some more tasks to do', 10, TaskModel::COLOR_RED)
32 32
         );
33 33
 
34 34
     }
Please login to merge, or discard this patch.
main/inc/lib/geometry.lib.php 4 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
      *        for all j in [O..max[y][ : for all i in bords[$j] :
57 57
      *            (i,j) is a point inside an edge of the polygone
58 58
      */
59
-	$bord_lenght = $max['x'];
59
+    $bord_lenght = $max['x'];
60 60
     if ($max['y'] > $bord_lenght) {
61
-     	$bord_lenght = $max['y'];
61
+            $bord_lenght = $max['y'];
62 62
     }
63 63
 
64 64
     //$bords = array_fill(0, $bord_lenght-1, array()); // building this array
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     /* adding the first point of the polygone */
68 68
     if (is_array($bords[$poly[0]['y']])) //avoid warning
69
-    	array_push($bords[$poly[0]['y']], $poly[0]['x']);
69
+        array_push($bords[$poly[0]['y']], $poly[0]['x']);
70 70
 
71 71
     $i = 1; // we re-use $i and $old_pente bellow the loop
72 72
     $old_pente=0;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
             if ($poly[$i-1]['x'] == $poly[$i]['x'])
79 79
                 continue; // twice the same point
80 80
             else {    //  infinite elevation of the edge
81
-            	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
81
+                if (is_array($bords[$poly[$i]['y']]))
82
+                    array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
83 83
                 $old_pente=0;
84 84
                 continue;
85 85
             }
86 86
         }
87 87
 
88
-		//echo 'point:'.$poly[$i]['y']; bug here
88
+        //echo 'point:'.$poly[$i]['y']; bug here
89 89
         // adding the point as a part of an edge
90 90
         if (is_array($bords[$poly[$i]['y']])) //avoid warning
91 91
         array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
         if ($i>1)
103 103
             if (($old_pente<0 && $pente>0)
104 104
                     || ($old_pente>0 && $pente<0)) {
105
-				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
105
+                if (is_array($bords[$poly[$i]['y']])) //avoid warning
106
+                    array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
107 107
 
108 108
                 if (DEBUG)
109 109
                     echo '*('.$poly[$i]['x'].
110 110
                         ';'.$poly[$i]['y'].')   ';
111
-        	}
111
+            }
112 112
 
113 113
         /* detect the direction of the elevation in Y */
114 114
         $dy_inc = ($poly[$i]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138 138
         $rest = $poly[0]['y']-$poly[1]['y'];
139 139
         if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
140
+            $pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
141 141
         else
142
-			$pente1 = 0;
142
+            $pente1 = 0;
143 143
 
144 144
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145 145
         $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 
152 152
         // doubling the first point if needed (see above)
153 153
         if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
154
-        	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
154
+            if (is_array($bords[$poly[$i - 1]['y']]))
155
+                array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
156 156
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 157
         }
158 158
         //  doubling the last point if neededd
159 159
         if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
161
-            	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
160
+            if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
161
+                array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
162 162
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 163
         }
164 164
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     for ($i = 0; $i<$n; $i++) {  // Y
186 186
         //error_log(__FILE__.' - Border Num '.$i,0);
187 187
         if (is_array($bords[$i])) {
188
-       		sort($bords[$i]);
188
+                sort($bords[$i]);
189 189
         }
190 190
 
191 191
         for ($j = 0; $j<sizeof($bords[$i]);$j+=2) { // bords
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             for ($k = round($bords[$i][$j]); $k<=$bords[$i][$j+1];$k++) {
197 197
                 $res[$k][$i] = true; //filling the array with trues
198 198
                 if ($test == 1)  {
199
-                	/*how to draw the polygon in a human way:
199
+                    /*how to draw the polygon in a human way:
200 200
                 	In ubuntu : sudo apt-get install gnuplot
201 201
                 	Create an empty file with all points with the result of this echos (No commas, no point, no headers)
202 202
                 	In gnuplot:
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 	For 2 polygons:  plot "/home/jmontoya/test", "/home/jmontoya/test2"
205 205
                 	A new window will appear with the plot
206 206
                 	*/
207
-                	echo $k.'  '.$i; echo '<br />';
207
+                    echo $k.'  '.$i; echo '<br />';
208 208
                 }
209 209
             }
210 210
         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
         list($x,$y) = explode(';',$pcoord);
309 309
         $points[] = array('x'=>$x,'y'=>$y);
310 310
     }
311
-	return $points;
311
+    return $points;
312 312
 }
313 313
 
314 314
 /**
@@ -321,11 +321,11 @@  discard block
 block discarded – undo
321 321
     $mx = 0;
322 322
     $my = 0;
323 323
     foreach ($coords1 as $coord) {
324
-    	if ($coord['x'] > $mx) {
324
+        if ($coord['x'] > $mx) {
325 325
             $mx = $coord['x'];
326
-    	}
326
+        }
327 327
         if ($coord['y'] > $my) {
328
-        	$my = $coord['y'];
328
+            $my = $coord['y'];
329 329
         }
330 330
     }
331 331
     foreach ($coords2 as $coord) {
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
  * @returns an array such as: for all i in [0..max[x][ : for all j in [0..max[y][ : array[i][j] = FALSE
14 14
  */
15 15
 function poly_init($max) {
16
-    return array_fill(0, $max["x"]-1,
17
-            array_fill(0, $max["y"]-1, FALSE));
16
+    return array_fill(0, $max["x"] - 1,
17
+            array_fill(0, $max["y"] - 1, FALSE));
18 18
 }
19 19
 
20 20
 
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
     	array_push($bords[$poly[0]['y']], $poly[0]['x']);
70 70
 
71 71
     $i = 1; // we re-use $i and $old_pente bellow the loop
72
-    $old_pente=0;
73
-    for (    ;    // for each points of the polygon but the first
74
-        $i<sizeof($poly) && (!empty($poly[$i]['x']) && !empty($poly[$i]['y'])); $i++) {
72
+    $old_pente = 0;
73
+    for (;    // for each points of the polygon but the first
74
+        $i < sizeof($poly) && (!empty($poly[$i]['x']) && !empty($poly[$i]['y'])); $i++) {
75 75
 
76 76
         /* special cases */
77
-        if ($poly[$i-1]['y'] == $poly[$i]['y']) {
78
-            if ($poly[$i-1]['x'] == $poly[$i]['x'])
77
+        if ($poly[$i - 1]['y'] == $poly[$i]['y']) {
78
+            if ($poly[$i - 1]['x'] == $poly[$i]['x'])
79 79
                 continue; // twice the same point
80 80
             else {    //  infinite elevation of the edge
81 81
             	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
83
-                $old_pente=0;
82
+                	array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
83
+                $old_pente = 0;
84 84
                 continue;
85 85
             }
86 86
         }
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 
94 94
         /* computing the elevation of the edge going */
95 95
         //        from $poly[$i-1] to $poly[$i]
96
-        $pente = ($poly[$i-1]['x']-$poly[$i]['x'])/
97
-                 ($poly[$i-1]['y']-$poly[$i]['y']);
96
+        $pente = ($poly[$i - 1]['x'] - $poly[$i]['x']) /
97
+                 ($poly[$i - 1]['y'] - $poly[$i]['y']);
98 98
 
99 99
         // if the sign of the elevation change from the one of the
100 100
         // previous edge, the point must be added a second time inside
101 101
         // $bords
102
-        if ($i>1)
103
-            if (($old_pente<0 && $pente>0)
104
-                    || ($old_pente>0 && $pente<0)) {
102
+        if ($i > 1)
103
+            if (($old_pente < 0 && $pente > 0)
104
+                    || ($old_pente > 0 && $pente < 0)) {
105 105
 				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
106
+                	array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
107 107
 
108 108
                 if (DEBUG)
109 109
                     echo '*('.$poly[$i]['x'].
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         	}
112 112
 
113 113
         /* detect the direction of the elevation in Y */
114
-        $dy_inc = ($poly[$i]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
115
-        $x = $poly[$i-1]['x'];
114
+        $dy_inc = ($poly[$i]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
115
+        $x = $poly[$i - 1]['x'];
116 116
 //        if (DEBUG) echo "init: ".$poly[$i-1]['y']."  dy_inc: ".$dy_inc.
117 117
 //            "   end: ".$poly[$i]['y']."   pente:".$pente;
118 118
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 
122 122
         // we iterate w/ $dy in ]$poly[$i-1]['y'],$poly[$i-1]['y'][
123 123
         //    w/ $dy_inc as increment
124
-        for ($dy = $poly[$i-1]['y']+$dy_inc;
124
+        for ($dy = $poly[$i - 1]['y'] + $dy_inc;
125 125
             $dy != $poly[$i]['y'];
126 126
             $dy += $dy_inc) {
127
-            $x += $pente*$dy_inc;
127
+            $x += $pente * $dy_inc;
128 128
             array_push($bords[$dy], $x);
129 129
 //            if (DEBUG) echo '/('.$x.';'.$dy.')   ';
130 130
         }
@@ -132,47 +132,47 @@  discard block
 block discarded – undo
132 132
     }
133 133
 
134 134
     // closing the polygone (the edge between $poly[$i-1] and $poly[0])
135
-    if ($poly[$i-1]['y']!=$poly[0]['y']) {// droite--> rien à faire
135
+    if ($poly[$i - 1]['y'] != $poly[0]['y']) {// droite--> rien à faire
136 136
 
137 137
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138
-        $rest = $poly[0]['y']-$poly[1]['y'];
139
-        if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
138
+        $rest = $poly[0]['y'] - $poly[1]['y'];
139
+        if ($rest != 0)
140
+        	$pente1 = ($poly[0]['x'] - $poly[1]['x']) / ($rest);
141 141
         else
142 142
 			$pente1 = 0;
143 143
 
144 144
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145
-        $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
146
-            ($poly[$i-1]['y']-$poly[0]['y']);
145
+        $pente = ($poly[$i - 1]['x'] - $poly[0]['x']) /
146
+            ($poly[$i - 1]['y'] - $poly[0]['y']);
147 147
 
148 148
 //        if (DEBUG) echo 'start('.$poly[$i-1]['x'].','.$poly[$i-1]['y'].
149 149
 //                ')-end('.$poly[0]['x'].','.$poly[0]['y'].
150 150
 //                ')-pente'.$pente;
151 151
 
152 152
         // doubling the first point if needed (see above)
153
-        if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
153
+        if (($pente1 < 0 && $pente > 0) || ($pente1 > 0 && $pente < 0)) {
154 154
         	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
155
+            	array_push($bords[$poly[$i - 1]['y']], round($poly[$i - 1]['x']));
156 156
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 157
         }
158 158
         //  doubling the last point if neededd
159
-        if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
161
-            	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
159
+        if (($old_pente < 0 && $pente > 0) || ($old_pente > 0 && $pente < 0)) {
160
+        	if (is_array($bords[$poly[$i - 1]['y']])) //avoid warning
161
+            	array_push($bords[$poly[$i - 1]['y']], round($poly[$i - 1]['x']));
162 162
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 163
         }
164 164
 
165 165
 
166
-        $dy_inc = ($poly[0]['y']-$poly[$i-1]['y']) > 0 ? 1 : -1;
167
-        $x = $poly[$i-1]['x'];
166
+        $dy_inc = ($poly[0]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
167
+        $x = $poly[$i - 1]['x'];
168 168
 //        if (DEBUG) echo "init: ".$poly[$i-1]['y']."  dy_inc: ".$dy_inc.
169 169
 //            "   end: ".$poly[0]['y'];
170 170
 
171
-        for ($dy = $poly[$i-1]['y']+$dy_inc;
171
+        for ($dy = $poly[$i - 1]['y'] + $dy_inc;
172 172
             $dy != $poly[0]['y'];
173 173
             $dy += $dy_inc)
174 174
         {
175
-            $x += $pente*$dy_inc;
175
+            $x += $pente * $dy_inc;
176 176
             array_push($bords[$dy], round($x));
177 177
 //            if (DEBUG) echo '/('.$x.';'.$dy.')   ';
178 178
         }
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
     /* basic idea: we sort a column of edges.
183 183
         For each pair of point, we color the points in between */
184 184
     $n = count($bords);
185
-    for ($i = 0; $i<$n; $i++) {  // Y
185
+    for ($i = 0; $i < $n; $i++) {  // Y
186 186
         //error_log(__FILE__.' - Border Num '.$i,0);
187 187
         if (is_array($bords[$i])) {
188 188
        		sort($bords[$i]);
189 189
         }
190 190
 
191
-        for ($j = 0; $j<sizeof($bords[$i]);$j+=2) { // bords
191
+        for ($j = 0; $j < sizeof($bords[$i]); $j += 2) { // bords
192 192
             if (!isset($bords[$i][$j + 1])) {
193 193
                 continue;
194 194
             }
195 195
 
196
-            for ($k = round($bords[$i][$j]); $k<=$bords[$i][$j+1];$k++) {
196
+            for ($k = round($bords[$i][$j]); $k <= $bords[$i][$j + 1]; $k++) {
197 197
                 $res[$k][$i] = true; //filling the array with trues
198
-                if ($test == 1)  {
198
+                if ($test == 1) {
199 199
                 	/*how to draw the polygon in a human way:
200 200
                 	In ubuntu : sudo apt-get install gnuplot
201 201
                 	Create an empty file with all points with the result of this echos (No commas, no point, no headers)
@@ -222,19 +222,19 @@  discard block
 block discarded – undo
222 222
  *
223 223
  * @return string     html code of the representation of the polygone image
224 224
  */
225
-function poly_dump(&$poly, $max, $format='raw') {
225
+function poly_dump(&$poly, $max, $format = 'raw') {
226 226
     if ($format == 'html') {
227 227
         $s = "<div style='font-size: 8px; line-height:3px'><pre>\n";
228 228
     }
229
-    for ($i=0; $i<$max['y']; $i++) {
230
-        for($j=0; $j<$max['x']; $j++)
231
-            if($poly[$j][$i] == TRUE)
232
-                $s .= ($format=='html'?"<b>1</b>":'1');
229
+    for ($i = 0; $i < $max['y']; $i++) {
230
+        for ($j = 0; $j < $max['x']; $j++)
231
+            if ($poly[$j][$i] == TRUE)
232
+                $s .= ($format == 'html' ? "<b>1</b>" : '1');
233 233
             else
234 234
                 $s .= "0";
235
-        $s .= ($format=='html'?"<br />\n":"\n");
235
+        $s .= ($format == 'html' ? "<br />\n" : "\n");
236 236
     }
237
-    $s .= ($format=='html'?"</pre></div>\n":"\n");
237
+    $s .= ($format == 'html' ? "</pre></div>\n" : "\n");
238 238
     return $s;
239 239
 }
240 240
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
     $surfaceOf1 = 0;
253 253
     $surfaceOf2 = 0;
254 254
 
255
-    for ($i=0; $i<$max['x']; $i++)
256
-        for($j=0; $j<$max['y']; $j++) {
255
+    for ($i = 0; $i < $max['x']; $i++)
256
+        for ($j = 0; $j < $max['y']; $j++) {
257 257
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == true)) {
258 258
                 $surfaceOf1++;
259 259
                 if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == false))
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                 $surfaceOf2++;
264 264
         }
265 265
 
266
-    return array (
266
+    return array(
267 267
         "s1" => $surfaceOf1,
268 268
         "s2" => $surfaceOf2,
269 269
         "both" => $surfaceOf1 - $onlyIn1,
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  */
283 283
 function poly_touch(&$poly1, &$poly2, $max) {
284 284
 
285
-    for ($i=0; $i<$max['x']; $i++) {
286
-        for($j=0; $j<$max['y']; $j++) {
285
+    for ($i = 0; $i < $max['x']; $i++) {
286
+        for ($j = 0; $j < $max['y']; $j++) {
287 287
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == true)
288 288
                 && isset($poly2[$i][$j]) && ($poly2[$i][$j] == true)) {
289 289
                     return true;
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
  * @return  array   An array of points in the right format to use with the
302 302
  *                  local functions
303 303
  */
304
-function convert_coordinates($coords,$sep='|') {
304
+function convert_coordinates($coords, $sep = '|') {
305 305
     $points = array();
306
-    $pairs = explode($sep,$coords);
306
+    $pairs = explode($sep, $coords);
307 307
     foreach ($pairs as $idx => $pcoord) {
308
-        list($x,$y) = explode(';',$pcoord);
309
-        $points[] = array('x'=>$x,'y'=>$y);
308
+        list($x, $y) = explode(';', $pcoord);
309
+        $points[] = array('x'=>$x, 'y'=>$y);
310 310
     }
311 311
 	return $points;
312 312
 }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             $my = $coord['y'];
337 337
         }
338 338
     }
339
-    return array('x'=>$mx,'y'=>$my);
339
+    return array('x'=>$mx, 'y'=>$my);
340 340
 }
341 341
 
342 342
 /**
Please login to merge, or discard this patch.
Braces   +75 added lines, -43 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
  * @param max[y]    Y resolution
13 13
  * @returns an array such as: for all i in [0..max[x][ : for all j in [0..max[y][ : array[i][j] = FALSE
14 14
  */
15
-function poly_init($max) {
15
+function poly_init($max)
16
+{
16 17
     return array_fill(0, $max["x"]-1,
17 18
             array_fill(0, $max["y"]-1, FALSE));
18 19
 }
@@ -41,7 +42,8 @@  discard block
 block discarded – undo
41 42
  * @returns an array such as: for all i in [0..max[x][ : for all j in [0..max[y][ : array[i][j] = in_poly(poly, i,j)
42 43
  *                in_poly(poly,i,j) = true iff (i,j) is inside the polygon defined by poly
43 44
  */
44
-function poly_compile($poly, $max, $test = false) {
45
+function poly_compile($poly, $max, $test = false)
46
+{
45 47
     $res = poly_init($max);
46 48
 
47 49
     // looking for EDGES
@@ -65,8 +67,10 @@  discard block
 block discarded – undo
65 67
     $bords = array_fill(0, $bord_lenght, array()); // building this array
66 68
 
67 69
     /* adding the first point of the polygone */
68
-    if (is_array($bords[$poly[0]['y']])) //avoid warning
70
+    if (is_array($bords[$poly[0]['y']])) {
71
+        //avoid warning
69 72
     	array_push($bords[$poly[0]['y']], $poly[0]['x']);
73
+    }
70 74
 
71 75
     $i = 1; // we re-use $i and $old_pente bellow the loop
72 76
     $old_pente=0;
@@ -75,11 +79,15 @@  discard block
 block discarded – undo
75 79
 
76 80
         /* special cases */
77 81
         if ($poly[$i-1]['y'] == $poly[$i]['y']) {
78
-            if ($poly[$i-1]['x'] == $poly[$i]['x'])
79
-                continue; // twice the same point
80
-            else {    //  infinite elevation of the edge
81
-            	if (is_array($bords[$poly[$i]['y']]))
82
-                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
82
+            if ($poly[$i-1]['x'] == $poly[$i]['x']) {
83
+                            continue;
84
+            }
85
+            // twice the same point
86
+            else {
87
+//  infinite elevation of the edge
88
+            	if (is_array($bords[$poly[$i]['y']])) {
89
+            	                	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
90
+            	}
83 91
                 $old_pente=0;
84 92
                 continue;
85 93
             }
@@ -87,9 +95,13 @@  discard block
 block discarded – undo
87 95
 
88 96
 		//echo 'point:'.$poly[$i]['y']; bug here
89 97
         // adding the point as a part of an edge
90
-        if (is_array($bords[$poly[$i]['y']])) //avoid warning
98
+        if (is_array($bords[$poly[$i]['y']])) {
99
+            //avoid warning
91 100
         array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
92
-        if (DEBUG) echo '('.$poly[$i]['x'].';'.$poly[$i]['y'].')   ';
101
+        }
102
+        if (DEBUG) {
103
+            echo '('.$poly[$i]['x'].';'.$poly[$i]['y'].')   ';
104
+        }
93 105
 
94 106
         /* computing the elevation of the edge going */
95 107
         //        from $poly[$i-1] to $poly[$i]
@@ -99,15 +111,17 @@  discard block
 block discarded – undo
99 111
         // if the sign of the elevation change from the one of the
100 112
         // previous edge, the point must be added a second time inside
101 113
         // $bords
102
-        if ($i>1)
103
-            if (($old_pente<0 && $pente>0)
114
+        if ($i>1) {
115
+                    if (($old_pente<0 && $pente>0)
104 116
                     || ($old_pente>0 && $pente<0)) {
105 117
 				if (is_array($bords[$poly[$i]['y']])) //avoid warning
106 118
                 	array_push($bords[$poly[$i]['y']],$poly[$i]['x']);
119
+        }
107 120
 
108
-                if (DEBUG)
109
-                    echo '*('.$poly[$i]['x'].
121
+                if (DEBUG) {
122
+                                    echo '*('.$poly[$i]['x'].
110 123
                         ';'.$poly[$i]['y'].')   ';
124
+                }
111 125
         	}
112 126
 
113 127
         /* detect the direction of the elevation in Y */
@@ -132,14 +146,16 @@  discard block
 block discarded – undo
132 146
     }
133 147
 
134 148
     // closing the polygone (the edge between $poly[$i-1] and $poly[0])
135
-    if ($poly[$i-1]['y']!=$poly[0]['y']) {// droite--> rien à faire
149
+    if ($poly[$i-1]['y']!=$poly[0]['y']) {
150
+// droite--> rien à faire
136 151
 
137 152
         // elevation between $poly[0]['x'] and $poly[1]['x'])
138 153
         $rest = $poly[0]['y']-$poly[1]['y'];
139
-        if ($rest!=0)
140
-        	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
141
-        else
142
-			$pente1 = 0;
154
+        if ($rest!=0) {
155
+                	$pente1 = ($poly[0]['x']-$poly[1]['x'])/($rest);
156
+        } else {
157
+        			$pente1 = 0;
158
+        }
143 159
 
144 160
         // elevation between $poly[$i-1]['x'] and $poly[0]['x'])
145 161
         $pente = ($poly[$i-1]['x']-$poly[0]['x'])/
@@ -151,14 +167,17 @@  discard block
 block discarded – undo
151 167
 
152 168
         // doubling the first point if needed (see above)
153 169
         if (($pente1<0 && $pente>0) || ($pente1>0 && $pente<0)) {
154
-        	if (is_array($bords[$poly[$i - 1]['y']]))
155
-            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
170
+        	if (is_array($bords[$poly[$i - 1]['y']])) {
171
+        	            	array_push($bords[$poly[$i - 1]['y']],  round($poly[$i - 1]['x']));
172
+        	}
156 173
             //if (DEBUG) echo '('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
157 174
         }
158 175
         //  doubling the last point if neededd
159 176
         if (($old_pente<0 && $pente>0) || ($old_pente>0 && $pente<0)) {
160
-        	if (is_array($bords[$poly[$i-1]['y']])) //avoid warning
177
+        	if (is_array($bords[$poly[$i-1]['y']])) {
178
+        	    //avoid warning
161 179
             	array_push($bords[$poly[$i-1]['y']], round($poly[$i-1]['x']));
180
+        	}
162 181
             //if (DEBUG) echo '*('.$poly[$i-1]['x'].';'.$poly[$i-1]['y'].')   ';
163 182
         }
164 183
 
@@ -170,8 +189,7 @@  discard block
 block discarded – undo
170 189
 
171 190
         for ($dy = $poly[$i-1]['y']+$dy_inc;
172 191
             $dy != $poly[0]['y'];
173
-            $dy += $dy_inc)
174
-        {
192
+            $dy += $dy_inc) {
175 193
             $x += $pente*$dy_inc;
176 194
             array_push($bords[$dy], round($x));
177 195
 //            if (DEBUG) echo '/('.$x.';'.$dy.')   ';
@@ -182,20 +200,22 @@  discard block
 block discarded – undo
182 200
     /* basic idea: we sort a column of edges.
183 201
         For each pair of point, we color the points in between */
184 202
     $n = count($bords);
185
-    for ($i = 0; $i<$n; $i++) {  // Y
203
+    for ($i = 0; $i<$n; $i++) {
204
+// Y
186 205
         //error_log(__FILE__.' - Border Num '.$i,0);
187 206
         if (is_array($bords[$i])) {
188 207
        		sort($bords[$i]);
189 208
         }
190 209
 
191
-        for ($j = 0; $j<sizeof($bords[$i]);$j+=2) { // bords
210
+        for ($j = 0; $j<sizeof($bords[$i]);$j+=2) {
211
+// bords
192 212
             if (!isset($bords[$i][$j + 1])) {
193 213
                 continue;
194 214
             }
195 215
 
196 216
             for ($k = round($bords[$i][$j]); $k<=$bords[$i][$j+1];$k++) {
197 217
                 $res[$k][$i] = true; //filling the array with trues
198
-                if ($test == 1)  {
218
+                if ($test == 1) {
199 219
                 	/*how to draw the polygon in a human way:
200 220
                 	In ubuntu : sudo apt-get install gnuplot
201 221
                 	Create an empty file with all points with the result of this echos (No commas, no point, no headers)
@@ -222,16 +242,19 @@  discard block
 block discarded – undo
222 242
  *
223 243
  * @return string     html code of the representation of the polygone image
224 244
  */
225
-function poly_dump(&$poly, $max, $format='raw') {
245
+function poly_dump(&$poly, $max, $format='raw')
246
+{
226 247
     if ($format == 'html') {
227 248
         $s = "<div style='font-size: 8px; line-height:3px'><pre>\n";
228 249
     }
229 250
     for ($i=0; $i<$max['y']; $i++) {
230
-        for($j=0; $j<$max['x']; $j++)
231
-            if($poly[$j][$i] == TRUE)
251
+        for($j=0; $j<$max['x']; $j++) {
252
+                    if($poly[$j][$i] == TRUE)
232 253
                 $s .= ($format=='html'?"<b>1</b>":'1');
233
-            else
234
-                $s .= "0";
254
+        }
255
+            else {
256
+                            $s .= "0";
257
+            }
235 258
         $s .= ($format=='html'?"<br />\n":"\n");
236 259
     }
237 260
     $s .= ($format=='html'?"</pre></div>\n":"\n");
@@ -247,20 +270,25 @@  discard block
 block discarded – undo
247 270
  *
248 271
  * @returns (see below, UTSL)
249 272
  */
250
-function poly_result(&$poly1, &$poly2, $max) {
273
+function poly_result(&$poly1, &$poly2, $max)
274
+{
251 275
     $onlyIn1 = 0;
252 276
     $surfaceOf1 = 0;
253 277
     $surfaceOf2 = 0;
254 278
 
255
-    for ($i=0; $i<$max['x']; $i++)
256
-        for($j=0; $j<$max['y']; $j++) {
279
+    for ($i=0; $i<$max['x']; $i++) {
280
+            for($j=0;
281
+    }
282
+    $j<$max['y']; $j++) {
257 283
             if (isset($poly1[$i][$j]) && ($poly1[$i][$j] == true)) {
258 284
                 $surfaceOf1++;
259
-                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == false))
260
-                    $onlyIn1++;
285
+                if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == false)) {
286
+                                    $onlyIn1++;
287
+                }
288
+            }
289
+            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == true)) {
290
+                            $surfaceOf2++;
261 291
             }
262
-            if (isset($poly2[$i][$j]) && ($poly2[$i][$j] == true))
263
-                $surfaceOf2++;
264 292
         }
265 293
 
266 294
     return array (
@@ -280,7 +308,8 @@  discard block
 block discarded – undo
280 308
  *
281 309
  * @returns (see below, UTSL)
282 310
  */
283
-function poly_touch(&$poly1, &$poly2, $max) {
311
+function poly_touch(&$poly1, &$poly2, $max)
312
+{
284 313
 
285 314
     for ($i=0; $i<$max['x']; $i++) {
286 315
         for($j=0; $j<$max['y']; $j++) {
@@ -301,7 +330,8 @@  discard block
 block discarded – undo
301 330
  * @return  array   An array of points in the right format to use with the
302 331
  *                  local functions
303 332
  */
304
-function convert_coordinates($coords,$sep='|') {
333
+function convert_coordinates($coords,$sep='|')
334
+{
305 335
     $points = array();
306 336
     $pairs = explode($sep,$coords);
307 337
     foreach ($pairs as $idx => $pcoord) {
@@ -317,7 +347,8 @@  discard block
 block discarded – undo
317 347
  * @param   array   Coordinates of one polygon
318 348
  * @return  array   ('x'=>val,'y'=>val)
319 349
  */
320
-function poly_get_max(&$coords1, &$coords2) {
350
+function poly_get_max(&$coords1, &$coords2)
351
+{
321 352
     $mx = 0;
322 353
     $my = 0;
323 354
     foreach ($coords1 as $coord) {
@@ -461,7 +492,8 @@  discard block
 block discarded – undo
461 492
      * @param array $point The point properties
462 493
      * @return boolean
463 494
      */
464
-    public static function pointIsInPolygon($properties, $point) {
495
+    public static function pointIsInPolygon($properties, $point)
496
+    {
465 497
         $points = $properties;
466 498
         $isInside = false;
467 499
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function poly_init($max) {
16 16
     return array_fill(0, $max["x"]-1,
17
-            array_fill(0, $max["y"]-1, FALSE));
17
+            array_fill(0, $max["y"]-1, false));
18 18
 }
19 19
 
20 20
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     }
229 229
     for ($i=0; $i<$max['y']; $i++) {
230 230
         for($j=0; $j<$max['x']; $j++)
231
-            if($poly[$j][$i] == TRUE)
231
+            if($poly[$j][$i] == true)
232 232
                 $s .= ($format=='html'?"<b>1</b>":'1');
233 233
             else
234 234
                 $s .= "0";
Please login to merge, or discard this patch.