Skip to content
Snippets Groups Projects
RequeteVue.php 1.01 KiB
<?php

use Slim\Slim;

class Requete1
{

    protected $tab, $app;

    public function __construct($t)
    {
        $this->tab = $t;
        $this->app = Slim::getInstance();
    }

    public function render($type)
    {
        switch ($type) {
            case 1:
                return $this->selectMario();
                break;
            default:
                return $this->notFound();
                break;
        }
    }

    private function notFound()
    {
        $res .= <<<RES
    <!doctype html>

    <html lang="fr">
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <p>data not found</p>
    </body>
    </html>
RES;
    }

    private function selectMario()
    {
        $res .= <<<RES
    <!doctype html>

    <html lang="fr">
    <head>
        <meta charset="utf-8">
    </head>
    <body>

RES;
        foreach ($this->tab as $key => $value) {
            $res .= <<<RES
    $key:$value
RES;
        }
        $res .= <<<RES
    </body>
    </html>
RES;
        return $res;
    }
}