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 setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; }
Required. The BigQueryLink to delete. Example format: properties/1234/bigQueryLinks/5678 Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> @param string $var @return $this
setName
php
googleapis/google-cloud-php
AnalyticsAdmin/src/V1alpha/DeleteBigQueryLinkRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/AnalyticsAdmin/src/V1alpha/DeleteBigQueryLinkRequest.php
Apache-2.0
public function getName() { return $this->name; }
Required. Name of the migration job resource to delete. Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> @return string
getName
php
googleapis/google-cloud-php
Dms/src/V1/DeleteMigrationJobRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Dms/src/V1/DeleteMigrationJobRequest.php
Apache-2.0
public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; }
Required. Name of the migration job resource to delete. Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> @param string $var @return $this
setName
php
googleapis/google-cloud-php
Dms/src/V1/DeleteMigrationJobRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Dms/src/V1/DeleteMigrationJobRequest.php
Apache-2.0
public function getRequestId() { return $this->request_id; }
A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters. Generated from protobuf field <code>string request_id = 2;</code> @return string
getRequestId
php
googleapis/google-cloud-php
Dms/src/V1/DeleteMigrationJobRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Dms/src/V1/DeleteMigrationJobRequest.php
Apache-2.0
public function setRequestId($var) { GPBUtil::checkString($var, True); $this->request_id = $var; return $this; }
A unique ID used to identify the request. If the server receives two requests with the same ID, then the second request is ignored. It is recommended to always set this value to a UUID. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters. Generated from protobuf field <code>string request_id = 2;</code> @param string $var @return $this
setRequestId
php
googleapis/google-cloud-php
Dms/src/V1/DeleteMigrationJobRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Dms/src/V1/DeleteMigrationJobRequest.php
Apache-2.0
public function getForce() { return $this->force; }
The destination CloudSQL connection profile is always deleted with the migration job. In case of force delete, the destination CloudSQL replica database is also deleted. Generated from protobuf field <code>bool force = 3;</code> @return bool
getForce
php
googleapis/google-cloud-php
Dms/src/V1/DeleteMigrationJobRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Dms/src/V1/DeleteMigrationJobRequest.php
Apache-2.0
public function setForce($var) { GPBUtil::checkBool($var); $this->force = $var; return $this; }
The destination CloudSQL connection profile is always deleted with the migration job. In case of force delete, the destination CloudSQL replica database is also deleted. Generated from protobuf field <code>bool force = 3;</code> @param bool $var @return $this
setForce
php
googleapis/google-cloud-php
Dms/src/V1/DeleteMigrationJobRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Dms/src/V1/DeleteMigrationJobRequest.php
Apache-2.0
public function getVersion() { return $this->version; }
API version of the resource. Example: If the resource is an instance provided by Compute Engine v1 API as defined in `https://cloud.google.com/compute/docs/reference/rest/v1/instances`, version will be "v1". Generated from protobuf field <code>string version = 1;</code> @return string
getVersion
php
googleapis/google-cloud-php
Asset/src/V1/VersionedResource.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/VersionedResource.php
Apache-2.0
public function setVersion($var) { GPBUtil::checkString($var, True); $this->version = $var; return $this; }
API version of the resource. Example: If the resource is an instance provided by Compute Engine v1 API as defined in `https://cloud.google.com/compute/docs/reference/rest/v1/instances`, version will be "v1". Generated from protobuf field <code>string version = 1;</code> @param string $var @return $this
setVersion
php
googleapis/google-cloud-php
Asset/src/V1/VersionedResource.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/VersionedResource.php
Apache-2.0
public function getResource() { return $this->resource; }
JSON representation of the resource as defined by the corresponding service providing this resource. Example: If the resource is an instance provided by Compute Engine, this field will contain the JSON representation of the instance as defined by Compute Engine: `https://cloud.google.com/compute/docs/reference/rest/v1/instances`. You can find the resource definition for each supported resource type in this table: `https://cloud.google.com/asset-inventory/docs/supported-asset-types` Generated from protobuf field <code>.google.protobuf.Struct resource = 2;</code> @return \Google\Protobuf\Struct|null
getResource
php
googleapis/google-cloud-php
Asset/src/V1/VersionedResource.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/VersionedResource.php
Apache-2.0
public function setResource($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); $this->resource = $var; return $this; }
JSON representation of the resource as defined by the corresponding service providing this resource. Example: If the resource is an instance provided by Compute Engine, this field will contain the JSON representation of the instance as defined by Compute Engine: `https://cloud.google.com/compute/docs/reference/rest/v1/instances`. You can find the resource definition for each supported resource type in this table: `https://cloud.google.com/asset-inventory/docs/supported-asset-types` Generated from protobuf field <code>.google.protobuf.Struct resource = 2;</code> @param \Google\Protobuf\Struct $var @return $this
setResource
php
googleapis/google-cloud-php
Asset/src/V1/VersionedResource.php
https://github.com/googleapis/google-cloud-php/blob/master/Asset/src/V1/VersionedResource.php
Apache-2.0
public function getKeyRings() { return $this->key_rings; }
The list of [KeyRings][google.cloud.kms.v1.KeyRing]. Generated from protobuf field <code>repeated .google.cloud.kms.v1.KeyRing key_rings = 1;</code> @return \Google\Protobuf\Internal\RepeatedField
getKeyRings
php
googleapis/google-cloud-php
Kms/src/V1/ListKeyRingsResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Kms/src/V1/ListKeyRingsResponse.php
Apache-2.0
public function setKeyRings($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Kms\V1\KeyRing::class); $this->key_rings = $arr; return $this; }
The list of [KeyRings][google.cloud.kms.v1.KeyRing]. Generated from protobuf field <code>repeated .google.cloud.kms.v1.KeyRing key_rings = 1;</code> @param array<\Google\Cloud\Kms\V1\KeyRing>|\Google\Protobuf\Internal\RepeatedField $var @return $this
setKeyRings
php
googleapis/google-cloud-php
Kms/src/V1/ListKeyRingsResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Kms/src/V1/ListKeyRingsResponse.php
Apache-2.0
public function getNextPageToken() { return $this->next_page_token; }
A token to retrieve next page of results. Pass this value in [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results. Generated from protobuf field <code>string next_page_token = 2;</code> @return string
getNextPageToken
php
googleapis/google-cloud-php
Kms/src/V1/ListKeyRingsResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Kms/src/V1/ListKeyRingsResponse.php
Apache-2.0
public function setNextPageToken($var) { GPBUtil::checkString($var, True); $this->next_page_token = $var; return $this; }
A token to retrieve next page of results. Pass this value in [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results. Generated from protobuf field <code>string next_page_token = 2;</code> @param string $var @return $this
setNextPageToken
php
googleapis/google-cloud-php
Kms/src/V1/ListKeyRingsResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Kms/src/V1/ListKeyRingsResponse.php
Apache-2.0
public function getTotalSize() { return $this->total_size; }
The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query. Generated from protobuf field <code>int32 total_size = 3;</code> @return int
getTotalSize
php
googleapis/google-cloud-php
Kms/src/V1/ListKeyRingsResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Kms/src/V1/ListKeyRingsResponse.php
Apache-2.0
public function setTotalSize($var) { GPBUtil::checkInt32($var); $this->total_size = $var; return $this; }
The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query. Generated from protobuf field <code>int32 total_size = 3;</code> @param int $var @return $this
setTotalSize
php
googleapis/google-cloud-php
Kms/src/V1/ListKeyRingsResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/Kms/src/V1/ListKeyRingsResponse.php
Apache-2.0
public function getUuid() { return $this->uuid; }
Machine unique identifier. Generated from protobuf field <code>string uuid = 1;</code> @return string
getUuid
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setUuid($var) { GPBUtil::checkString($var, True); $this->uuid = $var; return $this; }
Machine unique identifier. Generated from protobuf field <code>string uuid = 1;</code> @param string $var @return $this
setUuid
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getMachineName() { return $this->machine_name; }
Machine name. Generated from protobuf field <code>string machine_name = 2;</code> @return string
getMachineName
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setMachineName($var) { GPBUtil::checkString($var, True); $this->machine_name = $var; return $this; }
Machine name. Generated from protobuf field <code>string machine_name = 2;</code> @param string $var @return $this
setMachineName
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getCreateTime() { return $this->create_time; }
Machine creation time. Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code> @return \Google\Protobuf\Timestamp|null
getCreateTime
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setCreateTime($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); $this->create_time = $var; return $this; }
Machine creation time. Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code> @param \Google\Protobuf\Timestamp $var @return $this
setCreateTime
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getCoreCount() { return $this->core_count; }
Number of CPU cores in the machine. Must be non-negative. Generated from protobuf field <code>int32 core_count = 4;</code> @return int
getCoreCount
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setCoreCount($var) { GPBUtil::checkInt32($var); $this->core_count = $var; return $this; }
Number of CPU cores in the machine. Must be non-negative. Generated from protobuf field <code>int32 core_count = 4;</code> @param int $var @return $this
setCoreCount
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getMemoryMb() { return $this->memory_mb; }
The amount of memory in the machine. Must be non-negative. Generated from protobuf field <code>int32 memory_mb = 5;</code> @return int
getMemoryMb
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setMemoryMb($var) { GPBUtil::checkInt32($var); $this->memory_mb = $var; return $this; }
The amount of memory in the machine. Must be non-negative. Generated from protobuf field <code>int32 memory_mb = 5;</code> @param int $var @return $this
setMemoryMb
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getPowerState() { return $this->power_state; }
Power state of the machine. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineDetails.PowerState power_state = 6;</code> @return int
getPowerState
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setPowerState($var) { GPBUtil::checkEnum($var, \Google\Cloud\MigrationCenter\V1\MachineDetails\PowerState::class); $this->power_state = $var; return $this; }
Power state of the machine. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineDetails.PowerState power_state = 6;</code> @param int $var @return $this
setPowerState
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getArchitecture() { return $this->architecture; }
Architecture details (vendor, CPU architecture). Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineArchitectureDetails architecture = 7;</code> @return \Google\Cloud\MigrationCenter\V1\MachineArchitectureDetails|null
getArchitecture
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setArchitecture($var) { GPBUtil::checkMessage($var, \Google\Cloud\MigrationCenter\V1\MachineArchitectureDetails::class); $this->architecture = $var; return $this; }
Architecture details (vendor, CPU architecture). Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineArchitectureDetails architecture = 7;</code> @param \Google\Cloud\MigrationCenter\V1\MachineArchitectureDetails $var @return $this
setArchitecture
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getGuestOs() { return $this->guest_os; }
Guest OS information. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.GuestOsDetails guest_os = 8;</code> @return \Google\Cloud\MigrationCenter\V1\GuestOsDetails|null
getGuestOs
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setGuestOs($var) { GPBUtil::checkMessage($var, \Google\Cloud\MigrationCenter\V1\GuestOsDetails::class); $this->guest_os = $var; return $this; }
Guest OS information. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.GuestOsDetails guest_os = 8;</code> @param \Google\Cloud\MigrationCenter\V1\GuestOsDetails $var @return $this
setGuestOs
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getNetwork() { return $this->network; }
Network details. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineNetworkDetails network = 9;</code> @return \Google\Cloud\MigrationCenter\V1\MachineNetworkDetails|null
getNetwork
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setNetwork($var) { GPBUtil::checkMessage($var, \Google\Cloud\MigrationCenter\V1\MachineNetworkDetails::class); $this->network = $var; return $this; }
Network details. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineNetworkDetails network = 9;</code> @param \Google\Cloud\MigrationCenter\V1\MachineNetworkDetails $var @return $this
setNetwork
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getDisks() { return $this->disks; }
Disk details. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineDiskDetails disks = 10;</code> @return \Google\Cloud\MigrationCenter\V1\MachineDiskDetails|null
getDisks
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setDisks($var) { GPBUtil::checkMessage($var, \Google\Cloud\MigrationCenter\V1\MachineDiskDetails::class); $this->disks = $var; return $this; }
Disk details. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.MachineDiskDetails disks = 10;</code> @param \Google\Cloud\MigrationCenter\V1\MachineDiskDetails $var @return $this
setDisks
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getPlatform() { return $this->platform; }
Platform specific information. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.PlatformDetails platform = 11;</code> @return \Google\Cloud\MigrationCenter\V1\PlatformDetails|null
getPlatform
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function setPlatform($var) { GPBUtil::checkMessage($var, \Google\Cloud\MigrationCenter\V1\PlatformDetails::class); $this->platform = $var; return $this; }
Platform specific information. Generated from protobuf field <code>.google.cloud.migrationcenter.v1.PlatformDetails platform = 11;</code> @param \Google\Cloud\MigrationCenter\V1\PlatformDetails $var @return $this
setPlatform
php
googleapis/google-cloud-php
MigrationCenter/src/V1/MachineDetails.php
https://github.com/googleapis/google-cloud-php/blob/master/MigrationCenter/src/V1/MachineDetails.php
Apache-2.0
public function getSession() { return $this->session; }
Required. The session in which the transaction to roll back is running. Generated from protobuf field <code>string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> @return string
getSession
php
googleapis/google-cloud-php
Spanner/src/V1/RollbackRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/RollbackRequest.php
Apache-2.0
public function setSession($var) { GPBUtil::checkString($var, True); $this->session = $var; return $this; }
Required. The session in which the transaction to roll back is running. Generated from protobuf field <code>string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> @param string $var @return $this
setSession
php
googleapis/google-cloud-php
Spanner/src/V1/RollbackRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/RollbackRequest.php
Apache-2.0
public function getTransactionId() { return $this->transaction_id; }
Required. The transaction to roll back. Generated from protobuf field <code>bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> @return string
getTransactionId
php
googleapis/google-cloud-php
Spanner/src/V1/RollbackRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/RollbackRequest.php
Apache-2.0
public function setTransactionId($var) { GPBUtil::checkString($var, False); $this->transaction_id = $var; return $this; }
Required. The transaction to roll back. Generated from protobuf field <code>bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED];</code> @param string $var @return $this
setTransactionId
php
googleapis/google-cloud-php
Spanner/src/V1/RollbackRequest.php
https://github.com/googleapis/google-cloud-php/blob/master/Spanner/src/V1/RollbackRequest.php
Apache-2.0
public function __debugInfo() { return [ 'name' => $this->name, 'projectId' => $this->projectId, 'info' => $this->info, 'requestHandler' => $this->requestHandler ]; }
Present a nicer debug result to people using php 5.6 or greater. @return array @codeCoverageIgnore @access private
__debugInfo
php
googleapis/google-cloud-php
PubSub/src/Topic.php
https://github.com/googleapis/google-cloud-php/blob/master/PubSub/src/Topic.php
Apache-2.0
private function formatMessage($message) { $message = $message instanceof Message ? $message->toArray() : $message; if (isset($message['data']) && $this->encode) { $message['data'] = base64_encode($message['data']); } if (!array_key_exists('data', $message) && !array_key_exists('attributes', $message)) { throw new InvalidArgumentException( 'At least one of $data or $attributes must be specified on each message, but neither was given.' ); } return $this->serializer->decodeMessage( new PubsubMessage(), $message ); }
Ensure that the message is in a correct format, base64_encode the data, and error if the input is too wrong to proceed. @param Message|array $message @return PubsubMessage The message protobuf object @throws \InvalidArgumentException
formatMessage
php
googleapis/google-cloud-php
PubSub/src/Topic.php
https://github.com/googleapis/google-cloud-php/blob/master/PubSub/src/Topic.php
Apache-2.0
private function subscriptionFactory($name, array $info = []) { return new Subscription( $this->requestHandler, $this->serializer, $this->projectId, $name, $this->name, $this->encode, $info, $this->clientConfig ); }
Create a new subscription instance with the given name and optional subscription data. @codingStandardsIgnoreStart @param string $name @param array $info [optional] A representation of a [Subscription](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions#Subscription) @return Subscription @codingStandardsIgnoreEnd
subscriptionFactory
php
googleapis/google-cloud-php
PubSub/src/Topic.php
https://github.com/googleapis/google-cloud-php/blob/master/PubSub/src/Topic.php
Apache-2.0
public function getOutputs() { return $this->outputs; }
The prediction output. Generated from protobuf field <code>repeated .google.cloud.aiplatform.v1.Tensor outputs = 1;</code> @return \Google\Protobuf\Internal\RepeatedField
getOutputs
php
googleapis/google-cloud-php
AiPlatform/src/V1/StreamDirectPredictResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/StreamDirectPredictResponse.php
Apache-2.0
public function setOutputs($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AIPlatform\V1\Tensor::class); $this->outputs = $arr; return $this; }
The prediction output. Generated from protobuf field <code>repeated .google.cloud.aiplatform.v1.Tensor outputs = 1;</code> @param array<\Google\Cloud\AIPlatform\V1\Tensor>|\Google\Protobuf\Internal\RepeatedField $var @return $this
setOutputs
php
googleapis/google-cloud-php
AiPlatform/src/V1/StreamDirectPredictResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/StreamDirectPredictResponse.php
Apache-2.0
public function getParameters() { return $this->parameters; }
The parameters that govern the prediction. Generated from protobuf field <code>.google.cloud.aiplatform.v1.Tensor parameters = 2;</code> @return \Google\Cloud\AIPlatform\V1\Tensor|null
getParameters
php
googleapis/google-cloud-php
AiPlatform/src/V1/StreamDirectPredictResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/StreamDirectPredictResponse.php
Apache-2.0
public function setParameters($var) { GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\Tensor::class); $this->parameters = $var; return $this; }
The parameters that govern the prediction. Generated from protobuf field <code>.google.cloud.aiplatform.v1.Tensor parameters = 2;</code> @param \Google\Cloud\AIPlatform\V1\Tensor $var @return $this
setParameters
php
googleapis/google-cloud-php
AiPlatform/src/V1/StreamDirectPredictResponse.php
https://github.com/googleapis/google-cloud-php/blob/master/AiPlatform/src/V1/StreamDirectPredictResponse.php
Apache-2.0
public function __construct(protected array $kwargs = []) { $this->max_length = $kwargs['max_length'] ?? 20; $this->max_new_tokens = $kwargs['max_new_tokens'] ?? null; $this->min_length = $kwargs['min_length'] ?? 0; $this->min_new_tokens = $kwargs['min_new_tokens'] ?? null; $this->early_stopping = $kwargs['early_stopping'] ?? false; $this->max_time = $kwargs['max_time'] ?? null; $this->do_sample = $kwargs['do_sample'] ?? false; $this->num_beams = $kwargs['num_beams'] ?? 1; $this->num_beam_groups = $kwargs['num_beam_groups'] ?? 1; $this->penalty_alpha = $kwargs['penalty_alpha'] ?? null; $this->use_cache = $kwargs['use_cache'] ?? true; $this->temperature = $kwargs['temperature'] ?? 1.0; $this->top_k = $kwargs['top_k'] ?? 50; $this->top_p = $kwargs['top_p'] ?? 1.0; $this->typical_p = $kwargs['typical_p'] ?? 1.0; $this->epsilon_cutoff = $kwargs['epsilon_cutoff'] ?? 0.0; $this->eta_cutoff = $kwargs['eta_cutoff'] ?? 0.0; $this->diversity_penalty = $kwargs['diversity_penalty'] ?? 0.0; $this->repetition_penalty = $kwargs['repetition_penalty'] ?? 1.0; $this->encoder_repetition_penalty = $kwargs['encoder_repetition_penalty'] ?? 1.0; $this->length_penalty = $kwargs['length_penalty'] ?? 1.0; $this->no_repeat_ngram_size = $kwargs['no_repeat_ngram_size'] ?? 0; $this->bad_words_ids = $kwargs['bad_words_ids'] ?? null; $this->force_words_ids = $kwargs['force_words_ids'] ?? null; $this->renormalize_logits = $kwargs['renormalize_logits'] ?? false; $this->constraints = $kwargs['constraints'] ?? null; $this->forced_bos_token_id = $kwargs['forced_bos_token_id'] ?? null; $this->forced_eos_token_id = $kwargs['forced_eos_token_id'] ?? null; $this->remove_invalid_values = $kwargs['remove_invalid_values'] ?? false; $this->exponential_decay_length_penalty = $kwargs['exponential_decay_length_penalty'] ?? null; $this->suppress_tokens = $kwargs['suppress_tokens'] ?? null; $this->begin_suppress_tokens = $kwargs['begin_suppress_tokens'] ?? null; $this->forced_decoder_ids = $kwargs['forced_decoder_ids'] ?? null; $this->num_return_sequences = $kwargs['num_return_sequences'] ?? 1; $this->output_attentions = $kwargs['output_attentions'] ?? false; $this->output_hidden_states = $kwargs['output_hidden_states'] ?? false; $this->output_scores = $kwargs['output_scores'] ?? false; $this->return_dict_in_generate = $kwargs['return_dict_in_generate'] ?? false; $this->pad_token_id = $kwargs['pad_token_id'] ?? null; $this->bos_token_id = $kwargs['bos_token_id'] ?? null; $this->eos_token_id = $kwargs['eos_token_id'] ?? null; $this->encoder_no_repeat_ngram_size = $kwargs['encoder_no_repeat_ngram_size'] ?? 0; $this->decoder_start_token_id = $kwargs['decoder_start_token_id'] ?? null; $this->generation_kwargs = $kwargs['generation_kwargs'] ?? []; $this->decoder_input_ids = $kwargs['decoder_input_ids'] ?? null; }
Create a new GenerationConfig object. @param array $kwargs The configuration parameters.
__construct
php
CodeWithKyrian/transformers-php
src/Utils/GenerationConfig.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/Utils/GenerationConfig.php
Apache-2.0
public function __construct(array $config) { parent::__construct($config); $this->processors = array_map( fn ($processorConfig) => PostProcessor::fromConfig($processorConfig), $config['processors'] ); }
Creates a new instance of PostProcessorSequence. @param array $config The configuration array. - 'processors' (array): The list of post-processors to apply.
__construct
php
CodeWithKyrian/transformers-php
src/PostProcessors/PostProcessorSequence.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/PostProcessors/PostProcessorSequence.php
Apache-2.0
public function toArray() { if (count($this->shape) == 0) { return $this->buffer[$this->offset]; } $idx = $this->offset; return $this->unflattenArray($this->buffer, $idx, $this->shape); }
Convert the tensor into an array.
toArray
php
CodeWithKyrian/transformers-php
src/Tensor/Tensor.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/Tensor/Tensor.php
Apache-2.0
public function __construct( public string $sentence, public ?int $bosTokenId, public ?int $eosTokenId) { $this->len = mb_strlen($sentence); $this->beginNodes = array_fill(0, $this->len + 1, []); $this->endNodes = array_fill(0, $this->len + 1, []); $bos = new TokenLatticeNode($this->bosTokenId, 0, 0, 0, 0.0); $eos = new TokenLatticeNode($this->eosTokenId, 1, $this->len, 0, 0.0); $this->nodes[] = $bos; $this->nodes[] = $eos; $this->beginNodes[$this->len][] = $eos; $this->endNodes[0][] = $bos; }
Creates a new TokenLattice instance. @param string $sentence The input sentence to be tokenized. @param int $bosTokenId The beginning-of-sequence token ID. @param int $eosTokenId The end-of-sequence token ID.
__construct
php
CodeWithKyrian/transformers-php
src/DataStructures/TokenLattice.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/DataStructures/TokenLattice.php
Apache-2.0
public function __construct() { $this->root = CharTrieNode::default(256); }
Creates a new CharTrie instance.
__construct
php
CodeWithKyrian/transformers-php
src/DataStructures/CharTrie.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/DataStructures/CharTrie.php
Apache-2.0
public function __construct( public ?int $tokenId, public int $nodeId, public int $pos, public int $length, public float $score) { }
Represents a node in a token lattice for a given sentence. @param int $tokenId The ID of the token associated with this node. @param int $nodeId The ID of this node. @param int $pos The starting position of the token in the sentence. @param int $length The length of the token. @param float $score The score associated with the token.
__construct
php
CodeWithKyrian/transformers-php
src/DataStructures/TokenLatticeNode.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/DataStructures/TokenLatticeNode.php
Apache-2.0
public function __construct(GenerationConfig $generateConfig) { $this->eosTokenId = $generateConfig['eos_token_id']; $this->noTimestampsTokenId = $generateConfig['no_timestamps_token_id']; $this->timestampBegin = $this->noTimestampsTokenId + 1; $this->beginIndex = count($generateConfig['forced_decoder_ids'] ?? []) + 2; $forcedDecoderIds = $generateConfig['forced_decoder_ids'] ?? []; if (count($forcedDecoderIds) > 0 && end($forcedDecoderIds)[1] === $this->noTimestampsTokenId) { $this->beginIndex -= 1; } $this->maxInitialTimestampIndex = $generateConfig['max_initial_timestamp_index'] ?? null; }
Constructs a new WhisperTimeStampLogitsProcessor.
__construct
php
CodeWithKyrian/transformers-php
src/Generation/LogitsProcessors/WhisperTimeStampLogitsProcessor.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/Generation/LogitsProcessors/WhisperTimeStampLogitsProcessor.php
Apache-2.0
public function __construct(public readonly Tensor $logits, public readonly Tensor $predBoxes, public readonly Tensor $predMasks) { }
These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding). @param Tensor $logits Classification logits (including no-object) for all queries. @param Tensor $predBoxes Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height). @param Tensor $predMasks Segmentation masks for all queries.
__construct
php
CodeWithKyrian/transformers-php
src/Models/Output/DetrSegmentationOutput.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/Models/Output/DetrSegmentationOutput.php
Apache-2.0
public function __construct(public readonly Tensor $logits, public readonly Tensor $predBoxes) { }
These values are normalized in [0, 1], relative to the size of each individual image in the batch (disregarding possible padding). @param Tensor $logits Classification logits (including no-object) for all queries. @param Tensor $predBoxes Normalized boxes coordinates for all queries, represented as (center_x, center_y, width, height).
__construct
php
CodeWithKyrian/transformers-php
src/Models/Output/ObjectDetectionOutput.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/Models/Output/ObjectDetectionOutput.php
Apache-2.0
public function __construct( AutoConfig $config, InferenceSession $session, public InferenceSession $decoderMergedSession, public ModelArchitecture $modelArchitecture, public GenerationConfig $generationConfig ) { parent::__construct($config, $session, $this->modelArchitecture); // Extract configs $encoderConfig = $this->config['encoder']; $decoderConfig = $this->config['decoder']; $decoderConfig = AutoConfig::fromPretrained('', $decoderConfig); // Validate encoder $encoderModelType = $encoderConfig['model_type']; $encoderModel = AutoModel::ENCODER_ONLY_MODEL_MAPPING[$encoderModelType] ?? AutoModel::ENCODER_DECODER_MODEL_MAPPING[$encoderModelType]; if (!$encoderModel) { Transformers::getLogger()?->warning("Model type for encoder '{$encoderModelType}' not found, assuming encoder-only architecture. Please report this at https://github.com/CodeWithKyrian/transformers-php/issues/new/choose."); } // Validate decoder $decoderModel = AutoModelForCausalLM::MODEL_CLASS_MAPPING[$decoderConfig['model_type']]; if (!$decoderModel) { throw new \Exception("Unable to construct `VisionEncoderDecoder` due to unsupported decoder: '{$this->config['decoder']['model_type']}'"); } $decoder = new $decoderModel($decoderConfig, $this->decoderMergedSession, ModelArchitecture::DecoderOnly, $this->generationConfig); $this->addEncoderPkv = property_exists($decoder, 'numDecoderLayers'); if ($this->addEncoderPkv) { // Decoder is part of an encoder-decoder model $this->numDecoderLayers = $decoder->numDecoderLayers; $this->numDecoderHeads = $decoder->numDecoderHeads; $this->decoderDimKv = $decoder->decoderDimKv; $this->numEncoderLayers = $decoder->numEncoderLayers; $this->numEncoderHeads = $decoder->numEncoderHeads; $this->encoderDimKv = $decoder->encoderDimKv; } else { // Decoder is a decoder-only model $this->numLayers = $decoder->numLayers; $this->numHeads = $decoder->numHeads; $this->dimKv = $decoder->dimKv; } }
Creates a new instance of the `VisionEncoderDecoderModel` class. @param AutoConfig $config The configuration array specifying the hyperparameters and other model settings. @param mixed $session The ONNX session containing the encoder model. @param InferenceSession $decoderMergedSession The ONNX session containing the merged decoder model. @param ModelArchitecture $modelArchitecture @param GenerationConfig $generationConfig Configuration object for the generation process.
__construct
php
CodeWithKyrian/transformers-php
src/Models/Pretrained/VisionEncoderDecoderModel.php
https://github.com/CodeWithKyrian/transformers-php/blob/master/src/Models/Pretrained/VisionEncoderDecoderModel.php
Apache-2.0
private static function getFirstMetadataMatching(array $metadatas, $metadataClasses) { $metas = self::getMetadataMatching($metadatas, $metadataClasses); return array_shift($metas); }
Get the first metadata matching given class. @phpstan-template T of object @phpstan-param class-string<T>|class-string<T>[] $metadataClasses @phpstan-return T|null @return object|null
getFirstMetadataMatching
php
overblog/GraphQLBundle
src/Config/Parser/MetadataParser/MetadataParser.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Config/Parser/MetadataParser/MetadataParser.php
MIT
public function connectionFromPromisedArray($dataPromise, $args = []) { $this->checkPromise($dataPromise); return $dataPromise->then(fn ($data) => $this->connectionFromArray($data, $args)); }
A version of `connectionFromArray` that takes a promised array, and returns a promised connection. @param mixed $dataPromise a promise @param array|ArgumentInterface $args @return mixed a promise
connectionFromPromisedArray
php
overblog/GraphQLBundle
src/Relay/Connection/ConnectionBuilder.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Relay/Connection/ConnectionBuilder.php
MIT
public function connectionFromPromisedArraySlice($dataPromise, $args, array $meta) { $this->checkPromise($dataPromise); return $dataPromise->then(fn ($arraySlice) => $this->connectionFromArraySlice($arraySlice, $args, $meta)); }
A version of `connectionFromArraySlice` that takes a promised array slice, and returns a promised connection. @param mixed $dataPromise a promise @param array|ArgumentInterface $args @return mixed a promise
connectionFromPromisedArraySlice
php
overblog/GraphQLBundle
src/Relay/Connection/ConnectionBuilder.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Relay/Connection/ConnectionBuilder.php
MIT
public function getResolverArg(string $name) { if (in_array($name, self::KNOWN_VAR_NAMES)) { return $this->__resolverArgs->$name; } return null; }
Returns an argument of the resolver, where this validation is being executed. @return ResolveInfo|Argument|mixed|null
getResolverArg
php
overblog/GraphQLBundle
src/Validator/ValidationNode.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Validator/ValidationNode.php
MIT
public function __construct( ?ConstraintValidatorFactoryInterface $constraintValidatorFactory, ?ValidatorInterface $validator, ?TranslatorInterface $translator ) { $this->defaultValidator = $validator; $this->defaultTranslator = $translator; $this->constraintValidatorFactory = $constraintValidatorFactory; }
InputValidatorFactory constructor.
__construct
php
overblog/GraphQLBundle
src/Validator/InputValidatorFactory.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Validator/InputValidatorFactory.php
MIT
public static function unprefixExpression(string $expression) { $string = substr($expression, strlen(self::EXPRESSION_TRIGGER)) ?: ''; return '' !== $string ? $string : $expression; }
Removes the expression trigger prefix from a string. If no prefix found, returns the initial string. @param string $expression - String expression with a trigger prefix @return string
unprefixExpression
php
overblog/GraphQLBundle
src/ExpressionLanguage/ExpressionLanguage.php
https://github.com/overblog/GraphQLBundle/blob/master/src/ExpressionLanguage/ExpressionLanguage.php
MIT
private function getTypeClassInstance(string $type) { $classname = isset($this->classesMap[$type]) ? $this->classesMap[$type]['class'] : false; return $classname ? new $classname() : false; }
Get the PHP class for a given type. @return object|false
getTypeClassInstance
php
overblog/GraphQLBundle
src/Transformer/ArgumentsTransformer.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Transformer/ArgumentsTransformer.php
MIT
public function getInstanceAndValidate(string $argType, $data, ResolveInfo $info, string $argName) { $isRequired = '!' === $argType[strlen($argType) - 1]; $isMultiple = '[' === $argType[0]; $isStrictMultiple = false; if ($isMultiple) { $isStrictMultiple = '!' === $argType[strpos($argType, ']') - 1]; } $endIndex = ($isRequired ? 1 : 0) + ($isMultiple ? 1 : 0) + ($isStrictMultiple ? 1 : 0); $type = substr($argType, $isMultiple ? 1 : 0, $endIndex > 0 ? -$endIndex : strlen($argType)); $gqlType = $this->getType($type, $info); $result = $this->populateObject($gqlType, $data, $isMultiple, $info); // We only want to validate input object types and not the scalar or object types that are already validated by the GraphQL library. $shouldValidate = $gqlType instanceof InputObjectType; if (null !== $this->validator && $shouldValidate) { $errors = new ConstraintViolationList(); if (is_object($result)) { $errors = $this->validator->validate($result); } if (is_array($result) && $isMultiple) { foreach ($result as $element) { if (is_object($element)) { $errors->addAll( $this->validator->validate($element) ); } } } if (count($errors) > 0) { throw new InvalidArgumentError($argName, $errors); } } return $result; }
Given a GraphQL type and an array of data, populate corresponding object recursively using annotated classes. @param mixed $data @return mixed
getInstanceAndValidate
php
overblog/GraphQLBundle
src/Transformer/ArgumentsTransformer.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Transformer/ArgumentsTransformer.php
MIT
public function getArguments(array $mapping, $data, ResolveInfo $info) { $args = []; $exceptions = []; foreach ($mapping as $name => $type) { try { if (self::RESOLVE_INFO_TOKEN === $type) { $args[] = $info; continue; } $value = $this->getInstanceAndValidate($type, $data[$name], $info, $name); $args[] = $value; } catch (InvalidArgumentError $exception) { $exceptions[] = $exception; } } if (!empty($exceptions)) { throw new InvalidArgumentsError($exceptions); } return $args; }
Transform a list of arguments into their corresponding php class and validate them. @param mixed $data @return array
getArguments
php
overblog/GraphQLBundle
src/Transformer/ArgumentsTransformer.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Transformer/ArgumentsTransformer.php
MIT
private function buildType(string $typeDefinition) { $typeNode = Parser::parseType($typeDefinition); $isReference = false; $type = $this->wrapTypeRecursive($typeNode, $isReference); if ($isReference) { // References to other types should be wrapped in a closure // for performance reasons return ArrowFunction::new($type); } return $type; }
Converts a native GraphQL type string into the `webonyx/graphql-php` type literal. References to user-defined types are converted into TypeResolver method call and wrapped into a closure. Render examples: - "String" -> Type::string() - "String!" -> Type::nonNull(Type::string()) - "[String!] -> Type::listOf(Type::nonNull(Type::string())) - "[Post]" -> Type::listOf($services->getType('Post')) @return GeneratorInterface|string
buildType
php
overblog/GraphQLBundle
src/Generator/TypeBuilder.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Generator/TypeBuilder.php
MIT
private function buildScalarCallback($callback, string $fieldName) { if (!is_callable($callback)) { throw new GeneratorException("Value of '$fieldName' is not callable."); } $closure = new ArrowFunction(); if (!is_string($callback)) { [$class, $method] = $callback; } else { [$class, $method] = explode('::', $callback); } $className = Utils::resolveQualifier($class); if ($className === $this->config['class_name']) { // Create an alias if name of serializer is same as type name $className = 'Base'.$className; $this->file->addUse($class, $className); } else { $this->file->addUse($class); } $closure->setExpression(Literal::new("$className::$method(...\\func_get_args())")); return $closure; }
Builds an arrow function that calls a static method. Render example: fn() => MyClassName::myMethodName(...\func_get_args()) @param callable $callback - a callable string or a callable array @return ArrowFunction @throws GeneratorException
buildScalarCallback
php
overblog/GraphQLBundle
src/Generator/TypeBuilder.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Generator/TypeBuilder.php
MIT
private function buildPublic($public) { if (EL::isStringWithTrigger($public)) { $expression = $this->expressionConverter->convert($public); $arrow = ArrowFunction::new(Literal::new($expression)); if (EL::expressionContainsVar('fieldName', $public)) { $arrow->addArgument('fieldName'); } if (EL::expressionContainsVar('typeName', $public)) { $arrow->addArgument('fieldName'); $arrow->addArgument('typeName', '', new Literal('self::NAME')); } return $arrow; } return $public; }
Builds an arrow function from a string with an expression prefix, otherwise just returns the provided value back untouched. Render example (if expression): fn($fieldName, $typeName = self::NAME) => ($fieldName == "name") @param mixed $public @return ArrowFunction|mixed
buildPublic
php
overblog/GraphQLBundle
src/Generator/TypeBuilder.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Generator/TypeBuilder.php
MIT
private function buildAccess($access) { if (EL::isStringWithTrigger($access)) { $expression = $this->expressionConverter->convert($access); return ArrowFunction::new() ->addArguments('value', 'args', 'context', 'info', 'object') ->setExpression(Literal::new($expression)); } return $access; }
Builds an arrow function from a string with an expression prefix, otherwise just returns the provided value back untouched. Render example (if expression): fn($value, $args, $context, $info, $object) => $services->get('private_service')->hasAccess() @param mixed $access @return ArrowFunction|mixed
buildAccess
php
overblog/GraphQLBundle
src/Generator/TypeBuilder.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Generator/TypeBuilder.php
MIT
private function buildResolveType($resolveType) { if (EL::isStringWithTrigger($resolveType)) { $expression = $this->expressionConverter->convert($resolveType); return ArrowFunction::new() ->addArguments('value', 'context', 'info') ->setExpression(Literal::new($expression)); } return $resolveType; }
Builds an arrow function from a string with an expression prefix, otherwise just returns the provided value back untouched. Render example: fn($value, $context, $info) => $services->getType($value) @param mixed $resolveType @return mixed|ArrowFunction
buildResolveType
php
overblog/GraphQLBundle
src/Generator/TypeBuilder.php
https://github.com/overblog/GraphQLBundle/blob/master/src/Generator/TypeBuilder.php
MIT
public function register() { $this->app->afterResolving(MailManager::class, function (MailManager $mail_manager) { $mail_manager->extend("sendgrid", function ($config) { if (! isset($config['api_key'])) { $config = $this->app['config']->get('services.sendgrid', []); } $client = new HttpClient(Arr::get($config, 'guzzle', [])); $endpoint = $config['endpoint'] ?? null; return new SendgridTransport($client, $config['api_key'], $endpoint); }); }); }
Register the Sendgrid Transport instance. @return void
register
php
s-ichikawa/laravel-sendgrid-driver
src/SendgridTransportServiceProvider.php
https://github.com/s-ichikawa/laravel-sendgrid-driver/blob/master/src/SendgridTransportServiceProvider.php
MIT
public function getCascadeDeletes() { return property_exists($this, 'cascadeDeletes') ? $this->cascadeDeletes : []; }
Get the value of the cascadeDeletes attribute, if it exists. @return mixed
getCascadeDeletes
php
shiftonelabs/laravel-cascade-deletes
src/CascadesDeletes.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/src/CascadesDeletes.php
MIT
public function setCascadeDeletes($cascadeDeletes) { $this->cascadeDeletes = $cascadeDeletes; }
Set the cascadeDeletes attribute. @param mixed $cascadeDeletes @return void
setCascadeDeletes
php
shiftonelabs/laravel-cascade-deletes
src/CascadesDeletes.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/src/CascadesDeletes.php
MIT
public function getCascadeDeletesRelationNames() { $deletes = $this->getCascadeDeletes(); return array_filter(is_array($deletes) ? $deletes : [$deletes]); }
Get an array of cascading relation names. @return array
getCascadeDeletesRelationNames
php
shiftonelabs/laravel-cascade-deletes
src/CascadesDeletes.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/src/CascadesDeletes.php
MIT
public function getCascadeDeletesRelations() { $names = $this->getCascadeDeletesRelationNames(); return array_combine($names, array_map(function ($name) { $relation = method_exists($this, $name) ? $this->$name() : null; return $relation instanceof Relation ? $relation : null; }, $names)); }
Get an array of the cascading relation names mapped to their relation types. @return array
getCascadeDeletesRelations
php
shiftonelabs/laravel-cascade-deletes
src/CascadesDeletes.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/src/CascadesDeletes.php
MIT
public function getInvalidCascadeDeletesRelations(?array $relations = null) { // This will get the array keys for any item in the array where the // value is null. If the value is null, that means that the name // of the relation provided does not return a Relation object. return array_keys($relations ?: $this->getCascadeDeletesRelations(), null); }
Get an array of the invalid cascading relation names. @param array|null $relations @return array
getInvalidCascadeDeletesRelations
php
shiftonelabs/laravel-cascade-deletes
src/CascadesDeletes.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/src/CascadesDeletes.php
MIT
public function getCascadeDeletesRelationQuery($relation) { $query = $this->$relation(); // If this is a force delete and the related model is using soft deletes, // we need to use the withTrashed() scope on the relationship query to // ensure all related records, plus soft deleted, are force deleted. if ($this->isCascadeDeletesForceDeleting() && !is_null($query->getMacro('withTrashed'))) { $query = $query->withTrashed(); } return $query; }
Get the relationship query to use for the specified relation. @param string $relation @return \Illuminate\Database\Eloquent\Relations\Relation
getCascadeDeletesRelationQuery
php
shiftonelabs/laravel-cascade-deletes
src/CascadesDeletes.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/src/CascadesDeletes.php
MIT
public function isCascadeDeletesForceDeleting() { return property_exists($this, 'forceDeleting') && $this->forceDeleting; }
Check if this cascading delete is a force delete. @return boolean
isCascadeDeletesForceDeleting
php
shiftonelabs/laravel-cascade-deletes
src/CascadesDeletes.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/src/CascadesDeletes.php
MIT
public function afterTearDown() { $this->schema()->dropIfExists('users'); $this->schema()->dropIfExists('friends'); $this->schema()->dropIfExists('posts'); $this->schema()->dropIfExists('comments'); $this->schema()->dropIfExists('photos'); $this->schema()->dropIfExists('invalid_kids'); $this->schema()->dropIfExists('profiles'); }
Tear down run after each test. @after
afterTearDown
php
shiftonelabs/laravel-cascade-deletes
tests/IntegrationTest.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/tests/IntegrationTest.php
MIT
public function setUpDatabaseConnection() { $db = new DB(); $db->addConnection([ 'driver' => 'sqlite', 'database' => ':memory:', ]); $db->setEventDispatcher(new Dispatcher(new Container())); $db->bootEloquent(); $db->setAsGlobal(); // This is required for testing Model events. If this is not done, the // events will only fire on the first test. Model::clearBootedModels(); }
Setup the database connection. @return void
setUpDatabaseConnection
php
shiftonelabs/laravel-cascade-deletes
tests/TestCase.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/tests/TestCase.php
MIT
protected function schema($connection = 'default') { return $this->connection($connection)->getSchemaBuilder(); }
Get a schema builder instance. @return \Illuminate\Database\Schema\Builder
schema
php
shiftonelabs/laravel-cascade-deletes
tests/TestCase.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/tests/TestCase.php
MIT
protected function connection($connection = 'default') { return Model::getConnectionResolver()->connection($connection); }
Get a database connection instance. @return \Illuminate\Database\Connection
connection
php
shiftonelabs/laravel-cascade-deletes
tests/TestCase.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/tests/TestCase.php
MIT
protected function setRestrictedValue($object, $property, $value) { $reflectionProperty = new ReflectionProperty($object, $property); $reflectionProperty->setAccessible(true); if ($reflectionProperty->isStatic()) { $reflectionProperty->setValue($value); } else { $reflectionProperty->setValue($object, $value); } }
Use reflection to set the value of a restricted (private/protected) property on an object. @param object $object @param string $property @param mixed $value @return void
setRestrictedValue
php
shiftonelabs/laravel-cascade-deletes
tests/TestCase.php
https://github.com/shiftonelabs/laravel-cascade-deletes/blob/master/tests/TestCase.php
MIT
private function __construct() {}
The constructor. Please use `::fromHtml` or `::fromDomDocument` instead.
__construct
php
MyIntervals/emogrifier
src/HtmlProcessor/AbstractHtmlProcessor.php
https://github.com/MyIntervals/emogrifier/blob/master/src/HtmlProcessor/AbstractHtmlProcessor.php
MIT
public function __construct(array $array) { $this->invertedArray = \array_flip($array); }
Constructs the object with the array that will be reused for many intersection computations. @param array<array-key, array-key> $array
__construct
php
MyIntervals/emogrifier
src/Utilities/ArrayIntersector.php
https://github.com/MyIntervals/emogrifier/blob/master/src/Utilities/ArrayIntersector.php
MIT
public function __construct(string $css, bool $debug) { // CSS Parser currently throws exception with nested at-rules (like `@media`) in strict parsing mode $parserSettings = ParserSettings::create()->withLenientParsing(!$debug || $this->hasNestedAtRule($css)); // CSS Parser currently throws exception with non-empty whitespace-only CSS in strict parsing mode, so `trim()` // @see https://github.com/sabberworm/PHP-CSS-Parser/issues/349 $this->sabberwormCssDocument = (new CssParser(\trim($css), $parserSettings))->parse(); }
@param string $css @param bool $debug If this is `true`, an exception will be thrown if invalid CSS is encountered. Otherwise the parser will try to do the best it can.
__construct
php
MyIntervals/emogrifier
src/Css/CssDocument.php
https://github.com/MyIntervals/emogrifier/blob/master/src/Css/CssDocument.php
MIT
protected function __construct() { if (\is_callable([parent::class, '__construct'])) { parent::__construct(); } }
Invokes the parent class's constructor if there is one. Since PHPUnit 8.x, `Constraint` (the parent class) does not have a defined constructor. But... In PHP, a class that may be extended should have a defined constructor, even if it does nothing. That way, a child class that needs a constructor can explicitly call its parent's constructor. If it could not, and then a newer version of the parent class needed a constructor, the newly added constructor would not be invoked implicitly during instantiation of the child class. In that eventuality, the child class would also need updating, so there would be a compatibility issue, and potential for uncaught bugs if the child class's constructor was not updated.
__construct
php
MyIntervals/emogrifier
tests/Support/Constraint/CssConstraint.php
https://github.com/MyIntervals/emogrifier/blob/master/tests/Support/Constraint/CssConstraint.php
MIT
public function setFromString($coordinates) { if (!is_string($coordinates)) { throw new InvalidArgumentException('The given coordinates should be a string !'); } try { $inDecimalDegree = $this->toDecimalDegrees($coordinates); $this->setLatitude($inDecimalDegree[0]); $this->setLongitude($inDecimalDegree[1]); } catch (InvalidArgumentException $e) { throw $e; } }
Creates a valid and acceptable geographic coordinates. @param string $coordinates @throws InvalidArgumentException
setFromString
php
thephpleague/geotools
src/Coordinate/Coordinate.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Coordinate.php
MIT
private function toDecimalDegrees($coordinates) { // Degrees, Decimal Minutes format (DD MM.mmm) // N 40°26.7717 E 79°56.93172 // N40°26.7717E79°56.93172 // N 25°59.86′, W 21°09.81′ if (preg_match('/([ns]{1})\s?([0-9]{1,2})\D+([0-9]{1,2}\.?\d*)\D*[, ]?([we]{1})\s? ?([0-9]{1,3})\D+([0-9]{1,2}\.?\d*)\D*$/i', $coordinates, $match)) { $latitude = $match[2] + $match[3] / 60; $longitude = $match[5] + $match[6] / 60; return [ 'N' === strtoupper($match[1]) ? $latitude : -$latitude, 'E' === strtoupper($match[4]) ? $longitude : -$longitude, ]; } // 40.446195, -79.948862 if (preg_match('/(\-?[0-9]{1,2}\.?\d*)[, ] ?(\-?[0-9]{1,3}\.?\d*)$/', $coordinates, $match)) { return array($match[1], $match[2]); } // 40° 26.7717, -79° 56.93172 if (preg_match('/(\-?[0-9]{1,2})\D+([0-9]{1,2}\.?\d*)[, ] ?(\-?[0-9]{1,3})\D+([0-9]{1,2}\.?\d*)$/i', $coordinates, $match)) { return array( $match[1] < 0 ? $match[1] - $match[2] / 60 : $match[1] + $match[2] / 60, $match[3] < 0 ? $match[3] - $match[4] / 60 : $match[3] + $match[4] / 60 ); } // 40.446195N 79.948862W if (preg_match('/([0-9]{1,2}\.?\d*)\D*([ns]{1})[, ] ?([0-9]{1,3}\.?\d*)\D*([we]{1})$/i', $coordinates, $match)) { return array( 'N' === strtoupper($match[2]) ? $match[1] : -$match[1], 'E' === strtoupper($match[4]) ? $match[3] : -$match[3] ); } // 40°26.7717S 79°56.93172E // 25°59.86′N,21°09.81′W if (preg_match('/([0-9]{1,2})\D+([0-9]{1,2}\.?\d*)\D*([ns]{1})[, ] ?([0-9]{1,3})\D+([0-9]{1,2}\.?\d*)\D*([we]{1})$/i', $coordinates, $match)) { $latitude = $match[1] + $match[2] / 60; $longitude = $match[4] + $match[5] / 60; return array( 'N' === strtoupper($match[3]) ? $latitude : -$latitude, 'E' === strtoupper($match[6]) ? $longitude : -$longitude ); } // 40:26:46N, 079:56:55W // 40:26:46.302N 079:56:55.903W // 40°26′47″N 079°58′36″W // 40d 26′ 47″ N 079d 58′ 36″ W if (preg_match('/([0-9]{1,2})\D+([0-9]{1,2})\D+([0-9]{1,2}\.?\d*)\D*([ns]{1})[, ] ?([0-9]{1,3})\D+([0-9]{1,2})\D+([0-9]{1,2}\.?\d*)\D*([we]{1})$/i', $coordinates, $match)) { $latitude = $match[1] + ($match[2] * 60 + $match[3]) / 3600; $longitude = $match[5] + ($match[6] * 60 + $match[7]) / 3600; return array( 'N' === strtoupper($match[4]) ? $latitude : -$latitude, 'E' === strtoupper($match[8]) ? $longitude : -$longitude ); } throw new InvalidArgumentException( 'It should be a valid and acceptable ways to write geographic coordinates !' ); }
Converts a valid and acceptable geographic coordinates to decimal degrees coordinate. @param string $coordinates A valid and acceptable geographic coordinates. @return array An array of coordinate in decimal degree. @throws InvalidArgumentException @see http://en.wikipedia.org/wiki/Geographic_coordinate_conversion
toDecimalDegrees
php
thephpleague/geotools
src/Coordinate/Coordinate.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Coordinate.php
MIT
public function isEqual(Coordinate $coordinate) { return bccomp($this->latitude, $coordinate->getLatitude(), $this->getPrecision()) === 0 && bccomp($this->longitude, $coordinate->getLongitude(), $this->getPrecision()) === 0; }
Returns a boolean determining coordinates equality @param Coordinate $coordinate @return boolean
isEqual
php
thephpleague/geotools
src/Coordinate/Coordinate.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Coordinate.php
MIT
public static function createFromName($name = self::WGS84) { $name = trim($name); if (empty($name)) { throw new InvalidArgumentException('Please provide an ellipsoid name !'); } if (!array_key_exists($name, self::$referenceEllipsoids)) { throw new InvalidArgumentException( sprintf('%s ellipsoid does not exist in selected reference ellipsoids !', $name) ); } return self::createFromArray(self::$referenceEllipsoids[$name]); }
Create the ellipsoid chosen by its name. @param string $name The name of the ellipsoid to create (optional). @return Ellipsoid
createFromName
php
thephpleague/geotools
src/Coordinate/Ellipsoid.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Ellipsoid.php
MIT
public static function createFromArray(array $newEllipsoid) { if (!isset($newEllipsoid['name']) || !isset($newEllipsoid['a']) || !isset($newEllipsoid['invF']) || 3 !== count($newEllipsoid)) { throw new InvalidArgumentException('Ellipsoid arrays should contain `name`, `a` and `invF` keys !'); } return new self($newEllipsoid['name'], $newEllipsoid['a'], $newEllipsoid['invF']); }
Create an ellipsoid from an array. @param array $newEllipsoid The ellipsoid's parameters to create. @return Ellipsoid
createFromArray
php
thephpleague/geotools
src/Coordinate/Ellipsoid.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Ellipsoid.php
MIT
public static function checkCoordinatesEllipsoid(CoordinateInterface $a, CoordinateInterface $b) { if ($a->getEllipsoid() != $b->getEllipsoid()) { throw new NotMatchingEllipsoidException('The ellipsoids for both coordinates must match !'); } }
Check if coordinates have the same ellipsoid. @param CoordinateInterface $a A coordinate. @param CoordinateInterface $b A coordinate. @throws NotMatchingEllipsoidException
checkCoordinatesEllipsoid
php
thephpleague/geotools
src/Coordinate/Ellipsoid.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Ellipsoid.php
MIT
public function getA() { return (double) $this->a; }
Returns the semi-major axis (equatorial radius) in meters. @return double
getA
php
thephpleague/geotools
src/Coordinate/Ellipsoid.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Ellipsoid.php
MIT
public function getB() { return (double) $this->a * (1 - 1 / $this->invF); }
Computes and returns the semi-minor axis (polar distance) in meters. @see http://home.online.no/~sigurdhu/WGS84_Eng.html @return double
getB
php
thephpleague/geotools
src/Coordinate/Ellipsoid.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Ellipsoid.php
MIT
public function getInvF() { return (double) $this->invF; }
Returns the inverse flattening. @return double
getInvF
php
thephpleague/geotools
src/Coordinate/Ellipsoid.php
https://github.com/thephpleague/geotools/blob/master/src/Coordinate/Ellipsoid.php
MIT