Passed
Push — master ( 951973...030b08 )
by Felipe
28s
created
src/Histogram/AbstractHistogram.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      *
100 100
      * @access  public
101 101
      * @param   int $type one of HISTOGRAM_SIMPLE or HISTOGRAM_CUMMULATIVE
102
-     * @return  mixed   boolean true on success, a PEAR_Error object otherwise
102
+     * @return  boolean   boolean true on success, a PEAR_Error object otherwise
103 103
      */
104 104
     public function setType($type)
105 105
     {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @access  public
119 119
      * @param   array   $binOptions associative array of bin options
120
-     * @return  mixed   true on succcess, a PEAR_Error object otherwise
120
+     * @return  boolean   true on succcess, a PEAR_Error object otherwise
121 121
      */
122 122
     public function setBinOptions($binOptions)
123 123
     {
Please login to merge, or discard this patch.
src/Histogram/Histogram.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @access  public
69 69
      * @param   array   $data   the numeric array
70
-     * @return  mixed   boolean true on success, a \PEAR_Error object otherwise
70
+     * @return  boolean   boolean true on success, a \PEAR_Error object otherwise
71 71
      *
72 72
      * @see _clear()
73 73
      * @see Math_AbstractHistogram::getData()
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @access  public
108 108
      * @param   optional    $statsMode  calculate basic statistics (STATS_BASIC) or full (STATS_FULL)
109
-     * @return  mixed   boolean true on success, a \PEAR_Error object otherwise
109
+     * @return  boolean   boolean true on success, a \PEAR_Error object otherwise
110 110
      *
111 111
      * @see Math_Stats
112 112
      */
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      * @deprecated
271 271
      * @access  public
272 272
      * @param   optional    int $mode   one of HISTOGRAM_LO_BINS, HISTOGRAM_MID_BINS, or HISTOGRAM_HI_BINS (default)
273
-     * @return  mixed   a string on success, a \PEAR_Error object otherwise
273
+     * @return  string   a string on success, a \PEAR_Error object otherwise
274 274
      */
275 275
     public function printHistogram($mode = self::HISTOGRAM_HI_BINS)
276 276
     {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $this->_stats = new \HuasoFoundries\Math\Stats();
112 112
 
113 113
         $this->_statsMode = $statsMode;
114
-        $delta            = ($this->_rangeHigh - $this->_rangeLow) / $this->_nbins;
114
+        $delta            = ($this->_rangeHigh - $this->_rangeLow)/$this->_nbins;
115 115
         $lastpos          = 0;
116 116
         $cumm             = 0;
117 117
         $data             = $this->_histogramData();
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
         $ignoreList       = array();
120 120
 
121 121
         for ($i = 0; $i < $this->_nbins; $i++) {
122
-            $loBin                   = $this->_rangeLow + $i * $delta;
122
+            $loBin                   = $this->_rangeLow + $i*$delta;
123 123
             $hiBin                   = $loBin + $delta;
124 124
             $this->_bins[$i]["low"]  = $loBin;
125 125
             $this->_bins[$i]["high"] = $hiBin;
126
-            $this->_bins[$i]["mid"]  = ($hiBin + $loBin) / 2;
126
+            $this->_bins[$i]["mid"]  = ($hiBin + $loBin)/2;
127 127
             if ($this->_type == self::HISTOGRAM_CUMMULATIVE) {
128 128
                 $this->_bins[$i]["count"] = $cumm;
129 129
             } else {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             $out[] = "{$bin}{$separator}{$freq}";
210 210
         }
211 211
 
212
-        return implode("\n", $out) . "\n";
212
+        return implode("\n", $out)."\n";
213 213
     }
214 214
 
215 215
     /**
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
             throw new \PEAR_Exception("histogram has not been calculated");
268 268
         }
269 269
         $out = ($this->_type == self::HISTOGRAM_CUMMULATIVE) ? "Cummulative Frequency" : "Histogram";
270
-        $out .= "\n\tNumber of bins: " . $this->_nbins . "\n";
271
-        $out .= "\tPlot range: [" . $this->_rangeLow . ", " . $this->_rangeHigh . "]\n";
270
+        $out .= "\n\tNumber of bins: ".$this->_nbins."\n";
271
+        $out .= "\tPlot range: [".$this->_rangeLow.", ".$this->_rangeHigh."]\n";
272 272
         $hdata = $this->_histogramData();
273
-        $out .= "\tData range: [" . min($hdata) . ", " . max($hdata) . "]\n";
274
-        $out .= "\tOriginal data range: [" . min($this->_data) . ", " . max($this->_data) . "]\n";
273
+        $out .= "\tData range: [".min($hdata).", ".max($hdata)."]\n";
274
+        $out .= "\tOriginal data range: [".min($this->_data).", ".max($this->_data)."]\n";
275 275
         $out .= "BIN (FREQUENCY) ASCII_BAR (%)\n";
276 276
         $fmt     = "%-4.3f (%-4d) |%s\n";
277 277
         $bins    = $this->_filterBins($mode);
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
      */
296 296
     public function _bar($freq, $maxfreq, $total)
297 297
     {
298
-        $fact  = floatval(($maxfreq > 40) ? 40 / $maxfreq : 1);
299
-        $niter = round($freq * $fact);
298
+        $fact  = floatval(($maxfreq > 40) ? 40/$maxfreq : 1);
299
+        $niter = round($freq*$fact);
300 300
         $out   = "";
301 301
         for ($i = 0; $i < $niter; $i++) {
302 302
             $out .= "*";
303 303
         }
304 304
 
305
-        return $out . sprintf(" (%.1f%%)", $freq / $total * 100);
305
+        return $out.sprintf(" (%.1f%%)", $freq/$total*100);
306 306
     }
307 307
 
308 308
     /**
Please login to merge, or discard this patch.
src/Histogram/Histogram4D.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
      * Sets the binning options. Overrides parent's method.
43 43
      *
44 44
      * @access  public
45
-     * @param   array $binOptions  an array of options for binning the data
46
-     * @return  void
45
+     * @param   string $binOptions  an array of options for binning the data
46
+     * @return  boolean
47 47
      */
48 48
     public function setBinOptions($binOptions)
49 49
     {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      *
63 63
      * @access  public
64 64
      * @param   array   $data   the numeric array
65
-     * @return  mixed   boolean true on success, a \PEAR_Error object otherwise
65
+     * @return  boolean   boolean true on success, a \PEAR_Error object otherwise
66 66
      *
67 67
      * @see _clear()
68 68
      * @see Math_AbstractHistogram::getData()
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      * array
266 266
      *
267 267
      * @access  private
268
-     * @param   array   $elem
268
+     * @param   string   $elem
269 269
      * @return  array   of values: array(min, max)
270 270
      */
271 271
     public function _getMinMax($elem)
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
         $this->_bins      = array();
107 107
         $this->_stats     = array('x' => new \HuasoFoundries\Math\Stats(), 'y' => new \HuasoFoundries\Math\Stats(), 'z' => new \HuasoFoundries\Math\Stats());
108 108
         $this->_statsMode = $statsMode;
109
-        $deltaX           = ($this->_rangeHigh['x'] - $this->_rangeLow['x']) / $this->_nbins['x'];
110
-        $deltaY           = ($this->_rangeHigh['y'] - $this->_rangeLow['y']) / $this->_nbins['y'];
111
-        $deltaZ           = ($this->_rangeHigh['z'] - $this->_rangeLow['z']) / $this->_nbins['z'];
109
+        $deltaX           = ($this->_rangeHigh['x'] - $this->_rangeLow['x'])/$this->_nbins['x'];
110
+        $deltaY           = ($this->_rangeHigh['y'] - $this->_rangeLow['y'])/$this->_nbins['y'];
111
+        $deltaZ           = ($this->_rangeHigh['z'] - $this->_rangeLow['z'])/$this->_nbins['z'];
112 112
         $data             = $this->_histogramData();
113 113
         $dataX            = $data['x'];
114 114
         $dataY            = $data['y'];
@@ -117,20 +117,20 @@  discard block
 block discarded – undo
117 117
         $cumm             = 0;
118 118
         $nData            = count($dataX);
119 119
         for ($i = 0; $i < $this->_nbins['x']; $i++) {
120
-            $loXBin = $this->_rangeLow['x'] + $i * $deltaX;
120
+            $loXBin = $this->_rangeLow['x'] + $i*$deltaX;
121 121
             $hiXBin = $loXBin + $deltaX;
122 122
             $xBin   = array('low' => $loXBin, 'high' => $hiXBin,
123
-                'mid'             => ($hiXBin + $loXBin) / 2);
123
+                'mid'             => ($hiXBin + $loXBin)/2);
124 124
             for ($j = 0; $j < $this->_nbins['y']; $j++) {
125
-                $loYBin = $this->_rangeLow['y'] + $j * $deltaY;
125
+                $loYBin = $this->_rangeLow['y'] + $j*$deltaY;
126 126
                 $hiYBin = $loYBin + $deltaY;
127 127
                 $yBin   = array('low' => $loYBin, 'high' => $hiYBin,
128
-                    'mid'             => ($hiYBin + $loYBin) / 2);
128
+                    'mid'             => ($hiYBin + $loYBin)/2);
129 129
                 for ($m = 0; $m < $this->_nbins['z']; $m++) {
130
-                    $loZBin = $this->_rangeLow['z'] + $m * $deltaZ;
130
+                    $loZBin = $this->_rangeLow['z'] + $m*$deltaZ;
131 131
                     $hiZBin = $loZBin + $deltaZ;
132 132
                     $zBin   = array('low' => $loZBin, 'high' => $hiZBin,
133
-                        'mid'             => ($hiZBin + $loZBin) / 2);
133
+                        'mid'             => ($hiZBin + $loZBin)/2);
134 134
                     $bin  = array('x' => $xBin, 'y' => $yBin, 'z' => $zBin);
135 135
                     $freq = 0;
136 136
                     for ($k = 0; $k < $nData; $k++) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             $out[] = implode($separator, $bins[$i]);
250 250
         }
251 251
 
252
-        return implode("\n", $out) . "\n";
252
+        return implode("\n", $out)."\n";
253 253
     }
254 254
 
255 255
     /**
Please login to merge, or discard this patch.
src/Histogram/Printer/Common.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      *              Common options:
57 57
      *              'useHTTPHeaders' (default = false), whether to output HTTP headers when using printOutput()
58 58
      *              'outputStatistics' (default = false), whether to include histogram statistics when generating the output
59
-     * @return  boolean TRUE on success, FALSE otherwise
59
+     * @return  boolean|null TRUE on success, FALSE otherwise
60 60
      */
61 61
     public function setOptions($options)
62 62
     {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      *
143 143
      * @static
144 144
      * @access private
145
-     * @param object $printer An instance of a Histogram_Printer_* class
145
+     * @param Text $printer An instance of a Histogram_Printer_* class
146 146
      * @param object Histogram $hist A Histogram instance
147 147
      * @param array $options An array of options for the printer object
148 148
      * @return boolean|PEAR_Error TRUE on success, a \PEAR_Error otherwise
Please login to merge, or discard this patch.
src/Math/Stats.php 2 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @access public
121 121
      * @param   array   $arr    the data set
122 122
      * @param   optional    int $opt    data format: STATS_DATA_CUMMULATIVE or STATS_DATA_SIMPLE (default)
123
-     * @return  mixed   true on success, a PEAR_Error object otherwise
123
+     * @return  boolean   true on success, a PEAR_Error object otherwise
124 124
      */
125 125
     public function setData($arr, $opt = self::STATS_DATA_SIMPLE)
126 126
     {
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      * Must be called before assigning a new data set containing null values
171 171
      *
172 172
      * @access  public
173
-     * @return  mixed   true on success, a PEAR_Error object otherwise
173
+     * @return  boolean   true on success, a PEAR_Error object otherwise
174 174
      * @see _validate()
175 175
      */
176 176
     public function setNullOption($nullOption)
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
      * Handles cummulative data sets correctly
482 482
      *
483 483
      * @access  public
484
-     * @param   numeric $n  the exponent
484
+     * @param   integer $n  the exponent
485 485
      * @return  mixed   the sum on success, a PEAR_Error object otherwise
486 486
      * @see calc()
487 487
      * @see sum()
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
      * Handles cummulative data sets correctly
537 537
      *
538 538
      * @access  public
539
-     * @param   numeric $n  the exponent
539
+     * @param   integer $n  the exponent
540 540
      * @return  numeric|array|PEAR_Error  the product as a number or an array of numbers
541 541
      *                                    (if there is numeric overflow) on success,
542 542
      *                                    a PEAR_Error object otherwise
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
      *
732 732
      * @access  public
733 733
      * @param   numeric $mean   the fixed mean value
734
-     * @return  mixed   the variance on success, a PEAR_Error object otherwise
734
+     * @return  double   the variance on success, a PEAR_Error object otherwise
735 735
      * @see __sumdiff()
736 736
      * @see count()
737 737
      * @see variance()
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
      * @todo need to double check generality of the algorithm
1503 1503
      *
1504 1504
      * @access public
1505
-     * @param numeric $p the percentile to estimate, e.g. 25 for 25th percentile
1505
+     * @param integer $p the percentile to estimate, e.g. 25 for 25th percentile
1506 1506
      * @return mixed a numeric value on success, a PEAR_Error otherwise
1507 1507
      * @see quartiles()
1508 1508
      * @see median()
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
      * Utility function to calculate: SUM { (xi - mean)^n }
1541 1541
      *
1542 1542
      * @access private
1543
-     * @param   numeric $power  the exponent
1543
+     * @param   integer $power  the exponent
1544 1544
      * @param   optional    double   $mean   the data set mean value
1545 1545
      * @return  mixed   the sum on success, a PEAR_Error object otherwise
1546 1546
      *
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
      *
1679 1679
      * @access private
1680 1680
      * @param mixed $v value to be formatted
1681
-     * @param boolean $returnErrorObject whether the raw PEAR_Error (when true, default),
1681
+     * @param boolean $useErrorObject whether the raw PEAR_Error (when true, default),
1682 1682
      *                  or only the error message will be returned (when false)
1683 1683
      * @return mixed if the value is a PEAR_Error object, and $useErrorObject
1684 1684
      *              is false, then a string with the error message will be returned,
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
      * according to the current null handling option
1700 1700
      *
1701 1701
      * @access  private
1702
-     * @return  mixed true on success, a PEAR_Error object otherwise
1702
+     * @return  boolean true on success, a PEAR_Error object otherwise
1703 1703
      *
1704 1704
      * @see setData()
1705 1705
      */
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             $this->_nullOption = $nullOption;
179 179
             return true;
180 180
         } else {
181
-            throw new \PEAR_Exception('invalid null handling option expecting: ' .
181
+            throw new \PEAR_Exception('invalid null handling option expecting: '.
182 182
                 'STATS_REJECT_NULL, STATS_IGNORE_NULL or STATS_USE_NULL_AS_ZERO');
183 183
         }
184 184
     }
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
         $arr = array();
213 213
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
214 214
             foreach ($this->_data as $val => $freq) {
215
-                $newval         = ($val - $mean) / $std;
215
+                $newval         = ($val - $mean)/$std;
216 216
                 $arr["$newval"] = $freq;
217 217
             }
218 218
         } else {
219 219
             foreach ($this->_data as $val) {
220
-                $newval = ($val - $mean) / $std;
220
+                $newval = ($val - $mean)/$std;
221 221
                 $arr[]  = $newval;
222 222
             }
223 223
         }
@@ -480,11 +480,11 @@  discard block
 block discarded – undo
480 480
         $sumN = 0;
481 481
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
482 482
             foreach ($this->_data as $val => $freq) {
483
-                $sumN += $freq * pow((double) $val, (double) $n);
483
+                $sumN += $freq*pow((double)$val, (double)$n);
484 484
             }
485 485
         } else {
486 486
             foreach ($this->_data as $val) {
487
-                $sumN += pow((double) $val, (double) $n);
487
+                $sumN += pow((double)$val, (double)$n);
488 488
             }
489 489
         }
490 490
         return $sumN;
@@ -536,8 +536,8 @@  discard block
 block discarded – undo
536 536
                 if ($val == 0) {
537 537
                     return 0.0;
538 538
                 }
539
-                $prodN *= $freq * pow((double) $val, (double) $n);
540
-                if ($prodN > 10000 * $n) {
539
+                $prodN *= $freq*pow((double)$val, (double)$n);
540
+                if ($prodN > 10000*$n) {
541 541
                     $partial[] = $prodN;
542 542
                     $prodN     = 1.0;
543 543
                 }
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
                 if ($val == 0) {
548 548
                     return 0.0;
549 549
                 }
550
-                $prodN *= pow((double) $val, (double) $n);
551
-                if ($prodN > 10 * $n) {
550
+                $prodN *= pow((double)$val, (double)$n);
551
+                if ($prodN > 10*$n) {
552 552
                     $partial[] = $prodN;
553 553
                     $prodN     = 1.0;
554 554
                 }
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
                 } catch (\PEAR_Exception $e) {
616 616
                     return $count;
617 617
                 }
618
-                $this->_calculatedValues['mean'] = $sum / $count;
618
+                $this->_calculatedValues['mean'] = $sum/$count;
619 619
             } catch (\PEAR_Exception $e) {
620 620
                 return $sum;
621 621
             }
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
                 return $count;
815 815
             }
