Completed
Push — master ( a00622...08b3e1 )
by Martin
14:53
created

ServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 65
rs 10
wmc 4
lcom 1
cbo 4

4 Methods

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