Passed
Push — master ( 0602c9...8f96ba )
by Thierry
02:02
created

RequestTrait::getRequestFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jaxon\Container\Traits;
4
5
use Jaxon\Jaxon;
6
use Jaxon\Plugin\Manager as PluginManager;
7
use Jaxon\Request\Factory\ParameterFactory;
8
use Jaxon\Request\Factory\RequestFactory;
9
use Jaxon\Request\Handler\Handler as RequestHandler;
10
use Jaxon\Request\Plugin\FileUpload;
11
use Jaxon\Request\Support\CallableRegistry;
12
use Jaxon\Response\Manager as ResponseManager;
13
use Jaxon\Response\Plugin\DataBag;
14
15
trait RequestTrait
0 ignored issues
show
Coding Style introduced by
Missing doc comment for trait RequestTrait
Loading history...
16
{
17
    /**
18
     * Register the values into the container
19
     *
20
     * @return void
21
     */
22
    private function registerRequests()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
23
    {
24
        // Request Handler
25
        $this->set(RequestHandler::class, function($c) {
0 ignored issues
show
Bug introduced by
It seems like set() 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

25
        $this->/** @scrutinizer ignore-call */ 
26
               set(RequestHandler::class, function($c) {
Loading history...
26
            return new RequestHandler($c->g(Jaxon::class), $c->g(PluginManager::class),
27
                $c->g(ResponseManager::class), $c->g(FileUpload::class), $c->g(DataBag::class));
28
        });
29
        // Request Factory
30
        $this->set(RequestFactory::class, function($c) {
31
            return new RequestFactory($c->g(CallableRegistry::class));
32
        });
33
        // Parameter Factory
34
        $this->set(ParameterFactory::class, function() {
35
            return new ParameterFactory();
36
        });
37
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
38
39
    /**
40
     * Get the request handler
41
     *
42
     * @return RequestHandler
43
     */
44
    public function getRequestHandler()
45
    {
46
        return $this->g(RequestHandler::class);
0 ignored issues
show
Bug introduced by
It seems like g() 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

46
        return $this->/** @scrutinizer ignore-call */ g(RequestHandler::class);
Loading history...
47
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
48
49
    /**
50
     * Get the request factory
51
     *
52
     * @return RequestFactory
53
     */
54
    public function getRequestFactory()
55
    {
56
        return $this->g(RequestFactory::class);
57
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
58
59
    /**
60
     * Get the parameter factory
61
     *
62
     * @return ParameterFactory
63
     */
64
    public function getParameterFactory()
65
    {
66
        return $this->g(ParameterFactory::class);
67
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
68
}
69