816 816
 
817
-            $this->_calculatedValues['skewness'] = ($sumdiff3 / ($count * pow($stDev, 3)));
817
+            $this->_calculatedValues['skewness'] = ($sumdiff3/($count*pow($stDev, 3)));
818 818
         }
819 819
         return $this->_calculatedValues['skewness'];
820 820
     }
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
                 return $count;
857 857
             }
858 858
 
859
-            $this->_calculatedValues['kurtosis'] = ($sumdiff4 / ($count * pow($stDev, 4))) - 3;
859
+            $this->_calculatedValues['kurtosis'] = ($sumdiff4/($count*pow($stDev, 4))) - 3;
860 860
         }
861 861
         return $this->_calculatedValues['kurtosis'];
862 862
     }
@@ -891,9 +891,9 @@  discard block
 block discarded – undo
891 891
                 return $n;
892 892
             }
893 893
 
894
-            $h = intval($n / 2);
895
-            if ($n % 2 == 0) {
896
-                $median = ($arr[$h] + $arr[$h - 1]) / 2;
894
+            $h = intval($n/2);
895
+            if ($n%2 == 0) {
896
+                $median = ($arr[$h] + $arr[$h - 1])/2;
897 897
             } else {
898 898
                 $median = $arr[$h];
899 899
             }
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
                 return $min;
972 972
             }
