_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q239700 | EbreEscoolMigrator.checkLessonsMigrationState | train | protected function checkLessonsMigrationState()
{
$this->output->info('# Checkin lessons migration state... #');
switch ($this->checkLessonMigrationStats()) {
case 0:
return true;
case 1:
$this->output->error(' Migration stats does not match!'... | php | {
"resource": ""
} |
q239701 | EbreEscoolMigrator.checkLessonMigrationStats | train | protected function checkLessonMigrationStats()
{
$numberOfOriginalLessons = Lesson::activeOn($this->period)->count();
$numberOfTrackedLessons = LessonMigration::all()->count();
$numberOfMigratedLessons = ScoolLesson::all()->count();
$this->output->info(' Original lessons: ' . $number... | php | {
"resource": ""
} |
q239702 | EbreEscoolMigrator.enrollments | train | private function enrollments()
{
return $this->validateCollection(
Enrollment::activeOn(
AcademicPeriod::findOrFail($this->period)->shortname)
)->orderBy(
'enrollment_study_id',
'enrollment_course_id',
'enrollment_group_... | php | {
"resource": ""
} |
q239703 | EbreEscoolMigrator.migrateModule | train | public function migrateModule(StudyModuleAcademicPeriod $module)
{
try {
$this->setScoolModule(
$this->createModule($module)
);
} catch (\LogicException $le) {
$this->output->error($le->getMessage());
}
} | php | {
"resource": ""
} |
q239704 | EbreEscoolMigrator.createCourse | train | protected function createCourse(Course $srcCourse)
{
$course = ScoolCourse::firstOrNew([
'name' => $srcCourse->name,
]);
$course->save();
$course->shortname = $srcCourse->shortname;
$course->description = $srcCourse->description;
return $course;
... | php | {
"resource": ""
} |
q239705 | EbreEscoolMigrator.createModule | train | protected function createModule(StudyModuleAcademicPeriod $studyModule)
{
$module = ScoolModule::firstOrNew([
'name' => $studyModule->name,
'study_id' => $this->getScoolStudy()->id
]);
if($studyModule->study_shortname != $this->getScoolStudy()->shortname) ... | php | {
"resource": ""
} |
q239706 | EbreEscoolMigrator.createSubmodule | train | protected function createSubmodule(StudySubModule $srcSubmodule)
{
//First Or new
$id = $this->SubModuleAlreadyExists($srcSubmodule);
if ($id != null) {
$submodule = Submodule::findOrFail($id);
} else {
$submodule = new Submodule();
}
$submodu... | php | {
"resource": ""
} |
q239707 | EbreEscoolMigrator.showMigratingInfo | train | protected function showMigratingInfo($model, $level = 0) {
$suffix = '';
if ($model instanceof Study) {
$suffix = $model->multiple() ? ". <bg=yellow;options=bold>Study is multiple!</>" : "";
}
if ($this->verbose && $model->periods != null) $suffix .= ' ' . $model->periods->pl... | php | {
"resource": ""
} |
q239708 | EbreEscoolMigrator.academicPeriods | train | protected function academicPeriods()
{
if ( ! $this->filtersAppliedToPeriods()) return AcademicPeriod::all();
if (str_contains($this->filters[0], '-')) {
try {
return collect([AcademicPeriod::where(['academic_periods_name' => $this->filters[0]])->firstOrFail()]);
... | php | {
"resource": ""
} |
q239709 | EbreEscoolMigrator.departments | train | protected function departments()
{
//Avoid using FOL because is a transversal department
if ( ! $this->filtersAppliedToDepartments()) return $this->validateCollection(Department::whereNotIn('department_id', [3])->get());
if ( ! is_numeric($this->filters[1]) ) throw new \InvalidArgumentExcep... | php | {
"resource": ""
} |
q239710 | EbreEscoolMigrator.studies | train | protected function studies(Department $department) {
return $this->validateCollection($department->studiesActiveOn($this->period)->get());
} | php | {
"resource": ""
} |
q239711 | EbreEscoolMigrator.modules | train | protected function modules(Course $course) {
$modules = $course->modules()->active()->get();
$sortedModules = $modules->sortBy(
function ($module, $key) {
return $module->order;
}
);
return $this->validateCollection($sortedModules);
} | php | {
"resource": ""
} |
q239712 | EbreEscoolMigrator.submodules | train | protected function submodules(StudyModuleAcademicPeriod $module) {
return $this->validateCollection($module->module()->first()->submodules()->active()->get());
} | php | {
"resource": ""
} |
q239713 | EbreEscoolMigrator.switchToDestinationConnection | train | protected function switchToDestinationConnection()
{ $env = env(
$this->composeDestinationConnectionEnvVarByCurrentPeriodInProcess(),
$this->composeDestinationConnectionNameByCurrentPeriodInProcess()
);
$this->switchConnection($env,$this->getDestinationConnection());
} | php | {
"resource": ""
} |
q239714 | Grammar.compileComponents | train | protected function compileComponents(Builder $query)
{
$request = [];
foreach ($this->requestComponents as $component) {
// To compile the query, we'll spin through each component of the query and
// see if that component exists. If it does we'll just call the compiler
... | php | {
"resource": ""
} |
q239715 | Grammar.compileBody | train | protected function compileBody(Builder $query)
{
$body = [];
$hasBody = !is_null($query->body);
if ($hasBody) {
foreach ($query->body as $postField) {
$body[$postField['column']] = $postField['value'];
}
if (count($body) > 0) {
... | php | {
"resource": ""
} |
q239716 | AbstractPdfAdapter.setHeader | train | public function setHeader(array $data): PdfInterface
{
$string_right = str_replace("{{date(\"n/d/Y g:i A\")}}", Carbon::now()->format('n/d/Y g:i A'), $data['right']);
$string_left = str_replace("|", '<br>', $data['left']);
$html = "<table border='0' cellspacing='0' cellpadding='0' width='1... | php | {
"resource": ""
} |
q239717 | AbstractPdfAdapter.setFooter | train | public function setFooter(array $data, string $side = 'both'): PdfInterface
{
$data = array_change_key_case($data, CASE_LOWER);
$footer = ('<table width="100%" style="vertical-align: bottom; font-family: arial; font-size: 9pt; color: #000000; font-weight: bold; font-style: italic;"><tr>'.
... | php | {
"resource": ""
} |
q239718 | AbstractPdfAdapter.setFontType | train | public function setFontType(string $fontname = null): PdfInterface
{
/**
* Font sets to be used for PDF documents:
*
* - Arial - Times - Tahoma
* - Georgia - Trebuchet - Courier
* - Lucida - Lucida-Bright -... | php | {
"resource": ""
} |
q239719 | AbstractPdfAdapter.getFontFamily | train | protected function getFontFamily(string $fontname = null): string
{
/**
* Font sets to be used for PDF documents:
*
* - Arial - Times - Tahoma
* - Georgia - Trebuchet - Courier
* - Lucida - Lucida-Bright - ... | php | {
"resource": ""
} |
q239720 | AbstractPdfAdapter.appendPageContent | train | public function appendPageContent(string $str): PdfInterface
{
$this->setProperty('pageContent', $str);
$this->mpdf->WriteHTML($this->pageContent);
return $this;
} | php | {
"resource": ""
} |
q239721 | AbstractPdfAdapter.setMargins | train | public function setMargins(array $setting): PdfInterface
{
$this->setProperty('marginTop', (int) $setting['marginTop']);
$this->setProperty('marginRight', (int) $setting['marginRight']);
$this->setProperty('marginBottom', (int) $setting['marginBottom']);
$this->setProperty('marginLef... | php | {
"resource": ""
} |
q239722 | AbstractPdfAdapter.setPageSize | train | public function setPageSize(string $pageSize): PdfInterface
{
$this->setProperty('pageSize', $pageSize);
$this->registerPageFormat();
return $this;
} | php | {
"resource": ""
} |
q239723 | AbstractPdfAdapter.appendPageCSS | train | public function appendPageCSS(string $str): PdfInterface
{
$this->setProperty('pageCSS', $str);
$this->mpdf->WriteHTML($this->pageCSS, 1);
return $this;
} | php | {
"resource": ""
} |
q239724 | AbstractPdfAdapter.registerPageFormat | train | protected function registerPageFormat(string $pageSize = null, string $orientation = null): PdfInterface
{
in_array($pageSize, $this->pageTypes)
? $this->setProperty('pageSize', $pageSize)
: $this->setProperty('pageSize', static::DEFAULT_PAGE_SIZE);
$this->setPageOrientation... | php | {
"resource": ""
} |
q239725 | AbstractPdfAdapter.setPageOrientation | train | public function setPageOrientation(string $orientation): PdfInterface
{
$this->setProperty('pageOrientation', strtoupper($orientation[0]));
$this->pageOrientation === 'L'
? $this->setProperty('pageFormat', $this->pageSize . '-' . $this->pageOrientation)
: $this->setProperty(... | php | {
"resource": ""
} |
q239726 | AbstractPdfAdapter.setMetaTitle | train | public function setMetaTitle(string $str): PdfInterface
{
$this->setProperty('metaTitle', $str);
$this->mpdf->SetTitle($this->metaTitle);
return $this;
} | php | {
"resource": ""
} |
q239727 | AbstractPdfAdapter.setMetaAuthor | train | public function setMetaAuthor(string $str): PdfInterface
{
$this->setProperty('metaAuthor', $str);
$this->mpdf->SetAuthor($this->metaAuthor);
return $this;
} | php | {
"resource": ""
} |
q239728 | AbstractPdfAdapter.setMetaCreator | train | public function setMetaCreator(string $str): PdfInterface
{
$this->setProperty('metaCreator', $str);
$this->mpdf->SetCreator($this->metaCreator);
return $this;
} | php | {
"resource": ""
} |
q239729 | AbstractPdfAdapter.setMetaSubject | train | public function setMetaSubject(string $str): PdfInterface
{
$this->setProperty('metaSubject', $str);
$this->mpdf->SetSubject($this->metaSubject);
return $this;
} | php | {
"resource": ""
} |
q239730 | AbstractPdfAdapter.setMetaKeywords | train | public function setMetaKeywords(array $words): PdfInterface
{
$this->setProperty('metaKeywords', array_merge($this->metaKeywords, $words));
$this->mpdf->SetKeywords(implode(', ', $this->metaKeywords));
return $this;
} | php | {
"resource": ""
} |
q239731 | ControllerParser.parseReflectedController | train | public function parseReflectedController($name, ClassReflection $reflection, ArrayObject $config)
{
$annotations = $reflection->getAnnotations($this->annotationManager);
if ($annotations instanceof AnnotationCollection) {
$this->processor->processController($name, $annotations);
... | php | {
"resource": ""
} |
q239732 | Utils.getSystemService | train | public function getSystemService(): SystemService
{
if ($this->_systemService === null) {
$this->_systemService = new SystemService();
}
return $this->_systemService;
} | php | {
"resource": ""
} |
q239733 | System.realPath | train | public static function realPath(/*string*/ $filePath = '') {
if('' === $filePath) {
$filePath = '.';
}
$filePath = @realpath($filePath);
if(false !== $filePath) {
$filePath = str_replace('\\', '/', $filePath);
if('/' !== $filePath) {
$filePath = rtrim($filePath, '/');
}
... | php | {
"resource": ""
} |
q239734 | System.containsPath | train | public static function containsPath(/*string*/ $top, /*string*/ $sub) {
$top = self::realPath($top);
$sub = self::realPath($sub);
return self::isDir($top) && self::isDir($sub) &&
0 === strpos($sub, $top . '/');
} | php | {
"resource": ""
} |
q239735 | System.openFile | train | public static function openFile(/*string*/ $filePath, /*string*/ $mode) {
return self::isFile($filePath) ? fopen($filePath, $mode, false) : false;
} | php | {
"resource": ""
} |
q239736 | System.tempFile | train | public static function tempFile(/*string*/ $prefix = '') {
$prefix = @trim($prefix);
if('' === $prefix) {
$prefix = time() . '-' . rand(11111, 99999);
}
$prefix .= '.';
$tempPath = tempnam(sys_get_temp_dir(), $prefix);
return $tempPath;
} | php | {
"resource": ""
} |
q239737 | Raw.getInstance | train | private static function getInstance(
string $userName,
Auth $auth
) : RawEndpoint {
return new RawEndpoint(
$userName,
$auth,
new Client()
);
} | php | {
"resource": ""
} |
q239738 | Raw.createNew | train | public static function createNew(
string $userName,
int $sourceId,
string $collectionName,
array $data,
Auth $auth
) {
return static::getInstance()
->createNew($sourceId, $collectionName, $data);
} | php | {
"resource": ""
} |
q239739 | main.createPickles2ContentsEditor | train | public function createPickles2ContentsEditor(){
$px2ce = new \pickles2\libs\contentsEditor\main();
$px2ce->init(
array(
'page_path' => '/px2me-dummy.html', // <- 編集対象ページのパス
'appMode' => $this->getAppMode(), // 'web' or 'desktop'. default to 'web'
'entryScript' => $this->entryScript,
'customField... | php | {
"resource": ""
} |
q239740 | NameResolver.resolve | train | public static function resolve($classname, array $context)
{
if ($classname[0] === '\\') {
return substr($classname, 1);
}
$cn = explode(':', $classname, 2);
if (count($cn) === 1) {
if (!empty($context['namespace'])) {
$classname = $context['na... | php | {
"resource": ""
} |
q239741 | Str.cache | train | public static function cache( $value, $name, $delimiter = null )
{
if( $value === '' )
{
return $value;
}
$func = $name;
$arg2 = $name == "snake";
if( $arg2 )
{
if( is_null($delimiter) )
{
$delimiter = "_";
}
}
else if( ($arg2 = $arg2 == "ascii") )
{
if( is_null($delimiter) )
... | php | {
"resource": ""
} |
q239742 | UrlUtil.getSlug | train | public static function getSlug($text, $separator = '-')
{
return strtolower(
trim(
preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode(
preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities(
... | php | {
"resource": ""
} |
q239743 | UrlLocator.resolve | train | protected function resolve($filename, $scope)
{
$scopeIndex = ($scope === false)? '' : $scope;
$theme = $this->getCurrentTheme();
$url = false;
if (isset($this->locations[$theme][$scopeIndex][$filename])) {
return $this->locations[$theme][$scopeIndex][$filename];
... | php | {
"resource": ""
} |
q239744 | ComputableBehavior._findComputed | train | public function _findComputed(Model $Model, $func, $state, $query, $result = array()) {
if ('after' == $state) {
return $result;
}
$query['fields'] = array(sprintf(
'%s(%s) AS %s'
, strtoupper($this->_methods[strtolower($this->settings[$Model->alias]['method'])])
, $Model->alias . '.' . $this->settin... | php | {
"resource": ""
} |
q239745 | BladedServiceProvider.launching | train | public function launching()
{
/**
* registering default commands
*/
$this->with([self::PROVIDES_SERVICE], function (IBladedManager $manager) {
$manager->registerCommandNamespace('scope', Scope::class);
\phpQuery::newDocument();
$manager->register... | php | {
"resource": ""
} |
q239746 | CommandNameInflector.inflect | train | public function inflect(ICommand $command)
{
$tmpClass = str_replace('Domain', 'Application', get_class($command));
$handlerClass = str_replace('Command', 'Handler', $tmpClass);
return $handlerClass;
} | php | {
"resource": ""
} |
q239747 | Input.tidy | train | public function tidy($value) {
if (is_array($value)) {
$value = array_map([&$this, 'tidy'], $value);
} else {
$value = trim($value);
// unify line breaks
$value = preg_replace("=(\r\n|\r)=", "\n", $value);
// filter nullbyte
$value = str_replace("\0", '', $value);
}
return $value;
} | php | {
"resource": ""
} |
q239748 | Input._array_merge_recursive_distinct | train | protected function _array_merge_recursive_distinct ($array) {
$arrays = func_get_args();
$base = array_shift($arrays);
if (!is_array($base)) $base = empty($base) ? [] : [$base];
foreach ($arrays as $append) {
if (!is_array($append)) $append = [$append];
foreach ($append as $key => $value) {
if (!array... | php | {
"resource": ""
} |
q239749 | Route.checkRoute | train | public function checkRoute($uri)
{
foreach($this->strings as $expression)
{
// check if it matches the pattern
$this->regex->setPattern($expression);
if($this->regex->getMatches($uri))
{
$this->matchedUriParts = explode('/',$uri);
... | php | {
"resource": ""
} |
q239750 | Route.setStrings | train | private function setStrings()
{
/*
* Sift through the wreckage
*/
foreach($this->parts as $part)
{
$this->checkPart($part);
}
/*
* if there's still nuthin', we must be on the feckin' home page
*/
$this->strings[0] = ($... | php | {
"resource": ""
} |
q239751 | Route.setOptionalStrings | train | private function setOptionalStrings()
{
/*
* Make another string t' check fer
*/
if($this->optional)
{
$this->strings[1] = $this->strings[0].Url::SLASH_WORD;
//reverse the fecker, if the longer one matches first, good!
$this->strings = a... | php | {
"resource": ""
} |
q239752 | UserFilter.filter | train | public function filter(EventInterface $event)
{
if (!$event instanceof UserEventInterface) {
return null;
}
$nick = $event->getNick();
if ($nick === null) {
return null;
}
$userMask = sprintf('%s!%s@%s',
$nick,
$event-... | php | {
"resource": ""
} |
q239753 | SettingsController.Advanced | train | public function Advanced() {
// Check permission
$this->Permission('Garden.Settings.Manage');
// Load up config options we'll be setting
$Validation = new Gdn_Validation();
$ConfigurationModel = new Gdn_ConfigurationModel($Validation);
$ConfigurationModel->SetField(array(
... | php | {
"resource": ""
} |
q239754 | SettingsController.Initialize | train | public function Initialize() {
// Set up head
$this->Head = new HeadModule($this);
$this->AddJsFile('jquery.js');
$this->AddJsFile('jquery.livequery.js');
$this->AddJsFile('jquery.form.js');
$this->AddJsFile('jquery.popup.js');
$this->AddJsFile('jquery.gardenhandleajaxform.js')... | php | {
"resource": ""
} |
q239755 | SettingsController.AddSideMenu | train | public function AddSideMenu($CurrentUrl) {
// Only add to the assets if this is not a view-only request
if ($this->_DeliveryType == DELIVERY_TYPE_ALL) {
$SideMenu = new SideMenuModule($this);
$SideMenu->HtmlId = '';
$SideMenu->HighlightRoute($CurrentUrl);
$SideMenu->Sort ... | php | {
"resource": ""
} |
q239756 | SettingsController.FloodControl | train | public function FloodControl() {
// Check permission
$this->Permission('Garden.Settings.Manage');
// Display options
$this->Title(T('Flood Control'));
$this->AddSideMenu('vanilla/settings/floodcontrol');
// Load up config options we'll be setting
$Validation = new... | php | {
"resource": ""
} |
q239757 | SettingsController.AddCategory | train | public function AddCategory() {
// Check permission
$this->Permission('Garden.Settings.Manage');
// Set up head
$this->AddJsFile('jquery.alphanumeric.js');
$this->AddJsFile('categories.js');
$this->AddJsFile('jquery.gardencheckboxgrid.js');
$this->Title(T('Add Category')... | php | {
"resource": ""
} |
q239758 | SettingsController.DeleteCategory | train | public function DeleteCategory($CategoryID = FALSE) {
// Check permission
$this->Permission('Garden.Settings.Manage');
// Set up head
$this->AddJsFile('categories.js');
$this->Title(T('Delete Category'));
$this->AddSideMenu('vanilla/settings/managecategories');
// Get c... | php | {
"resource": ""
} |
q239759 | SettingsController.DeleteCategoryPhoto | train | public function DeleteCategoryPhoto($CategoryID = FALSE, $TransientKey = '') {
// Check permission
$this->Permission('Garden.Settings.Manage');
$RedirectUrl = 'vanilla/settings/editcategory/'.$CategoryID;
if (Gdn::Session()->ValidateTransientKey($TransientKey)) {
// Do rem... | php | {
"resource": ""
} |
q239760 | SettingsController.EditCategory | train | public function EditCategory($CategoryID = '') {
// Check permission
$this->Permission('Garden.Settings.Manage');
// Set up models
$RoleModel = new RoleModel();
$PermissionModel = Gdn::PermissionModel();
$this->Form->SetModel($this->CategoryModel);
if (!$CategoryI... | php | {
"resource": ""
} |
q239761 | SettingsController.ManageCategories | train | public function ManageCategories() {
// Check permission
$this->Permission('Garden.Settings.Manage');
$this->AddSideMenu('vanilla/settings/managecategories');
// Nested sortable always breaks when we update jQuery so we give it it's own old version of jquery.
$this->RemoveJsF... | php | {
"resource": ""
} |
q239762 | SettingsController.SortCategories | train | public function SortCategories() {
// Check permission
$this->Permission('Garden.Settings.Manage');
// Set delivery type to true/false
$TransientKey = GetIncomingValue('TransientKey');
if (Gdn::Request()->IsPostBack()) {
$TreeArray = GetValue('TreeArray', $_POST);
... | php | {
"resource": ""
} |
q239763 | RepositoryPool.get | train | public function get($className)
{
if (!$this->has($className)) {
throw new Exception('Repository ' . $className . ' not found');
}
return $this->pool[$className];
} | php | {
"resource": ""
} |
q239764 | SelectFacade.table | train | public function table($tableName, $alias = null)
{
$table = $this->factory->references('Table', $tableName, $alias);
$this->select->table($table);
return $this;
} | php | {
"resource": ""
} |
q239765 | SelectFacade.limit | train | public function limit($beginAmount, $amount = null)
{
$beginObj = new Numeric((int)$beginAmount);
$amountObj = ($amount) ? new Numeric((int)$amount) : null;
$this->select->limit($beginObj, $amountObj);
return $this;
} | php | {
"resource": ""
} |
q239766 | SelectFacade.groupBy | train | public function groupBy($column, $orderMode = null)
{
$columnObj = $this->factory->references('Column', $column);
$orderModeObj = ($orderMode) ? $this->factory->references('OrderModeEnum', $orderMode) : null;
$this->select->groupBy($columnObj, $orderModeObj);
return $this;
} | php | {
"resource": ""
} |
q239767 | DataSourceManager.createDoctrineDBALConnection | train | public function createDoctrineDBALConnection($driver, $host, $port, $dbname, $user, $password)
{
// TODO caching for connection
$connectionFactory = $this->getDoctrineConnectionFactory();
$connection = $connectionFactory->createConnection(array(
'driver' => $driver,
... | php | {
"resource": ""
} |
q239768 | DataSourceManager.getSQLResultFromConnection | train | protected function getSQLResultFromConnection($connection, $sql, array $params = array())
{
$result = $connection->fetchAll($sql, $params);
return $result;
} | php | {
"resource": ""
} |
q239769 | WebDriver_Server_Appium.findByXpath | train | public function findByXpath($locator)
{
$locator = \Normalizer::normalize($locator, \Normalizer::FORM_D);
return parent::find($locator);
} | php | {
"resource": ""
} |
q239770 | HttpController.on | train | public function on($method, $listener)
{
if (!array_key_exists($method, $this->_listeners)) {
$this->_listeners[$method] = [];
}
array_push($this->_listeners[$method], $listener);
} | php | {
"resource": ""
} |
q239771 | EnumTrait.getConstants | train | public static function getConstants()
{
if (empty(self::$_constantsCache)) {
$reflectionClass = new \ReflectionClass(get_called_class());
self::$_constantsCache = $reflectionClass->getConstants();
}
return self::$_constantsCache;
} | php | {
"resource": ""
} |
q239772 | EnumTrait.getConstantConfigByValue | train | public static function getConstantConfigByValue($value)
{
foreach (self::getConstants() as $constant) {
if ($constant['value'] === $value) {
return $constant;
}
}
return false;
} | php | {
"resource": ""
} |
q239773 | EnumTrait.getNameForValue | train | public static function getNameForValue($value)
{
foreach (self::getConstants() as $constant) {
if ($constant['value'] === $value) {
return $constant['name'];
}
}
return false;
} | php | {
"resource": ""
} |
q239774 | EnumTrait.getValueForName | train | public static function getValueForName($name)
{
foreach (self::getConstants() as $constant) {
if ($constant['name'] === $name) {
return $constant['value'];
}
}
return false;
} | php | {
"resource": ""
} |
q239775 | FilterHelper.pagination | train | public function pagination($maxPageNumbers = 10, $itemType = 'Items', $class = '', $element = 'Filter/pagination', $passParams = [])
{
if (empty($this->paginationParams)) {
return '';
}
$this->_passParams = array_merge($this->paginationParams['passParams'], $passParams);
... | php | {
"resource": ""
} |
q239776 | FilterHelper._getFilterUrl | train | protected function _getFilterUrl($withLimit = true)
{
$url = [
'plugin' => $this->request->getParam('plugin'),
'controller' => $this->request->getParam('controller'),
'action' => $this->request->getParam('action'),
];
foreach($this->_passParams as $name =... | php | {
"resource": ""
} |
q239777 | Contact.getByEmail | train | public function getByEmail($email)
{
if (!is_string($email) || empty($email)) {
return null;
}
$parameters = array(
'api_action' => 'contact_view_email',
'email' => $email
);
$response = $this->request($parameters);
if ($respon... | php | {
"resource": ""
} |
q239778 | QueryTrait.hasJoin | train | public function hasJoin($aliasOrTable)
{
if ($this->join) {
foreach ($this->join as $join) {
$secondJoinParam = $join[1];
if (is_array($secondJoinParam)) {
list($key, $val) = each($secondJoinParam);
if ($key == $alias... | php | {
"resource": ""
} |
q239779 | Collection.transform | train | public function transform()
{
$presentation = [];
if( ! $this->transformer) {
return $presentation;
}
foreach ($this->resource as $key => $resource) {
$presentation[$key] = Item::create($resource)->setTransformer($this->transformer)->transform();
}
... | php | {
"resource": ""
} |
q239780 | File.configureHTTPMethod | train | protected function configureHTTPMethod($method) {
switch($method){
case self::HTTP_GET:
$this->removeHeader('Content-Type');
break;
case self::HTTP_POST:
case self::HTTP_PUT:
$this->addHeader("Content-Type", "multipart/form-data... | php | {
"resource": ""
} |
q239781 | Chikka._init | train | protected function _init()
{
$this->url = Config::get('chikka::url');
$this->client_id = Config::get('chikka::client_id');
$this->secret_key = Config::get('chikka::secret_key');
$this->short_code = Config::get('chikka::short_code');
} | php | {
"resource": ""
} |
q239782 | CTFW_Widget.ctc_sanitize | train | function ctc_sanitize( $instance ) { // prefix in case WP core adds method with same name
global $allowedposttags;
// Array to add sanitized values to
$sanitized_instance = array();
// Loop valid fields to sanitize
$fields = $this->ctc_prepared_fields();
foreach ( $fields as $id => $field ) {
// Get ... | php | {
"resource": ""
} |
q239783 | CTFW_Widget.widget | train | function widget( $args, $instance ) {
global $post; // setup_postdata() needs this
// Available widgets
$widgets = ChurchThemeFrameworkWidgets::widgetList();
// Get template filename
$template_file = $widgets[$this->id_base]['template_file'];
// Check if template exists
$template_path = CTFW_WIDGETS_W... | php | {
"resource": ""
} |
q239784 | Menu.initialize | train | protected function initialize()
{
$itemData = $this->getItemData();
$itemsMerged = array();
foreach ($itemData as $key => $itemOptions)
{
$itemsMerged[$key] = array_merge($this->defaults, $itemOptions);
if (isset($itemsMerged[$key]['children']['.defaults']))... | php | {
"resource": ""
} |
q239785 | Menu.createItem | train | public function createItem($itemRouteName, array $itemOptions)
{
if (isset($itemOptions['item_class']))
{
$class = $itemOptions['item_class'];
}
else
{
$class = $this->getDefaultItemClass();
}
if (isset($this->itemClassAliases[$class])... | php | {
"resource": ""
} |
q239786 | Menu.getBreadcrumbItems | train | public function getBreadcrumbItems()
{
$item = $this->getBaseItem();
$items = array();
while ($current = $item->getCurrentChild())
{
$items[] = $current;
$item = $current;
}
return $items;
} | php | {
"resource": ""
} |
q239787 | Menu.isValidMenuItemClass | train | protected function isValidMenuItemClass($className)
{
if (!isset($this->checkedClasses[$className]))
{
$this->checkedClasses[$className] = $this->hasParentClass($className, 'C33s\\MenuBundle\\Item\\MenuItem');
}
return $this->checkedClasses[$className];
} | php | {
"resource": ""
} |
q239788 | Server.boot | train | protected function boot(): void
{
// boot extensions
foreach ($this->extensionManager->getExtensions() as $extension) {
if ($extension->isActivated()) {
$extension->boot();
}
}
// boot app
$this->dispatch(new RoutesWillBeLoaded($this->... | php | {
"resource": ""
} |
q239789 | PHP_ParserGenerator_Action.actioncmp | train | static function actioncmp(PHP_ParserGenerator_Action $ap1, PHP_ParserGenerator_Action $ap2)
{
$rc = $ap1->sp->index - $ap2->sp->index;
if ($rc === 0) {
$rc = $ap1->type - $ap2->type;
}
if ($rc === 0) {
if ($ap1->type == self::SHIFT) {
if ($ap1-... | php | {
"resource": ""
} |
q239790 | PHP_ParserGenerator_Action.Action_add | train | static function Action_add(&$app, $type, PHP_ParserGenerator_Symbol $sp, $arg)
{
$new = new PHP_ParserGenerator_Action;
$new->next = $app;
$app = $new;
$new->type = $type;
$new->sp = $sp;
$new->x = $arg;
echo ' Adding ';
$new->display();
} | php | {
"resource": ""
} |
q239791 | PHP_ParserGenerator_Action.PrintAction | train | function PrintAction($fp, $indent)
{
if (!$fp) {
$fp = STDOUT;
}
$result = 1;
switch ($this->type)
{
case self::SHIFT:
fprintf($fp, "%${indent}s shift %d", $this->sp->name, $this->x->statenum);
break;
case self::REDUCE:
... | php | {
"resource": ""
} |
q239792 | Project.removeElementFromArray | train | public static function removeElementFromArray($elements, $array)
{
if (is_array($elements) && is_array($array))
{
foreach ($elements as $element)
{
if (in_array($element, $array))
{
$key = array_search($element, $array);
... | php | {
"resource": ""
} |
q239793 | PriorityList.add | train | public function add($entry, $priority = self::DEFAULT_PRIORITY)
{
if (isset($this->entryClass) && !($entry instanceof $this->entryClass)) {
throw new InvalidObjectClassException($this->entryClass, get_class($entry));
}
$this->entries[] = ['data' => $entry, 'priority' => $priority... | php | {
"resource": ""
} |
q239794 | PriorityList.remove | train | public function remove($entry, $priority = false)
{
$unsetAnything = false;
foreach ($this->entries as $i => $entryData) {
if ($entry === $entryData['data'] && ($priority === false || $entryData['priority'] == $priority)) {
unset($this->entries[$i]);
$unse... | php | {
"resource": ""
} |
q239795 | PriorityList.reprioritise | train | public function reprioritise($entry, $newPriority, $oldPriority = false)
{
$changedAnything = false;
foreach ($this->entries as $i => &$entryData) {
if ($entry === $entryData['data'] && ($oldPriority === false || $entryData['priority'] == $oldPriority)) {
$entryData['prio... | php | {
"resource": ""
} |
q239796 | PriorityList.toArray | train | public function toArray()
{
if (!$this->sorted) {
$this->rewind();
}
return array_map(
function ($entry) {
return $entry['data'];
}, $this->entries
);
} | php | {
"resource": ""
} |
q239797 | Arr.dotGet | train | public static function dotGet(array $array, $key, $default = null)
{
if (is_null($key)) {
return $array;
}
if (isset($array[$key])) {
return $array[$key];
}
foreach (explode('.', $key) as $segment) {
if (!is_array($array) || !array_key_ex... | php | {
"resource": ""
} |
q239798 | Arr.dotSet | train | public static function dotSet(array $array, $key, $value)
{
$path = explode('.', $key);
$total = count($path);
$current = &$array;
for ($ii = 0; $ii < $total; $ii++) {
if ($ii === $total - 1) {
$current[$path[$ii]] = $value;
} else {
... | php | {
"resource": ""
} |
q239799 | Arr.walk | train | public static function walk(
array &$array,
callable $callback,
$recurse = false,
$path = '',
$considerLeaves = true
) {
$path = trim($path, '.');
foreach ($array as $key => $value) {
if (is_array($value) && $recurse) {
if ($consid... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.