Passed
Push — master ( e62a8d...f6e622 )
by Felipe
04:35 queued 02:04
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
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $this->_stats = new \HuasoFoundries\Math\Stats();
117 117
 
118 118
         $this->_statsMode = $statsMode;
119
-        $delta = ($this->_rangeHigh - $this->_rangeLow) / $this->_nbins;
119
+        $delta = ($this->_rangeHigh - $this->_rangeLow)/$this->_nbins;
120 120
         $lastpos = 0;
121 121
         $cumm = 0;
122 122
         $data = $this->_histogramData();
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
         $ignoreList = array();
125 125
 
126 126
         for ($i = 0; $i < $this->_nbins; $i++) {
127
-            $loBin = $this->_rangeLow + $i * $delta;
127
+            $loBin = $this->_rangeLow + $i*$delta;
128 128
             $hiBin = $loBin + $delta;
129 129
             $this->_bins[$i]["low"] = $loBin;
130 130
             $this->_bins[$i]["high"] = $hiBin;
131
-            $this->_bins[$i]["mid"] = ($hiBin + $loBin) / 2;
131
+            $this->_bins[$i]["mid"] = ($hiBin + $loBin)/2;
132 132
             if ($this->_type == self::HISTOGRAM_CUMMULATIVE) {
133 133
                 $this->_bins[$i]["count"] = $cumm;
134 134
             } else {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             $out[] = "{$bin}{$separator}{$freq}";
218 218
         }
219 219
 
220
-        return implode("\n", $out) . "\n";
220
+        return implode("\n", $out)."\n";
221 221
     }
222 222
 
223 223
     /**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
             throw new \PEAR_Exception("histogram has not been calculated");
280 280
         }
281 281
         $out = ($this->_type == self::HISTOGRAM_CUMMULATIVE) ? "Cummulative Frequency" : "Histogram";
282
-        $out .= "\n\tNumber of bins: " . $this->_nbins . "\n";
283
-        $out .= "\tPlot range: [" . $this->_rangeLow . ", " . $this->_rangeHigh . "]\n";
282
+        $out .= "\n\tNumber of bins: ".$this->_nbins."\n";
283
+        $out .= "\tPlot range: [".$this->_rangeLow.", ".$this->_rangeHigh."]\n";
284 284
         $hdata = $this->_histogramData();
285
-        $out .= "\tData range: [" . min($hdata) . ", " . max($hdata) . "]\n";
286
-        $out .= "\tOriginal data range: [" . min($this->_data) . ", " . max($this->_data) . "]\n";
285
+        $out .= "\tData range: [".min($hdata).", ".max($hdata)."]\n";
286
+        $out .= "\tOriginal data range: [".min($this->_data).", ".max($this->_data)."]\n";
287 287
         $out .= "BIN (FREQUENCY) ASCII_BAR (%)\n";
288 288
         $fmt = "%-4.3f (%-4d) |%s\n";
289 289
         $bins = $this->_filterBins($mode);
@@ -308,14 +308,14 @@  discard block
 block discarded – undo
308 308
     public function _bar($freq, $maxfreq, $total)
309 309
     {
310 310
 
311
-        $fact = floatval(($maxfreq > 40) ? 40 / $maxfreq : 1);
312
-        $niter = round($freq * $fact);
311
+        $fact = floatval(($maxfreq > 40) ? 40/$maxfreq : 1);
312
+        $niter = round($freq*$fact);
313 313
         $out = "";
314 314
         for ($i = 0; $i < $niter; $i++) {
315 315
             $out .= "*";
316 316
         }
317 317
 
318
-        return $out . sprintf(" (%.1f%%)", $freq / $total * 100);
318
+        return $out.sprintf(" (%.1f%%)", $freq/$total*100);
319 319
 
320 320
     }
321 321
 
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
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
  * Sets the binning options. Overrides parent's method.
44 44
  *
45 45
  * @access  public
46
- * @param   array $binOptions  an array of options for binning the data
47
- * @return  void
46
+ * @param   string $binOptions  an array of options for binning the data
47
+ * @return  boolean
48 48
  */
49 49
 
50 50
     public function setBinOptions($binOptions)
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @access  public
66 66
      * @param   array   $data   the numeric array