973 973
 
974
-            $this->_calculatedValues['midrange'] = (($max + $min) / 2);
974
+            $this->_calculatedValues['midrange'] = (($max + $min)/2);
975 975
         }
976 976
         return $this->_calculatedValues['midrange'];
977 977
     }
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
             if (is_array($prod)) {
1003 1003
                 $geomMean = 1.0;
1004 1004
                 foreach ($prod as $val) {
1005
-                    $geomMean *= pow($val, 1 / $count);
1005
+                    $geomMean *= pow($val, 1/$count);
1006 1006
                 }
1007 1007
                 $this->_calculatedValues['geometricMean'] = $geomMean;
1008 1008
             } else {
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                 if ($prod < 0) {
1013 1013
                     throw new \PEAR_Exception('The product of the data set is negative, geometric mean undefined.');
1014 1014
                 }
1015
-                $this->_calculatedValues['geometricMean'] = pow($prod, 1 / $count);
1015
+                $this->_calculatedValues['geometricMean'] = pow($prod, 1/$count);
1016 1016
             }
1017 1017
         }
1018 1018
         return $this->_calculatedValues['geometricMean'];
@@ -1042,21 +1042,21 @@  discard block
 block discarded – undo
1042 1042
             if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
1043 1043
                 foreach ($this->_data as $val => $freq) {
1044 1044
                     if ($val == 0) {
1045
-                        throw new \PEAR_Exception('cannot calculate a ' .
1045
+                        throw new \PEAR_Exception('cannot calculate a '.
1046 1046
                             'harmonic mean with data values of zero.');
1047 1047
                     }
1048
-                    $invsum += $freq / $val;
1048
+                    $invsum += $freq/$val;
1049 1049
                 }
1050 1050
             } else {
1051 1051
                 foreach ($this->_data as $val) {
1052 1052
                     if ($val == 0) {
1053
-                        throw new \PEAR_Exception('cannot calculate a ' .
1053
+                        throw new \PEAR_Exception('cannot calculate a '.
1054 1054
                             'harmonic mean with data values of zero.');
1055 1055
                     }
1056
-                    $invsum += 1 / $val;
1056
+                    $invsum += 1/$val;
1057 1057
                 }
1058 1058
             }
1059
-            $this->_calculatedValues['harmonicMean'] = $count / $invsum;
1059
+            $this->_calculatedValues['harmonicMean'] = $count/$invsum;
1060 1060
         }
