<?php
namespace ProVM\KI\Common\Controller\Web;

use Psr\Container\ContainerInterface as Container;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Slim\Views\Blade as View;

class Faq {
  public function __invoke(Request $request, Response $response, View $view, Container $container) {
    $filename = implode(DIRECTORY_SEPARATOR, [
      $container->get('folders.data'),
      'faqs.json'
    ]);
    $faqs = json_decode(trim(file_get_contents($filename)));
    return $view->render($response, 'faq', compact('faqs'));
  }
}
