Issues (34)

view/weather/map.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Anax\View;
4
5
/**
6
 * Rendering map for open street view
7
 */
8
?>
9
<?php if ($data["lat"] && $data["lon"]) : ?>
10
    <h4> Karta över ditt område</h4>
11
12
    <div id="map" style="width:100%;height:350px;">
13
    </div>
14
15
    <!-- Downloading leaflet library -->
16
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
17
      integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
18
      crossorigin=""/>
19
      <script src="https://unpkg.com/[email protected]/dist/leaflet.js"
20
         integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
21
         crossorigin=""></script>
22
    <script type="text/javascript">
23
    let lon = <?= $data["lon"] ?>;
24
    let lat = <?= $data["lat"] ?>;
25
26
    let map = L.map('map').setView([lat, lon], 11);
27
28
    L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
29
        attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
30
    }).addTo(map);
31
32
    L.marker([lat, lon]).addTo(map)
33
        .bindPopup('Din position')
34
        .openPopup();
35
    </script>
36
<?php else : ?>
37
    <p><b>Din position går tyvärr inte att läsa ut på kartan</b></p>
38
<?php endif; ?>
39
40
<!-- <pre>
41
    <?= var_dump($data); ?> -->
0 ignored issues
show
Are you sure the usage of var_dump($data) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Are you sure var_dump($data) of type void can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

41
    <?= /** @scrutinizer ignore-type */ var_dump($data); ?> -->
Loading history...
42