_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q26000
Upload.validate
train
public static function validate(array &$element, FormStateInterface $form_state) { if ($element['#value']) { $file = File::load($element['#value']); $errors = file_validate($file, $element['#upload_validators']); if ($errors) { foreach ($errors as $error) { $form_state->setError...
php
{ "resource": "" }
q26001
Upload.delete
train
public static function delete(array $element) { if ($element['#value']) { $file = File::load($element['#value']); $file->delete(); // Clean up the file system if needed. $uri = $file->getFileUri(); if (file_exists($uri)) { \Drupal::service('file_system')->unlink($uri); }...
php
{ "resource": "" }
q26002
IniEncoder.doEncode
train
protected function doEncode(array $input, array $keys = []) { $output = []; foreach ($input as $key => $value) { $keys[] = $key; if (is_array($value)) { if ($this->isAssociative($value)) { $output = array_merge($output, $this->doEncode($value, $keys)); } else { ...
php
{ "resource": "" }
q26003
IniEncoder.keysToString
train
protected function keysToString(array $keys) { $head = array_shift($keys); if ($keys) { return $head . '[' . implode('][', $keys) . ']'; } else { return $head; } }
php
{ "resource": "" }
q26004
IniEncoder.parse
train
public function parse($data) { $info = []; if (preg_match_all(' @^\s* # Start at the beginning of a line, ignoring leading whitespace ((?: [^=;\[\]]| # Key names cannot contain equal signs, semi-colons or square brackets, \[[^\[\]]*\] ...
php
{ "resource": "" }
q26005
Package.isLibrary
train
protected function isLibrary(array $package) { // Add Swiftmailer support. if ($package['name'] == 'swiftmailer/swiftmailer') { $package['type'] = 'drupal-library'; } $package_types = [ 'drupal-library', 'bower-asset', 'npm-asset', ]; return ( in_array($package['ty...
php
{ "resource": "" }
q26006
Package.isGovCMSTheme
train
protected function isGovCMSTheme(array $package) { // Exlucde package theme from custom repos. if ($package['name'] == 'govcms-custom/govcms8_uikit' || $package['name'] == 'govcms-custom/govcms8_uikit_starter') { return FALSE; } $package_types = [ 'drupal-theme', ]; return ( i...
php
{ "resource": "" }
q26007
InteractiveUpload.process
train
public static function process(array $element, FormStateInterface $form_state) { $element['fid'] = [ '#type' => 'hidden', ]; $element['upload'] = $element['remove'] = [ '#type' => 'submit', '#is_button' => TRUE, '#limit_validation_errors' => [ $element['#parents'], ], ...
php
{ "resource": "" }
q26008
InteractiveUpload.el
train
public static function el(array &$form, FormStateInterface $form_state) { $trigger = $form_state->getTriggeringElement(); return NestedArray::getValue($form, array_slice($trigger['#array_parents'], 0, -1)); }
php
{ "resource": "" }
q26009
InteractiveUpload.upload
train
public static function upload(array &$form, FormStateInterface $form_state) { $el = static::el($form, $form_state); $form_state->setValueForElement($el['fid'], $el['file']['#value']); NestedArray::setValue($form_state->getUserInput(), $el['fid']['#parents'], $el['file']['#value']); $form_state->setReb...
php
{ "resource": "" }
q26010
InteractiveUpload.remove
train
public static function remove(array &$form, FormStateInterface $form_state) { $el = static::el($form, $form_state); Upload::delete($el['fid']); $form_state->setValueForElement($el['fid'], NULL); NestedArray::setValue($form_state->getUserInput(), $el['fid']['#parents'], NULL); $form_state->setRebu...
php
{ "resource": "" }
q26011
Element.mergeCanadian
train
public function mergeCanadian(array $a, array $b) { $a += $b; foreach ($a as $k => $v) { if (is_array($v) && isset($b[$k]) && is_array($b[$k])) { $a[$k] = static::mergeCanadian($a[$k], $b[$k]); } } return $a; }
php
{ "resource": "" }
q26012
Element.order
train
public static function order(array &$values, array $keys) { $keys = array_values($keys); uksort($values, function ($a, $b) use ($keys) { return array_search($a, $keys) - array_search($b, $keys); }); }
php
{ "resource": "" }
q26013
Element.disableButtons
train
public static function disableButtons(array $element) { if (isset($element['#type'])) { $element['#access'] = !in_array($element['#type'], [ 'button', 'submit', 'image_button', ]); } // Recurse into child elements. foreach (RenderElement::children($element) as $key) ...
php
{ "resource": "" }
q26014
Element.oxford
train
public static function oxford(array $items, $conjunction = 'and') { $count = count($items); if ($count < 2) { return (string) reset($items); } elseif ($count === 2) { return reset($items) . ' ' . $conjunction . ' ' . end($items); } else { $items[] = $conjunction . ' ' . array_...
php
{ "resource": "" }
q26015
OverrideHelper.entityClass
train
public static function entityClass(EntityTypeInterface $entity_type, $replacement_class) { if (get_parent_class($replacement_class) == $entity_type->getClass()) { $entity_type->setClass($replacement_class); } }
php
{ "resource": "" }
q26016
OverrideHelper.entityForm
train
public static function entityForm(EntityTypeInterface $entity_type, $replacement_class, $operation = 'default') { if (get_parent_class($replacement_class) == $entity_type->getFormClass($operation)) { $entity_type->setFormClass($operation, $replacement_class); } }
php
{ "resource": "" }
q26017
OverrideHelper.entityHandler
train
public static function entityHandler(EntityTypeInterface $entity_type, $handler_type, $replacement_class) { if (get_parent_class($replacement_class) == $entity_type->getHandlerClass($handler_type)) { $entity_type->setHandlerClass($handler_type, $replacement_class); } }
php
{ "resource": "" }
q26018
FileUpload.processUploadElement
train
public function processUploadElement(array $element, FormStateInterface $form_state) { $element = AjaxUpload::process($element, $form_state); $element['upload']['#ajax']['callback'] = $element['remove']['#ajax']['callback'] = [static::class, 'ajax']; $element['remove']['#value'] = $this->t('Cancel'); ...
php
{ "resource": "" }
q26019
ImportProcessorBase.loadEntitiesByProperties
train
public function loadEntitiesByProperties($entity_type, array $values) { $entities = $this->entityTypeManager->getStorage($entity_type)->loadByProperties($values); if (!empty($entities)) { return $entities; } }
php
{ "resource": "" }
q26020
ImportProcessorBase.mapBasicField
train
public function mapBasicField(array &$values, $field_name) { $item = $this->item; if (!empty($item[$field_name])) { $values[$field_name] = $item[$field_name]; } }
php
{ "resource": "" }
q26021
ImportProcessorBase.mapParagraphField
train
public function mapParagraphField(array $paragraphs) { $entities = \Drupal::classResolver()->getInstanceFromDefinition(InstallHelper::class)->importParagraphs($paragraphs); if (!empty($entities)) { return $entities; } return []; }
php
{ "resource": "" }
q26022
ImportProcessorBase.populateMediaField
train
public function populateMediaField($field_name) { $item = $this->item; $assets = []; if (!empty($item[$field_name])) { $data = $this->loadDataArray('media_image'); foreach ($item[$field_name] as $k => $value) { if (!empty($data[$value])) { $name = $data[$value]['name']; ...
php
{ "resource": "" }
q26023
ImportProcessorBase.mapTaxonomyTermField
train
public function mapTaxonomyTermField($field_name, $vid) { $entities = $this->populateTaxonomyTermField($field_name, $vid); if (!empty($entities)) { return $entities; } return []; }
php
{ "resource": "" }
q26024
ImportProcessorBase.populateTaxonomyTermField
train
public function populateTaxonomyTermField($field_name, $vid) { $item = $this->item; $terms = []; if (!empty($item[$field_name])) { $data = $this->loadDataArray('taxonomy'); foreach ($item[$field_name] as $k => $value) { if (!empty($data[$value])) { $name = $data[$value]['name'...
php
{ "resource": "" }
q26025
ImportProcessorBase.populateEntityReferenceField
train
public function populateEntityReferenceField($field_name) { $item = $this->item; $node = []; if (!empty($item[$field_name])) { $data = $this->loadDataArray('node'); foreach ($item[$field_name] as $k => $value) { if (!empty($data[$value])) { $title = $data[$value]['title']; ...
php
{ "resource": "" }
q26026
InstallHelper.importPages
train
protected function importPages() { $data = $this->loadDataArray('node'); if (!empty($data)) { $uuids = []; foreach ($data as $item) { // Prepare content. $values = [ 'type' => $item['type'], 'title' => $item['title'], ]; // Fields mapping starts...
php
{ "resource": "" }
q26027
InstallHelper.importMediaImages
train
protected function importMediaImages() { $data = $this->loadDataArray('media_image'); if (!empty($data)) { $uuids = []; foreach ($data as $item) { // Prepare content. $values = [ 'bundle' => $item['bundle'], 'name' => $item['name'], ]; $file = ...
php
{ "resource": "" }
q26028
InstallHelper.importTaxonomyTerms
train
protected function importTaxonomyTerms() { $data = $this->loadDataArray('taxonomy'); if (!empty($data)) { $uuids = []; foreach ($data as $item) { // Prepare content. $values = [ 'vid' => $item['vid'], 'name' => $item['name'], ]; // Set author. ...
php
{ "resource": "" }
q26029
InstallHelper.importParagraphs
train
public function importParagraphs(array $paragraphs) { $data = $this->loadDataArray('paragraph'); $paragraph_items = []; $uuids = []; foreach ($paragraphs as $k => $paragraph_data) { $item = $data[$paragraph_data]; if (!empty($item)) { // Prepare content. $values = [ ...
php
{ "resource": "" }
q26030
InstallHelper.getBodyData
train
public function getBodyData($body) { $module_path = $this->moduleHandler->getModule('govcms8_default_content')->getPath(); if (!empty($body)) { if (is_array($body) && !empty($body['file'])) { $file = $body['file']; $body_path = $module_path . '/import/html_body/' . $file; $body_htm...
php
{ "resource": "" }
q26031
InstallHelper.loadProcessorPlugins
train
public function loadProcessorPlugins(&$values, $item, $entity_type) { $manager = \Drupal::service('plugin.manager.import_processor'); $import_processors = $manager->getDefinitions(); foreach ($import_processors as $plugin_id => $import_processor) { if ($import_processor['type'] == $entity_type . ':' ....
php
{ "resource": "" }
q26032
InstallHelper.saveFile
train
public function saveFile($file_name) { $path = 'public://govcms8-demo'; if (file_prepare_directory($path, FILE_CREATE_DIRECTORY)) { $source = DRUPAL_ROOT . '/' . drupal_get_path('module', 'govcms8_default_content') . '/import/images/' . $file_name; $data = file_get_contents($source); return fi...
php
{ "resource": "" }
q26033
InstallHelper.deleteImportedContent
train
public function deleteImportedContent() { $uuids = $this->state->get('govcms8_default_content_uuids', []); $by_entity_type = array_reduce(array_keys($uuids), function ($carry, $uuid) use ($uuids) { $entity_type_id = $uuids[$uuid]; $carry[$entity_type_id][] = $uuid; return $carry; }, []); ...
php
{ "resource": "" }
q26034
InstallHelper.getUser
train
protected function getUser($name) { $user_storage = $this->entityTypeManager->getStorage('user'); $users = $user_storage->loadByProperties(['name' => $name]);; if (empty($users)) { // Creating user without any email/password. $user = $user_storage->create([ 'name' => $name, 'stat...
php
{ "resource": "" }
q26035
InstallHelper.getTerm
train
protected function getTerm($term_name, $vocabulary_id = 'tags') { $term_name = trim($term_name); $term_storage = $this->entityTypeManager->getStorage('taxonomy_term'); $terms = $term_storage->loadByProperties([ 'name' => $term_name, 'vid' => $vocabulary_id, ]); if (!$terms) { $term...
php
{ "resource": "" }
q26036
InstallHelper.createFileEntity
train
protected function createFileEntity($path) { $uri = $this->fileUnmanagedCopy($path); $file = $this->entityTypeManager->getStorage('file')->create([ 'uri' => $uri, 'status' => 1, ]); $file->save(); $this->storeCreatedContentUuids([$file->uuid() => 'file']); return $file->id(); }
php
{ "resource": "" }
q26037
InstallHelper.storeCreatedContentUuids
train
protected function storeCreatedContentUuids(array $uuids) { $uuids = $this->state->get('govcms8_default_content_uuids', []) + $uuids; $this->state->set('govcms8_default_content_uuids', $uuids); }
php
{ "resource": "" }
q26038
LOC.toDms
train
private function toDms(float $decimal, string $axis = self::LATITUDE): string { $d = (int) floor(abs($decimal)); $m = (int) floor((abs($decimal) - $d) * 60); $s = ((abs($decimal) - $d) * 60 - $m) * 60; if (self::LATITUDE === $axis) { $h = ($decimal < 0) ? 'S' : 'N'; ...
php
{ "resource": "" }
q26039
ZoneBuilder.fullyQualify
train
private static function fullyQualify(string $subdomain, string $parent): string { if ('@' === $subdomain) { return $parent; } if ('.' !== substr($subdomain, -1, 1)) { return $subdomain.'.'.$parent; } return $subdomain; }
php
{ "resource": "" }
q26040
Parser.processResourceName
train
private function processResourceName(\ArrayIterator $iterator, ResourceRecord $resourceRecord): void { if ($this->isResourceName($iterator)) { $this->previousName = $iterator->current(); $iterator->next(); } $resourceRecord->setName($this->previousName); }
php
{ "resource": "" }
q26041
Parser.processTtl
train
private function processTtl(\ArrayIterator $iterator, ResourceRecord $resourceRecord): void { if ($this->isTTL($iterator)) { $resourceRecord->setTtl($iterator->current()); $iterator->next(); } }
php
{ "resource": "" }
q26042
Parser.processClass
train
private function processClass(\ArrayIterator $iterator, ResourceRecord $resourceRecord): void { if (Classes::isValid(strtoupper($iterator->current()))) { $resourceRecord->setClass(strtoupper($iterator->current())); $iterator->next(); } }
php
{ "resource": "" }
q26043
Parser.isResourceName
train
private function isResourceName(\ArrayIterator $iterator): bool { return !( $this->isTTL($iterator) || Classes::isValid(strtoupper($iterator->current())) || RDataTypes::isValid(strtoupper($iterator->current())) ); }
php
{ "resource": "" }
q26044
Factory.newRdataFromName
train
public static function newRdataFromName(string $name): RdataInterface { if (!self::isTypeImplemented($name)) { throw new UnsupportedTypeException($name); } $namespace = '\\Badcow\\DNS\\Rdata\\'; $className = $namespace.strtoupper($name); if (!class_exists($class...
php
{ "resource": "" }
q26045
Normaliser.handleComment
train
private function handleComment(): void { if ($this->string->isNot(Tokens::SEMICOLON)) { return; } while ($this->string->isNot(Tokens::LINE_FEED) && $this->string->valid()) { $this->string->next(); } }
php
{ "resource": "" }
q26046
Normaliser.handleTxt
train
private function handleTxt(): void { if ($this->string->isNot(Tokens::DOUBLE_QUOTES)) { return; } $this->append(); while ($this->string->isNot(Tokens::DOUBLE_QUOTES)) { if (!$this->string->valid()) { throw new ParseException('Unbalanced doubl...
php
{ "resource": "" }
q26047
Normaliser.handleMultiline
train
private function handleMultiline(): void { if ($this->string->isNot(Tokens::OPEN_BRACKET)) { return; } $this->string->next(); while ($this->string->valid()) { $this->handleTxt(); $this->handleComment(); if ($this->string->is(Tokens::L...
php
{ "resource": "" }
q26048
Normaliser.removeWhitespace
train
private function removeWhitespace(): void { $string = preg_replace('/ {2,}/', Tokens::SPACE, $this->normalisedString); $lines = []; foreach (explode(Tokens::LINE_FEED, $string) as $line) { if ('' !== $line = trim($line)) { $lines[] = $line; } ...
php
{ "resource": "" }
q26049
Validator.fullyQualifiedDomainName
train
public static function fullyQualifiedDomainName(string $name): bool { $isValid = strlen($name) < 254; $isValid &= 1 === preg_match('/^(?:(?!-)[a-z0-9\-]{1,63}(?<!-)\.){1,127}$/i', $name); return $isValid; }
php
{ "resource": "" }
q26050
Validator.countClasses
train
private static function countClasses(Zone $zone): int { $classes = []; foreach ($zone as $rr) { if (null !== $rr->getClass()) { $classes[$rr->getClass()] = null; } } return count($classes); }
php
{ "resource": "" }
q26051
AlignedBuilder.makeLine
train
private static function makeLine(string $text, ?string $comment, int $longestVarLength, int $padding): string { $output = str_repeat(' ', $padding).str_pad($text, $longestVarLength); if (null !== $comment) { $output .= ' '.self::COMMENT_DELIMINATOR.$comment; } return $o...
php
{ "resource": "" }
q26052
AlignedBuilder.getPadding
train
private static function getPadding(Zone $zone) { $name = $ttl = $type = 0; foreach ($zone as $resourceRecord) { $name = max($name, strlen($resourceRecord->getName())); $ttl = max($ttl, strlen($resourceRecord->getTtl())); $type = max($type, strlen($resourceRecord-...
php
{ "resource": "" }
q26053
Zone.getClass
train
public function getClass(): string { foreach ($this->resourceRecords as $resourceRecord) { if (null !== $resourceRecord->getClass()) { return $resourceRecord->getClass(); } } return Classes::INTERNET; }
php
{ "resource": "" }
q26054
Algorithms.getMnemonic
train
public static function getMnemonic(int $algorithmId) { if (!array_key_exists($algorithmId, self::$mnemonic)) { throw new \InvalidArgumentException(sprintf('"%d" id not a valid algorithm.', $algorithmId)); } return self::$mnemonic[$algorithmId]; }
php
{ "resource": "" }
q26055
Toolbox.expandIpv6
train
public static function expandIpv6(string $ip): string { if (!Validator::ipv6($ip)) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid IPv6 address.', $ip)); } $hex = unpack('H*hex', inet_pton($ip)); return implode(':', str_split($hex['hex'], 4)); }
php
{ "resource": "" }
q26056
Toolbox.contractIpv6
train
public static function contractIpv6(string $ip): string { if (!Validator::ipv6($ip)) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid IPv6 address.', $ip)); } return inet_ntop(inet_pton($ip)); }
php
{ "resource": "" }
q26057
Toolbox.reverseIpv4
train
public static function reverseIpv4(string $ip): string { $octets = array_reverse(explode('.', $ip)); return implode('.', $octets).'.in-addr.arpa.'; }
php
{ "resource": "" }
q26058
Toolbox.reverseIpv6
train
public static function reverseIpv6(string $ip, bool $appendSuffix = true): string { try { $ip = self::expandIpv6($ip); } catch (\InvalidArgumentException $e) { $ip = self::expandIncompleteIpv6($ip); } $ip = str_replace(':', '', $ip); $ip = strrev($ip)...
php
{ "resource": "" }
q26059
ParseException.getLineNumber
train
private function getLineNumber(): int { $pos = $this->stringIterator->key(); $this->stringIterator->rewind(); $lineNo = 1; while ($this->stringIterator->key() < $pos) { if ($this->stringIterator->is(Tokens::LINE_FEED)) { ++$lineNo; } ...
php
{ "resource": "" }
q26060
RdataHandlers.dmsToDecimal
train
public static function dmsToDecimal(int $deg, int $min, float $sec, string $hemisphere): float { $multiplier = ('S' === $hemisphere || 'W' === $hemisphere) ? -1 : 1; return $multiplier * ($deg + ($min / 60) + ($sec / 3600)); }
php
{ "resource": "" }
q26061
RdataHandlers.catchAll
train
public static function catchAll(string $type, \ArrayIterator $iterator): Rdata\RdataInterface { if (!Rdata\Factory::isTypeImplemented($type)) { return new Rdata\PolymorphicRdata($type, implode(Tokens::SPACE, self::getAllRemaining($iterator))); } return call_user_func_array([Rdat...
php
{ "resource": "" }
q26062
RdataHandlers.pop
train
private static function pop(\ArrayIterator $iterator): string { $current = $iterator->current(); $iterator->next(); return $current; }
php
{ "resource": "" }
q26063
RdataHandlers.getAllRemaining
train
private static function getAllRemaining(\ArrayIterator $iterator): array { $values = []; while ($iterator->valid()) { $values[] = $iterator->current(); $iterator->next(); } return $values; }
php
{ "resource": "" }
q26064
ClientToken.allowClientIncoming
train
public function allowClientIncoming($clientName) { // clientName must be a non-zero length alphanumeric string if (preg_match('/\W/', $clientName)) { throw new \InvalidArgumentException( 'Only alphanumeric characters allowed in client name.'); } if (strlen($...
php
{ "resource": "" }
q26065
ClientToken.generateToken
train
public function generateToken($ttl = 3600) { $payload = array_merge($this->customClaims, array( 'scope' => array(), 'iss' => $this->accountSid, 'exp' => time() + $ttl, )); $scopeStrings = array(); foreach ($this->scopes as $scope) { if ($s...
php
{ "resource": "" }
q26066
RequestValidator.compare
train
public static function compare($a, $b) { $result = true; if (strlen($a) != strlen($b)) { return false; } if (!$a && !$b) { return true; } $limit = strlen($a); for ($i = 0; $i < $limit; ++$i) { if ($a[$i] != $b[$i]) { ...
php
{ "resource": "" }
q26067
SessionList.create
train
public function create($messagingServiceSid, $options = array()) { $options = new Values($options); $data = Values::of(array( 'MessagingServiceSid' => $messagingServiceSid, 'FriendlyName' => $options['friendlyName'], 'Attributes' => $options['attributes'], ...
php
{ "resource": "" }
q26068
InviteList.create
train
public function create($identity, $options = array()) { $options = new Values($options); $data = Values::of(array('Identity' => $identity, 'RoleSid' => $options['roleSid'], )); $payload = $this->version->create( 'POST', $this->uri, array(), $data...
php
{ "resource": "" }
q26069
InviteList.stream
train
public function stream($options = array(), $limit = null, $pageSize = null) { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); }
php
{ "resource": "" }
q26070
InviteList.getContext
train
public function getContext($sid) { return new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); }
php
{ "resource": "" }
q26071
InstalledAddOnList.create
train
public function create($availableAddOnSid, $acceptTermsOfService, $options = array()) { $options = new Values($options); $data = Values::of(array( 'AvailableAddOnSid' => $availableAddOnSid, 'AcceptTermsOfService' => Serialize::booleanToString($acceptTermsOfService), ...
php
{ "resource": "" }
q26072
EngagementList.create
train
public function create($to, $from, $options = array()) { $options = new Values($options); $data = Values::of(array( 'To' => $to, 'From' => $from, 'Parameters' => Serialize::jsonObject($options['parameters']), )); $payload = $this->version->create( ...
php
{ "resource": "" }
q26073
AwsList.create
train
public function create($credentials, $options = array()) { $options = new Values($options); $data = Values::of(array( 'Credentials' => $credentials, 'FriendlyName' => $options['friendlyName'], 'AccountSid' => $options['accountSid'], )); $payload = $t...
php
{ "resource": "" }
q26074
ReservationList.getContext
train
public function getContext($sid) { return new ReservationContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskSid'], $sid ); }
php
{ "resource": "" }
q26075
ServiceContext.getSessions
train
protected function getSessions() { if (!$this->_sessions) { $this->_sessions = new SessionList($this->version, $this->solution['sid']); } return $this->_sessions; }
php
{ "resource": "" }
q26076
ServiceContext.getPhoneNumbers
train
protected function getPhoneNumbers() { if (!$this->_phoneNumbers) { $this->_phoneNumbers = new PhoneNumberList($this->version, $this->solution['sid']); } return $this->_phoneNumbers; }
php
{ "resource": "" }
q26077
ServiceContext.getShortCodes
train
protected function getShortCodes() { if (!$this->_shortCodes) { $this->_shortCodes = new ShortCodeList($this->version, $this->solution['sid']); } return $this->_shortCodes; }
php
{ "resource": "" }
q26078
IncomingPhoneNumberContext.getAssignedAddOns
train
protected function getAssignedAddOns() { if (!$this->_assignedAddOns) { $this->_assignedAddOns = new AssignedAddOnList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_assignedAddOn...
php
{ "resource": "" }
q26079
EntityContext.getFactors
train
protected function getFactors() { if (!$this->_factors) { $this->_factors = new FactorList( $this->version, $this->solution['serviceSid'], $this->solution['identity'] ); } return $this->_factors; }
php
{ "resource": "" }
q26080
Client.request
train
public function request($method, $uri, $params = array(), $data = array(), $headers = array(), $username = null, $password = null, $timeout = null) { $username = $username ? $username : $this->username; $password = $password ? $password : $this->password; $headers['User-Agent'] = 'twilio-php/' ...
php
{ "resource": "" }
q26081
Client.validateSslCertificate
train
public function validateSslCertificate($client) { $response = $client->request('GET', 'https://api.twilio.com:8443'); if ($response->getStatusCode() < 200 || $response->getStatusCode() > 300) { throw new TwilioException("Failed to validate SSL certificate"); } }
php
{ "resource": "" }
q26082
RecordingContext.getAddOnResults
train
protected function getAddOnResults() { if (!$this->_addOnResults) { $this->_addOnResults = new AddOnResultList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_addOnResults; }
php
{ "resource": "" }
q26083
FieldTypeContext.getFieldValues
train
protected function getFieldValues() { if (!$this->_fieldValues) { $this->_fieldValues = new FieldValueList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_fieldValues; }
php
{ "resource": "" }
q26084
FleetList.create
train
public function create($options = array()) { $options = new Values($options); $data = Values::of(array('FriendlyName' => $options['friendlyName'], )); $payload = $this->version->create( 'POST', $this->uri, array(), $data ); retur...
php
{ "resource": "" }
q26085
CountryContext.getHighriskSpecialPrefixes
train
protected function getHighriskSpecialPrefixes() { if (!$this->_highriskSpecialPrefixes) { $this->_highriskSpecialPrefixes = new HighriskSpecialPrefixList( $this->version, $this->solution['isoCode'] ); } return $this->_highriskSpecialPrefix...
php
{ "resource": "" }
q26086
StepContext.fetch
train
public function fetch() { $params = Values::of(array()); $payload = $this->version->fetch( 'GET', $this->uri, $params ); return new StepInstance( $this->version, $payload, $this->solution['flowSid'], $t...
php
{ "resource": "" }
q26087
PublishedTrackList.getContext
train
public function getContext($sid) { return new PublishedTrackContext( $this->version, $this->solution['roomSid'], $this->solution['participantSid'], $sid ); }
php
{ "resource": "" }
q26088
WorkerList.create
train
public function create($friendlyName, $options = array()) { $options = new Values($options); $data = Values::of(array( 'FriendlyName' => $friendlyName, 'ActivitySid' => $options['activitySid'], 'Attributes' => $options['attributes'], )); $payload = $...
php
{ "resource": "" }
q26089
SyncListContext.getSyncListItems
train
protected function getSyncListItems() { if (!$this->_syncListItems) { $this->_syncListItems = new SyncListItemList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncListItems; ...
php
{ "resource": "" }
q26090
SyncListContext.getSyncListPermissions
train
protected function getSyncListPermissions() { if (!$this->_syncListPermissions) { $this->_syncListPermissions = new SyncListPermissionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $...
php
{ "resource": "" }
q26091
AuthorizationDocumentContext.getDependentHostedNumberOrders
train
protected function getDependentHostedNumberOrders() { if (!$this->_dependentHostedNumberOrders) { $this->_dependentHostedNumberOrders = new DependentHostedNumberOrderList( $this->version, $this->solution['sid'] ); } return $this->_dependen...
php
{ "resource": "" }
q26092
FaxList.create
train
public function create($to, $mediaUrl, $options = array()) { $options = new Values($options); $data = Values::of(array( 'To' => $to, 'MediaUrl' => $mediaUrl, 'Quality' => $options['quality'], 'StatusCallback' => $options['statusCallback'], 'Fr...
php
{ "resource": "" }
q26093
AvailablePhoneNumberCountryContext.getLocal
train
protected function getLocal() { if (!$this->_local) { $this->_local = new LocalList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_local; }
php
{ "resource": "" }
q26094
AvailablePhoneNumberCountryContext.getTollFree
train
protected function getTollFree() { if (!$this->_tollFree) { $this->_tollFree = new TollFreeList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_tollFree; }
php
{ "resource": "" }
q26095
AvailablePhoneNumberCountryContext.getMobile
train
protected function getMobile() { if (!$this->_mobile) { $this->_mobile = new MobileList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_mobile; }
php
{ "resource": "" }
q26096
AvailablePhoneNumberCountryContext.getNational
train
protected function getNational() { if (!$this->_national) { $this->_national = new NationalList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_national; }
php
{ "resource": "" }
q26097
AvailablePhoneNumberCountryContext.getVoip
train
protected function getVoip() { if (!$this->_voip) { $this->_voip = new VoipList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_voip; }
php
{ "resource": "" }
q26098
AvailablePhoneNumberCountryContext.getSharedCost
train
protected function getSharedCost() { if (!$this->_sharedCost) { $this->_sharedCost = new SharedCostList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_sharedCost; }
php
{ "resource": "" }
q26099
AvailablePhoneNumberCountryContext.getMachineToMachine
train
protected function getMachineToMachine() { if (!$this->_machineToMachine) { $this->_machineToMachine = new MachineToMachineList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $thi...
php
{ "resource": "" }