-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Nchan has a concept named groups. A group configuration can be shown and can be changed.
Suggested implementation / collaborators
Code documentation and use statements has been removed for readability.
This class wraps the group api.
<?php
namespace Marein\Nchan\Api;
final class Group
{
private $groupUrl;
private $client;
public function __construct(Url $groupUrl, Client $client)
{
$this->groupUrl = $groupUrl;
$this->client = $client;
}
public function configuration(): GroupInformation
{
// Create and return value object for group information.
}
public function configure(): GroupConfigurator
{
return new GroupConfigurator($this->groupUrl, $this->client);
}
}This class acts like a builder for the group configuration. The configuration is sent when the configurate method is called.
<?php
namespace Marein\Nchan\Api;
final class GroupConfigurator
{
private $groupUrl;
private $client;
public function __construct(Url $groupUrl, Client $client)
{
$this->groupUrl = $groupUrl;
$this->client = $client;
}
public function changeMaximumNumberOfChannels(
int $maximumNumberOfChannels
): GroupConfigurator
{
$this->groupUrl = $this->groupUrl->appendQueryString(
'max_channels',
$maximumNumberOfChannels
);
return $this;
}
public function changeMaximumNumberOfSubscribers(
int $maximumNumberOfSubscribers
): GroupConfigurator
{
$this->groupUrl = $this->groupUrl->appendQueryString(
'max_subs',
$maximumNumberOfSubscribers
);
return $this;
}
public function configurate(): void
{
// Send request with configured items
}
}Reactions are currently unavailable