Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug #14989 - PHPCS

  • Loading branch information...
commit b970a6b99eba10cc100137daee2f70becbb60766 1 parent 33d4093
authored December 29, 2008
85  Math/Numerical/RootFinding/Bisection.php
... ...
@@ -1,8 +1,4 @@
1 1
 <?php
2  
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3  
-
4  
-// {{{ Header
5  
-
6 2
 /**
7 3
  * Driver file contains Math_Numerical_RootFinding_Bisection class to provide
8 4
  * Bisection/Binary Chopping/Interval Halving/Bolzano method root finding
@@ -21,51 +17,43 @@
21 17
  * obtain it through the world-wide-web, please send an email
22 18
  * to pear-dev@list.php.net so we can send you a copy immediately.
23 19
  *
24  
- * @category    Math
25  
- * @package     Math_Numerical_RootFinding
26  
- * @subpackage  Methods
27  
- * @author      Firman Wandayandi <firman@php.net>
28  
- * @copyright   Copyright (c) 2004-2008 Firman Wandayandi
29  
- * @license     http://www.opensource.org/licenses/bsd-license.php
30  
- *              BSD License
31  
- * @version     CVS: $Id$
  20
+ * @category   Math
  21
+ * @package    Math_Numerical_RootFinding
  22
+ * @subpackage Methods
  23
+ * @author     Firman Wandayandi <firman@php.net>
  24
+ * @copyright  2004-2008 Firman Wandayandi
  25
+ * @license    http://www.opensource.org/licenses/bsd-license.php BSD License
  26
+ * @version    CVS: $Id$
32 27
  */
33 28
 
34  
-// }}}
35  
-// {{{ Dependencies
36  
-
37 29
 /**
38 30
  * Math_Numerical_RootFinding_Common
39 31
  */
40 32
 require_once 'Math/Numerical/RootFinding/Common.php';
41 33
 
42  
-// }}}
43  
-// {{{ Class: Math_Numerical_RootFinding_Bisection
44  
-
45 34
 /**
46 35
  * Bisection/Binary Chopping/Interval Halving/Bolzano method class.
47 36
  *
48  
- * @category    Math
49  
- * @package     Math_Numerical_RootFinding
50  
- * @subpackage  Methods
51  
- * @author      Firman Wandayandi <firman@php.net>
52  
- * @copyright   Copyright (c) 2004-2008 Firman Wandayandi
53  
- * @license     http://www.opensource.org/licenses/bsd-license.php
54  
- *              BSD License
55  
- * @version     Release: @package_version@
  37
+ * @category   Math
  38
+ * @package    Math_Numerical_RootFinding
  39
+ * @subpackage Methods
  40
+ * @author     Firman Wandayandi <firman@php.net>
  41
+ * @copyright  2004-2008 Firman Wandayandi
  42
+ * @license    http://www.opensource.org/licenses/bsd-license.php BSD License
  43
+ * @version    Release: @package_version@
  44
+ * @link       http://pear.php.net/package/Math_Numerical_RootFinding
56 45
  */
57  
-class Math_Numerical_RootFinding_Bisection
58  
-extends Math_Numerical_RootFinding_Common
  46
