2021-03-25 21:23:29 -03:00
|
|
|
<?php
|
|
|
|
namespace App\Contract;
|
|
|
|
|
2023-06-22 23:15:17 -04:00
|
|
|
use App\Alias\RemoteConnection;
|
2021-03-25 21:23:29 -03:00
|
|
|
use App\Definition\Contract;
|
2023-06-22 23:15:17 -04:00
|
|
|
use App\Service\Money;
|
|
|
|
use App\Service\Remote;
|
2021-03-25 21:23:29 -03:00
|
|
|
use App\Service\View as ViewService;
|
2023-06-22 23:15:17 -04:00
|
|
|
use GuzzleHttp\Client;
|
2021-03-25 21:23:29 -03:00
|
|
|
|
|
|
|
class View
|
|
|
|
{
|
|
|
|
use Contract;
|
|
|
|
|
|
|
|
protected static function newInstance()
|
|
|
|
{
|
2023-06-22 23:15:17 -04:00
|
|
|
$remote = new Remote(new RemoteConnection());
|
|
|
|
$money = (new Money(new Client([
|
|
|
|
'base_uri' => "http://{$remote->getIP()}:8008",
|
|
|
|
'headers' => ['Accept' => 'application/json']
|
|
|
|
])));
|
|
|
|
return new ViewService(['money' => $money]);
|
2021-03-25 21:23:29 -03:00
|
|
|
}
|
|
|
|
public static function show($template, $variables = null)
|
|
|
|
{
|
|
|
|
$instance = self::getInstance();
|
|
|
|
return $instance->show($template, $variables);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|