Permalink
Browse files

Fixed the lap method. Added upgrade notes. Some CS fixes

  • Loading branch information...
1 parent 7ed728a commit bdf033443458b78c921ba0301e01c19ede4ece8e @dlsniper dlsniper committed Nov 9, 2012
View
@@ -10,6 +10,8 @@
`MongoDate` instead of `MongoTimestamp`, which also makes it possible to use
TTL collections in MongoDB 2.2+ instead of relying on the `gc()` method.
+ * The Stopwatch functionality was moved from HttpKernel\Debug to its own component
+
#### Deprecations
* The `Request::splitHttpAcceptHeader()` is deprecated and will be removed in 2.3.
@@ -18,7 +18,14 @@
*/
class Stopwatch
{
+ /**
+ * @var Section[]
+ */
private $sections;
+
+ /**
+ * @var array
+ */
private $activeSections;
public function __construct()
@@ -54,6 +61,8 @@ public function openSection($id = null)
* @see getSectionEvents
*
* @param string $id The identifier of the section
+ *
+ * @throws \LogicException When there's no started section to be stopped
*/
public function stopSection($id)
{
@@ -117,11 +126,32 @@ public function getSectionEvents($id)
}
}
+
+/**
+ * @internal This class is for internal usage only
+ *
+ * @author Fabien Potencier <fabien@symfony.com>
+ */
class Section
{
+ /**
+ * @var StopwatchEvent[]
+ */
private $events = array();
+
+ /**
+ * @var null|float
+ */
private $origin;
+
+ /**
+ * @var string
+ */
private $id;
+
+ /**
+ * @var Section[]
+ */
private $children = array();
/**
@@ -236,7 +266,7 @@ public function stopEvent($name)
*/
public function lap($name)
{
- return $this->stop($name)->start();
+ return $this->stopEvent($name)->start();
}
/**
@@ -249,3 +279,4 @@ public function getEvents()
return $this->events;
}
}
+
@@ -18,9 +18,24 @@
*/
class StopwatchEvent
{
+ /**
+ * @var StopwatchPeriod[]
+ */
private $periods;
+
+ /**
+ * @var float
+ */
private $origin;
+
+ /**
+ * @var string
+ */
private $category;
+
+ /**
+ * @var float[]
+ */
private $started;
/**
@@ -74,6 +89,8 @@ public function start()
/**
* Stops the last started event period.
*
+ * @throws \LogicException When start wasn't called before stopping
+ *
* @return StopwatchEvent The event
*/
public function stop()
@@ -182,7 +199,7 @@ protected function getNow()
/**
* Formats a time.
*
- * @param numerical $time A raw time
+ * @param integer|float $time A raw time
*
* @return float The formatted time
*

0 comments on commit bdf0334

Please sign in to comment.