67
-     * @return  mixed   boolean true on success, a \PEAR_Error object otherwise
67
+     * @return  boolean   boolean true on success, a \PEAR_Error object otherwise
68 68
      *
69 69
      * @see _clear()
70 70
      * @see Math_AbstractHistogram::getData()
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * array
249 249
      *
250 250
      * @access  private
251
-     * @param   array   $elem
251
+     * @param   string   $elem
252 252
      * @return  array   of values: array(min, max)
253 253
      */
254 254
     public function _getMinMax($elem)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
         $this->_bins = array();
113 113
         $this->_stats = array('x' => new \HuasoFoundries\Math\Stats(), 'y' => new \HuasoFoundries\Math\Stats());
114 114
         $this->_statsMode = $statsMode;
115
-        $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x']) / $this->_nbins['x'];
116
-        $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y']) / $this->_nbins['y'];
115
+        $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x'])/$this->_nbins['x'];
116
+        $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y'])/$this->_nbins['y'];
117 117
         $data = $this->_histogramData();
118 118
         //$dataX = $this->_data['x'];
119 119
         //$dataY = $this->_data['y'];
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
         $cumm = 0;
124 124
         $nData = count($dataX);
125 125
         for ($i = 0; $i < $this->_nbins['x']; $i++) {
126
-            $loXBin = $this->_rangeLow['x'] + $i * $deltaX;
126
+            $loXBin = $this->_rangeLow['x'] + $i*$deltaX;
127 127
             $hiXBin = $loXBin + $deltaX;
128 128
             $xBin = array('low' => $loXBin, 'high' => $hiXBin,
129
-                'mid' => ($hiXBin + $loXBin) / 2);
129
+                'mid' => ($hiXBin + $loXBin)/2);
130 130
             for ($j = 0; $j < $this->_nbins['y']; $j++) {
131
-                $loYBin = $this->_rangeLow['y'] + $j * $deltaY;
131
+                $loYBin = $this->_rangeLow['y'] + $j*$deltaY;
132 132
                 $hiYBin = $loYBin + $deltaY;
133 133
                 $yBin = array('low' => $loYBin, 'high' => $hiYBin,
134
-                    'mid' => ($hiYBin + $loYBin) / 2);
134
+                    'mid' => ($hiYBin + $loYBin)/2);
135 135
                 $bin = array('x' => $xBin, 'y' => $yBin);
136 136
                 $freq = 0;
137 137
                 for ($k = 0; $k < $nData; $k++) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
             $out[] = implode($separator, $bins[$i]);
241 241
         }
242 242
 
243
-        return implode("\n", $out) . "\n";
243
+        return implode("\n", $out)."\n";
244 244
     }
245 245
 
