_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q11000
ChatCommands.addCommand
train
protected function addCommand($pluginId, $cmdTxt, ChatCommandInterface $command) { if (isset($this->commands[$cmdTxt])) { throw new CommandExistException( "$pluginId tries to register command '$cmdTxt' already registered"
php
{ "resource": "" }
q11001
CakeThemeAppHelper._getOptionsForElem
train
protected function _getOptionsForElem($path = null) { if (empty($path)) { return null; }
php
{ "resource": "" }
q11002
Menu.displayMenu
train
protected function displayMenu() { foreach ($this->adminGroups->getUserGroups() as
php
{ "resource": "" }
q11003
BreadCrumbBehavior.getModelName
train
public function getModelName(Model $model, $toLowerCase = false) { $modelName = $model->name; if ($toLowerCase) {
php
{ "resource": "" }
q11004
BreadCrumbBehavior.getModelNamePlural
train
public function getModelNamePlural(Model $model, $toLowerCase = false) { $modelName
php
{ "resource": "" }
q11005
BreadCrumbBehavior.getControllerName
train
public function getControllerName(Model $model) { $modelNamePlural = $this->getModelNamePlural($model, false); $controllerName
php
{ "resource": "" }
q11006
BreadCrumbBehavior.getGroupName
train
public function getGroupName(Model $model) { $modelNamePlural = $this->getModelNamePlural($model); $groupNameCamel = Inflector::humanize(Inflector::underscore($modelNamePlural));
php
{ "resource": "" }
q11007
BreadCrumbBehavior.getName
train
public function getName(Model $model, $id = null) { if (empty($id) || empty($model->displayField)) { return false; } if (is_array($id)) { if (!isset($id[$model->alias][$model->displayField])) {
php
{ "resource": "" }
q11008
BreadCrumbBehavior.getFullName
train
public function getFullName(Model $model, $id = null) { $name = $this->getName($model, $id); if (empty($name)) { return false; }
php
{ "resource": "" }
q11009
BreadCrumbBehavior.createBreadcrumb
train
public function createBreadcrumb(Model $model, $id = null, $link = null, $escape = true) { $result = []; if (empty($id)) { $name = $model->getGroupName(); } else { $name = $model->getName($id); } if (empty($name)) { return $result; } if ($escape) { $name = h($name); } if ($link === false) { $link = null; } else { if (!is_array($link)) { $link = []; } $plugin = $model->getPluginName(); $controller = $model->getControllerName();
php
{ "resource": "" }
q11010
BreadCrumbBehavior.getBreadcrumbInfo
train
public function getBreadcrumbInfo(Model $model, $id = null, $includeRoot = null) { if (!empty($id) && ($includeRoot === null)) { $includeRoot = true; } $result = []; $root = []; if ($includeRoot) {
php
{ "resource": "" }
q11011
Result.detectFetchType
train
public final function detectFetchType($fetchType): int { switch (gettype($fetchType)) { case 'NULL': return ResultInterface::AS_OBJECT; case 'integer': if (in_array($fetchType, [ResultInterface::AS_OBJECT, ResultInterface::AS_ARRAY_ASC, ResultInterface::AS_ARRAY_NUM, ResultInterface::AS_ARRAY_ASCNUM])) { return $fetchType; } break; case 'string': // shorthands if ($fetchType == 'array') return ResultInterface::AS_ARRAY_ASC; if ($fetchType == 'object') return ResultInterface::AS_OBJECT; // object, array_asc etc.
php
{ "resource": "" }
q11012
Result.setFetchObject
train
public final function setFetchObject(string $fetchObject): void { if (!class_exists($fetchObject)) { throw new InvalidValueException("Fetch object class
php
{ "resource": "" }
q11013
Result.setIds
train
public final function setIds(array $ids): void { foreach ($ids as $id) {
php
{ "resource": "" }
q11014
Result.toObject
train
public final function toObject(): ?array { $data = null; if (!empty($this->data)) { // no need to type-cast if (is_object($this->data[0])) { return $this->data; }
php
{ "resource": "" }
q11015
Result.toClass
train
public final function toClass(string $class): ?array { $data = null; if (!empty($this->data)) { $data = $this->data; foreach ($data as &$dat) {
php
{ "resource": "" }
q11016
Arrays.copyIfKeysExist
train
public static function copyIfKeysExist(array $source, array &$dest, array $keyMap) { $callable = function (array $source, $key) { return array_key_exists($key,
php
{ "resource": "" }
q11017
Arrays.copyIfSet
train
public static function copyIfSet(array $source, array &$dest, array $keyMap) { $callable = function (array $source, $key) { return
php
{ "resource": "" }
q11018
Arrays.project
train
public static function project(array $input, $key, bool $strictKeyCheck = true) : array { $projection = []; foreach ($input as $itemKey => $item) { self::ensureIsArray($item, 'a value in $input was not an array'); if (array_key_exists($key, $item)) {
php
{ "resource": "" }
q11019
Arrays.embedInto
train
public static function embedInto( array $items, string $fieldName, array $destination = [], bool $overwrite = false ) : array { foreach ($items as $key => $item) { if (!array_key_exists($key, $destination)) { $destination[$key] = [$fieldName => $item];
php
{ "resource": "" }
q11020
Arrays.extract
train
public static function extract( array $input, $keyIndex, $valueIndex, string $duplicateBehavior = 'takeLast' ) : array { if (!in_array($duplicateBehavior, ['takeFirst', 'takeLast', 'throw'])) { throw new \InvalidArgumentException("\$duplicateBehavior was not 'takeFirst', 'takeLast', or 'throw'"); } self::ensureValidKey($keyIndex, '$keyIndex was not a string or integer'); self::ensureValidKey($valueIndex, '$valueIndex was not a string or integer'); $result = []; foreach ($input as $index => $array) {
php
{ "resource": "" }
q11021
Arrays.changeKeyCase
train
public static function changeKeyCase(array $input, int $case = self::CASE_LOWER) : array { if ($case & self::CASE_UNDERSCORE) { $input = self::underscoreKeys($input); } if ($case & self::CASE_CAMEL_CAPS) { $input = self::camelCaseKeys($input); } if ($case
php
{ "resource": "" }
q11022
Arrays.flatten
train
final public static function flatten(array $input, string $delimiter = '.') : array { $args = func_get_args(); $prefix = count($args) === 3 ? array_pop($args) : ''; $result = []; foreach ($input as $key => $value) { $newKey = $prefix . (empty($prefix) ? '' : $delimiter) . $key;
php
{ "resource": "" }
q11023
Process.restart
train
public function restart(callable $callback = null) { if ($this->isRunning()) { throw new RuntimeException('Process is already running'); }
php
{ "resource": "" }
q11024
Process.getExitCode
train
public function getExitCode() { if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use
php
{ "resource": "" }
q11025
Process.hasBeenSignaled
train
public function hasBeenSignaled() { $this->requireProcessIsTerminated(__FUNCTION__); if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { throw new RuntimeException('This PHP has
php
{ "resource": "" }
q11026
Process.addOutput
train
public function addOutput($line) { $this->lastOutputTime = microtime(true); fseek($this->stdout, 0, SEEK_END);
php
{ "resource": "" }
q11027
Process.addErrorOutput
train
public function addErrorOutput($line) { $this->lastOutputTime = microtime(true);
php
{ "resource": "" }
q11028
Process.readPipesForOutput
train
private function readPipesForOutput($caller, $blocking = false) { if ($this->outputDisabled) { throw new LogicException('Output has been disabled.');
php
{ "resource": "" }
q11029
Attendee.getBetterButtonsActions
train
public function getBetterButtonsActions() { /** @var FieldList $fields */ $fields = parent::getBetterButtonsActions(); if ($this->TicketFile()->exists() && !empty($this->getEmail())) { $fields->push(BetterButtonCustomAction::create('sendTicket', _t('Attendee.SEND', 'Send the ticket'))); }
php
{ "resource": "" }
q11030
Attendee.onBeforeWrite
train
public function onBeforeWrite() { // Set the title of the attendee $this->Title = $this->getName(); // Generate the ticket code if ($this->exists() && empty($this->TicketCode)) { $this->TicketCode = $this->generateTicketCode(); } if ( $this->getEmail() && $this->getName() && !$this->TicketFile()->exists() && !$this->TicketQRCode()->exists() ) { $this->createQRCode(); $this->createTicketFile(); } if ($fields = $this->Fields()) {
php
{ "resource": "" }
q11031
Attendee.onBeforeDelete
train
public function onBeforeDelete() { // If an attendee is deleted from the guest list remove it's qr code // after deleting the code it's not validatable anymore, simply here for cleanup if ($this->TicketQRCode()->exists()) { $this->TicketQRCode()->delete(); } // cleanup the ticket
php
{ "resource": "" }
q11032
Attendee.getName
train
public function getName() { $mainContact = $this->Reservation()->MainContact(); if ($this->getSurname()) { return trim("{$this->getFirstName()} {$this->getSurname()}"); } elseif ($mainContact->exists() && $mainContact->getSurname()) {
php
{ "resource": "" }
q11033
Attendee.getTableFields
train
public function getTableFields() { $fields = new ArrayList(); foreach (self::config()->get('table_fields') as $field) { $data = new ViewableData(); $data->Header = _t("Attendee.$field", $field);
php
{ "resource": "" }
q11034
Attendee.createQRCode
train
public function createQRCode() { $folder = $this->fileFolder(); $relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.png"; $absoluteFilePath = Director::baseFolder() . $relativeFilePath; if (!$image = Image::get()->find('Filename', $relativeFilePath)) { // Generate the QR code $renderer = new BaconQrCode\Renderer\Image\Png(); $renderer->setHeight(256); $renderer->setWidth(256); $writer = new BaconQrCode\Writer($renderer);
php
{ "resource": "" }
q11035
Attendee.createTicketFile
train
public function createTicketFile() { // Find or make a folder $folder = $this->fileFolder(); $relativeFilePath = "/{$folder->Filename}{$this->TicketCode}.pdf"; $absoluteFilePath = Director::baseFolder() . $relativeFilePath; if (!$this->TicketQRCode()->exists()) { $this->createQRCode(); } if (!$file = File::get()->find('Filename', $relativeFilePath)) { $file = File::create(); $file->ParentID = $folder->ID; $file->OwnerID = (Member::currentUser()) ? Member::currentUser()->ID : 0; $file->Title = $this->TicketCode; $file->setFilename($relativeFilePath); $file->write(); } // Set the template and parse the data
php
{ "resource": "" }
q11036
Attendee.sendTicket
train
public function sendTicket() { // Get the mail sender or fallback to the admin email if (empty($from = Reservation::config()->get('mail_sender'))) { $from = Config::inst()->get('Email', 'admin_email'); } $email = new Email(); $email->setSubject(_t( 'AttendeeMail.TITLE', 'Your ticket for {event}', null, array( 'event' =>
php
{ "resource": "" }
q11037
AbstractScriptMethod.get
train
public function get($function) { $this->toDispatch[] = $function; if (is_null($this->dataProvider)) { $this->currentData = null; $this->dispatchData();
php
{ "resource": "" }
q11038
AbstractScriptMethod.dispatchData
train
protected function dispatchData() { foreach ($this->toDispatch as $callback) { $callback($this->currentData);
php
{ "resource": "" }
q11039
RemoveController.removeAction
train
public function removeAction(Request $request, $userClass) { $form = $this->get('form.factory')->createNamedBuilder('', RemoveType::class, null, [ 'csrf_protection' => false, ])->getForm(); $form->handleRequest($request); if ($form->isValid()) { try { $this->get('bengor_user.' . $userClass . '.api_command_bus')->handle( $form->getData() ); return new JsonResponse(); }
php
{ "resource": "" }
q11040
AbstractBinary.run
train
protected function run(Process $process, $bypassErrors = false, $listeners = null) { if (null !== $listeners) { if (!is_array($listeners)) { $listeners = array($listeners); } $listenersManager = clone $this->listenersManager; foreach ($listeners as $listener) {
php
{ "resource": "" }
q11041
Throwable.parseThrowableMessage
train
public static function parseThrowableMessage($ex) { $message = $ex['message']; if ($ex['isError'] && strpos($message, ' in ') !== false) { $message = preg_replace('#([a-zA-Z0-9-_]+?)/#siU', '', $message); $message = preg_replace('#/#si', '', $message,
php
{ "resource": "" }
q11042
Throwable.getThrowableStack
train
public static function getThrowableStack($ex, &$data = [], $offset = 0) { $data = static::getThrowableData($ex, $offset);
php
{ "resource": "" }
q11043
Throwable.getThrowableData
train
public static function getThrowableData($ex, $offset = 0) { return [ 'message' => $ex->getMessage(), 'class' => get_class($ex), 'file'
php
{ "resource": "" }
q11044
Html.stripTags
train
public static function stripTags($html, $allowable = []) { if (!is_array($allowable)) { $allowable = preg_split("/, */", $allowable, -1, PREG_SPLIT_NO_EMPTY); } if ($allowable) {
php
{ "resource": "" }
q11045
Create.handle
train
public function handle() { /** @var string $path path to the env file */ $path = $this->getFilePath(); if (!file_exists($path)) { file_put_contents($path, ""); } /** @var string $content current content in the env file */ $content = file_get_contents($path); foreach ($this->generateKeys() as $key) { /** try and match the value in the env file by regex, if not * found then append the key to the bottom of the * file
php
{ "resource": "" }
q11046
Create.generateKeys
train
private function generateKeys() { $content = []; for ($i = 0; $i < count($this->keys); $i++) { $holder = []; $value = !$this->option($this->keys[$i]) || $this->option($this->keys[$i]) === 'generate' ? str_random(64) : $this->option($this->keys[$i]);
php
{ "resource": "" }
q11047
Php53Adapter.setSaveHandler
train
public static function setSaveHandler(\SessionHandlerInterface $handler) { return session_set_save_handler( array($handler, 'open'), array($handler, 'close'), array($handler, 'read'),
php
{ "resource": "" }
q11048
Consumer.parsePayload
train
protected function parsePayload($payload) { $database = 0; $client = null; $pregCallback = function ($matches) use (&$database, &$client) { if (2 === $count = \count($matches)) { // Redis <= 2.4 $database = (int) $matches[1]; } if (4 === $count) { // Redis >= 2.6 $database = (int) $matches[2]; $client = $matches[3]; } return ' '; };
php
{ "resource": "" }
q11049
RouteGroup.addRoute
train
public function addRoute(array $methods, string $path, string $handler) { $this->routeCollector->addRoute( $methods,
php
{ "resource": "" }
q11050
ContainerFactory.createContainer
train
public function createContainer() { # Create the container $container = new Container; # If we have auto-wire option on ... if (($this->options['autowire'] ?? false)) { # Add reflection delegate, so auto-wiring is possible
php
{ "resource": "" }
q11051
Transformation.apply
train
public function apply(EntityInterface $entity, SpecificationInterface $specification) { $attribute_name = $specification->getOption('attribute', $specification->getName());
php
{ "resource": "" }
q11052
RecordQueryBuilder.getMapRecords
train
public function getMapRecords($mapUid, $nbLaps, $sort, $nbRecords) { $query = new RecordQuery(); $query->filterByMapuid($mapUid); $query->filterByNblaps($nbLaps);
php
{ "resource": "" }
q11053
RecordQueryBuilder.getPlayerMapRecords
train
public function getPlayerMapRecords($mapUid, $nbLaps, $logins) { $query = new RecordQuery(); $query->filterByMapuid($mapUid); $query->filterByNblaps($nbLaps); $query->filterByPlayerLogins($logins);
php
{ "resource": "" }
q11054
SocketHandler.closeSocket
train
public function closeSocket() { if (is_resource($this->resource)) {
php
{ "resource": "" }
q11055
Document.handleErrors
train
public function handleErrors($msg_prefix = '', $msg_suffix = '', $user_error_handling = false) { if (libxml_get_last_error() !== false) { $errors = libxml_get_errors(); libxml_clear_errors(); libxml_use_internal_errors($user_error_handling); throw new DOMException(
php
{ "resource": "" }
q11056
Document.getErrorMessage
train
protected function getErrorMessage(array $errors) { $error_message = ''; foreach ($errors as $error) { $error_message .=
php
{ "resource": "" }
q11057
Document.parseError
train
protected function parseError(LibXMLError $error) { $prefix_map = [ LIBXML_ERR_WARNING => '[warning]', LIBXML_ERR_FATAL => '[fatal]', LIBXML_ERR_ERROR => '[error]' ]; $prefix = isset($prefix_map[$error->level]) ? $prefix_map[$error->level] : $prefix_map[LIBXML_ERR_ERROR]; $msg_parts = []; $msg_parts[] = sprintf('%s %s: %s', $prefix, $error->level, trim($error->message));
php
{ "resource": "" }
q11058
TokenUtils.positionForSequence
train
public static function positionForSequence(array $sequence, $tokens, $startFrom = null) { $seqIterator = (new ArrayObject($sequence))->getIterator(); $tokenIterator = (new ArrayObject($tokens))->getIterator(); if ($startFrom != null) { $tokenIterator->seek($startFrom); } while ($tokenIterator->valid()) { $seqIterator->rewind(); $keys = array(); list($allowedTokens, $timesAllowed) = $seqIterator->current(); self::seekToNextType($tokenIterator, $allowedTokens); while ($tokenIterator->valid()) { if (!$seqIterator->valid()) { $first = array_shift($keys); $last = array_pop($keys); return array($first, $last); } list($allowedTokens, $timesAllowed) = $seqIterator->current(); if ($timesAllowed == '*') { while ($tokenIterator->valid() && self::isTokenType($tokenIterator->current(),
php
{ "resource": "" }
q11059
TokenUtils.seekToNextType
train
private static function seekToNextType(ArrayIterator $tokenIterator, $type) { while ($tokenIterator->valid()) { if (self::isTokenType($tokenIterator->current(), $type)) {
php
{ "resource": "" }
q11060
TokenUtils.isTokenType
train
public static function isTokenType($token, $types) { if (!is_array($types)) { $types = array($types);
php
{ "resource": "" }
q11061
Locales.addLocale
train
public function addLocale($locale) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale); if (!isset($this->available[$locale])) {
php
{ "resource": "" }
q11062
Locales.findByCountry
train
public function findByCountry($country) { $country = Text::toUpper($country); foreach ($this->getAvailable() as $locale) { if ($country ==
php
{ "resource": "" }
q11063
Locales.findByLanguage
train
public function findByLanguage($language) { $language = Text::toLower($language); foreach ($this->getAvailable() as $locale) { if ($language ==
php
{ "resource": "" }
q11064
Locales.findByLocale
train
public function findByLocale($locale) { // Get sanitized locale $locale = Locale::sanitizeLocale($locale);
php
{ "resource": "" }
q11065
Locales.setActive
train
public function setActive($locale) { $active = $this->findByLocale($locale); if (!$active) { throw new Exception(sprintf("Locale '%s' not in list.", $locale)); } // Mark as current locale
php
{ "resource": "" }
q11066
Login.CreateNewUser
train
protected function CreateNewUser() { if (!$this->_login->getCanRegister()) { $this->FormLogin(); return; } $myWords = $this->WordCollection(); $this->defaultXmlnukeDocument->setPageTitle($myWords->Value("CREATEUSERTITLE")); $this->_login->setAction(ModuleActionLogin::NEWUSER); $this->_login->setNextAction(ModuleActionLogin::NEWUSERCONFIRM);
php
{ "resource": "" }
q11067
Login.CreateNewUserConfirm
train
protected function CreateNewUserConfirm() { if (!$this->_login->getCanRegister()) { $this->FormLogin(); return; } $myWords = $this->WordCollection(); $container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert); $container->setAutoHide(5000); $this->_blockCenter->addXmlnukeObject($container); if (($this->_login->getName() == "") || ($this->_login->getEmail() == "") || ($this->_login->getUsername() == "") || !Util::isValidEmail($this->_login->getEmail())) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("INCOMPLETEDATA"), true)); $this->CreateNewUser(); } elseif (!XmlInputImageValidate::validateText($this->_context)) { $container->addXmlnukeObject(new XmlnukeText($myWords->Value("OBJECTIMAGEINVALID"), true)); $this->CreateNewUser(); } else { $newpassword = $this->getRandomPassword();
php
{ "resource": "" }
q11068
Login.getRandomPassword
train
public function getRandomPassword() { //Random rand = new Random(); //int type, number; $password = ""; for($i=0; $i<7; $i++) { $type = rand(0,21) % 3; $number = rand(0,25); if ($type == 1) { $password = $password . chr(48 + ($number%10)); } else {
php
{ "resource": "" }
q11069
ListAbstract.input
train
public function input($name, $value = '', $id = '', $class = '', array $attrs = array()) { return '<input id="' . $id . '" class="' . $class . '" type="' . $this->_type . '" name="' . $name .
php
{ "resource": "" }
q11070
ListAbstract.label
train
public function label($id, $valAlias, $content = '') { $class = implode(' ', array( $this->_jbSrt($this->_type . '-lbl'),
php
{ "resource": "" }
q11071
ListAbstract._checkedOptions
train
protected function _checkedOptions($value, $selected, array $attrs) { $attrs['checked'] = false; if (is_array($selected)) { foreach ($selected as $val) { if ($value == $val) { $attrs['checked'] = 'checked'; break; }
php
{ "resource": "" }
q11072
ListAbstract._elementTpl
train
protected function _elementTpl($name, $value = '', $id = '', $text = '', array $attrs = array()) { $alias = Str::slug($value, true); $inpClass = $this->_jbSrt('val-' . $alias); $input = $this->input($name, $value, $id, $inpClass, $attrs); if ($this->_tpl === 'default') { return $input . $this->label($id, $alias, $text);
php
{ "resource": "" }
q11073
ListAbstract._setTpl
train
protected function _setTpl($tpl) { $this->_tpl = $tpl; if ($tpl === true) {
php
{ "resource": "" }
q11074
BaseRokkaCliCommand.verifyStackExists
train
public function verifyStackExists($stackName, $organization, OutputInterface $output, Image $client = null) { if (!$client) { $client = $this->clientProvider->getImageClient($organization); } if (!$stackName || !$this->rokkaHelper->stackExists($client, $stackName, $organization)) {
php
{ "resource": "" }
q11075
BaseRokkaCliCommand.resolveOrganizationName
train
public function resolveOrganizationName($organizationName, OutputInterface $output) { if (!$organizationName) { $organizationName = $this->rokkaHelper->getDefaultOrganizationName(); } if (!$this->rokkaHelper->validateOrganizationName($organizationName)) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The organization name "'.$organizationName.'" is not valid!', ], 'error', true)); return false; }
php
{ "resource": "" }
q11076
BaseRokkaCliCommand.verifySourceImageExists
train
public function verifySourceImageExists($hash, $organizationName, OutputInterface $output, Image $client) { if (!$this->rokkaHelper->validateImageHash($hash)) { $output->writeln($this->formatterHelper->formatBlock([ 'Error!', 'The Image HASH "'.$hash.'" is not valid!', ], 'error', true)); return false; } if ($this->rokkaHelper->imageExists($client, $hash, $organizationName)) { return true;
php
{ "resource": "" }
q11077
HandlerBuilder.build
train
public function build(FormFactoryInterface $form_factory, $data = null) { $options = is_callable($this->options) ? call_user_func($this->options, $data) : $this->options; if (null !== $this->name) { $form = $form_factory->createNamed($this->name, $this->type, $data, $options); } else {
php
{ "resource": "" }
q11078
FilterComponent.getFilterConditions
train
public function getFilterConditions($plugin = null) { $filterData = null; $filterCond = null; if ($this->_controller->request->is('get')) { $filterData = $this->_controller->request->query('data.FilterData'); $filterCond = $this->_controller->request->query('data.FilterCond');
php
{ "resource": "" }
q11079
FilterComponent.getGroupAction
train
public function getGroupAction($groupActions = null) { if (!$this->_controller->request->is('post')) { return false; } $action = $this->_controller->request->data('FilterGroup.action'); if (empty($action) || (!empty($groupActions) && !is_array($groupActions))) { return false; }
php
{ "resource": "" }
q11080
FilterComponent.getExtendPaginationOptions
train
public function getExtendPaginationOptions($options = null) { if (empty($options) || !is_array($options)) { $options = []; } if (!property_exists($this->_controller, 'Paginator')) { throw new InternalErrorException(__d('view_extension', 'Paginator component is not loaded')); } $paginatorOptions = $this->_controller->Paginator->mergeOptions(null); $page = (int)Hash::get($paginatorOptions,
php
{ "resource": "" }
q11081
Window.setBusy
train
public function setBusy($bool = true) { $this->busyCounter = 0; $this->isBusy = (bool)$bool; if ($bool) { $text = "Please wait..."; if (is_string($bool)) { $text = (string)$bool; } $lbl = Label::create(); $lbl->setText($text)->setTextColor("fff")->setTextSize(6) ->setSize(90, 12)->setAlign("center", "center") ->setPosition($this->busyFrame->getWidth() / 2, -($this->busyFrame->getHeight() / 2)); $this->busyFrame->addChild($lbl); $quad = Quad::create();
php
{ "resource": "" }
q11082
ManiaScriptFactory.createScript
train
public function createScript($params) { $className = $this->className;
php
{ "resource": "" }
q11083
ProductIndexListener.onProductIndex
train
public function onProductIndex(ResourceControllerEvent $event): void { $currentRequest = $this->requestStack->getCurrentRequest(); if (!$currentRequest instanceof Request) { return; } // Only sane way to extract the reference to the taxon if (!$currentRequest->attributes->has('slug')) { return; } $taxon = $this->taxonRepository->findOneBySlug( $currentRequest->attributes->get('slug'), $this->localeContext->getLocaleCode() ); if (!$taxon instanceof TaxonInterface) { return;
php
{ "resource": "" }
q11084
GameCurrencyQueryBuilder.save
train
public function save(Gamecurrency $gamecurrency) { // First clear references. entry has no references that needs saving. $gamecurrency->clearAllReferences(false);
php
{ "resource": "" }
q11085
PlayerDataProvider.onPlayerHit
train
public function onPlayerHit($params) { $this->dispatch(__FUNCTION__, [ $params['shooter'], $params['victim'], $params['weapon'], $params['damage'], $params['points'],
php
{ "resource": "" }
q11086
PlayerDataProvider.onArmorEmpty
train
public function onArmorEmpty($params) { $this->dispatch(__FUNCTION__, [ $params['shooter'], $params['victim'], $params['weapon'], $params['distance'],
php
{ "resource": "" }
q11087
TicketPayment.onAuthorized
train
public function onAuthorized(ServiceResponse $response) { if ($response->getPayment()->Gateway === 'Manual') {
php
{ "resource": "" }
q11088
TicketPayment.onCaptured
train
public function onCaptured(ServiceResponse $response) { /** @var Reservation $reservation */
php
{ "resource": "" }
q11089
Html._
train
public static function _($render, $ns = __NAMESPACE__) { $html = self::getInstance(); $render = Str::low($render); $alias = $ns . '\\' . $render; if (!isset($html[$alias])) {
php
{ "resource": "" }
q11090
Html._register
train
private static function _register($render, $ns) { return function () use ($render, $ns) { $render = Str::clean($render); $render = implode('\\', array( $ns,
php
{ "resource": "" }
q11091
SignUpUserCommandBuilder.invitationHandlerArguments
train
private function invitationHandlerArguments($user) { return [ $this->container->getDefinition( 'bengor.user.infrastructure.persistence.' . $user . '_repository' ), $this->container->getDefinition(
php
{ "resource": "" }
q11092
SignUpUserCommandBuilder.withConfirmationSpecification
train
private function withConfirmationSpecification($user) { (new EnableUserCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => WithConfirmationSignUpUserCommand::class,
php
{ "resource": "" }
q11093
SignUpUserCommandBuilder.byInvitationSpecification
train
private function byInvitationSpecification($user) { (new InviteUserCommandBuilder($this->container, $this->persistence))->build($user); (new ResendInvitationUserCommandBuilder($this->container, $this->persistence))->build($user); return [ 'command' => ByInvitationSignUpUserCommand::class,
php
{ "resource": "" }
q11094
Logger.pushProcessor
train
public function pushProcessor($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an
php
{ "resource": "" }
q11095
ErrorHandler.logError
train
protected function logError(Throwable $e) { if ($this->settings['displayErrorDetails']) { return; } if (!$this->logger) { return; } static $errorsLogged = []; // Get hash of Throwable object $errorObjectHash = spl_object_hash($e); // check: only log if we haven't logged this exact error before
php
{ "resource": "" }
q11096
Chart.setTitle
train
public function setTitle( $title ) { $this->title = $title;
php
{ "resource": "" }
q11097
Chart.setAxisOptions
train
public function setAxisOptions( $axis, $name, $value ) {
php
{ "resource": "" }
q11098
Chart.setAxisLabel
train
public function setAxisLabel( $axis, $label ) { if ( in_array( $axis, array( 'x', 'y', 'z' ) ) ) { $originalAxisOptions = $this->jsWriter->getOption( 'axes', array()
php
{ "resource": "" }
q11099
Chart.setType
train
public function setType( $type, $seriesTitle = null )
php
{ "resource": "" }