Passed
Branch dev5a (b4693d)
by Ron
27:36
created

GetTechTipStats   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTotalTipsCount() 0 6 1
A getTipsInLastDays() 0 6 1
1
<?php
2
3
namespace App\Domains\TechTips;
4
5
use Illuminate\Support\Facades\Log;
6
7
use Carbon\Carbon;
8
9
use App\TechTips;
10
11
12
class GetTechTipStats
13
{
14 4
    public function getTipsInLastDays($numDays = 30)
15
    {
16 4
        $tips = TechTips::where('created_at', '>', Carbon::now()->subDays($numDays))->count();
17 4
        Log::debug('Retrieved new Tech Tip count for last '.$numDays.' days.  Count - $tips');
18
19 4
        return $tips;
20
    }
21
22 4
    public function getTotalTipsCount()
23
    {
24 4
        $tipsTotal = TechTips::all()->count();
25 4
        Log::debug('Retrieved total Tech Tip count.  Count - '.$tipsTotal);
26
27 4
        return $tipsTotal;
28
    }
29
}
30