246 246
     /**
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
             && is_array($binOptions['low'])
301 301
             && is_array($binOptions['high'])
302 302
             && is_array($binOptions['nbins']));
303
-        if(!$barray) {
303
+        if (!$barray) {
304 304
             return false;
305 305
         }
306 306
         $low = $binOptions['low'];
Please login to merge, or discard this patch.
src/Histogram/Histogram4D.php 3 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.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     {
32 32
 
33 33
         $this->setType($type);
34
-         try {
34
+            try {
35 35
             $this->setBinOptions($binOptions);
36 36
         } catch (\PEAR_Exception $e) {
37 37
             // Falling back to default options
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
         $this->_bins = array();
112 112
         $this->_stats = array('x' => new \HuasoFoundries\Math\Stats(), 'y' => new \HuasoFoundries\Math\Stats(), 'z' => new \HuasoFoundries\Math\Stats());
113 113
         $this->_statsMode = $statsMode;
114
-        $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x']) / $this->_nbins['x'];
115
-        $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y']) / $this->_nbins['y'];
116
-        $deltaZ = ($this->_rangeHigh['z'] - $this->_rangeLow['z']) / $this->_nbins['z'];
114
+        $deltaX = ($this->_rangeHigh['x'] - $this->_rangeLow['x'])/$this->_nbins['x'];
115
+        $deltaY = ($this->_rangeHigh['y'] - $this->_rangeLow['y'])/$this->_nbins['y'];
116
+        $deltaZ = ($this->_rangeHigh['z'] - $this->_rangeLow['z'])/$this->_nbins['z'];
117 117
         $data = $this->_histogramData();
118 118
         $dataX = $data['x'];
119 119
         $dataY = $data['y'];
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
         $cumm = 0;
123 123
         $nData = count($dataX);
124 124
         for ($i = 0; $i < $this->_nbins['x']; $i++) {
125
-            $loXBin = $this->_rangeLow['x'] + $i * $deltaX;
125
+            $loXBin = $this->_rangeLow['x'] + $i*$deltaX;
126 126
             $hiXBin = $loXBin + $deltaX;
127 127
             $xBin = array('low' => $loXBin, 'high' => $hiXBin,
128
-                'mid' => ($hiXBin + $loXBin) / 2);
128
+                'mid' => ($hiXBin + $loXBin)/2);
129 129
             for ($j = 0; $j < $this->_nbins['y']; $j++) {
130
-                $loYBin = $this->_rangeLow['y'] + $j * $deltaY;
130
+                $loYBin = $this->_rangeLow['y'] + $j*$deltaY;
131 131
                 $hiYBin = $loYBin + $deltaY;
132 132
                 $yBin = array('low' => $loYBin, 'high' => $hiYBin,
133
-                    'mid' => ($hiYBin + $loYBin) / 2);
133
+                    'mid' => ($hiYBin + $loYBin)/2);
134 134
                 for ($m = 0; $m < $this->_nbins['z']; $m++) {
135
-                    $loZBin = $this->_rangeLow['z'] + $m * $deltaZ;
135
+                    $loZBin = $this->_rangeLow['z'] + $m*$deltaZ;
136 136
                     $hiZBin = $loZBin + $deltaZ;
137 137
                     $zBin = array('low' => $loZBin, 'high' => $hiZBin,
138
-                        'mid' => ($hiZBin + $loZBin) / 2);
138
+                        'mid' => ($hiZBin + $loZBin)/2);
139 139
                     $bin = array('x' => $xBin, 'y' => $yBin, 'z' => $zBin);
140 140
                     $freq = 0;
141 141
                     for ($k = 0; $k < $nData; $k++) {
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             $out[] = implode($separator, $bins[$i]);
258 258
         }
259 259
 
260
-        return implode("\n", $out) . "\n";
260
+        return implode("\n", $out)."\n";
261 261
     }
262 262
 
263 263
     /**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
             && is_array($binOptions['high'])
320 320
             && is_array($binOptions['nbins']));
321 321
 
322
-        if(!$barray) {
322
+        if (!$barray) {
323 323
             return false;
324 324
         }
325 325
         $low = $binOptions['low'];
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/Histogram/Printer/Text.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      * Returns a string representation of a Histogram plot
17 17
      *
18 18
      * @access public
19
-     * @return string|PEAR_Error A string on succcess, a \PEAR_Error otherwise
19
+     * @return string A string on succcess, a \PEAR_Error otherwise
20 20
      */
21 21
     public function generateOutput()
