WEBD-325-45/week-04/homework/libraries/src/Service/InputProvider.php

48 lines
1.1 KiB
PHP

<?php
/**
* @package Sport Stars
*
* @created 19th April 2022
* @author Llewellyn van der Merwe <https://git.vdm.dev/Llewellyn>
* @git WEBD-325-45 <https://git.vdm.dev/Llewellyn/WEBD-325-45>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Sport\Stars\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Input\Input;
/**
* Application service provider
* source: https://github.com/joomla/framework.joomla.org/blob/master/src/Service/ApplicationProvider.php
*/
class InputProvider implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*/
public function register(Container $container): void
{
$container->share(Input::class, [$this, 'getInputClassService'], true);
}
/**
* Get the Input class service
*
* @param Container $container The DI container.
*
* @return Input
*/
public function getInputClassService(Container $container): Input
{
return new Input($_REQUEST);
}
}