_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q234700 | Observer.dispatch | train | protected function dispatch(DelayedEvent $event)
{
if ($this->current instanceof Transaction) {
// Already in transaction, reserve it
$this->current->attach($event);
} else {
// There are no transactions, just dispatch it
$event->fire();
}
... | php | {
"resource": ""
} |
q234701 | RoutesJavascriptGenerator.getPatternFilters | train | protected function getPatternFilters($route)
{
$patterns = [];
foreach ($route->methods() as $method) {
$inner = $this->getMethodPatterns($route->uri(), $method);
$patterns = array_merge($patterns, array_keys($inner));
}
return $patterns;
} | php | {
"resource": ""
} |
q234702 | RoutesJavascriptGenerator.getMethodPatterns | train | protected function getMethodPatterns($uri, $method)
{
return $this->router->findPatternFilters(Request::create($uri, $method));
} | php | {
"resource": ""
} |
q234703 | PublisherManager.queue | train | public function queue($queue): bool
{
$queue = \array_unique(\array_merge($this->queued(), (array) $queue));
$this->memory->put('orchestra.publisher.queue', $queue);
return true;
} | php | {
"resource": ""
} |
q234704 | Foundation.widget | train | public function widget(string $type)
{
return ! \is_null($this->widget)
? $this->widget->make("{$type}.orchestra")
: null;
} | php | {
"resource": ""
} |
q234705 | Foundation.createAdminMenu | train | protected function createAdminMenu(): void
{
$menu = $this->menu();
$events = $this->app->make('events');
$handlers = [
UserMenuHandler::class,
ExtensionMenuHandler::class,
SettingMenuHandler::class,
];
$menu->add('home')
->ti... | php | {
"resource": ""
} |
q234706 | Foundation.registerComponents | train | protected function registerComponents(MemoryProvider $memory): void
{
$this->app->make('orchestra.notifier')->setDefaultDriver('orchestra');
$this->app->make('orchestra.mail')->attach($memory);
} | php | {
"resource": ""
} |
q234707 | Response.forge | train | public static function forge(RequestInterface $request)
{
$headerSize = $request->getInfo(CURLINFO_HEADER_SIZE);
$response = $request->getRawResponse();
$content = (strlen($response) === $headerSize) ? '' : substr($response, $headerSize);
$rawHeaders = rtrim(substr($response, 0... | php | {
"resource": ""
} |
q234708 | SiteCommerceLazyBuilders.cartBlock | train | public function cartBlock($pid) {
$site_commerce = $this->entityTypeManager->getStorage('site_commerce')->load($pid);
// Проверяем добавлена ли текущая позиция в корзину.
$position_in_cart = FALSE;
$databaseSendOrder = \Drupal::service('site_orders.database');
if ($databaseSendOrder->hasPositionInC... | php | {
"resource": ""
} |
q234709 | SiteCommerceLazyBuilders.parametrsBlock | train | public function parametrsBlock($id) {
$databaseSendOrder = \Drupal::service('site_orders.database');
$site_commerce = \Drupal::entityTypeManager()->getStorage('site_commerce')->load($id);
$items = $site_commerce->get('field_parametrs')->getValue();
$values = [];
foreach ($items as $delta => $item) ... | php | {
"resource": ""
} |
q234710 | Misc.cols | train | public static function cols( $cache = true ) {
static $cols = false;
if( !$cols || !$cache ) {
$cols = intval(`tput cols`);
}
return $cols ? : 80;
}
/**
* The row size of the current terminal as returned by tput
*
* @staticvar bool|int $rows the cached value for the number of columns
* @param boo... | php | {
"resource": ""
} |
q234711 | ProfileCreatorController.createProfileFailed | train | public function createProfileFailed(array $errors)
{
messages('error', trans('orchestra/foundation::response.db-failed', $errors));
return $this->redirect($this->getRedirectToRegisterPath())->withInput();
} | php | {
"resource": ""
} |
q234712 | PasswordBrokerController.showResetForm | train | public function showResetForm($token = null)
{
if (is_null($token)) {
return $this->showLinkRequestForm();
}
$email = Request::input('email');
set_meta('title', trans('orchestra/foundation::title.reset-password'));
return view('orchestra/foundation::forgot.rese... | php | {
"resource": ""
} |
q234713 | PasswordBrokerController.reset | train | public function reset(Processor $processor)
{
$input = Request::only('email', 'password', 'password_confirmation', 'token');
return $processor->update($this, $input);
} | php | {
"resource": ""
} |
q234714 | PasswordBrokerController.passwordResetHasFailed | train | public function passwordResetHasFailed($response)
{
$message = trans($response);
$token = Request::input('token');
return $this->redirectWithMessage(handles("orchestra::forgot/reset/{$token}"), $message, 'error');
} | php | {
"resource": ""
} |
q234715 | NodePath.toCleanString | train | public function toCleanString() : string
{
$path = array_filter($this->path, function ($val) {
return $val != Structure::ARRAY_NAME;
});
return implode('.', $path);
} | php | {
"resource": ""
} |
q234716 | NodePath.addChild | train | public function addChild(string $key) : NodePath
{
$path = $this->path;
$path[] = $key;
return new NodePath($path);
} | php | {
"resource": ""
} |
q234717 | NodePath.popFirst | train | public function popFirst(&$first) : NodePath
{
$path = $this->path;
$first = array_shift($path);
return new NodePath($path);
} | php | {
"resource": ""
} |
q234718 | Setting.getValue | train | private function getValue($input, $alternative)
{
if (empty($input)) {
$input = Config::get($alternative);
}
return $input;
} | php | {
"resource": ""
} |
q234719 | MigrateController.migrationHasSucceed | train | public function migrationHasSucceed(Fluent $extension)
{
$message = trans('orchestra/foundation::response.extensions.migrate', $extension->getAttributes());
return $this->redirectWithMessage(handles('orchestra::extensions'), $message);
} | php | {
"resource": ""
} |
q234720 | RedirectUsers.redirectUserTo | train | protected function redirectUserTo(string $namespace, string $path, ?string $redirect = null): string
{
return \handles($this->redirectUserPath($namespace, $path, $redirect));
} | php | {
"resource": ""
} |
q234721 | RedirectUsers.redirectUserPath | train | protected function redirectUserPath(string $namespace, string $path, ?string $redirect = null): string
{
if (! empty($redirect)) {
$path = $redirect;
}
$property = \sprintf('redirect%sPath', Str::ucfirst($namespace));
return \property_exists($this, $property) ? $this->{... | php | {
"resource": ""
} |
q234722 | TypeConverter.toSerialize | train | public static function toSerialize($resource) {
if (!self::isArray($resource)) {
$resource = self::toArray($resource);
}
return serialize($resource);
} | php | {
"resource": ""
} |
q234723 | TypeConverter.utf8Encode | train | public static function utf8Encode($data) {
if (is_string($data)) {
return utf8_encode($data);
} else if (is_array($data)) {
foreach ($data as $key => $value) {
$data[utf8_encode($key)] = self::utf8Encode($value);
}
} else if (is_object($data)) {
foreach ($data as $key => $value) {
$data->{$k... | php | {
"resource": ""
} |
q234724 | TypeConverter.utf8Decode | train | public static function utf8Decode($data) {
if (is_string($data)) {
return utf8_decode($data);
} else if (is_array($data)) {
foreach ($data as $key => $value) {
$data[utf8_decode($key)] = self::utf8Decode($value);
}
} else if (is_object($data)) {
foreach ($data as $key => $value) {
$data->{$k... | php | {
"resource": ""
} |
q234725 | Setting.form | train | public function form($model)
{
return $this->form->of('orchestra.settings', function (FormGrid $form) use ($model) {
$form->setup($this, 'orchestra::settings', $model);
$this->application($form);
$this->mailer($form, $model);
});
} | php | {
"resource": ""
} |
q234726 | SiteCommerceSearch.indexStep | train | protected function indexStep($step) {
$text = '<h1>' . $step->title . '</h1> ';
$text .= $step->description . ' ';
$text = trim($text);
// Use the current default interface language.
$language = \Drupal::languageManager()->getCurrentLanguage();
// Instantiate the transliteration class.
$... | php | {
"resource": ""
} |
q234727 | User.table | train | public function table($model)
{
return $this->table->of('orchestra.users', function (TableGrid $table) use ($model) {
// attach Model and set pagination option to true
$table->with($model);
$table->sortable($this->getSortableFields());
$table->layout('orchest... | php | {
"resource": ""
} |
q234728 | User.form | train | public function form($model)
{
return $this->form->of('orchestra.users', function (FormGrid $form) use ($model) {
$form->resource($this, 'orchestra/foundation::users', $model);
$form->hidden('id');
$form->fieldset(function (Fieldset $fieldset) {
$fieldse... | php | {
"resource": ""
} |
q234729 | User.getFullnameColumn | train | protected function getFullnameColumn()
{
return function ($row) {
$roles = $row->roles;
$value = [];
foreach ($roles as $role) {
$value[] = app('html')->create('span', e($role->name), [
'class' => 'label label-info',
... | php | {
"resource": ""
} |
q234730 | SiteCommerceListBuilder.getEntityIds | train | protected function getEntityIds() {
$query = $this->getStorage()->getQuery()
->sort($this->entityType->getKey('id'), 'DESC');
$this->limit = 1000;
if ($this->limit) {
$query->pager($this->limit);
}
return $query->execute();
} | php | {
"resource": ""
} |
q234731 | SiteCommerceListBuilder.getDefaultOperations | train | protected function getDefaultOperations(EntityInterface $entity) {
$operations = [];
if ($entity->access('update') && $entity->hasLinkTemplate('edit-form')) {
$operations['edit'] = [
'title' => $this->t('Edit'),
'weight' => 10,
'url' => $entity->urlInfo('edit-form'),
];
}... | php | {
"resource": ""
} |
q234732 | PasswordBroker.store | train | public function store(PasswordResetLink $listener, array $input)
{
$validation = $this->validator->with($input);
if ($validation->fails()) {
return $listener->resetLinkFailedValidation($validation->getMessageBag());
}
$response = $this->password->sendResetLink(['email' ... | php | {
"resource": ""
} |
q234733 | ActionController.queueToPublisher | train | protected function queueToPublisher(Fluent $extension)
{
Publisher::queue($extension->get('name'));
return $this->redirect(handles('orchestra::publisher'));
} | php | {
"resource": ""
} |
q234734 | Analyzer.checkType | train | private function checkType($oldType, $newType, NodePath $nodePath) : string
{
if (!is_null($oldType) && ($newType !== $oldType) && ($newType !== 'null') && ($oldType !== 'null')) {
throw new JsonParserException(
"Data in '$nodePath' contains incompatible data types '$oldType' and... | php | {
"resource": ""
} |
q234735 | Controller.getExtension | train | protected function getExtension($vendor, $package = null)
{
$name = (is_null($package) ? $vendor : implode('/', [$vendor, $package]));
return new Fluent(['name' => $name, 'uid' => $name]);
} | php | {
"resource": ""
} |
q234736 | AuthenticateUser.login | train | public function login(Listener $listener, array $input, ThrottlesCommand $throttles = null)
{
$validation = $this->validator->on('login')->with($input);
// Validate user login, if any errors is found redirect it back to
// login page with the errors.
if ($validation->fails()) {
... | php | {
"resource": ""
} |
q234737 | AuthenticateUser.handleUserHasTooManyAttempts | train | protected function handleUserHasTooManyAttempts(Listener $listener, array $input, ThrottlesCommand $throttles = null)
{
$throttles->incrementLoginAttempts();
$throttles->fireLockoutEvent();
return $listener->sendLockoutResponse($input, $throttles->getSecondsBeforeNextAttempts());
} | php | {
"resource": ""
} |
q234738 | AuthenticateUser.handleUserFailedAuthentication | train | protected function handleUserFailedAuthentication(Listener $listener, array $input, ThrottlesCommand $throttles = null)
{
if ($throttles) {
$throttles->incrementLoginAttempts();
}
return $listener->userLoginHasFailedAuthentication($input);
} | php | {
"resource": ""
} |
q234739 | AuthenticateUser.verifyWhenFirstTimeLogin | train | protected function verifyWhenFirstTimeLogin(Eloquent $user)
{
if ((int) $user->getAttribute('status') === Eloquent::UNVERIFIED) {
$user->activate()->save();
}
return $user;
} | php | {
"resource": ""
} |
q234740 | Request.setOption | train | public function setOption($option, $value = null)
{
if (is_array($option)) { // If it's an array, loop through each option and call this method recursively.
foreach ($option as $opt => $val) {
$this->setOption($opt, $val);
}
return;
}
if (... | php | {
"resource": ""
} |
q234741 | UserAccessPolicy.attachAccessPolicyEvents | train | protected function attachAccessPolicyEvents(Application $app)
{
// Orchestra Platform should be able to watch any changes to Role model
// and sync the information to "orchestra.acl".
Role::observe($app->make(RoleObserver::class));
// Orchestra Platform should be able to determine a... | php | {
"resource": ""
} |
q234742 | Curl.delete | train | public static function delete($urls, $data = null, callable $callback = null)
{
return static::make('delete', $urls, $data, $callback);
} | php | {
"resource": ""
} |
q234743 | Curl.get | train | public static function get($urls, $data = null, callable $callback = null)
{
return static::make('get', $urls, $data, $callback);
} | php | {
"resource": ""
} |
q234744 | Curl.post | train | public static function post($urls, $data = null, callable $callback = null)
{
return static::make('post', $urls, $data, $callback);
} | php | {
"resource": ""
} |
q234745 | Curl.put | train | public static function put($urls, $data = null, callable $callback = null)
{
return static::make('put', $urls, $data, $callback);
} | php | {
"resource": ""
} |
q234746 | Curl.make | train | protected static function make($verb, $urls, $data, callable $callback = null)
{
if (!is_array($urls)) {
$urls = [$urls => $data];
} elseif (!(bool)count(array_filter(array_keys($urls), 'is_string'))) {
foreach ($urls as $key => $url) {
$urls[$url] = null;
... | php | {
"resource": ""
} |
q234747 | Curl.makeRequest | train | protected function makeRequest(callable $callback = null)
{
// Foreach request:
foreach ($this->requests as $key => $request) {
$data = (isset($this->data[$key]) and $this->data[$key] !== null) ? $this->data[$key] : null;
// Follow any 3xx HTTP status code.
$requ... | php | {
"resource": ""
} |
q234748 | Curl.preparePostRequest | train | protected function preparePostRequest(RequestInterface $request, $data)
{
if ($data !== null) {
// Add the POST data to the request.
$request->setOption(CURLOPT_POST, true);
$request->setOption(CURLOPT_POSTFIELDS, $data);
} else {
$request->setOption(C... | php | {
"resource": ""
} |
q234749 | Curl.preparePutRequest | train | protected function preparePutRequest(RequestInterface $request, $data)
{
$request->setOption(CURLOPT_CUSTOMREQUEST, 'PUT');
if ($data !== null) {
$request->setOption(CURLOPT_POSTFIELDS, $data);
}
} | php | {
"resource": ""
} |
q234750 | Throttle.getUniqueLoginKey | train | protected function getUniqueLoginKey()
{
$key = $this->request->input($this->loginKey);
$ip = $this->request->ip();
return \mb_strtolower($key).$ip;
} | php | {
"resource": ""
} |
q234751 | Filesystem.upload | train | public function upload(string $name): bool
{
$app = $this->getContainer();
$config = $this->destination($name, $recursively);
try {
$basePath = "{$config->basePath}{$name}/";
$this->changePermission(
$config->workingPath, 0777, $config->recursively
... | php | {
"resource": ""
} |
q234752 | MenuHandler.prepare | train | public function prepare()
{
$id = $this->getAttribute('id');
$menus = $this->menu['with'] ?? [];
$parent = $this->getAttribute('position');
$position = Str::startsWith($parent, '^:') ? $parent.'.' : '^:';
foreach ((array) $menus as $class) {
$menu = $this->contai... | php | {
"resource": ""
} |
q234753 | MenuHandler.passesAuthorization | train | protected function passesAuthorization(): bool
{
$passes = false;
if (\method_exists($this, 'authorize')) {
$passes = $this->container->call([$this, 'authorize']);
}
return (bool) $passes;
} | php | {
"resource": ""
} |
q234754 | Dispatcher.buildStacks | train | protected function buildStacks()
{
$stacks = [];
$stackNo = 0;
$currSize = 0;
foreach ($this->requests as $request) {
if ($currSize === $this->stackSize) {
$currSize = 0;
$stackNo++;
}
$stacks[$stackNo][] = $req... | php | {
"resource": ""
} |
q234755 | Dispatcher.dispatch | train | protected function dispatch()
{
// Start processing the requests.
list($mrc, $active) = $this->process();
// Keep processing requests until we're done.
while ($active and $mrc === CURLM_OK) {
// Process the next request.
list($mrc, $active) = $this->process()... | php | {
"resource": ""
} |
q234756 | Dispatcher.process | train | protected function process()
{
// Workaround for PHP Bug #61141.
if (curl_multi_select($this->handle) === -1) {
usleep(100);
}
do {
$mrc = curl_multi_exec($this->handle, $active);
} while ($mrc === CURLM_CALL_MULTI_PERFORM);
return [$mrc, $ac... | php | {
"resource": ""
} |
q234757 | SiteCommerceController.addPage | train | public function addPage() {
$content = array();
foreach (\Drupal::entityTypeManager()->getStorage('site_commerce_type')->loadMultiple() as $type) {
$content[$type->id()] = $type;
}
if (!count($content)) {
return $this->redirect('entity.site_commerce_type.add_form');
}
if (count($c... | php | {
"resource": ""
} |
q234758 | SiteCommerceController.add | train | public function add(SiteCommerceTypeInterface $site_commerce_type) {
$site_commerce = $this->entityManager()->getStorage('site_commerce')->create(array(
'type' => $site_commerce_type->id(),
));
$form = $this->entityFormBuilder()->getForm($site_commerce);
return $form;
} | php | {
"resource": ""
} |
q234759 | Viewer.view | train | public function view(Listener $listener)
{
$data['extensions'] = $this->extension->detect();
return $listener->showExtensions($data);
} | php | {
"resource": ""
} |
q234760 | LoadExpresso.addBladeExtensions | train | protected function addBladeExtensions(Application $app)
{
$blade = $app->make('blade.compiler');
$blade->directive('decorator', function ($expression) {
return "<?php echo \app('orchestra.decorator')->render({$expression}); ?>";
});
$blade->directive('placeholder', func... | php | {
"resource": ""
} |
q234761 | LoadExpresso.addHtmlExtensions | train | protected function addHtmlExtensions(Application $app)
{
$html = $app->make('html');
$html->macro('title', function ($title = null) use ($html) {
$builder = new Title($html, \memorize('site.name'), [
'site' => \get_meta('html::title.format.site', '{site.name} (Page {page... | php | {
"resource": ""
} |
q234762 | Parser.parse | train | private function parse(array $data, NodePath $nodePath, $parentId = null)
{
$parentId = $this->validateParentId($parentId);
$csvFile = $this->createCsvFile($this->structure->getTypeFromNodePath($nodePath), $nodePath, $parentId);
$parentCols = array_fill_keys(array_keys($parentId), "string");... | php | {
"resource": ""
} |
q234763 | Parser.parseRow | train | private function parseRow(
\stdClass $dataRow,
NodePath $nodePath,
array $parentCols = [],
$outerObjectHash = null
) {
$csvRow = new CsvRow($this->getHeaders($nodePath, $parentCols));
// Generate parent ID for arrays
$arrayParentId = $this->getPrimaryKeyValue(... | php | {
"resource": ""
} |
q234764 | Parser.getHeaders | train | private function getHeaders(NodePath $nodePath, &$parent = false)
{
$headers = [];
$nodeData = $this->structure->getNode($nodePath);
if ($nodeData['nodeType'] == 'scalar') {
$headers[] = $nodeData['headerNames'];
}
if (is_array($parent) && !empty($parent)) {
... | php | {
"resource": ""
} |
q234765 | Parser.createCsvFile | train | private function createCsvFile($type, NodePath $nodePath, &$parentId)
{
if (empty($this->csvFiles[$type])) {
$this->csvFiles[$type] = Table::create(
$type,
$this->getHeaders($nodePath, $parentId),
$this->temp
);
$this->csvFi... | php | {
"resource": ""
} |
q234766 | Parser.validateParentId | train | private function validateParentId($parentId) : array
{
if (!empty($parentId)) {
if (is_array($parentId)) {
if (count($parentId) != count($parentId, COUNT_RECURSIVE)) {
throw new JsonParserException(
'Error assigning parentId to a CSV fi... | php | {
"resource": ""
} |
q234767 | Parser.getCsvFiles | train | public function getCsvFiles()
{
// parse what's in cache before returning results
while ($batch = $this->cache->getNext()) {
// root node is always array
$this->parse($batch["data"], new NodePath([$batch['type'], Structure::ARRAY_NAME]), $batch["parentId"]);
}
... | php | {
"resource": ""
} |
q234768 | CredentialController.login | train | public function login(Request $request, AuthenticateUser $authenticate, ThrottlesCommand $throttles)
{
$username = Authen::getIdentifierName();
$input = $request->only([$username, 'password', 'remember']);
$throttles->setRequest($request)->setLoginKey($username);
return $authentic... | php | {
"resource": ""
} |
q234769 | CredentialController.userLoginHasFailedAuthentication | train | public function userLoginHasFailedAuthentication(array $input)
{
$message = trans('orchestra/foundation::response.credential.invalid-combination');
return $this->redirectWithMessage($this->getRedirectToLoginPath(), $message, 'error')->withInput();
} | php | {
"resource": ""
} |
q234770 | Account.profile | train | public function profile($model, $url)
{
return $this->form->of('orchestra.account', function (FormGrid $form) use ($model, $url) {
$form->setup($this, $url, $model);
$form->hidden('id');
$form->fieldset(function (Fieldset $fieldset) {
$fieldset->control('... | php | {
"resource": ""
} |
q234771 | ActivateController.activationHasSucceed | train | public function activationHasSucceed(Fluent $extension)
{
$this->dispatch(new RefreshRouteCache());
$message = trans('orchestra/foundation::response.extensions.activate', $extension->getAttributes());
return $this->redirectWithMessage(handles('orchestra::extensions'), $message);
} | php | {
"resource": ""
} |
q234772 | Application.markAsRegistered | train | protected function markAsRegistered($provider)
{
$this['events']->dispatch(\get_class($provider), [$provider]);
parent::markAsRegistered($provider);
} | php | {
"resource": ""
} |
q234773 | ConfigureController.configure | train | public function configure(Processor $processor, $vendor, $package = null)
{
$extension = $this->getExtension($vendor, $package);
return $processor->configure($this, $extension);
} | php | {
"resource": ""
} |
q234774 | ConfigureController.update | train | public function update(Processor $processor, $vendor, $package = null)
{
$extension = $this->getExtension($vendor, $package);
return $processor->update($this, $extension, Input::all());
} | php | {
"resource": ""
} |
q234775 | ConfigureController.showConfigurationChanger | train | public function showConfigurationChanger(array $data)
{
$name = $data['extension']->name;
set_meta('title', Foundation::memory()->get("extensions.available.{$name}.name", $name));
set_meta('description', trans('orchestra/foundation::title.extensions.configure'));
return view('orche... | php | {
"resource": ""
} |
q234776 | FilterLoader.load | train | public function load(string $helper)
{
if (isset($this->filters[$helper])) {
return call_user_func_array($this->filters[$helper], array_slice(func_get_args(), 1));
}
} | php | {
"resource": ""
} |
q234777 | Collector.collect | train | public function collect()
{
$self = $this;
$fileSystem = new FileSystem();
$environment = $this->environment;
$this->testTargetRepository->walkOnResources(function ($resource, $index, TestTargetRepository $testTargetRepository) use ($self, $fileSystem, $environment) {
$ab... | php | {
"resource": ""
} |
q234778 | AbstractPopulator.getRecord | train | protected function getRecord($tableName, $where = null)
{
$record = $this->database->table($tableName)->order('RAND()');
return $where ?
$record->where($where)->limit(1)->fetch() :
$record->limit(1)->fetch();
} | php | {
"resource": ""
} |
q234779 | AbstractPopulator.getId | train | protected function getId($tableName, $where = null)
{
$record = $this->getRecord($tableName, $where);
return $record ? $record->id : null;
} | php | {
"resource": ""
} |
q234780 | Vue.scaffold | train | public function scaffold()
{
$this->updateDependencies([
"vue" => "^2.4.3",
]);
$this->updateDevDependencies([
"vue-loader" => "^13.3.0",
"vue-template-compiler" => "^2.5.2",
]);
$this->updateJavascript($this->name);
$this->updateAs... | php | {
"resource": ""
} |
q234781 | PhinxRegistrator.buildConfig | train | private function buildConfig()
{
$env = getenv('CRM_ENV');
$configData = [
'paths' => [
'migrations' => [
'%%PHINX_CONFIG_DIR%%/../../../../migrations'
]
],
'environments' => [
'default_migration... | php | {
"resource": ""
} |
q234782 | FilesCloner.clone | train | public function clone($destination)
{
$fs = new Filesystem;
if (! $fs->exists($destination)) {
$fs->mkdir($destination, 0755);
}
$fs->mirror($this->source, $destination, null, $this->options);
} | php | {
"resource": ""
} |
q234783 | FilesCloner.copy | train | public function copy($file)
{
$fs = new Filesystem;
if (! $fs->exists(dirname($file))) {
$fs->mkdir(dirname($file), 0755);
}
$fs->copy($this->source, $file, true);
} | php | {
"resource": ""
} |
q234784 | PHPUnitRunner.run | train | public function run($suite)
{
$printer = $this->createPrinter();
$testResult = new \PHPUnit_Framework_TestResult();
$testRunner = new TestRunner();
$testRunner->setTestResult($testResult);
$testRunner->doRun($suite, $this->createArguments($printer, $testResult), false);
... | php | {
"resource": ""
} |
q234785 | EventsStorage.getFiltered | train | private function getFiltered(bool $public = true): array
{
$result = [];
foreach ($this->events as $event) {
if ($event['is_public'] === $public) {
$result[] = $event;
}
}
return $result;
} | php | {
"resource": ""
} |
q234786 | Schema.quoteValue | train | public function quoteValue($str)
{
if (is_int($str) || is_float($str)) {
return $str;
}
return "'" . addcslashes(str_replace("'", "''", $str), "\000\n\r\\\032") . "'";
} | php | {
"resource": ""
} |
q234787 | FrontendPresenter.utmParams | train | public function utmParams() : array
{
return array_filter([
'utm_source' => $this->utmSession->utmSource,
'utm_medium' => $this->utmSession->utmMedium,
'utm_campaign' => $this->utmSession->utmCampaign,
'utm_content' => $this->utmSession->utmContent,
])... | php | {
"resource": ""
} |
q234788 | FrontendPresenter.buildTrackingParamsSession | train | protected function buildTrackingParamsSession()
{
$this->utmSession = $this->getSession('utm_session');
$this->utmSession->setExpiration('30 minutes');
if ($this->getParameter('utm_source')) {
$this->utmSession->utmSource = $this->getParameter('utm_source');
}
if... | php | {
"resource": ""
} |
q234789 | AuditHookMFA.onMethodVerificationSuccess | train | public function onMethodVerificationSuccess(Member $member, $method)
{
$this->getAuditLogger()->info(
sprintf(
'"%s" (ID: %s) successfully verified using MFA method',
$member->Email ?: $member->Title,
$member->ID
),
['method... | php | {
"resource": ""
} |
q234790 | AuditHookMFA.onMethodVerificationFailure | train | public function onMethodVerificationFailure(Member $member, $method)
{
$context = [
'method' => get_class($method),
];
if ($lockOutAfterCount = $member->config()->get('lock_out_after_incorrect_logins')) {
// Add information about how many attempts have been made
... | php | {
"resource": ""
} |
q234791 | AuditHookMFA.onSkipRegistration | train | public function onSkipRegistration(Member $member)
{
$this->getAuditLogger()->info(sprintf(
'"%s" (ID: %s) skipped MFA registration',
$member->Email ?: $member->Title,
$member->ID
));
} | php | {
"resource": ""
} |
q234792 | WeekScale.getDatabaseSeriesData | train | public function getDatabaseSeriesData(Criteria $criteria)
{
$dbData = [];
$res = $this->database->query("SELECT {$criteria->getValueField()} AS value,
calendar.week AS week,
calendar.month AS month,
calendar.year AS year,
{$this->getSeries($criteria->getSeries())}
{$criteria->getTableName()}.id
FRO... | php | {
"resource": ""
} |
q234793 | ConfigAdder.add | train | public function add(array $assets)
{
if (! file_exists($this->file)) {
throw new RuntimeException("Could not add assets, `app.json` file do not exists.");
}
$packages = json_decode(file_get_contents($this->file), true);
$packages['assets'] = $assets + $packages['assets'... | php | {
"resource": ""
} |
q234794 | CassandraConnection.insert | train | public function insert($query, $bindings = [])
{
try {
$this->statement($query, $bindings);
return true;
} catch (\Exception $e) {
throw new InternalServerErrorException('Insert failed. ' . $e->getMessage());
}
} | php | {
"resource": ""
} |
q234795 | CLI.run | train | public function run(
Renamer $renamer,
Scaffolder $scaffolder
) {
$this->drawBanner();
$child = $this->askForChildConfirmation();
$replacements = $this->askForReplacements($child);
if (! $child) {
$preset = $this->askForPreset();
}
if ($... | php | {
"resource": ""
} |
q234796 | CLI.askForReplacements | train | public function askForReplacements($child)
{
$replacements = [];
if ($child) {
$this->placeholders = array_merge($this->placeholders, $this->childPlaceholders);
}
foreach ($this->placeholders as $placeholder => $data) {
$input = $this->climate->input($data['... | php | {
"resource": ""
} |
q234797 | CLI.askForPreset | train | public function askForPreset()
{
$input = $this->climate->input('<comment>Choose the front-end scaffolding</comment>');
$input->accept($this->presets, true);
return strtolower($input->prompt());
} | php | {
"resource": ""
} |
q234798 | Foundation.scaffold | train | public function scaffold()
{
$this->updateDependencies([
'foundation-sites' => '^6.4.1',
'what-input' => '^4.1.3',
'motion-ui' => '^1.2.2',
]);
$this->updateConfig([
'foundation' => [
'./resources/assets/js/foundation.js',
... | php | {
"resource": ""
} |
q234799 | eZPlatformSearch.removeObjectById | train | public function removeObjectById( $contentObjectId, $commit = null )
{
if ( !isset( $commit ) && ( $this->iniConfig->variable( 'IndexOptions', 'DisableDeleteCommits' ) === 'true' ) )
{
$commit = false;
}
elseif ( !isset( $commit ) )
{
$commit = true;
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.