1061 1061
         return $this->_calculatedValues['harmonicMean'];
1062 1062
     }
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
             return $count;
1090 1090
         }
1091 1091
         if ($count == 0) {
1092
-            throw new \PEAR_Exception("Cannot calculate {$n}th sample moment, " .
1092
+            throw new \PEAR_Exception("Cannot calculate {$n}th sample moment, ".
1093 1093
                 'there are zero data entries');
1094 1094
         }
1095 1095
         try {
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
         } catch (\PEAR_Exception $e) {
1098 1098
             return $sum;
1099 1099
         }
1100
-        return ($sum / $count);
1100
+        return ($sum/$count);
1101 1101
     }
1102 1102
 
1103 1103
     /**
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
             return $count;
1126 1126
         }
1127 1127
         if ($count == 0) {
1128
-            throw new \PEAR_Exception("Cannot calculate {$n}th raw moment, " .
1128
+            throw new \PEAR_Exception("Cannot calculate {$n}th raw moment, ".
1129 1129
                 'there are zero data entries.');
1130 1130
         }
1131 1131
         try {
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
         } catch (\PEAR_Exception $e) {
1134 1134
             return $sum;
1135 1135
         }
1136
-        return ($sum / $count);
1136
+        return ($sum/$count);
1137 1137
     }
1138 1138
 
1139 1139
     /**
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
             }
1159 1159
 
1160 1160
             if ($mean == 0.0) {
1161
-                throw new \PEAR_Exception('cannot calculate the coefficient ' .
1161
+                throw new \PEAR_Exception('cannot calculate the coefficient '.
1162 1162
                     'of variation, mean of sample is zero');
1163 1163
             }
1164 1164
             try {
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
                 return $stDev;
1168 1168
             }
1169 1169
 
1170
-            $this->_calculatedValues['coeffOfVariation'] = $stDev / $mean;
1170
+            $this->_calculatedValues['coeffOfVariation'] = $stDev/$mean;
1171 1171
         }
1172 1172
         return $this->_calculatedValues['coeffOfVariation'];
1173 1173
     }
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
             } catch (\PEAR_Exception $e) {
1203 1203
                 return $stDev;
1204 1204
             }
1205
-            $this->_calculatedValues['stdErrorOfMean'] = $stDev / sqrt($count);
1205
+            $this->_calculatedValues['stdErrorOfMean'] = $stDev/sqrt($count);
1206 1206
         }
1207 1207
         return $this->_calculatedValues['stdErrorOfMean'];
1208 1208
     }
@@ -1309,10 +1309,10 @@  discard block
 block discarded – undo
1309 1309
                 }
1310 1310
             }
1311 1311
             if ($n == 0) {
1312
-                throw new \PEAR_Exception('error calculating interquartile mean, ' .
1312
+                throw new \PEAR_Exception('error calculating interquartile mean, '.
1313 1313
                     'empty interquartile range of values.');
1314 1314
             }
1315
-            $this->_calculatedValues['interquartileMean'] = $sum / $n;
1315
+            $this->_calculatedValues['interquartileMean'] = $sum/$n;
1316 1316
         }
1317 1317
         return $this->_calculatedValues['interquartileMean'];
1318 1318
     }
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
             } catch (\PEAR_Exception $e) {
1366 1366
                 return $iqr;
1367 1367
             }
1368
-            $this->_calculatedValues['quartileDeviation'] = $iqr / 2;
1368
+            $this->_calculatedValues['quartileDeviation'] = $iqr/2;
1369 1369
         }
1370 1370
         return $this->_calculatedValues['quartileDeviation'];
1371 1371
     }
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
             $q1                                                      = $quart['25'];
1395 1395
             $d                                                       = $q3 - $q1;
1396 1396
             $s                                                       = $q3 + $q1;
1397
-            $this->_calculatedValues['quartileVariationCoefficient'] = 100 * $d / $s;
1397
+            $this->_calculatedValues['quartileVariationCoefficient'] = 100*$d/$s;
1398 1398
         }
1399 1399
         return $this->_calculatedValues['quartileVariationCoefficient'];
1400 1400
     }
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
             $q3                                                     = $quart['75'];
1424 1424
             $q2                                                     = $quart['50'];
1425 1425
             $q1                                                     = $quart['25'];
1426
-            $d                                                      = $q3 - 2 * $q2 + $q1;
1426
+            $d                                                      = $q3 - 2*$q2 + $q1;
1427 1427
             $s                                                      = $q3 - $q1;
1428
-            $this->_calculatedValues['quartileSkewnessCoefficient'] = $d / $s;
1428
+            $this->_calculatedValues['quartileSkewnessCoefficient'] = $d/$s;
1429 1429
         }
1430 1430
         return $this->_calculatedValues['quartileSkewnessCoefficient'];
1431 1431
     }
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
         } else {
1468 1468
             $data = &$this->_data;
1469 1469
         }
1470
-        $obsidx = $p * ($count + 1) / 100;
1470
+        $obsidx = $p*($count + 1)/100;
1471 1471
         if (intval($obsidx) == $obsidx) {
1472 1472
             return $data[($obsidx - 1)];
1473 1473
         } elseif ($obsidx < 1) {
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
         } else {
1478 1478
             $left  = floor($obsidx - 1);
1479 1479
             $right = ceil($obsidx - 1);
1480
-            return ($data[$left] + $data[$right]) / 2;
1480
+            return ($data[$left] + $data[$right])/2;
1481 1481
         }
1482 1482
     }
1483 1483
 
@@ -1511,11 +1511,11 @@  discard block
 block discarded – undo
1511 1511
         $sdiff = 0;
1512 1512
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
1513 1513
             foreach ($this->_data as $val => $freq) {
1514
-                $sdiff += $freq * pow((double) ($val - $mean), (double) $power);
1514
+                $sdiff += $freq*pow((double)($val - $mean), (double)$power);
1515 1515
             }
1516 1516
         } else {
1517 1517
             foreach ($this->_data as $val) {
1518
-                $sdiff += pow((double) ($val - $mean), (double) $power);
1518
+                $sdiff += pow((double)($val - $mean), (double)$power);
1519 1519
             }
1520 1520
         }
1521 1521
         return $sdiff;
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
         if ($count == 1) {
1551 1551
             throw new \PEAR_Exception('cannot calculate variance of a singe data point');
1552 1552
         }
1553
-        return ($sumdiff2 / ($count - 1));
1553
+        return ($sumdiff2/($count - 1));
1554 1554
     }
1555 1555
 
1556 1556
     /**
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
             return $count;
1580 1580
         }
1581 1581
 
1582
-        return $sumabsdev / $count;
1582
+        return $sumabsdev/$count;
1583 1583
     }
1584 1584
 
1585 1585
     /**
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
         $sdev = 0;
1604 1604
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
1605 1605
             foreach ($this->_data as $val => $freq) {
1606
-                $sdev += $freq * abs($val - $mean);
1606
+                $sdev += $freq*abs($val - $mean);
1607 1607
             }
1608 1608
         } else {
1609 1609
             foreach ($this->_data as $val) {
Please login to merge, or discard this patch.
src/Histogram/Histogram3D.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
      * Sets the binning options. Overrides parent's method.
43 43
      *
44 44
      * @access  public
45
-     * @param   array $binOptions  an array of options for binning the data
46
-     * @return  void
45
+     * @param   string $binOptions  an array of options for binning the data
46
+     * @return  boolean
47 47
      */
