for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yokai\SecurityTokenBundle\InformationGuesser;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* This information guesser, is finding client ip and hostname
*
* @author Yann Eugoné <[email protected]>
*/
class InformationGuesser implements InformationGuesserInterface
{
* @var RequestStack
private $requestStack;
* @param RequestStack $requestStack The request stack
public function __construct(RequestStack $requestStack)
$this->requestStack = $requestStack;
}
* @inheritDoc
public function get()
$request = $this->requestStack->getMasterRequest();
if (!$request) {
return [];
return [
'ip' => $request->getClientIp(),
'host' => gethostname(),
];