Source of file GroupMembershipUpdate.php

Size: 1,302 Bytes - Last Modified: 2018-11-03T09:50:48-04:00

G:/AdobeConnectClient/src/Commands/GroupMembershipUpdate.php

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
<?php

namespace AdobeConnectClient\Commands;

use AdobeConnectClient\Command;
use AdobeConnectClient\Converter\Converter;
use AdobeConnectClient\Helpers\StatusValidate;
use AdobeConnectClient\Helpers\ValueTransform as VT;

/**
 * Adds one principal to a group, or removes one principal from a group.
 *
 * More info see {@link https://helpx.adobe.com/adobe-connect/webservices/group-membership-update.html}
 */
class GroupMembershipUpdate extends Command
{
    /**
     * @var array
     */
    protected $parameters;

    /**
     * @param int $groupId
     * @param int $principalId
     * @param bool $isMember
     */
    public function __construct($groupId, $principalId, $isMember)
    {
        $this->parameters = [
            'action' => 'group-membership-update',
            'group-id' => (int) $groupId,
            'principal-id' => (int) $principalId,
            'is-member' => VT::toString($isMember),
        ];
    }

    /**
     * @inheritdoc
     *
     * @return bool
     */
    protected function process()
    {
        $response = Converter::convert(
            $this->client->doGet(
                $this->parameters + ['session' => $this->client->getSession()]
            )
        );
        StatusValidate::validate($response['status']);
        return true;
    }
}