48 48
 
49 49
     public function setBinOptions($binOptions)
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @access  public
63 63
      * @param   array   $data   the numeric array
64
-     * @return  mixed   boolean true on success, a \PEAR_Error object otherwise
64
+     * @return  boolean   boolean true on success, a \PEAR_Error object otherwise
65 65
      *
66 66
      * @see _clear()
67 67
      * @see Math_AbstractHistogram::getData()
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      * array
241 241
      *
242 242
      * @access  private
243
-     * @param   array   $elem
243
+     * @param   string   $elem
244 244
      * @return  array   of values: array(min, max)
245 245
      */
246 246
     public function _getMinMax($elem)
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         $this->_bins      = array();
108 108
         $this->_stats     = array('x' => new \HuasoFoundries\Math\Stats(), 'y' => new \HuasoFoundries\Math\Stats());
109 109
         $this->_statsMode = $statsMode;
110
-        $deltaX           = ($this->_rangeHigh['x'] - $this->_rangeLow['x']) / $this->_nbins['x'];
111
-        $deltaY           = ($this->_rangeHigh['y'] - $this->_rangeLow['y']) / $this->_nbins['y'];
110
+        $deltaX           = ($this->_rangeHigh['x'] - $this->_rangeLow['x'])/$this->_nbins['x'];
111
+        $deltaY           = ($this->_rangeHigh['y'] - $this->_rangeLow['y'])/$this->_nbins['y'];
112 112
         $data             = $this->_histogramData();
