alexander-emelyanov/tradologic-api-client

View on GitHub
src/Responses/UserLogin.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace TradoLogic\Responses;

use TradoLogic\Exception;
use TradoLogic\Payload;
use TradoLogic\Response;

class UserLogin extends Response
{
    const FIELD_SESSION_ID = 'sessionId';

    public function __construct(Payload $payload)
    {
        parent::__construct($payload);
        if (!$this->isSuccess()) {
            switch ($this->getMessageType()) {
                default: {
                    throw new Exception($this, $this->getMessageText());
                }
            }
        }
    }

    public function getSessionId()
    {
        $messageParameters = $this->getMessageParameters();

        return $messageParameters[static::FIELD_SESSION_ID];
    }
}