_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q6300 | DocumentHydrator.processSingleResourceDocument | train | protected function processSingleResourceDocument($source): SingleResourceDocument
{
$resource = $this->hydrateResource($source->data);
$document | php | {
"resource": ""
} |
q6301 | DocumentHydrator.processResourceCollectionDocument | train | protected function processResourceCollectionDocument($source): ResourceCollectionDocument
{
$document = new ResourceCollectionDocument();
| php | {
"resource": ""
} |
q6302 | Mailer.send | train | public function send($first, $last, $email, $message)
{
$quote = nl2br($message);
$name = $first.' '.$last;
| 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) {
| 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() . '""');
}
| 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 | php | {
"resource": ""
} |
q6306 | BaseResource.request | train | protected function request($verb, $path, $resource = '', array $payload = [])
{
| 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())
: '';
}
| 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 | 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 ], | php | {
"resource": ""
} |
q6310 | FormBuilder.label | train | public function label($name, $label, array $attr = null)
{
return $this->input($name, [ 'type' | php | {
"resource": ""
} |
q6311 | FormBuilder.legend | train | public function legend($name, $legend, array $attr = null)
{
return $this->input($name, [ 'type' | 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' | php | {
"resource": ""
} |
q6313 | FormBuilder.inputBasic | train | public function inputBasic($type, $name, $id, array $attr = null)
{
$basic = | php | {
"resource": ""
} |
q6314 | FormBuilder.submit | train | public function submit($name, $value, array $attr = null)
{
$basic = $this->merge_attr([ 'value' | 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); | 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 . '"';
| 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_array($key, $this->attributesCss) | 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 ($value instanceof UploadedFileInterface) {
if ($value->getError() !== UPLOAD_ERR_OK) {
return 0;
}
return $value->getStream()->getSize();
}
if (is_resource($value)) {
| 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() | 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])) {
// Strip trailing 0s in fractional part.
if (!$formattedParts[1] = chop($formattedParts[1], '0')) {
| php | {
"resource": ""
} |
q6321 | RelationshipsContainer.relationshipsToArray | train | protected function relationshipsToArray(): array
{
$relationships = [];
foreach ($this->relationships as $name => $relationship)
{
| php | {
"resource": ""
} |
q6322 | SymfonyEventDispatcherDecorator.dispatchOnRequest | train | protected function dispatchOnRequest(RequestInterface $request): RequestInterface
{
$requestEvent = new RequestEvent($request);
| php | {
"resource": ""
} |
q6323 | SymfonyEventDispatcherDecorator.dispatchOnResponse | train | protected function dispatchOnResponse(ResponseInterface $response): ResponseInterface
{
$responseEvent = new ResponseEvent($response);
| 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->getResourceName();
$conn = $dbm->acquire( $dbname );
try
{
$id = $item->getId();
if( $id === null )
{
/** mshop/customer/manager/group/typo3/insert/mysql
* Inserts a new customer group record into the database table
*
* @see mshop/customer/manager/group/typo3/insert/ansi
*/
/** mshop/customer/manager/group/typo3/insert/ansi
* Inserts a new customer group record into the database table
*
* Items with no ID yet (i.e. the ID is NULL) will be created in
* the database and the newly created ID retrieved afterwards
* using the "newid" SQL statement.
*
* The SQL statement must be a string suitable for being used as
* prepared statement. It must include question marks for binding
* the values from the customer group item to the statement before
* they are sent to the database server. The number of question
* marks must be the same as the number of columns listed in the
* INSERT statement. The order of the columns must correspond to
* the order in the saveItems() method, so the correct values are
* bound to the columns.
*
* The SQL statement should conform to the ANSI standard to be
* compatible with most relational database systems. This also
* includes using double quotes for table and column names.
*
* @param string SQL statement for inserting records
* @since 2015.08
* @category Developer
* @see mshop/customer/manager/group/typo3/update/ansi
* @see mshop/customer/manager/group/typo3/newid/ansi
* @see mshop/customer/manager/group/typo3/delete/ansi
* @see mshop/customer/manager/group/typo3/search/ansi
* @see mshop/customer/manager/group/typo3/count/ansi
*/
$path = 'mshop/customer/manager/group/typo3/insert';
}
else
{
/** mshop/customer/manager/group/typo3/update/mysql
* Updates an existing customer group record in the database
*
* @see mshop/customer/manager/group/typo3/update/ansi
*/
/** mshop/customer/manager/group/typo3/update/ansi
* Updates an existing customer group record in the database
*
* Items which already have an ID (i.e. the ID is not NULL) will
* be updated in the database.
*
* The SQL statement must be a string suitable for being used as
* prepared statement. It must include question marks for binding
* the values from the customer group item to the statement before
* they are sent to the database server. The order of the columns
* must correspond to the order in the saveItems() method, so the
* correct values are bound to the columns.
*
* The SQL statement should conform to the ANSI standard to be
* compatible with most relational database systems. This also
* includes using double quotes for table and column names.
*
* @param string SQL statement for updating records
* @since 2015.08
* @category Developer
* @see mshop/customer/manager/group/typo3/insert/ansi
* @see mshop/customer/manager/group/typo3/newid/ansi
* @see mshop/customer/manager/group/typo3/delete/ansi
* @see mshop/customer/manager/group/typo3/search/ansi
* @see mshop/customer/manager/group/typo3/count/ansi
*/
| php | {
"resource": ""
} |
q6325 | RelationshipProcessor.process | train | public function process(\ReflectionClass $reflection, Definition $definition)
{
foreach ($reflection->getProperties() as $property)
{
| php | {
"resource": ""
} |
q6326 | RelationshipProcessor.handleDataControl | train | protected function handleDataControl(RelationshipAnnotation $annotation, Relationship $relationship)
{
| 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 | 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('::', $callback);
}
$name = '';
if (is_string($callback)) {
$name = $callback;
if (is_callable($callback)) {
if (strpos($callback, '::') !== false) {
list($classname, $methodname) = explode('::', $callback);
$name = Utils::dashized($methodname);
} else {
$name = strtolower(trim(str_replace('_', '-', $name), '-'));
}
} else {
if (substr($name, -7) === 'Command') {
$name = substr($name, 0, -7);
}
$name = Utils::dashized(basename(str_replace('\\', '/', $name)));
}
} else if (is_object($callback) && | 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($filename, -11)) !== 'command.php') {
continue;
}
if ($includeFiles) | php | {
"resource": ""
} |
q6330 | Console.writeln | train | public function writeln($text = '', $pipe = TextWriter::STDOUT)
{
| 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()
);
} else {
$text = sprintf("\n[%s]\n%s\n", get_class($e), $e->getMessage());
}
| php | {
"resource": ""
} |
q6332 | Query.validatePaymentTransaction | train | protected function validatePaymentTransaction(PaymentTransaction $paymentTransaction)
{
$this->validateQueryConfig($paymentTransaction);
$errorMessage = '';
$missedFields = array();
$invalidFields = array();
foreach (static::$requestFieldsDefinition as $fieldDescription)
{
list($fieldName, $propertyPath, $isFieldRequired, $validationRule) = $fieldDescription;
$fieldValue = PropertyAccessor::getValue($paymentTransaction, $propertyPath, false);
if (!empty($fieldValue))
{
try
{
Validator::validateByRule($fieldValue, $validationRule);
}
catch (ValidationException $e)
{
$invalidFields[] = "Field '{$fieldName}' from property path '{$propertyPath}', {$e->getMessage()}.";
}
}
elseif ($isFieldRequired)
{
| php | {
"resource": ""
} |
q6333 | Query.paymentTransactionToRequest | train | protected function paymentTransactionToRequest(PaymentTransaction $paymentTransaction)
{
$requestFields = array();
foreach (static::$requestFieldsDefinition as $fieldDescription)
{
list($fieldName, $propertyPath) = $fieldDescription;
$fieldValue = PropertyAccessor::getValue($paymentTransaction, $propertyPath);
if | 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 " .
"success response type '" . static::$successResponseType . "'");
}
$missedFields = array();
foreach (static::$responseFieldsDefinition as $fieldName)
{
if (empty($response[$fieldName]))
| 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 | php | {
"resource": ""
} |
q6336 | Query.updatePaymentTransactionOnSuccess | train | protected function updatePaymentTransactionOnSuccess(PaymentTransaction $paymentTransaction, Response $response)
{
| php | {
"resource": ""
} |
q6337 | Query.updatePaymentTransactionOnError | train | protected function updatePaymentTransactionOnError(PaymentTransaction $paymentTransaction, Response $response)
{
if ($response->isDeclined())
{
$paymentTransaction->setStatus($response->getStatus());
}
else
{
| 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('You must configure signatureDefinition property');
}
if (empty(static::$responseFieldsDefinition))
| 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 property 'queryConfig'");
}
if (strlen($queryConfig->getEndPoint()) == 0 && strlen($queryConfig->getEndPointGroup()) === 0)
{
throw new ValidationException(
"Properties 'endPont' and 'endPointGroup' do not defined in " .
"PaymentTransaction property 'queryConfig'. Set one | php | {
"resource": ""
} |
q6340 | Query.validateClientId | train | protected function validateClientId(PaymentTransaction $paymentTransaction, Response $response)
{
$paymentClientId = $paymentTransaction->getPayment()->getClientId();
$responseClientId = $response->getPaymentClientId();
if ( strlen($responseClientId) > 0
&& $paymentClientId != $responseClientId) | php | {
"resource": ""
} |
q6341 | Query.setPaynetId | train | protected function setPaynetId(PaymentTransaction $paymentTransaction, Response $response)
{
$responsePaynetId = $response->getPaymentPaynetId();
if(strlen($responsePaynetId) > 0)
{
$paymentTransaction
| php | {
"resource": ""
} |
q6342 | Typo3.encode | train | public function encode( $password, $salt = null )
{
return ( isset( $this->hasher ) ? | 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')) {
| 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 ConsoleException("Sub command '$subCommand' of '$name' does not exist");
}
return new Help($class->getMethod($method)->getDocComment());
}
$help = new Help($class->getDocComment());
foreach ($class->getMethods() as $method) {
| php | {
"resource": ""
} |
q6345 | LinksContainer.linksToArray | train | protected function linksToArray(): array
{
$links = [];
foreach ($this->links as $name => $link)
{
if (! $link->hasMetadata()) {
| 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))
{
| php | {
"resource": ""
} |
q6347 | PaymentTransaction.setProcessorName | train | public function setProcessorName($processorName)
{
if (!empty($this->processorName))
{
throw new RuntimeException('You can set payment transaction processor | php | {
"resource": ""
} |
q6348 | PaymentTransaction.setStatus | train | public function setStatus($status)
{
if (!in_array($status, static::$allowedStatuses))
{
throw new RuntimeException("Unknown transaction status given: | php | {
"resource": ""
} |
q6349 | PaymentTransaction.setPayment | train | public function setPayment(Payment $payment)
{
$this->payment = $payment;
if (!$payment->hasPaymentTransaction($this))
{
| php | {
"resource": ""
} |
q6350 | DoctrineBaseDriver.get | train | public function get($args)
{
$dataItem = $this->create($args);
if ($dataItem->hasId()) | php | {
"resource": ""
} |
q6351 | DoctrineBaseDriver.fetchList | train | public function fetchList($statement)
{
$result = array();
foreach ($this->getConnection()->fetchAll($statement) as | php | {
"resource": ""
} |
q6352 | DoctrineBaseDriver.getPlatformName | train | public function getPlatformName()
{
static $name = null;
if (!$name) { | php | {
"resource": ""
} |
q6353 | DoctrineBaseDriver.prepareResults | train | public function prepareResults(&$rows)
{
foreach ($rows as $key => &$row) {
$row | php | {
"resource": ""
} |
q6354 | DoctrineBaseDriver.getById | train | public function getById($id)
{
$list = $this->getByCriteria($id, | 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);
| php | {
"resource": ""
} |
q6356 | DoctrineBaseDriver.extractTypeValues | train | protected function extractTypeValues(array $data, array $types)
{
$typeValues = array();
foreach ($data as $k => $_) {
$typeValues[] = isset($types[$k])
| 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)
{
| 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)
{
| php | {
"resource": ""
} |
q6359 | eWay.setCardNumber | train | public function setCardNumber($number)
{
$number = preg_replace('/[^\d]/', '', $number);
if(strlen($number) > 20)
{
| php | {
"resource": ""
} |
q6360 | Max.sizeMax | train | protected function sizeMax($key, $lengthValue, $max, $not = true)
{
if (($lengthValue > $max) && $not) {
$this->addReturn($key, 'must', [ ':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" | php | {
"resource": ""
} |
q6362 | RepositoryProvider.getRepository | train | public function getRepository(string $name): RepositoryInterface
{
if (isset($this->repositories[$name])) {
return $this->repositories[$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 with it, because it doesn't make
* sense to configure PHP's memory limit to half the addressable
* RAM (2 GB on a typical 32-bit system).
*/
$memoryInBytes = function ($value) {
$unit = strtolower(substr($value, -1, 1));
$value = (int) $value;
switch ($unit) {
case 'g':
$value *= 1024 * 1024 * 1024;
break;
case 'm':
$value *= 1024 * 1024;
break;
case 'k':
$value *= 1024;
break;
}
| 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 | php | {
"resource": ""
} |
q6365 | AttachmentsBehavior.getAttachmentsTags | train | public function getAttachmentsTags($list = true)
{
$tags = $this->config('tags');
if (!$list) {
return $tags;
}
$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;
| 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',
| php | {
"resource": ""
} |
q6368 | Summary.yesterday | train | public function yesterday(int $vehicleId): Response
{
$this->requiresAccessToken();
return $this->send(
'GET',
| 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',
| php | {
"resource": ""
} |
q6370 | PNotify.registerNotification | train | protected function registerNotification(array $notification)
{
$view = $this->getView();
$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' => true]);
| 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' => false,
'mode' => 'full',
'style' => '',
'taggable' => false,
'isAjax' | 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) {
| 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());
return $this->Form->select('tags', $Table->getAttachmentsTags(), [
| 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);
| 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);
| php | {
"resource": ""
} |
q6378 | ObjectMapper.resolveType | train | protected function resolveType($object, MappingContext $context): string
{
$definition = $context->getDefinition();
if ($definition->hasType()) {
| php | {
"resource": ""
} |
q6379 | ObjectMapper.createContext | train | protected function createContext(string $class): MappingContext
{
$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);
}
| php | {
"resource": ""
} |
q6381 | Typo3.setHasherTypo3 | train | public function setHasherTypo3( \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface $object )
{ | php | {
"resource": ""
} |
q6382 | Oracle.transformColumnNames | train | public static function transformColumnNames(&$rows)
{
$columnNames = array_keys(current($rows));
foreach ($rows as &$row) {
foreach ($columnNames as $name) {
| php | {
"resource": ""
} |
q6383 | UnitsHelperTrait.units | train | public static function units()
{
// Helper Class Exists
if (isset(self::$unitConverter)) {
return self::$unitConverter;
| php | {
"resource": ""
} |
q6384 | Message.filterProtocolVersion | train | protected function filterProtocolVersion($version)
{
if (!is_string($version) || !in_array($version, $this->protocols)) | 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 (function_exists('apache_request_headers')) {
| 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});
| 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});
| 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});
| 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} >> | php | {
"resource": ""
} |
q6390 | SimpleFieldsTrait.setSimpleFloat | train | protected function setSimpleFloat($fieldName, $fieldData, $objectName = "object")
{
//====================================================================//
// Compare Field Data
if (!isset($this->{$objectName}->{$fieldName})
| php | {
"resource": ""
} |
q6391 | SimpleFieldsTrait.setSimpleBit | train | protected function setSimpleBit($fieldName, $position, $fieldData, $objectName = "object")
{
//====================================================================//
// Compare Field Data
if ($this->getSimpleBit($fieldName, $position, $objectName) !== $fieldData) {
//====================================================================//
// Update Field Data
if ($fieldData) {
| php | {
"resource": ""
} |
q6392 | Payment.addPaymentTransaction | train | public function addPaymentTransaction(PaymentTransaction $paymentTransaction)
{
if (!$this->hasPaymentTransaction($paymentTransaction))
{
| 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 ($lengthValue <= $max && $lengthValue >= $min && !$not) {
| 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( | 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);
| php | {
"resource": ""
} |
q6396 | SplashCore.configuration | train | public static function configuration()
{
//====================================================================//
// Configuration Array Already Exists
//====================================================================//
if (isset(self::core()->conf)) {
return self::core()->conf;
}
//====================================================================//
// Load Module Core Configuration
//====================================================================//
//====================================================================//
// Initialize Empty Configuration
self::core()->conf = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
$config = &self::core()->conf;
//====================================================================//
// Load Module Core Configuration from Definition File
//====================================================================//
// Translations Parameters
$config->DefaultLanguage = SPLASH_DF_LANG;
//====================================================================//
// WebService Core Parameters
$config->WsMethod = SPLASH_WS_METHOD;
$config->WsTimout = SPLASH_TIMEOUT;
$config->WsCrypt = SPLASH_CRYPT_METHOD;
$config->WsEncode = SPLASH_ENCODE;
$config->WsHost = 'www.splashsync.com/ws/soap';
//====================================================================//
// Activity Logging Parameters
$config->Logging = SPLASH_LOGGING;
$config->TraceIn = SPLASH_TRACE_IN;
$config->TraceOut = SPLASH_TRACE_OUT;
$config->TraceTasks = SPLASH_TRACE_TASKS;
//====================================================================//
// Custom Parameters Configurator
$config->Configurator = JsonConfigurator::class;
//====================================================================//
// Server Requests Configuration
| php | {
"resource": ""
} |
q6397 | SplashCore.log | train | public static function log()
{
if (!isset(self::core()->log)) {
//====================================================================//
// Initialize Log & Debug
self::core()->log = new Logger();
//====================================================================//
// Define Standard Messages Prefix if Not Overiden
| 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 = new \Splash\Components\SOAP\SOAPInterface();
break;
case 'NuSOAP':
default:
| php | {
"resource": ""
} |
q6399 | SplashCore.ws | train | public static function ws()
{
if (!isset(self::core()->soap)) {
//====================================================================//
// WEBSERVICE INITIALISATION
//====================================================================//
// Initialize SOAP WebServices Class
self::core()->soap = new Webservice();
//====================================================================//
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.