_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q6300 | DocumentHydrator.processSingleResourceDocument | train | protected function processSingleResourceDocument($source): SingleResourceDocument
{
$resource = $this->hydrateResource($source->data);
$document = new SingleResourceDocument($resource);
$this->hydrateObject($document, $source);
return $document;
} | php | {
"resource": ""
} |
q6301 | DocumentHydrator.processResourceCollectionDocument | train | protected function processResourceCollectionDocument($source): ResourceCollectionDocument
{
$document = new ResourceCollectionDocument();
foreach ($source->data as $resourceSrc)
{
$document->addResource($this->hydrateResource($resourceSrc));
}
$this->hydrateObje... | php | {
"resource": ""
} |
q6302 | Mailer.send | train | public function send($first, $last, $email, $message)
{
$quote = nl2br($message);
$name = $first.' '.$last;
$this->sendMessage($name, $email, $quote);
$this->sendThanks($first, $email, $quote);
} | php | {
"resource": ""
} |
q6303 | HttpClient.streamToDocument | train | protected function streamToDocument(StreamInterface $stream): AbstractDocument
{
$content = $stream->getContents();
$decoded = json_decode($content);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException('Decoding error: "' . json_last_error_msg() . '""');
... | php | {
"resource": ""
} |
q6304 | HttpClient.documentToStream | train | protected function documentToStream(AbstractDocument $document): StreamInterface
{
$encoded = json_encode($document->toArray());
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException('Encoding error: "' . json_last_error_msg() . '""');
}
$stream = fop... | php | {
"resource": ""
} |
q6305 | BaseResource.getId | train | protected function getId($id = null)
{
$id = (empty($id)) ? $this->resourceId : $id;
if (empty($id)) {
throw new \Exception('Invalid id supplied [' . $id . ']. Operation requires valid resource id.');
}
return $id;
} | php | {
"resource": ""
} |
q6306 | BaseResource.request | train | protected function request($verb, $path, $resource = '', array $payload = [])
{
return $this->client->request($verb, $path, $this->resourceType, $resource, $payload, $this->headers);
} | php | {
"resource": ""
} |
q6307 | Template.render | train | public function render()
{
require_once 'functions_include.php';
$block = [];
foreach ($this->blocks as $key => &$subTpl) {
$block[ $key ] = !is_null($subTpl)
? $this->filter('block.' . $key, $subTpl->render())
: '';
}
foreach ($th... | php | {
"resource": ""
} |
q6308 | CustomerRemoveLostUserDataTypo3.migrate | train | public function migrate()
{
$this->msg( 'Remove left over TYPO3 fe_users references', 0, '' );
foreach( $this->sql as $table => $stmt )
{
$this->msg( sprintf( 'Remove unused %1$s records', $table ), 1 );
if( $this->schema->tableExists( 'fe_users' ) && $this->schema->tableExists( $table ) )
{
$this... | php | {
"resource": ""
} |
q6309 | FormBuilder.group | train | public function group($name, $balise, callable $callback, $attr = null)
{
$form = new FormBuilder([]);
call_user_func_array($callback, [ &$form ]);
$group = $this->merge_attr([ 'balise' => $balise ], $attr);
return $this->input($name, [ 'type' => 'group', 'subform' => $form, 'attr'... | php | {
"resource": ""
} |
q6310 | FormBuilder.label | train | public function label($name, $label, array $attr = null)
{
return $this->input($name, [ 'type' => 'label', 'label' => $label, 'attr' => $attr ]);
} | php | {
"resource": ""
} |
q6311 | FormBuilder.legend | train | public function legend($name, $legend, array $attr = null)
{
return $this->input($name, [ 'type' => 'legend', 'legend' => $legend, 'attr' => $attr ]);
} | php | {
"resource": ""
} |
q6312 | FormBuilder.textarea | train | public function textarea($name, $id, $content = '', array $attr = null)
{
$basic = $this->merge_attr([ 'id' => $id ], $attr);
return $this->input($name, [ 'id' => $id, 'type' => 'textarea', 'content' => $content,
'attr' => $basic ]);
} | php | {
"resource": ""
} |
q6313 | FormBuilder.inputBasic | train | public function inputBasic($type, $name, $id, array $attr = null)
{
$basic = $this->merge_attr([ 'id' => $id ], $attr);
return $this->input($name, [ 'type' => $type, 'attr' => $basic ]);
} | php | {
"resource": ""
} |
q6314 | FormBuilder.submit | train | public function submit($name, $value, array $attr = null)
{
$basic = $this->merge_attr([ 'value' => $value ], $attr);
return $this->input($name, [ 'type' => 'submit', 'attr' => $basic ]);
} | php | {
"resource": ""
} |
q6315 | FormBuilder.input | train | protected function input($name, array $attr)
{
/**
* Si le for n'est pas précisé dans le label précédent
* il devient automatiquement l'id de la balise courante.
*/
$previous = end($this->form);
if ($previous && $previous[ 'type' ] == 'label' && !isset($previous[ '... | php | {
"resource": ""
} |
q6316 | FormBuilder.getAttributesCSS | train | protected function getAttributesCSS(array $attr)
{
$output = [];
foreach ($attr as $key => $values) {
if (in_array($key, $this->attributesCss) && $values !== '') {
$output[] = $key . '="' . $values . '"';
}
}
$implode = implode(' ', $output);
... | php | {
"resource": ""
} |
q6317 | FormBuilder.getAttributesInput | train | protected function getAttributesInput(array $attr)
{
$output = [];
foreach ($attr as $key => $values) {
if (empty($values)) {
continue;
}
if (in_array($key, $this->attributesUnique)) {
$output[] = $key;
} elseif (!in_arr... | php | {
"resource": ""
} |
q6318 | Size.getSize | train | protected function getSize($value)
{
if (is_numeric($value)) {
/* numeric+0 = int|float */
return $value + 0;
}
if (is_string($value)) {
return strlen($value);
}
if (is_array($value)) {
return count($value);
}
if... | php | {
"resource": ""
} |
q6319 | ByteFormatter.format | train | public function format($bytes, $precision = null)
{
// Use default precision when not specified.
$precision === null && $precision = $this->getPrecision();
$log = log($bytes, $this->getBase());
$exponent = $this->hasFixedExponent() ? $this->getFixedExponent() : max(0, $log|0);
... | php | {
"resource": ""
} |
q6320 | ByteFormatter.formatValue | train | private function formatValue($value, $precision)
{
$formatted = sprintf("%0.${precision}F", $value);
if ($this->hasAutomaticPrecision()) {
// [0 => integer part, 1 => fractional part].
$formattedParts = explode('.', $formatted);
if (isset($formattedParts[1])) {
... | php | {
"resource": ""
} |
q6321 | RelationshipsContainer.relationshipsToArray | train | protected function relationshipsToArray(): array
{
$relationships = [];
foreach ($this->relationships as $name => $relationship)
{
$relationships[$name] = $relationship->toArray();
}
return $relationships;
} | php | {
"resource": ""
} |
q6322 | SymfonyEventDispatcherDecorator.dispatchOnRequest | train | protected function dispatchOnRequest(RequestInterface $request): RequestInterface
{
$requestEvent = new RequestEvent($request);
$this->dispatcher->dispatch($this->requestEvent, $requestEvent);
return $requestEvent->getRequest();
} | php | {
"resource": ""
} |
q6323 | SymfonyEventDispatcherDecorator.dispatchOnResponse | train | protected function dispatchOnResponse(ResponseInterface $response): ResponseInterface
{
$responseEvent = new ResponseEvent($response);
$this->dispatcher->dispatch($this->responseEvent, $responseEvent);
return $responseEvent->getResponse();
} | php | {
"resource": ""
} |
q6324 | Typo3.saveItem | train | public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
{
self::checkClass( \Aimeos\MShop\Customer\Item\Group\Iface::class, $item );
if( !$item->isModified() ) {
return $item;
}
$context = $this->getContext();
$dbm = $context->getDatabaseManager();
$dbname = $this->getResourc... | php | {
"resource": ""
} |
q6325 | RelationshipProcessor.process | train | public function process(\ReflectionClass $reflection, Definition $definition)
{
foreach ($reflection->getProperties() as $property)
{
$this->processProperty($property, $definition);
}
} | php | {
"resource": ""
} |
q6326 | RelationshipProcessor.handleDataControl | train | protected function handleDataControl(RelationshipAnnotation $annotation, Relationship $relationship)
{
$relationship->setIncludeData($annotation->dataAllowed);
$relationship->setDataLimit($annotation->dataLimit);
} | php | {
"resource": ""
} |
q6327 | RelationshipProcessor.resolveType | train | protected function resolveType(RelationshipAnnotation $annotation): int
{
if ($annotation->type === RelationshipAnnotation::TYPE_ONE) {
return Relationship::TYPE_X_TO_ONE;
}
if ($annotation->type === RelationshipAnnotation::TYPE_MANY) {
return Relationship::TYPE_X_TO... | php | {
"resource": ""
} |
q6328 | Console.addCommand | train | public function addCommand($callback, $alias = null, $default = false)
{
if ($alias instanceof \Closure && is_string($callback)) {
list($alias, $callback) = array($callback, $alias);
}
if (is_array($callback) && is_string($callback[0])) {
$callback = implode('::', $ca... | php | {
"resource": ""
} |
q6329 | Console.addCommandsFromDir | train | public function addCommandsFromDir($dir, $namespace = '', $includeFiles = false)
{
foreach (new DirectoryIterator($dir) as $file) {
$filename = $file->getFilename();
if ($file->isDir() || substr($filename, 0, 1) === '.' || strlen($filename) <= 11
|| strtolower(substr... | php | {
"resource": ""
} |
q6330 | Console.writeln | train | public function writeln($text = '', $pipe = TextWriter::STDOUT)
{
$this->textWriter->writeln($text, $pipe);
return $this;
} | php | {
"resource": ""
} |
q6331 | Console.writeException | train | public function writeException(\Exception $e)
{
if ($this->verboseException) {
$text = sprintf("[%s]\n%s\nIn %s at line %s\n%s",
get_class($e),
$e->getMessage(),
$e->getFile(),
$e->getLine(),
$e->getTraceAsString()
... | php | {
"resource": ""
} |
q6332 | Query.validatePaymentTransaction | train | protected function validatePaymentTransaction(PaymentTransaction $paymentTransaction)
{
$this->validateQueryConfig($paymentTransaction);
$errorMessage = '';
$missedFields = array();
$invalidFields = array();
foreach (static::$requestFieldsDefinition as $fieldDescriptio... | php | {
"resource": ""
} |
q6333 | Query.paymentTransactionToRequest | train | protected function paymentTransactionToRequest(PaymentTransaction $paymentTransaction)
{
$requestFields = array();
foreach (static::$requestFieldsDefinition as $fieldDescription)
{
list($fieldName, $propertyPath) = $fieldDescription;
$fieldValue = PropertyAccessor::... | php | {
"resource": ""
} |
q6334 | Query.validateResponseOnSuccess | train | protected function validateResponseOnSuccess(PaymentTransaction $paymentTransaction, Response $response)
{
if ($response->getType() !== static::$successResponseType)
{
throw new ValidationException("Response type '{$response->getType()}' does not match " .
... | php | {
"resource": ""
} |
q6335 | Query.validateResponseOnError | train | protected function validateResponseOnError(PaymentTransaction $paymentTransaction, Response $response)
{
$allowedTypes = array(static::$successResponseType, 'error', 'validation-error');
if (!in_array($response->getType(), $allowedTypes))
{
throw new ValidationException("Unknown... | php | {
"resource": ""
} |
q6336 | Query.updatePaymentTransactionOnSuccess | train | protected function updatePaymentTransactionOnSuccess(PaymentTransaction $paymentTransaction, Response $response)
{
$paymentTransaction->setStatus($response->getStatus());
$this->setPaynetId($paymentTransaction, $response);
} | php | {
"resource": ""
} |
q6337 | Query.updatePaymentTransactionOnError | train | protected function updatePaymentTransactionOnError(PaymentTransaction $paymentTransaction, Response $response)
{
if ($response->isDeclined())
{
$paymentTransaction->setStatus($response->getStatus());
}
else
{
$paymentTransaction->setStatus(PaymentTrans... | php | {
"resource": ""
} |
q6338 | Query.validateQueryDefinition | train | protected function validateQueryDefinition()
{
if (empty(static::$requestFieldsDefinition))
{
throw new RuntimeException('You must configure requestFieldsDefinition property');
}
if (empty(static::$signatureDefinition))
{
throw new RuntimeException('Y... | php | {
"resource": ""
} |
q6339 | Query.validateQueryConfig | train | protected function validateQueryConfig(PaymentTransaction $paymentTransaction)
{
$queryConfig = $paymentTransaction->getQueryConfig();
if(strlen($queryConfig->getSigningKey()) === 0)
{
throw new ValidationException("Property 'signingKey' does not defined in PaymentTransaction pr... | php | {
"resource": ""
} |
q6340 | Query.validateClientId | train | protected function validateClientId(PaymentTransaction $paymentTransaction, Response $response)
{
$paymentClientId = $paymentTransaction->getPayment()->getClientId();
$responseClientId = $response->getPaymentClientId();
if ( strlen($responseClientId) > 0
&& $paymentClient... | php | {
"resource": ""
} |
q6341 | Query.setPaynetId | train | protected function setPaynetId(PaymentTransaction $paymentTransaction, Response $response)
{
$responsePaynetId = $response->getPaymentPaynetId();
if(strlen($responsePaynetId) > 0)
{
$paymentTransaction
->getPayment()
->setPaynetId($responsePaynetI... | php | {
"resource": ""
} |
q6342 | Typo3.encode | train | public function encode( $password, $salt = null )
{
return ( isset( $this->hasher ) ? $this->hasher->getHashedPassword( $password, $salt ) : $password );
} | php | {
"resource": ""
} |
q6343 | Help.fromFQDN | train | public static function fromFQDN($fqdn, $subCommand = null)
{
if (function_exists($fqdn)) {
return self::fromFunction($fqdn);
}
if (class_exists($fqdn) && is_subclass_of($fqdn, 'ConsoleKit\Command')) {
return self::fromCommandClass($fqdn, $subCommand);
}
... | php | {
"resource": ""
} |
q6344 | Help.fromCommandClass | train | public static function fromCommandClass($name, $subCommand = null)
{
$prefix = 'execute';
$class = new ReflectionClass($name);
if ($subCommand) {
$method = $prefix . ucfirst(Utils::camelize($subCommand));
if (!$class->hasMethod($method)) {
throw new C... | php | {
"resource": ""
} |
q6345 | LinksContainer.linksToArray | train | protected function linksToArray(): array
{
$links = [];
foreach ($this->links as $name => $link)
{
if (! $link->hasMetadata()) {
$links[$name] = $link->getReference();
continue;
}
$links[$name] = [
'href' =... | php | {
"resource": ""
} |
q6346 | PaymentTransaction.setProcessorType | train | public function setProcessorType($processorType)
{
if (!in_array($processorType, static::$allowedProcessorTypes))
{
throw new RuntimeException("Unknown transaction processor type given: {$processorType}");
}
if (!empty($this->processorType))
{
throw n... | php | {
"resource": ""
} |
q6347 | PaymentTransaction.setProcessorName | train | public function setProcessorName($processorName)
{
if (!empty($this->processorName))
{
throw new RuntimeException('You can set payment transaction processor name only once');
}
$this->processorName = $processorName;
return $this;
} | php | {
"resource": ""
} |
q6348 | PaymentTransaction.setStatus | train | public function setStatus($status)
{
if (!in_array($status, static::$allowedStatuses))
{
throw new RuntimeException("Unknown transaction status given: {$status}");
}
$this->status = $status;
return $this;
} | php | {
"resource": ""
} |
q6349 | PaymentTransaction.setPayment | train | public function setPayment(Payment $payment)
{
$this->payment = $payment;
if (!$payment->hasPaymentTransaction($this))
{
$payment->addPaymentTransaction($this);
}
return $this;
} | php | {
"resource": ""
} |
q6350 | DoctrineBaseDriver.get | train | public function get($args)
{
$dataItem = $this->create($args);
if ($dataItem->hasId()) {
$dataItem = $this->getById($dataItem->getId());
}
return $dataItem;
} | php | {
"resource": ""
} |
q6351 | DoctrineBaseDriver.fetchList | train | public function fetchList($statement)
{
$result = array();
foreach ($this->getConnection()->fetchAll($statement) as $row) {
$result[] = current($row);
}
return $result;
} | php | {
"resource": ""
} |
q6352 | DoctrineBaseDriver.getPlatformName | train | public function getPlatformName()
{
static $name = null;
if (!$name) {
$name = $this->connection->getDatabasePlatform()->getName();
}
return $name;
} | php | {
"resource": ""
} |
q6353 | DoctrineBaseDriver.prepareResults | train | public function prepareResults(&$rows)
{
foreach ($rows as $key => &$row) {
$row = $this->create($row);
}
return $rows;
} | php | {
"resource": ""
} |
q6354 | DoctrineBaseDriver.getById | train | public function getById($id)
{
$list = $this->getByCriteria($id, $this->getUniqueId());
return reset($list);
} | php | {
"resource": ""
} |
q6355 | DoctrineBaseDriver.getByCriteria | train | public function getByCriteria($criteria, $fieldName)
{
/** @var Statement $statement */
$queryBuilder = $this->getSelectQueryBuilder();
$queryBuilder->where($fieldName . " = :criteria");
$queryBuilder->setParameter('criteria', $criteria);
$statement = $queryBuilder->execute(... | php | {
"resource": ""
} |
q6356 | DoctrineBaseDriver.extractTypeValues | train | protected function extractTypeValues(array $data, array $types)
{
$typeValues = array();
foreach ($data as $k => $_) {
$typeValues[] = isset($types[$k])
? $types[$k]
: \PDO::PARAM_STR;
}
return $typeValues;
} | php | {
"resource": ""
} |
q6357 | eWay.setCustomerID | train | public function setCustomerID($id)
{
if(preg_match('/[^A-Za-z0-9]/', $id))
{
throw new ErrorException('Customer ID has invalid characters');
}
elseif(strlen($id) > 8)
{
throw new ErrorException('Customer ID cannot be longer than eight (8) characters');... | php | {
"resource": ""
} |
q6358 | eWay.setCardHoldersName | train | public function setCardHoldersName($name)
{
if(preg_match('/[^A-Za-z\s\'-\.]/', $name))
{
throw new ErrorException('Card holder name has invalid chracters.');
}
elseif(strlen($name) > 50)
{
throw new ErrorException('Card holder name longer than fifty (... | php | {
"resource": ""
} |
q6359 | eWay.setCardNumber | train | public function setCardNumber($number)
{
$number = preg_replace('/[^\d]/', '', $number);
if(strlen($number) > 20)
{
throw new ErrorException('Card number longer than twenty (20) digits');
}
$this->cardNumber = $number;
return $this;
} | php | {
"resource": ""
} |
q6360 | Max.sizeMax | train | protected function sizeMax($key, $lengthValue, $max, $not = true)
{
if (($lengthValue > $max) && $not) {
$this->addReturn($key, 'must', [ ':max' => $max ]);
} elseif (!($lengthValue > $max) && !$not) {
$this->addReturn($key, 'not', [ ':max' => $max ]);
}
} | php | {
"resource": ""
} |
q6361 | RepositoryProvider.registerRepository | train | public function registerRepository(string $name, RepositoryInterface $repository)
{
if (isset($this->repositories[$name])) {
throw new \LogicException(sprintf('Links\' Repository "%s" is already registered.', $name));
}
$this->repositories[$name] = $repository;
} | php | {
"resource": ""
} |
q6362 | RepositoryProvider.getRepository | train | public function getRepository(string $name): RepositoryInterface
{
if (isset($this->repositories[$name])) {
return $this->repositories[$name];
}
throw new \LogicException(sprintf('Unknown repository "%s"', $name));
} | php | {
"resource": ""
} |
q6363 | Wrapper.checkMemoryLimit | train | private function checkMemoryLimit()
{
if (function_exists('ini_get')) {
/**
* Note that this calculation is incorrect for memory limits that
* exceed the value range of the underlying platform's native
* integer.
* In practice, we will get away... | php | {
"resource": ""
} |
q6364 | Wrapper.run | train | public function run($input = '', $output = null)
{
$this->loadComposerPhar(false);
if (!$this->application) {
$this->application = new \Composer\Console\Application();
$this->application->setAutoExit(false);
}
$cli_args = is_string($input) && !empty($input) ?... | php | {
"resource": ""
} |
q6365 | AttachmentsBehavior.getAttachmentsTags | train | public function getAttachmentsTags($list = true)
{
$tags = $this->config('tags');
if (!$list) {
return $tags;
}
$tagsList = [];
foreach ($tags as $key => $tag) {
$tagsList[$key] = $tag['caption'];
}
return $tagsList;
} | php | {
"resource": ""
} |
q6366 | AttachmentsBehavior.saveTags | train | public function saveTags($attachment, $tags)
{
$newTags = [];
foreach ($tags as $tag) {
if (isset($this->config('tags')[$tag])) {
$newTags[] = $tag;
if ($this->config('tags')[$tag]['exclusive'] === true) {
$this->_clearTag($attachment, ... | php | {
"resource": ""
} |
q6367 | Checkpoint.month | train | public function month(int $vehicleId, int $year, int $month = 1, ?Query $query = null): Response
{
$this->requiresAccessToken();
return $this->send(
'GET',
"vehicles/{$vehicleId}/checkpoints/{$year}/{$month}",
$this->getApiHeaders(),
$this->buildHttpQ... | php | {
"resource": ""
} |
q6368 | Summary.yesterday | train | public function yesterday(int $vehicleId): Response
{
$this->requiresAccessToken();
return $this->send(
'GET',
"vehicles/{$vehicleId}/travels/summaries/yesterday",
$this->getApiHeaders()
);
} | php | {
"resource": ""
} |
q6369 | Summary.date | train | public function date(int $vehicleId, int $year, int $month = 1, int $day = 1): Response
{
$this->requiresAccessToken();
return $this->send(
'GET',
"vehicles/{$vehicleId}/travels/summaries/{$year}/{$month}/{$day}",
$this->getApiHeaders()
);
} | php | {
"resource": ""
} |
q6370 | PNotify.registerNotification | train | protected function registerNotification(array $notification)
{
$view = $this->getView();
$options = Json::encode(ArrayHelper::merge($this->getClientOptions(), $notification));
$view->registerJs("new PNotify({$options});");
} | php | {
"resource": ""
} |
q6371 | AttachmentsHelper.addDependencies | train | public function addDependencies()
{
$this->Html->script('/attachments/js/vendor/jquery.ui.widget.js', ['block' => true]);
$this->Html->script('/attachments/js/vendor/jquery.iframe-transport.js', ['block' => true]);
$this->Html->script('/attachments/js/vendor/jquery.fileupload.js', ['block' =... | php | {
"resource": ""
} |
q6372 | AttachmentsHelper.attachmentsArea | train | public function attachmentsArea(EntityInterface $entity, array $options = [])
{
if ($this->config('includeDependencies')) {
$this->addDependencies();
}
$options = Hash::merge([
'label' => false,
'id' => 'fileupload-' . uniqid(),
'formFieldName'... | php | {
"resource": ""
} |
q6373 | AttachmentsHelper.tagsList | train | public function tagsList($attachment)
{
$tagsString = '';
if (empty($attachment->tags)) {
return $tagsString;
}
$Table = TableRegistry::get($attachment->model);
foreach ($attachment->tags as $tag) {
$tagsString .= '<label class="label label-default">'... | php | {
"resource": ""
} |
q6374 | AttachmentsHelper.tagsChooser | train | public function tagsChooser(EntityInterface $entity, $attachment)
{
if (!TableRegistry::exists($entity->source())) {
throw new Cake\Network\Exception\MissingTableException('Could not find Table ' . $entity->source());
}
$Table = TableRegistry::get($entity->source());
ret... | php | {
"resource": ""
} |
q6375 | ObjectMapper.toResource | train | public function toResource($object): ResourceObject
{
$context = $this->createContext(get_class($object));
$id = $this->identifierHandler->getIdentifier($object, $context);
$type = $this->resolveType($object, $context);
$resource = new ResourceObject($id, $type);
foreach... | php | {
"resource": ""
} |
q6376 | ObjectMapper.toResourceIdentifier | train | public function toResourceIdentifier($object): ResourceIdentifierObject
{
$context = $this->createContext(get_class($object));
$id = $this->identifierHandler->getIdentifier($object, $context);
$type = $this->resolveType($object, $context);
return new ResourceIdentifierObject($id,... | php | {
"resource": ""
} |
q6377 | ObjectMapper.fromResource | train | public function fromResource($object, ResourceObject $resource)
{
$context = $this->createContext(get_class($object));
$this->identifierHandler->setIdentifier($object, $resource->getId(), $context);
foreach ($this->handlers as $handler)
{
$handler->fromResource($object,... | php | {
"resource": ""
} |
q6378 | ObjectMapper.resolveType | train | protected function resolveType($object, MappingContext $context): string
{
$definition = $context->getDefinition();
if ($definition->hasType()) {
return $definition->getType();
}
return $this->typeHandler->getType($object, $context);
} | php | {
"resource": ""
} |
q6379 | ObjectMapper.createContext | train | protected function createContext(string $class): MappingContext
{
$definition = $this->definitionProvider->getDefinition($class);
return new MappingContext($this, $definition);
} | php | {
"resource": ""
} |
q6380 | NotIterableAttribute.resolveTypeDescription | train | protected function resolveTypeDescription($value): string
{
$type = gettype($value);
if ($type === 'object') {
return 'an instance of ' . get_class($value);
}
if ($type === 'integer') {
return 'an integer';
}
return 'a ' . $type;
} | php | {
"resource": ""
} |
q6381 | Typo3.setHasherTypo3 | train | public function setHasherTypo3( \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface $object )
{
$this->hasher = $object;
return $this;
} | php | {
"resource": ""
} |
q6382 | Oracle.transformColumnNames | train | public static function transformColumnNames(&$rows)
{
$columnNames = array_keys(current($rows));
foreach ($rows as &$row) {
foreach ($columnNames as $name) {
$row[ strtolower($name) ] = &$row[ $name ];
unset($row[ $name ]);
}
}
} | php | {
"resource": ""
} |
q6383 | UnitsHelperTrait.units | train | public static function units()
{
// Helper Class Exists
if (isset(self::$unitConverter)) {
return self::$unitConverter;
}
// Initialize Class
self::$unitConverter = new UnitConverter();
// Return Helper Class
return self::$unitConverter;
} | php | {
"resource": ""
} |
q6384 | Message.filterProtocolVersion | train | protected function filterProtocolVersion($version)
{
if (!is_string($version) || !in_array($version, $this->protocols)) {
throw new \InvalidArgumentException('The specified protocol is invalid.');
}
return $version;
} | php | {
"resource": ""
} |
q6385 | Request.getAuthorizationHeader | train | public static function getAuthorizationHeader()
{
$headers = null;
if (isset($_SERVER['Authorization'])) {
$headers = trim($_SERVER["Authorization"]);
} else if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
$headers = trim($_SERVER["HTTP_AUTHORIZATION"]);
} elseif... | php | {
"resource": ""
} |
q6386 | SimpleFieldsTrait.getSimple | train | protected function getSimple($fieldName, $objectName = "object", $default = null)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = trim($this->{$objectName}->{$fieldName});
} else {
$this->out[$fieldName] = $default;
}
return $this;... | php | {
"resource": ""
} |
q6387 | SimpleFieldsTrait.getSimpleBool | train | protected function getSimpleBool($fieldName, $objectName = "object", $default = false)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = (bool) trim($this->{$objectName}->{$fieldName});
} else {
$this->out[$fieldName] = (bool) $default;
}
... | php | {
"resource": ""
} |
q6388 | SimpleFieldsTrait.getSimpleDouble | train | protected function getSimpleDouble($fieldName, $objectName = "object", $default = 0)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = (double) trim($this->{$objectName}->{$fieldName});
} else {
$this->out[$fieldName] = (double) $default;
}
... | php | {
"resource": ""
} |
q6389 | SimpleFieldsTrait.getSimpleBit | train | protected function getSimpleBit($fieldName, $position, $objectName = "object", $default = false)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = (bool) (($this->{$objectName}->{$fieldName} >> $position) & 1);
} else {
$this->out[$fieldName] = (bool... | php | {
"resource": ""
} |
q6390 | SimpleFieldsTrait.setSimpleFloat | train | protected function setSimpleFloat($fieldName, $fieldData, $objectName = "object")
{
//====================================================================//
// Compare Field Data
if (!isset($this->{$objectName}->{$fieldName})
|| (abs($this->{$objectName}->{$fieldName} - $fie... | php | {
"resource": ""
} |
q6391 | SimpleFieldsTrait.setSimpleBit | train | protected function setSimpleBit($fieldName, $position, $fieldData, $objectName = "object")
{
//====================================================================//
// Compare Field Data
if ($this->getSimpleBit($fieldName, $position, $objectName) !== $fieldData) {
//===========... | php | {
"resource": ""
} |
q6392 | Payment.addPaymentTransaction | train | public function addPaymentTransaction(PaymentTransaction $paymentTransaction)
{
if (!$this->hasPaymentTransaction($paymentTransaction))
{
$this->paymentTransactions[] = $paymentTransaction;
}
if ($paymentTransaction->getPayment() !== $this)
{
$payment... | php | {
"resource": ""
} |
q6393 | ImageDimensionsWidth.sizeBetween | train | protected function sizeBetween($lengthValue, $min, $max, $not = true)
{
if (!($lengthValue <= $max && $lengthValue >= $min) && $not) {
$this->addReturn('image_dimensions_width', 'width', [
':min' => $min,
':max' => $max
]);
} elseif ($lengthVal... | php | {
"resource": ""
} |
q6394 | ImagesHelper.touchRemoteFile | train | public static function touchRemoteFile($imageUrl)
{
// Get cURL resource
$curl = curl_init($imageUrl);
if (!$curl) {
return false;
}
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRAN... | php | {
"resource": ""
} |
q6395 | ImagesHelper.getRemoteFileSize | train | private static function getRemoteFileSize($imageUrl)
{
$result = curl_init($imageUrl);
if (!$result) {
return 0;
}
curl_setopt($result, CURLOPT_RETURNTRANSFER, true);
curl_setopt($result, CURLOPT_HEADER, true);
curl_setopt($result, CURLOPT_NOBODY, true);
... | php | {
"resource": ""
} |
q6396 | SplashCore.configuration | train | public static function configuration()
{
//====================================================================//
// Configuration Array Already Exists
//====================================================================//
if (isset(self::core()->conf)) {
return self::c... | php | {
"resource": ""
} |
q6397 | SplashCore.log | train | public static function log()
{
if (!isset(self::core()->log)) {
//====================================================================//
// Initialize Log & Debug
self::core()->log = new Logger();
//============================================================... | php | {
"resource": ""
} |
q6398 | SplashCore.com | train | public static function com()
{
if (isset(self::core()->com)) {
return self::core()->com;
}
switch (self::configuration()->WsMethod) {
case 'SOAP':
self::log()->deb('Selected SOAP PHP Protocol for Communication');
self::core()->com = ne... | php | {
"resource": ""
} |
q6399 | SplashCore.ws | train | public static function ws()
{
if (!isset(self::core()->soap)) {
//====================================================================//
// WEBSERVICE INITIALISATION
//====================================================================//
// Initialize SOAP We... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.