Passed
Push — main ( 0b028a...dfb81e )
by Tan
02:52 queued 14s
created

LikeCount   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A dislikesCount() 0 3 1
A likesCount() 0 3 1
A lovesCount() 0 3 1
1
<?php
2
3
namespace CSlant\LaravelLike\Traits;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Trait LikeCount
9
 *
10
 * @package CSlant\LaravelLike\Traits
11
 * @mixin Model
12
 */
13
trait LikeCount
14
{
15
    /**
16
     * Get the count of likes.
17
     *
18
     * @return int
19
     */
20
    public function likesCount(): int
21
    {
22
        return $this->likesTo()->count();
0 ignored issues
show
Bug introduced by
The method likesTo() does not exist on CSlant\LaravelLike\Traits\LikeCount. Did you maybe mean likesCount()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        return $this->/** @scrutinizer ignore-call */ likesTo()->count();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
23
    }
24
25
    /**
26
     * Get the count of dislikes.
27
     *
28
     * @return int
29
     */
30
    public function dislikesCount(): int
31
    {
32
        return $this->dislikesTo()->count();
0 ignored issues
show
Bug introduced by
The method dislikesTo() does not exist on CSlant\LaravelLike\Traits\LikeCount. Did you maybe mean dislikesCount()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        return $this->/** @scrutinizer ignore-call */ dislikesTo()->count();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
    }
34
35
    /**
36
     * Get the count of loves.
37
     *
38
     * @return int
39
     */
40
    public function lovesCount(): int
41
    {
42
        return $this->lovesTo()->count();
0 ignored issues
show
Bug introduced by
The method lovesTo() does not exist on CSlant\LaravelLike\Traits\LikeCount. Did you maybe mean lovesCount()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        return $this->/** @scrutinizer ignore-call */ lovesTo()->count();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
    }
44
}
45