22 22
     {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * Prints out a graphic representation of a Histogram
65 65
      *
66 66
      * @access public
67
-     * @return boolean|PEAR_Error TRUE on success, a \PEAR_Error otherwise
67
+     * @return string|null TRUE on success, a \PEAR_Error otherwise
68 68
      */
69 69
     public function printOutput()
70 70
     {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
         $out = ($this->_hist->_type == \HuasoFoundries\Histogram\Histogram::HISTOGRAM_CUMMULATIVE) ? "Cummulative Frequency" : "Histogram";
48 48
         $out .= "\n\tNumber of bins: {$binopts['nbins']}\n";
49 49
         $out .= "\tPlot range: [{$binopts['rangeLow']}, {$binopts['rangeHigh']}]\n";
50
-        $out .= "\tData range: [" . min($hdata) . ", " . max($hdata) . "]\n";
51
-        $out .= "\tOriginal data range: [" . min($data) . ", " . max($data) . "]\n";
50
+        $out .= "\tData range: [".min($hdata).", ".max($hdata)."]\n";
51
+        $out .= "\tOriginal data range: [".min($data).", ".max($data)."]\n";
52 52
         $out .= "BIN (FREQUENCY) ASCII_BAR (%)\n";
53 53
         foreach ($bins as $bin => $freq) {
54 54
             $out .= sprintf($fmt, $bin, $freq, $this->_bar($freq, $maxfreq, $total));
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
     public function _bar($freq, $maxfreq, $total)
109 109
     {
110 110
 
111
-        $fact = floatval(($maxfreq > 40) ? 40 / $maxfreq : 1);
112
-        $niter = round($freq * $fact);
111
+        $fact = floatval(($maxfreq > 40) ? 40/$maxfreq : 1);
112
+        $niter = round($freq*$fact);
113 113
         $out = "";
114 114
         for ($i = 0; $i < $niter; $i++) {
115 115
             $out .= "*";
116 116
         }
117 117
 
118
-        return $out . sprintf(" (%.1f%%)", $freq / $total * 100);
118
+        return $out.sprintf(" (%.1f%%)", $freq/$total*100);
119 119
 
120 120
     }
121 121
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
         $out = '';
134 134
         foreach ($stats as $name => $value) {
135 135
             if (is_array($value)) {
136
-                $out .= $prefix . $name . ":\n";
137
-                $out .= $this->_printStats($value, $prefix . "\t");
136
+                $out .= $prefix.$name.":\n";
137
+                $out .= $this->_printStats($value, $prefix."\t");
138 138
             } else {
139 139
                 $out .= "{$prefix}{$name}: $value\n";
140 140
             }
Please login to merge, or discard this patch.
src/Math/Stats.php 3 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.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
      */
19 19
     const STATS_BASIC = 1;
20 20
 /**
21
- * STATS_FULL to generate also higher moments, mode, median, etc.
22
- */
21
+     * STATS_FULL to generate also higher moments, mode, median, etc.
22
+     */
23 23
     const STATS_FULL = 2;
24 24
 
25 25
 // Constants describing the data set format
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
      */
30 30
     const STATS_DATA_SIMPLE = 0;
31 31
 /**
32
- * STATS_DATA_CUMMULATIVE for an associative array of frequency values,
33
- * where in each array entry, the index is the data point and the
34
- * value the count (frequency):
35
- * e.g. $data = array(3=>4, 2.3=>5, 1.25=>6, 0.5=>3)
36
- */
32
+     * STATS_DATA_CUMMULATIVE for an associative array of frequency values,
33
+     * where in each array entry, the index is the data point and the
34
+     * value the count (frequency):
35
+     * e.g. $data = array(3=>4, 2.3=>5, 1.25=>6, 0.5=>3)
36
+     */
37 37
     const STATS_DATA_CUMMULATIVE = 1;
38 38
 
39 39
 // Constants defining how to handle nulls
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
      */
44 44
     const STATS_REJECT_NULL = -1;
45 45
 /**
46
- * STATS_IGNORE_NULL, ignore null values and prune them from the data.
47
- * Any non-numeric value is considered a null in this context.
48
- */
46
+     * STATS_IGNORE_NULL, ignore null values and prune them from the data.
47
+     * Any non-numeric value is considered a null in this context.
48
+     */
49 49
     const STATS_IGNORE_NULL = -2;
50 50
 /**
51
- * STATS_USE_NULL_AS_ZERO, assign the value of 0 (zero) to null values.
52
- * Any non-numeric value is considered a null in this context.
53
- */
51
+     * STATS_USE_NULL_AS_ZERO, assign the value of 0 (zero) to null values.
52
+     * Any non-numeric value is considered a null in this context.
53
+     */
54 54
     const STATS_USE_NULL_AS_ZERO = -3;
55 55
 
56 56
     // properties
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             $this->_nullOption = $nullOption;
183 183
             return true;
184 184
         } else {
185
-            throw new \PEAR_Exception('invalid null handling option expecting: ' .
185
+            throw new \PEAR_Exception('invalid null handling option expecting: '.
186 186
                 'STATS_REJECT_NULL, STATS_IGNORE_NULL or STATS_USE_NULL_AS_ZERO');
187 187
         }
188 188
     }
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
         $arr = array();
218 218
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
219 219
             foreach ($this->_data as $val => $freq) {
220
-                $newval = ($val - $mean) / $std;
220
+                $newval = ($val - $mean)/$std;
221 221
                 $arr["$newval"] = $freq;
222 222
             }
223 223
         } else {
224 224
             foreach ($this->_data as $val) {
225
-                $newval = ($val - $mean) / $std;
225
+                $newval = ($val - $mean)/$std;
226 226
                 $arr[] = $newval;
227 227
             }
228 228
         }
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
         $sumN = 0;
497 497
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
498 498
             foreach ($this->_data as $val => $freq) {
499
-                $sumN += $freq * pow((double) $val, (double) $n);
499
+                $sumN += $freq*pow((double)$val, (double)$n);
500 500
             }
501 501
         } else {
502 502
             foreach ($this->_data as $val) {
503
-                $sumN += pow((double) $val, (double) $n);
503
+                $sumN += pow((double)$val, (double)$n);
504 504
             }
505 505
         }
506 506
         return $sumN;
@@ -555,8 +555,8 @@  discard block
 block discarded – undo
555 555
                 if ($val == 0) {
556 556
                     return 0.0;
557 557
                 }
558
-                $prodN *= $freq * pow((double) $val, (double) $n);
559
-                if ($prodN > 10000 * $n) {
558
+                $prodN *= $freq*pow((double)$val, (double)$n);
559
+                if ($prodN > 10000*$n) {
560 560
                     $partial[] = $prodN;
561 561
                     $prodN = 1.0;
562 562
                 }
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
                 if ($val == 0) {
567 567
                     return 0.0;
568 568
                 }
569
-                $prodN *= pow((double) $val, (double) $n);
570
-                if ($prodN > 10 * $n) {
569
+                $prodN *= pow((double)$val, (double)$n);
570
+                if ($prodN > 10*$n) {
571 571
                     $partial[] = $prodN;
572 572
                     $prodN = 1.0;
573 573
                 }
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
                 } catch (\PEAR_Exception $e) {
638 638
                     return $count;
639 639
                 }
640
-                $this->_calculatedValues['mean'] = $sum / $count;
640
+                $this->_calculatedValues['mean'] = $sum/$count;
641 641
             } catch (\PEAR_Exception $e) {
642 642
                 return $sum;
643 643
             }
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
                 return $count;
848 848
             }
