Issues (19)

src/Chips/Layers.php (3 issues)

1
<?php
2
/**
3
 * Chain layers for RPC client
4
 * User: moyo
5
 * Date: 12/12/2017
6
 * Time: 11:58 AM
7
 */
8
9
namespace Carno\HRPC\Client\Chips;
10
11
use function Carno\Coroutine\async;
12
use Carno\Coroutine\Context;
13
use Carno\Promise\Promised;
14
use Carno\RPC\Protocol\Request;
15
use Carno\RPC\Protocol\Response;
16
use Throwable;
17
18
trait Layers
19
{
20
    /**
21
     * @param Request $request
22
     * @param Context $ctx
23
     * @return Promised
24
     */
25
    public function inbound($request, Context $ctx) : Promised
26
    {
27
        return async(function (Request $request) {
28
            return $this->call($request);
0 ignored issues
show
It seems like call() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

28
            return $this->/** @scrutinizer ignore-call */ call($request);
Loading history...
29
        }, $ctx, $request);
30
    }
31
32
    /**
33
     * @param Response $response
34
     * @param Context $ctx
35
     * @return Response
36
     */
37
    public function outbound($response, Context $ctx)
0 ignored issues
show
The parameter $ctx is not used and could be removed. ( Ignorable by Annotation )

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

37
    public function outbound($response, /** @scrutinizer ignore-unused */ Context $ctx)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        return $response;
40
    }
41
42
    /**
43
     * @param Throwable $e
44
     * @param Context $ctx
45
     * @throws Throwable
46
     */
47
    public function exception(Throwable $e, Context $ctx) : void
0 ignored issues
show
The parameter $ctx is not used and could be removed. ( Ignorable by Annotation )

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

47
    public function exception(Throwable $e, /** @scrutinizer ignore-unused */ Context $ctx) : void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
    {
49
        throw $e;
50
    }
51
}
52