113 113
         //$dataX = $this->_data['x'];
114 114
         //$dataY = $this->_data['y'];
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
         $cumm       = 0;
119 119
         $nData      = count($dataX);
120 120
         for ($i = 0; $i < $this->_nbins['x']; $i++) {
121
-            $loXBin = $this->_rangeLow['x'] + $i * $deltaX;
121
+            $loXBin = $this->_rangeLow['x'] + $i*$deltaX;
122 122
             $hiXBin = $loXBin + $deltaX;
123 123
             $xBin   = array('low' => $loXBin, 'high' => $hiXBin,
124
-                'mid'             => ($hiXBin + $loXBin) / 2);
124
+                'mid'             => ($hiXBin + $loXBin)/2);
125 125
             for ($j = 0; $j < $this->_nbins['y']; $j++) {
126
-                $loYBin = $this->_rangeLow['y'] + $j * $deltaY;
126
+                $loYBin = $this->_rangeLow['y'] + $j*$deltaY;
127 127
                 $hiYBin = $loYBin + $deltaY;
128 128
                 $yBin   = array('low' => $loYBin, 'high' => $hiYBin,
129
-                    'mid'             => ($hiYBin + $loYBin) / 2);
129
+                    'mid'             => ($hiYBin + $loYBin)/2);
130 130
                 $bin  = array('x' => $xBin, 'y' => $yBin);
