Completed
Push — feature/refactor-app-design ( c863f7...166b88 )
by Avtandil
03:23
created

Kernel   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 39
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 8 1
1
<?php
2
/**
3
 * This file is part of the TelegramBot package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\TelegramBot\Http;
12
13
use Longman\TelegramBot\Entities\Update;
14
use Longman\TelegramBot\Telegram;
15
16
class Kernel
17
{
18
    /**
19
     * The application implementation.
20
     *
21
     * @var \Longman\TelegramBot\Telegram
22
     */
23
    protected $app;
24
25
    /**
26
     * Create a new HTTP kernel instance.
27
     *
28
     * @param  \Longman\TelegramBot\Telegram $app
29
     *
30
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
31
     */
32 2
    public function __construct(Telegram $app)
33
    {
34 2
        $this->app = $app;
35 2
    }
36
37
    /**
38
     * Handle an incoming HTTP request.
39
     *
40
     * @param  \Longman\TelegramBot\Http\Request $request
41
     *
42
     * @return \Longman\TelegramBot\Http\Response
43
     *
44
     * @throws \Longman\TelegramBot\Exception\TelegramException
45
     */
46 2
    public function handle(Request $request)
47
    {
48 2
        $params = $request->json();
49
50 2
        $update = new Update($params->all(), $this->app->getBotUsername());
51
52 2
        return $this->app->processUpdate($update);
53
    }
54
}
55