diff --git a/classes/phing/tasks/ext/StopwatchTask.php b/classes/phing/tasks/ext/StopwatchTask.php index 80ecb8659e..406c09b665 100644 --- a/classes/phing/tasks/ext/StopwatchTask.php +++ b/classes/phing/tasks/ext/StopwatchTask.php @@ -17,6 +17,7 @@ * . */ +use Symfony\Component\Stopwatch\Stopwatch; /** * Stopwatch. @@ -24,7 +25,7 @@ * @author Siad Ardroumli * @package phing.tasks.ext.stopwatch */ -class StopwatchTask extends Task +class StopwatchTask extends DispatchTask { /** * Name of the timer. @@ -40,13 +41,6 @@ class StopwatchTask extends Task */ private $category = ''; - /** - * Timer action. - * - * @var string $action - */ - private $action = 'start'; - /** * Holds an instance of Stopwatch. * @@ -61,36 +55,22 @@ class StopwatchTask extends Task */ public function init() { - } - - /** - * Load stopwatch. - * - * @return void - * - * @throws BuildException - */ - private function loadStopwatch() - { - @include_once 'Symfony/Component/Stopwatch/autoload.php'; - @include_once 'Symfony/Component/Stopwatch/autoloader.php'; - @include_once 'vendor/autoload.php'; - if (!class_exists('\\Symfony\\Component\\Stopwatch\\Stopwatch')) { throw new BuildException("StopwatchTask requires symfony/stopwatch to be installed."); } + + $this->setAction('start'); } /** * Get the stopwatch instance. * - * @return \Symfony\Component\Stopwatch\Stopwatch + * @return Stopwatch */ private function getStopwatchInstance() { if (self::$timer === null) { - $stopwatch = '\\Symfony\\Component\\Stopwatch\\Stopwatch'; - self::$timer = new $stopwatch; + self::$timer = new Stopwatch(); } return self::$timer; @@ -165,22 +145,6 @@ public function setCategory($category) $this->category = $category; } - /** - * Set the action. - * Action could be one of - * - start - * - lap - * - stop - * - * @param string $action - * - * @return void - */ - public function setAction($action) - { - $this->action = $action; - } - /** * The main entry point * @@ -190,9 +154,7 @@ public function setAction($action) */ public function main() { - $this->loadStopwatch(); - - switch ($this->action) { + switch ($this->getAction()) { case "start": $this->start(); break;