LaunchScreenAdvertsController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace PHPHub\Http\ApiControllers;
4
5
use PHPHub\Repositories\LaunchScreenAdvertRepositoryInterface;
6
use PHPHub\Transformers\LaunchScreenAdvertTransformer;
7
8
/**
9
 * 客户端启动的首屏广告.
10
 *
11
 * Class LaunchScreenAdvertsController
12
 */
13
class LaunchScreenAdvertsController extends Controller
14
{
15
    /**
16
     * @var LaunchScreenAdvertRepositoryInterface
17
     */
18
    private $adverts;
19
20
    /**
21
     * TopicController constructor.
22
     *
23
     * @param LaunchScreenAdvertRepositoryInterface $repository
24
     */
25
    public function __construct(LaunchScreenAdvertRepositoryInterface $repository)
26
    {
27
        $this->adverts = $repository;
28
    }
29
30
    /**
31
     * 获取所有广告数据.
32
     */
33
    public function index()
34
    {
35
        $adverts = $this->adverts->all();
36
37
        return $this->response()->collection($adverts, new LaunchScreenAdvertTransformer());
38
    }
39
}
40