Completed
Push — master ( abb536...2402a0 )
by Manuel
09:18 queued 05:56
created
app/Services/Statistics.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -7,58 +7,58 @@  discard block
 block discarded – undo
7 7
 
8 8
 class Statistics
9 9
 {
10
-    /**
11
-     * Returns the count of all pokes.
12
-     *
13
-     * @return mixed
14
-     */
15
-    public function totalPokes()
16
-    {
17
-        $base = 189771;
10
+	/**
11
+	 * Returns the count of all pokes.
12
+	 *
13
+	 * @return mixed
14
+	 */
15
+	public function totalPokes()
16
+	{
17
+		$base = 189771;
18 18
 
19
-        return Poke::count() + $base;
20
-    }
19
+		return Poke::count() + $base;
20
+	}
21 21
 
22
-    /**
23
-     * Returns the the count of all devices.
24
-     *
25
-     * @return mixed
26
-     */
27
-    public function totalDevices()
28
-    {
29
-        return Poke::distinct()->count('mac');
30
-    }
22
+	/**
23
+	 * Returns the the count of all devices.
24
+	 *
25
+	 * @return mixed
26
+	 */
27
+	public function totalDevices()
28
+	{
29
+		return Poke::distinct()->count('mac');
30
+	}
31 31
 
32
-    /**
33
-     * Returns all pokes.
34
-     *
35
-     * @return mixed
36
-     */
37
-    public function allPokes()
38
-    {
39
-        return Poke::select(
40
-            DB::raw('count(*) as pokes, date(created_at) as date')
41
-        )
42
-            ->groupBy('date')
43
-            ->get();
44
-    }
32
+	/**
33
+	 * Returns all pokes.
34
+	 *
35
+	 * @return mixed
36
+	 */
37
+	public function allPokes()
38
+	{
39
+		return Poke::select(
40
+			DB::raw('count(*) as pokes, date(created_at) as date')
41
+		)
42
+			->groupBy('date')
43
+			->get();
44
+	}
45 45
 
46
-    /**
47
-     * Returns a collection of all networks and it's count.
48
-     *
49
-     * @return mixed
50
-     */
51
-    public function networkDistribution()
52
-    {
53
-        $regex = '^172\.(1[6-9]|2[0-9]|3[01])\.';
46
+	/**
47
+	 * Returns a collection of all networks and it's count.
48
+	 *
49
+	 * @return mixed
50
+	 */
51
+	public function networkDistribution()
52
+	{
53
+		$regex = '^172\.(1[6-9]|2[0-9]|3[01])\.';
54 54
 
55
-        if ((new Poke())->getConnection()->getConfig('driver') == 'sqlite') {
56
-            $regex = "/$regex/";
57
-            $this->createSqliteRegexpFunction();
58
-        }
55
+		if ((new Poke())->getConnection()->getConfig('driver') == 'sqlite') {
56
+			$regex = "/$regex/";
57
+			$this->createSqliteRegexpFunction();
58
+		}
59 59
 
60
-        $data = Poke::select(
61
-            DB::raw("
60
+		$data = Poke::select(
61
+			DB::raw("
62 62
                 CASE
63 63
                     WHEN ip LIKE '192.168.%'
64 64
                         THEN '192.168.0.0/16'
@@ -69,31 +69,31 @@  discard block
 block discarded – undo
69 69
                     ELSE 'Internet'
70 70
                 END
71 71
 		AS label, count(*) as value")
72
-        )
73
-            ->groupBy('label')
74
-            ->orderBy('label')
75
-            ->get();
72
+		)
73
+			->groupBy('label')
74
+			->orderBy('label')
75
+			->get();
76 76
 
77
-        return $this->addColors($data);
78
-    }
77
+		return $this->addColors($data);
78
+	}
79 79
 
80
-    /**
81
-     * Creates the Regexp function for the SQLITE database.
82
-     */
83
-    protected function createSqliteRegexpFunction()
84
-    {
85
-        DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', 'preg_match', 2);
86
-    }
80
+	/**
81
+	 * Creates the Regexp function for the SQLITE database.
82
+	 */
83
+	protected function createSqliteRegexpFunction()
84
+	{
85
+		DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', 'preg_match', 2);
86
+	}
87 87
 
88
-    private function addColors($data)
89
-    {
90
-        $colors = ['rgb(23,103,153)', 'rgb(47,135,176)', 'rgb(66,164,187)', 'rgb(91,192,196)'];
91
-        $highlight_colors = ['#8BB3CC', '#97C3D7', '#ADDFE1', '#BBEAE3'];
92
-        foreach ($data as $i => $network) {
93
-            $network['color'] = $colors[$i];
94
-            $network['highlight'] = $highlight_colors[$i];
95
-        }
88
+	private function addColors($data)
89
+	{
90
+		$colors = ['rgb(23,103,153)', 'rgb(47,135,176)', 'rgb(66,164,187)', 'rgb(91,192,196)'];
91
+		$highlight_colors = ['#8BB3CC', '#97C3D7', '#ADDFE1', '#BBEAE3'];
92
+		foreach ($data as $i => $network) {
93
+			$network['color'] = $colors[$i];
94
+			$network['highlight'] = $highlight_colors[$i];
95
+		}
96 96
 
97
-        return $data;
98
-    }
97
+		return $data;
98
+	}
99 99
 }
Please login to merge, or discard this patch.