849 849
 
850
-            $this->_calculatedValues['skewness'] = ($sumdiff3 / ($count * pow($stDev, 3)));
850
+            $this->_calculatedValues['skewness'] = ($sumdiff3/($count*pow($stDev, 3)));
851 851
         }
852 852
         return $this->_calculatedValues['skewness'];
853 853
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
                 return $count;
892 892
             }
893 893
 
894
-            $this->_calculatedValues['kurtosis'] = ($sumdiff4 / ($count * pow($stDev, 4))) - 3;
894
+            $this->_calculatedValues['kurtosis'] = ($sumdiff4/($count*pow($stDev, 4))) - 3;
895 895
         }
896 896
         return $this->_calculatedValues['kurtosis'];
897 897
     }
@@ -927,9 +927,9 @@  discard block
 block discarded – undo
927 927
                 return $n;
928 928
             }
929 929
 
930
-            $h = intval($n / 2);
931
-            if ($n % 2 == 0) {
932
-                $median = ($arr[$h] + $arr[$h - 1]) / 2;
930
+            $h = intval($n/2);
931
+            if ($n%2 == 0) {
932
+                $median = ($arr[$h] + $arr[$h - 1])/2;
933 933
             } else {
934 934
                 $median = $arr[$h];
935 935
             }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
                 return $min;
1011 1011
             }
1012 1012
 
1013
-            $this->_calculatedValues['midrange'] = (($max + $min) / 2);
1013
+            $this->_calculatedValues['midrange'] = (($max + $min)/2);
1014 1014
         }
1015 1015
         return $this->_calculatedValues['midrange'];
1016 1016
     }
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
             if (is_array($prod)) {
1043 1043
                 $geomMean = 1.0;
1044 1044
                 foreach ($prod as $val) {
1045
-                    $geomMean *= pow($val, 1 / $count);
1045
+                    $geomMean *= pow($val, 1/$count);
1046 1046
                 }
1047 1047
                 $this->_calculatedValues['geometricMean'] = $geomMean;
1048 1048
             } else {
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
                 if ($prod < 0) {
1053 1053
                     throw new \PEAR_Exception('The product of the data set is negative, geometric mean undefined.');
1054 1054
                 }
1055
-                $this->_calculatedValues['geometricMean'] = pow($prod, 1 / $count);
1055
+                $this->_calculatedValues['geometricMean'] = pow($prod, 1/$count);
1056 1056
             }
1057 1057
         }
