Browse code

Aggregate statitics for date

Niklas Modess authored on 24/05/2014 14:58:38
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+<?php
1
+namespace Gitter\Statistics;
2
+
3
+use Gitter\Util\Collection;
4
+use Gitter\Model\Commit\Commit;
5
+
6
+/**
7
+ * Aggregate statistics based on day
8
+ */
9
+class Date extends Collection implements StatisticsInterface
10
+{
11
+    /**
12
+     * @param Commit $commit
13
+     */
14
+    public function addCommit(Commit $commit)
15
+    {
16
+        $day = $commit->getCommiterDate()->format('Y-m-d');
17
+
18
+        $this->items[$day][] = $commit;
19
+    }
20
+
21
+    public function sortCommits()
22
+    {
23
+        ksort($this->items);
24
+    }
25
+}
0 26
\ No newline at end of file