Issues (34)

view/weather/validationpos.php (4 issues)

Labels
Severity
1
<?php
2
3
namespace Anax\View;
4
5
/**
6
 * Render content within an article.
7
 */
8
9
?>
10
<head>
11
    <meta charset="utf-8">
12
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
13
    <title>Vädret</title>
14
</head>
15
16
<h1>Vädret</h1>
17
18
<h3>Vädret Just Nu</h3>
19
<div id="currweather">
20
    <?php
21
    if (is_array($data["forweather"]) && !array_key_exists("message", $data["forweather"])) {
22
        echo "<p>Vädret hos dig just nu är " . $data["forweather"]["current"]["weather"][0]["description"];
23
        echo "<br>Temperaturen är " . $data["forweather"]["current"]["temp"] .
24
            " grader och det känns som " . $data["forweather"]["current"]["feels_like"] . "</p>";
25
    } else {
26
        echo "<p>Tyvärr går det inte att visa vädret hos dig just nu.</p>";
27
    }?>
28
</div>
29
<h3>Kommande väder</h3>
30
<div id="forweather">
31
    <p>
32
    <?php
33
    if (is_array($data["forweather"]) && !array_key_exists("message", $data["forweather"])) {
34
        echo "Imorgon blir det ca " . $data["forweather"]["daily"][0]["temp"]["day"] .
35
            " grader och det blir " . $data["forweather"]["daily"][0]["weather"][0]["description"];
36
        echo "<br>I övermorgon blir det ca " . $data["forweather"]["daily"][1]["temp"]["day"] .
37
        " grader och det blir " . $data["forweather"]["daily"][1]["weather"][0]["description"];
38
        echo "<br>Om tre dagar blir det ca " . $data["forweather"]["daily"][2]["temp"]["day"] .
39
        " grader och det blir " . $data["forweather"]["daily"][2]["weather"][0]["description"];
40
        echo "<br>Om fyra dagar blir det ca " . $data["forweather"]["daily"][3]["temp"]["day"] .
41
        " grader och det blir " . $data["forweather"]["daily"][3]["weather"][0]["description"];
42
        echo "<br>Om fem dagar blir det ca " . $data["forweather"]["daily"][4]["temp"]["day"] .
43
        " grader och det blir " . $data["forweather"]["daily"][4]["weather"][0]["description"];
44
    } else {
45
        echo "Väderprognosen går ej att hämta.";
46
    }?>
47
    </p>
48
</div>
49
50
<h3>Historiskt väder</h3>
51
52
<div id="histweather">
53
    <p>
54
    <?php
55
    if (count($data["histweather"]) == 5) {
56
        echo "Igår var det " . $data["histweather"][0]["temp"] .
57
            " grader ute och det var " . $data["histweather"][0]["weather"][0]["description"];
58
        echo "<br>I förrgår var det " . $data["histweather"][1]["temp"] .
59
            " grader ute och det var " . $data["histweather"][1]["weather"][0]["description"];
60
        echo "<br>Dagen innan dess var det " . $data["histweather"][2]["temp"] .
61
            " grader ute och det var " . $data["histweather"][2]["weather"][0]["description"];
62
        echo "<br>För fyra dagar sen var det " . $data["histweather"][3]["temp"] .
63
            " grader ute och det var " . $data["histweather"][3]["weather"][0]["description"];
64
        echo "<br>För fem dagar sen var det " . $data["histweather"][4]["temp"] .
65
            " grader ute och det var " . $data["histweather"][4]["weather"][0]["description"];
66
    } else {
67
        echo "Historiskt väder kan inte visas för dig.";
68
    }?>
69
    </p>
70
</div>
71
72
73
<!-- <pre>
74
    <?= 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

74
    <?= /** @scrutinizer ignore-type */ var_dump($data); ?>
Loading history...
75
    <?= var_dump($_POST); ?> -->
0 ignored issues
show
Are you sure the usage of var_dump($_POST) 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($_POST) 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

75
    <?= /** @scrutinizer ignore-type */ var_dump($_POST); ?> -->
Loading history...
76