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

TokenExporterComposer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A compose() 0 4 1
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