Completed
Push — master ( c93e0a...f87b82 )
by Mario
09:30 queued 03:59
created

Service/Authentication/AuthenticationService.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Marek\Toggable\Service\Authentication;
4
5
use Marek\Toggable\API\Http\Request\Authentication\SessionCookie as SessionCookieRequest;
6
use Marek\Toggable\API\Http\Response\Error;
7
use Marek\Toggable\API\Http\Response\Successful;
8
use Marek\Toggable\API\Toggl\AuthenticationServiceInterface;
9
use Marek\Toggable\Service\AbstractService;
10
use Marek\Toggable\API\Security\Cookie\SessionCookie;
11
12
/**
13
 * Class AuthenticationService
14
 * @package Marek\Toggable\Service\Authentication
15
 */
16
class AuthenticationService extends AbstractService implements AuthenticationServiceInterface
17
{
18
    public function getSessionCookie()
19
    {
20
        $request = new SessionCookieRequest();
21
22
        $response = $this->requestManager->request($request);
23
24
        if ($response instanceof Error) {
25
            return $response;
26
        }
27
28
        if (!empty($response->cookie)) {
29
            $sessionCookie = new SessionCookie($response->cookie);
30
31
            $client = $this->requestManager->getHttpClient();
0 ignored issues
show
The method getHttpClient() does not seem to exist on object<Marek\Toggable\Ht...equestManagerInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
            $client->setCookie($sessionCookie);
33
34
            return new Successful();
35
        }
36
37
        return $response;
38
    }
39
40
    public function destroySession()
41
    {
42
        // TODO: Implement destroySession() method.
43
    }
44
}
45