Passed
Push — master ( 5f1f2d...1c09a1 )
by Luca
02:55 queued 12s
created

AdsenseBuilder::javascript()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * Google Adsense Ads for Laravel.
5
 *
6
 * Package for easily including Google Adsense Ad units
7
 * in Laravel and Lumen.
8
 *
9
 * @developer Crypto Technology srl <https://cryptotech.srl/>
10
 *
11
 * @copyright Copyright (c) 2019 Crypto Technology srl
12
 * @license   MIT
13
 *
14
 * Copyright (c) 2016 Galen Han
15
 * Copyright (c) 2019 Crypto Technology srl
16
 *
17
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
18
 * this software and associated documentation files (the "Software"), to deal in
19
 * the Software without restriction, including without limitation the rights to
20
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
21
 * the Software, and to permit persons to whom the Software is furnished to do so,
22
 * subject to the following conditions:
23
 *
24
 * The above copyright notice and this permission notice shall be included in all
25
 * copies or substantial portions of the Software.
26
 *
27
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
29
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
30
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
31
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
 */
34
35
declare(strict_types=1);
36
37
namespace CryptoTech\Laravel\Adsense;
38
39
class AdsenseBuilder
40
{
41
    public function ads($unit)
42
    {
43
        return view('adsense::ads')->with([
44
            'ad_client' => config('adsense.client_id'),
45
            'ad_style' => config("adsense.ads.$unit.ad_style", 'display:block;'),
46
            'ad_slot' => config("adsense.ads.$unit.ad_unit_id"),
47
            'ad_format' => config("adsense.ads.$unit.ad_format", null),
48
        ]);
49
    }
50
51 2
    public function javascript()
52
    {
53 2
        return view('adsense::javascript');
54
    }
55
}
56