+class Math_Numerical_RootFinding_Bisection extends Math_Numerical_RootFinding_Common
59 47
 {
60 48
     // {{{ Constructor
61 49
 
62 50
     /**
63 51
      * Constructor.
64 52
      *
65  
-     * @param   array   $options (optional) Options.
  53
+     * @param array $options (optional) Options.
66 54
      *
67  
-     * @access  public
68  
-     * @see     Math_Numerical_RootFinding_Common::Math_Numerical_RootFinding_Common()
  55
+     * @access public
  56
+     * @see Math_Numerical_RootFinding_Common::Math_Numerical_RootFinding_Common()
69 57
      */
70 58
     function Math_Numerical_RootFinding_Bisection($options = null)
71 59
     {
@@ -79,6 +67,7 @@ function Math_Numerical_RootFinding_Bisection($options = null)
79 67
      * Print out parameters description for compute() function.
80 68
      *
81 69
      * @access public
  70
+     * @return void
82 71
      */
83 72
     function infoCompute()
84 73
     {
@@ -104,21 +93,23 @@ function infoCompute()
104 93
     /**
105 94
      * Bisection/Binary Chopping/Interval Halving/Bolzano method.
106 95
      *
107  
-     * @param   callback    $fxFunction  Callback f(x) equation function or
108  
-     *                                   object/method tuple.
109  
-     * @param   float       $xL          Lower guess.
110  
-     * @param   float       $xU          Upper guess.
  96
+     * @param callback $fxFunction Callback f(x) equation function or
  97
+     *                             object/method tuple.
  98
+     * @param float    $xL         Lower guess.
  99
+     * @param float    $xU         Upper guess.
111 100
      *
112  
-     * @return  float|PEAR_Error         Root value on success or PEAR_Error on failure.
113  
-     * @access  public
114  
-     * @see     Math_Numerical_RootFinding::validateEqFunction()
115  
-     * @see     Math_Numerical_RootFinding::getEqResult()
116  
-     * @see     Math_Numerical_RootFinding_Falseposition::compute()
  101
+     * @return float|PEAR_Error Root value on success or PEAR_Error on failure.
  102
+     * @access public
  103
+     * @see Math_Numerical_RootFinding::validateEqFunction()
  104
+     * @see Math_Numerical_RootFinding::getEqResult()
  105
+     * @see Math_Numerical_RootFinding_Falseposition::compute()
117 106
      */
118 107
     function compute($fxFunction, $xL, $xU)
119 108
     {
120 109
         // Validate f(x) equation function.
121  
-        $err = Math_Numerical_RootFinding_Common::validateEqFunction($fxFunction, $xL);
  110
+        $err = Math_Numerical_RootFinding_Common::validateEqFunction(
  111
+                 $fxFunction, $xL
  112
+               );
122 113
         if (PEAR::isError($err)) {
123 114
             return $err;
124 115
         }
@@ -127,7 +118,9 @@ function compute($fxFunction, $xL, $xU)
127 118
         $xR = ($xU + $xL) / 2;
128 119
 
129 120
         // Validate f(x) equation function.
130  
-        $err = Math_Numerical_RootFinding_Common::validateEqFunction($fxFunction, $xR);
  121
+        $err = Math_Numerical_RootFinding_Common::validateEqFunction(
  122
+                 $fxFunction, $xR
  123
+               );
131 124
         if (PEAR::isError($err)) {
132 125
             return $err;
133 126
         }
@@ -159,13 +152,15 @@ function compute($fxFunction, $xL, $xU)
159 152
 
160 153
             // Compute approximation error.
161 154
             $this->epsError = abs(($xN - $xR) / $xN);
162  
-            $epsErrors[] = $this->epsError;
  155
+            $epsErrors[]    = $this->epsError;
163 156
 
164 157
             // Detect for divergent rows.
165 158
             if ($this->isDivergentRows($epsErrors) &&
166 159
                 $this->options['divergent_skip'])
167 160
             {
168  
-                return PEAR::raiseError('Iteration skipped, divergent rows detected');
  161
+                return PEAR::raiseError(
  162
+                         'Iteration skipped, divergent rows detected'
  163
+                       );
169 164
                 break;
170 165
             }
171 166
 
@@ -186,8 +181,6 @@ function compute($fxFunction, $xL, $xU)
186 181
     // }}}
187 182
 }
188 183
 
189  
-// }}}
190  
-
191 184
 /*
192 185
  * Local variables:
193 186
  * mode: php
1  Math/Numerical/RootFinding/Common.php
@@ -41,6 +41,7 @@
41 41
  * @copyright  2004-2008 Firman Wandayandi
42 42
  * @license    http://www.opensource.org/licenses/bsd-license.php BSD License
43 43
  * @version    Release: @package_version@
  44
+ * @link       http://pear.php.net/package/Math_Numerical_RootFinding
44 45
  * @abstract
45 46
  */
46 47
 class Math_Numerical_RootFinding_Common

0 notes on commit b970a6b

Please sign in to comment.
Something went wrong with that request. Please try again.