Issues (47)

src/base/PluginTrait.php (5 issues)

1
<?php
2
/**
3
 * @link      https://dukt.net/videos/
4
 * @copyright Copyright (c) Dukt
5
 * @license   https://github.com/dukt/videos/blob/v2/LICENSE.md
6
 */
7
8
namespace dukt\videos\base;
9
10
use dukt\videos\Plugin as Videos;
11
12
/**
13
 * PluginTrait implements the common methods and properties for plugin classes.
14
 *
15
 * @property \dukt\videos\services\Videos $videos     The videos service
16
 * @property \dukt\videos\services\Cache $cache      The cache service
17
 * @property \dukt\videos\services\Gateways $gateways   The gateways service
18
 * @property \dukt\videos\services\Oauth $oauth      The oauth service
19
 */
20
trait PluginTrait
21
{
22
    /**
23
     * Returns the videos service.
24
     *
25
     * @return \dukt\videos\services\Videos The videos service
26
     * @throws \yii\base\InvalidConfigException
27
     */
28
    public function getVideos(): \dukt\videos\services\Videos
29
    {
30
        /** @var Videos $this */
31
        return $this->get('videos');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('videos') could return the type mixed|null which is incompatible with the type-hinted return dukt\videos\services\Videos. Consider adding an additional type-check to rule them out.
Loading history...
32
    }
33
34
    /**
35
     * Returns the cache service.
36
     *
37
     * @return \dukt\videos\services\Cache The cache service
38
     * @throws \yii\base\InvalidConfigException
39
     */
40
    public function getCache(): \dukt\videos\services\Cache
41
    {
42
        /** @var Videos $this */
43
        return $this->get('cache');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('cache') could return the type mixed|null which is incompatible with the type-hinted return dukt\videos\services\Cache. Consider adding an additional type-check to rule them out.
Loading history...
44
    }
45
46
    /**
47
     * Returns the gateways service.
48
     *
49
     * @return \dukt\videos\services\Gateways The gateways service
50
     * @throws \yii\base\InvalidConfigException
51
     */
52
    public function getGateways(): \dukt\videos\services\Gateways
53
    {
54
        /** @var Videos $this */
55
        return $this->get('gateways');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('gateways') could return the type mixed|null which is incompatible with the type-hinted return dukt\videos\services\Gateways. Consider adding an additional type-check to rule them out.
Loading history...
56
    }
57
58
    /**
59
     * Returns the oauth service.
60
     *
61
     * @return \dukt\videos\services\Oauth The oauth service
62
     * @throws \yii\base\InvalidConfigException
63
     */
64
    public function getOauth(): \dukt\videos\services\Oauth
65
    {
66
        /** @var Videos $this */
67
        return $this->get('oauth');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('oauth') could return the type mixed|null which is incompatible with the type-hinted return dukt\videos\services\Oauth. Consider adding an additional type-check to rule them out.
Loading history...
68
    }
69
70
    /**
71
     * Returns the tokens service.
72
     *
73
     * @return \dukt\videos\services\Tokens The tokens service
74
     * @throws \yii\base\InvalidConfigException
75
     */
76
    public function getTokens(): \dukt\videos\services\Tokens
77
    {
78
        /** @var Videos $this */
79
        return $this->get('tokens');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get('tokens') could return the type mixed|null which is incompatible with the type-hinted return dukt\videos\services\Tokens. Consider adding an additional type-check to rule them out.
Loading history...
80
    }
81
}
82