1058 1058
         return $this->_calculatedValues['geometricMean'];
@@ -1083,21 +1083,21 @@  discard block
 block discarded – undo
1083 1083
             if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
1084 1084
                 foreach ($this->_data as $val => $freq) {
1085 1085
                     if ($val == 0) {
1086
-                        throw new \PEAR_Exception('cannot calculate a ' .
1086
+                        throw new \PEAR_Exception('cannot calculate a '.
1087 1087
                             'harmonic mean with data values of zero.');
1088 1088
                     }
1089
-                    $invsum += $freq / $val;
1089
+                    $invsum += $freq/$val;
1090 1090
                 }
1091 1091
             } else {
1092 1092
                 foreach ($this->_data as $val) {
1093 1093
                     if ($val == 0) {
1094
-                        throw new \PEAR_Exception('cannot calculate a ' .
1094
+                        throw new \PEAR_Exception('cannot calculate a '.
1095 1095
                             'harmonic mean with data values of zero.');
1096 1096
                     }
1097
-                    $invsum += 1 / $val;
1097
+                    $invsum += 1/$val;
1098 1098
                 }
1099 1099
             }
1100
-            $this->_calculatedValues['harmonicMean'] = $count / $invsum;
1100
+            $this->_calculatedValues['harmonicMean'] = $count/$invsum;
1101 1101
         }
1102 1102
         return $this->_calculatedValues['harmonicMean'];
1103 1103
     }
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
             return $count;
1132 1132
         }
1133 1133
         if ($count == 0) {
1134
-            throw new \PEAR_Exception("Cannot calculate {$n}th sample moment, " .
1134
+            throw new \PEAR_Exception("Cannot calculate {$n}th sample moment, ".
1135 1135
                 'there are zero data entries');
1136 1136
         }
1137 1137
         try {
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
         } catch (\PEAR_Exception $e) {
1140 1140
             return $sum;
1141 1141
         }
1142
-        return ($sum / $count);
1142
+        return ($sum/$count);
1143 1143
     }
1144 1144
 
