_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q244600 | File.preview | validation | public function preview($width, $height)
{
if (!$width || !$height) {
throw new \Exception('Please, provide both width and height for preview');
}
$result = clone $this;
$result->operations[]['preview'] = array(
'width' => $width,
'height' => $heig... | php | {
"resource": ""
} |
q244601 | File.op | validation | public function op($operation)
{
if (!$operation) {
return $this;
}
$result = clone $this;
$result->operations[]['custom'] = $operation;
return $result;
} | php | {
"resource": ""
} |
q244602 | PagedDataIterator.exists | validation | private function exists($offset = null)
{
return isset($this->container[$offset !== null ? $offset : $this->position]);
} | php | {
"resource": ""
} |
q244603 | PagedDataIterator.isFullyLoaded | validation | private function isFullyLoaded()
{
return $this->fullyLoaded || ($this->limit && count($this->container) >= $this->limit);
} | php | {
"resource": ""
} |
q244604 | PagedDataIterator.loadChunk | validation | private function loadChunk()
{
$portion = $this->pdGetDataChunk($this->api, $this->options, $this->reverse);
$this->options = $portion['params'];
$this->nextPageParams = $portion['nextParams'];
$this->prevPageParams = $portion['prevParams'];
if ($portion['data']) {
... | php | {
"resource": ""
} |
q244605 | Rewrite_Command.flush | validation | public function flush( $args, $assoc_args ) {
// make sure we detect mod_rewrite if configured in apache_modules in config
self::apache_modules();
if ( Utils\get_flag_value( $assoc_args, 'hard' ) && ! in_array( 'mod_rewrite', (array) WP_CLI::get_config( 'apache_modules' ), true ) ) {
WP_CLI::warning( 'Regener... | php | {
"resource": ""
} |
q244606 | Rewrite_Command.structure | validation | public function structure( $args, $assoc_args ) {
global $wp_rewrite;
// copypasta from /wp-admin/options-permalink.php
$blog_prefix = '';
$prefix = $blog_prefix;
if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) {
$blog_prefix = '/blog';
}
$permalink_structure = ( 'default' =... | php | {
"resource": ""
} |
q244607 | Rewrite_Command.apache_modules | validation | private static function apache_modules() {
$mods = WP_CLI::get_config( 'apache_modules' );
if ( ! empty( $mods ) && ! function_exists( 'apache_get_modules' ) ) {
global $is_apache;
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$is_apache = true;
// needed for get_home_path() and .htac... | php | {
"resource": ""
} |
q244608 | ElementAnnotationsListener.prepareEvent | validation | protected function prepareEvent(EventInterface $event)
{
foreach (['elementSpec', 'inputSpec'] as $type) {
if (! $event->getParam($type)) {
$event->setParam($type, new ArrayObject());
}
}
$elementSpec = $event->getParam('elementSpec');
$inputS... | php | {
"resource": ""
} |
q244609 | MetadataGrapher.generateFromMetadata | validation | public function generateFromMetadata(array $metadata)
{
$this->metadata = $metadata;
$this->visitedAssociations = [];
$str = [];
foreach ($metadata as $class) {
$parent = $this->getParent($class);
if ($parent) {
... | php | {
"resource": ""
} |
q244610 | MetadataGrapher.getClassString | validation | private function getClassString(ClassMetadata $class)
{
$this->visitAssociation($class->getName());
$className = $class->getName();
$classText = '[' . str_replace('\\', '.', $className);
$fields = [];
$parent = $this->getParent($class);
$parentField... | php | {
"resource": ""
} |
q244611 | MetadataGrapher.getClassByName | validation | private function getClassByName($className)
{
if (! isset($this->classByNames[$className])) {
foreach ($this->metadata as $class) {
if ($class->getName() === $className) {
$this->classByNames[$className] = $class;
break;
}
... | php | {
"resource": ""
} |
q244612 | MetadataGrapher.visitAssociation | validation | private function visitAssociation($className, $association = null)
{
if (null === $association) {
if (isset($this->visitedAssociations[$className])) {
return false;
}
$this->visitedAssociations[$className] = [];
return true;
}
... | php | {
"resource": ""
} |
q244613 | FormAnnotationBuilderFactory.getFormFactory | validation | private function getFormFactory(ContainerInterface $services)
{
$elements = null;
if ($services->has('FormElementManager')) {
$elements = $services->get('FormElementManager');
}
return new Factory($elements);
} | php | {
"resource": ""
} |
q244614 | YumlController.indexAction | validation | public function indexAction()
{
/* @var $request \Zend\Http\Request */
$request = $this->getRequest();
$this->httpClient->setMethod(Request::METHOD_POST);
$this->httpClient->setParameterPost(['dsl_text' => $request->getPost('dsl_text')]);
$response = $this->httpClient->send()... | php | {
"resource": ""
} |
q244615 | ImageHandler.getFilename | validation | protected function getFilename($filename)
{
$callback = $this->fileCallback;
if (null === $callback || substr($filename, 0, 1) == '/') {
return $filename;
}
return $callback($filename);
} | php | {
"resource": ""
} |
q244616 | ImageHandling.open | validation | public function open($file)
{
if (strlen($file) >= 1 && $file[0] == '@') {
try {
if ($this->fileLocator instanceof FileLocatorInterface) {
$file = $this->fileLocator->locate($file);
} else {
$this->fileLocator->locateResourc... | php | {
"resource": ""
} |
q244617 | ImageHandling.createInstance | validation | private function createInstance($file, $w = null, $h = null)
{
$container = $this->container;
$webDir = $container->getParameter('gregwar_image.web_dir');
$handlerClass = $this->handlerClass;
/** @var ImageHandler $image */
$image = new $handlerClass($file, $w, $h, $this->th... | php | {
"resource": ""
} |
q244618 | RemindersController.postRemind | validation | public function postRemind()
{
\App::make('route');
\Config::set('auth.defaults.passwords', 'panel');
$response = \Password::sendResetLink(Input::only('email'), function($message) {
$message->subject('Password Reminder');
});
switch ($response) {
case PasswordBr... | php | {
"resource": ""
} |
q244619 | dashboard.showLink | validation | private function showLink ($link)
{
if (!$link['show_menu']) return false;
$user = \Auth::guard('panel')->user();
return $user->hasRole('super') || $user->hasPermission('/' . $link['url'] . '/all');
} | php | {
"resource": ""
} |
q244620 | CreateControllerPanelCommand.getDefaultNamespace | validation | protected function getDefaultNamespace($rootNamespace)
{
$controllersPath = \Config::get('panel.controllers');
if ( isset($controllersPath) && $controllersPath != NULL ){
return $controllersPath;
} else {
return $rootNamespace.'\Http\... | php | {
"resource": ""
} |
q244621 | AppHelper.getModel | validation | public function getModel($entity) {
if ( \Links::isMain($entity) ) {
$modelClass = 'Serverfireteam\\Panel\\'.$entity;
} else {
if (!empty(\Config::get('panel.modelPath'))) {
$modelClass = $this->getNameSpace() . \Config::get('panel.modelPath') . '\\' . $entity;
... | php | {
"resource": ""
} |
q244622 | HasRoles.hasRole | validation | public function hasRole($role)
{
if (is_string($role)) {
return $this->roles->contains('name', $role);
}
return !! $role->intersect($this->roles)->count();
} | php | {
"resource": ""
} |
q244623 | HasRoles.hasPermission | validation | public function hasPermission($permission)
{
$permission = Permission::whereName($permission)->first();
if (is_null($permission)){
return false;
}
return $this->hasRole($permission->roles);
} | php | {
"resource": ""
} |
q244624 | PdoAdapter.authenticate | validation | public function authenticate()
{
$user = $this->findUser();
if ($user === false) {
return new AuthenticationResult(
AuthenticationResult::FAILURE_IDENTITY_NOT_FOUND,
array(),
array('User not found.')
);
}
$vali... | php | {
"resource": ""
} |
q244625 | PdoAdapter.findUser | validation | private function findUser()
{
$sql = sprintf(
'SELECT * FROM %s WHERE %s = :identity',
$this->getTableName(),
$this->getIdentityColumn()
);
$stmt = $this->db->prepare($sql);
$stmt->execute(array('identity' => $this->getIdentity()));
// Exp... | php | {
"resource": ""
} |
q244626 | Authorization.getRole | validation | private function getRole($identity = null)
{
if (is_object($identity)) {
return $identity->getRole();
}
if (is_array($identity) && isset($identity['role'])) {
return $identity['role'];
}
return 'guest';
} | php | {
"resource": ""
} |
q244627 | Authenticator.authenticate | validation | public function authenticate($identity, $credential)
{
$adapter = $this->auth->getAdapter();
$adapter->setIdentity($identity);
$adapter->setCredential($credential);
return $this->auth->authenticate();
} | php | {
"resource": ""
} |
q244628 | SendsPasswordResetEmails.sendResetLinkEmail | validation | public function sendResetLinkEmail(Request $request)
{
$this->validateEmail($request);
$user = $this->broker()->getUser($request->only('email'));
// If the user hasn't confirmed their email address,
// we will throw a validation exception for this error.
// A user can not r... | php | {
"resource": ""
} |
q244629 | RegistersUsers.redirectAfterConfirmationPath | validation | public function redirectAfterConfirmationPath()
{
if (method_exists($this, 'redirectConfirmationTo')) {
return $this->redirectConfirmationTo();
}
return property_exists($this, 'redirectConfirmationTo') ? $this->redirectConfirmationTo : route('login');
} | php | {
"resource": ""
} |
q244630 | RegistersUsers.redirectAfterRegistrationPath | validation | public function redirectAfterRegistrationPath()
{
if (method_exists($this, 'redirectAfterRegistrationTo')) {
return $this->redirectAfterRegistrationTo();
}
return property_exists($this, 'redirectAfterRegistrationTo') ? $this->redirectAfterRegistrationTo : route('login');
} | php | {
"resource": ""
} |
q244631 | RegistersUsers.redirectAfterResendConfirmationPath | validation | public function redirectAfterResendConfirmationPath()
{
if (method_exists($this, 'redirectAfterResendConfirmationTo')) {
return $this->redirectAfterResendConfirmationTo();
}
return property_exists($this, 'redirectAfterResendConfirmationTo') ? $this->redirectAfterResendConfirmati... | php | {
"resource": ""
} |
q244632 | RegistersUsers.confirm | validation | public function confirm($confirmation_code)
{
$model = $this->guard()->getProvider()->createModel();
$user = $model->where('confirmation_code', $confirmation_code)->firstOrFail();
$user->confirmation_code = null;
$user->confirmed_at = now();
$user->save();
event(ne... | php | {
"resource": ""
} |
q244633 | RegistersUsers.resendConfirmation | validation | public function resendConfirmation(Request $request)
{
$model = $this->guard()->getProvider()->createModel();
$user = $model->findOrFail($request->session()->pull('confirmation_user_id'));
$this->sendConfirmationToUser($user);
return redirect($this->redirectAfterResendConfirmationP... | php | {
"resource": ""
} |
q244634 | RegistersUsers.register | validation | public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->sendConfirmationToUser($user);
return $this->registered($request, $user)
?: redirect($this->redirectAfterRe... | php | {
"resource": ""
} |
q244635 | RegistersUsers.sendConfirmationToUser | validation | protected function sendConfirmationToUser($user)
{
// Create the confirmation code
$user->confirmation_code = str_random(25);
$user->save();
// Notify the user
$notification = app(config('confirmation.notification'));
$user->notify($notification);
} | php | {
"resource": ""
} |
q244636 | AuthenticatesUsers.attemptLogin | validation | protected function attemptLogin(Request $request)
{
if ($this->guard()->validate($this->credentials($request))) {
$user = $this->guard()->getLastAttempted();
if (! is_null($user->confirmed_at)) {
return $this->baseAttemptLogin($request);
}
se... | php | {
"resource": ""
} |
q244637 | ConfirmEmail.toMail | validation | public function toMail($notifiable)
{
return (new MailMessage)
->subject(__('confirmation::confirmation.confirmation_subject'))
->line(__('confirmation::confirmation.confirmation_subject_title'))
->line(__('confirmation::confirmation.confirmation_body'))
->act... | php | {
"resource": ""
} |
q244638 | Normalizer.urlDecodeUnreservedChars | validation | public function urlDecodeUnreservedChars($string)
{
$string = rawurldecode($string);
$string = rawurlencode($string);
$string = str_replace(array( '%2F', '%3A', '%40' ), array( '/', ':', '@' ), $string);
return $string;
} | php | {
"resource": ""
} |
q244639 | Normalizer.parseStr | validation | private function parseStr($string)
{
$params = array();
$pairs = explode('&', $string);
foreach ($pairs as $pair) {
if (! $pair) {
continue;
}
$var = explode('=', $pair, 2);
$val = ( isset( $var[1] ) ? $var[1]... | php | {
"resource": ""
} |
q244640 | ApistMethod.get | validation | public function get($arguments = [])
{
try
{
$this->makeRequest($arguments);
} catch (ConnectException $e)
{
$url = $e->getRequest()->getUrl();
return $this->errorResponse($e->getCode(), $e->getMessage(), $url);
} catch (RequestException $e)
{
$url = $e->getRequest()->getUrl();
$status = $e-... | php | {
"resource": ""
} |
q244641 | ApistMethod.makeRequest | validation | protected function makeRequest($arguments = [])
{
$defaults = $this->getDefaultOptions();
$arguments = array_merge($defaults, $arguments);
$client = $this->resource->getGuzzle();
$request = $client->createRequest($this->getMethod(), $this->url, $arguments);
$response = $client->send($request);
$this->setRe... | php | {
"resource": ""
} |
q244642 | ApistSelector.getValue | validation | public function getValue(ApistMethod $method, Crawler $rootNode = null)
{
if (is_null($rootNode))
{
$rootNode = $method->getCrawler();
}
$result = $rootNode->filter($this->selector);
return $this->applyResultCallbackChain($result, $method);
} | php | {
"resource": ""
} |
q244643 | ApistSelector.applyResultCallbackChain | validation | protected function applyResultCallbackChain(Crawler $node, ApistMethod $method)
{
if (empty($this->resultMethodChain))
{
$this->addCallback('text');
}
/** @var ResultCallback[] $traceStack */
$traceStack = [];
foreach ($this->resultMethodChain as $resultCallback)
{
try
{
$traceStack[] = $res... | php | {
"resource": ""
} |
q244644 | YamlApist.loadFromYml | validation | protected function loadFromYml($file)
{
$this->parser = new Parser($file);
$this->parser->load($this);
} | php | {
"resource": ""
} |
q244645 | Command.lock | validation | public function lock(Output $output)
{
# If this command doesn't require locking then don't do anything
if (!$this->lock) {
return;
}
$this->lock = $this->getApplication()->getLockFactory()->createLock($this->getName());
if (!$this->lock->acquire()) {
... | php | {
"resource": ""
} |
q244646 | Command.timeout | validation | public function timeout(int $timeout): bool
{
$application = $this->getApplication();
if (!$application instanceof Application) {
return false;
}
# Check if the application is currently allowing time limiting or not
if (!$application->timeLimit()) {
r... | php | {
"resource": ""
} |
q244647 | Application.loadCommands | validation | public function loadCommands(string $path, string $namespace = "", string $suffix = "Command"): Application
{
$commands = [];
# Get the realpath so we can strip it from the start of the filename
$realpath = (string) realpath($path);
$finder = (new Finder())->files()->in($path)->nam... | php | {
"resource": ""
} |
q244648 | Application.setLockStore | validation | public function setLockStore(StoreInterface $store): Factory
{
$this->lockFactory = new Factory($store);
return $this->lockFactory;
} | php | {
"resource": ""
} |
q244649 | Application.getLockFactory | validation | public function getLockFactory(): Factory
{
if ($this->lockFactory !== null) {
return $this->lockFactory;
}
if (!is_dir($this->lockPath)) {
(new Filesystem())->mkdir($this->lockPath);
}
$store = new FlockStore($this->lockPath);
return $this->... | php | {
"resource": ""
} |
q244650 | Application.setLockPath | validation | public function setLockPath(string $path): Application
{
if (!is_dir($path)) {
(new Filesystem())->mkdir($path);
}
if (!$realpath = realpath($path)) {
throw new \InvalidArgumentException("The directory (" . $path . ") is unavailable");
}
$this->lockPa... | php | {
"resource": ""
} |
q244651 | Application.runCommand | validation | public function runCommand(string $command, array $options, InputInterface $current, OutputInterface $output): int
{
# The first input argument must be the command name
array_unshift($options, $command);
$input = new ArrayInput($options);
if (!$current->isInteractive()) {
... | php | {
"resource": ""
} |
q244652 | Duration.format | validation | public function format(): string
{
foreach ($this->times as $unit => $value) {
if ($this->time >= $value) {
$time = floor($this->time / $value * 100) / 100;
return "{$time} {$unit}";
}
}
return round($this->time * 1000) . " ms";
} | php | {
"resource": ""
} |
q244653 | CrawlLogger.finishedCrawling | validation | public function finishedCrawling()
{
$this->consoleOutput->writeln('');
$this->consoleOutput->writeln('Crawling summary');
$this->consoleOutput->writeln('----------------');
ksort($this->crawledUrls);
foreach ($this->crawledUrls as $statusCode => $urls) {
$color... | php | {
"resource": ""
} |
q244654 | BaseBitrixModel.refreshFields | validation | public function refreshFields()
{
if ($this->id === null) {
$this->original = [];
return $this->fields = [];
}
$this->fields = static::query()->getById($this->id)->fields;
$this->original = $this->fields;
$this->fieldsAreFetched = tru... | php | {
"resource": ""
} |
q244655 | BaseBitrixModel.fill | validation | public function fill($fields)
{
if (!is_array($fields)) {
return;
}
if (isset($fields['ID'])) {
$this->id = $fields['ID'];
}
$this->fields = $fields;
$this->fieldsAreFetched = true;
if (method_exists(... | php | {
"resource": ""
} |
q244656 | BaseBitrixModel.update | validation | public function update(array $fields = [])
{
$keys = [];
foreach ($fields as $key => $value) {
array_set($this->fields, $key, $value);
$keys[] = $key;
}
return $this->save($keys);
} | php | {
"resource": ""
} |
q244657 | BaseBitrixModel.normalizeFieldsForSave | validation | protected function normalizeFieldsForSave($selectedFields)
{
$fields = [];
if ($this->fields === null) {
return [];
}
foreach ($this->fields as $field => $value) {
if (!$this->fieldShouldNotBeSaved($field, $value, $selectedFields)) {
$fields[$... | php | {
"resource": ""
} |
q244658 | BaseBitrixModel.getValueFromLanguageField | validation | protected function getValueFromLanguageField($field)
{
$key = $field . '_' . $this->getCurrentLanguage();
return isset($this->fields[$key]) ? $this->fields[$key] : null;
} | php | {
"resource": ""
} |
q244659 | ServiceProvider.registerEloquent | validation | public static function registerEloquent()
{
$capsule = self::bootstrapIlluminateDatabase();
class_alias(Capsule::class, 'DB');
if ($_COOKIE["show_sql_stat"] == "Y") {
Capsule::enableQueryLog();
$em = \Bitrix\Main\EventManager::getInstance();
$em->addEven... | php | {
"resource": ""
} |
q244660 | ServiceProvider.instantiateServiceContainer | validation | protected static function instantiateServiceContainer()
{
$container = Container::getInstance();
if (!$container) {
$container = new Container();
Container::setInstance($container);
}
return $container;
} | php | {
"resource": ""
} |
q244661 | BitrixModel.delete | validation | public function delete()
{
if ($this->onBeforeDelete() === false) {
return false;
}
$result = static::$bxObject->delete($this->id);
$this->setEventErrorsOnFail($result, static::$bxObject);
$this->onAfterDelete($result);
$this->resetEventErrors();
... | php | {
"resource": ""
} |
q244662 | UserQuery.loadModels | validation | protected function loadModels()
{
$queryType = 'UserQuery::getList';
$sort = $this->sort;
$filter = $this->normalizeFilter();
$params = [
'SELECT' => $this->propsMustBeSelected() ? ['UF_*'] : ($this->normalizeUfSelect() ?: false),
'NAV_PARAMS' => $this->na... | php | {
"resource": ""
} |
q244663 | UserQuery.count | validation | public function count()
{
if ($this->queryShouldBeStopped) {
return 0;
}
$queryType = 'UserQuery::count';
$filter = $this->normalizeFilter();
$callback = function() use ($filter) {
return (int) $this->bxObject->getList($order = 'ID', $by = 'ASC', $fil... | php | {
"resource": ""
} |
q244664 | UserQuery.groupsMustBeSelected | validation | protected function groupsMustBeSelected()
{
return in_array('GROUPS', $this->select) || in_array('GROUP_ID', $this->select) || in_array('GROUPS_ID', $this->select);
} | php | {
"resource": ""
} |
q244665 | UserQuery.normalizeFilter | validation | protected function normalizeFilter()
{
$this->substituteField($this->filter, 'GROUPS', 'GROUPS_ID');
$this->substituteField($this->filter, 'GROUP_ID', 'GROUPS_ID');
return $this->filter;
} | php | {
"resource": ""
} |
q244666 | BaseQuery.getById | validation | public function getById($id)
{
if (!$id || $this->queryShouldBeStopped) {
return false;
}
$this->sort = [];
$this->filter['ID'] = $id;
return $this->getList()->first(null, false);
} | php | {
"resource": ""
} |
q244667 | BaseQuery.sort | validation | public function sort($by, $order = 'ASC')
{
$this->sort = is_array($by) ? $by : [$by => $order];
return $this;
} | php | {
"resource": ""
} |
q244668 | BaseQuery.addFilter | validation | public function addFilter($filters)
{
foreach ($filters as $field => $value) {
$this->filter[$field] = $value;
}
return $this;
} | php | {
"resource": ""
} |
q244669 | BaseQuery.paginate | validation | public function paginate($perPage = 15, $pageName = 'page')
{
$page = Paginator::resolveCurrentPage($pageName);
$total = $this->count();
$results = $this->forPage($page, $perPage)->getList();
return new LengthAwarePaginator($results, $total, $perPage, $page, [
'path' => ... | php | {
"resource": ""
} |
q244670 | BaseQuery.propsMustBeSelected | validation | protected function propsMustBeSelected()
{
return in_array('PROPS', $this->select)
|| in_array('PROPERTIES', $this->select)
|| in_array('PROPERTY_VALUES', $this->select);
} | php | {
"resource": ""
} |
q244671 | BaseQuery.rememberInCache | validation | protected function rememberInCache($key, $minutes, Closure $callback)
{
$minutes = (double) $minutes;
if ($minutes <= 0) {
return $callback();
}
$cache = Cache::createInstance();
if ($cache->initCache($minutes * 60, $key, '/bitrix-models')) {
$vars = ... | php | {
"resource": ""
} |
q244672 | SectionQuery.count | validation | public function count()
{
if ($this->queryShouldBeStopped) {
return 0;
}
$queryType = 'SectionQuery::count';
$filter = $this->normalizeFilter();
$callback = function() use ($filter) {
return (int) $this->bxObject->getCount($filter);
};
... | php | {
"resource": ""
} |
q244673 | SectionQuery.normalizeSelect | validation | protected function normalizeSelect()
{
if ($this->fieldsMustBeSelected()) {
$this->select = array_merge($this->standardFields, $this->select);
}
if ($this->propsMustBeSelected()) {
$this->select[] = 'IBLOCK_ID';
$this->select[] = 'UF_*';
}
... | php | {
"resource": ""
} |
q244674 | UserModel.refreshFields | validation | public function refreshFields()
{
if ($this->id === null) {
$this->original = [];
return $this->fields = [];
}
$groupBackup = isset($this->fields['GROUP_ID']) ? $this->fields['GROUP_ID'] : null;
$this->fields = static::query()->getById($this->id)->fields;
... | php | {
"resource": ""
} |
q244675 | UserModel.refreshGroups | validation | public function refreshGroups()
{
if ($this->id === null) {
return [];
}
global $USER;
$this->fields['GROUP_ID'] = $this->isCurrent()
? $USER->getUserGroupArray()
: static::$bxObject->getUserGroup($this->id);
$this->groupsAreFetched = tr... | php | {
"resource": ""
} |
q244676 | UserModel.substituteGroup | validation | public function substituteGroup($old, $new)
{
$groups = $this->getGroups();
if(($key = array_search($old, $groups)) !== false) {
unset($groups[$key]);
}
if (!in_array($new, $groups)) {
$groups[] = $new;
}
$this->fields['GROUP_ID'] = $groups;... | php | {
"resource": ""
} |
q244677 | ElementQuery.fetchAllPropsForSelect | validation | protected function fetchAllPropsForSelect()
{
$props = [];
$rsProps = static::$cIblockObject->GetProperties($this->iblockId);
while ($prop = $rsProps->Fetch()) {
$props[] = 'PROPERTY_'.$prop['CODE'];
}
return $props;
} | php | {
"resource": ""
} |
q244678 | ElementModel.refreshFields | validation | public function refreshFields()
{
if ($this->id === null) {
$this->original = [];
return $this->fields = [];
}
$sectionsBackup = isset($this->fields['IBLOCK_SECTION']) ? $this->fields['IBLOCK_SECTION'] : null;
$this->fields = static::query()->getById($this->... | php | {
"resource": ""
} |
q244679 | ElementModel.refreshSections | validation | public function refreshSections()
{
if ($this->id === null) {
return [];
}
$this->fields['IBLOCK_SECTION'] = [];
$dbSections = static::$bxObject->getElementGroups($this->id, true);
while ($section = $dbSections->Fetch()) {
$this->fields['IBLOCK_SECTIO... | php | {
"resource": ""
} |
q244680 | ElementModel.section | validation | public function section($load = false)
{
$fields = $this->getFields();
/** @var SectionModel $sectionModel */
$sectionModel = static::sectionModel();
return $load
? $sectionModel::query()->getById($fields['IBLOCK_SECTION_ID'])
: new $sectionModel($fields['IB... | php | {
"resource": ""
} |
q244681 | ElementModel.saveProps | validation | public function saveProps($selected = [])
{
$propertyValues = $this->constructPropertyValuesForSave($selected);
if (empty($propertyValues)) {
return false;
}
$bxMethod = empty($selected) ? 'setPropertyValues' : 'setPropertyValuesEx';
static::$bxObject->$bxMethod(... | php | {
"resource": ""
} |
q244682 | ElementModel.normalizePropertyFormat | validation | protected function normalizePropertyFormat()
{
if (empty($this->fields['PROPERTIES'])) {
return;
}
foreach ($this->fields['PROPERTIES'] as $code => $prop) {
$this->fields['PROPERTY_'.$code.'_VALUE'] = $prop['VALUE'];
$this->fields['~PROPERTY_'.$code.'_VAL... | php | {
"resource": ""
} |
q244683 | OldCoreQuery.fetchUsing | validation | public function fetchUsing($methodAndParams)
{
// simple case
if (is_string($methodAndParams) || empty($methodAndParams['method'])) {
$this->fetchUsing = in_array($methodAndParams, ['GetNext', 'getNext'])
? ['method' => 'GetNext', 'params' => [true, true]]
... | php | {
"resource": ""
} |
q244684 | ArrayableModel.offsetExists | validation | public function offsetExists($offset)
{
return $this->getAccessor($offset) || $this->getAccessorForLanguageField($offset)
? true : isset($this->fields[$offset]);
} | php | {
"resource": ""
} |
q244685 | ArrayableModel.offsetGet | validation | public function offsetGet($offset)
{
$fieldValue = isset($this->fields[$offset]) ? $this->fields[$offset] : null;
$accessor = $this->getAccessor($offset);
if ($accessor) {
return $this->$accessor($fieldValue);
}
$accessorForLanguageField = $this->getAccessorForLa... | php | {
"resource": ""
} |
q244686 | ArrayableModel.getAccessor | validation | private function getAccessor($field)
{
$method = 'get'.camel_case($field).'Attribute';
return method_exists($this, $method) ? $method : false;
} | php | {
"resource": ""
} |
q244687 | ArrayableModel.getAccessorForLanguageField | validation | private function getAccessorForLanguageField($field)
{
$method = 'getValueFromLanguageField';
return in_array($field, $this->languageAccessors) && method_exists($this, $method) ? $method : false;
} | php | {
"resource": ""
} |
q244688 | ArrayableModel.toArray | validation | public function toArray()
{
$array = $this->fields;
foreach ($this->appends as $accessor) {
if (isset($this[$accessor])) {
$array[$accessor] = $this[$accessor];
}
}
foreach ($this->related as $key => $value) {
if (is_object($value... | php | {
"resource": ""
} |
q244689 | EloquentModel.getAttribute | validation | public function getAttribute($key)
{
if (in_array($key, $this->multipleHighloadBlockFields)) {
return unserialize($this->attributes[$key]);
}
return parent::getAttribute($key);
} | php | {
"resource": ""
} |
q244690 | EloquentModel.setAttribute | validation | public function setAttribute($key, $value)
{
if (in_array($key, $this->multipleHighloadBlockFields)) {
$this->attributes[$key] = serialize($value);
return $this;
}
parent::setAttribute($key, $value);
return $this;
} | php | {
"resource": ""
} |
q244691 | SectionModel.getDirectChildren | validation | public function getDirectChildren(array $filter = [])
{
return static::query()
->filter($filter)
->filter(['SECTION_ID' => $this->id])
->select('ID')
->getList()
->transform(function ($section) {
return (int) $section['ID'];
... | php | {
"resource": ""
} |
q244692 | EventProducerTrait.recordThat | validation | protected function recordThat(AggregateChanged $event): void
{
$this->version += 1;
$this->recordedEvents[] = $event->withVersion($this->version);
$this->apply($event);
} | php | {
"resource": ""
} |
q244693 | AggregateRepository.getAggregateRoot | validation | public function getAggregateRoot(string $aggregateId)
{
if (! $this->disableIdentityMap && isset($this->identityMap[$aggregateId])) {
return $this->identityMap[$aggregateId];
}
if ($this->snapshotStore) {
$eventSourcedAggregateRoot = $this->loadFromSnapshotStore($agg... | php | {
"resource": ""
} |
q244694 | AggregateRepository.determineStreamName | validation | protected function determineStreamName(string $aggregateId): StreamName
{
if ($this->oneStreamPerAggregate) {
if (null === $this->streamName) {
$prefix = $this->aggregateType->toString();
} else {
$prefix = $this->streamName->toString();
}
... | php | {
"resource": ""
} |
q244695 | AggregateType.fromAggregateRoot | validation | public static function fromAggregateRoot($eventSourcedAggregateRoot): AggregateType
{
if (! \is_object($eventSourcedAggregateRoot)) {
throw new Exception\AggregateTypeException(
\sprintf('Aggregate root must be an object but type of %s given', \gettype($eventSourcedAggregateRoot)... | php | {
"resource": ""
} |
q244696 | AggregateType.fromAggregateRootClass | validation | public static function fromAggregateRootClass(string $aggregateRootClass): AggregateType
{
if (! \class_exists($aggregateRootClass)) {
throw new Exception\InvalidArgumentException(\sprintf('Aggregate root class %s can not be found', $aggregateRootClass));
}
$self = new static();... | php | {
"resource": ""
} |
q244697 | AggregateType.fromString | validation | public static function fromString(string $aggregateTypeString): AggregateType
{
if (empty($aggregateTypeString)) {
throw new Exception\InvalidArgumentException('AggregateType must be a non empty string');
}
$self = new static();
$self->aggregateType = $aggregateTypeStrin... | php | {
"resource": ""
} |
q244698 | EventSourcedTrait.replay | validation | protected function replay(Iterator $historyEvents): void
{
foreach ($historyEvents as $pastEvent) {
/** @var AggregateChanged $pastEvent */
$this->version = $pastEvent->version();
$this->apply($pastEvent);
}
} | php | {
"resource": ""
} |
q244699 | Application.extend | validation | public function extend($module): void
{
if (is_object($module) || class_exists($module)) {
$this->modules[] = $module;
} else {
throw ApplicationException::forInvalidModule($module);
}
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.