ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Spires\Irc;
5
6
use Spires\Contracts\Core\Core;
7
8
class ServiceProvider extends \Spires\Core\ServiceProvider
9
{
10
    /**
11
     * Define config keys to make available with their defaults.
12
     *
13
     * @return array
14
     */
15
    public function config()
16
    {
17
        return [
18
            'connection.channel' => '',
19
            'connection.server' => '',
20
            'connection.port' => 6667,
21
            'user.nickname' => 'spires',
22
            'user.username' => 'spiresbot',
23
            'user.realname' => 'Spires ALPHA',
24
        ];
25
    }
26
27
    /**
28
     * Register the service provider.
29
     *
30
     * @return void
31
     */
32
    public function register()
33
    {
34
        $this->core->bind(Connection::class, function (Core $core) {
35
            return new Connection(
36
                $core['connection.channel'],
37
                $core['connection.server'],
38
                $core['connection.port']
39
            );
40
        });
41
42
        $this->core->bind(User::class, function (Core $core) {
43
            return new User(
44
                $core['user.nickname'],
45
                $core['user.username'],
46
                $core['user.realname']
47
            );
48
        });
49
50
        $this->core->singleton(Client::class);
51
    }
52
53
    /**
54
     * Boot the service provider.
55
     *
56
     * @return void
57
     */
58
    public function boot()
59
    {
60
    }
61
62
    /**
63
     * Plugins provided.
64
     *
65
     * @return Plugin[]
66
     */
67
    public function plugins()
68
    {
69
        return [];
70
    }
71
}
72