_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q253100 | DataItem.getHandlingObject | validation | public static function getHandlingObject($a, $b)
{
$handlingA = $a->handlingComparison;
$handlingB = $b->handlingComparison;
if (!$handlingB) {
return $a;
}
if ($handlingA !== false && $handlingB !== false) {
if ($handlingA > $handlingB) {
... | php | {
"resource": ""
} |
q253101 | DataItem.setCompanionObject | validation | public function setCompanionObject($value)
{
if ($this->isForeign) {
return $this->localObject = $value;
} else {
return $this->foreignObject = $value;
}
} | php | {
"resource": ""
} |
q253102 | DataItem.getCompanionId | validation | public function getCompanionId()
{
if ($this->isForeign && isset($this->foreignPrimaryKey)) {
return $this->foreignPrimaryKey;
} elseif (!$this->isForeign && isset($this->localPrimaryKey)) {
return $this->localPrimaryKey;
}
if (isset($this->companionObject)) {... | php | {
"resource": ""
} |
q253103 | DataItem.setPairedDataItem | validation | public function setPairedDataItem(DataItem $value)
{
$this->_pairedDataItem = $value;
if (!isset($this->_localObject) && isset($value->localObject)) {
$this->localObject = $value->localObject;
}
if (!isset($this->_foreignObject) && isset($value->foreignObject)) {
... | php | {
"resource": ""
} |
q253104 | DataItem.setHandledDataItem | validation | public function setHandledDataItem($value)
{
if (isset($this->_pairedDataItem)) {
$this->pairedDataItem->handledDataItem = $value;
}
if (!$this->_handledDataItem && $value) {
$this->dataSource->reduceRemaining($this);
}
$this->clean();
return ... | php | {
"resource": ""
} |
q253105 | MockStorage.save | validation | public function save(string $sessionIdentifier, string $sessionData): void
{
self::$files[$sessionIdentifier] = [
'data' => $sessionData,
'time' => microtime(true)
];
} | php | {
"resource": ""
} |
q253106 | MockStorage.get | validation | public function get(string $sessionIdentifier): string
{
if (!$this->sessionExists($sessionIdentifier)) {
throw new SessionNotFoundException();
}
return self::$files[$sessionIdentifier]['data'];
} | php | {
"resource": ""
} |
q253107 | MockStorage.lock | validation | public function lock(string $sessionIdentifier): bool
{
if (in_array($sessionIdentifier, self::$lockedIdentifiers)) {
return true;
}
self::$lockedIdentifiers[] = $sessionIdentifier;
return true;
} | php | {
"resource": ""
} |
q253108 | MockStorage.unlock | validation | public function unlock(string $sessionIdentifier): void
{
$index = array_search($sessionIdentifier, self::$lockedIdentifiers);
if ($index !== false) {
unset(self::$lockedIdentifiers[$index]);
}
} | php | {
"resource": ""
} |
q253109 | MockStorage.destroy | validation | public function destroy(string $sessionIdentifier): void
{
if (!isset(self::$files[$sessionIdentifier])) {
throw new SessionNotFoundException();
}
unset(self::$files[$sessionIdentifier]);
} | php | {
"resource": ""
} |
q253110 | MockStorage.clearOld | validation | public function clearOld(int $maxLife): void
{
$limit = microtime(true) - $maxLife / 1000000;
foreach (self::$files as &$file) {
if ($file['time'] <= $limit) {
$file = null;
}
}
self::$files = array_filter(self::$files);
} | php | {
"resource": ""
} |
q253111 | HidePageController.hideAction | validation | public function hideAction(Request $request, Application $app)
{
$options = array(
"request" => $request,
"page_manager" => $app["red_kite_cms.page_manager"],
"username" => $this->fetchUsername($app["security"], $app["red_kite_cms.configuration_handler"]),
);
... | php | {
"resource": ""
} |
q253112 | CustomFieldText.buildForm | validation | public function buildForm(FormBuilderInterface $builder, CustomField $customField)
{
$options = $customField->getOptions();
$type = ($options[self::MAX_LENGTH] < 256) ? 'text'
: 'textarea';
$attrArray = array();
if(array_key_exists(self::MULTIPLE_CF_INLINE, $option... | php | {
"resource": ""
} |
q253113 | DataKeyAwareTrait._setDataKey | validation | protected function _setDataKey($key)
{
if (!is_null($key) && !is_string($key) && !($key instanceof Stringable)) {
throw $this->_createInvalidArgumentException($this->__('Data key must be a string or stringable'), 0, null, $key);
}
$this->dataKey = $key;
return $this;
... | php | {
"resource": ""
} |
q253114 | AuthorizerAccessToken.getToken | validation | public function getToken($forceRefresh = false)
{
$cached = $this->authorizer->getAccessToken();
if ($forceRefresh || empty($cached)) {
return $this->renewAccessToken();
}
return $cached;
} | php | {
"resource": ""
} |
q253115 | AuthorizerAccessToken.renewAccessToken | validation | protected function renewAccessToken()
{
$token = $this->authorizer->getApi()
->getAuthorizerToken(
$this->authorizer->getAppId(),
$this->authorizer->getRefreshToken()
);
$this->authorizer->setAccessToken($token['authorizer_access_token'], $tok... | php | {
"resource": ""
} |
q253116 | AbstractModule.getModuleDir | validation | final public function getModuleDir()
{
if (! $this->moduleDir) {
$reflection = new ReflectionClass(static::class);
$this->moduleDir = dirname($reflection->getFileName());
}
return $this->moduleDir;
} | php | {
"resource": ""
} |
q253117 | Debug.getDump | validation | public static function getDump($var, $maxSize = null)
{
// Trace
$trace = debug_backtrace();
// Initialise la sortie
$dump = '';
// Header
$dump .= static::getHeader('Dump de variable');
// Contexte
$dump .= '<div class="dump_segment">Contexte</div>';
if (coun... | php | {
"resource": ""
} |
q253118 | Debug.getDumpQueryResult | validation | public static function getDumpQueryResult($var)
{
$header = true;
$dump = '<table cellpadding=5 cellspacing=0>';
$i = 1;
foreach ($var as $ligne) {
// Affichage du header
if ($header) {
$dump .= '<tr>';
foreach ($ligne as $key => $value) {
if (!is_numeri... | php | {
"resource": ""
} |
q253119 | Debug.getDumpContent | validation | protected static function getDumpContent($var, $maxSize = null)
{
$dump = '<div class="dump_segment_content_main">';
$dump .= '<div class="dump_variable">';
$dump .= sprintf('<ul>%s</ul>', static::dumpElement($var, '', $maxSize));
$dump .= '</div>';
$dump .= '</div>';
retu... | php | {
"resource": ""
} |
q253120 | Debug.getTrace | validation | public static function getTrace()
{
// Trace
$trace = debug_backtrace();
// Initialise la sortie
$dump = '';
// Header
$dump .= static::getHeader('Trace du contexte');
// Contexte
$dump .= '<div class="dump_segment">Contexte</div>';
$nb = count($trace);
for (... | php | {
"resource": ""
} |
q253121 | CliApplication.getRunner | validation | protected function getRunner()
{
if (null === $this->runner) {
$this->runner = new ConsoleApplication($this->name, $this->version, $this->description, $this->alias);
}
return $this->runner;
} | php | {
"resource": ""
} |
q253122 | CliApplication.run | validation | public function run()
{
// Boot the application.
if (false === $this->boot()) {
exit(1);
}
// Let symfony/console do the rest.
$this->runner->run($this->request, $this->response);
return $this;
} | php | {
"resource": ""
} |
q253123 | CustomFieldNumber.prepareFieldOptions | validation | private function prepareFieldOptions(CustomField $customField, $type)
{
$options = $customField->getOptions();
/**
* @var mixed[] the formField options
*/
$fieldOptions = array();
// add required
$fieldOptions['required'] = False;
... | php | {
"resource": ""
} |
q253124 | Card.getTicketCacheKey | validation | public function getTicketCacheKey()
{
if (is_null($this->ticketCacheKey)) {
return $this->ticketCachePrefix.$this->getAccessToken()->getAppId();
}
return $this->ticketCacheKey;
} | php | {
"resource": ""
} |
q253125 | Taxonomy.getModuleHandler | validation | public function getModuleHandler()
{
if (is_null($this->_moduleHandler)) {
$stem = $this->field;
if (!isset(self::$_moduleHandlers[$stem])) {
self::$_moduleHandlers[$stem] = [];
}
$n = count(self::$_moduleHandlers[$stem]);
$this->_m... | php | {
"resource": ""
} |
q253126 | CommonStructureDefinition.addPlaceholder | validation | public function addPlaceholder($placeholder, $description, $sampleValue, $emptyValue)
{
if (isset($this->placeholders[$placeholder])) {
throw new DefinitionDuplicateException(
sprintf('Field with same placeholder "%s" already exists in structure', $placeholder)
);
... | php | {
"resource": ""
} |
q253127 | CommonStructureDefinition.addChild | validation | public function addChild($structureName, $prefix = '', $suffix = '')
{
if (isset($this->children[$structureName])) {
throw new DefinitionDuplicateException(
sprintf('Child structure with same name "%s" already exists', $structureName)
);
}
$this->chil... | php | {
"resource": ""
} |
q253128 | Familiarity.getUser | validation | public function getUser($owner = true)
{
if ($owner && $this->owner->getBehavior('Ownable') !== null && isset($this->owner->objectOwner)) {
return $this->owner->objectOwner;
} elseif (isset(Yii::$app->user) && isset(Yii::$app->user->identity->primaryKey)) {
return Yii::$app->... | php | {
"resource": ""
} |
q253129 | Familiarity.getFamiliarity | validation | public function getFamiliarity($user = null)
{
if (is_null($user)) {
$user = $this->getUser(false);
}
if (is_object($user)) {
$user = $user->primaryKey;
}
$familarityKey = md5($user);
if (!isset($this->_familiarity[$familarityKey])) {
... | php | {
"resource": ""
} |
q253130 | PaginateProviderTrait.paginate | validation | public function paginate()
{
$model = $this->model;
if (property_exists($model, 'order')) {
$paginator = $model::orderBy($model::$order, $model::$sort)->paginate($model::$paginate, $model::$index);
} else {
$paginator = $model::paginate($model::$paginate, $model::$in... | php | {
"resource": ""
} |
q253131 | ElementRequireAttributesProviderTrait.addRequiredAttributeToFields | validation | final protected function addRequiredAttributeToFields(array $specifications)
{
/** @var array $data */
foreach ($specifications as $field => $data) {
if (!$this->has($field)) {
continue;
}
$validators = ArrayUtils::get($data, 'validators', []);
... | php | {
"resource": ""
} |
q253132 | CustomFieldController.createCreateForm | validation | private function createCreateForm(CustomField $entity, $type)
{
$form = $this->createForm('custom_field_choice', $entity, array(
'action' => $this->generateUrl('customfield_create',
array('type' => $type)),
'method' => 'POST',
'type' => $type,
... | php | {
"resource": ""
} |
q253133 | CustomFieldController.newAction | validation | public function newAction(Request $request)
{
$entity = new CustomField();
//add the custom field group if defined in URL
$cfGroupId = $request->query->get('customFieldsGroup', null);
if ($cfGroupId !== null) {
$cfGroup = $this->getDoctrine()->getManager... | php | {
"resource": ""
} |
q253134 | CustomFieldController.createEditForm | validation | private function createEditForm(CustomField $entity, $type)
{
$form = $this->createForm('custom_field_choice', $entity, array(
'action' => $this->generateUrl('customfield_update', array('id' => $entity->getId())),
'method' => 'PUT',
'type' => $type,
'group_wid... | php | {
"resource": ""
} |
q253135 | Mcrypt.encrypt | validation | public function encrypt($data)
{
if ($this->iv === null) {
$dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode);
} else {
$dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode, $this->iv);
}
return bin2hex($da... | php | {
"resource": ""
} |
q253136 | Mcrypt.decrypt | validation | public function decrypt($data)
{
if (!is_string($data) || !preg_match('/^[0-9A-Fa-f]*$/', $data)) {
throw new \InvalidArgumentException('blowfishDecryptCBC require hex input', 1502);
}
$data = pack('H*', $data);
if ($this->iv === null) {
$return = mcrypt_dec... | php | {
"resource": ""
} |
q253137 | Mcrypt.generateIV | validation | protected function generateIV()
{
$sizeIV = $this->getSizeIV();
if ($sizeIV === 0) {
return $this;
}
$this->setIV(mcrypt_create_iv($sizeIV, MCRYPT_RAND));
return $this;
} | php | {
"resource": ""
} |
q253138 | DataInterfaceLog.getStatusLog | validation | public function getStatusLog($checkRecent = false)
{
if (!isset($this->_statusLog)) {
$this->_statusLog = Cacher::get([get_called_class(), $this->primaryKey, $this->created]);
if (empty($this->_statusLog)) {
if (is_null($this->message)) {
$this->_s... | php | {
"resource": ""
} |
q253139 | DataInterfaceLog.getEstimateTimeRemaining | validation | public function getEstimateTimeRemaining()
{
$estimatedDuration = $this->dataInterface->estimateDuration();
if ($estimatedDuration) {
$startedTime = strtotime($this->started);
$estimatedEndTime = $startedTime + $estimatedDuration;
if (time() > $estimatedEndTime) {... | php | {
"resource": ""
} |
q253140 | DataInterfaceLog.getDuration | validation | public function getDuration()
{
$ended = microtime(true);
if ($this->ended) {
$ended = strtotime($this->ended);
}
$started = strtotime($this->started);
return Date::niceDuration($ended-$started);
} | php | {
"resource": ""
} |
q253141 | DataInterfaceLog.getIsMostRecent | validation | public function getIsMostRecent()
{
return !empty($this->dataInterface) && $this->dataInterface->lastDataInterfaceLog && $this->dataInterface->lastDataInterfaceLog->primaryKey === $this->primaryKey;
} | php | {
"resource": ""
} |
q253142 | Url.assembleUrl | validation | private function assembleUrl()
{
$address = '';
if (!empty($this->scheme)) {
$address .= $this->scheme . '://';
}
if (!empty($this->user)) {
$address .= $this->user;
}
if (!empty($this->pass)) {
$address .= ':' . $this->pass . '@';
... | php | {
"resource": ""
} |
q253143 | FilesystemAssetAdapter.cache | validation | public function cache(ContentfulAsset $asset)
{
if (!isset($asset->file)) {
$this->log('Asset %s has no file.', $asset);
return;
}
foreach ($asset->file as $locale => $file) {
if (!$file) {
// File not published.
$this->log(... | php | {
"resource": ""
} |
q253144 | DeferredAction.getDescriptor | validation | public function getDescriptor()
{
$logModel = $this->getLogModel(true);
if (empty($logModel) || !isset($logModel->dataInterface)) {
return 'Unknown Data Interface';
}
return 'Interface: ' . $logModel->dataInterface->name;
} | php | {
"resource": ""
} |
q253145 | DeferredAction.getLogModel | validation | public function getLogModel($refresh = false)
{
$config = $this->config;
if (isset($config['logModel'])) {
if (!is_object($config['logModel'])) {
if ($refresh) {
return DataInterfaceLog::find()->where(['id' => $config['logModel']])->one();
... | php | {
"resource": ""
} |
q253146 | Base.getType | validation | public function getType()
{
if (is_null($this->_type)) {
$this->_type = FieldTypeDetector::detect($this->modelField);
}
return $this->_type;
} | php | {
"resource": ""
} |
q253147 | NoticeJsonRequestHandler.handle | validation | public function handle(ServerRequestInterface $request): ResponseInterface
{
$msg = "This is the default request handler. This means no middleware produced a response before hitting it.";
$contents = json_encode([
'type' => MiddlewareStackExhaustedException::class,
'message'... | php | {
"resource": ""
} |
q253148 | BootingAppBuilder.doFullBootBuildIfNecessary | validation | public function doFullBootBuildIfNecessary(AviatorApp $app)
{
// check if the watcher is running
$beaconUpdatedAt = $this->getChangedAt(Aviator::getInstallDir() . '/tmp/watch_beacon');
if ($beaconUpdatedAt > LocalDate::now()->modifyBySeconds(3)->getTimestamp()) {
echo DebugError... | php | {
"resource": ""
} |
q253149 | BootingAppBuilder.getChangedAt | validation | private function getChangedAt(string $filename) : float
{
clearstatcache(true, $filename);
return file_exists($filename)
? (float) file_get_contents($filename)
: -1;
} | php | {
"resource": ""
} |
q253150 | OperationDefinition.getRequiredParams | validation | public function getRequiredParams() {
$requiredParams = [];
foreach ($this->parameters as $parameter) {
if ($parameter->getIsOptional() || $parameter->hasDefault()) {
continue;
}
$requiredParams[] = $parameter;
}
return $requ... | php | {
"resource": ""
} |
q253151 | OperationDefinition.getDefaultParams | validation | public function getDefaultParams() {
$defaultParams = [];
foreach ($this->parameters as $parameter) {
if ($parameter->hasDefault()) {
if ($parameter->getIsAPIParameter() == false) {
$defaultParams[] = $parameter;
}
}
}
... | php | {
"resource": ""
} |
q253152 | StringHelper.trimStringRight | validation | public static function trimStringRight($str, $remove)
{
if (!is_string($str))
throw new InvalidArgumentException('$str has to be a string');
if (!is_string($remove))
throw new InvalidArgumentException('$remove has to be a string');
$len = strlen($remove);
$offset = strlen($str) - $len;
while(0 < ... | php | {
"resource": ""
} |
q253153 | Notice.setIndustry | validation | public function setIndustry($industryOne, $industryTwo)
{
$params = [
'industry_id1' => $industryOne,
'industry_id2' => $industryTwo,
];
return $this->parseJSON('json', [self::API_SET_INDUSTRY, $params]);
} | php | {
"resource": ""
} |
q253154 | Map.current | validation | public function current()
{
$current = current($this->storage);
if ($this->useMapEntries) {
return new MapEntry($current[0], $current[1]);
}
return $current[1];
} | php | {
"resource": ""
} |
q253155 | Container.addDynamic | validation | public function addDynamic($name, $factory, $createDefault = 0, $forceDefault = false)
{
$control = new RContainer($factory, $createDefault, $forceDefault);
$control->currentGroup = $this->currentGroup;
return $this[$name] = $control;
} | php | {
"resource": ""
} |
q253156 | DiOptionsCollection.from | validation | public static function from(Reader $reader, \Reflector $reflector)
{
if ($reflector instanceof \ReflectionClass) {
return new static(
Psi::it($reader->getClassAnnotations($reflector))->toArray()
);
}
if ($reflector instanceof \ReflectionMethod) {
... | php | {
"resource": ""
} |
q253157 | ApiResponse.response | validation | public function response(array $data, $http_code)
{
if (config('odin.queryRequest')) {
$data['queries'] = $this->getQueries();
}
return response()->json($data, $http_code);
} | php | {
"resource": ""
} |
q253158 | Repository.newInstanceQuery | validation | public function newInstanceQuery(array $data = [], array $selectable = ['*'])
{
$tm = new TextGenerator();
$r = $this->newInstanceRepository();
$query = $r->newQuery();
if (!empty($this->filter)) {
$filter = new Filter($r->getTableName(), $selectable);
$filt... | php | {
"resource": ""
} |
q253159 | Container.register | validation | public function register(callable $inject) : void
{
$reflection = new ReflectionFunction($inject);
$parameters = $reflection->getParameters();
foreach ($parameters as $parameter) {
$key = $parameter->name;
$getter = function ($c) use ($reflection, $parameters, $key) {... | php | {
"resource": ""
} |
q253160 | AbstractTemplate.attr | validation | public function attr($keys = [])
{
if (!is_array($keys)) {
$keys = [$keys];
}
$out = '';
foreach ($keys as $key) {
$value = $this->getValue($key)->attr();
if (!empty($value)) {
$out .= ' ' . $value;
}
}
... | php | {
"resource": ""
} |
q253161 | PageRemovedListener.onPageRemoved | validation | public function onPageRemoved(PageCollectionRemovedEvent $event)
{
$pageName = basename($event->getFilePath());
$page = $this->pagesParser
->contributor($event->getUsername())
->parse()
->page($pageName);
if (null === $page) {
return;
}... | php | {
"resource": ""
} |
q253162 | Utils.arrayRecursiveDiff | validation | public static function arrayRecursiveDiff($aArray1, $aArray2) {
$aReturn = array();
foreach ($aArray1 as $mKey => $mValue) {
if (array_key_exists($mKey, $aArray2)) {
if (is_array($mValue)) {
$aRecursiveDiff = self::arrayRecursiveDiff($mValue, $aArray2[$mK... | php | {
"resource": ""
} |
q253163 | CartItem.getAmount | validation | public function getAmount()
{
$amount = $this->getPerUnitAmount();
$totalAmount = bcmul($amount, $this->getQuantity(), 2);
return floatval($totalAmount);
} | php | {
"resource": ""
} |
q253164 | CartItem.getPerUnitAmount | validation | public function getPerUnitAmount()
{
$amount = $this->getProduct()->getPrice();
foreach ($this->getOptions() as $cartOption) {
$amount = bcadd($amount, $cartOption->getOption()->getPrice(), 2);
}
foreach ($this->getExtras() as $cartExtra) {
$amount = bcadd($... | php | {
"resource": ""
} |
q253165 | PermalinkChangedListener.onPermalinkChanged | validation | public function onPermalinkChanged(PermalinkChangedEvent $event)
{
$previousPermalink = $event->getOriginalText();
$newPermalink = $event->getChangedText();
$this->updatePermalinkOnBlocks($previousPermalink, $newPermalink);
$this->updateHomepagePermalink($previousPermalink, $newPerm... | php | {
"resource": ""
} |
q253166 | MasterGenerator.generate | validation | public function generate(string $outputDir) : array
{
$generatedFiles = [];
foreach ($this->generators as $generator) {
$this->logger->info('Running generator ' . get_class($generator));
$result = $generator->generate();
foreach ($result->all() as $phpFile) {
... | php | {
"resource": ""
} |
q253167 | ConfigReaderAutoloadListener.setAutoloadDir | validation | public function setAutoloadDir($dir)
{
if (! is_string($dir) || empty($dir)) {
throw new InvalidArgumentException(sprintf(
'Invalid directory for autoload of configuration provided; '
. 'must be a non-empty string, "%s" received.',
is_object($dir) ... | php | {
"resource": ""
} |
q253168 | InterfaceController.actionRunOne | validation | public function actionRunOne()
{
$this->out("Run Interface " . $this->dataInterface->object->name, Console::UNDERLINE, Console::FG_GREEN);
$this->hr();
$this->dataInterface->run(null, new ConsoleAction());
} | php | {
"resource": ""
} |
q253169 | InterfaceController.getDataInterface | validation | public function getDataInterface()
{
if (!$this->started) {
return $this->_interface;
}
if (is_null($this->_interface)) {
$interfaces = ArrayHelper::map(Yii::$app->collectors['dataInterfaces']->getAll(), 'systemId', 'object.name');
$this->dataInterface = $... | php | {
"resource": ""
} |
q253170 | InterfaceController.setDataInterface | validation | public function setDataInterface($value)
{
if (($interfaceItem = Yii::$app->collectors['dataInterfaces']->getOne($value)) && ($interface = $interfaceItem->object)) {
$this->_interface = $interfaceItem;
} else {
throw new Exception("Invalid interface!");
}
} | php | {
"resource": ""
} |
q253171 | CustomFieldsGroup.getActiveCustomFields | validation | public function getActiveCustomFields()
{
if($this->activeCustomFields === null) {
$this->activeCustomFields = array();
foreach ($this->customFields as $cf) {
if($cf->isActive()) {
array_push($this->activeCustomFields, $cf);
}
... | php | {
"resource": ""
} |
q253172 | LoadContentTypeData.generateField | validation | protected function generateField($fieldType, $fieldId, array $labels)
{
$field = new FieldType();
$field->setType($fieldType);
$field->setFieldId($fieldId);
$field->setDefaultValue(null);
$field->setSearchable(true);
$field->setLabels($labels);
return $field;... | php | {
"resource": ""
} |
q253173 | LoadContentTypeData.generateOption | validation | protected function generateOption($key, $value)
{
$option = new FieldOption();
$option->setKey($key);
$option->setValue($value);
return $option;
} | php | {
"resource": ""
} |
q253174 | AdminController.render | validation | public function render($view, array $parameters = array(), Response $response = null)
{
$parameters['base_template'] = isset($parameters['base_template']) ? $parameters['base_template'] : $this->getBaseTemplate();
$parameters['admin_pool'] = $this->get('sonata.admin.pool');
return parent... | php | {
"resource": ""
} |
q253175 | ArrayList.walk | validation | public function walk(Callable $callback)
{
$arrayCopy = $this->getArrayCopy();
$result = array_walk($arrayCopy, $callback);
$this->exchangeArray($arrayCopy);
return $result;
} | php | {
"resource": ""
} |
q253176 | Model.primaryKey | validation | public function primaryKey()
{
$pk = $this->meta->schema->primaryKey;
if (is_array($pk)) {
$ppk = [];
foreach ($pk as $key) {
$ppk[] = $key;
}
return implode('.', $ppk);
}
return $pk;
} | php | {
"resource": ""
} |
q253177 | Model.getPrimaryKey | validation | public function getPrimaryKey()
{
$pk = $this->meta->schema->primaryKey;
if (is_array($pk)) {
$ppk = [];
foreach ($pk as $key) {
if (!isset($this->attributes[$key])) {
$ppk[] = null;
} else {
$ppk[] = $th... | php | {
"resource": ""
} |
q253178 | Model.find | validation | protected function find($params)
{
$debug = false;
$q = new Query();
$q->select('*');
$q->from($this->_tableName);
foreach ($params as $k => $v) {
if ($k === 'join') {
foreach ($v as $join) {
if (!isset($join['type'])) {
... | php | {
"resource": ""
} |
q253179 | Model.findAll | validation | public function findAll($params = [])
{
$return = $this->populateRecords($this->find($params)->all($this->interface->db));
return $return;
} | php | {
"resource": ""
} |
q253180 | Model.findOne | validation | public function findOne($params = [])
{
return $this->populateRecord($this->find($params)->one($this->interface->db));
} | php | {
"resource": ""
} |
q253181 | UrlManager.getUrl | validation | public function getUrl(string $sCode, array $aParams = array()) : string
{
if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
foreach (Config::get('route') as $sHost => $oHost) {
if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
|| (strstr($s... | php | {
"resource": ""
} |
q253182 | ArgumentEvent.onExecuteAction | validation | public function onExecuteAction(ExecuteActionEvent $event){
$request=$event->getRequest();
$position=1;
foreach($request->getConfig()->getArray('argument') as $argument){
$this->validateArgument($request,$argument,$position++);
}
} | php | {
"resource": ""
} |
q253183 | ArgumentEvent.validateArgument | validation | private function validateArgument(Request $request , ConfigContainer $config , $position){
$value=null;
switch($config->getValue('storage')){
case 'url':
$value=$this->validateUrl($request , $config , $position);
break;
case 'post':
$value=$this->validateGetPost($request->getData() , $config , $pos... | php | {
"resource": ""
} |
q253184 | ArgumentEvent.validateUrl | validation | private function validateUrl(Request $request , ConfigContainer $config , $position){
$url=$request->getUrl();
$default=$config->getValue('default');
if(preg_match('/^'.$config->getValue('pattern').'$/',$url,$matches) && isset($matches[1])){
return $matches[1];
}
else if($default!==false){
return $co... | php | {
"resource": ""
} |
q253185 | ArgumentEvent.validateGetPost | validation | private function validateGetPost($data , ConfigContainer $config , $position){
$argumentName=$config->getValue('name');
$default=$config->getValue('default');
if(!isset($data[$argumentName])){
if($default!==false){
return $default;
}
else{
throw new RequiredArgumentException($position,$argumentNa... | php | {
"resource": ""
} |
q253186 | Guard.handleEventMessage | validation | protected function handleEventMessage(array $message)
{
Log::debug('OpenPlatform Event Message detail:', $message);
$message = new Collection($message);
$infoType = $message->get('InfoType');
if ($handler = $this->getHandler($infoType)) {
$handler->handle($message);
... | php | {
"resource": ""
} |
q253187 | ApiUser.getCurrentUser | validation | protected function getCurrentUser()
{
try {
return JWTAuth::parseToken()->authenticate();
} catch (\Tymon\JWTAuth\Exceptions\JWTException $ex) {
return null;
}
} | php | {
"resource": ""
} |
q253188 | SectionTrait.getPriority | validation | public function getPriority()
{
if (isset($this->object->singleWidget)) {
if (isset($this->object->singleWidget) && isset($this->object->singleWidget->content->priorityAdjust)) {
//\d($this->object->singleWidget->content->priorityAdjust);exit;
return $this->_prior... | php | {
"resource": ""
} |
q253189 | Oauth1.getSignature | validation | public function getSignature($baseString, array $params) {
// Remove oauth_signature if present
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
unset($params['oauth_signature']);
if ($this->signature_method === 'HMAC-SHA1') {
$result = $this->sign_HMA... | php | {
"resource": ""
} |
q253190 | Oauth1.createBaseString | validation | protected function createBaseString(Request $request, array $params)
{
// Remove query params from URL. Ref: Spec: 9.1.2.
//TODO - remove params properly, not this hack method
$request = clone $request;
// $request->setQueryFields([]);
$uri = $request->getUri();
$quer... | php | {
"resource": ""
} |
q253191 | Oauth1.buildAuthorizationHeader | validation | private function buildAuthorizationHeader(array $params)
{
foreach ($params as $key => $value) {
$params[$key] = $key . '="' . rawurlencode($value) . '"';
}
if ($this->realm) {
array_unshift(
$params,
'realm="' . rawurlencode($this->re... | php | {
"resource": ""
} |
q253192 | Oauth1.getOauthParams | validation | private function getOauthParams($nonce)
{
$params = [
'oauth_nonce' => $nonce,
'oauth_timestamp' => time(),
];
if (isset($this->oauth_token)) {
$params['oauth_token'] = $this->oauth_token;
}
$params = $this->oauthConfig-... | php | {
"resource": ""
} |
q253193 | Web2All_Table_SaveObjectTrait.substituteSQLOperationPlaceholders | validation | protected function substituteSQLOperationPlaceholders($sqloperation)
{
$sql_value=$sqloperation->toSQLString();
if (count($sqloperation->getPlaceholderValues())>0) {
// there are placeholders
// replace each questionmark by a placeholder value
$startpos=0;
$sql_value_replaced=''... | php | {
"resource": ""
} |
q253194 | Web2All_Table_SaveObjectTrait.deleteFromDB | validation | public function deleteFromDB()
{
// first check if keys are available
if (!$this->isValid()) {
return false;
}
if(count($this->key_properties)==0){
// cannot delete without keys
return false;
}
// build where part
$where_part='';
foreach ($this->key_pr... | php | {
"resource": ""
} |
q253195 | Web2All_Table_SaveObjectTrait.resetAllPropertiesExcept | validation | public function resetAllPropertiesExcept($properties=array())
{
foreach ($this->obj_to_db_trans as $obj_prop => $db_field) {
if( !in_array($obj_prop,$this->key_properties) && !in_array($obj_prop,$properties) ){
$this->{$obj_prop}=null;
}
}
} | php | {
"resource": ""
} |
q253196 | RoutingGenerator.generate | validation | public function generate(RouterInterface $router)
{
$routes = $router->getRouteCollection();
$pagesDir = $this->configurationHandler->pagesDir();
$homepageValues = array(
'_locale' => $this->configurationHandler->language(),
'country' => $this->configurationHandler->c... | php | {
"resource": ""
} |
q253197 | AggregateQueue.addQueue | validation | function addQueue($channel, $queue, $weight = 1)
{
$orig = $channel;
$channel = $this->_normalizeQueueName($channel);
if (! $queue instanceof iQueueDriver)
throw new \Exception(sprintf(
'Queue must be instance of iQueueDriver; given: (%s).'
, ... | php | {
"resource": ""
} |
q253198 | FuelProvider.add | validation | public function add($renderer, $name = null)
{
if (is_null($name))
{
$name = $renderer;
}
$this->renderers[$name] = $renderer;
} | php | {
"resource": ""
} |
q253199 | Collection.remove | validation | public function remove($element)
{
if (!$this->contains($element)) {
return false;
}
$this->offsetUnset($this->indexOf($element));
return true;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.