Issues (19)

src/Models/Traits/PublicStatusTrait.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Sfneal\Models\Traits;
4
5
/**
6
 * Trait PublicStatus.
7
 *
8
 * @property int $public_status
9
 */
10
trait PublicStatusTrait
11
{
12
    /**
13
     * Determine if a Model's 'public_status' is true.
14
     *
15
     * @return bool
16
     */
17
    public function isPublic(): bool
18
    {
19
        return $this->public_status == 1;
20
    }
21
22
    /**
23
     * Determine if a Model's 'public_status' is false.
24
     *
25
     * @return bool
26
     */
27
    public function isPrivate(): bool
28
    {
29
        return ! $this->isPublic();
30
    }
31
32
    /**
33
     * Update a Model's 'public_status' attribute.
34
     *
35
     *  - if a $status is not provided, the $status_id is automatically changed
36
     *
37
     * @param  int|null  $status
38
     * @return bool
39
     */
40
    public function updatePublicStatus(int $status = null): bool
41
    {
42
        return $this->update([
0 ignored issues
show
The method update() does not exist on Sfneal\Models\Traits\PublicStatusTrait. Did you maybe mean updatePublicStatus()? ( 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 */ update([

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
            'public_status' => $status ?? ($this->public_status == 1 ? 0 : 1),
44
        ]);
45
    }
46
}
47