Renamed internal object names to represent a difference between standard objects and database records.

This commit is contained in:
Netkas 2023-06-20 17:28:01 -04:00
parent 8e2e1eaba1
commit dc15ce5bb9
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
16 changed files with 79 additions and 315 deletions

View file

@ -54,7 +54,7 @@
self::$configuration->setDefault('cache_system.cache.client_objects_ttl', 200); self::$configuration->setDefault('cache_system.cache.client_objects_ttl', 200);
self::$configuration->setDefault('cache_system.cache.client_objects_server_preference', 'redis_master'); self::$configuration->setDefault('cache_system.cache.client_objects_server_preference', 'redis_master');
self::$configuration->setDefault('cache_system.cache.client_objects_server_fallback', 'redis_slave'); self::$configuration->setDefault('cache_system.cache.client_objects_server_fallback', 'redis_slave');
// Peer Objects // PeerRecord Objects
self::$configuration->setDefault('cache_system.cache.peer_objects_enabled', true); self::$configuration->setDefault('cache_system.cache.peer_objects_enabled', true);
self::$configuration->setDefault('cache_system.cache.peer_objects_ttl', 200); self::$configuration->setDefault('cache_system.cache.peer_objects_ttl', 200);
self::$configuration->setDefault('cache_system.cache.peer_objects_server_preference', 'redis_master'); self::$configuration->setDefault('cache_system.cache.peer_objects_server_preference', 'redis_master');

View file

