_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q25900 | Builder.expr | train | public function expr() : Expr
{
$expr = new Expr($this->dm); | php | {
"resource": ""
} |
q25901 | Builder.field | train | public function field(string $field) : self
{
$this->currentField = $field;
| php | {
"resource": ""
} |
q25902 | Builder.find | train | public function find(?string $documentName = null) : self
{
$this->setDocumentName($documentName); | php | {
"resource": ""
} |
q25903 | Builder.selectMeta | train | public function selectMeta(string $fieldName, string $metaDataKeyword) : self
| php | {
"resource": ""
} |
q25904 | Builder.getDiscriminatorValues | train | private function getDiscriminatorValues($classNames) : array
{
$discriminatorValues = [];
$collections = [];
foreach ($classNames as $className) {
$class = $this->dm->getClassMetadata($className);
$discriminatorValues[] = $class->discriminatorV... | php | {
"resource": ""
} |
q25905 | UuidGenerator.generate | train | public function generate(DocumentManager $dm, object $document)
{
| php | {
"resource": ""
} |
q25906 | Builder.bucket | train | public function bucket() : Stage\Bucket
{
$stage = new Stage\Bucket($this, $this->dm, $this->class);
| php | {
"resource": ""
} |
q25907 | Builder.bucketAuto | train | public function bucketAuto() : Stage\BucketAuto
{
$stage = new Stage\BucketAuto($this, $this->dm, $this->class);
| php | {
"resource": ""
} |
q25908 | Builder.collStats | train | public function collStats() : Stage\CollStats
{
$stage = new Stage\CollStats($this);
| php | {
"resource": ""
} |
q25909 | Builder.count | train | public function count(string $fieldName) : Stage\Count
{
$stage = new Stage\Count($this, $fieldName);
| php | {
"resource": ""
} |
q25910 | Builder.execute | train | public function execute(array $options = []) : Iterator
{
// Force cursor to be used
$options = array_merge($options, ['cursor' | php | {
"resource": ""
} |
q25911 | Builder.facet | train | public function facet() : Stage\Facet
{
$stage = new Stage\Facet($this);
| php | {
"resource": ""
} |
q25912 | Builder.getPipeline | train | public function getPipeline() : array
{
$pipeline = array_map(
static function (Stage $stage) {
return $stage->getExpression();
},
$this->stages
);
if ($this->getStage(0) instanceof Stage\GeoNear) {
$pipeline[0]['$geoNear']['qu... | php | {
"resource": ""
} |
q25913 | Builder.graphLookup | train | public function graphLookup(string $from) : Stage\GraphLookup
{
$stage = new Stage\GraphLookup($this, $from, $this->dm, | php | {
"resource": ""
} |
q25914 | Builder.group | train | public function group() : Stage\Group
{
$stage = new Stage\Group($this);
| php | {
"resource": ""
} |
q25915 | Builder.indexStats | train | public function indexStats() : Stage\IndexStats
{
$stage = new Stage\IndexStats($this);
| php | {
"resource": ""
} |
q25916 | Builder.limit | train | public function limit(int $limit) : Stage\Limit
{
$stage = new Stage\Limit($this, $limit);
| php | {
"resource": ""
} |
q25917 | Builder.matchExpr | train | public function matchExpr() : QueryExpr
{
$expr = new QueryExpr($this->dm);
| php | {
"resource": ""
} |
q25918 | Builder.out | train | public function out(string $from) : Stage\Out
{
$stage = new Stage\Out($this, $from, $this->dm);
| php | {
"resource": ""
} |
q25919 | Builder.project | train | public function project() : Stage\Project
{
$stage = new Stage\Project($this);
| php | {
"resource": ""
} |
q25920 | Builder.redact | train | public function redact() : Stage\Redact
{
$stage = new Stage\Redact($this);
| php | {
"resource": ""
} |
q25921 | Builder.replaceRoot | train | public function replaceRoot($expression = null) : Stage\ReplaceRoot
{
$stage = new Stage\ReplaceRoot($this, $this->dm, | php | {
"resource": ""
} |
q25922 | Builder.sample | train | public function sample(int $size) : Stage\Sample
{
$stage = new Stage\Sample($this, $size);
| php | {
"resource": ""
} |
q25923 | Builder.skip | train | public function skip(int $skip) : Stage\Skip
{
$stage = new Stage\Skip($this, $skip);
| php | {
"resource": ""
} |
q25924 | Builder.sortByCount | train | public function sortByCount(string $expression) : Stage\SortByCount
{
$stage = new Stage\SortByCount($this, $expression, | php | {
"resource": ""
} |
q25925 | Builder.unwind | train | public function unwind(string $fieldName) : Stage\Unwind
{
// Fixme: move field name translation to stage
$stage | php | {
"resource": ""
} |
q25926 | Builder.applyFilters | train | private function applyFilters(array $query) : array
{
$documentPersister = $this->dm->getUnitOfWork()->getDocumentPersister($this->class->name);
| php | {
"resource": ""
} |
q25927 | CachingIterator.storeCurrentItem | train | private function storeCurrentItem() : void
{
$key = $this->iterator->key();
if ($key === null) {
return;
} | php | {
"resource": ""
} |
q25928 | Project.avg | train | public function avg($expression1, ...$expressions) : self
{
$this->expr->avg(empty($expressions) | php | {
"resource": ""
} |
q25929 | Project.stdDevSamp | train | public function stdDevSamp($expression1, ...$expressions) : self
{
| php | {
"resource": ""
} |
q25930 | Project.sum | train | public function sum($expression1, ...$expressions) : self
{
$this->expr->sum(empty($expressions) | php | {
"resource": ""
} |
q25931 | Expr.expression | train | public function expression($value) : self
{
$this->requiresCurrentField(__METHOD__);
$this->expr[$this->currentField] | php | {
"resource": ""
} |
q25932 | Expr.field | train | public function field(string $fieldName) : self
{
$fieldName = $this->getDocumentPersister()->prepareFieldName($fieldName);
| php | {
"resource": ""
} |
q25933 | Expr.addToSet | train | public function addToSet($valueOrExpression) : self
{
if ($valueOrExpression instanceof Expr) {
$valueOrExpression = $valueOrExpression->getQuery();
}
| php | {
"resource": ""
} |
q25934 | Expr.equals | train | public function equals($value) : self
{
if ($this->currentField) {
$this->query[$this->currentField] = $value;
} else {
| php | {
"resource": ""
} |
q25935 | Expr.inc | train | public function inc($value) : self
{
$this->requiresCurrentField(); | php | {
"resource": ""
} |
q25936 | Expr.includesReferenceTo | train | public function includesReferenceTo(object $document) : self
{
$this->requiresCurrentField();
$mapping = $this->getReferenceMapping();
$reference = $this->dm->createReference($document, $mapping);
$storeAs = $mapping['storeAs'] ?? null;
$keys = [];
switch ($... | php | {
"resource": ""
} |
q25937 | Expr.not | train | public function not($expression) : self
{
return $this->operator('$not', | php | {
"resource": ""
} |
q25938 | Expr.getReferenceMapping | train | private function getReferenceMapping() : array
{
$this->requiresCurrentField();
assert($this->currentField !== null);
try {
return $this->class->getFieldMapping($this->currentField);
} catch (MappingException $e) {
if (empty($this->class->discriminatorMap)) {... | php | {
"resource": ""
} |
q25939 | Cache.set | train | public function set($name, Location $location)
{
| php | {
"resource": ""
} |
q25940 | GeoIPServiceProvider.registerGeoIpService | train | public function registerGeoIpService()
{
$this->app->singleton('geoip', function ($app) {
| php | {
"resource": ""
} |
q25941 | GeoIP.getService | train | public function getService()
{
if ($this->service === null) {
// Get service configuration
$config = $this->config('services.' . $this->config('service'), []);
// Get service class
| php | {
"resource": ""
} |
q25942 | GeoIP.isValid | train | private function isValid($ip)
{
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)
| php | {
"resource": ""
} |
q25943 | HttpClient.get | train | public function get($url, array $query = [], array $headers = [])
| php | {
"resource": ""
} |
q25944 | HttpClient.parseHeaders | train | private function parseHeaders($headers)
{
$result = [];
foreach (preg_split("/\\r\\n|\\r|\\n/", $headers) as $row) {
$header = explode(':', $row, 2);
if (count($header) == 2) {
| php | {
"resource": ""
} |
q25945 | HttpClient.getUrl | train | private function getUrl($url)
{
// Check for URL scheme
if (parse_url($url, PHP_URL_SCHEME) === null) {
$url = | php | {
"resource": ""
} |
q25946 | HttpClient.buildGetUrl | train | private function buildGetUrl($url, array $query = [])
{
// Merge global and request queries
$query = array_merge(
Arr::get($this->config, 'query', []),
$query
);
// Append query | php | {
"resource": ""
} |
q25947 | CustomerPaymentsEndpoint.createForId | train | public function createForId($customerId, array $options = [], array $filters = [])
{
$this->parentId = $customerId; | php | {
"resource": ""
} |
q25948 | ProfileMethodEndpoint.createForId | train | public function createForId($profileId, $methodId, array $data = [])
{
$this->parentId = $profileId;
$resource = $this->getResourcePath() . '/' . urlencode($methodId);
$body = null;
if (count($data) > 0) {
$body = | php | {
"resource": ""
} |
q25949 | ProfileMethodEndpoint.createFor | train | public function createFor($profile, $methodId, array $data = | php | {
"resource": ""
} |
q25950 | ProfileMethodEndpoint.deleteForId | train | public function deleteForId($profileId, $methodId, array $data = [])
{
$this->parentId = $profileId;
| php | {
"resource": ""
} |
q25951 | ProfileMethodEndpoint.deleteFor | train | public function deleteFor($profile, $methodId, array $data = | php | {
"resource": ""
} |
q25952 | Customer.payments | train | public function payments()
{
return $this->client->customerPayments->listFor($this, | php | {
"resource": ""
} |
q25953 | Customer.subscriptions | train | public function subscriptions()
{
return $this->client->subscriptions->listFor($this, | php | {
"resource": ""
} |
q25954 | Customer.mandates | train | public function mandates()
{
return $this->client->mandates->listFor($this, | php | {
"resource": ""
} |
q25955 | Customer.hasValidMandate | train | public function hasValidMandate()
{
$mandates = $this->mandates();
foreach ($mandates as $mandate) {
if ($mandate->isValid()) { | php | {
"resource": ""
} |
q25956 | Customer.hasValidMandateForMethod | train | public function hasValidMandateForMethod($method)
{
$mandates = $this->mandates();
foreach ($mandates as $mandate) {
if ($mandate->method === | php | {
"resource": ""
} |
q25957 | Customer.getPresetOptions | train | private function getPresetOptions()
{
$options = [];
if($this->client->usesOAuth()) { | php | {
"resource": ""
} |
q25958 | ShipmentEndpoint.listForId | train | public function listForId($orderId, array $parameters = [])
{
$this->parentId = $orderId;
| php | {
"resource": ""
} |
q25959 | Profile.chargebacks | train | public function chargebacks()
{
if (!isset($this->_links->chargebacks->href)) {
return new ChargebackCollection($this->client, 0, null);
}
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->chargebacks->href);
| php | {
"resource": ""
} |
q25960 | Profile.methods | train | public function methods()
{
if (!isset($this->_links->methods->href)) {
return new MethodCollection(0, null);
}
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->methods->href);
| php | {
"resource": ""
} |
q25961 | Profile.enableMethod | train | public function enableMethod($methodId, array $data = [])
{
| php | {
"resource": ""
} |
q25962 | Profile.disableMethod | train | public function disableMethod($methodId, array $data = [])
{
| php | {
"resource": ""
} |
q25963 | Profile.refunds | train | public function refunds()
{
if (!isset($this->_links->refunds->href)) {
return new RefundCollection($this->client, 0, null);
}
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->refunds->href);
| php | {
"resource": ""
} |
q25964 | Payment.getCheckoutUrl | train | public function getCheckoutUrl()
{
if (empty($this->_links->checkout)) {
return null;
| php | {
"resource": ""
} |
q25965 | Payment.captures | train | public function captures()
{
if (!isset($this->_links->captures->href)) {
return new CaptureCollection($this->client, 0, null);
}
$result = $this->client->performHttpCallToFullUrl(
MollieApiClient::HTTP_GET,
$this->_links->captures->href
);
| php | {
"resource": ""
} |
q25966 | Payment.getChargeback | train | public function getChargeback($chargebackId, array $parameters = [])
{
return $this->client->paymentChargebacks->getFor( | php | {
"resource": ""
} |
q25967 | Payment.refund | train | public function refund($data = [])
{
$resource = "payments/" . urlencode($this->id) . "/refunds";
$body = null;
if (count($data) > 0) {
$body = json_encode($data);
}
$result = $this->client->performHttpCall(
MollieApiClient::HTTP_POST,
| php | {
"resource": ""
} |
q25968 | PaymentEndpoint.get | train | public function get($paymentId, array $parameters = [])
{
if (empty($paymentId) || strpos($paymentId, self::RESOURCE_ID_PREFIX) !== 0) {
throw new ApiException("Invalid payment ID: | php | {
"resource": ""
} |
q25969 | PaymentEndpoint.page | train | public function page($from = null, $limit = null, array $parameters = | php | {
"resource": ""
} |
q25970 | PaymentEndpoint.refund | train | public function refund(Payment $payment, $data = [])
{
$resource = "{$this->getResourcePath()}/" . urlencode($payment->id) . "/refunds";
$body = null;
if (count($data) > 0) {
$body = json_encode($data);
}
| php | {
"resource": ""
} |
q25971 | ResourceFactory.createFromApiResult | train | public static function createFromApiResult($apiResult, BaseResource $resource)
{
foreach ($apiResult as $property => $value) {
| php | {
"resource": ""
} |
q25972 | Mandate.revoke | train | public function revoke()
{
if (!isset($this->_links->self->href)) {
return $this;
}
$body = null;
if($this->client->usesOAuth()) {
$body = json_encode([
"testmode" => $this->mode === "test" ? true : false
| php | {
"resource": ""
} |
q25973 | MethodEndpoint.allAvailable | train | public function allAvailable(array $parameters = [])
{
$url = 'methods/all' . $this->buildQueryString($parameters);
$result = $this->client->performHttpCall('GET', $url);
return ResourceFactory::createBaseResourceCollection(
| php | {
"resource": ""
} |
q25974 | MethodEndpoint.get | train | public function get($methodId, array $parameters = [])
{
if (empty($methodId)) {
throw new ApiException("Method ID is | php | {
"resource": ""
} |
q25975 | OrganizationEndpoint.get | train | public function get($organizationId, array $parameters = [])
{
if (empty($organizationId)) {
throw new ApiException("Organization ID is | php | {
"resource": ""
} |
q25976 | EndpointAbstract.rest_read | train | protected function rest_read($id, array $filters)
{
if (empty($id)) {
throw new ApiException("Invalid resource id.");
}
$id = urlencode($id);
$result = $this->client->performHttpCall(
self::REST_READ,
| php | {
"resource": ""
} |
q25977 | EndpointAbstract.rest_delete | train | protected function rest_delete($id, array $body = [])
{
if (empty($id)) {
throw new ApiException("Invalid resource id.");
}
$id = urlencode($id);
$result = $this->client->performHttpCall(
self::REST_DELETE,
"{$this->getResourcePath()}/{$id}",
... | php | {
"resource": ""
} |
q25978 | EndpointAbstract.rest_list | train | protected function rest_list($from = null, $limit = null, array $filters)
{
$filters = array_merge(["from" => $from, "limit" => $limit], $filters);
$apiPath = $this->getResourcePath() . $this->buildQueryString($filters);
$result = $this->client->performHttpCall(self::REST_LIST, $apiPath);
... | php | {
"resource": ""
} |
q25979 | CursorCollection.next | train | final public function next()
{
if (!$this->hasNext()) {
return null;
}
$result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->next->href);
$collection = new static($this->client, $result->count, $result->_links);
| php | {
"resource": ""
} |
q25980 | ProfileEndpoint.get | train | public function get($profileId, array $parameters = [])
{
if($profileId === 'me') {
return $this->getCurrent($parameters);
| php | {
"resource": ""
} |
q25981 | OrderLineCollection.get | train | public function get($lineId)
{
foreach ($this as $line) {
if ($line->id === $lineId) {
| php | {
"resource": ""
} |
q25982 | Subscription.cancel | train | public function cancel()
{
if (!isset($this->_links->self->href)) {
return $this;
}
$body = null;
if($this->client->usesOAuth()) {
$body = json_encode([
"testmode" => $this->mode === "test" ? true : false
]);
}
| php | {
"resource": ""
} |
q25983 | Order.getShipment | train | public function getShipment($shipmentId, array $parameters = [])
{
| php | {
"resource": ""
} |
q25984 | Order.createPayment | train | public function createPayment($data, $filters = [])
{
return | php | {
"resource": ""
} |
q25985 | Order.payments | train | public function payments()
{
if(! isset($this->_embedded, $this->_embedded->payments) ) {
return null;
| php | {
"resource": ""
} |
q25986 | OrderLineEndpoint.cancelForId | train | public function cancelForId($orderId, array $data)
{
if(! isset($data, $data['lines']) || ! is_array($data['lines'])) {
throw new ApiException("A lines array is required.");
}
$this->parentId = $orderId;
$this->client->performHttpCall(
| php | {
"resource": ""
} |
q25987 | Shipment.update | train | public function update()
{
if (!isset($this->_links->self->href)) {
return $this;
}
$body = json_encode([
"tracking" => $this->tracking,
]);
$result = $this->client->performHttpCallToFullUrl(
MollieApiClient::HTTP_PATCH,
| php | {
"resource": ""
} |
q25988 | Refund.cancel | train | public function cancel()
{
$this->client->performHttpCallToFullUrl(
MollieApiClient::HTTP_DELETE,
| php | {
"resource": ""
} |
q25989 | MollieApiClient.performHttpCallToFullUrl | train | public function performHttpCallToFullUrl($httpMethod, $url, $httpBody = null)
{
if (empty($this->apiKey)) {
throw new ApiException("You have not set an API key or OAuth access token. Please use setApiKey() to set the API key.");
}
$userAgent = implode(' ', $this->versionStrings)... | php | {
"resource": ""
} |
q25990 | MollieApiClient.parseResponseBody | train | private function parseResponseBody(ResponseInterface $response)
{
$body = (string) $response->getBody();
if (empty($body)) {
if ($response->getStatusCode() === self::HTTP_NO_CONTENT) {
return null;
}
throw new ApiException("No response body found.... | php | {
"resource": ""
} |
q25991 | OrderEndpoint.get | train | public function get($orderId, array $parameters = [])
{
if (empty($orderId) || strpos($orderId, self::RESOURCE_ID_PREFIX) !== 0) {
throw new ApiException("Invalid order ID: | php | {
"resource": ""
} |
q25992 | CalendarItemDateFormatter.viewValue | train | protected function viewValue(FieldItemInterface $item) {
$field = $item->getFieldDefinition();
if ($field->get('field_type') == 'daterange') {
$value = $item->start_date;
}
else {
$value = $item->date;
}
$build = [
| php | {
"resource": ""
} |
q25993 | BulkUploadForm.bytesToString | train | public static function bytesToString($bytes) {
$units = array_map('t', ['bytes', 'KB', 'MB', 'GB', 'TB']);
while ($bytes > 1024) {
| php | {
"resource": ""
} |
q25994 | MediaHelper.getFileExtensions | train | public function getFileExtensions($check_access = FALSE, array $bundles = []) {
$extensions = '';
// GovCMS Media overrides the media_bundle storage handler with a special
// one that adds an optional second parameter to loadMultiple().
$storage = $this->entityTypeManager
->getStorage('media_type... | php | {
"resource": ""
} |
q25995 | MediaHelper.getBundleFromInput | train | public function getBundleFromInput($value, $check_access = TRUE, array $bundles = []) {
// GovCMS Media overrides the media_bundle storage handler with a special
// one that adds an optional second parameter to loadMultiple().
$media_types = $this->entityTypeManager
->getStorage('media_type')
->... | php | {
"resource": ""
} |
q25996 | MediaHelper.createFromInput | train | public function createFromInput($value, array $bundles = []) {
/** @var \Drupal\media\MediaInterface $entity */
$entity = $this->entityTypeManager
->getStorage('media')
->create([
'bundle' => $this->getBundleFromInput($value, | php | {
"resource": ""
} |
q25997 | MediaHelper.useFile | train | public static function useFile(MediaInterface $entity, FileInterface $file, $replace = FILE_EXISTS_RENAME) {
$field = static::getSourceField($entity);
$field->setValue($file);
$destination = '';
$destination .= static::prepareFileDestination($entity);
if (substr($destination, -1) != '/') {
$d... | php | {
"resource": ""
} |
q25998 | MediaHelper.prepareFileDestination | train | public static function prepareFileDestination(MediaInterface $entity) {
/** @var \Drupal\file\Plugin\Field\FieldType\FileItem $item */
$item = static::getSourceField($entity)->first();
$dir = $item->getUploadLocation();
$is_ready = file_prepare_directory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMIS... | php | {
"resource": ""
} |
q25999 | MediaHelper.getSourceField | train | public static function getSourceField(MediaInterface $entity) {
$field = $entity->getSource()->getSourceFieldDefinition($entity->bundle->entity);
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.