cvs: php4 /pear/Benchmark Iterate.php
| From: | Sebastian Bergmann | Date: | Thu, 26 Jul 2001 06:48:33 +0000 |
| Subject: | cvs: php4 /pear/Benchmark Iterate.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-347@lists.php.net to get a copy of this message | ||
sbergmann Thu Jul 26 02:48:33 2001 EDT
Modified files:
/php4/pear/Benchmark Iterate.php
Log:
Fix whitespace in previous commit.
Index: php4/pear/Benchmark/Iterate.php
diff -u php4/pear/Benchmark/Iterate.php:1.8 php4/pear/Benchmark/Iterate.php:1.9
--- php4/pear/Benchmark/Iterate.php:1.8 Wed Jul 25 18:03:34 2001
+++ php4/pear/Benchmark/Iterate.php Thu Jul 26 02:48:33 2001
@@ -16,7 +16,7 @@
// | Authors: Sebastian Bergmann <sb@sebastian-bergmann.de> |
// +----------------------------------------------------------------------+
//
-// $Id: Iterate.php,v 1.8 2001/07/25 22:03:34 yavo Exp $
+// $Id: Iterate.php,v 1.9 2001/07/26 06:48:33 sbergmann Exp $
//
require_once 'Benchmark/Timer.php';
@@ -30,19 +30,18 @@
*
* Example:
*
-* require_once "Benchmark/Iterate.php";
+* require_once 'Benchmark/Iterate.php';
* $benchmark = new Benchmark_Iterate;
*
-* function foo($string)
-* {
-* print $string."<br>";
+* function foo($string) {
+* print $string . '<br>';
* }
*
* $benchmark->run(100, 'foo', 'test');
* $result = $benchmark->get();
*
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
-* @version $Revision: 1.8 $
+* @version $Revision: 1.9 $
* @access public
*/
@@ -58,30 +57,31 @@
$iterations = array_shift($arguments);
$function_name = array_shift($arguments);
-
- if(strstr($function_name, "::")){
- $function_name = explode("::", $function_name);
- $objectmethod = $function_name[1];
- }
-
- // If we're calling a method on an object use call_user_method
- if(strstr($function_name, "->")){
- $function_name = explode("->", $function_name);
- $objectname = $function_name[0];
- global ${$objectname};
- $objectmethod = $function_name[1];
- for ($i = 1; $i <= $iterations; $i++) {
- $this->setMarker('start_'.$i);
- call_user_method_array($function_name[1], ${$objectname}, $arguments);
- $this->setMarker('end_'.$i);
- }
- return(true);
- }
+
+ if (strstr($function_name, '::')) {
+ $function_name = explode('::', $function_name);
+ $objectmethod = $function_name[1];
+ }
+
+ // If we're calling a method on an object use call_user_method
+ if (strstr($function_name, '->')) {
+ $function_name = explode('->', $function_name);
+ $objectname = $function_name[0];
+
+ global ${$objectname};
+ $objectmethod = $function_name[1];
+
+ for ($i = 1; $i <= $iterations; $i++) {
+ $this->setMarker('start_' . $i);
+ call_user_method_array($function_name[1], ${$objectname}, $arguments);
+ $this->setMarker('end_' . $i);
+ }
+ }
for ($i = 1; $i <= $iterations; $i++) {
- $this->setMarker('start_'.$i);
+ $this->setMarker('start_' . $i);
call_user_func_array($function_name, $arguments);
- $this->setMarker('end_'.$i);
+ $this->setMarker('end_' . $i);
}
}