for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Asti\Weather;
use Anax\Commons\ContainerInjectableInterface;
use Anax\Commons\ContainerInjectableTrait;
// use Anax\Route\Exception\ForbiddenException;
// use Anax\Route\Exception\NotFoundException;
// use Anax\Route\Exception\InternalErrorException;
/**
* A sample controller to show how a controller class can be implemented.
* The controller will be injected with $di if implementing the interface
* ContainerInjectableInterface, like this sample class does.
* The controller is mounted on a particular route and can then handle all
* requests for that mount point.
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class WeatherRequestController implements ContainerInjectableInterface
{
use ContainerInjectableTrait;
public function indexAction(): object
$ip = $_SERVER['REMOTE_ADDR'] ?? "127.0.0.1";
$page = $this->di->get("page");
$data = [
"ipAdress" => $ip
];
$page->add("weather_api/weather_request", $data);
return $page->render($data);
}