_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q239100 | Formatter.apply | train | protected function apply(string $text, bool $decorated) : string
{
return $decorated && !empty($text) ? $this->stack->current()->apply($text) : $text;
} | php | {
"resource": ""
} |
q239101 | Model.scopeOrder | train | public function scopeOrder($query)
{
$order = Input::get('order', isset($this->order) ? $this->order : 'id') ?: 'id';
$direction = Input::get('direction', isset($this->direction) ? $this->direction : 'desc') ?: 'desc';
return $query->orderBy($order, $direction);
} | php | {
"resource": ""
} |
q239102 | HttpUri.parseUserInfo | train | protected function parseUserInfo()
{
// No user information? we're done
if (null === $this->userInfo) {
return;
}
// If no ':' separator, we only have a username
if (false === strpos($this->userInfo, ':')) {
$this->setUser($this->userInfo);
... | php | {
"resource": ""
} |
q239103 | HttpUri.getPort | train | public function getPort()
{
if (empty($this->port)) {
if (array_key_exists($this->scheme, static::$defaultPorts)) {
return static::$defaultPorts[$this->scheme];
}
}
return $this->port;
} | php | {
"resource": ""
} |
q239104 | HttpUri.parse | train | public function parse($uri)
{
parent::parse($uri);
if (empty($this->path)) {
$this->path = '/';
}
return $this;
} | php | {
"resource": ""
} |
q239105 | EditorContentHelper.beforeSaveBody | train | public static function beforeSaveBody($text)
{
static::correctParams();
$webfilesSubdir = static::$webfilesSubdir;
$webfilesSubdirOld = static::$webfilesSubdirOld;
$baseUrl = Yii::$app->urlManager->getBaseUrl();
$trTable = [
"src=\"{$baseUrl}/{$webfilesSubdirOld}... | php | {
"resource": ""
} |
q239106 | EditorContentHelper.uploadUrl | train | public static function uploadUrl($path = '', $uploadsAlias = '@uploads', $webfilesurlAlias = 'uploads')
{
$path = str_replace('\\', '/', $path);
$webroot = str_replace('\\', '/', Yii::getAlias('@webroot'));
$uploads = str_replace('\\', '/', Yii::getAlias($uploadsAlias));
//$subdir =... | php | {
"resource": ""
} |
q239107 | UriFactory.create | train | public function create(Environment $environment)
{
$scheme = $environment->getRequestScheme();
$host = $environment->getHost();
$port = $environment->getPort();
$query = $environment->getQueryString();
$user = $environment->getAuthUser();
$pass = $environment... | php | {
"resource": ""
} |
q239108 | Entity._tableDefinition | train | final protected function _tableDefinition() {
$annotation = Annotation::getClass($this);
/** @var \ReflectionClass $fieldClass */
$fieldClass = new \ReflectionClass('\\Gcs\Framework\Core\\Orm\\Entity\\Field');
/** @var \ReflectionClass $foreignKeyClass */
$foreignKeyClass = new ... | php | {
"resource": ""
} |
q239109 | Entity.field | train | public function field($name) {
$this->_fields['' . $name . ''] = new Field($name, $this->_name);
return $this->_fields['' . $name . ''];
} | php | {
"resource": ""
} |
q239110 | Entity.getPrimary | train | public function getPrimary() {
foreach ($this->_fields as $key => $field) {
if ($field->primary == true) {
$this->_primary = $key;
break;
}
}
} | php | {
"resource": ""
} |
q239111 | Entity.get | train | public function get($key) {
if (array_key_exists($key, $this->_fields)) {
if (gettype($this->_fields['' . $key . '']) == 'object') {
return $this->_fields['' . $key . '']->value;
}
else {
return $this->_fields['' . $key . ''];
}
... | php | {
"resource": ""
} |
q239112 | ContentController.createAction | train | public function createAction(Request $request, $type = 0)
{
/** @var ContentManager $manager */
$manager = $this->get('opifer.content.content_manager');
if ($type) {
$contentType = $this->get('opifer.content.content_type_manager')->getRepository()->find($type);
$cont... | php | {
"resource": ""
} |
q239113 | ContentController.detailsAction | train | public function detailsAction(Request $request, $id)
{
$manager = $this->get('opifer.content.content_manager');
$content = $manager->getRepository()->find($id);
$form = $this->createForm(ContentType::class, $content);
$form->handleRequest($request);
if ($form->isValid()) {
... | php | {
"resource": ""
} |
q239114 | RepositoryFactory.add | train | public function add(string $name, RepositoryFactoryInterface $factory): void
{
$this->factories[$name] = $factory;
} | php | {
"resource": ""
} |
q239115 | RepositoryFactory.remove | train | public function remove(string $name): void
{
if ($this->has($name)) {
unset($this->factories[$name]);
}
} | php | {
"resource": ""
} |
q239116 | TranslatorServiceProvider.publishDatabaseDriver | train | protected function publishDatabaseDriver() {
$this->publishes([
__DIR__.'/DriverAssets/Database/migrations' => database_path('migrations'),
]);
$this->publishes([
__DIR__.'/DriverAssets/Database/seeds' => database_path('seeds'),
]);
return $this;
} | php | {
"resource": ""
} |
q239117 | CmdHello.executeImpl | train | protected function executeImpl($params) {
/**
* Get a reference to the log.
*/
$log = $this->log;
/**
* Output some debug info to log file.
*/
$log->debug ( "CmdHello: Parameters received: " . implode ( ",", $params ) );
/**
* Preparing the result text and validating parameters.
*/
$... | php | {
"resource": ""
} |
q239118 | ArrayMap.toList | train | public function toList(bool $mutable): ArrayList
{
if ($mutable)
{
return new MutableList(array_values($this->data));
}
else
{
return new ImmutableList(array_values($this->data));
}
} | php | {
"resource": ""
} |
q239119 | HasChildren.append | train | public function append(Node $node)
{
if (!is_array($this->_children)) {
$this->_children = [];
}
$this->_children[] = $node;
return $this;
} | php | {
"resource": ""
} |
q239120 | FactoryHttpHeader.plugins | train | static function plugins()
{
if (! self::isEnabledPlugins() )
throw new \Exception('Using Plugins depends on Poirot/Ioc; that not exists currently.');
if (! self::$pluginManager )
self::$pluginManager = new PluginsHttpHeader;
return self::$pluginManager;
} | php | {
"resource": ""
} |
q239121 | FactoryHttpHeader.givePluginManager | train | static function givePluginManager(PluginsHttpHeader $pluginsManager)
{
if ( self::$pluginManager !== null )
throw new exImmutable('Header Factory Has Plugin Manager, and can`t be changed.');
self::$pluginManager = $pluginsManager;
} | php | {
"resource": ""
} |
q239122 | LocalCache.forget | train | public function forget(string $key): bool
{
$key = $this->hashKey($key);
if (\array_key_exists($key, $this->cache)) {
unset($this->cache[$key]);
return true;
}
return false;
} | php | {
"resource": ""
} |
q239123 | LocalCache.remember | train | public function remember(string $key, callable $callBack)
{
$existing = $this->get($key);
if ($existing !== null) {
return $existing;
}
$result = $callBack();
return $this->put($key, $result);
} | php | {
"resource": ""
} |
q239124 | LocalCache.get | train | public function get(string $key)
{
$key = $this->hashKey($key);
if (\array_key_exists($key, $this->cache)) {
$this->hits++;
return $this->cache[$key];
}
$this->misses++;
return null;
} | php | {
"resource": ""
} |
q239125 | LocalCache.put | train | public function put(string $key, $value)
{
$this->cache[$this->hashKey($key)] = $value;
return $value;
} | php | {
"resource": ""
} |
q239126 | RequestHandlerProvider.handleHandleHttpRequestEvent | train | public function handleHandleHttpRequestEvent(HandleHttpRequestEvent $event) {
$event->setResponse(
$this->requestHandler->handle($event->getRequest())
);
} | php | {
"resource": ""
} |
q239127 | RequestHandlerProvider.shareInstancesInContainer | train | protected function shareInstancesInContainer() {
$this->container->set([Router::class, IRouter::class], $this->router);
$this->container->set(
[RequestHandler::class, IRequestHandler::class], $this->requestHandler
);
} | php | {
"resource": ""
} |
q239128 | RequestHandlerProvider.loadRoutesFromConfig | train | protected function loadRoutesFromConfig() {
$config = $this->config->getRaw('routing', []);
$this->routerConfigurator->processConfig($this->router, $config);
} | php | {
"resource": ""
} |
q239129 | Template.output | train | public function output()
{
if (!file_exists($this->_file))
throw new RuntimeException(
"Error loading template file: $this->_file.",
1
);
$output = file_get_contents($this->_file);
foreach ($this->_vars as $key => $value) {
... | php | {
"resource": ""
} |
q239130 | Validation.make | train | public function make(array $data = [],array $validationRules = [],array $filterRules = [])
{
$data = $this->sanitize($data);
$this->validation_rules($validationRules);
$this->filter_rules($filterRules);
return $this->run($data);
} | php | {
"resource": ""
} |
q239131 | Phi.make | train | public function make($alias, array $arguments = []) {
// Iterate over each resolver and see if they have a binding override
foreach($this->_resolvers as $resolver) {
// Ask the resolver for the alias' binding
$binding = $resolver->make($alias, $arguments);
// If it's not null, we got a ... | php | {
"resource": ""
} |
q239132 | PHPConsistent_Main.start | train | public function start()
{
$this->_starttime = microtime(true);
if (extension_loaded('xdebug') === false) {
return false;
}
if (is_null($this->_traceFile) === true) {
$this->_traceFile = tempnam(sys_get_temp_dir(), 'PHPConsistent_');
}
ini_set('xdeb... | php | {
"resource": ""
} |
q239133 | PHPConsistent_Main.analyze | train | public function analyze()
{
if (!file_exists($this->_traceFile)) {
return false;
}
$this->processFunctionCalls();
unlink($this->_traceFile);
if (file_exists($this->_traceFile . '.xt')) {
unlink($this->_traceFile . '.xt');
}
if (count($... | php | {
"resource": ""
} |
q239134 | PHPConsistent_Main.addParamTypeFailure | train | protected function addParamTypeFailure($fileName, $fileLine, $calledFunction, $parameterNumber, $parameterName, $expectedType, $calledType)
{
$data = 'Invalid type calling ' . $calledFunction . ' : parameter ' . $parameterNumber . ' (' . $parameterName . ') should be of type ' . $expectedType . ' but got '... | php | {
"resource": ""
} |
q239135 | PHPConsistent_Main.addParamNameMismatchFailure | train | protected function addParamNameMismatchFailure($fileName, $fileLine, $calledFunction, $parameterNumber, $expectedName, $calledName)
{
$data = 'Parameter names in function definition and docblock don\'t match when calling ' . $calledFunction . ' : parameter ' . $parameterNumber . ' (' . $calledName . ') shou... | php | {
"resource": ""
} |
q239136 | PHPConsistent_Main.addParamCountMismatchFailure | train | protected function addParamCountMismatchFailure($fileName, $fileLine, $calledFunction, $expectedCount, $actualCount)
{
$data = 'Parameter count in function definition and docblock don\'t match when calling ' . $calledFunction . ' : function has ' . $actualCount . ' but should be ' . $expectedCount . ' accor... | php | {
"resource": ""
} |
q239137 | PHPConsistent_Main.reportFailure | train | protected function reportFailure($fileName, $fileLine, $data)
{
switch ($this->_log) {
case self::LOG_TO_FILE:
file_put_contents(
$this->_logLocation,
$data . ' - in ' . $fileName . ' (line ' . $fileLine . ')',
FILE_APPE... | php | {
"resource": ""
} |
q239138 | Kohana_Table_Row.& | train | function &add_cell($name = null) {
if (!$name) {
$name = uniqid(microtime(true), true);
}
$this->cells[$name] = new KHtml_Table_Cell();
return $this->cells[$name];
} | php | {
"resource": ""
} |
q239139 | DiscoUtils.getIdpsForSp | train | public static function getIdpsForSp(
$spEntityId,
$metadataPath
) {
$idpEntries = Metadata::getIdpMetadataEntries($metadataPath);
return self::getReducedIdpList(
$idpEntries,
$metadataPath,
$spEntityId);
} | php | {
"resource": ""
} |
q239140 | DB.prepareStatement | train | private function prepareStatement($query, $parameters) {
$stmt = $this->db_connection->prepare($query);
if (!empty($parameters)) {
foreach ($parameters as $key => $val) {
$stmt->bindValue($key, $val);
}
}
return $stmt;... | php | {
"resource": ""
} |
q239141 | DB.deleteWhere | train | function deleteWhere($table_name, $where_with_placeholders, $named_parameters) {
if (empty($where_with_placeholders) || !$table_name) {
return false;
}
$sql_query = 'DELETE FROM ' . $table_name . ' WHERE ' . $where_with_placeholders;
Event::dispatch(Eve... | php | {
"resource": ""
} |
q239142 | DB.getEnumeratedParameterList | train | private function getEnumeratedParameterList($parameter_name, $param_array) {
$result = [];
if ($param_array) {
foreach ($param_array as $k => $v) {
$result[ ':' . $parameter_name . '_' . $k ] = $v;
}
}
return $result;
... | php | {
"resource": ""
} |
q239143 | DB.updateWhere | train | public function updateWhere($table_name, $update_values, $where_with_placeholders, $named_parameters = null) {
$all_params = empty($named_parameters) ? $update_values : array_merge($update_values, $named_parameters);
Event::dispatch(EventData::forBefore(Event::BEFORE_UPDATE, $table_name, $all_p... | php | {
"resource": ""
} |
q239144 | MenuWrapper.render | train | public function render($data)
{
if (isset($data['content'])) {
$this->config(['content' => $data['content']]);
$content = new MenuContent($this->config(), $this->_here);
$group = isset($data['group'])? $data['group'] : null;
$contents = $content->render($group... | php | {
"resource": ""
} |
q239145 | GoogleMap.addAdresse | train | function addAdresse($params=array())
{
$index = count($this->coordonnees);
if (isset($params['adresse']) && $params['adresse']!='') {
$this->coordonnees[$index]['adresse'] = $params['adresse'];
} else {
$this->coordonnees[$index]['adresse'] = '';
}
i... | php | {
"resource": ""
} |
q239146 | GoogleMap.getHTML | train | public function getHTML()
{
$html="<div id='".$this->googleMapNameId."' style='width: ".$this->googleMapWidth."px; height: ".$this->googleMapHeight."px; ".$this->divStyle."'>Veuilliez patienter pendant le chargement de la carte...</div>";
//$html.="<script >";
/*
if (count($th... | php | {
"resource": ""
} |
q239147 | GoogleMap.distance | train | public function distance($lat1=0, $lon1=0, $lat2=0, $lon2=0)
{
$theta = $lon1 - $lon2;
$dist = sin(_deg2rad($lat1)) * sin(_deg2rad($lat2)) + cos(_deg2rad($lat1)) * cos(_deg2rad($lat2)) * cos(_deg2rad($theta));
$dist = acos($dist);
$dist = _rad2deg($dist);
$dist = $... | php | {
"resource": ""
} |
q239148 | ActionProcessorDataCollector.getActions | train | public function getActions()
{
$actions = [];
foreach ($this->data['actions'] as $action) {
$name = $action['name'];
$time = isset($action['time'])
? $action['time']
: 0;
if (isset($actions[$name])) {
$actions[$name]... | php | {
"resource": ""
} |
q239149 | ActionProcessorDataCollector.getProcessors | train | public function getProcessors()
{
$processors = [];
foreach ($this->data['actions'] as $action) {
if (isset($action['processors'])) {
foreach ($action['processors'] as $processor) {
$id = $processor['id'];
$time = isset($processor['... | php | {
"resource": ""
} |
q239150 | ActionProcessorDataCollector.getProcessorCount | train | public function getProcessorCount()
{
$count = 0;
foreach ($this->data['actions'] as $action) {
if (isset($action['processors'])) {
$count += count($action['processors']);
}
}
return $count;
} | php | {
"resource": ""
} |
q239151 | ActionProcessorDataCollector.getTotalTime | train | public function getTotalTime()
{
if (null === $this->totalTime) {
$this->totalTime = 0;
foreach ($this->data['actions'] as $action) {
if (isset($action['time'])) {
$this->totalTime += $action['time'];
}
}
for... | php | {
"resource": ""
} |
q239152 | FormForm.SaveElement | train | protected function SaveElement()
{
$this->form->SetMethod($this->Value('Method'));
$this->form->SetSaveTo($this->Value('SaveTo'));
$this->form->SetSendFrom($this->Value('SendFrom'));
$this->form->SetSendTo($this->Value('SendTo'));
$this->form->SetRedirectUrl($this->selector->... | php | {
"resource": ""
} |
q239153 | Cache.exists | train | public function exists( $key, $lifetime )
{
if ( !$this->cache_dir )
{
$this->initializeCacheDir();
}
if ( !file_exists($this->cache_dir . $key . ".html") )
{
return false;
}
$file_lifetime = time() - filectime( $this->cache_dir . $ke... | php | {
"resource": ""
} |
q239154 | RedisContainer.prefill | train | protected function prefill()
{
if (!$this->prefill || $this->prefilled) {
return;
}
try {
$this->definitions = $this->getReadConnection()->hGetAll($this->hashName);
$this->prefilled = true;
} catch (\Exception $exception) {
throw new R... | php | {
"resource": ""
} |
q239155 | System.write | train | public function write($message)
{
$written = false;
if ($this->output_allowed) {
$written = error_log($message);
}
return $written;
} | php | {
"resource": ""
} |
q239156 | Configuration.get | train | public static function get($fileName, $driverClass = null)
{
$configuration = new Configuration($fileName, $driverClass);
return $configuration->initialize();
} | php | {
"resource": ""
} |
q239157 | Configuration.driverClass | train | private function driverClass()
{
if (null == $this->driverClass) {
$this->driverClass = $this->determineDriver($this->file);
}
return $this->driverClass;
} | php | {
"resource": ""
} |
q239158 | Configuration.determineDriver | train | private function determineDriver($file)
{
$exception = new InvalidArgumentException(
"Cannot initialize the configuration driver. I could not determine ".
"the correct driver class."
);
if (is_null($file) || !is_string($file)) {
throw $exception;
... | php | {
"resource": ""
} |
q239159 | Configuration.composeFileName | train | private function composeFileName($name)
{
if (is_null($name)) {
return $name;
}
$ext = $this->determineExtension();
$withExtension = $this->createName($name, $ext);
list($found, $fileName) = $this->searchFor($name, $withExtension);
return $found ? $file... | php | {
"resource": ""
} |
q239160 | Configuration.determineExtension | train | private function determineExtension()
{
$ext = 'php';
if (in_array($this->driverClass, $this->extensionToDriver)) {
$map = array_flip($this->extensionToDriver);
$ext = $map[$this->driverClass];
}
return $ext;
} | php | {
"resource": ""
} |
q239161 | Configuration.searchFor | train | private function searchFor($name, $withExtension)
{
$found = false;
$fileName = $name;
foreach (self::$paths as $path) {
$fileName = "{$path}/$withExtension";
if (is_file($fileName)) {
$found = true;
break;
}
}
... | php | {
"resource": ""
} |
q239162 | Configuration.createConfigurationDriver | train | private function createConfigurationDriver()
{
$reflection = new \ReflectionClass($this->driverClass());
/** @var ConfigurationInterface $config */
$config = $reflection->hasMethod('__construct')
? $reflection->newInstanceArgs([$this->file])
: $reflection->newInstanc... | php | {
"resource": ""
} |
q239163 | Configuration.setProperties | train | private function setProperties($option)
{
$priority = isset($option[2]) ? $option[2] : 0;
$this->driverClass = isset($option[1]) ? $option[1] : null;
$this->file = isset($option[0]) ? $this->composeFileName($option[0]) : null;
return $priority;
} | php | {
"resource": ""
} |
q239164 | Configuration.fixOptions | train | private function fixOptions()
{
$options = (is_array($this->file))
? $this->file
: [[$this->file]];
return $options;
} | php | {
"resource": ""
} |
q239165 | PasswordChangeRequestController.createAction | train | public function createAction()
{
$success = null;
$this->paragraphLayout();
/* @var $form \Zend\Form\Form */
$request = $this->getRequest();
$data = $request->getPost();
$service = $this->getServiceLocator();
$model = $service->get( 'Grid\Use... | php | {
"resource": ""
} |
q239166 | PasswordChangeRequestController.resolveAction | train | public function resolveAction()
{
$success = null;
$failed = null;
$service = $this->getServiceLocator();
$userModel = $service->get( 'Grid\User\Model\User\Model' );
$confirm = $service->get( 'Grid\User\Model\ConfirmHash' );
$hash = $this->params()... | php | {
"resource": ""
} |
q239167 | UrlManagerInModule.getSitetreeManager | train | public function getSitetreeManager()
{
if (empty(static::$_sitetreeManager)) {
$module = Yii::$app->getModule($this->sitetreeModuleUniqueId);
if (!empty($module) && $module instanceof UniModule) {
$mgr = $module->getDataModel($this->sitetreeManagerAlias);
... | php | {
"resource": ""
} |
q239168 | AkismetFieldSet.getInputFilterSpecification | train | public function getInputFilterSpecification(): array
{
return [
'api_key' => [
'required' => false,
'filters' => [
['name' => StripTags::class],
['name' => StringTrim::class],
],
'validators' ... | php | {
"resource": ""
} |
q239169 | LoadClassMetadataListener.initDefaultAnnotationReader | train | private function initDefaultAnnotationReader()
{
if (null !== self::$defaultAnnotationReader) {
return;
}
$docParser = new DocParser();
$docParser->setImports([
'Bits' => 'KonstantinKuklin\\DoctrineCompressedFields\\Annotation',
]);
$docParser... | php | {
"resource": ""
} |
q239170 | TemplatesController.listAction | train | public function listAction()
{
$repository = $this->get('phlexible_media_template.template_manager');
$allTemplates = $repository->findAll();
$templates = [];
foreach ($allTemplates as $template) {
if (substr($template->getKey(), 0, 4) === '_mm_') {
cont... | php | {
"resource": ""
} |
q239171 | TemplatesController.createAction | train | public function createAction(Request $request)
{
$templateRepository = $this->get('phlexible_media_template.template_manager');
$type = $request->get('type');
$key = $request->get('key');
switch ($type) {
case 'image':
$template = new ImageTemplate();
... | php | {
"resource": ""
} |
q239172 | BlockLogEntryRepository.findDistinctByRootId | train | public function findDistinctByRootId($rootId)
{
$qb = $this->createQueryBuilder('l')
->andWhere('l.rootId = :rootId')
->groupBy('l.rootVersion')
->setParameter('rootId', $rootId);
return $qb->getQuery()->getResult();
} | php | {
"resource": ""
} |
q239173 | BlockLogEntryRepository.getLogEntriesRoot | train | public function getLogEntriesRoot($entity, $rootVersion = null)
{
$q = $this->getLogEntriesQueryRoot($entity, $rootVersion);
return $q->getResult();
} | php | {
"resource": ""
} |
q239174 | BlockLogEntryRepository.getLogEntriesQueryRoot | train | public function getLogEntriesQueryRoot($entity, $rootVersion = null)
{
$wrapped = new EntityWrapper($entity, $this->_em);
$objectClass = $wrapped->getMetadata()->name;
$meta = $this->getClassMetadata();
$dql = "SELECT log FROM {$meta->name} log";
$dql .= " WHERE log.objectId ... | php | {
"resource": ""
} |
q239175 | ViewController.actionIndex | train | public function actionIndex($slug)
{
$this->trigger(self::EVENT_BEFORE_VIEW_SHOW);
$data['slug'] = $slug;
$data['route'] = '/' . $this->getRoute();
$videoFinder = new VideoFinder();
$data['video'] = $videoFinder->findBySlug($slug);
if (empty($data['video'])) {
... | php | {
"resource": ""
} |
q239176 | Cookie.getExpireTime | train | private function getExpireTime(array $expires = ['m' => 1]): int
{
$expireTime = \time();
if (\is_array($expires)) {
if (isset($expires['y'])) {
$expireTime += \intval(0 + $expires['y']) * 60 * 60 * 24 * 365;
}
if (isset($expires['m'])) {
... | php | {
"resource": ""
} |
q239177 | Cookie.get | train | public function get(string $variableName = null, int $type = Variables::TYPE_STRING)
{
if ($variableName === null) {
throw new BadMethodCallException('Variable name must be specified');
}
if (isset($this->variables[$variableName])) {
return $this->cast($this->variable... | php | {
"resource": ""
} |
q239178 | Cookie.set | train | public function set(string $variableName = null, $variableValue = null, array $expires = ['m' => 1],
bool $encrypted = true): Cookie
{
if ($variableName === null) {
throw new BadMethodCallException('Variable name must be specified');
}
\setcookie(
... | php | {
"resource": ""
} |
q239179 | SystemService.executeCommand | train | public function executeCommand(string $cmd, array $arguments = [], array $options = [])
{
$options = array_replace(
[
'overrideExitCode' => null,
'exceptionMessage' => 'There was an error while executing the command.',
'returnString' => fals... | php | {
"resource": ""
} |
q239180 | SystemService.mkdir | train | public function mkdir(string $dir, array $options = []): SystemService
{
$options = array_replace(
[
'mode' => 0777,
'recursive' => true,
'context' => null
],
$options
);
if (file_exists($... | php | {
"resource": ""
} |
q239181 | SystemService.rm | train | public function rm(string $fileOrDirectory, array $options = []): SystemService
{
$options = array_replace(
[
'force' => false,
'recursive' => false,
'context' => null,
'skipIfAlreadyRemoved... | php | {
"resource": ""
} |
q239182 | SystemService.scandir | train | public function scandir(string $dir, array $options = [])
{
$options = array_replace(
[
'sort' => SCANDIR_SORT_NONE,
'context' => null,
'recursive' => false,
'skipDots' => true,
'skipSymlinks'... | php | {
"resource": ""
} |
q239183 | Dispatcher.getRoutes | train | public function getRoutes()
{
$router_factory = new RouterFactory;
$router = $router_factory->newInstance();
$routes_file = $this->getAppResourcePath('config/routes.php');
if (file_exists($routes_file)) {
// Let the app specify it's own routes.
include_once($routes_file);
} else {
// Fall back on ... | php | {
"resource": ""
} |
q239184 | PromptableOptionsTrait.addPrompts | train | protected function addPrompts(array $options = [])
{
$resolver = $this->getConfigResolver();
$optionNames = [];
foreach ($options as $key => $value) {
if (is_string($value)) {
$optionNames[] = $value;
$this->promptConfig[$key] = $resolver->resolve... | php | {
"resource": ""
} |
q239185 | Content.addAccessibility | train | public function addAccessibility($items): array
{
global $wp;
$current_url = home_url(add_query_arg(array(),$wp->request));
if (! isset($_GET['readable']) && get_field('easy_reading_select') == true) {
$items[] = '<a href="' . add_query_arg('readable', '1', $current_url) . '" class=""><i class="pricon pricon... | php | {
"resource": ""
} |
q239186 | Content.easyReadingLead | train | public function easyReadingLead($lead)
{
if (isset($_GET['readable']) && $_GET['readable'] == '1' && get_field('easy_reading_select') == true && in_the_loop() && is_main_query()) {
return '';
}
return $lead;
} | php | {
"resource": ""
} |
q239187 | Content.easyReadingContent | train | public function easyReadingContent($content)
{
global $post;
if (isset($_GET['readable']) && $_GET['readable'] == '1' && get_field('easy_reading_select') == true && is_object($post) && isset($post->post_content) && in_the_loop() && is_main_query()) {
$post_content = $post->post_content;
if (strpos($post_con... | php | {
"resource": ""
} |
q239188 | PreparedMYSQL.executeUpdate | train | public function executeUpdate(): bool {
$temp = false;
if ($this->build()) {
$this->conect->query($this->generate);
$this->generate = "";
$temp = true;
}
return $temp;
} | php | {
"resource": ""
} |
q239189 | FormBuilder.setContext | train | public function setContext(FormContext $context){
$old = $this->context;
$this->context = $context;
return $old;
} | php | {
"resource": ""
} |
q239190 | FormBuilder.hiddenField | train | public function hiddenField($key, $value=null, array $attr=[]){
$this->context->hiddenField($key, $value, $attr);
} | php | {
"resource": ""
} |
q239191 | FormBuilder.textField | train | public function textField($key, $label=null, array $attr=[]){
$field = $this->factory("text", $key, $label, $attr);
return $this->addField($field);
} | php | {
"resource": ""
} |
q239192 | FormBuilder.hint | train | public function hint($text, $label=null, array $attr=[]) {
if ( $this->unbuffered() ){
trigger_error("Cannot use hint in unbuffered mode", E_USER_ERROR);
}
$field = $this->factory("hint", $text, $label, $attr);
return $this->addField($field);
} | php | {
"resource": ""
} |
q239193 | FormBuilder.manual | train | public function manual($key, $label, $content, $hint=false){
$field = new ManualField($key, $label, $content, $hint);
$this->addField($field);
if ( $this->unbuffered() ){
echo $field->getContent() . "\n";
}
return $field;
} | php | {
"resource": ""
} |
q239194 | FormBuilder.uploadField | train | public function uploadField($key, $label=null, array $attr=[]) {
$remove = false;
$current = false;
if ( array_key_exists('remove', $attr) ){
$remove = $attr['remove'];
unset($attr['remove']);
}
if ( array_key_exists('current', $attr) ){
$current = $attr['current'];
unset($attr['current']);
}
... | php | {
"resource": ""
} |
q239195 | FormBuilder.group | train | public function group($label, callable $callback, array $attr=[]){
if ( $this->unbuffered() ){
trigger_error("Cannot use Form groups in unbuffered mode", E_USER_ERROR);
}
$field = new FormGroup($this->context, $label, $callback, $attr);
return $this->addField($field);
} | php | {
"resource": ""
} |
q239196 | FormBuilder.fieldset | train | public function fieldset($label, callable $callback){
if ( $this->unbuffered() ){
trigger_error("Cannot use Form fieldsets in unbuffered mode", E_USER_ERROR);
}
$field = new FormFieldset($this->context, $label, $callback);
return $this->addField($field);
} | php | {
"resource": ""
} |
q239197 | FormBuilder.staticValue | train | public function staticValue($key, $label=false, array $attr=[]){
$field = $this->factory('static', $key, $label, $attr);
return $this->addField($field);
} | php | {
"resource": ""
} |
q239198 | FormBuilder.link | train | public function link($text, $href, $label=false, array $attr=[]){
$field = $this->factory('link', false, $label, array_merge(array('text' => $text, 'href' => $href), $attr));
return $this->addField($field);
} | php | {
"resource": ""
} |
q239199 | FormBuilder.checkbox | train | public function checkbox($key, $text, $label=null, array $attr=[]) {
$this->hiddenField($key, '0');
$attr['text'] = $text;
$field = $this->factory('checkbox', $key, $label, $attr);
return $this->addField($field);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.