id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
42,700 | agentsib/diadoc-php | src/Api/Proto/Docflow/FetchedDocument.php | FetchedDocument.setDocument | public function setDocument(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentWithDocflow $value)
{
$this->Document = $value;
} | php | public function setDocument(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentWithDocflow $value)
{
$this->Document = $value;
} | [
"public",
"function",
"setDocument",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"DocumentWithDocflow",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"Document",
"=",
"$",
"value",
";",
"}"
] | Set 'Document' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\DocumentWithDocflow $value | [
"Set",
"Document",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/FetchedDocument.php#L66-L69 |
42,701 | agentsib/diadoc-php | src/Api/Proto/Docflow/Entity.php | Entity.setCreationTimestamp | public function setCreationTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->CreationTimestamp = $value;
} | php | public function setCreationTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->CreationTimestamp = $value;
} | [
"public",
"function",
"setCreationTimestamp",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Timestamp",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"CreationTimestamp",
"=",
"$",
"value",
";",
"}"
] | Set 'CreationTimestamp' value
@param \AgentSIB\Diadoc\Api\Proto\Timestamp $value | [
"Set",
"CreationTimestamp",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/Entity.php#L103-L106 |
42,702 | agentsib/diadoc-php | src/Api/Proto/Docflow/GetDocflowBatchRequest.php | GetDocflowBatchRequest.addRequests | public function addRequests(\AgentSIB\Diadoc\Api\Proto\Docflow\GetDocflowRequest $value)
{
if ($this->Requests === null) {
$this->Requests = new \Protobuf\MessageCollection();
}
$this->Requests->add($value);
} | php | public function addRequests(\AgentSIB\Diadoc\Api\Proto\Docflow\GetDocflowRequest $value)
{
if ($this->Requests === null) {
$this->Requests = new \Protobuf\MessageCollection();
}
$this->Requests->add($value);
} | [
"public",
"function",
"addRequests",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"GetDocflowRequest",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Requests",
"===",
"null",
")",
"{",
"$",
"this",
... | Add a new element to 'Requests'
@param \AgentSIB\Diadoc\Api\Proto\Docflow\GetDocflowRequest $value | [
"Add",
"a",
"new",
"element",
"to",
"Requests"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/GetDocflowBatchRequest.php#L69-L76 |
42,703 | agentsib/diadoc-php | src/Api/Proto/ResolutionChainList.php | ResolutionChainList.addResolutionChains | public function addResolutionChains(\AgentSIB\Diadoc\Api\Proto\ResolutionChain $value)
{
if ($this->ResolutionChains === null) {
$this->ResolutionChains = new \Protobuf\MessageCollection();
}
$this->ResolutionChains->add($value);
} | php | public function addResolutionChains(\AgentSIB\Diadoc\Api\Proto\ResolutionChain $value)
{
if ($this->ResolutionChains === null) {
$this->ResolutionChains = new \Protobuf\MessageCollection();
}
$this->ResolutionChains->add($value);
} | [
"public",
"function",
"addResolutionChains",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"ResolutionChain",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ResolutionChains",
"===",
"null",
")",
"{",
"$",
"this",
"->",
... | Add a new element to 'ResolutionChains'
@param \AgentSIB\Diadoc\Api\Proto\ResolutionChain $value | [
"Add",
"a",
"new",
"element",
"to",
"ResolutionChains"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/ResolutionChainList.php#L69-L76 |
42,704 | agentsib/diadoc-php | src/Api/Proto/CertificateVerificationResult.php | CertificateVerificationResult.addCertificateChain | public function addCertificateChain(\AgentSIB\Diadoc\Api\Proto\CertificateChainElement $value)
{
if ($this->CertificateChain === null) {
$this->CertificateChain = new \Protobuf\MessageCollection();
}
$this->CertificateChain->add($value);
} | php | public function addCertificateChain(\AgentSIB\Diadoc\Api\Proto\CertificateChainElement $value)
{
if ($this->CertificateChain === null) {
$this->CertificateChain = new \Protobuf\MessageCollection();
}
$this->CertificateChain->add($value);
} | [
"public",
"function",
"addCertificateChain",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"CertificateChainElement",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"CertificateChain",
"===",
"null",
")",
"{",
"$",
"this",
... | Add a new element to 'CertificateChain'
@param \AgentSIB\Diadoc\Api\Proto\CertificateChainElement $value | [
"Add",
"a",
"new",
"element",
"to",
"CertificateChain"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/CertificateVerificationResult.php#L113-L120 |
42,705 | agentsib/diadoc-php | src/Api/Proto/CertificateVerificationResult.php | CertificateVerificationResult.setVerificationTime | public function setVerificationTime(\AgentSIB\Diadoc\Api\Proto\Timestamp $value)
{
$this->VerificationTime = $value;
} | php | public function setVerificationTime(\AgentSIB\Diadoc\Api\Proto\Timestamp $value)
{
$this->VerificationTime = $value;
} | [
"public",
"function",
"setVerificationTime",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Timestamp",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"VerificationTime",
"=",
"$",
"value",
";",
"}"
] | Set 'VerificationTime' value
@param \AgentSIB\Diadoc\Api\Proto\Timestamp $value | [
"Set",
"VerificationTime",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/CertificateVerificationResult.php#L147-L150 |
42,706 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php | UniversalTransferDocumentBuyerTitleInfo.setEmployee | public function setEmployee(\AgentSIB\Diadoc\Api\Proto\Invoicing\Employee $value = null)
{
$this->Employee = $value;
} | php | public function setEmployee(\AgentSIB\Diadoc\Api\Proto\Invoicing\Employee $value = null)
{
$this->Employee = $value;
} | [
"public",
"function",
"setEmployee",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Employee",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Employee",
"=",
"$",
"value",
";",
"}"
] | Set 'Employee' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Employee $value | [
"Set",
"Employee",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php#L266-L269 |
42,707 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php | UniversalTransferDocumentBuyerTitleInfo.setOtherIssuer | public function setOtherIssuer(\AgentSIB\Diadoc\Api\Proto\Invoicing\OtherIssuer $value = null)
{
$this->OtherIssuer = $value;
} | php | public function setOtherIssuer(\AgentSIB\Diadoc\Api\Proto\Invoicing\OtherIssuer $value = null)
{
$this->OtherIssuer = $value;
} | [
"public",
"function",
"setOtherIssuer",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"OtherIssuer",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"OtherIssuer",
"=",
"$",
"value",
";",
"}"
] | Set 'OtherIssuer' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\OtherIssuer $value | [
"Set",
"OtherIssuer",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php#L296-L299 |
42,708 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php | UniversalTransferDocumentBuyerTitleInfo.setAdditionalInfoId | public function setAdditionalInfoId(\AgentSIB\Diadoc\Api\Proto\Invoicing\AdditionalInfoId $value = null)
{
$this->AdditionalInfoId = $value;
} | php | public function setAdditionalInfoId(\AgentSIB\Diadoc\Api\Proto\Invoicing\AdditionalInfoId $value = null)
{
$this->AdditionalInfoId = $value;
} | [
"public",
"function",
"setAdditionalInfoId",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"AdditionalInfoId",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"AdditionalInfoId",
"=",
"$",
"value",
";",
... | Set 'AdditionalInfoId' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\AdditionalInfoId $value | [
"Set",
"AdditionalInfoId",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php#L326-L329 |
42,709 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php | UniversalTransferDocumentBuyerTitleInfo.addSigners | public function addSigners(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\ExtendedSigner $value)
{
if ($this->Signers === null) {
$this->Signers = new \Protobuf\MessageCollection();
}
$this->Signers->add($value);
} | php | public function addSigners(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\ExtendedSigner $value)
{
if ($this->Signers === null) {
$this->Signers = new \Protobuf\MessageCollection();
}
$this->Signers->add($value);
} | [
"public",
"function",
"addSigners",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Signers",
"\\",
"ExtendedSigner",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Signers",
"===",
"null",
")",
"{",
... | Add a new element to 'Signers'
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\ExtendedSigner $value | [
"Add",
"a",
"new",
"element",
"to",
"Signers"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentBuyerTitleInfo.php#L366-L373 |
42,710 | agentsib/diadoc-php | src/Api/Proto/Documents/InvoiceDocument/InvoiceMetadata.php | InvoiceMetadata.setInvoiceStatus | public function setInvoiceStatus(\AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value = null)
{
$this->InvoiceStatus = $value;
} | php | public function setInvoiceStatus(\AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value = null)
{
$this->InvoiceStatus = $value;
} | [
"public",
"function",
"setInvoiceStatus",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Documents",
"\\",
"InvoiceDocument",
"\\",
"InvoiceStatus",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"InvoiceStatus",
"=",
"$",... | Set 'InvoiceStatus' value
@param \AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value | [
"Set",
"InvoiceStatus",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Documents/InvoiceDocument/InvoiceMetadata.php#L105-L108 |
42,711 | agentsib/diadoc-php | src/Api/Proto/Docflow/InboundInvoiceDocflow.php | InboundInvoiceDocflow.setCorrectionRequestDocflow | public function setCorrectionRequestDocflow(\AgentSIB\Diadoc\Api\Proto\Docflow\InvoiceCorrectionRequestDocflow $value = null)
{
$this->CorrectionRequestDocflow = $value;
} | php | public function setCorrectionRequestDocflow(\AgentSIB\Diadoc\Api\Proto\Docflow\InvoiceCorrectionRequestDocflow $value = null)
{
$this->CorrectionRequestDocflow = $value;
} | [
"public",
"function",
"setCorrectionRequestDocflow",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"InvoiceCorrectionRequestDocflow",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"CorrectionRequestDocflow",
"=... | Set 'CorrectionRequestDocflow' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\InvoiceCorrectionRequestDocflow $value | [
"Set",
"CorrectionRequestDocflow",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/InboundInvoiceDocflow.php#L198-L201 |
42,712 | agentsib/diadoc-php | src/Api/Proto/Docflow/InboundInvoiceDocflow.php | InboundInvoiceDocflow.setConfirmationTimestamp | public function setConfirmationTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->ConfirmationTimestamp = $value;
} | php | public function setConfirmationTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->ConfirmationTimestamp = $value;
} | [
"public",
"function",
"setConfirmationTimestamp",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Timestamp",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ConfirmationTimestamp",
"=",
"$",
"value",
";",
"}"
] | Set 'ConfirmationTimestamp' value
@param \AgentSIB\Diadoc\Api\Proto\Timestamp $value | [
"Set",
"ConfirmationTimestamp",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/InboundInvoiceDocflow.php#L228-L231 |
42,713 | agentsib/diadoc-php | src/Api/Proto/Events/EncryptedInvoiceMetadata.php | EncryptedInvoiceMetadata.setRevisionDateAndNumber | public function setRevisionDateAndNumber(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value = null)
{
$this->RevisionDateAndNumber = $value;
} | php | public function setRevisionDateAndNumber(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value = null)
{
$this->RevisionDateAndNumber = $value;
} | [
"public",
"function",
"setRevisionDateAndNumber",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"DocumentDateAndNumber",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"RevisionDateAndNumber",
"=",
"$",
"val... | Set 'RevisionDateAndNumber' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value | [
"Set",
"RevisionDateAndNumber",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/EncryptedInvoiceMetadata.php#L59-L62 |
42,714 | agentsib/diadoc-php | src/Api/Proto/Documents/InvoiceDocument/InvoiceCorrectionRevisionMetadata.php | InvoiceCorrectionRevisionMetadata.setInvoiceCorrectionRevisionStatus | public function setInvoiceCorrectionRevisionStatus(\AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value = null)
{
$this->InvoiceCorrectionRevisionStatus = $value;
} | php | public function setInvoiceCorrectionRevisionStatus(\AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value = null)
{
$this->InvoiceCorrectionRevisionStatus = $value;
} | [
"public",
"function",
"setInvoiceCorrectionRevisionStatus",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Documents",
"\\",
"InvoiceDocument",
"\\",
"InvoiceStatus",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"InvoiceCorr... | Set 'InvoiceCorrectionRevisionStatus' value
@param \AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value | [
"Set",
"InvoiceCorrectionRevisionStatus",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Documents/InvoiceDocument/InvoiceCorrectionRevisionMetadata.php#L161-L164 |
42,715 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php | UniversalTransferDocumentSellerTitleInfo.setFunction | public function setFunction(\AgentSIB\Diadoc\Api\Proto\Invoicing\FunctionType $value)
{
$this->Function = $value;
} | php | public function setFunction(\AgentSIB\Diadoc\Api\Proto\Invoicing\FunctionType $value)
{
$this->Function = $value;
} | [
"public",
"function",
"setFunction",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"FunctionType",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"Function",
"=",
"$",
"value",
";",
"}"
] | Set 'Function' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\FunctionType $value | [
"Set",
"Function",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php#L193-L196 |
42,716 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php | UniversalTransferDocumentSellerTitleInfo.setShipper | public function setShipper(\AgentSIB\Diadoc\Api\Proto\Invoicing\Shipper $value = null)
{
$this->Shipper = $value;
} | php | public function setShipper(\AgentSIB\Diadoc\Api\Proto\Invoicing\Shipper $value = null)
{
$this->Shipper = $value;
} | [
"public",
"function",
"setShipper",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Shipper",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Shipper",
"=",
"$",
"value",
";",
"}"
] | Set 'Shipper' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Shipper $value | [
"Set",
"Shipper",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php#L373-L376 |
42,717 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php | UniversalTransferDocumentSellerTitleInfo.setInvoiceTable | public function setInvoiceTable(\AgentSIB\Diadoc\Api\Proto\Invoicing\InvoiceTable $value = null)
{
$this->InvoiceTable = $value;
} | php | public function setInvoiceTable(\AgentSIB\Diadoc\Api\Proto\Invoicing\InvoiceTable $value = null)
{
$this->InvoiceTable = $value;
} | [
"public",
"function",
"setInvoiceTable",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"InvoiceTable",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"InvoiceTable",
"=",
"$",
"value",
";",
"}"
] | Set 'InvoiceTable' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\InvoiceTable $value | [
"Set",
"InvoiceTable",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php#L521-L524 |
42,718 | agentsib/diadoc-php | src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php | UniversalTransferDocumentSellerTitleInfo.setTransferInfo | public function setTransferInfo(\AgentSIB\Diadoc\Api\Proto\Invoicing\TransferInfo $value = null)
{
$this->TransferInfo = $value;
} | php | public function setTransferInfo(\AgentSIB\Diadoc\Api\Proto\Invoicing\TransferInfo $value = null)
{
$this->TransferInfo = $value;
} | [
"public",
"function",
"setTransferInfo",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"TransferInfo",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"TransferInfo",
"=",
"$",
"value",
";",
"}"
] | Set 'TransferInfo' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\TransferInfo $value | [
"Set",
"TransferInfo",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/UniversalTransferDocumentSellerTitleInfo.php#L701-L704 |
42,719 | agentsib/diadoc-php | src/Api/Proto/Events/PrepareDocumentsToSignResponse.php | PrepareDocumentsToSignResponse.addDocumentPatchedContents | public function addDocumentPatchedContents(\AgentSIB\Diadoc\Api\Proto\Events\DocumentPatchedContent $value)
{
if ($this->DocumentPatchedContents === null) {
$this->DocumentPatchedContents = new \Protobuf\MessageCollection();
}
$this->DocumentPatchedContents->add($value);
} | php | public function addDocumentPatchedContents(\AgentSIB\Diadoc\Api\Proto\Events\DocumentPatchedContent $value)
{
if ($this->DocumentPatchedContents === null) {
$this->DocumentPatchedContents = new \Protobuf\MessageCollection();
}
$this->DocumentPatchedContents->add($value);
} | [
"public",
"function",
"addDocumentPatchedContents",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Events",
"\\",
"DocumentPatchedContent",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"DocumentPatchedContents",
"===",
"null",... | Add a new element to 'DocumentPatchedContents'
@param \AgentSIB\Diadoc\Api\Proto\Events\DocumentPatchedContent $value | [
"Add",
"a",
"new",
"element",
"to",
"DocumentPatchedContents"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/PrepareDocumentsToSignResponse.php#L70-L77 |
42,720 | agentsib/diadoc-php | src/Api/Proto/Content_v2.php | Content_v2.setDocumentId | public function setDocumentId(\AgentSIB\Diadoc\Api\Proto\DocumentIdEx $value = null)
{
$this->DocumentId = $value;
} | php | public function setDocumentId(\AgentSIB\Diadoc\Api\Proto\DocumentIdEx $value = null)
{
$this->DocumentId = $value;
} | [
"public",
"function",
"setDocumentId",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"DocumentIdEx",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"DocumentId",
"=",
"$",
"value",
";",
"}"
] | Set 'DocumentId' value
@param \AgentSIB\Diadoc\Api\Proto\DocumentIdEx $value | [
"Set",
"DocumentId",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Content_v2.php#L174-L177 |
42,721 | agentsib/diadoc-php | src/Api/Proto/Events/BoxEvent.php | BoxEvent.setMessage | public function setMessage(\AgentSIB\Diadoc\Api\Proto\Events\Message $value = null)
{
$this->Message = $value;
} | php | public function setMessage(\AgentSIB\Diadoc\Api\Proto\Events\Message $value = null)
{
$this->Message = $value;
} | [
"public",
"function",
"setMessage",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Events",
"\\",
"Message",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Message",
"=",
"$",
"value",
";",
"}"
] | Set 'Message' value
@param \AgentSIB\Diadoc\Api\Proto\Events\Message $value | [
"Set",
"Message",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/BoxEvent.php#L103-L106 |
42,722 | agentsib/diadoc-php | src/Api/Proto/Events/BoxEvent.php | BoxEvent.setPatch | public function setPatch(\AgentSIB\Diadoc\Api\Proto\Events\MessagePatch $value = null)
{
$this->Patch = $value;
} | php | public function setPatch(\AgentSIB\Diadoc\Api\Proto\Events\MessagePatch $value = null)
{
$this->Patch = $value;
} | [
"public",
"function",
"setPatch",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Events",
"\\",
"MessagePatch",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Patch",
"=",
"$",
"value",
";",
"}"
] | Set 'Patch' value
@param \AgentSIB\Diadoc\Api\Proto\Events\MessagePatch $value | [
"Set",
"Patch",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/BoxEvent.php#L133-L136 |
42,723 | agentsib/diadoc-php | src/Api/Proto/Invoicing/Signers/ExtendedSignerDetails.php | ExtendedSignerDetails.setSignerType | public function setSignerType(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerType $value)
{
$this->SignerType = $value;
} | php | public function setSignerType(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerType $value)
{
$this->SignerType = $value;
} | [
"public",
"function",
"setSignerType",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Signers",
"\\",
"SignerType",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"SignerType",
"=",
"$",
"value",
";",
"}"
] | Set 'SignerType' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerType $value | [
"Set",
"SignerType",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/Signers/ExtendedSignerDetails.php#L334-L337 |
42,724 | agentsib/diadoc-php | src/Api/Proto/Invoicing/Signers/ExtendedSignerDetails.php | ExtendedSignerDetails.setSignerPowers | public function setSignerPowers(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerPowers $value)
{
$this->SignerPowers = $value;
} | php | public function setSignerPowers(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerPowers $value)
{
$this->SignerPowers = $value;
} | [
"public",
"function",
"setSignerPowers",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Signers",
"\\",
"SignerPowers",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"SignerPowers",
"=",
"$",
"value",
";",
"}"
] | Set 'SignerPowers' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerPowers $value | [
"Set",
"SignerPowers",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/Signers/ExtendedSignerDetails.php#L424-L427 |
42,725 | agentsib/diadoc-php | src/Api/Proto/Invoicing/Signers/ExtendedSignerDetails.php | ExtendedSignerDetails.setSignerStatus | public function setSignerStatus(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerStatus $value)
{
$this->SignerStatus = $value;
} | php | public function setSignerStatus(\AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerStatus $value)
{
$this->SignerStatus = $value;
} | [
"public",
"function",
"setSignerStatus",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Signers",
"\\",
"SignerStatus",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"SignerStatus",
"=",
"$",
"value",
";",
"}"
] | Set 'SignerStatus' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Signers\SignerStatus $value | [
"Set",
"SignerStatus",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/Signers/ExtendedSignerDetails.php#L454-L457 |
42,726 | agentsib/diadoc-php | src/Api/Proto/Documents/DocumentsMoveOperation.php | DocumentsMoveOperation.addDocumentIds | public function addDocumentIds(\AgentSIB\Diadoc\Api\Proto\DocumentId $value)
{
if ($this->DocumentIds === null) {
$this->DocumentIds = new \Protobuf\MessageCollection();
}
$this->DocumentIds->add($value);
} | php | public function addDocumentIds(\AgentSIB\Diadoc\Api\Proto\DocumentId $value)
{
if ($this->DocumentIds === null) {
$this->DocumentIds = new \Protobuf\MessageCollection();
}
$this->DocumentIds->add($value);
} | [
"public",
"function",
"addDocumentIds",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"DocumentId",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"DocumentIds",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"DocumentIds",... | Add a new element to 'DocumentIds'
@param \AgentSIB\Diadoc\Api\Proto\DocumentId $value | [
"Add",
"a",
"new",
"element",
"to",
"DocumentIds"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Documents/DocumentsMoveOperation.php#L143-L150 |
42,727 | agentsib/diadoc-php | src/Api/Proto/Forwarding/ForwardedDocumentEvent.php | ForwardedDocumentEvent.setForwardedDocument | public function setForwardedDocument(\AgentSIB\Diadoc\Api\Proto\Forwarding\ForwardedDocument $value = null)
{
$this->ForwardedDocument = $value;
} | php | public function setForwardedDocument(\AgentSIB\Diadoc\Api\Proto\Forwarding\ForwardedDocument $value = null)
{
$this->ForwardedDocument = $value;
} | [
"public",
"function",
"setForwardedDocument",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Forwarding",
"\\",
"ForwardedDocument",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ForwardedDocument",
"=",
"$",
"value",
";... | Set 'ForwardedDocument' value
@param \AgentSIB\Diadoc\Api\Proto\Forwarding\ForwardedDocument $value | [
"Set",
"ForwardedDocument",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Forwarding/ForwardedDocumentEvent.php#L174-L177 |
42,728 | agentsib/diadoc-php | src/Api/Proto/Forwarding/GetForwardedDocumentsRequest.php | GetForwardedDocumentsRequest.addForwardedDocumentIds | public function addForwardedDocumentIds(\AgentSIB\Diadoc\Api\Proto\Forwarding\ForwardedDocumentId $value)
{
if ($this->ForwardedDocumentIds === null) {
$this->ForwardedDocumentIds = new \Protobuf\MessageCollection();
}
$this->ForwardedDocumentIds->add($value);
} | php | public function addForwardedDocumentIds(\AgentSIB\Diadoc\Api\Proto\Forwarding\ForwardedDocumentId $value)
{
if ($this->ForwardedDocumentIds === null) {
$this->ForwardedDocumentIds = new \Protobuf\MessageCollection();
}
$this->ForwardedDocumentIds->add($value);
} | [
"public",
"function",
"addForwardedDocumentIds",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Forwarding",
"\\",
"ForwardedDocumentId",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ForwardedDocumentIds",
"===",
"null",
")... | Add a new element to 'ForwardedDocumentIds'
@param \AgentSIB\Diadoc\Api\Proto\Forwarding\ForwardedDocumentId $value | [
"Add",
"a",
"new",
"element",
"to",
"ForwardedDocumentIds"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Forwarding/GetForwardedDocumentsRequest.php#L87-L94 |
42,729 | agentsib/diadoc-php | src/Api/Proto/Events/ResolutionAttachment.php | ResolutionAttachment.setResolutionType | public function setResolutionType(\AgentSIB\Diadoc\Api\Proto\Events\ResolutionType $value)
{
$this->ResolutionType = $value;
} | php | public function setResolutionType(\AgentSIB\Diadoc\Api\Proto\Events\ResolutionType $value)
{
$this->ResolutionType = $value;
} | [
"public",
"function",
"setResolutionType",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Events",
"\\",
"ResolutionType",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"ResolutionType",
"=",
"$",
"value",
";",
"}"
] | Set 'ResolutionType' value
@param \AgentSIB\Diadoc\Api\Proto\Events\ResolutionType $value | [
"Set",
"ResolutionType",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/ResolutionAttachment.php#L103-L106 |
42,730 | agentsib/diadoc-php | src/Api/Proto/Documents/ResolutionStatus.php | ResolutionStatus.setTarget | public function setTarget(\AgentSIB\Diadoc\Api\Proto\ResolutionTarget $value = null)
{
$this->Target = $value;
} | php | public function setTarget(\AgentSIB\Diadoc\Api\Proto\ResolutionTarget $value = null)
{
$this->Target = $value;
} | [
"public",
"function",
"setTarget",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"ResolutionTarget",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Target",
"=",
"$",
"value",
";",
"}"
] | Set 'Target' value
@param \AgentSIB\Diadoc\Api\Proto\ResolutionTarget $value | [
"Set",
"Target",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Documents/ResolutionStatus.php#L120-L123 |
42,731 | agentsib/diadoc-php | src/Api/Proto/Invoicing/TransferInfo.php | TransferInfo.addTransferBase | public function addTransferBase(\AgentSIB\Diadoc\Api\Proto\Invoicing\TransferBase $value)
{
if ($this->TransferBase === null) {
$this->TransferBase = new \Protobuf\MessageCollection();
}
$this->TransferBase->add($value);
} | php | public function addTransferBase(\AgentSIB\Diadoc\Api\Proto\Invoicing\TransferBase $value)
{
if ($this->TransferBase === null) {
$this->TransferBase = new \Protobuf\MessageCollection();
}
$this->TransferBase->add($value);
} | [
"public",
"function",
"addTransferBase",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"TransferBase",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"TransferBase",
"===",
"null",
")",
"{",
"$",
"this... | Add a new element to 'TransferBase'
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\TransferBase $value | [
"Add",
"a",
"new",
"element",
"to",
"TransferBase"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/TransferInfo.php#L236-L243 |
42,732 | agentsib/diadoc-php | src/Api/Proto/Invoicing/TransferInfo.php | TransferInfo.addWaybill | public function addWaybill(\AgentSIB\Diadoc\Api\Proto\Invoicing\Waybill $value)
{
if ($this->Waybill === null) {
$this->Waybill = new \Protobuf\MessageCollection();
}
$this->Waybill->add($value);
} | php | public function addWaybill(\AgentSIB\Diadoc\Api\Proto\Invoicing\Waybill $value)
{
if ($this->Waybill === null) {
$this->Waybill = new \Protobuf\MessageCollection();
}
$this->Waybill->add($value);
} | [
"public",
"function",
"addWaybill",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Waybill",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Waybill",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"W... | Add a new element to 'Waybill'
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Waybill $value | [
"Add",
"a",
"new",
"element",
"to",
"Waybill"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/TransferInfo.php#L310-L317 |
42,733 | agentsib/diadoc-php | src/Api/Proto/Invoicing/TransferInfo.php | TransferInfo.setCarrier | public function setCarrier(\AgentSIB\Diadoc\Api\Proto\Invoicing\Organizations\ExtendedOrganizationInfo $value = null)
{
$this->Carrier = $value;
} | php | public function setCarrier(\AgentSIB\Diadoc\Api\Proto\Invoicing\Organizations\ExtendedOrganizationInfo $value = null)
{
$this->Carrier = $value;
} | [
"public",
"function",
"setCarrier",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Organizations",
"\\",
"ExtendedOrganizationInfo",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Carrier",
"=",
"$",
... | Set 'Carrier' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Organizations\ExtendedOrganizationInfo $value | [
"Set",
"Carrier",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/TransferInfo.php#L344-L347 |
42,734 | agentsib/diadoc-php | src/Api/Proto/Events/ResolutionRequestInfo.php | ResolutionRequestInfo.setRequestType | public function setRequestType(\AgentSIB\Diadoc\Api\Proto\Events\ResolutionRequestType $value = null)
{
$this->RequestType = $value;
} | php | public function setRequestType(\AgentSIB\Diadoc\Api\Proto\Events\ResolutionRequestType $value = null)
{
$this->RequestType = $value;
} | [
"public",
"function",
"setRequestType",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Events",
"\\",
"ResolutionRequestType",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"RequestType",
"=",
"$",
"value",
";",
"}"
] | Set 'RequestType' value
@param \AgentSIB\Diadoc\Api\Proto\Events\ResolutionRequestType $value | [
"Set",
"RequestType",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/ResolutionRequestInfo.php#L90-L93 |
42,735 | agentsib/diadoc-php | src/Api/Proto/Forwarding/ForwardedDocument.php | ForwardedDocument.setDocumentWithDocflow | public function setDocumentWithDocflow(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentWithDocflow $value = null)
{
$this->DocumentWithDocflow = $value;
} | php | public function setDocumentWithDocflow(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentWithDocflow $value = null)
{
$this->DocumentWithDocflow = $value;
} | [
"public",
"function",
"setDocumentWithDocflow",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"DocumentWithDocflow",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"DocumentWithDocflow",
"=",
"$",
"value",
... | Set 'DocumentWithDocflow' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\DocumentWithDocflow $value | [
"Set",
"DocumentWithDocflow",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Forwarding/ForwardedDocument.php#L133-L136 |
42,736 | agentsib/diadoc-php | src/Api/Proto/Invoicing/AcceptanceCertificateSellerTitleInfo.php | AcceptanceCertificateSellerTitleInfo.addWorks | public function addWorks(\AgentSIB\Diadoc\Api\Proto\Invoicing\WorkDescription $value)
{
if ($this->Works === null) {
$this->Works = new \Protobuf\MessageCollection();
}
$this->Works->add($value);
} | php | public function addWorks(\AgentSIB\Diadoc\Api\Proto\Invoicing\WorkDescription $value)
{
if ($this->Works === null) {
$this->Works = new \Protobuf\MessageCollection();
}
$this->Works->add($value);
} | [
"public",
"function",
"addWorks",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"WorkDescription",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Works",
"===",
"null",
")",
"{",
"$",
"this",
"->",
... | Add a new element to 'Works'
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\WorkDescription $value | [
"Add",
"a",
"new",
"element",
"to",
"Works"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/AcceptanceCertificateSellerTitleInfo.php#L276-L283 |
42,737 | agentsib/diadoc-php | src/Api/Proto/Events/EditDocumentPacketCommand.php | EditDocumentPacketCommand.addAddDocumentsToPacket | public function addAddDocumentsToPacket(\AgentSIB\Diadoc\Api\Proto\DocumentId $value)
{
if ($this->AddDocumentsToPacket === null) {
$this->AddDocumentsToPacket = new \Protobuf\MessageCollection();
}
$this->AddDocumentsToPacket->add($value);
} | php | public function addAddDocumentsToPacket(\AgentSIB\Diadoc\Api\Proto\DocumentId $value)
{
if ($this->AddDocumentsToPacket === null) {
$this->AddDocumentsToPacket = new \Protobuf\MessageCollection();
}
$this->AddDocumentsToPacket->add($value);
} | [
"public",
"function",
"addAddDocumentsToPacket",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"DocumentId",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"AddDocumentsToPacket",
"===",
"null",
")",
"{",
"$",
"this",
"->"... | Add a new element to 'AddDocumentsToPacket'
@param \AgentSIB\Diadoc\Api\Proto\DocumentId $value | [
"Add",
"a",
"new",
"element",
"to",
"AddDocumentsToPacket"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/EditDocumentPacketCommand.php#L113-L120 |
42,738 | agentsib/diadoc-php | src/Api/Proto/Events/EditDocumentPacketCommand.php | EditDocumentPacketCommand.addRemoveDocumentsFromPacket | public function addRemoveDocumentsFromPacket(\AgentSIB\Diadoc\Api\Proto\DocumentId $value)
{
if ($this->RemoveDocumentsFromPacket === null) {
$this->RemoveDocumentsFromPacket = new \Protobuf\MessageCollection();
}
$this->RemoveDocumentsFromPacket->add($value);
} | php | public function addRemoveDocumentsFromPacket(\AgentSIB\Diadoc\Api\Proto\DocumentId $value)
{
if ($this->RemoveDocumentsFromPacket === null) {
$this->RemoveDocumentsFromPacket = new \Protobuf\MessageCollection();
}
$this->RemoveDocumentsFromPacket->add($value);
} | [
"public",
"function",
"addRemoveDocumentsFromPacket",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"DocumentId",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"RemoveDocumentsFromPacket",
"===",
"null",
")",
"{",
"$",
"thi... | Add a new element to 'RemoveDocumentsFromPacket'
@param \AgentSIB\Diadoc\Api\Proto\DocumentId $value | [
"Add",
"a",
"new",
"element",
"to",
"RemoveDocumentsFromPacket"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/EditDocumentPacketCommand.php#L157-L164 |
42,739 | agentsib/diadoc-php | src/Api/Proto/Docflow/RevocationDocflow.php | RevocationDocflow.setRevocationRequestAttachment | public function setRevocationRequestAttachment(\AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value = null)
{
$this->RevocationRequestAttachment = $value;
} | php | public function setRevocationRequestAttachment(\AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value = null)
{
$this->RevocationRequestAttachment = $value;
} | [
"public",
"function",
"setRevocationRequestAttachment",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"SignedAttachment",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"RevocationRequestAttachment",
"=",
"$",... | Set 'RevocationRequestAttachment' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value | [
"Set",
"RevocationRequestAttachment",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/RevocationDocflow.php#L131-L134 |
42,740 | agentsib/diadoc-php | src/Api/Proto/Events/CustomDataPatch.php | CustomDataPatch.setOperation | public function setOperation(\AgentSIB\Diadoc\Api\Proto\Events\CustomDataPatchOperation $value)
{
$this->Operation = $value;
} | php | public function setOperation(\AgentSIB\Diadoc\Api\Proto\Events\CustomDataPatchOperation $value)
{
$this->Operation = $value;
} | [
"public",
"function",
"setOperation",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Events",
"\\",
"CustomDataPatchOperation",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"Operation",
"=",
"$",
"value",
";",
"}"
] | Set 'Operation' value
@param \AgentSIB\Diadoc\Api\Proto\Events\CustomDataPatchOperation $value | [
"Set",
"Operation",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Events/CustomDataPatch.php#L110-L113 |
42,741 | agentsib/diadoc-php | src/Api/Proto/Certificate.php | Certificate.setRawCertificateData | public function setRawCertificateData($value)
{
if ($value !== null && ! $value instanceof \Protobuf\Stream) {
$value = \Protobuf\Stream::wrap($value);
}
$this->RawCertificateData = $value;
} | php | public function setRawCertificateData($value)
{
if ($value !== null && ! $value instanceof \Protobuf\Stream) {
$value = \Protobuf\Stream::wrap($value);
}
$this->RawCertificateData = $value;
} | [
"public",
"function",
"setRawCertificateData",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
"&&",
"!",
"$",
"value",
"instanceof",
"\\",
"Protobuf",
"\\",
"Stream",
")",
"{",
"$",
"value",
"=",
"\\",
"Protobuf",
"\\",
"Stream",
... | Set 'RawCertificateData' value
@param \Protobuf\Stream $value | [
"Set",
"RawCertificateData",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Certificate.php#L59-L66 |
42,742 | agentsib/diadoc-php | src/Api/Proto/CertificateChainElement.php | CertificateChainElement.setDerCertificate | public function setDerCertificate($value)
{
if ($value !== null && ! $value instanceof \Protobuf\Stream) {
$value = \Protobuf\Stream::wrap($value);
}
$this->DerCertificate = $value;
} | php | public function setDerCertificate($value)
{
if ($value !== null && ! $value instanceof \Protobuf\Stream) {
$value = \Protobuf\Stream::wrap($value);
}
$this->DerCertificate = $value;
} | [
"public",
"function",
"setDerCertificate",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
"&&",
"!",
"$",
"value",
"instanceof",
"\\",
"Protobuf",
"\\",
"Stream",
")",
"{",
"$",
"value",
"=",
"\\",
"Protobuf",
"\\",
"Stream",
"::"... | Set 'DerCertificate' value
@param \Protobuf\Stream $value | [
"Set",
"DerCertificate",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/CertificateChainElement.php#L96-L103 |
42,743 | agentsib/diadoc-php | src/Api/Proto/Documents/InvoiceDocument/InvoiceRevisionMetadata.php | InvoiceRevisionMetadata.setInvoiceRevisionStatus | public function setInvoiceRevisionStatus(\AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value = null)
{
$this->InvoiceRevisionStatus = $value;
} | php | public function setInvoiceRevisionStatus(\AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value = null)
{
$this->InvoiceRevisionStatus = $value;
} | [
"public",
"function",
"setInvoiceRevisionStatus",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Documents",
"\\",
"InvoiceDocument",
"\\",
"InvoiceStatus",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"InvoiceRevisionStatus... | Set 'InvoiceRevisionStatus' value
@param \AgentSIB\Diadoc\Api\Proto\Documents\InvoiceDocument\InvoiceStatus $value | [
"Set",
"InvoiceRevisionStatus",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Documents/InvoiceDocument/InvoiceRevisionMetadata.php#L119-L122 |
42,744 | ohdearapp/ohdear-php-sdk | src/Resources/Site.php | Site.uptime | public function uptime(string $startedAt, string $endedAt, string $split)
{
return $this->ohDear->uptime($this->id, $startedAt, $endedAt, $split);
} | php | public function uptime(string $startedAt, string $endedAt, string $split)
{
return $this->ohDear->uptime($this->id, $startedAt, $endedAt, $split);
} | [
"public",
"function",
"uptime",
"(",
"string",
"$",
"startedAt",
",",
"string",
"$",
"endedAt",
",",
"string",
"$",
"split",
")",
"{",
"return",
"$",
"this",
"->",
"ohDear",
"->",
"uptime",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"startedAt",
",",
"$... | Get the uptime percentages for a site.
@param string $startedAt Must be in format Ymdhis
@param string $endedAt Must be in format Ymdhis
@param string $split Use hour, day or month
@return array | [
"Get",
"the",
"uptime",
"percentages",
"for",
"a",
"site",
"."
] | 7851e55d28ea62ae29f516ab2b5bb4be576a6427 | https://github.com/ohdearapp/ohdear-php-sdk/blob/7851e55d28ea62ae29f516ab2b5bb4be576a6427/src/Resources/Site.php#L83-L86 |
42,745 | ohdearapp/ohdear-php-sdk | src/Resources/Site.php | Site.downtime | public function downtime(string $startedAt, string $endedAt)
{
return $this->ohDear->downtime($this->id, $startedAt, $endedAt);
} | php | public function downtime(string $startedAt, string $endedAt)
{
return $this->ohDear->downtime($this->id, $startedAt, $endedAt);
} | [
"public",
"function",
"downtime",
"(",
"string",
"$",
"startedAt",
",",
"string",
"$",
"endedAt",
")",
"{",
"return",
"$",
"this",
"->",
"ohDear",
"->",
"downtime",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"startedAt",
",",
"$",
"endedAt",
")",
";",
"... | Get the downtime periods for a site.
@param string $startedAt Must be in format Ymdhis
@param string $endedAt Must be in format Ymdhis
@return array | [
"Get",
"the",
"downtime",
"periods",
"for",
"a",
"site",
"."
] | 7851e55d28ea62ae29f516ab2b5bb4be576a6427 | https://github.com/ohdearapp/ohdear-php-sdk/blob/7851e55d28ea62ae29f516ab2b5bb4be576a6427/src/Resources/Site.php#L96-L99 |
42,746 | 8p/guzzle-wsse-middleware | src/EightPoints/Guzzle/WsseAuthMiddleware.php | WsseAuthMiddleware.attach | public function attach()
{
return function (callable $handler) {
return function (RequestInterface $request, array $options) use ($handler) {
$createdAt = $this->getCreatedAt()->format('c');
$nonce = $this->generateNonce();
$digest = $this->generateDigest($nonce, $createdAt, $this->password);
$xwsse = array(
sprintf('Username="%s"', $this->username),
sprintf('PasswordDigest="%s"', $digest),
sprintf('Nonce="%s"', $nonce),
sprintf('Created="%s"', $createdAt)
);
$request = $request->withHeader('Authorization', 'WSSE profile="UsernameToken"');
$request = $request->withHeader('X-WSSE', sprintf('UsernameToken %s', implode(', ', $xwsse)));
return $handler($request, $options);
};
};
} | php | public function attach()
{
return function (callable $handler) {
return function (RequestInterface $request, array $options) use ($handler) {
$createdAt = $this->getCreatedAt()->format('c');
$nonce = $this->generateNonce();
$digest = $this->generateDigest($nonce, $createdAt, $this->password);
$xwsse = array(
sprintf('Username="%s"', $this->username),
sprintf('PasswordDigest="%s"', $digest),
sprintf('Nonce="%s"', $nonce),
sprintf('Created="%s"', $createdAt)
);
$request = $request->withHeader('Authorization', 'WSSE profile="UsernameToken"');
$request = $request->withHeader('X-WSSE', sprintf('UsernameToken %s', implode(', ', $xwsse)));
return $handler($request, $options);
};
};
} | [
"public",
"function",
"attach",
"(",
")",
"{",
"return",
"function",
"(",
"callable",
"$",
"handler",
")",
"{",
"return",
"function",
"(",
"RequestInterface",
"$",
"request",
",",
"array",
"$",
"options",
")",
"use",
"(",
"$",
"handler",
")",
"{",
"$",
... | Add WSSE auth headers to Request
@version 3.0
@since 2015-06
@return callable
@throws \InvalidArgumentException | [
"Add",
"WSSE",
"auth",
"headers",
"to",
"Request"
] | 3998dae6fed29f2d3384024764046b63a764ddda | https://github.com/8p/guzzle-wsse-middleware/blob/3998dae6fed29f2d3384024764046b63a764ddda/src/EightPoints/Guzzle/WsseAuthMiddleware.php#L165-L188 |
42,747 | ohdearapp/ohdear-php-sdk | src/Resources/Check.php | Check.enable | public function enable()
{
$updatedCheck = $this->ohDear->enableCheck($this->id);
$this->enabled = $updatedCheck->enabled;
} | php | public function enable()
{
$updatedCheck = $this->ohDear->enableCheck($this->id);
$this->enabled = $updatedCheck->enabled;
} | [
"public",
"function",
"enable",
"(",
")",
"{",
"$",
"updatedCheck",
"=",
"$",
"this",
"->",
"ohDear",
"->",
"enableCheck",
"(",
"$",
"this",
"->",
"id",
")",
";",
"$",
"this",
"->",
"enabled",
"=",
"$",
"updatedCheck",
"->",
"enabled",
";",
"}"
] | Enable the check. | [
"Enable",
"the",
"check",
"."
] | 7851e55d28ea62ae29f516ab2b5bb4be576a6427 | https://github.com/ohdearapp/ohdear-php-sdk/blob/7851e55d28ea62ae29f516ab2b5bb4be576a6427/src/Resources/Check.php#L38-L43 |
42,748 | ohdearapp/ohdear-php-sdk | src/Resources/Check.php | Check.disable | public function disable()
{
$updatedCheck = $this->ohDear->disableCheck($this->id);
$this->enabled = $updatedCheck->enabled;
} | php | public function disable()
{
$updatedCheck = $this->ohDear->disableCheck($this->id);
$this->enabled = $updatedCheck->enabled;
} | [
"public",
"function",
"disable",
"(",
")",
"{",
"$",
"updatedCheck",
"=",
"$",
"this",
"->",
"ohDear",
"->",
"disableCheck",
"(",
"$",
"this",
"->",
"id",
")",
";",
"$",
"this",
"->",
"enabled",
"=",
"$",
"updatedCheck",
"->",
"enabled",
";",
"}"
] | Disable the check. | [
"Disable",
"the",
"check",
"."
] | 7851e55d28ea62ae29f516ab2b5bb4be576a6427 | https://github.com/ohdearapp/ohdear-php-sdk/blob/7851e55d28ea62ae29f516ab2b5bb4be576a6427/src/Resources/Check.php#L48-L53 |
42,749 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.configureOptions | private function configureOptions()
{
$this->addOption(
self::OPTIONS_KEY_IMAGES,
'i',
InputOption::VALUE_OPTIONAL,
'The list of docker images to use (comma or space delimited).'
);
$this->addOption(
self::OPTIONS_KEY_CONFIGFILE,
'c',
InputOption::VALUE_OPTIONAL,
'The path to the configuration file.'
);
$this->addOption(
self::OPTIONS_KEY_SYNTAX,
's',
InputOption::VALUE_OPTIONAL,
'A flag indicating whether to run syntax checks.'
);
$this->addOption(
self::OPTIONS_KEY_SYNTAXCOMMAND,
'S',
InputOption::VALUE_OPTIONAL,
'The command to run syntax checks.'
);
$this->addOption(
self::OPTIONS_KEY_UNITTESTS,
'u',
InputOption::VALUE_OPTIONAL,
'A flag indicating whether to run the unit test suite.'
);
$this->addOption(
self::OPTIONS_KEY_UNITTESTSCOMMAND,
'U',
InputOption::VALUE_OPTIONAL,
'The command to run the unit tests.'
);
$this->addOption(
self::OPTIONS_KEY_PULL,
'p',
InputOption::VALUE_NONE,
'A flag indicating to pull new images instead of running the linter or unit tests.'
);
} | php | private function configureOptions()
{
$this->addOption(
self::OPTIONS_KEY_IMAGES,
'i',
InputOption::VALUE_OPTIONAL,
'The list of docker images to use (comma or space delimited).'
);
$this->addOption(
self::OPTIONS_KEY_CONFIGFILE,
'c',
InputOption::VALUE_OPTIONAL,
'The path to the configuration file.'
);
$this->addOption(
self::OPTIONS_KEY_SYNTAX,
's',
InputOption::VALUE_OPTIONAL,
'A flag indicating whether to run syntax checks.'
);
$this->addOption(
self::OPTIONS_KEY_SYNTAXCOMMAND,
'S',
InputOption::VALUE_OPTIONAL,
'The command to run syntax checks.'
);
$this->addOption(
self::OPTIONS_KEY_UNITTESTS,
'u',
InputOption::VALUE_OPTIONAL,
'A flag indicating whether to run the unit test suite.'
);
$this->addOption(
self::OPTIONS_KEY_UNITTESTSCOMMAND,
'U',
InputOption::VALUE_OPTIONAL,
'The command to run the unit tests.'
);
$this->addOption(
self::OPTIONS_KEY_PULL,
'p',
InputOption::VALUE_NONE,
'A flag indicating to pull new images instead of running the linter or unit tests.'
);
} | [
"private",
"function",
"configureOptions",
"(",
")",
"{",
"$",
"this",
"->",
"addOption",
"(",
"self",
"::",
"OPTIONS_KEY_IMAGES",
",",
"'i'",
",",
"InputOption",
"::",
"VALUE_OPTIONAL",
",",
"'The list of docker images to use (comma or space delimited).'",
")",
";",
... | Configures the list of command options. | [
"Configures",
"the",
"list",
"of",
"command",
"options",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L100-L144 |
42,750 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
// retrieve the current settings
$options = $this->getCurrentOptions($input, $output);
// check if docker is installed
if (false === $this->commandExists('docker')) {
$output->writeln('Docker is required to run DUnit.');
return self::ERROR_CODE;
}
// loop over each of the docker images specified
foreach ($options[self::OPTIONS_KEY_IMAGES] as $image) {
if ($options[self::OPTIONS_KEY_PULL]) {
passthru(sprintf(
self::DOCKER_COMMAND_PULL,
escapeshellarg($image)
));
continue;
}
$output->writeln('Running against image '.$image);
if ($options[self::OPTIONS_KEY_SYNTAX]) {
$output->writeln('Checking syntax');
// run the syntax checks
$this->executeCommandForImage(
$image,
$options[self::OPTIONS_KEY_SYNTAXCOMMAND]
);
}
if ($options[self::OPTIONS_KEY_UNITTESTS]) {
$output->writeln('Running unit test suite');
// run the unit tests
$this->executeCommandForImage(
$image,
$options[self::OPTIONS_KEY_UNITTESTSCOMMAND]
);
}
}
return self::NO_ERROR;
} | php | protected function execute(InputInterface $input, OutputInterface $output)
{
// retrieve the current settings
$options = $this->getCurrentOptions($input, $output);
// check if docker is installed
if (false === $this->commandExists('docker')) {
$output->writeln('Docker is required to run DUnit.');
return self::ERROR_CODE;
}
// loop over each of the docker images specified
foreach ($options[self::OPTIONS_KEY_IMAGES] as $image) {
if ($options[self::OPTIONS_KEY_PULL]) {
passthru(sprintf(
self::DOCKER_COMMAND_PULL,
escapeshellarg($image)
));
continue;
}
$output->writeln('Running against image '.$image);
if ($options[self::OPTIONS_KEY_SYNTAX]) {
$output->writeln('Checking syntax');
// run the syntax checks
$this->executeCommandForImage(
$image,
$options[self::OPTIONS_KEY_SYNTAXCOMMAND]
);
}
if ($options[self::OPTIONS_KEY_UNITTESTS]) {
$output->writeln('Running unit test suite');
// run the unit tests
$this->executeCommandForImage(
$image,
$options[self::OPTIONS_KEY_UNITTESTSCOMMAND]
);
}
}
return self::NO_ERROR;
} | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"// retrieve the current settings",
"$",
"options",
"=",
"$",
"this",
"->",
"getCurrentOptions",
"(",
"$",
"input",
",",
"$",
"output",
")",... | The entry point for the command.
@param InputInterface $input The input for options and arguments.
@param OutputInterface $output The output writer.
@return null|int null or 0 if everything went fine, or an error code | [
"The",
"entry",
"point",
"for",
"the",
"command",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L152-L191 |
42,751 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.getCurrentOptions | private function getCurrentOptions(InputInterface $input, OutputInterface $output)
{
$options = $this->getDefaultOptions();
try {
$options = $this->mergeConfigFileIntoOptions(
$options,
$input->getOption(self::OPTIONS_KEY_CONFIGFILE)
);
} catch (Exception $e) {
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
$output->writeln('WARNING: Config file could not be read. Falling back to built-in defaults.');
}
}
$options = $this->mergeEnvironmentVariablesIntoOptions($options);
// handle the individual options
// handle the list of images
$options[self::OPTIONS_KEY_IMAGES] = $this->getArrayOption(
$input, self::OPTIONS_KEY_IMAGES, $options[self::OPTIONS_KEY_IMAGES]
);
// if the user specified a syntax command we assume they want to run
// the syntax checks
$syntaxCommand = $input->getOption(self::OPTIONS_KEY_SYNTAXCOMMAND);
if (!empty($syntaxCommand)) {
$options[self::OPTIONS_KEY_SYNTAX] = true;
} else {
// check for the syntax flag
$options[self::OPTIONS_KEY_SYNTAX] = $this->getBooleanOption(
$input, self::OPTIONS_KEY_SYNTAX, $options[self::OPTIONS_KEY_SYNTAX]
);
}
// if they are running syntax, check for the actual command option
if ($options[self::OPTIONS_KEY_SYNTAX]) {
$options[self::OPTIONS_KEY_SYNTAXCOMMAND] = $this->getStringOption(
$input, self::OPTIONS_KEY_SYNTAXCOMMAND, $options[self::OPTIONS_KEY_SYNTAXCOMMAND]
);
}
// if the user specified a unit tests command we assume they want to
// run the unit tests
if ($input->hasOption(self::OPTIONS_KEY_UNITTESTSCOMMAND)) {
$options[self::OPTIONS_KEY_UNITTESTS] = true;
} else {
// check for the unit tests flag
$options[self::OPTIONS_KEY_UNITTESTS] = $this->getBooleanOption(
$input, self::OPTIONS_KEY_UNITTESTS, $options[self::OPTIONS_KEY_UNITTESTS]
);
}
// if they are running the unit tests, check for the actual command
if ($options[self::OPTIONS_KEY_UNITTESTS]) {
$options[self::OPTIONS_KEY_UNITTESTSCOMMAND] = $this->getStringOption(
$input,
self::OPTIONS_KEY_UNITTESTSCOMMAND,
$options[self::OPTIONS_KEY_UNITTESTSCOMMAND]
);
}
$options[self::OPTIONS_KEY_PULL] = $input->getOption(self::OPTIONS_KEY_PULL);
return $options;
} | php | private function getCurrentOptions(InputInterface $input, OutputInterface $output)
{
$options = $this->getDefaultOptions();
try {
$options = $this->mergeConfigFileIntoOptions(
$options,
$input->getOption(self::OPTIONS_KEY_CONFIGFILE)
);
} catch (Exception $e) {
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
$output->writeln('WARNING: Config file could not be read. Falling back to built-in defaults.');
}
}
$options = $this->mergeEnvironmentVariablesIntoOptions($options);
// handle the individual options
// handle the list of images
$options[self::OPTIONS_KEY_IMAGES] = $this->getArrayOption(
$input, self::OPTIONS_KEY_IMAGES, $options[self::OPTIONS_KEY_IMAGES]
);
// if the user specified a syntax command we assume they want to run
// the syntax checks
$syntaxCommand = $input->getOption(self::OPTIONS_KEY_SYNTAXCOMMAND);
if (!empty($syntaxCommand)) {
$options[self::OPTIONS_KEY_SYNTAX] = true;
} else {
// check for the syntax flag
$options[self::OPTIONS_KEY_SYNTAX] = $this->getBooleanOption(
$input, self::OPTIONS_KEY_SYNTAX, $options[self::OPTIONS_KEY_SYNTAX]
);
}
// if they are running syntax, check for the actual command option
if ($options[self::OPTIONS_KEY_SYNTAX]) {
$options[self::OPTIONS_KEY_SYNTAXCOMMAND] = $this->getStringOption(
$input, self::OPTIONS_KEY_SYNTAXCOMMAND, $options[self::OPTIONS_KEY_SYNTAXCOMMAND]
);
}
// if the user specified a unit tests command we assume they want to
// run the unit tests
if ($input->hasOption(self::OPTIONS_KEY_UNITTESTSCOMMAND)) {
$options[self::OPTIONS_KEY_UNITTESTS] = true;
} else {
// check for the unit tests flag
$options[self::OPTIONS_KEY_UNITTESTS] = $this->getBooleanOption(
$input, self::OPTIONS_KEY_UNITTESTS, $options[self::OPTIONS_KEY_UNITTESTS]
);
}
// if they are running the unit tests, check for the actual command
if ($options[self::OPTIONS_KEY_UNITTESTS]) {
$options[self::OPTIONS_KEY_UNITTESTSCOMMAND] = $this->getStringOption(
$input,
self::OPTIONS_KEY_UNITTESTSCOMMAND,
$options[self::OPTIONS_KEY_UNITTESTSCOMMAND]
);
}
$options[self::OPTIONS_KEY_PULL] = $input->getOption(self::OPTIONS_KEY_PULL);
return $options;
} | [
"private",
"function",
"getCurrentOptions",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getDefaultOptions",
"(",
")",
";",
"try",
"{",
"$",
"options",
"=",
"$",
"this",
"->"... | Returns an array of the currently active options given all possible
options, environment variables, config file settings, etc.
@param InputInterface $input The input of options and arguments.
@param OutputInterface $output The output writer.
@return array Returns an array of settings. | [
"Returns",
"an",
"array",
"of",
"the",
"currently",
"active",
"options",
"given",
"all",
"possible",
"options",
"environment",
"variables",
"config",
"file",
"settings",
"etc",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L200-L261 |
42,752 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.getDefaultOptions | private function getDefaultOptions()
{
// the list of default options if no config is found or specified
return array(
self::OPTIONS_KEY_IMAGES => array(
'vectorface/php5.4',
'vectorface/php5.5',
'vectorface/php5.6',
'vectorface/hhvm'
),
self::OPTIONS_KEY_SYNTAX => true,
self::OPTIONS_KEY_SYNTAXCOMMAND => 'find /opt/source -type f -name "*.php" ! -path "*/vendor/*" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v "No syntax errors"',
self::OPTIONS_KEY_UNITTESTS => true,
self::OPTIONS_KEY_UNITTESTSCOMMAND => '/opt/source/vendor/bin/phpunit',
self::OPTIONS_KEY_PULL => false,
);
} | php | private function getDefaultOptions()
{
// the list of default options if no config is found or specified
return array(
self::OPTIONS_KEY_IMAGES => array(
'vectorface/php5.4',
'vectorface/php5.5',
'vectorface/php5.6',
'vectorface/hhvm'
),
self::OPTIONS_KEY_SYNTAX => true,
self::OPTIONS_KEY_SYNTAXCOMMAND => 'find /opt/source -type f -name "*.php" ! -path "*/vendor/*" -print0 | xargs -0 -n 1 -P 8 php -l | grep -v "No syntax errors"',
self::OPTIONS_KEY_UNITTESTS => true,
self::OPTIONS_KEY_UNITTESTSCOMMAND => '/opt/source/vendor/bin/phpunit',
self::OPTIONS_KEY_PULL => false,
);
} | [
"private",
"function",
"getDefaultOptions",
"(",
")",
"{",
"// the list of default options if no config is found or specified",
"return",
"array",
"(",
"self",
"::",
"OPTIONS_KEY_IMAGES",
"=>",
"array",
"(",
"'vectorface/php5.4'",
",",
"'vectorface/php5.5'",
",",
"'vectorface... | Returns an array of built-in options if none are found or specified.
@return array The array of deafult options. | [
"Returns",
"an",
"array",
"of",
"built",
"-",
"in",
"options",
"if",
"none",
"are",
"found",
"or",
"specified",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L267-L283 |
42,753 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.mergeConfigFileIntoOptions | private function mergeConfigFileIntoOptions($options, $configFile)
{
$configFile = ($configFile) ?: realpath(getcwd()).'/.dunitconfig';
if (file_exists($configFile) && is_readable($configFile)) {
if (false !== ($settings = parse_ini_file($configFile))) {
return array_merge($options, $settings);
}
}
throw new Exception(
'WARNING: Config file could not be read. Falling back to built-in defaults.'
);
} | php | private function mergeConfigFileIntoOptions($options, $configFile)
{
$configFile = ($configFile) ?: realpath(getcwd()).'/.dunitconfig';
if (file_exists($configFile) && is_readable($configFile)) {
if (false !== ($settings = parse_ini_file($configFile))) {
return array_merge($options, $settings);
}
}
throw new Exception(
'WARNING: Config file could not be read. Falling back to built-in defaults.'
);
} | [
"private",
"function",
"mergeConfigFileIntoOptions",
"(",
"$",
"options",
",",
"$",
"configFile",
")",
"{",
"$",
"configFile",
"=",
"(",
"$",
"configFile",
")",
"?",
":",
"realpath",
"(",
"getcwd",
"(",
")",
")",
".",
"'/.dunitconfig'",
";",
"if",
"(",
"... | Merges the default options with values from the config file specified.
@param array $options The current options.
@param string $configFile The path to the config file. If the config
file specified is not valid the method will fall back to the
default config file location (./.dunitconfig)
@return array Returns the array of merged settings.
@throws Exception Throws an exception if no config file can be found. | [
"Merges",
"the",
"default",
"options",
"with",
"values",
"from",
"the",
"config",
"file",
"specified",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L294-L305 |
42,754 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.mergeEnvironmentVariablesIntoOptions | private function mergeEnvironmentVariablesIntoOptions($options)
{
// map environment variables to script options
foreach (self::$optionsMap as $env => $option) {
if (false !== ($value = getenv($env))) {
$options[$option] = (string)$value;
}
}
return $options;
} | php | private function mergeEnvironmentVariablesIntoOptions($options)
{
// map environment variables to script options
foreach (self::$optionsMap as $env => $option) {
if (false !== ($value = getenv($env))) {
$options[$option] = (string)$value;
}
}
return $options;
} | [
"private",
"function",
"mergeEnvironmentVariablesIntoOptions",
"(",
"$",
"options",
")",
"{",
"// map environment variables to script options",
"foreach",
"(",
"self",
"::",
"$",
"optionsMap",
"as",
"$",
"env",
"=>",
"$",
"option",
")",
"{",
"if",
"(",
"false",
"!... | Merges in the value of the environment variables into the settings.
@param array $options The current settings.
@return array The merged settings with the environment variables. | [
"Merges",
"in",
"the",
"value",
"of",
"the",
"environment",
"variables",
"into",
"the",
"settings",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L312-L321 |
42,755 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.getArrayOption | private function getArrayOption(InputInterface $input, $key, $default)
{
$value = trim((string)$input->getOption($key));
if (strlen($value)) {
$current = $this->parseStringToArray($input->getOption($key));
if (!empty($current)) {
return $current;
}
}
return is_string($default) ? $this->parseStringToArray($default) : $default;
} | php | private function getArrayOption(InputInterface $input, $key, $default)
{
$value = trim((string)$input->getOption($key));
if (strlen($value)) {
$current = $this->parseStringToArray($input->getOption($key));
if (!empty($current)) {
return $current;
}
}
return is_string($default) ? $this->parseStringToArray($default) : $default;
} | [
"private",
"function",
"getArrayOption",
"(",
"InputInterface",
"$",
"input",
",",
"$",
"key",
",",
"$",
"default",
")",
"{",
"$",
"value",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"input",
"->",
"getOption",
"(",
"$",
"key",
")",
")",
";",
"if",
... | Retrieves the given key from the input options as an array and uses
the default value if not found or empty.
@param InputInterface $input The input for options.
@param string $key The input key for the option.
@param mixed $default current value for the images.
@return array Returns the list of images as an array. | [
"Retrieves",
"the",
"given",
"key",
"from",
"the",
"input",
"options",
"as",
"an",
"array",
"and",
"uses",
"the",
"default",
"value",
"if",
"not",
"found",
"or",
"empty",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L331-L341 |
42,756 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.parseStringToArray | private function parseStringToArray($string)
{
// convert commas to spaces
$string = str_replace(',', ' ', $string);
// convert new lines to spaces
$string = str_replace(PHP_EOL, ' ', $string);
// split on the spaces and filter out empty elements
return array_values(
array_filter(
array_map(
'trim',
explode(' ', $string)
),
'strlen'
)
);
} | php | private function parseStringToArray($string)
{
// convert commas to spaces
$string = str_replace(',', ' ', $string);
// convert new lines to spaces
$string = str_replace(PHP_EOL, ' ', $string);
// split on the spaces and filter out empty elements
return array_values(
array_filter(
array_map(
'trim',
explode(' ', $string)
),
'strlen'
)
);
} | [
"private",
"function",
"parseStringToArray",
"(",
"$",
"string",
")",
"{",
"// convert commas to spaces",
"$",
"string",
"=",
"str_replace",
"(",
"','",
",",
"' '",
",",
"$",
"string",
")",
";",
"// convert new lines to spaces",
"$",
"string",
"=",
"str_replace",
... | Parses a string into an array by splitting on spaces, commas or
new line characters and stripping out any empty elements.
@param string $string The input string.
@return array Returns the list of elements as an array. | [
"Parses",
"a",
"string",
"into",
"an",
"array",
"by",
"splitting",
"on",
"spaces",
"commas",
"or",
"new",
"line",
"characters",
"and",
"stripping",
"out",
"any",
"empty",
"elements",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L349-L365 |
42,757 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.getBooleanOption | private function getBooleanOption(InputInterface $input, $key, $default)
{
$value = trim((string)$input->getOption($key));
if (strlen($value)) {
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
return filter_var($default, FILTER_VALIDATE_BOOLEAN);
} | php | private function getBooleanOption(InputInterface $input, $key, $default)
{
$value = trim((string)$input->getOption($key));
if (strlen($value)) {
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
return filter_var($default, FILTER_VALIDATE_BOOLEAN);
} | [
"private",
"function",
"getBooleanOption",
"(",
"InputInterface",
"$",
"input",
",",
"$",
"key",
",",
"$",
"default",
")",
"{",
"$",
"value",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"input",
"->",
"getOption",
"(",
"$",
"key",
")",
")",
";",
"if",... | Retrieves the given key from the input options as a boolean.
@param InputInterface $input The input interface.
@param string $key The option key.
@param mixed $default The default value.
@return boolean Returns the boolean value of the option or the default
if the option is not found. | [
"Retrieves",
"the",
"given",
"key",
"from",
"the",
"input",
"options",
"as",
"a",
"boolean",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L375-L382 |
42,758 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.getStringOption | private function getStringOption(InputInterface $input, $key, $default)
{
$value = trim((string)$input->getOption($key));
if (strlen($value)) {
return $value;
}
return (string)$default;
} | php | private function getStringOption(InputInterface $input, $key, $default)
{
$value = trim((string)$input->getOption($key));
if (strlen($value)) {
return $value;
}
return (string)$default;
} | [
"private",
"function",
"getStringOption",
"(",
"InputInterface",
"$",
"input",
",",
"$",
"key",
",",
"$",
"default",
")",
"{",
"$",
"value",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"input",
"->",
"getOption",
"(",
"$",
"key",
")",
")",
";",
"if",
... | Retrieves the given key from the input options as a string.
@param InputInterface $input The input interface.
@param string $key The option key.
@param mixed $default The default value.
@return string Returns the string value of the option or the default if
if the option is not found. | [
"Retrieves",
"the",
"given",
"key",
"from",
"the",
"input",
"options",
"as",
"a",
"string",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L393-L400 |
42,759 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.commandExists | private function commandExists($command)
{
$response = trim(shell_exec(sprintf(
'which %s',
escapeshellarg($command)
)));
return !empty($response);
} | php | private function commandExists($command)
{
$response = trim(shell_exec(sprintf(
'which %s',
escapeshellarg($command)
)));
return !empty($response);
} | [
"private",
"function",
"commandExists",
"(",
"$",
"command",
")",
"{",
"$",
"response",
"=",
"trim",
"(",
"shell_exec",
"(",
"sprintf",
"(",
"'which %s'",
",",
"escapeshellarg",
"(",
"$",
"command",
")",
")",
")",
")",
";",
"return",
"!",
"empty",
"(",
... | Determines if a command exists on the current environment.
N.B. This function is not cross platform. The "which" command used is
not portable to Microsoft Windows OS. Feel free to provide a pull
request if you wish to use dunit on windows.
@param string $command The command to check
@return boolean Returns true if the command has been found and false,
otherwise. | [
"Determines",
"if",
"a",
"command",
"exists",
"on",
"the",
"current",
"environment",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L425-L432 |
42,760 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.executeCommandForImage | private function executeCommandForImage($image, $command)
{
passthru(sprintf(
self::DOCKER_COMMAND_FORMAT,
escapeshellarg($image),
intval($this->getColumns()),
$command
));
} | php | private function executeCommandForImage($image, $command)
{
passthru(sprintf(
self::DOCKER_COMMAND_FORMAT,
escapeshellarg($image),
intval($this->getColumns()),
$command
));
} | [
"private",
"function",
"executeCommandForImage",
"(",
"$",
"image",
",",
"$",
"command",
")",
"{",
"passthru",
"(",
"sprintf",
"(",
"self",
"::",
"DOCKER_COMMAND_FORMAT",
",",
"escapeshellarg",
"(",
"$",
"image",
")",
",",
"intval",
"(",
"$",
"this",
"->",
... | Executes an arbitrary command against the image.
@param string $image The docker image to use.
@param string $command The command to run inside the docker image. | [
"Executes",
"an",
"arbitrary",
"command",
"against",
"the",
"image",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L439-L447 |
42,761 | Vectorface/dunit | src/DunitCommand.php | DunitCommand.getColumns | private function getColumns()
{
$dimensions = $this->getApplication()->getTerminalDimensions();
if (is_array($dimensions) && count($dimensions) > self::DIMENSION_WIDTH) {
return $dimensions[self::DIMENSION_WIDTH];
} else {
return self::DEFAULT_WIDTH;
}
} | php | private function getColumns()
{
$dimensions = $this->getApplication()->getTerminalDimensions();
if (is_array($dimensions) && count($dimensions) > self::DIMENSION_WIDTH) {
return $dimensions[self::DIMENSION_WIDTH];
} else {
return self::DEFAULT_WIDTH;
}
} | [
"private",
"function",
"getColumns",
"(",
")",
"{",
"$",
"dimensions",
"=",
"$",
"this",
"->",
"getApplication",
"(",
")",
"->",
"getTerminalDimensions",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"dimensions",
")",
"&&",
"count",
"(",
"$",
"dimensi... | Returns the number of character columns in the terminal.
@return int The width of the terminal (in number of characters). | [
"Returns",
"the",
"number",
"of",
"character",
"columns",
"in",
"the",
"terminal",
"."
] | 3f04c7a8bef5ff100666e92db96e93f80a6640bf | https://github.com/Vectorface/dunit/blob/3f04c7a8bef5ff100666e92db96e93f80a6640bf/src/DunitCommand.php#L453-L461 |
42,762 | apisearch-io/apisearch-bundle | Command/ExportIndexCommand.php | ExportIndexCommand.exportToFile | public static function exportToFile(
string $file,
OutputInterface $output,
callable $queryItems
) {
$resource = fopen($file, 'w');
$i = 1;
$count = 0;
while (true) {
$items = $queryItems(Query::create('', $i, 500))->getItems();
if (empty($items)) {
break;
}
self::writeItemsToResource(
$resource,
$items
);
self::printPartialCountSaved($output, count($items));
$count += count($items);
++$i;
}
fclose($resource);
return $count;
} | php | public static function exportToFile(
string $file,
OutputInterface $output,
callable $queryItems
) {
$resource = fopen($file, 'w');
$i = 1;
$count = 0;
while (true) {
$items = $queryItems(Query::create('', $i, 500))->getItems();
if (empty($items)) {
break;
}
self::writeItemsToResource(
$resource,
$items
);
self::printPartialCountSaved($output, count($items));
$count += count($items);
++$i;
}
fclose($resource);
return $count;
} | [
"public",
"static",
"function",
"exportToFile",
"(",
"string",
"$",
"file",
",",
"OutputInterface",
"$",
"output",
",",
"callable",
"$",
"queryItems",
")",
"{",
"$",
"resource",
"=",
"fopen",
"(",
"$",
"file",
",",
"'w'",
")",
";",
"$",
"i",
"=",
"1",
... | Save items and return total imported.
@param string $file
@param OutputInterface $output
@param callable $queryItems
@return int | [
"Save",
"items",
"and",
"return",
"total",
"imported",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ExportIndexCommand.php#L86-L115 |
42,763 | apisearch-io/apisearch-bundle | Command/ExportIndexCommand.php | ExportIndexCommand.writeItemsToResource | private static function writeItemsToResource(
$resource,
array $items
) {
foreach ($items as $item) {
fputcsv($resource, [
$item->getId(),
$item->getType(),
json_encode($item->getMetadata()),
json_encode($item->getIndexedMetadata()),
json_encode($item->getSearchableMetadata()),
json_encode($item->getExactMatchingMetadata()),
json_encode($item->getSuggest()),
json_encode(
($item->getCoordinate() instanceof Coordinate)
? $item->getCoordinate()->toArray()
: null
),
]);
}
} | php | private static function writeItemsToResource(
$resource,
array $items
) {
foreach ($items as $item) {
fputcsv($resource, [
$item->getId(),
$item->getType(),
json_encode($item->getMetadata()),
json_encode($item->getIndexedMetadata()),
json_encode($item->getSearchableMetadata()),
json_encode($item->getExactMatchingMetadata()),
json_encode($item->getSuggest()),
json_encode(
($item->getCoordinate() instanceof Coordinate)
? $item->getCoordinate()->toArray()
: null
),
]);
}
} | [
"private",
"static",
"function",
"writeItemsToResource",
"(",
"$",
"resource",
",",
"array",
"$",
"items",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"fputcsv",
"(",
"$",
"resource",
",",
"[",
"$",
"item",
"->",
"getId",
"(",
... | Echo items as CSV.
@param resource $resource
@param Item[] $items | [
"Echo",
"items",
"as",
"CSV",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ExportIndexCommand.php#L123-L143 |
42,764 | apisearch-io/apisearch-bundle | Command/WithAppRepositoryBucketCommand.php | WithAppRepositoryBucketCommand.getRepositoryAndIndices | protected function getRepositoryAndIndices(
InputInterface $input,
OutputInterface $output
): array {
$appName = $input->getArgument('app-name');
$configuration = $this->repositoryBucket->getConfiguration();
if (!isset($configuration[$appName])) {
throw new Exception(sprintf('App %s not found under apisearch configuration', $appName));
}
$appId = $configuration[$appName]['app_id'];
self::printInfoMessage(
$output,
$this->getHeader(),
"App: <strong>{$appName} / {$appId}</strong>"
);
if (!$input->hasOption('index-name')) {
return [$configuration[$appName]['app_id'], []];
}
$indexNamesAsArray = $configuration[$appName]['indices'] ?? [];
$indices = array_map(function (string $indexName) use ($indexNamesAsArray, $appName, $output) {
if (!isset($indexNamesAsArray[$indexName])) {
throw new Exception(sprintf(
'Index %s not found under %s repository. Indices availables: %s',
$indexName,
$appName,
implode(', ', array_keys($indexNamesAsArray))
));
}
$indexId = $indexNamesAsArray[$indexName];
self::printInfoMessage(
$output,
$this->getHeader(),
"Index: <strong>{$indexName} / {$indexId}</strong>"
);
return IndexUUID::createById($indexId);
}, $input->getOption('index-name'));
return [
AppUUID::createById($appId),
$indices,
];
} | php | protected function getRepositoryAndIndices(
InputInterface $input,
OutputInterface $output
): array {
$appName = $input->getArgument('app-name');
$configuration = $this->repositoryBucket->getConfiguration();
if (!isset($configuration[$appName])) {
throw new Exception(sprintf('App %s not found under apisearch configuration', $appName));
}
$appId = $configuration[$appName]['app_id'];
self::printInfoMessage(
$output,
$this->getHeader(),
"App: <strong>{$appName} / {$appId}</strong>"
);
if (!$input->hasOption('index-name')) {
return [$configuration[$appName]['app_id'], []];
}
$indexNamesAsArray = $configuration[$appName]['indices'] ?? [];
$indices = array_map(function (string $indexName) use ($indexNamesAsArray, $appName, $output) {
if (!isset($indexNamesAsArray[$indexName])) {
throw new Exception(sprintf(
'Index %s not found under %s repository. Indices availables: %s',
$indexName,
$appName,
implode(', ', array_keys($indexNamesAsArray))
));
}
$indexId = $indexNamesAsArray[$indexName];
self::printInfoMessage(
$output,
$this->getHeader(),
"Index: <strong>{$indexName} / {$indexId}</strong>"
);
return IndexUUID::createById($indexId);
}, $input->getOption('index-name'));
return [
AppUUID::createById($appId),
$indices,
];
} | [
"protected",
"function",
"getRepositoryAndIndices",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"array",
"{",
"$",
"appName",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'app-name'",
")",
";",
"$",
"configuration",
"... | Check repository and indices existence.
@param InputInterface $input
@param OutputInterface $output
@return array
@throws Exception | [
"Check",
"repository",
"and",
"indices",
"existence",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/WithAppRepositoryBucketCommand.php#L59-L107 |
42,765 | apisearch-io/apisearch-bundle | Command/QueryCommand.php | QueryCommand.makeQueryAndPrintResults | public static function makeQueryAndPrintResults(
InputInterface $input,
OutputInterface $output,
callable $makeQuery
) {
$query = $input->getArgument('query');
self::printInfoMessage(
$output,
'Query / Page / Size',
sprintf('<strong>%s</strong> / %d / %d',
'' === $query
? '*'
: $query,
$input->getOption('page'),
$input->getOption('size')
)
);
try {
$result = $makeQuery(Query::create(
$input->getArgument('query'),
(int) $input->getOption('page'),
(int) $input->getOption('size')
));
self::printResult($output, $result);
} catch (ResourceNotAvailableException $exception) {
self::printInfoMessage(
$output,
self::getHeader(),
$output->writeln('Index not found. Skipping.')
);
}
} | php | public static function makeQueryAndPrintResults(
InputInterface $input,
OutputInterface $output,
callable $makeQuery
) {
$query = $input->getArgument('query');
self::printInfoMessage(
$output,
'Query / Page / Size',
sprintf('<strong>%s</strong> / %d / %d',
'' === $query
? '*'
: $query,
$input->getOption('page'),
$input->getOption('size')
)
);
try {
$result = $makeQuery(Query::create(
$input->getArgument('query'),
(int) $input->getOption('page'),
(int) $input->getOption('size')
));
self::printResult($output, $result);
} catch (ResourceNotAvailableException $exception) {
self::printInfoMessage(
$output,
self::getHeader(),
$output->writeln('Index not found. Skipping.')
);
}
} | [
"public",
"static",
"function",
"makeQueryAndPrintResults",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"callable",
"$",
"makeQuery",
")",
"{",
"$",
"query",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'query'",
")",
";",... | Make query and print results.
@param InputInterface $input
@param OutputInterface $output
@param callable $makeQuery | [
"Make",
"query",
"and",
"print",
"results",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/QueryCommand.php#L106-L140 |
42,766 | apisearch-io/apisearch-bundle | Command/QueryCommand.php | QueryCommand.printResult | public static function printResult(
OutputInterface $output,
Result $result
) {
self::printInfoMessage(
$output,
'Number of resources in index',
$result->getTotalItems()
);
self::printInfoMessage(
$output,
'Number of hits',
$result->getTotalHits()
);
$output->writeln('');
foreach ($result->getItems() as $item) {
$firstStringPosition = array_reduce($item->getAllMetadata(), function ($carry, $element) {
return is_string($carry)
? $carry
: (
is_string($element)
? $element
: null
);
}, null);
self::printInfoMessage(
$output,
'x',
sprintf('%s - %s',
$item->getUUID()->composeUUID(),
substr((string) $firstStringPosition, 0, 50)
)
);
}
} | php | public static function printResult(
OutputInterface $output,
Result $result
) {
self::printInfoMessage(
$output,
'Number of resources in index',
$result->getTotalItems()
);
self::printInfoMessage(
$output,
'Number of hits',
$result->getTotalHits()
);
$output->writeln('');
foreach ($result->getItems() as $item) {
$firstStringPosition = array_reduce($item->getAllMetadata(), function ($carry, $element) {
return is_string($carry)
? $carry
: (
is_string($element)
? $element
: null
);
}, null);
self::printInfoMessage(
$output,
'x',
sprintf('%s - %s',
$item->getUUID()->composeUUID(),
substr((string) $firstStringPosition, 0, 50)
)
);
}
} | [
"public",
"static",
"function",
"printResult",
"(",
"OutputInterface",
"$",
"output",
",",
"Result",
"$",
"result",
")",
"{",
"self",
"::",
"printInfoMessage",
"(",
"$",
"output",
",",
"'Number of resources in index'",
",",
"$",
"result",
"->",
"getTotalItems",
... | Print results.
@param OutputInterface $output
@param Result $result | [
"Print",
"results",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/QueryCommand.php#L148-L186 |
42,767 | apisearch-io/apisearch-bundle | Command/ImportIndexCommand.php | ImportIndexCommand.importFromFile | public static function importFromFile(
string $file,
OutputInterface $output,
callable $saveItems
): int {
$itemsBuffer = [];
$itemsNb = 0;
if (false !== ($handle = fopen($file, 'r'))) {
while (false !== ($data = fgetcsv($handle, 0, ','))) {
$itemAsArray = [
'uuid' => [
'id' => $data[0],
'type' => $data[1],
],
'metadata' => json_decode($data[2], true),
'indexed_metadata' => json_decode($data[3], true),
'searchable_metadata' => json_decode($data[4], true),
'exact_matching_metadata' => json_decode($data[5], true),
'suggest' => json_decode($data[6], true),
];
if (is_array($data[7])) {
$itemAsArray['coordinate'] = $data[7];
}
$item = Item::createFromArray($itemAsArray);
$itemsBuffer[] = $item;
++$itemsNb;
if (count($itemsBuffer) >= 500) {
$saveItems($itemsBuffer, false);
self::printPartialCountSaved($output, count($itemsBuffer));
$itemsBuffer = [];
}
}
$saveItems($itemsBuffer, true);
self::printPartialCountSaved($output, count($itemsBuffer));
}
fclose($handle);
return $itemsNb;
} | php | public static function importFromFile(
string $file,
OutputInterface $output,
callable $saveItems
): int {
$itemsBuffer = [];
$itemsNb = 0;
if (false !== ($handle = fopen($file, 'r'))) {
while (false !== ($data = fgetcsv($handle, 0, ','))) {
$itemAsArray = [
'uuid' => [
'id' => $data[0],
'type' => $data[1],
],
'metadata' => json_decode($data[2], true),
'indexed_metadata' => json_decode($data[3], true),
'searchable_metadata' => json_decode($data[4], true),
'exact_matching_metadata' => json_decode($data[5], true),
'suggest' => json_decode($data[6], true),
];
if (is_array($data[7])) {
$itemAsArray['coordinate'] = $data[7];
}
$item = Item::createFromArray($itemAsArray);
$itemsBuffer[] = $item;
++$itemsNb;
if (count($itemsBuffer) >= 500) {
$saveItems($itemsBuffer, false);
self::printPartialCountSaved($output, count($itemsBuffer));
$itemsBuffer = [];
}
}
$saveItems($itemsBuffer, true);
self::printPartialCountSaved($output, count($itemsBuffer));
}
fclose($handle);
return $itemsNb;
} | [
"public",
"static",
"function",
"importFromFile",
"(",
"string",
"$",
"file",
",",
"OutputInterface",
"$",
"output",
",",
"callable",
"$",
"saveItems",
")",
":",
"int",
"{",
"$",
"itemsBuffer",
"=",
"[",
"]",
";",
"$",
"itemsNb",
"=",
"0",
";",
"if",
"... | Import from file and return total number of elements.
@param string $file
@param OutputInterface $output
@param callable $saveItems
@return int | [
"Import",
"from",
"file",
"and",
"return",
"total",
"number",
"of",
"elements",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ImportIndexCommand.php#L88-L133 |
42,768 | apisearch-io/apisearch-bundle | Command/ImportIndexCommand.php | ImportIndexCommand.printPartialCountSaved | private static function printPartialCountSaved(
OutputInterface $output,
int $count
) {
self::printInfoMessage(
$output,
self::getHeader(),
sprintf('Partial import of %d items', $count)
);
} | php | private static function printPartialCountSaved(
OutputInterface $output,
int $count
) {
self::printInfoMessage(
$output,
self::getHeader(),
sprintf('Partial import of %d items', $count)
);
} | [
"private",
"static",
"function",
"printPartialCountSaved",
"(",
"OutputInterface",
"$",
"output",
",",
"int",
"$",
"count",
")",
"{",
"self",
"::",
"printInfoMessage",
"(",
"$",
"output",
",",
"self",
"::",
"getHeader",
"(",
")",
",",
"sprintf",
"(",
"'Parti... | Print partial save.
@param OutputInterface $output
@param int $count | [
"Print",
"partial",
"save",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ImportIndexCommand.php#L141-L150 |
42,769 | ezdeliveryco/snorlax | src/RestResource.php | RestResource.getPath | private function getPath(array $action, array $args)
{
$pattern = '/{(\d+)}/';
$callback = function ($matches) use ($args) {
return $args[$matches[1]];
};
return preg_replace_callback($pattern, $callback, $action['path']);
} | php | private function getPath(array $action, array $args)
{
$pattern = '/{(\d+)}/';
$callback = function ($matches) use ($args) {
return $args[$matches[1]];
};
return preg_replace_callback($pattern, $callback, $action['path']);
} | [
"private",
"function",
"getPath",
"(",
"array",
"$",
"action",
",",
"array",
"$",
"args",
")",
"{",
"$",
"pattern",
"=",
"'/{(\\d+)}/'",
";",
"$",
"callback",
"=",
"function",
"(",
"$",
"matches",
")",
"use",
"(",
"$",
"args",
")",
"{",
"return",
"$"... | Returns the URI path for the request
@param array $action
@param array $args
@return mixed | [
"Returns",
"the",
"URI",
"path",
"for",
"the",
"request"
] | b7f40413f5954c6c71f7f9a7c7accfd1ec87d606 | https://github.com/ezdeliveryco/snorlax/blob/b7f40413f5954c6c71f7f9a7c7accfd1ec87d606/src/RestResource.php#L69-L77 |
42,770 | ezdeliveryco/snorlax | src/RestResource.php | RestResource.getParams | private function getParams(array $args)
{
if (count($args) == 0) {
return [];
}
$params = array_slice($args, -1)[0];
return is_array($params) ? $params : [];
} | php | private function getParams(array $args)
{
if (count($args) == 0) {
return [];
}
$params = array_slice($args, -1)[0];
return is_array($params) ? $params : [];
} | [
"private",
"function",
"getParams",
"(",
"array",
"$",
"args",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"0",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"params",
"=",
"array_slice",
"(",
"$",
"args",
",",
"-",
"1",
")",
"[",... | Extracts the params from the arguments passed
@param $args array
@return array | [
"Extracts",
"the",
"params",
"from",
"the",
"arguments",
"passed"
] | b7f40413f5954c6c71f7f9a7c7accfd1ec87d606 | https://github.com/ezdeliveryco/snorlax/blob/b7f40413f5954c6c71f7f9a7c7accfd1ec87d606/src/RestResource.php#L86-L95 |
42,771 | apisearch-io/apisearch-bundle | Command/ApisearchCommand.php | ApisearchCommand.configureFormatter | protected static function configureFormatter(OutputInterface $output)
{
$formatter = $output->getFormatter();
$formatter->setStyle('system', new OutputFormatterStyle('green'));
$formatter->setStyle('line', new OutputFormatterStyle('yellow'));
$formatter->setStyle('fail', new OutputFormatterStyle('red'));
$formatter->setStyle('info', new OutputFormatterStyle('blue'));
$formatter->setStyle('body', new OutputFormatterStyle('white'));
$formatter->setStyle('strong', new OutputFormatterStyle(null, null, ['bold']));
} | php | protected static function configureFormatter(OutputInterface $output)
{
$formatter = $output->getFormatter();
$formatter->setStyle('system', new OutputFormatterStyle('green'));
$formatter->setStyle('line', new OutputFormatterStyle('yellow'));
$formatter->setStyle('fail', new OutputFormatterStyle('red'));
$formatter->setStyle('info', new OutputFormatterStyle('blue'));
$formatter->setStyle('body', new OutputFormatterStyle('white'));
$formatter->setStyle('strong', new OutputFormatterStyle(null, null, ['bold']));
} | [
"protected",
"static",
"function",
"configureFormatter",
"(",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"formatter",
"=",
"$",
"output",
"->",
"getFormatter",
"(",
")",
";",
"$",
"formatter",
"->",
"setStyle",
"(",
"'system'",
",",
"new",
"OutputFormatt... | Configure formatter with Apisearch specific style.
@param OutputInterface $output | [
"Configure",
"formatter",
"with",
"Apisearch",
"specific",
"style",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ApisearchCommand.php#L70-L79 |
42,772 | apisearch-io/apisearch-bundle | Command/ApisearchCommand.php | ApisearchCommand.printSystemMessage | protected static function printSystemMessage(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'system'
);
} | php | protected static function printSystemMessage(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'system'
);
} | [
"protected",
"static",
"function",
"printSystemMessage",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
")",
"{",
"self",
"::",
"printStructureMessage",
"(",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
",",
"'system'",
... | Print system message.
@param OutputInterface $output
@param string $header
@param string $body | [
"Print",
"system",
"message",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ApisearchCommand.php#L88-L99 |
42,773 | apisearch-io/apisearch-bundle | Command/ApisearchCommand.php | ApisearchCommand.printMessage | protected static function printMessage(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'line'
);
} | php | protected static function printMessage(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'line'
);
} | [
"protected",
"static",
"function",
"printMessage",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
")",
"{",
"self",
"::",
"printStructureMessage",
"(",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
",",
"'line'",
")",
... | Print line message.
@param OutputInterface $output
@param string $header
@param string $body | [
"Print",
"line",
"message",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ApisearchCommand.php#L108-L119 |
42,774 | apisearch-io/apisearch-bundle | Command/ApisearchCommand.php | ApisearchCommand.printInfoMessage | protected static function printInfoMessage(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'info'
);
} | php | protected static function printInfoMessage(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'info'
);
} | [
"protected",
"static",
"function",
"printInfoMessage",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
")",
"{",
"self",
"::",
"printStructureMessage",
"(",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
",",
"'info'",
")... | Print info message.
@param OutputInterface $output
@param string $header
@param string $body | [
"Print",
"info",
"message",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ApisearchCommand.php#L128-L139 |
42,775 | apisearch-io/apisearch-bundle | Command/ApisearchCommand.php | ApisearchCommand.printMessageFail | protected static function printMessageFail(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'fail'
);
} | php | protected static function printMessageFail(
OutputInterface $output,
$header,
$body
) {
self::printStructureMessage(
$output,
$header,
$body,
'fail'
);
} | [
"protected",
"static",
"function",
"printMessageFail",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
")",
"{",
"self",
"::",
"printStructureMessage",
"(",
"$",
"output",
",",
"$",
"header",
",",
"$",
"body",
",",
"'fail'",
")... | Print fail message.
@param OutputInterface $output
@param string $header
@param string $body | [
"Print",
"fail",
"message",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ApisearchCommand.php#L148-L159 |
42,776 | apisearch-io/apisearch-bundle | Command/ApisearchCommand.php | ApisearchCommand.getEndpoints | protected function getEndpoints(InputInterface $input): array
{
$endpointsName = $input->getOption('endpoint');
$endpoints = Endpoints::filter($endpointsName);
if (count($endpointsName) > count($endpoints)) {
throw new Exception(sprintf(
'Endpoint not found. Endpoints available: %s',
implode(', ', array_keys(Endpoints::all()))
));
}
return $endpoints;
} | php | protected function getEndpoints(InputInterface $input): array
{
$endpointsName = $input->getOption('endpoint');
$endpoints = Endpoints::filter($endpointsName);
if (count($endpointsName) > count($endpoints)) {
throw new Exception(sprintf(
'Endpoint not found. Endpoints available: %s',
implode(', ', array_keys(Endpoints::all()))
));
}
return $endpoints;
} | [
"protected",
"function",
"getEndpoints",
"(",
"InputInterface",
"$",
"input",
")",
":",
"array",
"{",
"$",
"endpointsName",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'endpoint'",
")",
";",
"$",
"endpoints",
"=",
"Endpoints",
"::",
"filter",
"(",
"$",
"en... | Get endpoint compositions given their names.
@param InputInterface $input
@return array
@throws Exception | [
"Get",
"endpoint",
"compositions",
"given",
"their",
"names",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/ApisearchCommand.php#L219-L232 |
42,777 | apisearch-io/apisearch-bundle | Command/PrintTokensCommand.php | PrintTokensCommand.printTokens | public static function printTokens(
InputInterface $input,
OutputInterface $output,
array $tokens
) {
$withMetadata = $input->getOption('with-metadata');
$table = new Table($output);
$headers = ['UUID', 'Indices', 'endpoints', 'plugins', 'ttl'];
if ($withMetadata) {
$headers[] = 'Metadata';
}
$table->setHeaders($headers);
foreach ($tokens as $token) {
$row = [
$token->getTokenUUID()->composeUUID(),
implode(', ', array_map(function (IndexUUID $index) {
return $index->composeUUID();
}, $token->getIndices())),
implode(', ', $token->getEndpoints()),
implode(', ', $token->getPlugins()),
$token->getTtl(),
];
if ($withMetadata) {
$metadataRow = [];
foreach ($token->getMetadata() as $metadataField => $metadataValue) {
$metadataRow[] = sprintf("$metadataField = %s",
is_bool($metadataValue)
? $metadataValue ? 'true' : 'false'
: (
is_array($metadataValue)
? implode(', ', $metadataValue)
: (string) $metadataValue
)
);
}
$row[] = implode(PHP_EOL, $metadataRow);
}
$table->addRow($row);
}
$table->render();
} | php | public static function printTokens(
InputInterface $input,
OutputInterface $output,
array $tokens
) {
$withMetadata = $input->getOption('with-metadata');
$table = new Table($output);
$headers = ['UUID', 'Indices', 'endpoints', 'plugins', 'ttl'];
if ($withMetadata) {
$headers[] = 'Metadata';
}
$table->setHeaders($headers);
foreach ($tokens as $token) {
$row = [
$token->getTokenUUID()->composeUUID(),
implode(', ', array_map(function (IndexUUID $index) {
return $index->composeUUID();
}, $token->getIndices())),
implode(', ', $token->getEndpoints()),
implode(', ', $token->getPlugins()),
$token->getTtl(),
];
if ($withMetadata) {
$metadataRow = [];
foreach ($token->getMetadata() as $metadataField => $metadataValue) {
$metadataRow[] = sprintf("$metadataField = %s",
is_bool($metadataValue)
? $metadataValue ? 'true' : 'false'
: (
is_array($metadataValue)
? implode(', ', $metadataValue)
: (string) $metadataValue
)
);
}
$row[] = implode(PHP_EOL, $metadataRow);
}
$table->addRow($row);
}
$table->render();
} | [
"public",
"static",
"function",
"printTokens",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"tokens",
")",
"{",
"$",
"withMetadata",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'with-metadata'",
")",
";",
"$"... | Print tokens.
@param InputInterface $input
@param OutputInterface $output
@param Token[] $tokens | [
"Print",
"tokens",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/PrintTokensCommand.php#L103-L147 |
42,778 | ezdeliveryco/snorlax | src/RestPool.php | RestPool.addResource | public function addResource($name, RestClient $client, $route, $params = [])
{
$this->resources[$name] = $this->buildRequest($client, $route, $params);
} | php | public function addResource($name, RestClient $client, $route, $params = [])
{
$this->resources[$name] = $this->buildRequest($client, $route, $params);
} | [
"public",
"function",
"addResource",
"(",
"$",
"name",
",",
"RestClient",
"$",
"client",
",",
"$",
"route",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"resources",
"[",
"$",
"name",
"]",
"=",
"$",
"this",
"->",
"buildRequest",
... | Add new resource to request pool
@param string $name
@param RestClient $client
@param string $route
@param array $params | [
"Add",
"new",
"resource",
"to",
"request",
"pool"
] | b7f40413f5954c6c71f7f9a7c7accfd1ec87d606 | https://github.com/ezdeliveryco/snorlax/blob/b7f40413f5954c6c71f7f9a7c7accfd1ec87d606/src/RestPool.php#L29-L32 |
42,779 | ezdeliveryco/snorlax | src/RestPool.php | RestPool.buildRequest | private function buildRequest($client, $route, $params)
{
list($resource, $method) = $this->explodeRoute($route);
if (array_key_exists('parameters', $params)) {
$parameters = $params['parameters'];
unset($params['parameters']);
return call_user_func_array(
[ $client->setAsync()->{$resource}, $method ],
array_merge($parameters, [$params])
);
}
return $client->setAsync()->{$resource}->{$method}($params);
} | php | private function buildRequest($client, $route, $params)
{
list($resource, $method) = $this->explodeRoute($route);
if (array_key_exists('parameters', $params)) {
$parameters = $params['parameters'];
unset($params['parameters']);
return call_user_func_array(
[ $client->setAsync()->{$resource}, $method ],
array_merge($parameters, [$params])
);
}
return $client->setAsync()->{$resource}->{$method}($params);
} | [
"private",
"function",
"buildRequest",
"(",
"$",
"client",
",",
"$",
"route",
",",
"$",
"params",
")",
"{",
"list",
"(",
"$",
"resource",
",",
"$",
"method",
")",
"=",
"$",
"this",
"->",
"explodeRoute",
"(",
"$",
"route",
")",
";",
"if",
"(",
"arra... | Build a async request using the injected client
@param RestClient $client
@param string $route
@param array $params
@return RestClient | [
"Build",
"a",
"async",
"request",
"using",
"the",
"injected",
"client"
] | b7f40413f5954c6c71f7f9a7c7accfd1ec87d606 | https://github.com/ezdeliveryco/snorlax/blob/b7f40413f5954c6c71f7f9a7c7accfd1ec87d606/src/RestPool.php#L43-L58 |
42,780 | ezdeliveryco/snorlax | src/RestPool.php | RestPool.send | public function send()
{
$responses = new \StdClass();
foreach ($this->resources as $key => $promise) {
$response = $promise->wait();
$responses->{$key} = $this->parse($response->getBody());
}
return $responses;
} | php | public function send()
{
$responses = new \StdClass();
foreach ($this->resources as $key => $promise) {
$response = $promise->wait();
$responses->{$key} = $this->parse($response->getBody());
}
return $responses;
} | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"responses",
"=",
"new",
"\\",
"StdClass",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"resources",
"as",
"$",
"key",
"=>",
"$",
"promise",
")",
"{",
"$",
"response",
"=",
"$",
"promise",
"->"... | Send and parse the request pool
@return \StdClass | [
"Send",
"and",
"parse",
"the",
"request",
"pool"
] | b7f40413f5954c6c71f7f9a7c7accfd1ec87d606 | https://github.com/ezdeliveryco/snorlax/blob/b7f40413f5954c6c71f7f9a7c7accfd1ec87d606/src/RestPool.php#L85-L95 |
42,781 | ezdeliveryco/snorlax | src/RestClient.php | RestClient.createDefaultClient | private function createDefaultClient(array $params)
{
$stack = HandlerStack::create();
if (isset($params['cache']) && $params['cache'] === true) {
$cache = new CacheMiddleware($this->getCacheStrategy());
$stack->push($cache, 'snorlax-cache');
}
if (isset($params['log']) && $params['log'] === true) {
$logger = new Logger($this->getLogger());
$logger->setLogLevel(LogLevel::DEBUG);
$logger->setRequestLoggingEnabled();
$logger->setFormatter(new MessageFormatter(
'REQ "{method} {target} HTTP/{version}"',
'RES "{method} {target} HTTP/{version}" {code}'
));
$stack->push($logger, 'snorlax-logger');
}
$params = array_merge($params, ['handler' => $stack]);
return new Client($params);
} | php | private function createDefaultClient(array $params)
{
$stack = HandlerStack::create();
if (isset($params['cache']) && $params['cache'] === true) {
$cache = new CacheMiddleware($this->getCacheStrategy());
$stack->push($cache, 'snorlax-cache');
}
if (isset($params['log']) && $params['log'] === true) {
$logger = new Logger($this->getLogger());
$logger->setLogLevel(LogLevel::DEBUG);
$logger->setRequestLoggingEnabled();
$logger->setFormatter(new MessageFormatter(
'REQ "{method} {target} HTTP/{version}"',
'RES "{method} {target} HTTP/{version}" {code}'
));
$stack->push($logger, 'snorlax-logger');
}
$params = array_merge($params, ['handler' => $stack]);
return new Client($params);
} | [
"private",
"function",
"createDefaultClient",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"stack",
"=",
"HandlerStack",
"::",
"create",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'cache'",
"]",
")",
"&&",
"$",
"params",
"[",
"'cache'"... | Creates a new default client based on the given parameters
@param array $params
@return \GuzzleHttp\Client | [
"Creates",
"a",
"new",
"default",
"client",
"based",
"on",
"the",
"given",
"parameters"
] | b7f40413f5954c6c71f7f9a7c7accfd1ec87d606 | https://github.com/ezdeliveryco/snorlax/blob/b7f40413f5954c6c71f7f9a7c7accfd1ec87d606/src/RestClient.php#L203-L228 |
42,782 | ezdeliveryco/snorlax | src/RestClient.php | RestClient.getResource | public function getResource($resource)
{
if (array_key_exists($resource, $this->cache)) {
return $this->cache[$resource];
}
if (!array_key_exists($resource, $this->resources)) {
throw new ResourceNotImplemented($resource);
}
$params = $this->resources[$resource];
$instance = $params['instance'];
if (is_null($instance)) {
$class = $params['class'];
$instance = new $class($this);
}
return $this->cache[$resource] = $instance;
} | php | public function getResource($resource)
{
if (array_key_exists($resource, $this->cache)) {
return $this->cache[$resource];
}
if (!array_key_exists($resource, $this->resources)) {
throw new ResourceNotImplemented($resource);
}
$params = $this->resources[$resource];
$instance = $params['instance'];
if (is_null($instance)) {
$class = $params['class'];
$instance = new $class($this);
}
return $this->cache[$resource] = $instance;
} | [
"public",
"function",
"getResource",
"(",
"$",
"resource",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"resource",
",",
"$",
"this",
"->",
"cache",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"[",
"$",
"resource",
"]",
";",
"}",
"if",... | Instantiates and returns the asked resource.
@param string $resource The resource name
@throws \Snorlax\Exception\ResourceNotImplemented If the resource is not available
@return \Snorlax\Resource The instantiated resource | [
"Instantiates",
"and",
"returns",
"the",
"asked",
"resource",
"."
] | b7f40413f5954c6c71f7f9a7c7accfd1ec87d606 | https://github.com/ezdeliveryco/snorlax/blob/b7f40413f5954c6c71f7f9a7c7accfd1ec87d606/src/RestClient.php#L238-L258 |
42,783 | apisearch-io/apisearch-bundle | DependencyInjection/CompilerPass/RepositoryCompilerPass.php | RepositoryCompilerPass.createClientRetryMap | private function createClientRetryMap(
ContainerBuilder $container,
string $name,
array $repositoryConfiguration
) {
if (!$this->repositoryIsHttp($repositoryConfiguration)) {
return;
}
$clientRetryMapName = rtrim("apisearch.retry_map_$name", '.');
$container
->register($clientRetryMapName, RetryMap::class)
->setFactory([
RetryMap::class,
'createFromArray',
])
->setArgument(0, $repositoryConfiguration['http']['retry_map']);
} | php | private function createClientRetryMap(
ContainerBuilder $container,
string $name,
array $repositoryConfiguration
) {
if (!$this->repositoryIsHttp($repositoryConfiguration)) {
return;
}
$clientRetryMapName = rtrim("apisearch.retry_map_$name", '.');
$container
->register($clientRetryMapName, RetryMap::class)
->setFactory([
RetryMap::class,
'createFromArray',
])
->setArgument(0, $repositoryConfiguration['http']['retry_map']);
} | [
"private",
"function",
"createClientRetryMap",
"(",
"ContainerBuilder",
"$",
"container",
",",
"string",
"$",
"name",
",",
"array",
"$",
"repositoryConfiguration",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"repositoryIsHttp",
"(",
"$",
"repositoryConfiguration"... | Create client retry map.
@param ContainerBuilder $container
@param string $name
@param string $name
@param array $repositoryConfiguration | [
"Create",
"client",
"retry",
"map",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/DependencyInjection/CompilerPass/RepositoryCompilerPass.php#L168-L185 |
42,784 | apisearch-io/apisearch-bundle | DependencyInjection/CompilerPass/RepositoryCompilerPass.php | RepositoryCompilerPass.createSearchRepository | private function createSearchRepository(
ContainerBuilder $container,
string $name,
array $repositoryConfiguration,
string $indexName
) {
$repositoryName = "apisearch.repository_$name.$indexName";
$repositoryTransformableName = "apisearch.repository_transformable_$name.$indexName";
$clientName = "apisearch.client_$name";
switch ($repositoryConfiguration['adapter']) {
case 'in_memory':
$repositoryDefinition = $container
->register($repositoryName, InMemoryRepository::class)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'disk':
$repositoryDefinition = $container
->register($repositoryName, DiskRepository::class)
->addArgument($repositoryConfiguration['disk_file'].'.'.$name)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'http':
case 'http_test':
$repositoryDefinition = $container
->register($repositoryName, HttpRepository::class)
->addArgument(new Reference($clientName))
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'service':
$container->setAlias($repositoryName, $repositoryConfiguration['search']['repository_service']);
$aliasDefinition = $container->getAlias($repositoryName);
$aliasDefinition->setPublic($this->repositoryIsTest($repositoryConfiguration));
$repositoryDefinition = $container->getDefinition($repositoryConfiguration['search']['repository_service']);
break;
}
$this->injectRepositoryCredentials(
$repositoryDefinition,
$name,
$repositoryConfiguration,
$indexName
);
$definition = $container
->register($repositoryTransformableName, TransformableRepository::class)
->setDecoratedService($repositoryName)
->addArgument(new Reference($repositoryTransformableName.'.inner'))
->addArgument(new Reference('apisearch.transformer'))
->setPublic($this->repositoryIsTest($repositoryConfiguration));
$this->injectRepositoryCredentials(
$definition,
$name,
$repositoryConfiguration,
$indexName
);
$container
->getDefinition('apisearch.repository_bucket')
->addMethodCall(
'addRepository',
[$name, $indexName, new Reference($repositoryName)]
)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
} | php | private function createSearchRepository(
ContainerBuilder $container,
string $name,
array $repositoryConfiguration,
string $indexName
) {
$repositoryName = "apisearch.repository_$name.$indexName";
$repositoryTransformableName = "apisearch.repository_transformable_$name.$indexName";
$clientName = "apisearch.client_$name";
switch ($repositoryConfiguration['adapter']) {
case 'in_memory':
$repositoryDefinition = $container
->register($repositoryName, InMemoryRepository::class)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'disk':
$repositoryDefinition = $container
->register($repositoryName, DiskRepository::class)
->addArgument($repositoryConfiguration['disk_file'].'.'.$name)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'http':
case 'http_test':
$repositoryDefinition = $container
->register($repositoryName, HttpRepository::class)
->addArgument(new Reference($clientName))
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'service':
$container->setAlias($repositoryName, $repositoryConfiguration['search']['repository_service']);
$aliasDefinition = $container->getAlias($repositoryName);
$aliasDefinition->setPublic($this->repositoryIsTest($repositoryConfiguration));
$repositoryDefinition = $container->getDefinition($repositoryConfiguration['search']['repository_service']);
break;
}
$this->injectRepositoryCredentials(
$repositoryDefinition,
$name,
$repositoryConfiguration,
$indexName
);
$definition = $container
->register($repositoryTransformableName, TransformableRepository::class)
->setDecoratedService($repositoryName)
->addArgument(new Reference($repositoryTransformableName.'.inner'))
->addArgument(new Reference('apisearch.transformer'))
->setPublic($this->repositoryIsTest($repositoryConfiguration));
$this->injectRepositoryCredentials(
$definition,
$name,
$repositoryConfiguration,
$indexName
);
$container
->getDefinition('apisearch.repository_bucket')
->addMethodCall(
'addRepository',
[$name, $indexName, new Reference($repositoryName)]
)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
} | [
"private",
"function",
"createSearchRepository",
"(",
"ContainerBuilder",
"$",
"container",
",",
"string",
"$",
"name",
",",
"array",
"$",
"repositoryConfiguration",
",",
"string",
"$",
"indexName",
")",
"{",
"$",
"repositoryName",
"=",
"\"apisearch.repository_$name.$... | Create a repository by connection configuration.
@param ContainerBuilder $container
@param string $name
@param array $repositoryConfiguration
@param string $indexName | [
"Create",
"a",
"repository",
"by",
"connection",
"configuration",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/DependencyInjection/CompilerPass/RepositoryCompilerPass.php#L233-L301 |
42,785 | apisearch-io/apisearch-bundle | DependencyInjection/CompilerPass/RepositoryCompilerPass.php | RepositoryCompilerPass.createStandardRepository | private function createStandardRepository(
ContainerBuilder $container,
string $appName,
array $repositoryConfiguration,
string $indexName,
string $prefix,
string $inMemoryRepositoryNamespace,
string $diskRepositoryNamespace,
string $httpRepositoryNamespace
) {
$repositoryName = rtrim("apisearch.{$prefix}_repository_$appName.$indexName", '.');
$tokenUUIDName = rtrim("apisearch.token_uuid.$appName");
$clientName = rtrim("apisearch.client_$appName", '.');
$tokenUUIDReference = $container->register($tokenUUIDName, TokenUUID::class);
$tokenUUIDReference
->setFactory([
TokenUUID::class,
'createById',
])
->addArgument((string) $repositoryConfiguration['token'])
->setPrivate(true);
$repositoryReferenceName = rtrim("apisearch.repository_reference.$appName.$indexName", '.');
$repositoryReferenceReference = new Reference($repositoryReferenceName);
switch ($repositoryConfiguration['adapter']) {
case 'in_memory':
$container
->register($repositoryName, $inMemoryRepositoryNamespace)
->addMethodCall('setRepositoryReference', [
$repositoryReferenceReference,
])
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'disk':
$container
->register($repositoryName, $diskRepositoryNamespace)
->addMethodCall('setRepositoryReference', [
$repositoryReferenceReference,
])
->addArgument($repositoryConfiguration['disk_file'].'.'.$prefix.'.'.$appName)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'http':
case 'http_test':
$container
->register($repositoryName, $httpRepositoryNamespace)
->addArgument(new Reference($clientName))
->addMethodCall('setCredentials', [
$repositoryReferenceReference,
new Reference($tokenUUIDName),
])
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'service':
$repoDefinition = $container->getDefinition($repositoryConfiguration[$prefix]['repository_service']);
$this->injectRepositoryCredentials(
$repoDefinition,
$appName,
$repositoryConfiguration,
$indexName
);
$container->setAlias($repositoryName, $repositoryConfiguration[$prefix]['repository_service']);
$aliasDefinition = $container->getAlias($repositoryName);
$aliasDefinition->setPublic($this->repositoryIsTest($repositoryConfiguration));
}
$container
->getDefinition("apisearch.{$prefix}_repository_bucket")
->addMethodCall(
'addRepository',
[$appName, new Reference($repositoryName)]
)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
} | php | private function createStandardRepository(
ContainerBuilder $container,
string $appName,
array $repositoryConfiguration,
string $indexName,
string $prefix,
string $inMemoryRepositoryNamespace,
string $diskRepositoryNamespace,
string $httpRepositoryNamespace
) {
$repositoryName = rtrim("apisearch.{$prefix}_repository_$appName.$indexName", '.');
$tokenUUIDName = rtrim("apisearch.token_uuid.$appName");
$clientName = rtrim("apisearch.client_$appName", '.');
$tokenUUIDReference = $container->register($tokenUUIDName, TokenUUID::class);
$tokenUUIDReference
->setFactory([
TokenUUID::class,
'createById',
])
->addArgument((string) $repositoryConfiguration['token'])
->setPrivate(true);
$repositoryReferenceName = rtrim("apisearch.repository_reference.$appName.$indexName", '.');
$repositoryReferenceReference = new Reference($repositoryReferenceName);
switch ($repositoryConfiguration['adapter']) {
case 'in_memory':
$container
->register($repositoryName, $inMemoryRepositoryNamespace)
->addMethodCall('setRepositoryReference', [
$repositoryReferenceReference,
])
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'disk':
$container
->register($repositoryName, $diskRepositoryNamespace)
->addMethodCall('setRepositoryReference', [
$repositoryReferenceReference,
])
->addArgument($repositoryConfiguration['disk_file'].'.'.$prefix.'.'.$appName)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'http':
case 'http_test':
$container
->register($repositoryName, $httpRepositoryNamespace)
->addArgument(new Reference($clientName))
->addMethodCall('setCredentials', [
$repositoryReferenceReference,
new Reference($tokenUUIDName),
])
->setPublic($this->repositoryIsTest($repositoryConfiguration));
break;
case 'service':
$repoDefinition = $container->getDefinition($repositoryConfiguration[$prefix]['repository_service']);
$this->injectRepositoryCredentials(
$repoDefinition,
$appName,
$repositoryConfiguration,
$indexName
);
$container->setAlias($repositoryName, $repositoryConfiguration[$prefix]['repository_service']);
$aliasDefinition = $container->getAlias($repositoryName);
$aliasDefinition->setPublic($this->repositoryIsTest($repositoryConfiguration));
}
$container
->getDefinition("apisearch.{$prefix}_repository_bucket")
->addMethodCall(
'addRepository',
[$appName, new Reference($repositoryName)]
)
->setPublic($this->repositoryIsTest($repositoryConfiguration));
} | [
"private",
"function",
"createStandardRepository",
"(",
"ContainerBuilder",
"$",
"container",
",",
"string",
"$",
"appName",
",",
"array",
"$",
"repositoryConfiguration",
",",
"string",
"$",
"indexName",
",",
"string",
"$",
"prefix",
",",
"string",
"$",
"inMemoryR... | Create standard repository.
@param ContainerBuilder $container
@param string $appName
@param array $repositoryConfiguration
@param string $indexName
@param string $prefix
@param string $inMemoryRepositoryNamespace
@param string $diskRepositoryNamespace
@param string $httpRepositoryNamespace | [
"Create",
"standard",
"repository",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/DependencyInjection/CompilerPass/RepositoryCompilerPass.php#L315-L394 |
42,786 | apisearch-io/apisearch-bundle | DependencyInjection/CompilerPass/RepositoryCompilerPass.php | RepositoryCompilerPass.injectRepositoryCredentials | private function injectRepositoryCredentials(
Definition $definition,
string $appName,
array $repositoryConfiguration,
string $indexName
) {
if ($repositoryConfiguration['app_id']) {
$repositoryReferenceName = rtrim("apisearch.repository_reference.$appName.$indexName", '.');
$tokenUUIDName = rtrim("apisearch.token_uuid.$appName");
$repositoryReferenceReference = new Reference($repositoryReferenceName);
$repositoryConfiguration['token']
? $definition->addMethodCall('setCredentials', [
$repositoryReferenceReference,
new Reference($tokenUUIDName),
])
: $definition->addMethodCall('setRepositoryReference', [
$repositoryReferenceReference,
]);
}
} | php | private function injectRepositoryCredentials(
Definition $definition,
string $appName,
array $repositoryConfiguration,
string $indexName
) {
if ($repositoryConfiguration['app_id']) {
$repositoryReferenceName = rtrim("apisearch.repository_reference.$appName.$indexName", '.');
$tokenUUIDName = rtrim("apisearch.token_uuid.$appName");
$repositoryReferenceReference = new Reference($repositoryReferenceName);
$repositoryConfiguration['token']
? $definition->addMethodCall('setCredentials', [
$repositoryReferenceReference,
new Reference($tokenUUIDName),
])
: $definition->addMethodCall('setRepositoryReference', [
$repositoryReferenceReference,
]);
}
} | [
"private",
"function",
"injectRepositoryCredentials",
"(",
"Definition",
"$",
"definition",
",",
"string",
"$",
"appName",
",",
"array",
"$",
"repositoryConfiguration",
",",
"string",
"$",
"indexName",
")",
"{",
"if",
"(",
"$",
"repositoryConfiguration",
"[",
"'ap... | Inject credentials in repository.
@param Definition $definition
@param string $appName
@param array $repositoryConfiguration
@param string $indexName | [
"Inject",
"credentials",
"in",
"repository",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/DependencyInjection/CompilerPass/RepositoryCompilerPass.php#L404-L424 |
42,787 | apisearch-io/apisearch-bundle | DependencyInjection/CompilerPass/RepositoryCompilerPass.php | RepositoryCompilerPass.createRepositoryReferenceServiceReference | private function createRepositoryReferenceServiceReference(
ContainerBuilder $container,
string $appName,
array $repositoryConfiguration,
string $indexId,
string $indexName
): Definition {
$repositoryReferenceName = rtrim("apisearch.repository_reference.$appName.$indexName", '.');
$appUUIDReference = $container->register("apisearch.app_uuid.$appName", AppUUID::class);
$appUUIDReference
->setFactory([
AppUUID::class,
'createById',
])
->addArgument((string) $repositoryConfiguration['app_id'])
->setPrivate(true);
$indexUUIDReference = $container->register("apisearch.index_uuid.$appName.$indexName", IndexUUID::class);
$indexUUIDReference
->setFactory([
IndexUUID::class,
'createById',
])
->addArgument((string) $indexId)
->setPrivate(true);
$reference = $container->register($repositoryReferenceName, RepositoryReference::class);
$reference
->setFactory([
RepositoryReference::class,
'create',
])
->addArgument(new Reference("apisearch.app_uuid.$appName"))
->addArgument(new Reference("apisearch.index_uuid.$appName.$indexName"))
->setPublic($this->repositoryIsTest($repositoryConfiguration));
return $reference;
} | php | private function createRepositoryReferenceServiceReference(
ContainerBuilder $container,
string $appName,
array $repositoryConfiguration,
string $indexId,
string $indexName
): Definition {
$repositoryReferenceName = rtrim("apisearch.repository_reference.$appName.$indexName", '.');
$appUUIDReference = $container->register("apisearch.app_uuid.$appName", AppUUID::class);
$appUUIDReference
->setFactory([
AppUUID::class,
'createById',
])
->addArgument((string) $repositoryConfiguration['app_id'])
->setPrivate(true);
$indexUUIDReference = $container->register("apisearch.index_uuid.$appName.$indexName", IndexUUID::class);
$indexUUIDReference
->setFactory([
IndexUUID::class,
'createById',
])
->addArgument((string) $indexId)
->setPrivate(true);
$reference = $container->register($repositoryReferenceName, RepositoryReference::class);
$reference
->setFactory([
RepositoryReference::class,
'create',
])
->addArgument(new Reference("apisearch.app_uuid.$appName"))
->addArgument(new Reference("apisearch.index_uuid.$appName.$indexName"))
->setPublic($this->repositoryIsTest($repositoryConfiguration));
return $reference;
} | [
"private",
"function",
"createRepositoryReferenceServiceReference",
"(",
"ContainerBuilder",
"$",
"container",
",",
"string",
"$",
"appName",
",",
"array",
"$",
"repositoryConfiguration",
",",
"string",
"$",
"indexId",
",",
"string",
"$",
"indexName",
")",
":",
"Def... | Crate Repository Reference service reference.
@param ContainerBuilder $container
@param string $appName
@param array $repositoryConfiguration
@param string $indexId
@param string $indexName
@return Definition | [
"Crate",
"Repository",
"Reference",
"service",
"reference",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/DependencyInjection/CompilerPass/RepositoryCompilerPass.php#L437-L474 |
42,788 | apisearch-io/apisearch-bundle | Command/PrintIndicesCommand.php | PrintIndicesCommand.printIndices | public static function printIndices(
InputInterface $input,
OutputInterface $output,
array $indices
) {
$hasIndices = !empty($indices);
$table = new Table($output);
$headers = ['UUID', 'App ID', 'Doc Count', 'Size', 'Ok?', 'shards', 'replicas'];
$withMetadata = $input->getOption('with-metadata');
$withFields = $input->getOption('with-fields');
if ($hasIndices && $withFields) {
$headers[] = 'Fields';
}
if ($hasIndices && $withMetadata) {
foreach ($indices[0]->getMetadata() as $field => $_) {
$headers[] = ucfirst($field);
}
}
$table->setHeaders($headers);
/*
* @var Index
*/
foreach ($indices as $index) {
$row = [
$index->getUUID()->composeUUID(),
$index->getAppUUID()->composeUUID(),
$index->getDocCount(),
$index->getSize(),
$index->isOK()
? 'Yes'
: 'No',
$index->getShards(),
$index->getReplicas(),
];
if ($withFields) {
$fields = $index->getFields();
array_walk($fields, function (string &$type, string $field) {
$type = "$field: $type";
});
$row[] = implode("\n", $fields);
}
if ($withMetadata) {
foreach ($index->getMetadata() as $_ => $value) {
$row[] = $value;
}
}
$table->addRow($row);
}
$table->render();
} | php | public static function printIndices(
InputInterface $input,
OutputInterface $output,
array $indices
) {
$hasIndices = !empty($indices);
$table = new Table($output);
$headers = ['UUID', 'App ID', 'Doc Count', 'Size', 'Ok?', 'shards', 'replicas'];
$withMetadata = $input->getOption('with-metadata');
$withFields = $input->getOption('with-fields');
if ($hasIndices && $withFields) {
$headers[] = 'Fields';
}
if ($hasIndices && $withMetadata) {
foreach ($indices[0]->getMetadata() as $field => $_) {
$headers[] = ucfirst($field);
}
}
$table->setHeaders($headers);
/*
* @var Index
*/
foreach ($indices as $index) {
$row = [
$index->getUUID()->composeUUID(),
$index->getAppUUID()->composeUUID(),
$index->getDocCount(),
$index->getSize(),
$index->isOK()
? 'Yes'
: 'No',
$index->getShards(),
$index->getReplicas(),
];
if ($withFields) {
$fields = $index->getFields();
array_walk($fields, function (string &$type, string $field) {
$type = "$field: $type";
});
$row[] = implode("\n", $fields);
}
if ($withMetadata) {
foreach ($index->getMetadata() as $_ => $value) {
$row[] = $value;
}
}
$table->addRow($row);
}
$table->render();
} | [
"public",
"static",
"function",
"printIndices",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"indices",
")",
"{",
"$",
"hasIndices",
"=",
"!",
"empty",
"(",
"$",
"indices",
")",
";",
"$",
"table",
"=",
"n... | Print indices.
@param InputInterface $input
@param OutputInterface $output
@param Index[] $indices | [
"Print",
"indices",
"."
] | 70d34ee385d85aa12d291436892ffd2f432583ad | https://github.com/apisearch-io/apisearch-bundle/blob/70d34ee385d85aa12d291436892ffd2f432583ad/Command/PrintIndicesCommand.php#L86-L141 |
42,789 | traderinteractive/dws-coding-standard | DWS/Helpers/WhiteSpace.php | DWS_Helpers_Whitespace.indentOfLine | public static function indentOfLine(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$beginningElement = $stackPtr;
$previousElement = $phpcsFile->findPrevious(T_WHITESPACE, $beginningElement - 1, null, true);
while ($previousElement !== false && $tokens[$previousElement]['line'] === $tokens[$stackPtr]['line']) {
$beginningElement = $previousElement;
$previousElement = $phpcsFile->findPrevious(T_WHITESPACE, $beginningElement - 1, null, true);
}
return $tokens[$beginningElement]['column'];
} | php | public static function indentOfLine(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$beginningElement = $stackPtr;
$previousElement = $phpcsFile->findPrevious(T_WHITESPACE, $beginningElement - 1, null, true);
while ($previousElement !== false && $tokens[$previousElement]['line'] === $tokens[$stackPtr]['line']) {
$beginningElement = $previousElement;
$previousElement = $phpcsFile->findPrevious(T_WHITESPACE, $beginningElement - 1, null, true);
}
return $tokens[$beginningElement]['column'];
} | [
"public",
"static",
"function",
"indentOfLine",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"$",
"beginningElement",
"=",
"$",
"stackPtr",
";",
"$",
... | Returns the indentation level of the requested line.
@param PHP_CodeSniffer_File $phpcsFile The file in question.
@param int $stackPtr The stack pointer to the element on the line in question.
@return int The normalized column number for the initial non-whitespace token on the line. | [
"Returns",
"the",
"indentation",
"level",
"of",
"the",
"requested",
"line",
"."
] | c1e8da9f16a7fcf36d5f2a664a3514fb98261ad5 | https://github.com/traderinteractive/dws-coding-standard/blob/c1e8da9f16a7fcf36d5f2a664a3514fb98261ad5/DWS/Helpers/WhiteSpace.php#L25-L36 |
42,790 | yiisoft/yii2-jui | src/Widget.php | Widget.registerClientOptions | protected function registerClientOptions($name, $id)
{
if ($this->clientOptions !== false) {
$options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions);
$js = "jQuery('#$id').$name($options);";
$this->getView()->registerJs($js);
}
} | php | protected function registerClientOptions($name, $id)
{
if ($this->clientOptions !== false) {
$options = empty($this->clientOptions) ? '' : Json::htmlEncode($this->clientOptions);
$js = "jQuery('#$id').$name($options);";
$this->getView()->registerJs($js);
}
} | [
"protected",
"function",
"registerClientOptions",
"(",
"$",
"name",
",",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"clientOptions",
"!==",
"false",
")",
"{",
"$",
"options",
"=",
"empty",
"(",
"$",
"this",
"->",
"clientOptions",
")",
"?",
"''"... | Registers a specific jQuery UI widget options
@param string $name the name of the jQuery UI widget
@param string $id the ID of the widget | [
"Registers",
"a",
"specific",
"jQuery",
"UI",
"widget",
"options"
] | 49d2f37852f5b9ce6cf43b2467c77bdb6710c340 | https://github.com/yiisoft/yii2-jui/blob/49d2f37852f5b9ce6cf43b2467c77bdb6710c340/src/Widget.php#L74-L81 |
42,791 | yiisoft/yii2-jui | src/Widget.php | Widget.registerClientEvents | protected function registerClientEvents($name, $id)
{
if (!empty($this->clientEvents)) {
$js = [];
foreach ($this->clientEvents as $event => $handler) {
if (isset($this->clientEventMap[$event])) {
$eventName = $this->clientEventMap[$event];
} else {
$eventName = strtolower($name . $event);
}
$js[] = "jQuery('#$id').on('$eventName', $handler);";
}
$this->getView()->registerJs(implode("\n", $js));
}
} | php | protected function registerClientEvents($name, $id)
{
if (!empty($this->clientEvents)) {
$js = [];
foreach ($this->clientEvents as $event => $handler) {
if (isset($this->clientEventMap[$event])) {
$eventName = $this->clientEventMap[$event];
} else {
$eventName = strtolower($name . $event);
}
$js[] = "jQuery('#$id').on('$eventName', $handler);";
}
$this->getView()->registerJs(implode("\n", $js));
}
} | [
"protected",
"function",
"registerClientEvents",
"(",
"$",
"name",
",",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"clientEvents",
")",
")",
"{",
"$",
"js",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"clientEv... | Registers a specific jQuery UI widget events
@param string $name the name of the jQuery UI widget
@param string $id the ID of the widget | [
"Registers",
"a",
"specific",
"jQuery",
"UI",
"widget",
"events"
] | 49d2f37852f5b9ce6cf43b2467c77bdb6710c340 | https://github.com/yiisoft/yii2-jui/blob/49d2f37852f5b9ce6cf43b2467c77bdb6710c340/src/Widget.php#L88-L102 |
42,792 | yiisoft/yii2-jui | src/Widget.php | Widget.registerWidget | protected function registerWidget($name, $id = null)
{
if ($id === null) {
$id = $this->options['id'];
}
JuiAsset::register($this->getView());
$this->registerClientEvents($name, $id);
$this->registerClientOptions($name, $id);
} | php | protected function registerWidget($name, $id = null)
{
if ($id === null) {
$id = $this->options['id'];
}
JuiAsset::register($this->getView());
$this->registerClientEvents($name, $id);
$this->registerClientOptions($name, $id);
} | [
"protected",
"function",
"registerWidget",
"(",
"$",
"name",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"null",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
";",
"}",
"JuiAsset",
"::",
"regist... | Registers a specific jQuery UI widget asset bundle, initializes it with client options and registers related events
@param string $name the name of the jQuery UI widget
@param string $id the ID of the widget. If null, it will use the `id` value of [[options]]. | [
"Registers",
"a",
"specific",
"jQuery",
"UI",
"widget",
"asset",
"bundle",
"initializes",
"it",
"with",
"client",
"options",
"and",
"registers",
"related",
"events"
] | 49d2f37852f5b9ce6cf43b2467c77bdb6710c340 | https://github.com/yiisoft/yii2-jui/blob/49d2f37852f5b9ce6cf43b2467c77bdb6710c340/src/Widget.php#L109-L117 |
42,793 | TCB13/thunder-tus-php | src/Server.php | Server.handle | public function handle(): Server
{
// Check the upload directory
if (!is_dir($this->uploadDir))
throw new ThunderTUSException("Invalid upload directory. Path wasn't set, it doesn't exist or it isn't a directory.");
// Call handlers
$method = "handle" . $this->request->getMethod();
if (!method_exists($this, $method))
throw new ThunderTUSException("Invalid HTTP request method. Not TUS or ThunderTUS compliant.");
// Check if this server supports the client protocol version
if ($this->request->getHeaderLine("Tus-Resumable") != self::PROTOCOL_VERSION) {
$this->response = $this->response->withStatus(412);
return $this;
}
// Gather the filename from the last part of the URL and set the resource location
$this->apiPath = rtrim($this->apiPath, "/") . "/";
$this->uploadDir = rtrim(realpath($this->uploadDir), \DIRECTORY_SEPARATOR) . \DIRECTORY_SEPARATOR;
$url = $this->request->getUri();
$this->file = str_replace(["\\", "/"], "", substr($url, strrpos($url, $this->apiPath) + strlen($this->apiPath)));
$this->location = $this->apiPath . $this->file;
$this->file = $this->uploadDir . $this->file;
// Replicate the input stream so we can control its pointer
$this->stream = fopen('php://temp', 'w+');
stream_copy_to_stream(fopen($this->streamURI, 'r'), $this->stream);
rewind($this->stream);
$this->response = $this->$method();
return $this;
} | php | public function handle(): Server
{
// Check the upload directory
if (!is_dir($this->uploadDir))
throw new ThunderTUSException("Invalid upload directory. Path wasn't set, it doesn't exist or it isn't a directory.");
// Call handlers
$method = "handle" . $this->request->getMethod();
if (!method_exists($this, $method))
throw new ThunderTUSException("Invalid HTTP request method. Not TUS or ThunderTUS compliant.");
// Check if this server supports the client protocol version
if ($this->request->getHeaderLine("Tus-Resumable") != self::PROTOCOL_VERSION) {
$this->response = $this->response->withStatus(412);
return $this;
}
// Gather the filename from the last part of the URL and set the resource location
$this->apiPath = rtrim($this->apiPath, "/") . "/";
$this->uploadDir = rtrim(realpath($this->uploadDir), \DIRECTORY_SEPARATOR) . \DIRECTORY_SEPARATOR;
$url = $this->request->getUri();
$this->file = str_replace(["\\", "/"], "", substr($url, strrpos($url, $this->apiPath) + strlen($this->apiPath)));
$this->location = $this->apiPath . $this->file;
$this->file = $this->uploadDir . $this->file;
// Replicate the input stream so we can control its pointer
$this->stream = fopen('php://temp', 'w+');
stream_copy_to_stream(fopen($this->streamURI, 'r'), $this->stream);
rewind($this->stream);
$this->response = $this->$method();
return $this;
} | [
"public",
"function",
"handle",
"(",
")",
":",
"Server",
"{",
"// Check the upload directory",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"uploadDir",
")",
")",
"throw",
"new",
"ThunderTUSException",
"(",
"\"Invalid upload directory. Path wasn't set, it doesn't... | Handles the incoming request.
@throws \ThunderTUS\ThunderTUSException | [
"Handles",
"the",
"incoming",
"request",
"."
] | a6a8782407d4e03475e4e8fce24902509b8f4f9d | https://github.com/TCB13/thunder-tus-php/blob/a6a8782407d4e03475e4e8fce24902509b8f4f9d/src/Server.php#L67-L101 |
42,794 | TCB13/thunder-tus-php | src/Server.php | Server.handlePOST | protected function handlePOST(): ResponseInterface
{
// If the already exists we can't create it
if (is_file($this->file))
return $this->response->withStatus(409);
// Get the total upload expected length
$length = $this->request->getHeaderLine("Upload-Length");
if ($length === "") // Note: Some PSR7 implementations discard headers set to 0.
return $this->response->withStatus(400);
// Check for the size of the entire upload
if ($this->uploadMaxFileSize > 0 && $this->uploadMaxFileSize < $length)
return $this->response->withStatus(413);
// Create empty cache container
$cache = new \stdClass();
$cache->length = $length;
// Extension Thunder TUS CrossCheck: get complete upload checksum
if ($this->extCrossCheck) {
$cache->checksum = self::parseChecksum($this->request->getHeaderLine("Upload-CrossChecksum"));
if ($cache->checksum === false)
return $this->response->withStatus(400);
}
// Create an empty file to store the upload and save the cache container
touch($this->file);
file_put_contents($this->file . ".cachecontainer", \json_encode($cache));
return $this->response->withStatus(201)
->withHeader("Location", $this->location);
} | php | protected function handlePOST(): ResponseInterface
{
// If the already exists we can't create it
if (is_file($this->file))
return $this->response->withStatus(409);
// Get the total upload expected length
$length = $this->request->getHeaderLine("Upload-Length");
if ($length === "") // Note: Some PSR7 implementations discard headers set to 0.
return $this->response->withStatus(400);
// Check for the size of the entire upload
if ($this->uploadMaxFileSize > 0 && $this->uploadMaxFileSize < $length)
return $this->response->withStatus(413);
// Create empty cache container
$cache = new \stdClass();
$cache->length = $length;
// Extension Thunder TUS CrossCheck: get complete upload checksum
if ($this->extCrossCheck) {
$cache->checksum = self::parseChecksum($this->request->getHeaderLine("Upload-CrossChecksum"));
if ($cache->checksum === false)
return $this->response->withStatus(400);
}
// Create an empty file to store the upload and save the cache container
touch($this->file);
file_put_contents($this->file . ".cachecontainer", \json_encode($cache));
return $this->response->withStatus(201)
->withHeader("Location", $this->location);
} | [
"protected",
"function",
"handlePOST",
"(",
")",
":",
"ResponseInterface",
"{",
"// If the already exists we can't create it",
"if",
"(",
"is_file",
"(",
"$",
"this",
"->",
"file",
")",
")",
"return",
"$",
"this",
"->",
"response",
"->",
"withStatus",
"(",
"409"... | Handle POST requests.
Creates new files on the server and caches its expected size.
If the client uses the ThunderTUS CrossCheck extension this method will also cache the final file
checksum - the checksum of the entire file.
@return \Psr\Http\Message\ResponseInterface | [
"Handle",
"POST",
"requests",
"."
] | a6a8782407d4e03475e4e8fce24902509b8f4f9d | https://github.com/TCB13/thunder-tus-php/blob/a6a8782407d4e03475e4e8fce24902509b8f4f9d/src/Server.php#L113-L146 |
42,795 | TCB13/thunder-tus-php | src/Server.php | Server.handleHEAD | protected function handleHEAD(): ResponseInterface
{
// Extension Thunder TUS Express: create the file on HEAD request
if ($this->extExpress) {
$this->response = $this->handlePOST();
$code = $this->response->getStatusCode();
if ($code !== 201 && $code !== 409)
return $this->response;
$this->response = $this->response->withHeader("Location", $this->location);
}
else { // For Standard TUS
if (!is_file($this->file))
return $this->response->withStatus(404);
}
// Standard TUS HEAD response
$localSize = filesize($this->file);
return $this->response->withStatus(200)
->withHeader("Upload-Offset", $localSize);
} | php | protected function handleHEAD(): ResponseInterface
{
// Extension Thunder TUS Express: create the file on HEAD request
if ($this->extExpress) {
$this->response = $this->handlePOST();
$code = $this->response->getStatusCode();
if ($code !== 201 && $code !== 409)
return $this->response;
$this->response = $this->response->withHeader("Location", $this->location);
}
else { // For Standard TUS
if (!is_file($this->file))
return $this->response->withStatus(404);
}
// Standard TUS HEAD response
$localSize = filesize($this->file);
return $this->response->withStatus(200)
->withHeader("Upload-Offset", $localSize);
} | [
"protected",
"function",
"handleHEAD",
"(",
")",
":",
"ResponseInterface",
"{",
"// Extension Thunder TUS Express: create the file on HEAD request",
"if",
"(",
"$",
"this",
"->",
"extExpress",
")",
"{",
"$",
"this",
"->",
"response",
"=",
"$",
"this",
"->",
"handleP... | Handle HEAD requests.
Informs the client about the status of a file. If the file exists, the number of bytes (offset) already
stored in the server is also provided.
If the client uses the ThunderTUS Express extension this method will also create new files bypassing
the need to call POST.
@return \Psr\Http\Message\ResponseInterface | [
"Handle",
"HEAD",
"requests",
"."
] | a6a8782407d4e03475e4e8fce24902509b8f4f9d | https://github.com/TCB13/thunder-tus-php/blob/a6a8782407d4e03475e4e8fce24902509b8f4f9d/src/Server.php#L159-L181 |
42,796 | TCB13/thunder-tus-php | src/Server.php | Server.handlePATCH | protected function handlePATCH(): ResponseInterface
{
$offset = $this->request->getHeaderLine("Upload-Offset");
if ($offset === "") // Note: Some PSR7 implementations discard headers set to 0.
return $this->response->withStatus(400);
// Check if the server supports the proposed checksum algorithm
$checksum = self::parseChecksum($this->request->getHeaderLine("Upload-Checksum"));
if ($checksum === false)
return $this->response->withStatus(400);
// Extension Thunder TUS Express: create the file on PATCH request
if ($this->extExpress && $offset == 0) {
$this->response = $this->handlePOST();
$code = $this->response->getStatusCode();
if ($code !== 201 && $code !== 409)
return $this->response;
if ($code === 409 && !file_exists($this->file . ".cachecontainer")) // Avoid overwriting completed uploads
return $this->response;
}
else { // For Standard TUS
if (!is_file($this->file))
return $this->response->withStatus(404);
}
// Check if the current stored file offset is different from the proposed upload offset
// This ensures we're getting the file block by block in the right order and nothing is missing
if (filesize($this->file) != $offset) {
return $this->response->withStatus(409)
->withHeader("Upload-Offset", filesize($this->file));
}
// Compare proposed checksum with the received data checksum
$hashContext = hash_init($checksum->algorithm);
hash_update_stream($hashContext, $this->stream);
$localChecksum = base64_encode(hash_final($hashContext, true));
if ($localChecksum !== $checksum->value)
return $this->response->withStatus(460, "Checksum Mismatch")
->withHeader("Upload-Offset", filesize($this->file));
rewind($this->stream);
// Write the uploaded chunk to the file
$file = fopen($this->file, "ab");
stream_copy_to_stream($this->stream, $file);
fclose($file);
clearstatcache(true, $this->file);
$localSize = filesize($this->file);
// Detect when the upload is complete
$cache = \json_decode(file_get_contents($this->file . ".cachecontainer"));
if ($cache->length <= $localSize) {
// Remove the cache container, we don't need it anymore
unlink($this->file . ".cachecontainer");
// Extension Thunder TUS CrossCheck: verify if the uploaded file is as expected or delete it
if ($this->extCrossCheck) {
$localChecksum = base64_encode(hash_file($cache->checksum->algorithm, $this->file, true));
if ($localChecksum !== $cache->checksum->value) {
unlink($this->file);
return $this->response->withStatus(410);
}
}
}
if ($this->extCrossCheck)
$this->response = $this->response->withHeader("Location", $this->location);
// File uploaded successfully!
return $this->response->withStatus(204)
->withHeader("Upload-Offset", $localSize);
} | php | protected function handlePATCH(): ResponseInterface
{
$offset = $this->request->getHeaderLine("Upload-Offset");
if ($offset === "") // Note: Some PSR7 implementations discard headers set to 0.
return $this->response->withStatus(400);
// Check if the server supports the proposed checksum algorithm
$checksum = self::parseChecksum($this->request->getHeaderLine("Upload-Checksum"));
if ($checksum === false)
return $this->response->withStatus(400);
// Extension Thunder TUS Express: create the file on PATCH request
if ($this->extExpress && $offset == 0) {
$this->response = $this->handlePOST();
$code = $this->response->getStatusCode();
if ($code !== 201 && $code !== 409)
return $this->response;
if ($code === 409 && !file_exists($this->file . ".cachecontainer")) // Avoid overwriting completed uploads
return $this->response;
}
else { // For Standard TUS
if (!is_file($this->file))
return $this->response->withStatus(404);
}
// Check if the current stored file offset is different from the proposed upload offset
// This ensures we're getting the file block by block in the right order and nothing is missing
if (filesize($this->file) != $offset) {
return $this->response->withStatus(409)
->withHeader("Upload-Offset", filesize($this->file));
}
// Compare proposed checksum with the received data checksum
$hashContext = hash_init($checksum->algorithm);
hash_update_stream($hashContext, $this->stream);
$localChecksum = base64_encode(hash_final($hashContext, true));
if ($localChecksum !== $checksum->value)
return $this->response->withStatus(460, "Checksum Mismatch")
->withHeader("Upload-Offset", filesize($this->file));
rewind($this->stream);
// Write the uploaded chunk to the file
$file = fopen($this->file, "ab");
stream_copy_to_stream($this->stream, $file);
fclose($file);
clearstatcache(true, $this->file);
$localSize = filesize($this->file);
// Detect when the upload is complete
$cache = \json_decode(file_get_contents($this->file . ".cachecontainer"));
if ($cache->length <= $localSize) {
// Remove the cache container, we don't need it anymore
unlink($this->file . ".cachecontainer");
// Extension Thunder TUS CrossCheck: verify if the uploaded file is as expected or delete it
if ($this->extCrossCheck) {
$localChecksum = base64_encode(hash_file($cache->checksum->algorithm, $this->file, true));
if ($localChecksum !== $cache->checksum->value) {
unlink($this->file);
return $this->response->withStatus(410);
}
}
}
if ($this->extCrossCheck)
$this->response = $this->response->withHeader("Location", $this->location);
// File uploaded successfully!
return $this->response->withStatus(204)
->withHeader("Upload-Offset", $localSize);
} | [
"protected",
"function",
"handlePATCH",
"(",
")",
":",
"ResponseInterface",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"request",
"->",
"getHeaderLine",
"(",
"\"Upload-Offset\"",
")",
";",
"if",
"(",
"$",
"offset",
"===",
"\"\"",
")",
"// Note: Some PSR7 impl... | Handle PATCH requests.
Receives a chuck of a file and stores it on the server. Implements the checksum extension to validate
the integrity of the chunk.
If the client uses the ThunderTUS Express extension this method will also create new files bypassing
the need to call POST/HEAD.
If the client uses the ThunderTUS CrossCheck extension this method will also verify the final file
checksum (after all chunks are received) against checksum previously stored in the cache.
@return \Psr\Http\Message\ResponseInterface | [
"Handle",
"PATCH",
"requests",
"."
] | a6a8782407d4e03475e4e8fce24902509b8f4f9d | https://github.com/TCB13/thunder-tus-php/blob/a6a8782407d4e03475e4e8fce24902509b8f4f9d/src/Server.php#L197-L274 |
42,797 | TCB13/thunder-tus-php | src/Server.php | Server.handleDELETE | protected function handleDELETE(): ResponseInterface
{
if (!is_file($this->file))
return $this->response->withStatus(404);
unlink($this->file);
$cacheStore = $this->file . ".cachecontainer";
if (is_file($cacheStore))
unlink($cacheStore);
return $this->response->withStatus(204);
} | php | protected function handleDELETE(): ResponseInterface
{
if (!is_file($this->file))
return $this->response->withStatus(404);
unlink($this->file);
$cacheStore = $this->file . ".cachecontainer";
if (is_file($cacheStore))
unlink($cacheStore);
return $this->response->withStatus(204);
} | [
"protected",
"function",
"handleDELETE",
"(",
")",
":",
"ResponseInterface",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"this",
"->",
"file",
")",
")",
"return",
"$",
"this",
"->",
"response",
"->",
"withStatus",
"(",
"404",
")",
";",
"unlink",
"(",
"$"... | Handle DELETE requests.
Remove an existing file from the server and its associated resources. Useful when the client
decides to abort an upload.
@return \Psr\Http\Message\ResponseInterface | [
"Handle",
"DELETE",
"requests",
"."
] | a6a8782407d4e03475e4e8fce24902509b8f4f9d | https://github.com/TCB13/thunder-tus-php/blob/a6a8782407d4e03475e4e8fce24902509b8f4f9d/src/Server.php#L284-L296 |
42,798 | TCB13/thunder-tus-php | src/Server.php | Server.handleOPTIONS | protected function handleOPTIONS(): ResponseInterface
{
return $this->response->withStatus(204)
->withHeader("Tus-Version", self::PROTOCOL_VERSION)
->withHeader("Tus-Max-Size", $this->uploadMaxFileSize)
->withHeader("Tus-Extension", "creation,checksum,termination,crosscheck,express");
} | php | protected function handleOPTIONS(): ResponseInterface
{
return $this->response->withStatus(204)
->withHeader("Tus-Version", self::PROTOCOL_VERSION)
->withHeader("Tus-Max-Size", $this->uploadMaxFileSize)
->withHeader("Tus-Extension", "creation,checksum,termination,crosscheck,express");
} | [
"protected",
"function",
"handleOPTIONS",
"(",
")",
":",
"ResponseInterface",
"{",
"return",
"$",
"this",
"->",
"response",
"->",
"withStatus",
"(",
"204",
")",
"->",
"withHeader",
"(",
"\"Tus-Version\"",
",",
"self",
"::",
"PROTOCOL_VERSION",
")",
"->",
"with... | Handle OPTIONS requests.
Return information about the server's current configuration. Useful to get the protocol
version, the maximum upload file size and supported extensions.
@return \Psr\Http\Message\ResponseInterface | [
"Handle",
"OPTIONS",
"requests",
"."
] | a6a8782407d4e03475e4e8fce24902509b8f4f9d | https://github.com/TCB13/thunder-tus-php/blob/a6a8782407d4e03475e4e8fce24902509b8f4f9d/src/Server.php#L306-L312 |
42,799 | TCB13/thunder-tus-php | src/Server.php | Server.getStream | public function getStream(bool $rewind = true)
{
if ($rewind)
rewind($this->stream);
return $this->stream;
} | php | public function getStream(bool $rewind = true)
{
if ($rewind)
rewind($this->stream);
return $this->stream;
} | [
"public",
"function",
"getStream",
"(",
"bool",
"$",
"rewind",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"rewind",
")",
"rewind",
"(",
"$",
"this",
"->",
"stream",
")",
";",
"return",
"$",
"this",
"->",
"stream",
";",
"}"
] | Returns the underlying stream resource where the data sent to the server was stored.
@param bool $rewind If the stream should be rewinded before returned.
@return bool|resource | [
"Returns",
"the",
"underlying",
"stream",
"resource",
"where",
"the",
"data",
"sent",
"to",
"the",
"server",
"was",
"stored",
"."
] | a6a8782407d4e03475e4e8fce24902509b8f4f9d | https://github.com/TCB13/thunder-tus-php/blob/a6a8782407d4e03475e4e8fce24902509b8f4f9d/src/Server.php#L349-L355 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.