<?php
namespace Controllers;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class IndexController
{
public function index(Request $request, Application $app)
{
return new Response('Index page');
}
public function viewAllProducts(Request $request, Application $app)
{
return new Response('All products');
}
public function viewProduct(Request $request, Application $app, $id)
{
return new Response($id . 'producth with this number.');
}
}
PD9waHAgCgpuYW1lc3BhY2UgQ29udHJvbGxlcnM7Cgp1c2UgU2lsZXhcQXBwbGljYXRpb247CnVzZSBTeW1mb255XENvbXBvbmVudFxIdHRwRm91bmRhdGlvblxSZXF1ZXN0Owp1c2UgU3ltZm9ueVxDb21wb25lbnRcSHR0cEZvdW5kYXRpb25cUmVzcG9uc2U7CgoKY2xhc3MgSW5kZXhDb250cm9sbGVyCnsKCXB1YmxpYyBmdW5jdGlvbiBpbmRleChSZXF1ZXN0ICRyZXF1ZXN0LCBBcHBsaWNhdGlvbiAkYXBwKQoJewoJCXJldHVybiBuZXcgUmVzcG9uc2UoJ0luZGV4IHBhZ2UnKTsKCX0KCglwdWJsaWMgZnVuY3Rpb24gdmlld0FsbFByb2R1Y3RzKFJlcXVlc3QgJHJlcXVlc3QsIEFwcGxpY2F0aW9uICRhcHApCgl7CgkJcmV0dXJuIG5ldyBSZXNwb25zZSgnQWxsIHByb2R1Y3RzJyk7Cgl9CgoJcHVibGljIGZ1bmN0aW9uIHZpZXdQcm9kdWN0KFJlcXVlc3QgJHJlcXVlc3QsIEFwcGxpY2F0aW9uICRhcHAsICRpZCkKCXsKCQlyZXR1cm4gbmV3IFJlc3BvbnNlKCRpZCAuICdwcm9kdWN0aCB3aXRoIHRoaXMgbnVtYmVyLicpOwoJfQp9