1145 1145
     /**
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
             return $count;
1169 1169
         }
1170 1170
         if ($count == 0) {
1171
-            throw new \PEAR_Exception("Cannot calculate {$n}th raw moment, " .
1171
+            throw new \PEAR_Exception("Cannot calculate {$n}th raw moment, ".
1172 1172
                 'there are zero data entries.');
1173 1173
         }
1174 1174
         try {
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
         } catch (\PEAR_Exception $e) {
1177 1177
             return $sum;
1178 1178
         }
1179
-        return ($sum / $count);
1179
+        return ($sum/$count);
1180 1180
     }
1181 1181
 
1182 1182
     /**
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
             }
1203 1203
 
1204 1204
             if ($mean == 0.0) {
1205
-                throw new \PEAR_Exception('cannot calculate the coefficient ' .
1205
+                throw new \PEAR_Exception('cannot calculate the coefficient '.
1206 1206
                     'of variation, mean of sample is zero');
1207 1207
             }
1208 1208
             try {
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
                 return $stDev;
1212 1212
             }
1213 1213
 
1214
-            $this->_calculatedValues['coeffOfVariation'] = $stDev / $mean;
1214
+            $this->_calculatedValues['coeffOfVariation'] = $stDev/$mean;
1215 1215
         }
1216 1216
         return $this->_calculatedValues['coeffOfVariation'];
1217 1217
     }
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
             } catch (\PEAR_Exception $e) {
1248 1248
                 return $stDev;
1249 1249
             }
1250
-            $this->_calculatedValues['stdErrorOfMean'] = $stDev / sqrt($count);
1250
+            $this->_calculatedValues['stdErrorOfMean'] = $stDev/sqrt($count);
1251 1251
         }
1252 1252
         return $this->_calculatedValues['stdErrorOfMean'];
1253 1253
     }
@@ -1358,10 +1358,10 @@  discard block
 block discarded – undo
1358 1358
                 }
1359 1359
             }
1360 1360
             if ($n == 0) {
1361
-                throw new \PEAR_Exception('error calculating interquartile mean, ' .
1361
+                throw new \PEAR_Exception('error calculating interquartile mean, '.
1362 1362
                     'empty interquartile range of values.');
1363 1363
             }
1364
-            $this->_calculatedValues['interquartileMean'] = $sum / $n;
1364
+            $this->_calculatedValues['interquartileMean'] = $sum/$n;
1365 1365
         }
1366 1366
         return $this->_calculatedValues['interquartileMean'];
1367 1367
     }
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
             } catch (\PEAR_Exception $e) {
1417 1417
                 return $iqr;
1418 1418
             }
1419
-            $this->_calculatedValues['quartileDeviation'] = $iqr / 2;
1419
+            $this->_calculatedValues['quartileDeviation'] = $iqr/2;
1420 1420
         }
1421 1421
         return $this->_calculatedValues['quartileDeviation'];
1422 1422
     }
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
             $q1 = $quart['25'];
1447 1447
             $d = $q3 - $q1;
1448 1448
             $s = $q3 + $q1;
1449
-            $this->_calculatedValues['quartileVariationCoefficient'] = 100 * $d / $s;
1449
+            $this->_calculatedValues['quartileVariationCoefficient'] = 100*$d/$s;
1450 1450
         }
1451 1451
         return $this->_calculatedValues['quartileVariationCoefficient'];
1452 1452
     }
@@ -1476,9 +1476,9 @@  discard block
 block discarded – undo
1476 1476
             $q3 = $quart['75'];
1477 1477
             $q2 = $quart['50'];
1478 1478
             $q1 = $quart['25'];
1479
-            $d = $q3 - 2 * $q2 + $q1;
1479
+            $d = $q3 - 2*$q2 + $q1;
1480 1480
             $s = $q3 - $q1;
1481
-            $this->_calculatedValues['quartileSkewnessCoefficient'] = $d / $s;
1481
+            $this->_calculatedValues['quartileSkewnessCoefficient'] = $d/$s;
1482 1482
         }
1483 1483
         return $this->_calculatedValues['quartileSkewnessCoefficient'];
1484 1484
     }
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
         } else {
1521 1521
             $data = &$this->_data;
1522 1522
         }
1523
-        $obsidx = $p * ($count + 1) / 100;
1523
+        $obsidx = $p*($count + 1)/100;
1524 1524
         if (intval($obsidx) == $obsidx) {
1525 1525
             return $data[($obsidx - 1)];
1526 1526
         } elseif ($obsidx < 1) {
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
         } else {
1531 1531
             $left = floor($obsidx - 1);
1532 1532
             $right = ceil($obsidx - 1);
1533
-            return ($data[$left] + $data[$right]) / 2;
1533
+            return ($data[$left] + $data[$right])/2;
1534 1534
         }
1535 1535
     }
1536 1536
 
@@ -1566,11 +1566,11 @@  discard block
 block discarded – undo
1566 1566
         $sdiff = 0;
1567 1567
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
1568 1568
             foreach ($this->_data as $val => $freq) {
1569
-                $sdiff += $freq * pow((double) ($val - $mean), (double) $power);
1569
+                $sdiff += $freq*pow((double)($val - $mean), (double)$power);
1570 1570
             }
1571 1571
         } else {
1572 1572
             foreach ($this->_data as $val) {
1573
-                $sdiff += pow((double) ($val - $mean), (double) $power);
1573
+                $sdiff += pow((double)($val - $mean), (double)$power);
1574 1574
             }
1575 1575
 
1576 1576
         }
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
         if ($count == 1) {
1608 1608
             throw new \PEAR_Exception('cannot calculate variance of a singe data point');
1609 1609
         }
1610
-        return ($sumdiff2 / ($count - 1));
1610
+        return ($sumdiff2/($count - 1));
1611 1611
     }
1612 1612
 
1613 1613
     /**
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
             return $count;
1638 1638
         }
1639 1639
 
1640
-        return $sumabsdev / $count;
1640
+        return $sumabsdev/$count;
1641 1641
     }
1642 1642
 
1643 1643
     /**
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
         $sdev = 0;
1663 1663
         if ($this->_dataOption == self::STATS_DATA_CUMMULATIVE) {
1664 1664
             foreach ($this->_data as $val => $freq) {
1665
-                $sdev += $freq * abs($val - $mean);
1665
+                $sdev += $freq*abs($val - $mean);
1666 1666
             }
1667 1667
         } else {
1668 1668
             foreach ($this->_data as $val) {
Please login to merge, or discard this patch.