public function getClientId($clientId = null)
    {

        // Return given parameter
        if ($clientId) {
            return $clientId;
        }

        // If clientId is null and no clientId has previously been set
        if (!$this->clientId) {
            throw new RequestRequiresClientIdException();
        }

        // Return clientId that has previously been set
        return $this->clientId;
    }