_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q3000 | SitemapGenerator.addAll | train | public function addAll($objects)
{
if (is_a($objects, 'Closure')) {
return $this->closures[] = $objects;
}
foreach ($objects as $object) {
$this->add($object);
}
} | php | {
"resource": ""
} |
q3001 | SitemapGenerator.addRaw | train | public function addRaw($data)
{
$this->validateData($data);
$data['location'] = trim($data['location'], '/');
$this->entries[] = $this->replaceAttributes($data);
} | php | {
"resource": ""
} |
q3002 | SitemapGenerator.contains | train | public function contains($url)
{
$url = trim($url, '/');
foreach ($this->entries as $entry) {
if ($entry['loc'] == $url) {
return TRUE;
}
}
return FALSE;
} | php | {
"resource": ""
} |
q3003 | SitemapGenerator.generateIndex | train | public function generateIndex()
{
$this->loadClosures();
$xml = new XMLWriter();
$xml->openMemory();
$xml->writeRaw('<?xml version="1.0" encoding="UTF-8"?>');
$xml->writeRaw('<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
foreach ($this->entries as $data) {
$xml->startElement('... | php | {
"resource": ""
} |
q3004 | SitemapGenerator.replaceAttributes | train | protected function replaceAttributes($data)
{
foreach ($data as $attribute => $value) {
$replacement = $this->replaceAttribute($attribute);
unset($data[$attribute]);
$data[$replacement] = $value;
}
return $data;
} | php | {
"resource": ""
} |
q3005 | SitemapGenerator.replaceAttribute | train | protected function replaceAttribute($attribute)
{
if (array_key_exists($attribute, $this->replacements)) {
return $this->replacements[$attribute];
}
return $attribute;
} | php | {
"resource": ""
} |
q3006 | SitemapGenerator.loadClosures | train | protected function loadClosures()
{
foreach ($this->closures as $closure) {
$instance = $closure();
if (is_array($instance) || $instance instanceof Traversable) {
$this->addAll($instance);
} else {
$this->add($instance);
}
}
} | php | {
"resource": ""
} |
q3007 | Tx_Oelib_ConfigCheck.checkTemplateFile | train | protected function checkTemplateFile($canUseFlexforms = false)
{
if (TYPO3_MODE === 'BE') {
return;
}
$this->checkForNonEmptyString(
'templateFile',
$canUseFlexforms,
's_template_special',
'This value specifies the HTML template wh... | php | {
"resource": ""
} |
q3008 | Tx_Oelib_ConfigCheck.checkForNonEmptyString | train | public function checkForNonEmptyString(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$value = $this->objectToCheck->getConfValueString($fieldName, $sheet);
$this->checkForNonEmptyStringValue(
$value,
$fieldName,
$canUseFle... | php | {
"resource": ""
} |
q3009 | Tx_Oelib_ConfigCheck.checkIfSingleInSetNotEmpty | train | protected function checkIfSingleInSetNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
array $allowedValues
) {
$this->checkForNonEmptyString(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
... | php | {
"resource": ""
} |
q3010 | Tx_Oelib_ConfigCheck.checkIfSingleInSetOrEmpty | train | protected function checkIfSingleInSetOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
array $allowedValues
) {
if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) {
$value = $this->objectToCheck->getConfValueString($fieldName, $sh... | php | {
"resource": ""
} |
q3011 | Tx_Oelib_ConfigCheck.checkIfBoolean | train | protected function checkIfBoolean($fieldName, $canUseFlexforms, $sheet, $explanation)
{
$this->checkIfSingleInSetNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
['0', '1']
);
} | php | {
"resource": ""
} |
q3012 | Tx_Oelib_ConfigCheck.checkIfMultiInSetOrEmpty | train | protected function checkIfMultiInSetOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
array $allowedValues
) {
if ($this->objectToCheck->hasConfValueString($fieldName, $sheet)) {
$allValues = GeneralUtility::trimExplode(
',',
... | php | {
"resource": ""
} |
q3013 | Tx_Oelib_ConfigCheck.checkIfSingleInTableNotEmpty | train | public function checkIfSingleInTableNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$tableName
) {
$this->checkIfSingleInSetNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$this->g... | php | {
"resource": ""
} |
q3014 | Tx_Oelib_ConfigCheck.checkIfSingleInTableOrEmpty | train | protected function checkIfSingleInTableOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$tableName
) {
$this->checkIfSingleInSetOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$this->... | php | {
"resource": ""
} |
q3015 | Tx_Oelib_ConfigCheck.checkIfMultiInTableOrEmpty | train | protected function checkIfMultiInTableOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$tableName
) {
$this->checkIfMultiInSetOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$this->ge... | php | {
"resource": ""
} |
q3016 | Tx_Oelib_ConfigCheck.checkRegExp | train | protected function checkRegExp(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$regExp
) {
$value = $this->objectToCheck->getConfValueString($fieldName, $sheet);
if (!preg_match($regExp, $value)) {
$message = 'The TS setup variable <strong>' ... | php | {
"resource": ""
} |
q3017 | Tx_Oelib_ConfigCheck.checkRegExpNotEmpty | train | protected function checkRegExpNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$regExp
) {
$this->checkForNonEmptyString(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
$this->checkReg... | php | {
"resource": ""
} |
q3018 | Tx_Oelib_ConfigCheck.checkIfFePagesNotEmpty | train | protected function checkIfFePagesNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$this->checkForNonEmptyString(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
$this->checkIfFePagesOrEmpty(... | php | {
"resource": ""
} |
q3019 | Tx_Oelib_ConfigCheck.checkIfSingleFePageNotEmpty | train | protected function checkIfSingleFePageNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$this->checkIfPositiveInteger(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
$this->checkIfFePagesOrE... | php | {
"resource": ""
} |
q3020 | Tx_Oelib_ConfigCheck.checkIfSingleFePageOrEmpty | train | protected function checkIfSingleFePageOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$this->checkIfInteger($fieldName, $canUseFlexforms, $sheet, $explanation);
$this->checkIfFePagesOrEmpty(
$fieldName,
$canUseFlexforms,
... | php | {
"resource": ""
} |
q3021 | Tx_Oelib_ConfigCheck.checkIfSysFoldersNotEmpty | train | protected function checkIfSysFoldersNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$this->checkForNonEmptyString(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
$this->checkIfSysFoldersOr... | php | {
"resource": ""
} |
q3022 | Tx_Oelib_ConfigCheck.checkIfSingleSysFolderNotEmpty | train | protected function checkIfSingleSysFolderNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$this->checkIfPositiveInteger(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
$this->checkIfSysFold... | php | {
"resource": ""
} |
q3023 | Tx_Oelib_ConfigCheck.checkIfSingleSysFolderOrEmpty | train | protected function checkIfSingleSysFolderOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$this->checkIfInteger(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
$this->checkIfSysFoldersOrEmpt... | php | {
"resource": ""
} |
q3024 | Tx_Oelib_ConfigCheck.checkIfSysFoldersOrEmpty | train | protected function checkIfSysFoldersOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
) {
$pids = $this->objectToCheck->getConfValueString($fieldName, $sheet);
// Uses the plural if the configuration value is empty or contains a
// comma.
if... | php | {
"resource": ""
} |
q3025 | Tx_Oelib_ConfigCheck.checkPageTypeOrEmpty | train | protected function checkPageTypeOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation,
$typeCondition
) {
$this->checkIfPidListOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
if ($th... | php | {
"resource": ""
} |
q3026 | Tx_Oelib_ConfigCheck.checkListViewIfSingleInSetNotEmpty | train | protected function checkListViewIfSingleInSetNotEmpty(
$fieldName,
$explanation,
array $allowedValues
) {
$fieldSubPath = 'listView.' . $fieldName;
$value = $this->objectToCheck->getListViewConfValueString($fieldName);
$this->checkForNonEmptyStringValue(
... | php | {
"resource": ""
} |
q3027 | Tx_Oelib_ConfigCheck.checkIsValidEmailOrEmpty | train | public function checkIsValidEmailOrEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$unused,
$explanation
) {
$value = $this->objectToCheck->getConfValueString($fieldName, $sheet);
if ($value === '') {
return;
}
if (!GeneralUtility::va... | php | {
"resource": ""
} |
q3028 | Tx_Oelib_ConfigCheck.checkIsValidEmailNotEmpty | train | public function checkIsValidEmailNotEmpty(
$fieldName,
$canUseFlexforms,
$sheet,
$allowInternalAddresses,
$explanation
) {
$this->checkForNonEmptyString(
$fieldName,
$canUseFlexforms,
$sheet,
$explanation
);
... | php | {
"resource": ""
} |
q3029 | Tx_Oelib_TranslatorRegistry.setLanguageKeyFromConfiguration | train | private function setLanguageKeyFromConfiguration(\Tx_Oelib_Configuration $configuration)
{
if (!$configuration->hasString('language')) {
return;
}
$this->languageKey = $configuration->getAsString('language');
if ($configuration->hasString('language_alt')) {
$... | php | {
"resource": ""
} |
q3030 | Tx_Oelib_TranslatorRegistry.initializeBackEnd | train | private function initializeBackEnd()
{
$backEndUser =
\Tx_Oelib_BackEndLoginManager::getInstance()->getLoggedInUser(\Tx_Oelib_Mapper_BackEndUser::class);
$this->languageKey = $backEndUser->getLanguage();
} | php | {
"resource": ""
} |
q3031 | Tx_Oelib_TranslatorRegistry.getByExtensionName | train | private function getByExtensionName($extensionName)
{
if ($extensionName === '') {
throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489578);
}
if (!ExtensionManagementUtility::isLoaded($extensionName)) {
throw new \BadMethodC... | php | {
"resource": ""
} |
q3032 | Tx_Oelib_TranslatorRegistry.getLocalizedLabelsFromFile | train | private function getLocalizedLabelsFromFile($extensionKey)
{
if ($extensionKey === '') {
throw new \InvalidArgumentException('$extensionKey must not be empty.', 1331489618);
}
/** @var LocalizationFactory $languageFactory */
$languageFactory = GeneralUtility::makeInstanc... | php | {
"resource": ""
} |
q3033 | Tx_Oelib_TranslatorRegistry.getLocalizedLabelsFromTypoScript | train | private function getLocalizedLabelsFromTypoScript($extensionName)
{
if ($extensionName === '') {
throw new \InvalidArgumentException('The parameter $extensionName must not be empty.', 1331489630);
}
$result = [];
$namespace = 'plugin.tx_' . $extensionName . '._LOCAL_LANG... | php | {
"resource": ""
} |
q3034 | Tracker.getCurrent | train | public function getCurrent()
{
if (is_null($this->current))
{
$siteView = $this->makeNewViewModel();
$this->current = $siteView;
}
return $this->current;
} | php | {
"resource": ""
} |
q3035 | Tracker.collectVisitData | train | protected function collectVisitData()
{
$request = $this->request;
$user = $request->user();
$userId = $user ? $user->getKey() : null;
return [
'user_id' => $userId,
'http_referer' => $request->server('HTTP_REFERER'),
'url' ... | php | {
"resource": ""
} |
q3036 | Tracker.saveCurrent | train | public function saveCurrent()
{
if ($this->saveEnabled() && $this->isViewValid() && $this->isViewUnique())
{
$success = $this->saveCurrentModel();
// Keep on only if the model save has succeeded
if ($success)
{
$this->storeCurrentHash(... | php | {
"resource": ""
} |
q3037 | Tracker.isViewUnique | train | public function isViewUnique()
{
$hash = $this->getCurrentHash();
if (in_array($hash, $this->session->get('tracker.views', [])))
{
return false;
}
return true;
} | php | {
"resource": ""
} |
q3038 | Tracker.getCurrentHash | train | protected function getCurrentHash()
{
if ($this->currentHash === null)
{
$this->currentHash = md5(
$this->request->fullUrl() .
$this->request->method() .
$this->request->getClientIp()
);
}
return $this->currentH... | php | {
"resource": ""
} |
q3039 | Tracker.saveCurrentModel | train | protected function saveCurrentModel()
{
$current = $this->getCurrent();
$current->setAttribute('app_time', $this->getCurrentRuntime());
$current->setAttribute('memory', memory_get_peak_usage(true));
return $current->save();
} | php | {
"resource": ""
} |
q3040 | Tracker.saveTrackables | train | protected function saveTrackables($view, $success)
{
foreach ($this->trackables as $trackable)
{
$trackable->attachTrackerView($view);
}
return $success;
} | php | {
"resource": ""
} |
q3041 | Tracker.flushOlderThanOrBetween | train | public function flushOlderThanOrBetween($until = null, $from = null)
{
$modelName = $this->getViewModelName();
return $modelName::olderThanOrBetween($until, $from)->delete();
} | php | {
"resource": ""
} |
q3042 | DataTablesMappingHelper.getComparator | train | public static function getComparator(DataTablesMappingInterface $mapping) {
if (null === $mapping->getParent()) {
return "LIKE";
}
switch ($mapping->getParent()->getType()) {
case DataTablesColumnInterface::DATATABLES_TYPE_DATE:
case DataTablesColumnInterfa... | php | {
"resource": ""
} |
q3043 | DataTablesMappingHelper.getWhere | train | public static function getWhere(DataTablesMappingInterface $mapping) {
$where = [
static::getAlias($mapping),
static::getComparator($mapping),
static::getParam($mapping),
];
return implode(" ", $where);
} | php | {
"resource": ""
} |
q3044 | DataTablesController.deleteAction | train | public function deleteAction(Request $request, $name, $id) {
$dtProvider = $this->getDataTablesProvider($name);
try {
$entity = $this->getDataTablesEntityById($dtProvider, $id);
$this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_DELETE, [$entity]);
$... | php | {
"resource": ""
} |
q3045 | DataTablesController.editAction | train | public function editAction(Request $request, $name, $id, $data, $value) {
$dtProvider = $this->getDataTablesProvider($name);
$dtEditor = $this->getDataTablesEditor($dtProvider);
$dtColumn = $this->getDataTablesColumn($dtProvider, $data);
try {
$entity = $this->getDataTab... | php | {
"resource": ""
} |
q3046 | DataTablesController.exportAction | train | public function exportAction(Request $request, $name) {
$windows = DataTablesExportHelper::isWindows($request);
$dtProvider = $this->getDataTablesProvider($name);
$dtExporter = $this->getDataTablesCSVExporter($dtProvider);
$repository = $this->getDataTablesRepository($dtProvider);
... | php | {
"resource": ""
} |
q3047 | DataTablesController.optionsAction | train | public function optionsAction($name) {
$dtProvider = $this->getDataTablesProvider($name);
$dtWrapper = $this->getDataTablesWrapper($dtProvider);
$dtOptions = DataTablesWrapperHelper::getOptions($dtWrapper);
return new JsonResponse($dtOptions);
} | php | {
"resource": ""
} |
q3048 | DataTablesController.showAction | train | public function showAction($name, $id) {
$dtProvider = $this->getDataTablesProvider($name);
try {
$entity = $this->getDataTablesEntityById($dtProvider, $id);
$this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_SHOW, [$entity]);
} catch (EntityNotFoundExcep... | php | {
"resource": ""
} |
q3049 | Autoload.loadPsr4 | train | public function loadPsr4()
{
$data = $this->getData();
// Always load these
if (isset($data['always']))
{
$this->loadPsr4Group($data['always']);
}
// These only in admin
if (is_admin() && isset($data['admin']))
{
$this->loadPs... | php | {
"resource": ""
} |
q3050 | Autoload.instantiateClasses | train | public function instantiateClasses()
{
$data = $this->getData();
// Always load these
if (isset($data['always']))
{
$this->instantiateGroup($data['always']);
}
// These only in admin
if (is_admin() && isset($data['admin']))
{
... | php | {
"resource": ""
} |
q3051 | Autoload.loadPsr4Group | train | private function loadPsr4Group($group)
{
if ( !isset($group['psr4']))
{
return;
}
foreach ($group['psr4'] as $prefix => $paths)
{
$this->objectRegistry->addPsr4($prefix, $paths);
}
} | php | {
"resource": ""
} |
q3052 | Autoload.instantiateGroup | train | private function instantiateGroup($group)
{
if ( !isset($group['instantiate']))
{
return;
}
foreach ($group['instantiate'] as $nickname => $className)
{
$this->objectRegistry->register($nickname, new $className());
}
} | php | {
"resource": ""
} |
q3053 | User.createUser | train | private function createUser(array $user)
{
$this->fields = [
'id' => $this->getValue('id', $user),
'name' => $this->getValue('name', $user),
'username' => $this->getValue('username', $user),
'description' => $this->getVal... | php | {
"resource": ""
} |
q3054 | Customizer.configureKirki | train | public function configureKirki()
{
// These cannot be setup above directly, do it now
self::$OPTIONS_DEFAULTS['logo_image'] = Urls::assets('images/admin/customizer.png');
self::$OPTIONS_DEFAULTS['url_path'] = Urls::baobabFramework('vendor/aristath/kirki/');
// Todo pull description f... | php | {
"resource": ""
} |
q3055 | Customizer.registerControls | train | public function registerControls($controls)
{
$data = $this->getData();
$customControls = $data['controls'];
foreach ($customControls as &$c) {
$c['label'] = $this->translateValueIfKeyExists($c, 'label');
$c['description'] = $this->translateValueIfKeyExists($c, 'descr... | php | {
"resource": ""
} |
q3056 | Customizer.createPanels | train | public function createPanels($wp_customize)
{
$data = $this->getData();
// Move all default sections to the default panel
$defaultPanel = $data['options']['default_panel'];
$wp_customize->add_panel($defaultPanel['id'], array(
'priority' => 10,
'title' ... | php | {
"resource": ""
} |
q3057 | Twitter.getTweetsFromUser | train | public function getTweetsFromUser($username, $count = 10, $cacheMinutes = 30, $returnEntities = true)
{
$count = $this->getVerifiedCount($count, 1, 200);
$endpoint = '/statuses/user_timeline.json';
$url = $this->urlHelper->joinSlugs([$this->baseUrl, $this->apiVersion, $endpoint]);
... | php | {
"resource": ""
} |
q3058 | PreUserController.indexAction | train | public function indexAction()
{
$em = $this->getDoctrine()->getEntityManager();
$entities = $em->getRepository('DMSLauncherBundle:PreUser')->findAll();
return array('entities' => $entities);
} | php | {
"resource": ""
} |
q3059 | PreUserController.showAction | train | public function showAction($id)
{
$em = $this->getDoctrine()->getEntityManager();
$entity = $em->getRepository('DMSLauncherBundle:PreUser')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find PreUser entity.');
}
return array(
... | php | {
"resource": ""
} |
q3060 | CloudStorage.containers | train | public function containers($limit = 10000, $marker = '')
{
$response = $this->api->request('GET', '/', [
'query' => [
'limit' => intval($limit),
'marker' => $marker,
],
]);
if ($response->getStatusCode() !== 200) {
throw ne... | php | {
"resource": ""
} |
q3061 | CloudStorage.createContainer | train | public function createContainer($name, $type = 'public')
{
if (!in_array($type, ['public', 'private', 'gallery'])) {
throw new InvalidArgumentException('Unknown type "'.$type.'" provided.');
}
$response = $this->api->request('PUT', '/'.trim($name, '/'), [
'headers' =... | php | {
"resource": ""
} |
q3062 | CloudStorage.transformContainers | train | protected function transformContainers(array $items)
{
if (!count($items)) {
return [];
}
$containers = [];
foreach ($items as $item) {
$container = new Container($this->api, $this->uploader, $item['name'], $item);
$containers[$container->name()]... | php | {
"resource": ""
} |
q3063 | KnowledgebaseServiceProvider.setupMigrations | train | protected function setupMigrations()
{
$migrations = realpath(__DIR__.'/../database/migrations');
$this->publishes([
$migrations => $this->app->databasePath() . '/migrations',
]);
} | php | {
"resource": ""
} |
q3064 | KnowledgebaseServiceProvider.setupSeeds | train | protected function setupSeeds()
{
$seeds = realpath(__DIR__.'/../database/seeds');
$this->publishes([
$seeds => $this->app->databasePath() . '/seeds',
]);
} | php | {
"resource": ""
} |
q3065 | Tx_Oelib_MailerFactory.getMailer | train | public function getMailer()
{
if ($this->isTestMode) {
$className = \Tx_Oelib_EmailCollector::class;
} else {
$className = \Tx_Oelib_RealMailer::class;
}
if (!is_object($this->mailer) || (get_class($this->mailer) !== $className)) {
$this->mailer =... | php | {
"resource": ""
} |
q3066 | TwitterBase.requestAppAccessToken | train | protected function requestAppAccessToken()
{
$credentials = $this->authHelper->generateAppCredentials($this->apiKey, $this->apiSecret);
$endpoint = '/oauth2/token';
$url = $this->urlHelper->joinSlugs([$this->baseUrl, $endpoint]);
$data = ['grant_type' => 'client_credentials'];
... | php | {
"resource": ""
} |
q3067 | TwitterBase.getVerifiedCount | train | protected function getVerifiedCount($count, $min = 1, $max = 100)
{
settype($count, "integer");
settype($min, "integer");
settype($max, "integer");
// If $min is greater than $max,
// use the smallest of the two ($max)
if ($min > $max) $min = $max;
if ($coun... | php | {
"resource": ""
} |
q3068 | TwitterBase.createTweetEntities | train | protected function createTweetEntities($tweets)
{
$entities = [];
foreach ($tweets as $tweet)
{
$user = $this->twitterFactory->createUser($tweet['user']);
$entities[] = $this->twitterFactory->createTweet($tweet, $user);
}
return $entities;
} | php | {
"resource": ""
} |
q3069 | Laravel4.registerConfigurator | train | private function registerConfigurator()
{
$this->app->bind('CodeZero\Twitter\Twitter', function($app)
{
$config = $app['config']->has("twitter")
? $app['config']->get("twitter")
: $app['config']->get("twitter::config");
$configurator = new \Co... | php | {
"resource": ""
} |
q3070 | DefaultController.registerAction | train | public function registerAction()
{
$entity = new PreUser();
$request = $this->getRequest();
$form = $this->createForm(new RegistrationForm(), $entity);
$form->bindRequest($request);
if ($form->isValid()) {
$entity->setRegisteredOn(new \DateTime('now'));
... | php | {
"resource": ""
} |
q3071 | LanguageKsh.commafy | train | public function commafy( $_ ) {
if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
} else {
return $_;
}
} | php | {
"resource": ""
} |
q3072 | GiroCheckout_SDK_Request.addParam | train | public function addParam($param, $value) {
if (!$this->requestMethod->hasParam($param)) {
throw new GiroCheckout_SDK_Exception_helper('Failure: param "' . $param . '" not valid or misspelled. Please check API Params List.');
}
if ($value instanceof GiroCheckout_SDK_Request_Cart) {
$this->param... | php | {
"resource": ""
} |
q3073 | GiroCheckout_SDK_Request.getResponseParam | train | public function getResponseParam($param) {
if (isset($this->response[$param])) {
return $this->response[$param];
}
return null;
} | php | {
"resource": ""
} |
q3074 | GiroCheckout_SDK_Request.redirectCustomerToPaymentProvider | train | public function redirectCustomerToPaymentProvider() {
if (isset($this->response['redirect'])) {
header('location:' . $this->response['redirect']);
exit;
}
elseif (isset($this->response['url'])) {
header('location:' . $this->response['url']);
exit;
}
} | php | {
"resource": ""
} |
q3075 | MobileDetectExtension.getAvailableDevices | train | public function getAvailableDevices()
{
$availableDevices = array();
$rules = array_change_key_case($this->detector->getRules());
foreach ($rules as $device => $rule) {
$availableDevices[$device] = static::fromCamelCase($device);
}
return $availableDevices;
... | php | {
"resource": ""
} |
q3076 | ClassMetadataFactory.loadInterfaceMetadata | train | protected function loadInterfaceMetadata($metadata)
{
foreach( $metadata->getReflectionClass()->getInterfaces() as $interface ) {
$metadata->mergeRules($this->getClassMetadata($interface->getName()));
}
} | php | {
"resource": ""
} |
q3077 | GiroCheckout_SDK_AbstractApi.hasParam | train | public function hasParam($paramName) {
if (isset($this->paramFields[$paramName])) {
return true;
}
elseif ('sourceId' === $paramName) {
return true;
} //default field due to support issues
elseif ('userAgent' === $paramName) {
return true;
} //default field due to support issue... | php | {
"resource": ""
} |
q3078 | GiroCheckout_SDK_AbstractApi.getSubmitParams | train | public function getSubmitParams($params) {
$submitParams = array();
foreach ($this->paramFields as $k => $mandatory) {
if (isset($params[$k]) && strlen($params[$k]) > 0) {
$submitParams[$k] = $params[$k];
}
elseif ((!isset($params[$k]) || strlen($params[$k]) == 0) && $mandatory) {
... | php | {
"resource": ""
} |
q3079 | GiroCheckout_SDK_AbstractApi.checkResponse | train | public function checkResponse($response) {
if (!is_array($response)) {
return FALSE;
}
$responseParams = array();
foreach ($this->responseFields as $k => $mandatory) {
if (isset($response[$k])) {
$responseParams[$k] = $response[$k];
}
elseif (!isset($response[$k]) && $ma... | php | {
"resource": ""
} |
q3080 | GiroCheckout_SDK_AbstractApi.checkNotification | train | public function checkNotification($notify) {
if (!is_array($notify)) {
return FALSE;
}
$notifyParams = array();
foreach ($this->notifyFields as $k => $mandatory) {
if (isset($notify[$k])) {
$notifyParams[$k] = $notify[$k];
}
elseif (!isset($notify[$k]) && $mandatory) {
... | php | {
"resource": ""
} |
q3081 | Assets.registerAssets | train | public function registerAssets()
{
$data = $this->getData();
// Read the assets manifest file if it exists
$manifest = $this->loadManifest();
if (isset($data['styles']))
{
foreach ($data['styles'] as $handle => $props)
{
$this->handle... | php | {
"resource": ""
} |
q3082 | Assets.enqueueAssets | train | public function enqueueAssets()
{
$data = $this->getData();
if (isset($data['editor']))
{
// Tell the TinyMCE editor to use a custom stylesheet
add_editor_style($data['editor']);
}
if (isset($data['styles']))
{
foreach ($data['sty... | php | {
"resource": ""
} |
q3083 | Assets.loadManifest | train | protected function loadManifest()
{
$manifestPath = Paths::assets('manifest.json');
if (file_exists($manifestPath))
{
return json_decode(file_get_contents($manifestPath), true);
}
return null;
} | php | {
"resource": ""
} |
q3084 | Container.objectData | train | protected function objectData($key, $default = null)
{
if (!$this->dataLoaded) {
$this->loadContainerData();
}
return isset($this->data[$key]) ? $this->data[$key] : $default;
} | php | {
"resource": ""
} |
q3085 | Container.loadContainerData | train | protected function loadContainerData()
{
// CloudStorage::containers and CloudStorage::getContainer methods did not
// produce any requests to Selectel API, since it may be unnecessary if
// user only wants to upload/manage files or delete container via API.
// If user really wants ... | php | {
"resource": ""
} |
q3086 | Container.jsonSerialize | train | public function jsonSerialize()
{
return [
'name' => $this->name(),
'type' => $this->type(),
'files_count' => $this->filesCount(),
'size' => $this->size(),
'uploaded_bytes' => $this->uploadedBytes(),
'downloaded_bytes' => $this->downloa... | php | {
"resource": ""
} |
q3087 | Container.setType | train | public function setType($type)
{
if ($this->type() === $type) {
return $type;
}
// Catch any API Request Exceptions here
// so we can replace exception message
// with more informative one.
try {
$this->setMeta(['Type' => $type]);
} c... | php | {
"resource": ""
} |
q3088 | Container.createDir | train | public function createDir($name)
{
$response = $this->api->request('PUT', $this->absolutePath($name), [
'headers' => [
'Content-Type' => 'application/directory',
],
]);
if ($response->getStatusCode() !== 201) {
throw new ApiRequestFailedEx... | php | {
"resource": ""
} |
q3089 | Container.deleteDir | train | public function deleteDir($name)
{
$response = $this->api->request('DELETE', $this->absolutePath($name));
if ($response->getStatusCode() !== 204) {
throw new ApiRequestFailedException('Unable to delete directory "'.$name.'".', $response->getStatusCode());
}
return true;... | php | {
"resource": ""
} |
q3090 | Container.uploadFromString | train | public function uploadFromString($path, $contents, array $params = [], $verifyChecksum = true)
{
return $this->uploader->upload($this->api, $this->absolutePath($path), $contents, $params, $verifyChecksum);
} | php | {
"resource": ""
} |
q3091 | Container.uploadFromStream | train | public function uploadFromStream($path, $resource, array $params = [])
{
return $this->uploader->upload($this->api, $this->absolutePath($path), $resource, $params, false);
} | php | {
"resource": ""
} |
q3092 | Container.delete | train | public function delete()
{
$response = $this->api->request('DELETE', $this->absolutePath());
switch ($response->getStatusCode()) {
case 204:
// Container removed.
return;
case 404:
throw new ApiRequestFailedException('Container... | php | {
"resource": ""
} |
q3093 | Tx_Oelib_Model_FrontEndUser.getName | train | public function getName()
{
if ($this->hasString('name')) {
$result = $this->getAsString('name');
} elseif ($this->hasFirstName() || $this->hasLastName()) {
$result = trim($this->getFirstName() . ' ' . $this->getLastName());
} else {
$result = $this->getUs... | php | {
"resource": ""
} |
q3094 | Tx_Oelib_Model_FrontEndUser.hasGroupMembership | train | public function hasGroupMembership($uidList)
{
if ($uidList === '') {
throw new \InvalidArgumentException('$uidList must not be empty.', 1331488635);
}
$isMember = false;
foreach (GeneralUtility::trimExplode(',', $uidList, true) as $uid) {
if ($this->getUser... | php | {
"resource": ""
} |
q3095 | Tx_Oelib_Model_FrontEndUser.setGender | train | public function setGender($genderKey)
{
$validGenderKeys = [self::GENDER_MALE, self::GENDER_FEMALE, self::GENDER_UNKNOWN];
if (!in_array($genderKey, $validGenderKeys, true)) {
throw new \InvalidArgumentException(
'$genderKey must be one of the predefined constants, but ac... | php | {
"resource": ""
} |
q3096 | Tx_Oelib_Model_FrontEndUser.getAge | train | public function getAge()
{
if (!$this->hasDateOfBirth()) {
return 0;
}
$currentTimestamp = $GLOBALS['EXEC_TIME'];
$birthTimestamp = $this->getDateOfBirth();
$currentYear = (int)strftime('%Y', $currentTimestamp);
$currentMonth = (int)strftime('%m', $curre... | php | {
"resource": ""
} |
q3097 | Tx_Oelib_Model_FrontEndUser.getCountry | train | public function getCountry()
{
$countryCode = $this->getAsString('static_info_country');
if ($countryCode === '') {
return null;
}
try {
/** @var \Tx_Oelib_Mapper_Country $countryMapper */
$countryMapper = \Tx_Oelib_MapperRegistry::get(\Tx_Oelib_M... | php | {
"resource": ""
} |
q3098 | Tx_Oelib_Model_FrontEndUser.setCountry | train | public function setCountry(\Tx_Oelib_Model_Country $country = null)
{
$countryCode = ($country !== null) ? $country->getIsoAlpha3Code() : '';
$this->setAsString('static_info_country', $countryCode);
} | php | {
"resource": ""
} |
q3099 | IntervalTree.search | train | public function search($interval)
{
if (is_null($this->top_node)) {
return array();
}
$result = $this->find_intervals($interval);
$result = array_values($result);
usort($result, function (RangeInterface $a, RangeInterface $b) {
$x = $a->getStart();
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.