code
stringlengths
17
296k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public function getTimestamp() { return $this->timestamp; }
using int64 for Unix timestamp Generated from protobuf field <code>int64 timestamp = 2;</code> @return int|string
getTimestamp
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setTimestamp($var) { GPBUtil::checkInt64($var); $this->timestamp = $var; return $this; }
using int64 for Unix timestamp Generated from protobuf field <code>int64 timestamp = 2;</code> @param int|string $var @return $this
setTimestamp
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getTopic() { return $this->topic; }
Generated from protobuf field <code>string topic = 3;</code> @return string
getTopic
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setTopic($var) { GPBUtil::checkString($var, True); $this->topic = $var; return $this; }
Generated from protobuf field <code>string topic = 3;</code> @param string $var @return $this
setTopic
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getMimeType() { return $this->mime_type; }
Generated from protobuf field <code>string mime_type = 4;</code> @return string
getMimeType
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setMimeType($var) { GPBUtil::checkString($var, True); $this->mime_type = $var; return $this; }
Generated from protobuf field <code>string mime_type = 4;</code> @param string $var @return $this
setMimeType
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getTotalLength() { return isset($this->total_length) ? $this->total_length : 0; }
only populated for finite streams, if it's a stream of unknown size this stays empty Generated from protobuf field <code>optional uint64 total_length = 5;</code> @return int|string
getTotalLength
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setTotalLength($var) { GPBUtil::checkUint64($var); $this->total_length = $var; return $this; }
only populated for finite streams, if it's a stream of unknown size this stays empty Generated from protobuf field <code>optional uint64 total_length = 5;</code> @param int|string $var @return $this
setTotalLength
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getEncryptionType() { return $this->encryption_type; }
defaults to NONE Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7;</code> @return int
getEncryptionType
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setEncryptionType($var) { GPBUtil::checkEnum($var, \Livekit\Encryption\Type::class); $this->encryption_type = $var; return $this; }
defaults to NONE Generated from protobuf field <code>.livekit.Encryption.Type encryption_type = 7;</code> @param int $var @return $this
setEncryptionType
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getAttributes() { return $this->attributes; }
user defined attributes map that can carry additional info Generated from protobuf field <code>map<string, string> attributes = 8;</code> @return \Google\Protobuf\Internal\MapField
getAttributes
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setAttributes($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->attributes = $arr; return $this; }
user defined attributes map that can carry additional info Generated from protobuf field <code>map<string, string> attributes = 8;</code> @param array|\Google\Protobuf\Internal\MapField $var @return $this
setAttributes
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getTextHeader() { return $this->readOneof(9); }
Generated from protobuf field <code>.livekit.DataStream.TextHeader text_header = 9;</code> @return \Livekit\DataStream\TextHeader|null
getTextHeader
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setTextHeader($var) { GPBUtil::checkMessage($var, \Livekit\DataStream\TextHeader::class); $this->writeOneof(9, $var); return $this; }
Generated from protobuf field <code>.livekit.DataStream.TextHeader text_header = 9;</code> @param \Livekit\DataStream\TextHeader $var @return $this
setTextHeader
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getByteHeader() { return $this->readOneof(10); }
Generated from protobuf field <code>.livekit.DataStream.ByteHeader byte_header = 10;</code> @return \Livekit\DataStream\ByteHeader|null
getByteHeader
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function setByteHeader($var) { GPBUtil::checkMessage($var, \Livekit\DataStream\ByteHeader::class); $this->writeOneof(10, $var); return $this; }
Generated from protobuf field <code>.livekit.DataStream.ByteHeader byte_header = 10;</code> @param \Livekit\DataStream\ByteHeader $var @return $this
setByteHeader
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Header.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Header.php
Apache-2.0
public function getOperationType() { return $this->operation_type; }
Generated from protobuf field <code>.livekit.DataStream.OperationType operation_type = 1;</code> @return int
getOperationType
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function setOperationType($var) { GPBUtil::checkEnum($var, \Livekit\DataStream\OperationType::class); $this->operation_type = $var; return $this; }
Generated from protobuf field <code>.livekit.DataStream.OperationType operation_type = 1;</code> @param int $var @return $this
setOperationType
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function getVersion() { return $this->version; }
Optional: Version for updates/edits Generated from protobuf field <code>int32 version = 2;</code> @return int
getVersion
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function setVersion($var) { GPBUtil::checkInt32($var); $this->version = $var; return $this; }
Optional: Version for updates/edits Generated from protobuf field <code>int32 version = 2;</code> @param int $var @return $this
setVersion
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function getReplyToStreamId() { return $this->reply_to_stream_id; }
Optional: Reply to specific message Generated from protobuf field <code>string reply_to_stream_id = 3;</code> @return string
getReplyToStreamId
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function setReplyToStreamId($var) { GPBUtil::checkString($var, True); $this->reply_to_stream_id = $var; return $this; }
Optional: Reply to specific message Generated from protobuf field <code>string reply_to_stream_id = 3;</code> @param string $var @return $this
setReplyToStreamId
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function getAttachedStreamIds() { return $this->attached_stream_ids; }
file attachments for text streams Generated from protobuf field <code>repeated string attached_stream_ids = 4;</code> @return \Google\Protobuf\Internal\RepeatedField
getAttachedStreamIds
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function setAttachedStreamIds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->attached_stream_ids = $arr; return $this; }
file attachments for text streams Generated from protobuf field <code>repeated string attached_stream_ids = 4;</code> @param string[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
setAttachedStreamIds
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function getGenerated() { return $this->generated; }
true if the text has been generated by an agent from a participant's audio transcription Generated from protobuf field <code>bool generated = 5;</code> @return bool
getGenerated
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function setGenerated($var) { GPBUtil::checkBool($var); $this->generated = $var; return $this; }
true if the text has been generated by an agent from a participant's audio transcription Generated from protobuf field <code>bool generated = 5;</code> @param bool $var @return $this
setGenerated
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/TextHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/TextHeader.php
Apache-2.0
public function getStreamId() { return $this->stream_id; }
unique identifier for this data stream Generated from protobuf field <code>string stream_id = 1;</code> @return string
getStreamId
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Trailer.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Trailer.php
Apache-2.0
public function setStreamId($var) { GPBUtil::checkString($var, True); $this->stream_id = $var; return $this; }
unique identifier for this data stream Generated from protobuf field <code>string stream_id = 1;</code> @param string $var @return $this
setStreamId
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Trailer.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Trailer.php
Apache-2.0
public function getReason() { return $this->reason; }
reason why the stream was closed (could contain "error" / "interrupted" / empty for expected end) Generated from protobuf field <code>string reason = 2;</code> @return string
getReason
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Trailer.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Trailer.php
Apache-2.0
public function setReason($var) { GPBUtil::checkString($var, True); $this->reason = $var; return $this; }
reason why the stream was closed (could contain "error" / "interrupted" / empty for expected end) Generated from protobuf field <code>string reason = 2;</code> @param string $var @return $this
setReason
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Trailer.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Trailer.php
Apache-2.0
public function getAttributes() { return $this->attributes; }
finalizing updates for the stream, can also include additional insights for errors or endTime for transcription Generated from protobuf field <code>map<string, string> attributes = 3;</code> @return \Google\Protobuf\Internal\MapField
getAttributes
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Trailer.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Trailer.php
Apache-2.0
public function setAttributes($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->attributes = $arr; return $this; }
finalizing updates for the stream, can also include additional insights for errors or endTime for transcription Generated from protobuf field <code>map<string, string> attributes = 3;</code> @param array|\Google\Protobuf\Internal\MapField $var @return $this
setAttributes
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Trailer.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Trailer.php
Apache-2.0
public function getName() { return $this->name; }
Generated from protobuf field <code>string name = 1;</code> @return string
getName
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/ByteHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/ByteHeader.php
Apache-2.0
public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; }
Generated from protobuf field <code>string name = 1;</code> @param string $var @return $this
setName
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/ByteHeader.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/ByteHeader.php
Apache-2.0
public function getStreamId() { return $this->stream_id; }
unique identifier for this data stream to map it to the correct header Generated from protobuf field <code>string stream_id = 1;</code> @return string
getStreamId
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function setStreamId($var) { GPBUtil::checkString($var, True); $this->stream_id = $var; return $this; }
unique identifier for this data stream to map it to the correct header Generated from protobuf field <code>string stream_id = 1;</code> @param string $var @return $this
setStreamId
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function getChunkIndex() { return $this->chunk_index; }
Generated from protobuf field <code>uint64 chunk_index = 2;</code> @return int|string
getChunkIndex
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function setChunkIndex($var) { GPBUtil::checkUint64($var); $this->chunk_index = $var; return $this; }
Generated from protobuf field <code>uint64 chunk_index = 2;</code> @param int|string $var @return $this
setChunkIndex
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function getContent() { return $this->content; }
content as binary (bytes) Generated from protobuf field <code>bytes content = 3;</code> @return string
getContent
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function setContent($var) { GPBUtil::checkString($var, False); $this->content = $var; return $this; }
content as binary (bytes) Generated from protobuf field <code>bytes content = 3;</code> @param string $var @return $this
setContent
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function getVersion() { return $this->version; }
a version indicating that this chunk_index has been retroactively modified and the original one needs to be replaced Generated from protobuf field <code>int32 version = 4;</code> @return int
getVersion
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function setVersion($var) { GPBUtil::checkInt32($var); $this->version = $var; return $this; }
a version indicating that this chunk_index has been retroactively modified and the original one needs to be replaced Generated from protobuf field <code>int32 version = 4;</code> @param int $var @return $this
setVersion
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function getIv() { return isset($this->iv) ? $this->iv : ''; }
optional, initialization vector for AES-GCM encryption Generated from protobuf field <code>optional bytes iv = 5;</code> @return string
getIv
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function setIv($var) { GPBUtil::checkString($var, False); $this->iv = $var; return $this; }
optional, initialization vector for AES-GCM encryption Generated from protobuf field <code>optional bytes iv = 5;</code> @param string $var @return $this
setIv
php
agence104/livekit-server-sdk-php
src/proto/Livekit/DataStream/Chunk.php
https://github.com/agence104/livekit-server-sdk-php/blob/master/src/proto/Livekit/DataStream/Chunk.php
Apache-2.0
public function __construct(array $maps) { $this->maps = $maps; }
Instantiates a new filesystem map. @param array $maps
__construct
php
KnpLabs/KnpGaufretteBundle
FilesystemMap.php
https://github.com/KnpLabs/KnpGaufretteBundle/blob/master/FilesystemMap.php
MIT
public function checkGatewayConnections($addresses_list) { if (empty($addresses_list)) { return; } foreach ($addresses_list as $addr) { if (!isset($this->_waitingConnectGatewayAddresses[$addr])) { $this->tryToConnectGateway($addr); } } }
检查 gateway 的通信端口是否都已经连 如果有未连接的端口,则尝试连接 @param array $addresses_list
checkGatewayConnections
php
walkor/GatewayWorker
src/BusinessWorker.php
https://github.com/walkor/GatewayWorker/blob/master/src/BusinessWorker.php
MIT
public function onConnectGateway($connection) { $this->gatewayConnections[$connection->remoteAddr] = $connection; unset($this->_connectingGatewayAddresses[$connection->remoteAddr], $this->_waitingConnectGatewayAddresses[$connection->remoteAddr]); }
当连接上 gateway 的通讯端口时触发 将连接 connection 对象保存起来 @param TcpConnection $connection @return void
onConnectGateway
php
walkor/GatewayWorker
src/BusinessWorker.php
https://github.com/walkor/GatewayWorker/blob/master/src/BusinessWorker.php
MIT
public function onClientConnect($connection) { $connection->id = self::generateConnectionId(); // 保存该连接的内部通讯的数据包报头,避免每次重新初始化 $connection->gatewayHeader = array( 'local_ip' => ip2long(gethostbyname($this->lanIp)), 'local_port' => $this->lanPort, 'client_ip' => ip2long($connection->getRemoteIp()), 'client_port' => $connection->getRemotePort(), 'gateway_port' => $this->_gatewayPort, 'connection_id' => $connection->id, 'flag' => 0, ); // 连接的 session $connection->session = ''; // 该连接的心跳参数 $connection->pingNotResponseCount = -1; // 该链接发送缓冲区大小 $connection->maxSendBufferSize = $this->sendToClientBufferSize; // 保存客户端连接 connection 对象 $this->_clientConnections[$connection->id] = $connection; // 如果用户有自定义 onConnect 回调,则执行 if ($this->_onConnect) { call_user_func($this->_onConnect, $connection); if (isset($connection->onWebSocketConnect)) { $connection->_onWebSocketConnect = $connection->onWebSocketConnect; } } if ($connection->protocol === '\Workerman\Protocols\Websocket' || $connection->protocol === 'Workerman\Protocols\Websocket') { $connection->onWebSocketConnect = array($this, 'onWebsocketConnect'); } $this->sendToWorker(GatewayProtocol::CMD_ON_CONNECT, $connection); }
当客户端连接上来时,初始化一些客户端的数据 包括全局唯一的client_id、初始化session等 @param TcpConnection $connection
onClientConnect
php
walkor/GatewayWorker
src/Gateway.php
https://github.com/walkor/GatewayWorker/blob/master/src/Gateway.php
MIT
public function onWorkerConnect($connection) { $connection->maxSendBufferSize = $this->sendToWorkerBufferSize; $connection->authorized = !$this->secretKey; }
当 worker 通过内部通讯端口连接到 gateway 时 @param TcpConnection $connection
onWorkerConnect
php
walkor/GatewayWorker
src/Gateway.php
https://github.com/walkor/GatewayWorker/blob/master/src/Gateway.php
MIT
public static function getAllClientInfo($group = '') { echo "Warning: Gateway::getAllClientInfo is deprecated and will be removed in a future, please use Gateway::getAllClientSessions instead."; return static::getAllClientSessions($group); }
获取所有在线用户的session,client_id为 key(弃用,请用getAllClientSessions代替) @param string $group @return array
getAllClientInfo
php
walkor/GatewayWorker
src/Lib/Gateway.php
https://github.com/walkor/GatewayWorker/blob/master/src/Lib/Gateway.php
MIT
public static function getClientInfoByGroup($group) { echo "Warning: Gateway::getClientInfoByGroup is deprecated and will be removed in a future, please use Gateway::getClientSessionsByGroup instead."; return static::getAllClientSessions($group); }
获取某个组的连接信息(弃用,请用getClientSessionsByGroup代替) @param string $group @return array
getClientInfoByGroup
php
walkor/GatewayWorker
src/Lib/Gateway.php
https://github.com/walkor/GatewayWorker/blob/master/src/Lib/Gateway.php
MIT
public static function getAllClientCount() { return static::getAllClientIdCount(); }
获取所有在线client_id数(getAllClientIdCount的别名) @return int
getAllClientCount
php
walkor/GatewayWorker
src/Lib/Gateway.php
https://github.com/walkor/GatewayWorker/blob/master/src/Lib/Gateway.php
MIT
public function newInstanceArgs(string $class, array $params) { return $this->container->getInstanceWithArgs($class, $params); }
Build an object graph with give constructor parameters @param string $class class name @param array<int, mixed> $params construct parameters @return mixed
newInstanceArgs
php
ray-di/Ray.Di
src/di/Grapher.php
https://github.com/ray-di/Ray.Di/blob/master/src/di/Grapher.php
MIT
public function getInstanceWithArgs(string $interface, array $params) { $index = $interface . '-'; if (! isset($this->container[$index])) { throw $this->unbound($index); } $dependency = $this->container[$index]; if (! $dependency instanceof Dependency) { throw new BadMethodCallException($interface); } /** @psalm-suppress ArgumentTypeCoercion */ return $dependency->injectWithArgs($this, $params); }
Return dependency injected instance @param array<int, mixed> $params @return mixed @throws Unbound
getInstanceWithArgs
php
ray-di/Ray.Di
src/di/Container.php
https://github.com/ray-di/Ray.Di/blob/master/src/di/Container.php
MIT
public function getDependency(string $index) { if (! isset($this->container[$index])) { throw $this->unbound($index); } return $this->container[$index]->inject($this); }
Return dependency injected instance @return mixed @throws Unbound
getDependency
php
ray-di/Ray.Di
src/di/Container.php
https://github.com/ray-di/Ray.Di/blob/master/src/di/Container.php
MIT
public function invoke(MethodInvocation $invocation) { $method = $invocation->getMethod(); $assisted = $method->getAnnotation(Assisted::class); $parameters = $method->getParameters(); $arguments = $invocation->getArguments()->getArrayCopy(); if ($assisted instanceof Assisted) { $this->methodInvocationProvider->set($invocation); $arguments = $this->injectAssistedParameters($method, $assisted, $parameters, $arguments); } $invocation->getArguments()->exchangeArray($arguments); return $invocation->proceed(); }
Intercepts any method and injects instances of the missing arguments when they are type hinted @return mixed
invoke
php
ray-di/Ray.Di
src/di/AssistedInterceptor.php
https://github.com/ray-di/Ray.Di/blob/master/src/di/AssistedInterceptor.php
MIT
public function setFinder(FinderInterface $finder) { $this->finder = $finder; }
Setter Injection with no Inject annotation
setFinder
php
ray-di/Ray.Di
demo-php8/05b-constructor-binding-setter-injection.php
https://github.com/ray-di/Ray.Di/blob/master/demo-php8/05b-constructor-binding-setter-injection.php
MIT
public function setFinder(FinderInterface $finder) { $this->finder = $finder; }
Setter Injection with no Inject annotation
setFinder
php
ray-di/Ray.Di
demo/05b-constructor-binding-setter-injection.php
https://github.com/ray-di/Ray.Di/blob/master/demo/05b-constructor-binding-setter-injection.php
MIT
public function __construct(FakeEngineInterface $engine) { $this->engine = $engine; }
Inject annotation at constructor is just for human, not mandatory.
__construct
php
ray-di/Ray.Di
tests/di/Fake/FakeCar.php
https://github.com/ray-di/Ray.Di/blob/master/tests/di/Fake/FakeCar.php
MIT
private function getRawValueForKey($key) { $qb = $this->conn->createQueryBuilder() ->select($this->valueColumn) ->from(self::TABLE) ->where($this->keyColumn . ' = :key') ->setParameter('key', $this->generateKey($key)) ; // TODO just call `executeQuery()` as soon as DBAL >= 2.13.1 is required $result = \method_exists($qb, 'executeQuery') ? $qb->executeQuery() : $qb->execute(); // TODO remove as soon as Doctrine DBAL >= 3.0 is required if (!\method_exists($result, 'fetchOne')) { return $result->fetchColumn(); } return $result->fetchOne(); }
Gets stored raw data for the given key. @param string $key @return string|false Raw data or false, if no data is available.
getRawValueForKey
php
craue/CraueFormFlowBundle
Storage/DoctrineStorage.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Storage/DoctrineStorage.php
MIT
private function proceedToStep($stepNumber) { static::$client->followRedirects(); $crawler = static::$client->request('GET', $this->url('_FormFlow_createTopic')); if ($stepNumber < 2) { return $crawler; } // bug report -> step 2 $form = $crawler->selectButton('next')->form(); $crawler = static::$client->submit($form, [ 'createTopic[title]' => 'blah', 'createTopic[category]' => 'BUG_REPORT', ]); if ($stepNumber < 3) { return $crawler; } // comment -> step 3 $form = $crawler->selectButton('next')->form(); $crawler = static::$client->submit($form, [ 'createTopic[comment]' => 'my comment', ]); if ($stepNumber < 4) { return $crawler; } // bug details -> step 4 $form = $crawler->selectButton('next')->form(); $crawler = static::$client->submit($form, [ 'createTopic[details]' => 'blah blah', ]); return $crawler; }
Processes through the flow up to the given step by filling out the forms with some valid data. @param int $stepNumber The targeted step number. @return Crawler
proceedToStep
php
craue/CraueFormFlowBundle
Tests/CreateTopicFlowTest.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Tests/CreateTopicFlowTest.php
MIT
private function ensureStepNumberRange($stepNumber) { return max(min($stepNumber, $this->getStepCount()), 1); }
Ensures that the step number is within the range of defined steps to avoid a possible OutOfBoundsException. @param int $stepNumber @return int
ensureStepNumberRange
php
craue/CraueFormFlowBundle
Form/FormFlow.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Form/FormFlow.php
MIT
public function invalidateStepData($fromStepNumber) { $stepData = $this->retrieveStepData(); for ($step = $fromStepNumber, $stepCount = $this->getStepCount(); $step < $stepCount; ++$step) { unset($stepData[$step]); } $this->saveStepData($stepData); }
Invalidates data for steps >= $fromStepNumber. @param int $fromStepNumber
invalidateStepData
php
craue/CraueFormFlowBundle
Form/FormFlow.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Form/FormFlow.php
MIT
protected function createFormForStep($stepNumber, array $options = []) { $formType = $this->getStep($stepNumber)->getFormType(); $options = $this->getFormOptions($stepNumber, $options); if ($formType === null) { $formType = FormType::class; } return $this->formFactory->create($formType, $this->formData, $options); }
Creates the form for the given step number. @param int $stepNumber @param array $options @return FormInterface
createFormForStep
php
craue/CraueFormFlowBundle
Form/FormFlow.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Form/FormFlow.php
MIT
protected function loadStepsConfig() { return []; }
Defines the configuration for all steps of this flow. @return array
loadStepsConfig
php
craue/CraueFormFlowBundle
Form/FormFlow.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Form/FormFlow.php
MIT
public static function removeTempFiles() { foreach (self::$tempFiles as $tempFile) { if (is_file($tempFile)) { @unlink($tempFile); } } self::$tempFiles = []; }
Removes all previously added files from disk.
removeTempFiles
php
craue/CraueFormFlowBundle
Util/TempFileUtil.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Util/TempFileUtil.php
MIT
public function addRouteParameters(array $parameters, FormFlow $flow, $stepNumber = null) { if ($stepNumber === null) { $stepNumber = $flow->getCurrentStepNumber(); } $parameters[$flow->getDynamicStepNavigationInstanceParameter()] = $flow->getInstanceId(); $parameters[$flow->getDynamicStepNavigationStepParameter()] = $stepNumber; return $parameters; }
Adds route parameters for dynamic step navigation. @param array $parameters Current route parameters. @param FormFlow $flow The flow involved. @param int|null $stepNumber Number of the step the link will be generated for. If <code>null</code>, the <code>$flow</code>'s current step number will be used. @return array Route parameters plus instance and step parameter.
addRouteParameters
php
craue/CraueFormFlowBundle
Util/FormFlowUtil.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Util/FormFlowUtil.php
MIT
public function removeRouteParameters(array $parameters, FormFlow $flow) { unset($parameters[$flow->getDynamicStepNavigationInstanceParameter()]); unset($parameters[$flow->getDynamicStepNavigationStepParameter()]); return $parameters; }
Removes route parameters for dynamic step navigation. @param array $parameters Current route parameters. @param FormFlow $flow The flow involved. @return array Route parameters without instance and step parameter.
removeRouteParameters
php
craue/CraueFormFlowBundle
Util/FormFlowUtil.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Util/FormFlowUtil.php
MIT
public function addDynamicStepNavigationParameters(array $parameters, FormFlow $flow, $stepNumber) { return $this->formFlowUtil->addRouteParameters($parameters, $flow, $stepNumber); }
Adds route parameters for dynamic step navigation. @param array $parameters Current route parameters. @param FormFlow $flow The flow involved. @param int $stepNumber Number of the step the link will be generated for. @return array Route parameters plus instance and step parameter.
addDynamicStepNavigationParameters
php
craue/CraueFormFlowBundle
Twig/Extension/FormFlowExtension.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Twig/Extension/FormFlowExtension.php
MIT
public function removeDynamicStepNavigationParameters(array $parameters, FormFlow $flow) { return $this->formFlowUtil->removeRouteParameters($parameters, $flow); }
Removes route parameters for dynamic step navigation. @param array $parameters Current route parameters. @param FormFlow $flow The flow involved. @return array Route parameters without instance and step parameter.
removeDynamicStepNavigationParameters
php
craue/CraueFormFlowBundle
Twig/Extension/FormFlowExtension.php
https://github.com/craue/CraueFormFlowBundle/blob/master/Twig/Extension/FormFlowExtension.php
MIT
public function __construct(private readonly TransporterContract $transporter) { // .. }
Creates a Client instance with the given API token.
__construct
php
openai-php/client
src/Client.php
https://github.com/openai-php/client/blob/master/src/Client.php
MIT
public function __construct( private readonly ClientInterface $client, private readonly BaseUri $baseUri, private readonly Headers $headers, private readonly QueryParams $queryParams, private readonly Closure $streamHandler, ) { // .. }
Creates a new Http Transporter instance.
__construct
php
openai-php/client
src/Transporters/HttpTransporter.php
https://github.com/openai-php/client/blob/master/src/Transporters/HttpTransporter.php
MIT
public function __construct( private readonly string $responseClass, private readonly ResponseInterface $response, ) { // }
Creates a new Stream Response instance. @param class-string<TResponse> $responseClass
__construct
php
openai-php/client
src/Responses/StreamResponse.php
https://github.com/openai-php/client/blob/master/src/Responses/StreamResponse.php
MIT
public function __construct(ClientExceptionInterface $exception) { parent::__construct($exception->getMessage(), 0, $exception); }
Creates a new Exception instance.
__construct
php
openai-php/client
src/Exceptions/TransporterException.php
https://github.com/openai-php/client/blob/master/src/Exceptions/TransporterException.php
MIT
public function __construct(JsonException $exception) { parent::__construct($exception->getMessage(), 0, $exception); }
Creates a new Exception instance.
__construct
php
openai-php/client
src/Exceptions/UnserializableResponse.php
https://github.com/openai-php/client/blob/master/src/Exceptions/UnserializableResponse.php
MIT
public function __construct(private readonly array $contents, private readonly int $statusCode) { $message = ($contents['message'] ?: (string) $this->contents['code']) ?: 'Unknown error'; if (is_array($message)) { $message = implode(PHP_EOL, $message); } parent::__construct($message); }
Creates a new Exception instance. @param array{message: string|array<int, string>, type: ?string, code: string|int|null} $contents
__construct
php
openai-php/client
src/Exceptions/ErrorException.php
https://github.com/openai-php/client/blob/master/src/Exceptions/ErrorException.php
MIT
private function __construct(private readonly string $uri) { // .. }
Creates a new ResourceUri value object.
__construct
php
openai-php/client
src/ValueObjects/ResourceUri.php
https://github.com/openai-php/client/blob/master/src/ValueObjects/ResourceUri.php
MIT
private function __construct(public readonly string $apiKey) { // .. }
Creates a new API token value object.
__construct
php
openai-php/client
src/ValueObjects/ApiKey.php
https://github.com/openai-php/client/blob/master/src/ValueObjects/ApiKey.php
MIT
private function __construct(private readonly string $baseUri) { // .. }
Creates a new Base URI value object.
__construct
php
openai-php/client
src/ValueObjects/Transporter/BaseUri.php
https://github.com/openai-php/client/blob/master/src/ValueObjects/Transporter/BaseUri.php
MIT
private function __construct( private readonly array|string $data, private readonly MetaInformation $meta ) { // .. }
Creates a new Response value object. @param TData $data
__construct
php
openai-php/client
src/ValueObjects/Transporter/Response.php
https://github.com/openai-php/client/blob/master/src/ValueObjects/Transporter/Response.php
MIT
private function __construct(private readonly array $headers) { // .. }
Creates a new Headers value object. @param array<string, string> $headers
__construct
php
openai-php/client
src/ValueObjects/Transporter/Headers.php
https://github.com/openai-php/client/blob/master/src/ValueObjects/Transporter/Headers.php
MIT
private function __construct( private readonly ContentType $contentType, private readonly Method $method, private readonly ResourceUri $uri, private readonly array $parameters = [], ) { // .. }
Creates a new Request value object. @param array<string, mixed> $parameters
__construct
php
openai-php/client
src/ValueObjects/Transporter/Payload.php
https://github.com/openai-php/client/blob/master/src/ValueObjects/Transporter/Payload.php
MIT
private function __construct(private readonly array $params) { // .. }
Creates a new Query Params value object. @param array<string, string|int> $params
__construct
php
openai-php/client
src/ValueObjects/Transporter/QueryParams.php
https://github.com/openai-php/client/blob/master/src/ValueObjects/Transporter/QueryParams.php
MIT
public function definition() { return [ 'first_name' => $this->faker->firstName(), 'last_name' => $this->faker->lastName(), 'email' => $this->faker->unique()->email(), 'phone_number' => $this->faker->unique()->phoneNumber(), 'address' => $this->faker->address(), 'city' => $this->faker->city(), 'state' => $this->faker->streetName(), 'postal_code' => $this->faker->postcode(), ]; }
Define the model's default state. @return array<string, mixed>
definition
php
liberu-ecommerce/ecommerce-old
database/factories/CustomerFactory.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/database/factories/CustomerFactory.php
MIT
public function join(User $user) { }
Authenticate the user's access to the channel. @return array|bool
join
php
liberu-ecommerce/ecommerce-old
app/Broadcasting/Notification.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Broadcasting/Notification.php
MIT
public function import(ImportJob $job) { }
The user imports Gedcom progress. @param \App\Models\ImportJob @return array|bool
import
php
liberu-ecommerce/ecommerce-old
app/Broadcasting/Notification.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Broadcasting/Notification.php
MIT
public function createTokenAndSendEmail(User $user) { Activation::where('user_id', $user->id) ->where('created_at', '>=', Carbon::now()->subHours(config('settings.timePeriod'))) ->count(); // if ($activations >= config('settings.maxAttempts')) { // return true; // } //if user changed activated email to new one if ($user->email_verified_at) { $user->update([ 'email_verified_at' => null, ]); } // Create new Activation record for this user $activation = self::createNewActivationToken($user); // Send activation email notification self::sendNewActivationEmail($user, $activation->token); }
Creates a token and send email. @return bool or void
createTokenAndSendEmail
php
liberu-ecommerce/ecommerce-old
app/Logic/Activation/ActivationRepository.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Logic/Activation/ActivationRepository.php
MIT
public function createNewActivationToken(User $user) { // $ipAddress = new CaptureIpTrait(); $activation = new Activation(); $activation->user_id = $user->id; $activation->token = Str::random(64); // $activation->ip_address = $ipAddress->getClientIp(); $activation->save(); return $activation; }
Creates a new activation token. @return \App\Models\Activation $activation
createNewActivationToken
php
liberu-ecommerce/ecommerce-old
app/Logic/Activation/ActivationRepository.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Logic/Activation/ActivationRepository.php
MIT
public function createTokenAndSendEmailApi(User $user) { $activations = Activation::where('user_id', $user->id) ->where('created_at', '>=', Carbon::now()->subHours(config('settings.timePeriod'))) ->count(); if ($activations >= config('settings.maxAttempts')) { return true; } //if user changed activated email to new one if ($user->activated) { $user->update([ 'activated' => false, ]); } // Create new Activation record for this user $activation = self::createNewActivationTokenApi($user); // Send activation email notification self::sendNewActivationEmailApi($user, $activation->token); }
Creates a token and send email.- api. @return bool or void
createTokenAndSendEmailApi
php
liberu-ecommerce/ecommerce-old
app/Logic/Activation/ActivationRepository.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Logic/Activation/ActivationRepository.php
MIT
public function createNewActivationTokenApi(User $user) { $token = sprintf('%06d', random_int(1, 999999)); // $ipAddress = new CaptureIpTrait(); $activation = new Activation(); $activation->user_id = $user->id; $activation->token = $token; // $activation->ip_address = $ipAddress->getClientIp(); $activation->save(); return $activation; }
Creates a new activation token. @return \App\Models\Activation $activation
createNewActivationTokenApi
php
liberu-ecommerce/ecommerce-old
app/Logic/Activation/ActivationRepository.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Logic/Activation/ActivationRepository.php
MIT
public function deleteExpiredActivations() { Activation::where('created_at', '<=', Carbon::now()->subHours(72))->delete(); }
Method to removed expired activations. @return void
deleteExpiredActivations
php
liberu-ecommerce/ecommerce-old
app/Logic/Activation/ActivationRepository.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Logic/Activation/ActivationRepository.php
MIT
public function broadcastOn() { return new Channel('getcom-progress'); }
Get the channels the event should broadcast on. @return \Illuminate\Broadcasting\Channel|array
broadcastOn
php
liberu-ecommerce/ecommerce-old
app/Events/GedComProgressSent.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Events/GedComProgressSent.php
MIT
public function broadcastOn() { return new PrivateChannel('chat'); }
Get the channels the event should broadcast on. @return \Illuminate\Broadcasting\Channel|array
broadcastOn
php
liberu-ecommerce/ecommerce-old
app/Events/MessageSent.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Events/MessageSent.php
MIT
public function broadcastOn() { return new Channel('chat'); }
Get the channels the event should broadcast on. @return \Illuminate\Broadcasting\Channel|array
broadcastOn
php
liberu-ecommerce/ecommerce-old
app/Events/ServerCreated.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Events/ServerCreated.php
MIT
public function __construct(protected $token) { // $this->onQueue('social'); }
Create a new notification instance. SendActivationEmail constructor. @param $token
__construct
php
liberu-ecommerce/ecommerce-old
app/Notifications/SendActivationEmail.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Notifications/SendActivationEmail.php
MIT
public function via(mixed $notifiable) { return ['mail']; }
Get the notification's delivery channels. @return array
via
php
liberu-ecommerce/ecommerce-old
app/Notifications/SendActivationEmail.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Notifications/SendActivationEmail.php
MIT
public function toMail(mixed $notifiable) { $baseUrl = env('APP_URL'); $url = $baseUrl.'/verify?token='.$this->token; $message = new MailMessage(); $message->subject(trans('emails.activationSubject')) ->greeting(trans('emails.activationGreeting')) ->line(trans('emails.activationMessage')) ->action(trans('emails.activationButton'), $url) ->line($this->token) ->line(trans('emails.activationThanks')); return $message; }
Get the mail representation of the notification. @return \Illuminate\Notifications\Messages\MailMessage
toMail
php
liberu-ecommerce/ecommerce-old
app/Notifications/SendActivationEmail.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Notifications/SendActivationEmail.php
MIT
public function toArray(mixed $notifiable) { return [ ]; }
Get the array representation of the notification. @return array
toArray
php
liberu-ecommerce/ecommerce-old
app/Notifications/SendActivationEmail.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Notifications/SendActivationEmail.php
MIT
public function __construct($plan_id) { $stripe = new \Stripe\StripeClient(\Config::get('services.stripe.secret')); $this->plan = is_array($plan_id) ? $stripe->plans->retrieve($plan_id['planId']) : $stripe->plans->retrieve($plan_id); }
Create a new notification instance. @return void
__construct
php
liberu-ecommerce/ecommerce-old
app/Notifications/SubscribeSuccessfully.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Notifications/SubscribeSuccessfully.php
MIT
public function via(mixed $notifiable) { return ['mail']; }
Get the notification's delivery channels. @return array
via
php
liberu-ecommerce/ecommerce-old
app/Notifications/SubscribeSuccessfully.php
https://github.com/liberu-ecommerce/ecommerce-old/blob/master/app/Notifications/SubscribeSuccessfully.php
MIT