UpdateNotification::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\ViewComposers;
4
5
use App\Model\Update\BarNotification;
6
use Illuminate\View\View;
7
8
class UpdateNotification
9
{
10
    public function __construct()
11
    {
12
    }
13
14
    public function compose(View $view)
15
    {
16
        $notification = new BarNotification();
17
        $notice = $notification->where('value', '!=', '')->select('value')->get();
0 ignored issues
show
Documentation Bug introduced by
The method where does not exist on object<App\Model\Update\BarNotification>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
18
        $view->with(['notification' => $notice]);
19
    }
20
}
21