Issues (686)

examples/outerhtml-component/code.php (4 issues)

1
<?php
2
3
use Jaxon\App\FuncComponent;
4
use Jaxon\App\NodeComponent;
5
6
class HelloText extends NodeComponent
7
{
8
    public function html(): string
9
    {
10
        return $this->stash()->get('is_caps') ? 'HELLO WORLD!' : 'Hello World!';
11
    }
12
}
13
14
class HelloWorld extends FuncComponent
15
{
16
    public function sayHello(bool $isCaps)
17
    {
18
        $this->stash()->set('is_caps', $isCaps);
0 ignored issues
show
The method stash() does not exist on HelloWorld. ( Ignorable by Annotation )

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

18
        $this->/** @scrutinizer ignore-call */ 
19
               stash()->set('is_caps', $isCaps);

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...
19
20
        $this->response->assign('div2', 'outerHTML', '<div class="col-md-12" id="div2" ' .
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist on HelloWorld. Did you maybe forget to declare it?
Loading history...
21
            attr()->bind(rq(HelloText::class)) . '></div>');
22
        // The HelloText component is rendered only if the Jaxon attribute in the
23
        // above outerHTML content is successfully processed.
24
        $this->cl(HelloText::class)->render();
0 ignored issues
show
The method cl() does not exist on HelloWorld. ( Ignorable by Annotation )

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

24
        $this->/** @scrutinizer ignore-call */ 
25
               cl(HelloText::class)->render();

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...
25
    }
26
27
    public function setColor(string $sColor)
28
    {
29
        $this->response->assign('div2', 'style.color', $sColor);
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist on HelloWorld. Did you maybe forget to declare it?
Loading history...
30
    }
31
}
32
33
// Register object
34
$jaxon = jaxon();
35
36
$jaxon->app()->setup(configFile('class.php'));
37
// Js options
38
$jaxon->setOptions(['lib' => ['uri' => '/js'], 'app' => ['minify' => false]], 'js');
39
$jaxon->register(Jaxon\Jaxon::CALLABLE_CLASS, HelloText::class);
40