_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q235200 | pakeApp.display_tasks_and_comments | train | public function display_tasks_and_comments()
{
$width = 0;
$tasks = pakeTask::get_tasks();
foreach ($tasks as $name => $task) {
$w = strlen(pakeTask::get_mini_task_name($name));
if ($w > $width)
$width = $w;
}
$width += mb_strlen(pakeCo... | php | {
"resource": ""
} |
q235201 | pakeApp.display_prerequisites | train | public function display_prerequisites()
{
foreach (pakeTask::get_tasks() as $name => $task) {
echo self::$EXEC_NAME." ".pakeTask::get_mini_task_name($name)."\n";
foreach ($task->get_prerequisites() as $prerequisite) {
echo " $prerequisite\n";
}
... | php | {
"resource": ""
} |
q235202 | pakeApp.run_help | train | public static function run_help($task, $args)
{
if (count($args) == 0) {
self::get_instance()->help();
return;
}
$victim_name = $args[0];
$task_name = pakeTask::taskname_from_abbreviation($victim_name);
$victim = null;
foreach (pakeTask::get... | php | {
"resource": ""
} |
q235203 | AbstractToken.findNextToken | train | public function findNextToken($matcher)
{
$nextToken = $this->nextToken;
while (null !== $nextToken) {
if ($nextToken->matches($matcher)) {
return new Some($nextToken);
}
$nextToken = $nextToken->nextToken;
}
return None::create()... | php | {
"resource": ""
} |
q235204 | AbstractToken.findPreviousToken | train | public function findPreviousToken($matcher)
{
$previousToken = $this->previousToken;
while (null !== $previousToken) {
if ($previousToken->matches($matcher)) {
return new Some($previousToken);
}
$previousToken = $previousToken->previousToken;
... | php | {
"resource": ""
} |
q235205 | AbstractToken.getIndentation | train | public function getIndentation()
{
$indentation = $this->getLineIndentation();
if($this->isFirstTokenOnLine() && $this->matches(T_WHITESPACE)) {
$indentation = '';
}
return $indentation . str_repeat(' ', $this->getStartColumn() - strlen($indentation));
} | php | {
"resource": ""
} |
q235206 | AbstractToken.getContentUntil | train | public function getContentUntil(AbstractToken $token)
{
if ($this === $token) {
return '';
}
$content = $this->getContent();
$next = $this->nextToken;
while ($next && $next !== $token) {
$content .= $next->getContent();
$next = $next->nex... | php | {
"resource": ""
} |
q235207 | AbstractToken.getLineIndentation | train | public function getLineIndentation()
{
$first = $this->getFirstTokenOnLine();
if ( ! $first->matches(T_WHITESPACE)) {
return '';
}
return $first->getContentUntil($first->findNextToken('NO_WHITESPACE')->get());
} | php | {
"resource": ""
} |
q235208 | AbstractToken.matches | train | public final function matches($matcher)
{
// Handle negations of matchers.
if (is_string($matcher) && substr($matcher, 0, 3) === 'NO_') {
return ! $this->matches(substr($matcher, 3));
}
// Handle some special cases.
if ($matcher === 'WHITESPACE_OR_COMMENT') {
... | php | {
"resource": ""
} |
q235209 | TaskCommand.getOptions | train | private function getOptions()
{
$inputString = (string) $this->input;
$options = [];
// Remove the first two arguments from the array (c/call and the name)
$content = explode(' ', $inputString, 3);
if (sizeof($content) > 2 && strpos($inputString, '=') === false) {
... | php | {
"resource": ""
} |
q235210 | BreadcrumbsServiceProvider.registerBreadcrumbsService | train | private function registerBreadcrumbsService()
{
$this->singleton(Contracts\Breadcrumbs::class, function ($app) {
/** @var \Illuminate\Contracts\Config\Repository $config */
$config = $app['config'];
return new Breadcrumbs(
$config->get('breadcrumbs.temp... | php | {
"resource": ""
} |
q235211 | ContainerBuilder.compile | train | public function compile()
{
if (null !== $this->parameterBag) {
$blocks = $this->getCoreBlocks();
$blocks = array_merge($blocks, $this->getThirdPartyBlocks());
foreach ($blocks as $block) {
$this->prepareBlock($block);
}
}
Conf... | php | {
"resource": ""
} |
q235212 | BillogramObject.sendReminder | train | public function sendReminder($method = null)
{
if ($method) {
if (!in_array($method, array('Email', 'Letter')))
throw new InvalidFieldValueError("'method' must be either " .
"'Email' or 'Letter'");
return $this->performEvent('remind', array('metho... | php | {
"resource": ""
} |
q235213 | BillogramObject.resend | train | public function resend($method = null)
{
if ($method) {
if (!in_array($method, array('Email', 'Letter')))
throw new InvalidFieldValueError("'method' must be either " .
"'Email' or 'Letter'");
return $this->performEvent('resend', array('method' => ... | php | {
"resource": ""
} |
q235214 | BillogramObject.getInvoicePdf | train | public function getInvoicePdf($letterId = null, $invoiceNo = null)
{
$params = array();
if ($letterId)
$params['letter_id'] = $letterId;
if ($invoiceNo)
$params['invoice_no'] = $invoiceNo;
$response = $this->api->get(
$this->url() . '.pdf',
... | php | {
"resource": ""
} |
q235215 | BillogramObject.getAttachmentPdf | train | public function getAttachmentPdf()
{
$response = $this->api->get(
$this->url() . '/attachment.pdf',
null,
'application/json'
);
return base64_decode($response->data->content);
} | php | {
"resource": ""
} |
q235216 | BillogramObject.attachPdf | train | public function attachPdf($filepath)
{
$content = file_get_contents($filepath);
$filename = basename($filepath);
return $this->performEvent('attach', array('filename' => $filename, 'content' => base64_encode($content)));
} | php | {
"resource": ""
} |
q235217 | CalendarConfig.settings | train | public static function settings($settings = null)
{
if ($settings) {
//set mode
self::$settings = self::mergeSettings(self::$settings, $settings);
} else {
//get mode
}
//always return settings
return self::$settings;
} | php | {
"resource": ""
} |
q235218 | CalendarConfig.mergeSettings | train | protected static function mergeSettings($Arr1, $Arr2)
{
foreach ($Arr2 as $key => $Value) {
if (array_key_exists($key, $Arr1) && is_array($Value)) {
$Arr1[$key] = self::mergeSettings($Arr1[$key], $Arr2[$key]);
} else {
$Arr1[$key] = $Value;
... | php | {
"resource": ""
} |
q235219 | CalendarConfig.subpackage_settings | train | public static function subpackage_settings($subpackage)
{
$s = self::settings();
if (isset($s[$subpackage])) {
return $s[$subpackage];
}
} | php | {
"resource": ""
} |
q235220 | CalendarConfig.subpackage_setting | train | public static function subpackage_setting($subpackage, $setting)
{
$s = self::subpackage_settings($subpackage);
if (isset($s[$setting])) {
return $s[$setting];
}
} | php | {
"resource": ""
} |
q235221 | CalendarConfig.init | train | public static function init($settings = null)
{
if (is_array($settings)) {
//merging settings (and setting the global settings)
//settings should be submitted via an array
$settings = self::settings($settings);
} else {
$settings = self::settings();
... | php | {
"resource": ""
} |
q235222 | ResultFormatterHelper.formatQueryResult | train | public function formatQueryResult(QueryResultInterface $result, OutputInterface $output, $elapsed)
{
$table = new Table($output);
$table->setHeaders(array_merge([
'Path',
], $result->getColumnNames()));
foreach ($result->getRows() as $row) {
$values = array_m... | php | {
"resource": ""
} |
q235223 | pakeFinder.type | train | public static function type($name)
{
$finder = new pakeFinder();
if (strtolower(substr($name, 0, 3)) == 'dir') {
$finder->type = 'directory';
} else {
if (strtolower($name) == 'any') {
$finder->type = 'any';
} else {
$finde... | php | {
"resource": ""
} |
q235224 | pakeFinder.pattern_to_regex | train | private function pattern_to_regex($pattern)
{
if (substr($pattern, -1) == '/') {
$pattern .= '**';
}
$regex = '|^';
foreach (explode('/', $pattern) as $i => $piece) {
if ($i > 0) {
$regex .= preg_quote('/', '|');
}
if ... | php | {
"resource": ""
} |
q235225 | pakeFinder.pattern | train | public function pattern()
{
$patterns = func_get_args();
foreach (func_get_args() as $pattern) {
$this->patterns[] = $this->pattern_to_regex($pattern);
}
return $this;
} | php | {
"resource": ""
} |
q235226 | pakeFinder.not_name | train | public function not_name()
{
$args = func_get_args();
$this->names = array_merge($this->names, $this->args_to_array($args, true));
return $this;
} | php | {
"resource": ""
} |
q235227 | pakeFinder.prune | train | public function prune()
{
$args = func_get_args();
$this->prunes = array_merge($this->prunes, $this->args_to_array($args));
return $this;
} | php | {
"resource": ""
} |
q235228 | pakeFinder.discard | train | public function discard()
{
$args = func_get_args();
$this->discards = array_merge($this->discards, $this->args_to_array($args));
return $this;
} | php | {
"resource": ""
} |
q235229 | pakeFinder.exec | train | public function exec()
{
$args = func_get_args();
for ($i = 0; $i < count($args); $i++) {
if (is_array($args[$i]) && !method_exists($args[$i][0], $args[$i][1])) {
throw new pakeException('Method ' . $args[$i][1] . ' does not exist for object ' . $args[$i][0]);
... | php | {
"resource": ""
} |
q235230 | SimpleClass.create | train | public function create($data)
{
$response = $this->api->post($this->url(), $data);
$className = $this->objectClass;
return new $className($this->api, $this, $response->data);
} | php | {
"resource": ""
} |
q235231 | SimpleClass.url | train | public function url($object = null)
{
if (is_object($object)) {
$objectIdField = $this->objectIdField;
return $this->urlName . '/' . $object->$objectIdField;
} elseif ($object) {
return $this->urlName . '/' . $object;
}
return $this->urlName;
... | php | {
"resource": ""
} |
q235232 | NodeHelper.assertNodeIsVersionable | train | public function assertNodeIsVersionable(NodeInterface $node)
{
if (!$this->nodeHasMixinType($node, 'mix:versionable')) {
throw new \OutOfBoundsException(sprintf(
'Node "%s" is not versionable', $node->getPath()
));
}
} | php | {
"resource": ""
} |
q235233 | SessionStore.has | train | public function has($key): bool
{
return $this->exists($key) && null !== $this->attributes[$key];
} | php | {
"resource": ""
} |
q235234 | SessionStore.setRequestOnHandler | train | public function setRequestOnHandler($request)
{
if ($this->handlerNeedsRequest()) {
/** @var NeedRequestInterface $handler */
$handler = $this->getHandler();
$handler->setRequest($request);
}
} | php | {
"resource": ""
} |
q235235 | CalendarColorExtension.getColorWithHash | train | public function getColorWithHash()
{
$color = $this->owner->Color;
if (strpos($color, '#') === false) {
return '#' . $color;
} else {
return $color;
}
} | php | {
"resource": ""
} |
q235236 | MockAdapter.mapRequestToFile | train | protected function mapRequestToFile($method, $uri, $parameters)
{
$filename = strtolower($method).'_';
$filename .= $this->cleanPath($uri);
$suffix = $this->mapRequestParameters($parameters);
return $this->fixturesPath.$filename.$suffix.'.json';
} | php | {
"resource": ""
} |
q235237 | MockAdapter.cleanPath | train | protected function cleanPath($uri)
{
$urlPath = parse_url($uri, PHP_URL_PATH);
$uri = str_replace('v1/', '', $urlPath);
$path = preg_replace('/(\/\w{10}$|self|\d*)/', '', $uri);
return trim(preg_replace('/\/{1,2}|\-/', '_', $path), '_');
} | php | {
"resource": ""
} |
q235238 | MockAdapter.mapRequestParameters | train | protected function mapRequestParameters($parameters)
{
if (empty($parameters) || !array_key_exists('query', $parameters)) {
return '';
}
$exclude = [
'q',
'count',
'min_id',
'max_id',
'min_tag_id',
'max_tag_... | php | {
"resource": ""
} |
q235239 | QueryConverter.getOldFacetParams | train | private function getOldFacetParams(array $facetBuilders)
{
$facetParamsGrouped = array_map(
function ($facetBuilder) {
return $this->facetBuilderVisitor->visitBuilder($facetBuilder, spl_object_hash($facetBuilder));
},
$this->filterOldFacetBuilders($facetBu... | php | {
"resource": ""
} |
q235240 | Response.getRaw | train | public function getRaw($key = null)
{
return $key === null
? $this->raw
: $this->raw[$key];
} | php | {
"resource": ""
} |
q235241 | Response.get | train | public function get()
{
return $this->isCollection($this->data)
? new Collection($this->data)
: $this->data;
} | php | {
"resource": ""
} |
q235242 | Response.isCollection | train | protected function isCollection($data)
{
$isCollection = false;
if ($data === null) {
return $isCollection;
}
if (!$this->isRecord($data)) {
$isCollection = true;
}
return $isCollection;
} | php | {
"resource": ""
} |
q235243 | Response.isRecord | train | protected function isRecord($data)
{
if ($data instanceof Collection) {
return false;
}
$keys = array_keys($data);
return (in_array('id', $keys, true) || in_array('name', $keys, true));
} | php | {
"resource": ""
} |
q235244 | HasBreadcrumbs.registerBreadcrumbs | train | protected function registerBreadcrumbs($container, array $item = [])
{
$this->setBreadcrumbsContainer($container);
breadcrumbs()->register('main', function(Builder $bc) use ($item) {
if (empty($item)) {
$item = $this->getBreadcrumbsHomeItem();
}
... | php | {
"resource": ""
} |
q235245 | HasBreadcrumbs.loadBreadcrumbs | train | protected function loadBreadcrumbs()
{
breadcrumbs()->register($this->breadcrumbsContainer, function(Builder $bc) {
$bc->parent('main');
if ( ! empty($this->breadcrumbsItems)) {
foreach ($this->breadcrumbsItems as $crumb) {
$bc->push($crumb['title... | php | {
"resource": ""
} |
q235246 | HasBreadcrumbs.addBreadcrumbRoute | train | protected function addBreadcrumbRoute($title, $route, array $parameters = [], array $data = [])
{
return $this->addBreadcrumb($title, route($route, $parameters), $data);
} | php | {
"resource": ""
} |
q235247 | SecureRequestMiddleware.generateSig | train | protected function generateSig($endpoint, array $params, $secret)
{
$sig = $endpoint;
ksort($params);
foreach ($params as $key => $val) {
$sig .= "|$key=$val";
}
return hash_hmac('sha256', $sig, $secret, false);
} | php | {
"resource": ""
} |
q235248 | JsonFileLoader.loadFile | train | protected function loadFile($file)
{
if (!stream_is_local($file)) {
throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file));
}
if (!file_exists($file)) {
throw new InvalidArgumentException(sprintf('The service file "%s" is not valid.', $f... | php | {
"resource": ""
} |
q235249 | LocationsRepository.getRecentMedia | train | public function getRecentMedia($id, $minId = null, $maxId = null)
{
$params = ['query' => [
'min_id' => $minId,
'max_id' => $maxId,
]];
return $this->client->request('GET', "locations/$id/media/recent", $params);
} | php | {
"resource": ""
} |
q235250 | LocationsRepository.search | train | public function search($latitude, $longitude, $distance = 1000)
{
$params = ['query' => [
'lat' => $latitude,
'lng' => $longitude,
'distance' => $distance,
]];
return $this->client->request('GET', 'locations/search', $params);
} | php | {
"resource": ""
} |
q235251 | NodeNormalizer.isPropertyEditable | train | private function isPropertyEditable(PropertyInterface $property)
{
// do not serialize binary objects
if (false === $this->allowBinary && PropertyType::BINARY == $property->getType()) {
$this->notes[] = sprintf(
'Binary property "%s" has been omitted', $property->getName(... | php | {
"resource": ""
} |
q235252 | TaskService.update | train | public function update($taskId, array $data)
{
$data = self::mergeData($data, [
'finished' => false,
'smContactTaskReq' => [
'id' => $taskId,
],
]);
return $this->client->doPost('contact/updateTask', $data);
} | php | {
"resource": ""
} |
q235253 | sfYamlInline.parseMapping | train | static protected function parseMapping($mapping, &$i = 0)
{
$output = array();
$len = strlen($mapping);
$i += 1;
// {foo: bar, bar:foo, ...}
while ($i < $len)
{
switch ($mapping[$i])
{
case ' ':
case ',':
++$i;
continue 2;
case '}':
... | php | {
"resource": ""
} |
q235254 | CommentManager.findAverageNote | train | public function findAverageNote(Thread $thread)
{
return $this->repository->createQueryBuilder('c')
->select('avg(c.note)')
->where('c.private <> :private')
->andWhere('c.thread = :thread')
->setParameters([
'private' => 1,
'thr... | php | {
"resource": ""
} |
q235255 | AbstractAdapter.resolveExceptionClass | train | protected function resolveExceptionClass(ClientException $exception)
{
$response = $exception->getResponse()->getBody();
$response = json_decode($response->getContents());
if ($response === null) {
return new Exception($exception->getMessage());
}
$meta = iss... | php | {
"resource": ""
} |
q235256 | pakeGit.git_run | train | public function git_run($command)
{
$git = escapeshellarg(pake_which('git'));
if (self::$needs_work_tree_workaround === true) {
$cmd = '(cd '.escapeshellarg($this->repository_path).' && '.$git.' '.$command.')';
} else {
$cmd = $git;
$cmd .= ' --git-dir='.... | php | {
"resource": ""
} |
q235257 | pakeGit.init | train | public static function init($path, $template_path = null, $shared = false)
{
pake_mkdirs($path);
if (false === $shared)
$shared = 'false';
elseif (true === $shared)
$shared = 'true';
elseif (is_int($shared))
$shared = sprintf("%o", $shared);
... | php | {
"resource": ""
} |
q235258 | ElementMap.renderEntryElementMap | train | public function renderEntryElementMap(array &$context)
{
$map = $this->renderer->getElementMap($context['entry']['id'], $context['site']['id']);
return $this->renderMap($map);
} | php | {
"resource": ""
} |
q235259 | ElementMap.renderCategoryElementMap | train | public function renderCategoryElementMap(array &$context)
{
$map = $this->renderer->getElementMap($context['category']['id'], $context['site']['id']);
return $this->renderMap($map);
} | php | {
"resource": ""
} |
q235260 | ElementMap.renderUserElementMap | train | public function renderUserElementMap(array &$context)
{
$map = $this->renderer->getElementMap($context['user']['id'], Craft::$app->getSites()->getPrimarySite()->id);
return $this->renderMap($map);
} | php | {
"resource": ""
} |
q235261 | ElementMap.renderProductElementMap | train | public function renderProductElementMap(array &$context)
{
$map = $this->renderer->getElementMap($context['product']['id'], $context['site']['id']);
return $this->renderMap($map);
} | php | {
"resource": ""
} |
q235262 | EventHelper.formatted_dates | train | public static function formatted_dates($startObj, $endObj)
{
//Checking if end date is set
$endDateIsset = true;
if (isset($endObj->value)) {
$endDateIsset = false;
}
$startTime = strtotime($startObj->value);
$endTime = strtotime($endObj->value);
... | php | {
"resource": ""
} |
q235263 | EventHelper.formatted_timeframe | train | public static function formatted_timeframe($startStr, $endStr)
{
$str = null;
if ($startStr == $endStr) {
return null;
}
$startTime = strtotime($startStr->value);
$endTime = strtotime($endStr->value);
if ($startTime == $endTime) {
return nul... | php | {
"resource": ""
} |
q235264 | ICSExport.ics_from_sscal | train | public static function ics_from_sscal($cal)
{
$events = $cal->Events();
$eventsArr = $events->toNestedArray();
//Debug::dump($eventsArr);
//return false;
$ics = new ICSExport($eventsArr);
return $ics;
} | php | {
"resource": ""
} |
q235265 | ICSExport_Controller.all | train | public function all()
{
$calendars = PublicCalendar::get();
$events = new ArrayList();
foreach ($calendars as $cal) {
$events->merge($cal->Events());
}
$eventsArr = $events->toNestedArray();
//Debug::dump($eventsArr);
//return false;
$i... | php | {
"resource": ""
} |
q235266 | NotifyTask.sendEmail | train | private function sendEmail(OutputInterface $output, $content)
{
$output->writeln("Sending an email");
$transport = $this->getTransport();
$mailer = \Swift_Mailer::newInstance($transport);
$message = \Swift_Message::newInstance('Bldr Notify - New Message')
->setFrom(['... | php | {
"resource": ""
} |
q235267 | ValidationBuilder.buildValidation | train | public static function buildValidation(array $schema, $name = null)
{
$validation = new NestedValidation($name);
foreach ($schema as $key => $value) {
if (!is_array($value)) {
trigger_error('parsing error', E_USER_ERROR);
}
if (self::i... | php | {
"resource": ""
} |
q235268 | ValidationBuilder.isNestedValidation | train | private static function isNestedValidation(array $value)
{
return !(key_exists(Properties::TYPE, $value) && !is_array($value[Properties::TYPE]));
} | php | {
"resource": ""
} |
q235269 | ValidationBuilder.buildKeyValidation | train | public static function buildKeyValidation(array $options, $name)
{
if (!key_exists(Properties::TYPE, $options)) {
trigger_error($name . ' must have a type');
}
switch ($options[Properties::TYPE]) {
case Types::STR:
case Types::STRING:
... | php | {
"resource": ""
} |
q235270 | Html.escape | train | public static function escape($string)
{
Arguments::define(
Boa::either(
Boa::either(
Boa::instance(SafeHtmlWrapper::class),
Boa::instance(SafeHtmlProducerInterface::class)
),
Boa::string()
)
... | php | {
"resource": ""
} |
q235271 | DateTime.forceWorkday | train | public function forceWorkday($next = false)
{
$weekday = $this->format('N');
if ($weekday == 7) $this->addDays(1);
elseif ($weekday == 6) $next ? $this->addDays(2) : $this->addDays(-1);
return $this;
} | php | {
"resource": ""
} |
q235272 | DateTime.formatLocalized | train | public function formatLocalized($format, $encoding = 'UTF-8')
{
$str = strftime($format, $this->getTimestamp());
if ($encoding == 'UTF-8') {
$str = utf8_encode($str);
}
return $str;
} | php | {
"resource": ""
} |
q235273 | MenusTable.getLinkTypes | train | public function getLinkTypes()
{
$event = new Event('Wasabi.Backend.MenuItems.getLinkTypes', $this);
EventManager::instance()->dispatch($event);
$typeExternal = ['type' => 'external'];
$typeCustom = ['type' => 'custom'];
$event->result[__d('wasabi_core', 'General')] = [
... | php | {
"resource": ""
} |
q235274 | Definition.replaceArgument | train | public function replaceArgument($index, $argument)
{
if (0 === count($this->arguments)) {
throw new OutOfBoundsException('Cannot replace arguments if none have been configured yet.');
}
if ($index < 0 || $index > count($this->arguments) - 1) {
throw new OutOfBoundsEx... | php | {
"resource": ""
} |
q235275 | LimitStatement.getLimit | train | public function getLimit()
{
if ($this->max > 0) {
return min($this->max, $this->limit);
}
return $this->limit;
} | php | {
"resource": ""
} |
q235276 | iauTaiut1.Taiut1 | train | public static function Taiut1($tai1, $tai2, $dta, &$ut11, &$ut12) {
$dtad;
/* Result, safeguarding precision. */
$dtad = $dta / DAYSEC;
if ($tai1 > $tai2) {
$ut11 = $tai1;
$ut12 = $tai2 + $dtad;
}
else {
$ut11 = $tai1 + $dtad;
$ut12 = $tai2;
}
/* Status (always ... | php | {
"resource": ""
} |
q235277 | Specificity.compare | train | public static function compare($left, $right){
if($left->a != $right->a) return $left->a <=> $right->a;
if($left->b != $right->b) return $left->b <=> $right->b;
if($left->c != $right->c) return $left->c <=> $right->c;
if($left->i < 0 || $right->i < 0) return 0;
return $left->i <=> $right->i;
} | php | {
"resource": ""
} |
q235278 | Specificity.get | train | public static function get($selector){
$specificity = $selector->hasNext() ? self::get($selector->getNext()) : new self();
if($selector->getIdentification()) $specificity->a++;
if($selector->getClasses()) $specificity->b+= count($selector->getClasses());
if($selector->getAttributes()) $specificity->b+= count... | php | {
"resource": ""
} |
q235279 | MatchLexer.supports | train | public function supports($phrase, array $arguments)
{
if (!isset($this->forms[$phrase])) {
return false;
}
$argumentMatch = $this->forms[$phrase];
if ($this->validateNoArgumentsCondition($arguments, $argumentMatch)
|| $this->validateStrictArgumentCountCondit... | php | {
"resource": ""
} |
q235280 | UpdateTransCommand._crawlNode | train | private function _crawlNode(\Twig_Node $node)
{
if ($node instanceof TransNode && !$node->getNode('body') instanceof \Twig_Node_Expression_GetAttr) {
// trans block
$domain = $node->getNode('domain')->getAttribute('value');
$message = $node->getNode('body')->getAttribute('data');
$this->messages->set($me... | php | {
"resource": ""
} |
q235281 | UpdateTransCommand._extractMessage | train | private function _extractMessage(\Twig_Node $node)
{
if ($node->hasNode('node')) {
return $this->_extractMessage($node->getNode('node'));
}
if ($node instanceof \Twig_Node_Expression_Constant) {
return $node->getAttribute('value');
}
return null;
} | php | {
"resource": ""
} |
q235282 | UpdateTransCommand._extractDomain | train | private function _extractDomain(\Twig_Node $node)
{
// must be a filter node
if (!$node instanceof \Twig_Node_Expression_Filter) {
return null;
}
// is a trans filter
if ($node->getNode('filter')->getAttribute('value') == 'trans') {
if ($node->getNode('arguments')->hasNode(1)) {
return $node->getNo... | php | {
"resource": ""
} |
q235283 | Udate_CalendarEntityRowPlugin.preloadEntities | train | protected function preloadEntities($values)
{
$ids = array();
foreach ($values as $row) {
$id = $row->{$this->field_alias};
if ($this->view->base_table == 'node_revision') {
$this->entities[$id] = node_load(NULL, $id);
} else {
$i... | php | {
"resource": ""
} |
q235284 | StyleCollection.addById | train | public function addById($id, array $styles)
{
$this->ids[$id] = array_merge_recursive($this->getById($id), $styles);
} | php | {
"resource": ""
} |
q235285 | StyleCollection.addByElement | train | public function addByElement($element, array $styles)
{
$this->elements[$element] = array_merge_recursive($this->getByElement($element), $styles);
} | php | {
"resource": ""
} |
q235286 | Upgrade.fe | train | protected static function fe()
{
if( ! empty(ZN::upgrade()) )
{
$status = self::$lang['upgradeSuccess'];
}
else
{
$status = self::$lang['alreadyVersion'];
if( $upgradeError = ZN::upgradeError() )
{
$status = $up... | php | {
"resource": ""
} |
q235287 | Upgrade.eip | train | protected static function eip($tag = 'znframework')
{
if( $return = Restful::useragent(true)->get('https://api.github.com/repos/znframework/'.$tag.'/tags') )
{
if( ! isset($return->message) )
{
usort($return, function($data1, $data2){ return strcmp($data1->nam... | php | {
"resource": ""
} |
q235288 | Response.cached | train | public function cached($public = true, $expires = '+1 year')
{
if (!is_int($expires)) {
$expires = strtotime($expires);
}
$maxAge = $expires - time();
$pragma = $public ? 'public' : 'private';
$cache = $pragma . ', max-age=' . $maxAge;
$response = clone $t... | php | {
"resource": ""
} |
q235289 | Response.file | train | public static function file($path, $type = null)
{
$response = new self(
Status::OK,
new PhpStream($path, 'rb')
);
if (isset($type)) {
$response->setHeader('Content-Type', $type);
}
return $response;
} | php | {
"resource": ""
} |
q235290 | JinitializeApplication.registerPlugin | train | public function registerPlugin(array $plugin)
{
/* Dont't process nameless plugins */
if(! isset($plugin['name'])) return;
/* Create a container for the plugin */
$this->getContainer()->addPlugin($plugin['name']);
/* Commands are registered first so they can be found be por... | php | {
"resource": ""
} |
q235291 | JinitializeApplication.registerProcedures | train | public function registerProcedures(string $plugin, array $procedures, string $path)
{
/* Append the installation path before the files */
array_walk($procedures, function(&$procedure) use ($path){
$procedure = "$path/$procedure";
});
/* Create a factory from list of path... | php | {
"resource": ""
} |
q235292 | JinitializeApplication.registerCommands | train | public function registerCommands(string $plugin, array $commands)
{
$newCommands = [];
foreach($commands as $commandClass) {
$command = new $commandClass($plugin);
$command = CommandFactory::setNamespace($command);
$this->add($command);
$newCommands[]... | php | {
"resource": ""
} |
q235293 | JinitializeApplication.missingSettings | train | public function missingSettings()
{
$missing = [];
foreach($this->recommendedSettings() as $plugin => $settings) {
foreach($settings as $setting) {
/* Get value for the setting */
$value = $_ENV[$setting] ?? null;
if(is_null($value)) $miss... | php | {
"resource": ""
} |
q235294 | Output.flushBuffer | train | public function flushBuffer() {
$content = $this->format($this->buffer->flush());
if ( ! $this->is(OutputVerbosity::SILENT)) {
fwrite($this->getOutputStream(), $content);
}
} | php | {
"resource": ""
} |
q235295 | Queue.add | train | public function add(Job $job)
{
$jobClass = new \ReflectionClass($job);
$name = $jobClass->getName();
$object = serialize($job);
$jobId = $this->broker->put(['object' => $object, 'class' => $name]);
$this->broker->setStatus($jobId,
['status' => Job::STATUS_QUEUED,... | php | {
"resource": ""
} |
q235296 | Console.indent | train | public static function indent($str, $spaces = 4, $level = 1){
return str_repeat(" ", $spaces * $level)
. str_replace("\n", "\n" . str_repeat(" ", $spaces * $level), $str);
} | php | {
"resource": ""
} |
q235297 | Console.moveCursorRel | train | public function moveCursorRel($x, $y)
{
$yChar = ($y < 0) ? "A" : "B"; // up / down
$xChar = ($x < 0) ? "D" : "C"; // left / right
fwrite(STDOUT, "\e[" . abs($x) . $xChar);
fwrite(STDOUT, "\e[" . abs($y) . $yChar);
} | php | {
"resource": ""
} |
q235298 | Hybrid_Providers_MailChimp.getEndpoint | train | function getEndpoint()
{
$this->api->curl_header = array(
'Authorization: OAuth '.$this->api->access_token,
);
$data = $this->api->get( $this->metadata_url );
if ( ! isset( $data->api_endpoint ) ){
throw new Exception( "Endpoint request failed! {$this... | php | {
"resource": ""
} |
q235299 | Info.getPhpInfo | train | protected function getPhpInfo(): string
{
ob_start();
phpinfo();
$result = ob_get_contents();
ob_end_clean();
$result = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $result);
$result = preg_replace('/,\s*/', ', ', $result);
return $result;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.