131 131
                 $freq = 0;
132 132
                 for ($k = 0; $k < $nData; $k++) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $out[] = implode($separator, $bins[$i]);
233 233
         }
234 234
 
235
-        return implode("\n", $out) . "\n";
235
+        return implode("\n", $out)."\n";
236 236
     }
237 237
 
238 238
     /**
Please login to merge, or discard this patch.
src/Histogram/Printer/Text.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
         $out     = ($this->_hist->_type == \HuasoFoundries\Histogram\Histogram::HISTOGRAM_CUMMULATIVE) ? "Cummulative Frequency" : "Histogram";
47 47
         $out .= "\n\tNumber of bins: {$binopts['nbins']}\n";
48 48
         $out .= "\tPlot range: [{$binopts['rangeLow']}, {$binopts['rangeHigh']}]\n";
49
-        $out .= "\tData range: [" . min($hdata) . ", " . max($hdata) . "]\n";
50
-        $out .= "\tOriginal data range: [" . min($data) . ", " . max($data) . "]\n";
49
+        $out .= "\tData range: [".min($hdata).", ".max($hdata)."]\n";
50
+        $out .= "\tOriginal data range: [".min($data).", ".max($data)."]\n";
51 51
         $out .= "BIN (FREQUENCY) ASCII_BAR (%)\n";
52 52
         foreach ($bins as $bin => $freq) {
53 53
             $out .= sprintf($fmt, $bin, $freq, $this->_bar($freq, $maxfreq, $total));
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function _bar($freq, $maxfreq, $total)
106 106
     {
107
-        $fact  = floatval(($maxfreq > 40) ? 40 / $maxfreq : 1);
108
-        $niter = round($freq * $fact);
107
+        $fact  = floatval(($maxfreq > 40) ? 40/$maxfreq : 1);
108
+        $niter = round($freq*$fact);
109 109
         $out   = "";
110 110
         for ($i = 0; $i < $niter; $i++) {
111 111
             $out .= "*";
112 112
         }
113 113
 
114
-        return $out . sprintf(" (%.1f%%)", $freq / $total * 100);
114
+        return $out.sprintf(" (%.1f%%)", $freq/$total*100);
115 115
     }
116 116
 
117 117
     /**
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
         $out = '';
128 128
         foreach ($stats as $name => $value) {
129 129
             if (is_array($value)) {
130
-                $out .= $prefix . $name . ":\n";
131
-                $out .= $this->_printStats($value, $prefix . "\t");
130
+                $out .= $prefix.$name.":\n";
131
+                $out .= $this->_printStats($value, $prefix."\t");
132 132
             } else {
133 133
                 $out .= "{$prefix}{$name}: $value\n";
134 134
             }
Please login to merge, or discard this patch.