1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
<?php
namespace JRA\Responsibilities\Responsible\Logout;
use JRA\Config\Authenticate;
use JRA\Factories\InternalFactory;
use JRA\Interfaces\ConfigInterface;
use JRA\Responsibilities\Handlers\AbstractLogoutHandler;
use stdClass;
class UserCredentialsLogout extends AbstractLogoutHandler
{
protected function process(ConfigInterface $pConfig, InternalFactory $pInternalFactory)
{
if ($pConfig->getAuthenticationMethod() !== Authenticate::AUTH_METHOD_USER_CREDENTIALS) {
return false;
}
$userCredentials = $pConfig->getAuthenticationCredentials();
$userSession = $pConfig->getSession();
$response = json_decode(
$pInternalFactory
->getGuzzleFactory()
->getGuzzleHandler()
->get(
'user/logout/' . $userCredentials['username'] . '/' . $userSession
)
->getBody()
);
return $response;
}
}