WorkcastApi::getAuth()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

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
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace LaravelWorkcast;
4
5
use LaravelWorkcast\Endpoints\Contacts;
6
use LaravelWorkcast\Endpoints\Events;
7
use LaravelWorkcast\Endpoints\Presenters;
8
use LaravelWorkcast\Endpoints\Sessions;
9
use LaravelWorkcast\RegistrationEndpoints\Register;
10
11
/**
12
 *
13
 * @see https://insite.workcast.com/api-webinar-registration-documentation
14
 * @see https://insite.workcast.com/api-webinar-reporting-documentation
15
 *
16
 * @example Workcast::events()->list()
17
 * @example Workcast::sessions(63001)->list()->items()
18
 */
19
class WorkcastApi
20
{
21
    protected Auth $auth;
22
23
    /**
24
     * WorkcastApi constructor.
25
     */
26 3
    public function __construct(string $apiKey)
27
    {
28 3
        $this->auth = new Auth($apiKey);
29
    }
30
31
    /**
32
     * @return Auth
33
     */
34 3
    public function getAuth(): Auth
35
    {
36 3
        return $this->auth;
37
    }
38
39
    /**
40
     * @return Events
41
     */
42 1
    public function events(): Events
43
    {
44 1
        return new Events($this->getAuth());
45
    }
46
47
    /**
48
     * @param int $eventId
49
     *
50
     * @return Sessions
51
     */
52 1
    public function sessions(int $eventId): Sessions
53
    {
54 1
        return new Sessions($this->getAuth(), $eventId);
55
    }
56
57
    /**
58
     * @param int $eventId
59
     *
60
     * @return Contacts
61
     */
62 1
    public function contacts(int $eventId): Contacts
63
    {
64 1
        return new Contacts($this->getAuth(), $eventId);
65
    }
66
67
    /**
68
     * @param int $eventId
69
     *
70
     * @return Presenters
71
     */
72 1
    public function presenters(int $eventId): Presenters
73
    {
74 1
        return new Presenters($this->getAuth(), $eventId);
75
    }
76
77
    /**
78
     * @return \LaravelWorkcast\RegistrationEndpoints\Register
79
     */
80 1
    public function registerRequest(): Register
81
    {
82 1
        return new Register($this->getAuth());
83
    }
84
}
85