Completed
Push — 2.0 ( 690f5b...db6f10 )
by Kirill
05:50
created

TokenExporterComposer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of laravel.su package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace App\Views\Composers;
11
12
use App\Services\TokenAuth;
13
use Illuminate\Contracts\Auth\Guard;
14
use Illuminate\View\View;
15
16
/**
17
 * Class TokenExporterComposer
18
 * @package App\Views\Composers
19
 */
20
class TokenExporterComposer
21
{
22
    /**
23
     * @var TokenAuth
24
     */
25
    private $auth;
26
27
    /**
28
     * @var Guard
29
     */
30
    private $guard;
31
32
    /**
33
     * TokenExporterComposer constructor.
34
     * @param TokenAuth $auth
35
     * @param Guard $guard
36
     */
37
    public function __construct(TokenAuth $auth, Guard $guard)
38
    {
39
        $this->auth = $auth;
40
        $this->guard = $guard;
41
    }
42
43
    /**
44
     * @param View $view
45
     */
46
    public function compose(View $view): void
47
    {
48
        $view->with('token', $this->auth->fromGuard($this->guard));
49
    }
50
}
51