@ -13,7 +13,7 @@
use FederationLib\Exceptions\Standard\InvalidClientDescriptionException; use FederationLib\Exceptions\Standard\InvalidClientDescriptionException;
use FederationLib\Exceptions\Standard\InvalidClientNameException; use FederationLib\Exceptions\Standard\InvalidClientNameException;
use FederationLib\Managers\ClientManager; use FederationLib\Managers\ClientManager;
use FederationLib\Objects\Client; use FederationLib\Objects\ClientRecord;
use FederationLib\Objects\ResolvedIdentity; use FederationLib\Objects\ResolvedIdentity;
use FederationLib\Objects\Standard\ClientIdentity; use FederationLib\Objects\Standard\ClientIdentity;
use TamerLib\Enums\TamerMode; use TamerLib\Enums\TamerMode;
@ -197,14 +197,14 @@
* Returns an existing client from the database * Returns an existing client from the database
* *
* @param ClientIdentity|null $identity * @param ClientIdentity|null $identity
* @param string|Client $client_uuid * @param string|ClientRecord $client_uuid
* @throws AccessDeniedException * @return Objects\Standard\Client
*@throws ClientNotFoundException *@throws ClientNotFoundException
* @throws DatabaseException * @throws DatabaseException
* @throws InternalServerException * @throws InternalServerException
* @return Objects\Standard\Client * @throws AccessDeniedException
*/ */
public function getClient(?ClientIdentity $identity, string|Client $client_uuid): Objects\Standard\Client public function getClient(?ClientIdentity $identity, string|ClientRecord $client_uuid): Objects\Standard\Client
{ {
if(!$this->checkPermission(Methods::GET_CLIENT, $this->resolveIdentity($identity))) if(!$this->checkPermission(Methods::GET_CLIENT, $this->resolveIdentity($identity)))
{ {

View file

@ -2,8 +2,8 @@
namespace FederationLib\Interfaces; namespace FederationLib\Interfaces;
use FederationLib\Objects\Client; use FederationLib\Objects\ClientRecord;
use FederationLib\Objects\Peer; use FederationLib\Objects\PeerRecord;
use FederationLib\Objects\Standard\PeerMetadata\TelegramUserMetadata; use FederationLib\Objects\Standard\PeerMetadata\TelegramUserMetadata;
interface PeerMetadataManagerInterface interface PeerMetadataManagerInterface
@ -12,27 +12,27 @@
* Intelligently syncs the metadata of the given federated address, this will ignore raw metadata & use * Intelligently syncs the metadata of the given federated address, this will ignore raw metadata & use
* data from the given $client_uuid * data from the given $client_uuid
* *
* @param Client|string $client_uuid * @param ClientRecord|string $client_uuid
* @param TelegramUserMetadata $telegram_user_metadata * @param TelegramUserMetadata $telegram_user_metadata
* @return string * @return string
*/ */
public function syncMetadata(Client|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string; public function syncMetadata(ClientRecord|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string;
/** /**
* Registers the metadata of the given federated address, this will ignore raw metadata & use data from the * Registers the metadata of the given federated address, this will ignore raw metadata & use data from the
* given $client_uuid * given $client_uuid
* *
* @param Client|string $client_uuid * @param ClientRecord|string $client_uuid
* @param TelegramUserMetadata $telegram_user_metadata * @param TelegramUserMetadata $telegram_user_metadata
* @return string * @return string
*/ */
public function registerMetadata(Client|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string; public function registerMetadata(ClientRecord|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string;
/** /**
* Returns the metadata of the given federated address, this returns the full raw metadata * Returns the metadata of the given federated address, this returns the full raw metadata
* *
* @param Peer|string $federated_address * @param PeerRecord|string $federated_address
* @return TelegramUserMetadata * @return TelegramUserMetadata
*/ */
public function getMetadata(Peer|string $federated_address): TelegramUserMetadata; public function getMetadata(PeerRecord|string $federated_address): TelegramUserMetadata;
} }

View file

@ -19,7 +19,7 @@
use FederationLib\Exceptions\Standard\InvalidClientNameException; use FederationLib\Exceptions\Standard\InvalidClientNameException;
use FederationLib\Exceptions\Standard\InvalidPermissionRoleException; use FederationLib\Exceptions\Standard\InvalidPermissionRoleException;
use FederationLib\FederationLib; use FederationLib\FederationLib;
use FederationLib\Objects\Client; use FederationLib\Objects\ClientRecord;
use LogLib\Log; use LogLib\Log;
use Symfony\Component\Uid\Uuid; use Symfony\Component\Uid\Uuid;
use TamerLib\Enums\TamerMode; use TamerLib\Enums\TamerMode;
@ -119,14 +119,14 @@
/** /**
* Returns an existing client from the database. * Returns an existing client from the database.
* *
* @param string|Client $client_uuid * @param string|ClientRecord $client_uuid
* @return Client * @return ClientRecord
* @throws ClientNotFoundException * @throws ClientNotFoundException
* @throws DatabaseException * @throws DatabaseException
*/ */
public function getClient(string|Client $client_uuid): Client public function getClient(string|ClientRecord $client_uuid): ClientRecord
{ {
if($client_uuid instanceof Client) if($client_uuid instanceof ClientRecord)
{ {
$client_uuid = $client_uuid->getUuid(); $client_uuid = $client_uuid->getUuid();
} }
@ -143,7 +143,7 @@
if($redis->exists($client_uuid)) if($redis->exists($client_uuid))
{ {
$client = Client::fromArray($redis->hGetAll($client_uuid)); $client = ClientRecord::fromArray($redis->hGetAll($client_uuid));
Log::debug(Misc::FEDERATIONLIB, sprintf('Loaded client object %s from cache', $client_uuid)); Log::debug(Misc::FEDERATIONLIB, sprintf('Loaded client object %s from cache', $client_uuid));
return $client; return $client;
} }
@ -170,7 +170,7 @@
throw new ClientNotFoundException($client_uuid); throw new ClientNotFoundException($client_uuid);
} }
$client = Client::fromArray($result->fetchAssociative()); $client = ClientRecord::fromArray($result->fetchAssociative());
} }
catch(ClientNotFoundException $e) catch(ClientNotFoundException $e)
{ {
@ -211,16 +211,16 @@
/** /**
* Changes the name of a client. * Changes the name of a client.
* *
* @param string|Client $client_uuid * @param string|ClientRecord $client_uuid
* @param string|null $name * @param string|null $name
* @return void * @return void
* @throws ClientNotFoundException * @throws ClientNotFoundException
* @throws DatabaseException * @throws DatabaseException
* @throws InvalidClientNameException * @throws InvalidClientNameException
*/ */
public function changeClientName(string|Client $client_uuid, ?string $name=null): void public function changeClientName(string|ClientRecord $client_uuid, ?string $name=null): void
{ {
if($client_uuid instanceof Client) if($client_uuid instanceof ClientRecord)
{ {
$client_uuid = $client_uuid->getUuid(); $client_uuid = $client_uuid->getUuid();
} }
@ -297,16 +297,16 @@
/** /**
* Changes the description of a client * Changes the description of a client
* *
* @param string|Client $client_uuid * @param string|ClientRecord $client_uuid
* @param string|null $description * @param string|null $description
* @return void * @return void
* @throws ClientNotFoundException * @throws ClientNotFoundException
* @throws DatabaseException * @throws DatabaseException
* @throws InvalidClientDescriptionException * @throws InvalidClientDescriptionException
*/ */
public function changeClientDescription(string|Client $client_uuid, ?string $description=null): void public function changeClientDescription(string|ClientRecord $client_uuid, ?string $description=null): void
{ {
if($client_uuid instanceof Client) if($client_uuid instanceof ClientRecord)
{ {
$client_uuid = $client_uuid->getUuid(); $client_uuid = $client_uuid->getUuid();
} }
@ -377,16 +377,16 @@
/** /**
* Updates the permission role of a client. * Updates the permission role of a client.
* *
* @param string|Client $client_uuid * @param string|ClientRecord $client_uuid
* @param int $permission_role * @param int $permission_role
* @return void * @return void
* @throws ClientNotFoundException * @throws ClientNotFoundException
* @throws DatabaseException * @throws DatabaseException
* @throws InvalidPermissionRoleException * @throws InvalidPermissionRoleException
*/ */
public function changeClientPermissionRole(string|Client $client_uuid, int $permission_role): void public function changeClientPermissionRole(string|ClientRecord $client_uuid, int $permission_role): void
{ {
if($client_uuid instanceof Client) if($client_uuid instanceof ClientRecord)
{ {
$client_uuid = $client_uuid->getUuid(); $client_uuid = $client_uuid->getUuid();
} }
@ -457,14 +457,14 @@
/** /**
* Updates a client's last seen timestamp. * Updates a client's last seen timestamp.
* *
* @param string|Client $uuid * @param string|ClientRecord $uuid
* @return void * @return void
* @throws DatabaseException * @throws DatabaseException
* @noinspection PhpUnused * @noinspection PhpUnused
*/ */
public function updateLastSeen(string|Client $uuid): void public function updateLastSeen(string|ClientRecord $uuid): void
{ {
if($uuid instanceof Client) if($uuid instanceof ClientRecord)
{ {
$uuid = $uuid->getUuid(); $uuid = $uuid->getUuid();
} }
@ -593,7 +593,7 @@
while($row = $result->fetchAssociative()) while($row = $result->fetchAssociative())
{ {
$client_object = Client::fromArray($row); $client_object = ClientRecord::fromArray($row);
if($redis_client !== null) if($redis_client !== null)
{ {
@ -657,13 +657,13 @@
/** /**
* Deletes an existing client from the database. * Deletes an existing client from the database.
* *
* @param string|Client $uuid * @param string|ClientRecord $uuid
* @return void * @return void
* @throws DatabaseException * @throws DatabaseException
*/ */
public function deleteClient(string|Client $uuid): void public function deleteClient(string|ClientRecord $uuid): void
{ {
if($uuid instanceof Client) if($uuid instanceof ClientRecord)
{ {
$uuid = $uuid->getUuid(); $uuid = $uuid->getUuid();
} }

View file

@ -14,23 +14,23 @@
use FederationLib\Exceptions\Standard\PeerMetadataNotFoundException; use FederationLib\Exceptions\Standard\PeerMetadataNotFoundException;
use FederationLib\Interfaces\PeerMetadataManagerInterface; use FederationLib\Interfaces\PeerMetadataManagerInterface;
use FederationLib\Managers\RedisConnectionManager; use FederationLib\Managers\RedisConnectionManager;
use FederationLib\Objects\Client; use FederationLib\Objects\ClientRecord;
use FederationLib\Objects\Peer; use FederationLib\Objects\PeerRecord;
use FederationLib\Objects\Standard\PeerMetadata\TelegramUserMetadata; use FederationLib\Objects\Standard\PeerMetadata\TelegramUserMetadata;
use LogLib\Log; use LogLib\Log;
class TelegramUserManager implements PeerMetadataManagerInterface class TelegramUserManager implements PeerMetadataManagerInterface
{ {
/** /**
* @param Client|string $client_uuid * @param ClientRecord|string $client_uuid
* @param TelegramUserMetadata $telegram_user_metadata * @param TelegramUserMetadata $telegram_user_metadata
* @return string * @return string
* @throws DatabaseException * @throws DatabaseException
* @throws InvalidPeerMetadataException * @throws InvalidPeerMetadataException
*/ */
public function syncMetadata(Client|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string public function syncMetadata(ClientRecord|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string
{ {
if($client_uuid instanceof Client) if($client_uuid instanceof ClientRecord)
{ {
$client_uuid = $client_uuid->getUuid(); $client_uuid = $client_uuid->getUuid();
} }
@ -126,14 +126,14 @@
/** /**
* Registers the client's metadata with the database * Registers the client's metadata with the database
* *
* @param Client|string $client_uuid * @param ClientRecord|string $client_uuid
* @param TelegramUserMetadata $telegram_user_metadata * @param TelegramUserMetadata $telegram_user_metadata
* @return string * @return string
* @throws DatabaseException * @throws DatabaseException
*/ */
public function registerMetadata(Client|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string public function registerMetadata(ClientRecord|string $client_uuid, TelegramUserMetadata $telegram_user_metadata): string
{ {
if($client_uuid instanceof Client) if($client_uuid instanceof ClientRecord)
{ {
$client_uuid = $client_uuid->getUuid(); $client_uuid = $client_uuid->getUuid();
} }
@ -182,14 +182,14 @@
} }
/** /**
* @param Peer|string $federated_address * @param PeerRecord|string $federated_address
* @throws PeerMetadataNotFoundException
* @throws DatabaseException
* @return TelegramUserMetadata * @return TelegramUserMetadata
*@throws DatabaseException
* @throws PeerMetadataNotFoundException
*/ */
public function getMetadata(Peer|string $federated_address): TelegramUserMetadata public function getMetadata(PeerRecord|string $federated_address): TelegramUserMetadata
{ {
if($federated_address instanceof Peer) if($federated_address instanceof PeerRecord)
{ {
$federated_address = $federated_address->getFederatedAddress(); $federated_address = $federated_address->getFederatedAddress();
} }
@ -243,7 +243,7 @@
if($result->rowCount() === 0) if($result->rowCount() === 0)
{ {
throw new PeerMetadataNotFoundException(sprintf('Peer metadata not found for federated address %s', $federated_address)); throw new PeerMetadataNotFoundException(sprintf('PeerRecord metadata not found for federated address %s', $federated_address));
} }
$telegram_user_metadata = TelegramUserMetadata::fromArray($result->fetchAssociative(), true); $telegram_user_metadata = TelegramUserMetadata::fromArray($result->fetchAssociative(), true);

View file

@ -4,6 +4,7 @@
use FederationLib\Enums\Standard\UserPeerType; use FederationLib\Enums\Standard\UserPeerType;
use FederationLib\FederationLib; use FederationLib\FederationLib;
use FederationLib\Interfaces\PeerMetadataInterface;
use FederationLib\Interfaces\PeerMetadataManagerInterface; use FederationLib\Interfaces\PeerMetadataManagerInterface;
use FederationLib\Objects\Standard\PeerMetadata\TelegramUserMetadata; use FederationLib\Objects\Standard\PeerMetadata\TelegramUserMetadata;
@ -29,4 +30,9 @@
$this->federationLib = $federationLib; $this->federationLib = $federationLib;
$this->metadata_managers[UserPeerType::TELEGRAM_USER] = new TelegramUserMetadata(); $this->metadata_managers[UserPeerType::TELEGRAM_USER] = new TelegramUserMetadata();
} }
public function registerPeer(string $federated_address, PeerMetadataInterface $peer_metadata): void
{
}
} }

View file

@ -9,7 +9,7 @@
use FederationLib\Enums\Standard\PermissionRole; use FederationLib\Enums\Standard\PermissionRole;
use FederationLib\Interfaces\SerializableObjectInterface; use FederationLib\Interfaces\SerializableObjectInterface;
class Client implements SerializableObjectInterface class ClientRecord implements SerializableObjectInterface
{ {
/** /**
* @var string * @var string
@ -238,9 +238,9 @@
* Constructs object from an array representation. * Constructs object from an array representation.
* *
* @param array $array * @param array $array
* @return Client * @return ClientRecord
*/ */
public static function fromArray(array $array): Client public static function fromArray(array $array): ClientRecord
{ {
$client = new self(); $client = new self();

View file

@ -1,50 +0,0 @@
<?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace FederationLib\Objects;
class InvokeResults
{
/**
* @var int
*/
private $exit_code;
/**
* @var string
*/
private $output;
/**
* InvokeResults constructor.
*
* @param int $exit_code
* @param string $output
*/
public function __construct(int $exit_code, string $output)
{
$this->exit_code = $exit_code;
$this->output = $output;
}
/**
* Returns the exit code of the command.
*
* @return int
*/
public function getExitCode(): int
{
return $this->exit_code;
}
/**
* Returns the output of the command.
*
* @return string
*/
public function getOutput(): string
{
return $this->output;
}
}

View file

@ -6,7 +6,7 @@
use FederationLib\Interfaces\SerializableObjectInterface; use FederationLib\Interfaces\SerializableObjectInterface;
class Peer implements SerializableObjectInterface class PeerRecord implements SerializableObjectInterface
{ {
/** /**
* @var string * @var string
@ -120,9 +120,9 @@
* Constructs object from an array representation * Constructs object from an array representation
* *
* @param array $array * @param array $array
* @return Peer * @return PeerRecord
*/ */
public static function fromArray(array $array): Peer public static function fromArray(array $array): PeerRecord
{ {
$object = new self(); $object = new self();

View file

@ -1,17 +0,0 @@
<?php
namespace FederationLib\Objects;
class QueryDocument
{
private $subject_type;
private $client_id;
private $client_totp_signature;
private $timstamp;
private $platform;
private $event_type;
private $channel_peer;
private $resent_from_peer;
private
}

View file

@ -9,12 +9,12 @@
class ResolvedIdentity class ResolvedIdentity
{ {
/** /**
* @var Client|null * @var ClientRecord|null
*/ */
private $client; private $client;
/** /**
* @var Peer|null * @var PeerRecord|null
*/ */
private $peer; private $peer;
@ -26,10 +26,10 @@
/** /**
* ResolvedIdentity constructor. * ResolvedIdentity constructor.
* *
* @param Client|null $client * @param ClientRecord|null $client
* @param Peer|null $peer * @param PeerRecord|null $peer
*/ */
public function __construct(?Client $client, ?Peer $peer=null, bool $allow_root=false) public function __construct(?ClientRecord $client, ?PeerRecord $peer=null, bool $allow_root=false)
{ {
$this->client = $client; $this->client = $client;
$this->peer = $peer; $this->peer = $peer;
@ -73,17 +73,17 @@
} }
/** /**
* @return Client|null * @return ClientRecord|null
*/ */
public function getClient(): ?Client public function getClient(): ?ClientRecord
{ {
return $this->client; return $this->client;
} }
/** /**
* @return Peer|null * @return PeerRecord|null
*/ */
public function getPeer(): ?Peer public function getPeer(): ?PeerRecord
{ {
return $this->peer; return $this->peer;
} }

View file

@ -5,6 +5,7 @@
namespace FederationLib\Objects\Standard; namespace FederationLib\Objects\Standard;
use FederationLib\Interfaces\SerializableObjectInterface; use FederationLib\Interfaces\SerializableObjectInterface;
use FederationLib\Objects\ClientRecord;
class Client implements SerializableObjectInterface class Client implements SerializableObjectInterface
{ {
@ -51,9 +52,9 @@
/** /**
* Client constructor. * Client constructor.
* *
* @param \FederationLib\Objects\Client|null $client * @param ClientRecord|null $client
*/ */
public function __construct(?\FederationLib\Objects\Client $client=null) public function __construct(?ClientRecord $client=null)
{ {
if($client === null) if($client === null)
{ {

View file

@ -1,176 +0,0 @@
<?php
/** @noinspection PhpMissingFieldTypeInspection */
namespace FederationLib\Objects\Standard;
use FederationLib\Interfaces\SerializableObjectInterface;
class Peer implements SerializableObjectInterface
{
/**
* @var string
*/
private $federated_address;
/**
* @var string
*/
private $client_first_seen;
/**
* @var string
*/
private $client_last_seen;
/**
* @var string|null
*/
private $active_restriction;
/**
* @var int
*/
private $permission_role;
/**
* @var int
*/
private $discovered_timestamp;
/**
* @var int
*/
private $seen_timestamp;
/**
* Peer constructor.
*
* @param \FederationLib\Objects\Peer|null $peer
*/
public function __construct(?\FederationLib\Objects\Peer $peer=null)
{
if($peer === null)
{
return;
}
$this->federated_address = $peer->getFederatedAddress();
$this->client_first_seen = $peer->getClientFirstSeen();
$this->client_last_seen = $peer->getClientLastSeen();
$this->active_restriction = $peer->getActiveRestriction();
$this->permission_role = $peer->getPermissionRole();
$this->discovered_timestamp = $peer->getDiscoveredTimestamp();
$this->seen_timestamp = $peer->getSeenTimestamp();
}
/**
* Returns the federated address of the peer
*
* @return string
*/
public function getFederatedAddress(): string
{
return $this->federated_address;
}
/**
* Returns the Client UUID that first saw the peer
*
* @return string
*/
public function getClientFirstSeen(): string
{
return $this->client_first_seen;
}
/**
* Returns the Client UUID that last saw the peer
*
* @return string
*/
public function getClientLastSeen(): string
{
return $this->client_last_seen;
}
/**
* Optional. Returns the ID of the active restriction applied to the peer
* if null, no restriction is applied
*
* @return string|null
*/
public function getActiveRestriction(): ?string
{
return $this->active_restriction;
}
/**
* Returns the permission role of the peer
*
* @return int
*/
public function getPermissionRole(): int
{
return $this->permission_role;
}
/**
* Returns the timestamp of when the peer was discovered by the client
*
* @return int
*/
public function getDiscoveredTimestamp(): int
{
return $this->discovered_timestamp;
}
/**
* Returns the timestamp of when the peer was last seen by the client
*
* @return int
*/
public function getSeenTimestamp(): int
{
return $this->seen_timestamp;
}
/**
* Returns an array representation of the object
*
* @return array
*/
public function toArray(): array
{
return [
'federated_address' => $this->federated_address,
'client_first_seen' => $this->client_first_seen,
'client_last_seen' => $this->client_last_seen,
'active_restriction' => $this->active_restriction,
'permission_role' => $this->permission_role,
'discovered_timestamp' => $this->discovered_timestamp,
'seen_timestamp' => $this->seen_timestamp
];
}
/**
* Constructs object from an array representation
*
* @param array $array
* @return Peer
*/
public static function fromArray(array $array): Peer
{
$object = new self();
$object->federated_address = $array['federated_address'];
$object->client_first_seen = $array['client_first_seen'];
$object->client_last_seen = $array['client_last_seen'];
$object->active_restriction = $array['active_restriction'];
$object->permission_role = $array['permission_role'];
$object->discovered_timestamp = $array['discovered_timestamp'];
$object->seen_timestamp = $array['seen_timestamp'];
return $object;
}
}

View file

@ -5,7 +5,7 @@
import('net.nosial.federationlib'); import('net.nosial.federationlib');
$federationlib = new \FederationLib\FederationLib(); $federationlib = new \FederationLib\FederationLib();
$client = new \FederationLib\Objects\Client(); $client = new \FederationLib\Objects\ClientRecord();
$client->setDescription('This is a test client generated by a test script.'); $client->setDescription('This is a test client generated by a test script.');
$uuid = $federationlib->getClientManager()->registerClient($client); $uuid = $federationlib->getClientManager()->registerClient($client);

View file

@ -5,7 +5,7 @@
import('net.nosial.federationlib'); import('net.nosial.federationlib');
$federationlib = new \FederationLib\FederationLib(); $federationlib = new \FederationLib\FederationLib();
$client = new \FederationLib\Objects\Client(); $client = new \FederationLib\Objects\ClientRecord();
$client->setDescription('This is a test client generated by a test script.'); $client->setDescription('This is a test client generated by a test script.');
$uuid = $federationlib->getClientManager()->registerClient($client); $uuid = $federationlib->getClientManager()->registerClient($client);

View file

@ -8,7 +8,7 @@
// loop 50 times to create 50 clients // loop 50 times to create 50 clients
for($i = 0; $i < 50; $i++) for($i = 0; $i < 50; $i++)
{ {
$client = new \FederationLib\Objects\Client(); $client = new \FederationLib\Objects\ClientRecord();
$client->setDescription('This is a test client generated by a test script.'); $client->setDescription('This is a test client generated by a test script.');
$client->enableAuthentication(); $client->enableAuthentication();