Factory/TokenFactory.php
public function createEntity(array $data, $token = false)
    {
        if (false === $token) {
            $token = Token::create();
        }

        if (isset($data['authorization'])) {
            $token = $token->setAuthorization($this->createAuthorization($data['authorization']));
        }

        if (isset($data['user_name'])) {
            $token = $token->setUserName($data['user_name']);
        }

        if (isset($data['valid'])) {
            $token = $token->setValid($data['valid']);
        }

        return $token;
    }
public function createEntity(array $data, $token = false)
    {
        if (false === $token) {
            $token = Token::create();
        }

        if (isset($data['authorization'])) {
            $token = $token->setAuthorization($this->createAuthorization($data['authorization']));
        }

        if (isset($data['user_name'])) {
            $token = $token->setUserName($data['user_name']);
        }

        if (isset($data['valid'])) {
            $token = $token->setValid($data['valid']);
        }

        return $token;
    }
@param array $data
@param false|Token $token

@return Token