_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q254100
Router.addRoute
validation
public function addRoute(string $verb, string $path, array $callback): Router { $this->routeCollector->addRoute($verb, $path, $callback); return $this; }
php
{ "resource": "" }
q254101
Router.getDispatcher
validation
public function getDispatcher(): Dispatcher { if ($this->forceReload || !file_exists($this->cacheFile)) { $dispatchData = $this->buildCache(); } else { /** @noinspection PhpIncludeInspection */ $dispatchData = require $this->cacheFile; } return ca...
php
{ "resource": "" }
q254102
Router.buildCache
validation
private function buildCache(): array { $dispatchData = $this->routeCollector->getData(); file_put_contents($this->cacheFile, '<?php return ' . var_export($dispatchData, true) . ';'); return $dispatchData; }
php
{ "resource": "" }
q254103
ContentfulTwigExtension.parseBehaviour
validation
public function parseBehaviour(\stdClass $block, $search) { if (!isset($block->behaviour)) { return false; } $behaviours = array(); foreach (explode(' ', trim($block->behaviour)) as $b) { if (strstr($b, ':')) { list($name, $prop) = explode(':',...
php
{ "resource": "" }
q254104
OpenStack.getCachedIdentityService
validation
protected function getCachedIdentityService(Cache $cache, array $options): CachedIdentityService { if (!isset($options['authUrl'])) { throw new \InvalidArgumentException("'authUrl' is a required option"); } $stack = HandlerStack::create(); if (!empty($options['debugLog']) ...
php
{ "resource": "" }
q254105
Benri_Controller_Plugin_CORS.postDispatch
validation
public function postDispatch(Zend_Controller_Request_Abstract $request) { $methods = implode(', ', array_unique($this->_methods)); $headers = implode(', ', array_unique($this->_headers)); if ($this->_credentials) { header('Access-Control-Allow-Credentials: true', true); ...
php
{ "resource": "" }
q254106
API.clearQuota
validation
public function clearQuota() { $appid = $this->getAccessToken()->getAppId(); return $this->parseJSON('json', [self::API_CLEAR_QUOTA, compact('appid')]); }
php
{ "resource": "" }
q254107
SimplePlugin.init_locales
validation
public function init_locales() { if (!empty($this->textdomain) && $this->locales_initialized !== true) { load_plugin_textdomain($this->textdomain, true, $this->get_id()); $this->locales_initialized = true; } }
php
{ "resource": "" }
q254108
SimplePlugin.init_options
validation
public function init_options() { if (!is_array($this->options)) { $this->options = array(); } $options_id = $this->get_id('-options'); $options = get_option($options_id); $need_update = false; if($options === false) { $need_update = true; ...
php
{ "resource": "" }
q254109
RecoveryForm.resetPassword
validation
public function resetPassword(Token $token) { if (!$this->validate() || $token->user === null) { return false; } if ($token->user->resetPassword($this->password)) { \Yii::$app->session->setFlash('success', \Yii::t('user', 'Your password has been changed successfully....
php
{ "resource": "" }
q254110
Ldap.bind
validation
public function bind($sUser, $sPassword) : Ldap { return $this->_bConnected = ldap_bind($this->_rConnect, $sUser, $sPassword); return $this; }
php
{ "resource": "" }
q254111
Ldap.unbind
validation
public function unbind() : bool { if ($this->_bConnected) { return $this->_bConnected = ldap_unbind($this->_rConnect); } else { return true; } }
php
{ "resource": "" }
q254112
Ldap.search
validation
public function search(string $sFilter, array $aAttributes) { return ldap_search($this->_rConnect, $this->_sBase, $sFilter, $aAttributes); }
php
{ "resource": "" }
q254113
ValidatorBuilder.setElementRequired
validation
public function setElementRequired(\Zend\Form\Element $element) { $element->setAttribute('required', 'true'); //set browser validation $this->form->getInputFilter()->get($element->getAttribute('name'))->setAllowEmpty(false); //set backend requirement }
php
{ "resource": "" }
q254114
ValidatorBuilder.getElementValidatorChain
validation
protected function getElementValidatorChain(\Zend\Form\Element $element) { $elementName = $element->getAttribute('name'); return $this->form->getInputFilter()->get($elementName)->getValidatorChain(); }
php
{ "resource": "" }
q254115
SaveThemeController.saveAction
validation
public function saveAction(Request $request, Application $app) { $options = array( "configuration_handler" => $app["red_kite_cms.configuration_handler"], "plugin_manager" => $app["red_kite_cms.plugin_manager"], "theme_deployer" => $app["red_kite_cms.theme_deployer"], ...
php
{ "resource": "" }
q254116
MW_EXT_Kernel.getJSON
validation
public static function getJSON( $src ) { $src = file_get_contents( $src ); $out = json_decode( $src, true ); return $out; }
php
{ "resource": "" }
q254117
Cerberus.setNamespace
validation
private function setNamespace($serviceName = null) { if ($serviceName === null) { $this->storage->getOptions()->setNamespace($this->defaultNamespace); } else { $this->storage->getOptions()->setNamespace($serviceName); } }
php
{ "resource": "" }
q254118
SEO_Icons_SiteConfig_DataExtension.generateAndroidManifest
validation
public function generateAndroidManifest() { //// Android Pinicon Manifest $pinicon = $this->owner->AndroidPinicon(); if ($pinicon->exists()) { // $manifest = new stdClass(); // $manifest->name = $this->owner->PiniconTitle; // $manifest->...
php
{ "resource": "" }
q254119
RangeFilter.setValue
validation
public function setValue($value) { $this->value = $value; /** @noinspection NotOptimalIfConditionsInspection */ if (is_array($value) && array_key_exists('start', $value) && array_key_exists('end', $value)) { $start = (float) $value['start']; $end = (float) $value['...
php
{ "resource": "" }
q254120
ToolbarManager.render
validation
public function render() { $plugins = $this->pluginManager->getBlockPlugins(); $toolbar = array(); $left[] = $this->twig->render("RedKiteCms/Resources/views/Editor/Toolbar/_toolbar_left_buttons.html.twig"); $right[] = $this->twig->render("RedKiteCms/Resources/views/Editor/Toolbar/_t...
php
{ "resource": "" }
q254121
RegistrationForm.register
validation
public function register() { if (!$this->validate()) { return false; } $this->user->setAttributes([ 'email' => $this->email, 'username' => $this->username, 'password' => $this->password ]); return $this->user->register(); ...
php
{ "resource": "" }
q254122
DataSource.getForeignDataItem
validation
public function getForeignDataItem($key) { if (!isset($this->_foreignDataItems[$key])) { $this->createForeignDataItem(null, ['foreignPrimaryKey' => $key]); } if (isset($this->_foreignDataItems[$key])) { return $this->_foreignDataItems[$key]; } return ...
php
{ "resource": "" }
q254123
DataSource.getUnmappedKeys
validation
public function getUnmappedKeys() { $u = []; $f = $this->unmappedForeignKeys; $l = $this->unmappedLocalKeys; if (!empty($f)) { $u['foreign'] = $f; } if (!empty($l)) { $u['local'] = $l; } return $u; }
php
{ "resource": "" }
q254124
DataSource.getUnmappedLocalKeys
validation
public function getUnmappedLocalKeys() { $u = array_diff(array_keys($this->localModel->getMetaData()->columns), array_keys($this->_map)); unset($u[$this->localPrimaryKeyName]); return $u; }
php
{ "resource": "" }
q254125
DataSource.getKeyTranslation
validation
public function getKeyTranslation(Model $foreignObject, $key = null) { if (isset($key)) { return $this->internalGetKeyTranslation($foreignObject, $key); } foreach ($this->keys as $keyName => $keyField) { if (!empty($foreignObject->{$keyField})) { $key...
php
{ "resource": "" }
q254126
DataSource.getReverseKeyTranslation
validation
public function getReverseKeyTranslation($localObject) { $key = is_object($localObject) ? $localObject->primaryKey : $localObject; if ($this->settings['universalKey']) { //return KeyTranslation::findOne(['registry_id' => $key]); return KeyTranslation::find()->where(['registry...
php
{ "resource": "" }
q254127
Photo.setRawPhoto
validation
public function setRawPhoto($photo) { if (empty($photo)) { return true; } if (!($photo instanceof FileInterface)) { $photo = RawFile::createRawInstance($photo); } return $this->setStorage($photo); }
php
{ "resource": "" }
q254128
ComposerPackagesOrderCompiler.getComposer
validation
private function getComposer($fileOrPackage) { if(isset($this->jsonCache[$fileOrPackage])) return $this->jsonCache[$fileOrPackage]; if($file = $this->files[$fileOrPackage] ?? NULL) { return $this->getComposer($file); } if(is_dir($fileOrPackage)) $fil...
php
{ "resource": "" }
q254129
Collector.getTheme
validation
public function getTheme() { if (!isset($this->_theme)) { return $this->_lastLoadedTheme->object; } if (!isset($this->_theme)) { throw new Exception("No theme has been loaded!"); } return $this->_theme; }
php
{ "resource": "" }
q254130
Collector.getIdentity
validation
public function getIdentity($view) { if (!isset($view->assetBundles[$this->identityAssetBundle])) { return false; } return Yii::$app->assetManager->getBundle($this->identityAssetBundle); }
php
{ "resource": "" }
q254131
Container.createView
validation
public function createView() : \stdClass { $oView = new \stdClass; $oView->form = $this->_sView; $oView->form_start = $this->_oForm->getFormInObject()->start; $oView->form_end = $this->_oForm->getFormInObject()->end; $oView->form_row = array(); foreach ($this->_oForm...
php
{ "resource": "" }
q254132
Redirect.redirectCorrectDomainSystemParams
validation
protected function redirectCorrectDomainSystemParams (& $domainParams) { $localizationParamName = static::URL_PARAM_LOCALIZATION; if (isset($domainParams[$localizationParamName])) { $domainParams[$localizationParamName] = $this->redirectLocalizationGetUrlValueAndUnsetGet( $domainParams[$localizationParamName...
php
{ "resource": "" }
q254133
FormCollection.render
validation
public function render(ElementInterface $element) { $renderer = $this->getView(); if (!method_exists($renderer, 'plugin')) { return ''; } $wrapperClass = ''; $elementMarkup = ''; $templateMarkup = ''; $attributesString = ''; $lab...
php
{ "resource": "" }
q254134
Session.create
validation
public function create($account, $openId) { $params = [ 'kf_account' => $account, 'openid' => $openId, ]; return $this->parseJSON('json', [self::API_CREATE, $params]); }
php
{ "resource": "" }
q254135
Session.close
validation
public function close($account, $openId) { $params = [ 'kf_account' => $account, 'openid' => $openId, ]; return $this->parseJSON('json', [self::API_CLOSE, $params]); }
php
{ "resource": "" }
q254136
AccompanyingPeriod.setPerson
validation
public function setPerson(\Chill\PersonBundle\Entity\Person $person = null) { $this->person = $person; return $this; }
php
{ "resource": "" }
q254137
AccompanyingPeriod.isClosingAfterOpening
validation
public function isClosingAfterOpening() { $diff = $this->getOpeningDate()->diff($this->getClosingDate()); if ($diff->invert === 0) { return true; } else { return false; } }
php
{ "resource": "" }
q254138
Redirect.to
validation
public function to(string $path, int $status = 301, array $headers = array()) { return $this->makeRedirect($path, $status, $headers); }
php
{ "resource": "" }
q254139
Translator.translate
validation
public static function translate($message, $parameters = array(), $domain = "RedKiteCms", $locale = null) { if (null === self::$translator) { return $message; } return self::$translator->trans($message, $parameters, $domain, $locale); }
php
{ "resource": "" }
q254140
HttpEmulator.getResponse
validation
public function getResponse() { if ($this->response) { return $this->response; } return $this->response = \GuzzleHttp\Psr7\parse_response($this->getResponseStream()); }
php
{ "resource": "" }
q254141
HttpEmulator.offsetGet
validation
public function offsetGet($offset) { if ($offset === 'headers') { $headers = [ 'HTTP/' . $this->getResponse()->getProtocolVersion() . ' ' . $this->getResponse()->getStatusCode() . ' ' . $this->getResponse()->getReasonPhrase() ]; foreach ($this->getResponse...
php
{ "resource": "" }
q254142
HttpApiAction.addSource
validation
private function addSource(array $arguments = array()) { $this->builder->addSource( array_key_exists('cache', $this->source) ? $this->createCacheAdapter() : new HttpApiAdapter(), new Request(array( 'source' => $this->source, 'arguments' => $arguments, ...
php
{ "resource": "" }
q254143
HttpApiAction.addVirtualizationWorker
validation
private function addVirtualizationWorker($arguments = array()) { $this->builder->addWorker(new VirtualizationWorker( $this->registry, $this->virtualProperties, $this->deserialization, $arguments )); }
php
{ "resource": "" }
q254144
HttpApiAction.createCacheAdapter
validation
private function createCacheAdapter() { $extraData = &$this->extraData; return new CallbackAdapter(function (Request $request) use (&$extraData) { $poolName = 'default'; if (isset($this->source['cache']['pool'])) { $poolName = $this->source['cache']['pool']...
php
{ "resource": "" }
q254145
Authorizer.setAccessToken
validation
public function setAccessToken($token, $expires = 7200) { $this->cache->save($this->getAccessTokenCacheKey(), $token, $expires); return $this; }
php
{ "resource": "" }
q254146
ApiActions.index
validation
public function index(FilterRequest $request) { $limit = $request->request->get('limit', 15); $limit = ($limit > 49) ? 50 : $limit; $filter = $this->repository->filter($request); if ($this->list || $request->request->get('search_type') == 'list') { ...
php
{ "resource": "" }
q254147
ApiActions.show
validation
public function show($id, FilterRequest $request) { $id = $this->getRealId($id); $request->criteria[] = 'id,=,' . $id; $resource = $this->repository->filter($request)->first(); //$resource = $this->repository->find($id); if (! $re...
php
{ "resource": "" }
q254148
ApiActions.store
validation
public function store(FilterRequest $request) { $this->fieldManager = $this->getFieldManager(); $this->validate($request->request, $this->fieldManager->store()); $input = $request->all(); $resource = $this->repository->create($input); if (!...
php
{ "resource": "" }
q254149
ApiActions.update
validation
public function update(FilterRequest $request, $id) { $this->fieldManager = $this->getFieldManager(); $this->validate($request->request, $this->fieldManager->update()); $id = $this->getRealId($id); $resource = $this->repository->update($request->all(), $id); ...
php
{ "resource": "" }
q254150
BaseManager.all
validation
public function all() { $_filters = $this->filters; // store filters if (!$this->allowDeleted) { $this->filters = array("`" . $this->table . "`.deleted = 0"); // reset them } else { $this->filters = array(); } $values = $this->values(); $thi...
php
{ "resource": "" }
q254151
BaseManager.group
validation
public function group($group) { if (!is_array($group)) { $this->group = array($group); } else { $this->group = $group; } return $this; }
php
{ "resource": "" }
q254152
BaseManager.getCountSQL
validation
public function getCountSQL() { $statement = []; if ($this->distinct) { $distinct = 'DISTINCT '; } else { $distinct = ''; } $statement[] = "(SELECT $distinct`" . $this->table . "`.*"; $statement[] = $this->getFrom(); $statement[] = $t...
php
{ "resource": "" }
q254153
BaseManager.join
validation
public function join( BaseManager $manager, $type = null, $column = null, $column_right = null ) { $this->joins[$manager->table] = array( 'manager' => $manager, 'type' => $type, 'column' => $column, 'column_right' => $column_rig...
php
{ "resource": "" }
q254154
BaseManager.cache
validation
public function cache($flag, $expiry = null) { $this->cache = (boolean) $flag; if (!is_null($expiry)) { $this->cacheExpiry = $expiry; } return $this; }
php
{ "resource": "" }
q254155
BaseManager.getWhereAsArray
validation
protected function getWhereAsArray() { $filters = []; if (!empty($this->filters)) { $filters = $this->filters; } if (!$this->allowDeleted) { $filters[] = "(`" . $this->table . "`.deleted = 0 OR `" . $this->table . "`.deleted IS NULL)"; } if ...
php
{ "resource": "" }
q254156
BaseManager.getColumnReference
validation
protected function getColumnReference($column, $tableless) { if ($tableless) { return $column; } // check if table is already defined if (count(explode(".", $column)) > 1) { return $column; } return "`" . $this->table . "`.`" . $column . "`";...
php
{ "resource": "" }
q254157
BaseManager.resultToModels
validation
protected function resultToModels($result) { $models = array(); foreach ($result as $r) { $pk = $r->{$this->pk}; try { // It is inefficient to fetch every record from the DB here // Instead, pass in the result data $models[] = ...
php
{ "resource": "" }
q254158
Repository.sumValor
validation
public function sumValor() { $tableGateway = new TableGateway($this->tableName, $this->dbAdapter); $sql = $tableGateway->getSql(); $select = $sql->select()->columns(array('sum' => new Expression('SUM(valor)'))); return $tableGateway->selectWith($select)->current(); }
php
{ "resource": "" }
q254159
RepositoryContentAdapter.findContentType
validation
protected function findContentType($spaceId, $contentTypeName) { $contentTypes = $this->contentTypeRepo->findNewestByName($spaceId, $contentTypeName); if ($contentTypes->isEmpty()) { throw new InvalidArgumentException( sprintf( 'Content type "%s" in sp...
php
{ "resource": "" }
q254160
FilterRequest.setFilters
validation
public function setFilters() { $this->activeQueryLog() ->setFields() ->setCriteriaByQueryString() ->setCriteria() ->setIncludes() ->setLimit() ->setOrder() ->setGroup(); }
php
{ "resource": "" }
q254161
DataSource.getTotal
validation
public function getTotal() { if (!$this->isReady()) { return 0; } if (is_null($this->_countTotal)) { $this->_countTotal = 0; if (in_array($this->settings['direction'], ['to_local', 'both'])) { $this->_countTotal += count($this->foreignDataI...
php
{ "resource": "" }
q254162
DataSource.getRemaining
validation
public function getRemaining() { if (is_null($this->_countRemaining)) { $this->_countRemaining = $this->total; } return $this->_countRemaining; }
php
{ "resource": "" }
q254163
DataSource.getForeignDataItems
validation
public function getForeignDataItems() { if (!isset($this->_foreignDataItems)) { $this->_foreignDataItems = []; $this->trigger(self::EVENT_LOAD_FOREIGN_DATA_ITEMS); } return $this->_foreignDataItems; }
php
{ "resource": "" }
q254164
DataSource.getLocalDataItems
validation
public function getLocalDataItems() { if (!isset($this->_localDataItems)) { $this->trigger(self::EVENT_LOAD_LOCAL_DATA_ITEMS); } return $this->_localDataItems; }
php
{ "resource": "" }
q254165
DataSource.getHandledLocalDataItems
validation
public function getHandledLocalDataItems() { $handled = []; foreach ($this->localDataItems as $local) { if ($local->handled) { $handled[] = $local; } } return $handled; }
php
{ "resource": "" }
q254166
DataSource.setSearch
validation
public function setSearch($value) { if (!is_object($value)) { if (!isset($value['class'])) { $value['class'] = $this->searchClass; } $value = Yii::createObject($value); } $value->dataSource = $this; $this->_search = $value; }
php
{ "resource": "" }
q254167
ConfirmController.actionIndex
validation
public function actionIndex($search) { $user = $this->finder->findUserByUsernameOrEmail($search); if ($user === null) { $this->stdout(\Yii::t('user', 'User is not found') . "\n", Console::FG_RED); } else { if ($user->confirm()) { $this->stdout(\Yii::t(...
php
{ "resource": "" }
q254168
POI.lists
validation
public function lists($offset = 0, $limit = 10) { $params = [ 'begin' => $offset, 'limit' => $limit, ]; return $this->parseJSON('json', [self::API_LIST, $params]); }
php
{ "resource": "" }
q254169
POI.update
validation
public function update($poiId, array $data) { $data = array_merge($data, ['poi_id' => $poiId]); $params = [ 'business' => ['base_info' => $data], ]; return $this->parseJSON('json', [self::API_UPDATE, $params]); }
php
{ "resource": "" }
q254170
JsonList.get
validation
public function get() { $totalEntities = $this->repository->countTotal(); if(!is_null($this->category)){ $entities = $this->repository->findAllForDataTablesByCategory($this->search, $this->sortColumn, $this->sortDirection, $this->category); }elseif(!is_null($this->entity...
php
{ "resource": "" }
q254171
User.attemptConfirmation
validation
public function attemptConfirmation($code) { /** @var Token $token */ $token = $this->finder->findToken([ 'user_id' => $this->id, 'code' => $code, 'type' => Token::TYPE_CONFIRMATION, ])->one(); if ($token === null || $token->isExpired) { ...
php
{ "resource": "" }
q254172
RoutingBase.createRouter
validation
public function createRouter($debug = false) { if (null === $this->routesFile) { throw new LogicException('The derived class must define the string variable "routesFile"'); } if (!is_string($this->routesFile)) { throw new LogicException('"routesFile" variable must be...
php
{ "resource": "" }
q254173
LoadContentNewsData.generateContentAttribute
validation
protected function generateContentAttribute($name, $value, $type = 'text') { $attribute = new ContentAttribute(); $attribute->setName($name); $attribute->setValue($value); if (is_array($value)) { $value = ''; } $attribute->setStringValue($value); $...
php
{ "resource": "" }
q254174
LoadContentNewsData.generateContent
validation
protected function generateContent($type, $id, $name, $language) { $content = new Content(); $content->setContentId($id); $content->setContentType($type); $content->setDeleted(false); $content->setName($name); $content->setLanguage($language); $content->setSt...
php
{ "resource": "" }
q254175
BlockManagerMove.move
validation
public function move($baseDir, array $options, $username) { $this->resolveMoveOptions($options); if (array_key_exists("targetSlot", $options)) { $options["slot"] = $options["targetSlot"]; $block = $this->moveBlockToAnotherSlot($baseDir, $options, $username); retu...
php
{ "resource": "" }
q254176
BlockManagerMove.resolveMoveOptions
validation
protected function resolveMoveOptions(array $options) { if ($this->optionsResolved) { // @codeCoverageIgnoreStart return; // @codeCoverageIgnoreEnd } $this->optionsResolver->clear(); $this->optionsResolver->setRequired( array( ...
php
{ "resource": "" }
q254177
BlockManagerMove.moveArchiveDir
validation
private function moveArchiveDir($archiveSourceFile, $archiveTargetFile, $blockName, $slotName) { if (!is_dir($archiveSourceFile)) { return; } $this->filesystem->mirror($archiveSourceFile, $archiveTargetFile); $this->filesystem->remove($archiveSourceFile); $histo...
php
{ "resource": "" }
q254178
BlockManagerMove.changeBlockSlotAndName
validation
private function changeBlockSlotAndName($targetFile, $blockName, $slotName) { $block = json_decode(FilesystemTools::readFile($targetFile), true); $block["name"] = $blockName; $block["slot_name"] = $slotName; $json = json_encode($block); FilesystemTools::writeFile($targetFile,...
php
{ "resource": "" }
q254179
NumberField.setMin
validation
public function setMin($value){ $this->setTag('min',$value); if($this->getValidator()){ $this->getValidator()->setOption('min',$value); } }
php
{ "resource": "" }
q254180
NumberField.setMax
validation
public function setMax($value){ $this->setTag('max',$value); if($this->getValidator()){ $this->getValidator()->setOption('max',$value); } }
php
{ "resource": "" }
q254181
Consumer.assertClient
validation
private function assertClient(ClientInterface $client) { if ($client->getConnection() instanceof AggregateConnectionInterface) { throw new NotSupportedException( 'Cannot initialize a monitor consumer over aggregate connections.' ); } if ($client->getC...
php
{ "resource": "" }
q254182
Authority.storePermissions
validation
public function storePermissions($params = array()) { //2. Saniitize the data $authorityAreaTitle = $this->input->getString("area-title"); $authorityAreaURI = $this->input->getString("area-uri"); $authorityAreaAction = $this->input->getString("area-action"); $authorityAreaPermi...
php
{ "resource": "" }
q254183
FormFactory.create
validation
public function create($className, $username) { $reflectionClass = new \ReflectionClass($className); $permalinks = $this->pagesParser ->contributor($username) ->parse() ->permalinksByLanguage( $this->configurationHandler->language() . '_' . $this-...
php
{ "resource": "" }
q254184
AuthenticationService.authenticate
validation
public function authenticate(AdapterInterface $adapter = null) { $event = clone $this->getEvent(); $event->setName(AuthenticationEvent::EVENT_AUTH); if (!$adapter) { $adapter = $this->getAdapter(); } if ($adapter) { $event->setAdapter($adapter); ...
php
{ "resource": "" }
q254185
SteadyQueue.setDefaultQueues
validation
function setDefaultQueues(array $defaultQueues) { $this->_defaults = $defaultQueues; $queues = StdArray::of($this->queues)->withMergeRecursive($defaultQueues, true); $this->queues = $queues->value; return $this; }
php
{ "resource": "" }
q254186
TaggableBehavior.getTagValues
validation
public function getTagValues($asString = false) { if ($this->_tagsList === null && !$this->owner->getIsNewRecord()) { // the list of tags is not initialized $this->_tagsList = []; // trying to obtain related models $relation = $this->owner->getRelation('tagsLi...
php
{ "resource": "" }
q254187
TaggableBehavior.parseTags
validation
protected function parseTags($tags) { return array_unique(is_array($tags) ? array_filter($tags) : preg_split('/\s*,\s*/', $tags, -1, PREG_SPLIT_NO_EMPTY)); }
php
{ "resource": "" }
q254188
TaggableBehavior.ownerHasTagAttribute
validation
protected function ownerHasTagAttribute() { if ($this->_hasTagAttribute === null) { $this->_hasTagAttribute = $this->owner->hasAttribute('tags'); } return $this->_hasTagAttribute; }
php
{ "resource": "" }
q254189
TaggableBehavior.removeTagValues
validation
public function removeTagValues($tags) { $this->_tagsList = array_diff($this->getTagValues(), $this->parseTags($tags)); $this->updateOwnerTags(); }
php
{ "resource": "" }
q254190
TaggableBehavior.afterSave
validation
public function afterSave() { if ($this->_tagsList === null) { return; } $relation = $this->owner->getRelation('tagsList', false); if (!($relation instanceof ActiveQuery)) { return; } if (!$this->owner->getIsNewRecord()) { // clear ...
php
{ "resource": "" }
q254191
TaggableBehavior.beforeDelete
validation
public function beforeDelete() { // store tag ids list $this->_tagsForDelete = []; $relation = $this->owner->getRelation('tagsList', false); if ($relation instanceof ActiveQuery) { $this->_tagsForDelete = (new Query()) ->select(current($relation->link)) ...
php
{ "resource": "" }
q254192
TaggableBehavior.afterDelete
validation
public function afterDelete() { // after complete owner delete delete tags links if (!empty($this->_tagsForDelete)) { $relation = $this->owner->getRelation('tagsList', false); if ($relation instanceof ActiveQuery) { /** @var ActiveRecord $class */ ...
php
{ "resource": "" }
q254193
DataItem.getForeignParents
validation
public function getForeignParents() { $parents = []; foreach ($this->dataSource->foreignParentKeys as $keySet) { $model = $keySet['foreignModel']; unset($keySet['foreignModel']); if (!empty($this->foreignObject->{$keySet['foreignId']})) { $keySet['...
php
{ "resource": "" }
q254194
DataItem.getForeignChildren
validation
public function getForeignChildren() { $children = []; foreach ($this->dataSource->foreignChildKeys as $keySet) { $model = $keySet['foreignModel']; unset($keySet['foreignModel']); if (!empty($this->foreignObject->{$keySet['foreignId']})) { $keySet[...
php
{ "resource": "" }
q254195
Payment.priceStringToInt
validation
public static function priceStringToInt(string $str, string $propertyPath = '') : int { $str = trim($str); // verify format of string if (!preg_match('/(\.|,)[0-9]{2}$/', $str)) { throw new \InvalidArgumentException(($propertyPath ? $propertyPath.' (value: "'.$str.'")' : $str). ...
php
{ "resource": "" }
q254196
KeyTranslation.getObject
validation
public function getObject($checkAccess = true) { $registryClass = Yii::$app->classes['Registry']; $return = $registryClass::getObject($this->registry_id, $checkAccess); if (get_class($return) === 'cascade\models\Registry') { \d($this->registry_id); //throw new \Exce...
php
{ "resource": "" }
q254197
ArrayStore.remove
validation
public function remove($id) { if (!$this->has($id)) { throw new NotFoundException(sprintf('%s not found in %s', $id, __CLASS__)); } unset($this->objects[$id]); }
php
{ "resource": "" }
q254198
ModelAdapter.authenticate
validation
public function authenticate() { $identity = $this->getIdentity(); $results = $this->model->findByIdentity($identity); $identityObject = null; $count = 0; foreach ($results as $identityObject) { if ($count > 1) { return new Result( ...
php
{ "resource": "" }
q254199
Injector.inject
validation
public function inject(...$injects) : void { $container = new Container; $requested = []; foreach ($injects as $inject) { if (is_string($inject)) { $requested[] = $inject; } elseif (is_callable($inject)) { $reflection = new ReflectionFu...
php
{ "resource": "" }