Passed
Push — main ( 51da02...cc341e )
by Usama
03:58
created

HasCommentBan   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 13
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A isCommentBanned() 0 6 3
1
<?php
2
3
namespace Usamamuneerchaudhary\Commentify\Traits;
4
5
use Carbon\Carbon;
6
7
trait HasCommentBan
8
{
9
    /**
10
     * Check if the user is banned from commenting.
11
     *
12
     * @return bool
13
     */
14
    public function isCommentBanned(): bool
15
    {
16
        if (!isset($this->comment_banned_until)) {
17
            return false;
18
        }
19
        return $this->comment_banned_until && Carbon::parse($this->comment_banned_until)->isFuture();
20
    }
21
}
22