ApiClient
extends ApiClient
in package
Admin list row of an external Api client (Settings, applications with Api access).
ApiClientMapper builds the rows from the api/system/api-client/get-all response; the
key digest is never present (the Api does not send it). The entity also carries the status
(enabled / disabled / revoked), allowed role ids and the application keys (Api rows
with state active / expiring / expired / revoked, without digest); all for display only.
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_system_api_clients'
- #[TableAlias]
- 'apiClient'
Table of Contents
Constants
- KEY_STATE_ACTIVE : string = 'active'
- KEY_STATE_EXPIRED : string = 'expired'
- KEY_STATE_EXPIRING : string = 'expiring'
- KEY_STATE_REVOKED : string = 'revoked'
- STATE_DISABLED : string = 'disabled'
- STATE_ENABLED : string = 'enabled'
- STATE_REVOKED : string = 'revoked'
Properties
- $createdAt : DateTime|null
- $enabled : bool
- $id : int|null
- $ipLimitPerMinute : int|null
- $lastUsedAt : DateTime|null
- $limitPerMinute : int|null
- $limitPerSecond : int|null
- $name : string
- $notes : string|null
- $revokedAt : DateTime|null
- $updatedAt : DateTime|null
- $userLimitPerMinute : int|null
- $activeKeyCount : int
- $keys : array<int, array<string, mixed>>
- $roleIds : array<int, int>
- $state : string
Methods
- __construct() : mixed
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getActiveKeyCount() : int
- Number of valid keys (neither revoked nor expired).
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getCreatedAt() : DateTime|null
- getEnabled() : bool
- getId() : int|null
- getIpLimitPerMinute() : int|null
- getKeys() : array<int, array<string, mixed>>
- getLastUsedAt() : DateTime|null
- getLimitPerMinute() : int|null
- getLimitPerSecond() : int|null
- getName() : string
- getNotes() : string|null
- getRevokedAt() : DateTime|null
- getRoleIds() : array<int, int>
- getState() : string
- getUpdatedAt() : DateTime|null
- getUserLimitPerMinute() : int|null
- isEnabled() : bool
- isPersisted() : bool
- isRevoked() : bool
- isUsable() : bool
- setActiveKeyCount() : self
- setCreatedAt() : $this
- setEnabled() : $this
- setId() : $this
- setIpLimitPerMinute() : $this
- setKeys() : self
- setLastUsedAt() : $this
- setLimitPerMinute() : $this
- setLimitPerSecond() : $this
- setName() : $this
- setNotes() : $this
- setRevokedAt() : $this
- setRoleIds() : self
- setState() : self
- setUpdatedAt() : $this
- setUserLimitPerMinute() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Constants
KEY_STATE_ACTIVE
public
string
KEY_STATE_ACTIVE
= 'active'
KEY_STATE_EXPIRED
public
string
KEY_STATE_EXPIRED
= 'expired'
KEY_STATE_EXPIRING
public
string
KEY_STATE_EXPIRING
= 'expiring'
KEY_STATE_REVOKED
public
string
KEY_STATE_REVOKED
= 'revoked'
STATE_DISABLED
public
string
STATE_DISABLED
= 'disabled'
STATE_ENABLED
public
string
STATE_ENABLED
= 'enabled'
STATE_REVOKED
public
string
STATE_REVOKED
= 'revoked'
Properties
$createdAt
protected
DateTime|null
$createdAt
= null
Attributes
- #[Column]
- $name: 'created_at'
- $type: 'datetime'
$enabled
protected
bool
$enabled
= true
Attributes
- #[Column]
- $name: 'enabled'
- $type: 'boolean'
- $options: ['default' => true]
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $type: 'integer'
- $name: 'api_client_id'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$ipLimitPerMinute
protected
int|null
$ipLimitPerMinute
= null
Attributes
- #[Column]
- $name: 'ip_limit_per_minute'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$lastUsedAt
protected
DateTime|null
$lastUsedAt
= null
Attributes
- #[Column]
- $name: 'last_used_at'
- $type: 'datetime'
- $nullable: true
$limitPerMinute
protected
int|null
$limitPerMinute
= null
Attributes
- #[Column]
- $name: 'limit_per_minute'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$limitPerSecond
protected
int|null
$limitPerSecond
= null
Attributes
- #[Column]
- $name: 'limit_per_second'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$name
protected
string
$name
= ''
Attributes
- #[Column]
- $name: 'name'
- $type: 'string'
- $length: 100
$notes
protected
string|null
$notes
= null
Attributes
- #[Column]
- $name: 'notes'
- $type: 'string'
- $length: 255
- $nullable: true
$revokedAt
protected
DateTime|null
$revokedAt
= null
Attributes
- #[Column]
- $name: 'revoked_at'
- $type: 'datetime'
- $nullable: true
$updatedAt
protected
DateTime|null
$updatedAt
= null
Attributes
- #[Column]
- $name: 'updated_at'
- $type: 'datetime'
- $nullable: true
$userLimitPerMinute
protected
int|null
$userLimitPerMinute
= null
Attributes
- #[Column]
- $name: 'user_limit_per_minute'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$activeKeyCount
private
int
$activeKeyCount
= 0
Attributes
- #[Transient]
$keys
private
array<int, array<string, mixed>>
$keys
= []
application keys (Api rows: id, keyPrefix, label, createdAt, expiresAt, revokedAt, lastUsedAt, state)
Attributes
- #[Transient]
$roleIds
private
array<int, int>
$roleIds
= []
Attributes
- #[Transient]
$state
private
string
$state
= self::STATE_ENABLED
Attributes
- #[Transient]
Methods
__construct()
public
__construct([int|null $id = null ][, string $name = '' ][, bool $enabled = true ][, DateTime|null $createdAt = null ][, DateTime|null $revokedAt = null ][, DateTime|null $lastUsedAt = null ][, DateTime|null $updatedAt = null ][, string|null $notes = null ][, int|null $limitPerSecond = null ][, int|null $limitPerMinute = null ][, int|null $userLimitPerMinute = null ][, int|null $ipLimitPerMinute = null ]) : mixed
Parameters
- $id : int|null = null
- $name : string = ''
- $enabled : bool = true
- $createdAt : DateTime|null = null
- $revokedAt : DateTime|null = null
- $lastUsedAt : DateTime|null = null
- $updatedAt : DateTime|null = null
- $notes : string|null = null
- $limitPerSecond : int|null = null
- $limitPerMinute : int|null = null
- $userLimitPerMinute : int|null = null
- $ipLimitPerMinute : int|null = null
callInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getActiveKeyCount()
Number of valid keys (neither revoked nor expired).
public
getActiveKeyCount() : int
Return values
intgetAllTraits()
Returns all traits the class uses, including those used by parent classes and nested traits.
public
getAllTraits() : array<string, string>
Return values
array<string, string>getCreatedAt()
public
getCreatedAt() : DateTime|null
Return values
DateTime|nullgetEnabled()
public
getEnabled() : bool
Return values
boolgetId()
public
getId() : int|null
Return values
int|nullgetIpLimitPerMinute()
public
getIpLimitPerMinute() : int|null
Return values
int|nullgetKeys()
public
getKeys() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>getLastUsedAt()
public
getLastUsedAt() : DateTime|null
Return values
DateTime|nullgetLimitPerMinute()
public
getLimitPerMinute() : int|null
Return values
int|nullgetLimitPerSecond()
public
getLimitPerSecond() : int|null
Return values
int|nullgetName()
public
getName() : string
Return values
stringgetNotes()
public
getNotes() : string|null
Return values
string|nullgetRevokedAt()
public
getRevokedAt() : DateTime|null
Return values
DateTime|nullgetRoleIds()
public
getRoleIds() : array<int, int>
Return values
array<int, int>getState()
public
getState() : string
Return values
stringgetUpdatedAt()
public
getUpdatedAt() : DateTime|null
Return values
DateTime|nullgetUserLimitPerMinute()
public
getUserLimitPerMinute() : int|null
Return values
int|nullisEnabled()
public
isEnabled() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisRevoked()
public
isRevoked() : bool
Return values
boolisUsable()
public
isUsable() : bool
Return values
boolsetActiveKeyCount()
public
setActiveKeyCount(int $activeKeyCount) : self
Parameters
- $activeKeyCount : int
Return values
selfsetCreatedAt()
public
setCreatedAt(DateTime|null $createdAt) : $this
Parameters
- $createdAt : DateTime|null
Return values
$thissetEnabled()
public
setEnabled(bool $enabled) : $this
Parameters
- $enabled : bool
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetIpLimitPerMinute()
public
setIpLimitPerMinute(int|null $ipLimitPerMinute) : $this
Parameters
- $ipLimitPerMinute : int|null
Return values
$thissetKeys()
public
setKeys(array<int, array<string, mixed>> $keys) : self
Parameters
- $keys : array<int, array<string, mixed>>
Return values
selfsetLastUsedAt()
public
setLastUsedAt(DateTime|null $lastUsedAt) : $this
Parameters
- $lastUsedAt : DateTime|null
Return values
$thissetLimitPerMinute()
public
setLimitPerMinute(int|null $limitPerMinute) : $this
Parameters
- $limitPerMinute : int|null
Return values
$thissetLimitPerSecond()
public
setLimitPerSecond(int|null $limitPerSecond) : $this
Parameters
- $limitPerSecond : int|null
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetNotes()
public
setNotes(string|null $notes) : $this
Parameters
- $notes : string|null
Return values
$thissetRevokedAt()
public
setRevokedAt(DateTime|null $revokedAt) : $this
Parameters
- $revokedAt : DateTime|null
Return values
$thissetRoleIds()
public
setRoleIds(array<int, int> $roleIds) : self
Parameters
- $roleIds : array<int, int>
Return values
selfsetState()
public
setState(string $state) : self
Parameters
- $state : string
Return values
selfsetUpdatedAt()
public
setUpdatedAt(DateTime|null $updatedAt) : $this
Parameters
- $updatedAt : DateTime|null
Return values
$thissetUserLimitPerMinute()
public
setUserLimitPerMinute(int|null $userLimitPerMinute) : $this
Parameters
- $userLimitPerMinute : int|null
Return values
$thisgetTraitsRecursive()
Walks the trait list recursively and collects nested traits too.
private
static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
- $traits : array<string, string>