RedirectionMsg   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 30
ccs 6
cts 7
cp 0.8571
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __call() 0 9 2
1
<?php
2
3
namespace Imanghafoori\HeyMan\Plugins\Reactions\Redirect;
4
5
use Imanghafoori\HeyMan\Reactions\TerminateWith;
6
7
/**
8
 * Class RedirectionMsg.
9
 *
10
 * @method with($key, $value = null)
11
 * @method withCookies(array $cookies)
12
 * @method withInput(array $input = null)
13
 * @method onlyInput()
14
 * @method exceptInput(): self
15
 * @method withErrors($provider, $key = 'default')
16
 */
17
final class RedirectionMsg
18
{
19
    private $redirect;
20
21
    /**
22
     * Redirector constructor.
23
     *
24
     * @param  Redirector  $redirect
25
     */
26 10
    public function __construct(Redirector $redirect)
27
    {
28 10
        $this->redirect = $redirect;
29 10
    }
30
31
    /**
32
     * @param  string  $method
33
     * @param  array  $parameters
34
     * @return $this
35
     *
36
     * @throws \BadMethodCallException
37
     */
38
    public function __call($method, $parameters)
39 5
    {
40
        if ($method == 'then') {
41 5
            return new TerminateWith($this);
0 ignored issues
show
Bug Best Practice introduced by
The expression return new Imanghafoori\...ns\TerminateWith($this) returns the type Imanghafoori\HeyMan\Reactions\TerminateWith which is incompatible with the documented return type Imanghafoori\HeyMan\Plug...Redirect\RedirectionMsg.
Loading history...
42
        }
43
44
        resolve('heyman.chain')->push('data', [$method, $parameters]);
0 ignored issues
show
Bug introduced by
The method push() does not exist on Illuminate\Foundation\Application. ( Ignorable by Annotation )

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

44
        resolve('heyman.chain')->/** @scrutinizer ignore-call */ push('data', [$method, $parameters]);

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...
45 5
46
        return $this;
47 5
    }
48
}
49