HomeComposer::compose()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
namespace App\Http\ViewComposers;
4
5
use Illuminate\View\View;
6
use Illuminate\Mail\Markdown;
7
8
class HomeComposer
9
{
10
    /**
11
     * Bind data to the view.
12
     *
13
     * @param View $view
14
     * @return void
15
     */
16
    public function compose(View $view)
17
    {
18
        $announce = false;
19
        if (config('kleis.announce')) {
20
            $mdfile = public_path('markdown/'.config('kleis.announce'));
21
            if (file_exists($mdfile)) {
22
                $text = file_get_contents($mdfile);
23
                $announce = Markdown::parse($text)->toHtml();
24
            }
25
        }
26
        $view->with('announce', $announce);
27
    }
28
}
29