TweetsService   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTweets() 0 3 1
A getTweetsService() 0 7 2
1
<?php
2
3
namespace Osnova\Services\Tweets\Traits;
4
5
use Osnova\Api\ApiProvider;
6
use Osnova\Services\Tweets\Requests\TweetsRequest;
7
use Osnova\Services\Tweets\Tweets;
8
9
trait TweetsService
10
{
11
    /** @var Tweets */
12
    private $tweets;
13
14
    /**
15
     * Get the resource API Provider instance.
16
     *
17
     * @return ApiProvider
18
     */
19
    abstract public function getApiProvider();
20
21
    /**
22
     * Get the tweets service instance.
23
     *
24
     * @return Tweets
25
     */
26
    public function getTweetsService()
27
    {
28
        if (is_null($this->tweets)) {
29
            return $this->tweets = new Tweets($this->getApiProvider());
30
        }
31
32
        return $this->tweets;
33
    }
34
35
    /**
36
     * Get tweets list.
37
     *
38
     * @param TweetsRequest $request
39
     *
40
     * @see Tweets::getTweets()
41
     *
42
     * @return array|\Osnova\Services\Tweets\Tweet[]
43
     */
44
    public function getTweets(TweetsRequest $request)
45
    {
46
        return $this->getTweetsService()->getTweets($request);
47
    }
48
}
49