Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / consolidation / robo / src / Common / Timer.php
diff --git a/vendor/consolidation/robo/src/Common/Timer.php b/vendor/consolidation/robo/src/Common/Timer.php
new file mode 100644 (file)
index 0000000..955eb5b
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+namespace Robo\Common;
+
+trait Timer
+{
+    /**
+     * @var \Robo\Common\TimeKeeper
+     */
+    protected $timer;
+
+    protected function startTimer()
+    {
+        if (!isset($this->timer)) {
+            $this->timer = new TimeKeeper();
+        }
+        $this->timer->start();
+    }
+
+    protected function stopTimer()
+    {
+        if (!isset($this->timer)) {
+            return;
+        }
+        $this->timer->stop();
+    }
+
+    /**
+     * @return float|null
+     */
+    protected function getExecutionTime()
+    {
+        if (!isset($this->timer)) {
+            return null;
+        }
+        return $this->timer->elapsed();
+    }
+}