Completed
Push — master ( d821a1...69acc7 )
by Bradley
04:26
created

example.php ➔ env()   A

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
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
require_once __DIR__ . "/vendor/autoload.php";
4
5
use Cornford\Googlmapper\Mapper;
6
use Illuminate\Container\Container;
7
use Illuminate\Events\Dispatcher;
8
use Illuminate\Filesystem\Filesystem;
9
use Illuminate\View\Compilers\BladeCompiler;
10
use Illuminate\View\Engines\CompilerEngine;
11
use Illuminate\View\Factory;
12
use Illuminate\View\Engines\EngineResolver;
13
use Illuminate\View\FileViewFinder;
14
15
/**
16
 * Env function.
17
 *
18
 * @param string $key
19
 * @param string $value
20
 *
21
 * @return string
22
 */
23
function env($key, $value)
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
{
25
    return $value;
26
}
27
28
$fileViewFinder = new FileViewFinder(new Filesystem,  [__DIR__ . '/src/views']);
29
$fileViewFinder->addNamespace('googlmapper', [__DIR__ . '/src/views']);
30
31
$engineResolver = new EngineResolver();
32
$engineResolver->register(
33
    'blade',
34
    function () {
35
        return new CompilerEngine(new BladeCompiler(new Filesystem(), sys_get_temp_dir()));
36
    }
37
);
38
39
$viewFactory = new Factory($engineResolver, $fileViewFinder, new Dispatcher(new Container));
40
41
$config = include_once __DIR__ . '/src/config/config.php';
42
43
$mapper = new Mapper($viewFactory, $config);
44
45
// Location
46
$mapper->location('Sheffield')->streetview(1, 1, ['ui' => false]);
47
48
// Map
49
$mapper->map(53.3, -1.4, ['zoom' => 10, 'markers' => ['title' => 'My Location', 'animation' => 'DROP']]);
50
51
// Information window
52
$mapper->informationWindow(53.4, -1.5, 'Content');
53
54
// Render
55
print $mapper->render();