Request   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 2
1
<?php
2
/**
3
 * Webino™ (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/request
6
 * @copyright   Copyright (c) 2019 Webino, s.r.o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace Webino;
12
13
/**
14
 * Class Request
15
 * @package request
16
 */
17
final class Request implements InstanceFactoryMethodInterface
18
{
19
    /**
20
     * @param CreateInstanceEventInterface $event
21
     * @return RequestInterface
22
     */
23
    public static function create(CreateInstanceEventInterface $event): RequestInterface
24
    {
25
        $container = $event->getContainer();
26
27
        if (php_sapi_name() === 'cli') {
28
            return $container->make(ConsoleRequest::class);
29
        }
30
        return $container->make(HttpRequest::class);
31
    }
32
}
33