Issues (18)

src/helpers.php (2 issues)

Labels
1
<?php
2
3
if(!function_exists('JavaScript')){
4
    /**
5
     * @return \Blok\JavaScript\JavaScript
6
     */
7
    function javascript($key = null, $value = null){
8
9
        /**
10
         * @var $javascript \Blok\JavaScript\JavaScript
11
         */
12
        $javascript = app('JavaScript');
0 ignored issues
show
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

12
        $javascript = /** @scrutinizer ignore-call */ app('JavaScript');
Loading history...
13
14
        if ($key && $value) {
15
            return $javascript->set($key, $value);
16
        } elseif (is_array($key)) {
17
            return $javascript->set($key);
0 ignored issues
show
$key of type array is incompatible with the type string expected by parameter $key of Blok\JavaScript\JavaScript::set(). ( Ignorable by Annotation )

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

17
            return $javascript->set(/** @scrutinizer ignore-type */ $key);
Loading history...
18
        } elseif ($key) {
19
            return $javascript->get($key);
20
        }
21
22
        return $javascript;
23
    }
24
}