_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q20800
ReportTcpdf.footer
train
public function footer() { foreach ($this->footerElements as $element) { if ($element instanceof ReportBaseElement) { $element->render($this); } elseif ($element === 'footnotetexts') {
php
{ "resource": "" }
q20801
ReportTcpdf.setCurrentStyle
train
public function setCurrentStyle(string $s) { $this->currentStyle = $s; $style = $this->wt_report->getStyle($s);
php
{ "resource": "" }
q20802
ReportTcpdf.getStyle
train
public function getStyle(string $s): array { if (!isset($this->wt_report->styles[$s])) { $s = $this->getCurrentStyle();
php
{ "resource": "" }
q20803
ReportTcpdf.addMarginX
train
public function addMarginX(float $x): float { $m = $this->getMargins(); if ($this->getRTL()) { $x += $m['right']; } else {
php
{ "resource": "" }
q20804
ReportTcpdf.getMaxLineWidth
train
public function getMaxLineWidth() { $m = $this->getMargins(); if ($this->getRTL()) { return ($this->getRemainingWidth() + $m['right']);
php
{ "resource": "" }
q20805
ReportTcpdf.getFootnotesHeight
train
public function getFootnotesHeight(): float { $h = 0; foreach ($this->printedfootnotes as $element) { $h +=
php
{ "resource": "" }
q20806
JulianDate.formatLongYear
train
protected function formatLongYear(): string { if ($this->year < 0) { return /* I18N: BCE=Before the Common Era, for Julian years < 0. See http://en.wikipedia.org/wiki/Common_Era */ I18N::translate('%s&nbsp;BCE', I18N::digits(-$this->year)); } if ($this->new_old_...
php
{ "resource": "" }
q20807
JulianDate.formatGedcomYear
train
protected function formatGedcomYear(): string { if ($this->year < 0) { return sprintf('%04d B.C.', -$this->year);
php
{ "resource": "" }
q20808
AutocompleteController.folder
train
public function folder(ServerRequestInterface $request, Tree $tree, Filesystem $filesystem): ResponseInterface { $query = $request->get('query', ''); $prefix = $tree->getPreference('MEDIA_DIRECTORY', ''); $media_filesystem = new Filesystem(new ChrootAdapter($filesystem, $prefix));
php
{ "resource": "" }
q20809
AutocompleteController.page
train
public function page(ServerRequestInterface $request, Tree $tree): ResponseInterface { $query = $request->get('query', ''); $xref = $request->get('extra', ''); $source = Source::getInstance($xref, $tree); Auth::checkSourceAccess($source); $regex_query = preg_quote(strtr($...
php
{ "resource": "" }
q20810
AutocompleteController.placeSearch
train
private function placeSearch(Tree $tree, int $page, string $query, bool $create): array { $offset = $page * self::RESULTS_PER_PAGE; $results = []; $found = false; foreach ($this->search_service->searchPlaces($tree, $query) as $place) { $place_name = $place->gedcomName...
php
{ "resource": "" }
q20811
IndividualMetadataModule.getSidebarContent
train
public function getSidebarContent(Individual $individual): string { ob_start(); foreach ($individual->facts(static::HANDLED_FACTS) as $fact) { FunctionsPrintFacts::printFact($fact, $individual);
php
{ "resource": "" }
q20812
BatchUpdateMarriedNamesPlugin.surnamesToAdd
train
private function surnamesToAdd(GedcomRecord $record): array { $gedcom = $record->gedcom(); $tree = $record->tree(); $wife_surnames = $this->surnames($record); $husb_surnames = []; $missing_surnames = []; preg_match_all('/^1 FAMS @(.+)@/m', $gedcom, $fmatch);...
php
{ "resource": "" }
q20813
BatchUpdateMarriedNamesPlugin.surnames
train
private function surnames(GedcomRecord $record): array { $gedcom = $record->gedcom(); if (preg_match_all('/^(?:1
php
{ "resource": "" }
q20814
FixLevel0MediaController.fixLevel0MediaAction
train
public function fixLevel0MediaAction(ServerRequestInterface $request): ResponseInterface { $fact_id = $request->getParsedBody()['fact_id']; $indi_xref = $request->getParsedBody()['indi_xref']; $obje_xref = $request->getParsedBody()['obje_xref']; $tree_id = (int) $request->getPars...
php
{ "resource": "" }
q20815
PedigreeMapModule.getSosaName
train
private function getSosaName(int $sosa): string { $path = ''; while ($sosa > 1) { if ($sosa % 2 === 1) {
php
{ "resource": "" }
q20816
FunctionsPrint.printFactNotes
train
public static function printFactNotes(Tree $tree, $factrec, $level): string { $data = ''; $previous_spos = 0; $nlevel = $level + 1; $ct = preg_match_all("/$level NOTE (.*)/", $factrec, $match, PREG_SET_ORDER); for ($j = 0; $j < $ct; $j++) { ...
php
{ "resource": "" }
q20817
FunctionsPrint.helpLink
train
public static function helpLink($topic): string { return '<a href="#" data-toggle="modal" data-target="#wt-ajax-modal" data-href="' . e(route('help-text', ['topic' => $topic])) . '" title="' . I18N::translate('Help') . '">' .
php
{ "resource": "" }
q20818
FunctionsPrint.checkFactUnique
train
public static function checkFactUnique(array $uniquefacts, Collection $recfacts): array { foreach ($recfacts as $factarray) { $fact = $factarray->getTag();
php
{ "resource": "" }
q20819
UseTheme.themes
train
private function themes(): Generator { $themes = $this->module_service->findByInterface(ModuleThemeInterface::class); // Last theme used yield $themes->get(Session::get('theme', '')); // Default for tree $tree = app(Tree::class); if ($tree instanceof Tree) { ...
php
{ "resource": "" }
q20820
MigrationService.updateSchema
train
public function updateSchema($namespace, $schema_name, $target_version): bool { try { $current_version = (int) Site::getPreference($schema_name); } catch (PDOException $ex) { // During initial installation, the site_preference table won’t exist. $current_version =...
php
{ "resource": "" }
q20821
MigrationService.seedDatabase
train
public function seedDatabase(): void { (new SeedSiteSettingTable())->run(); (new SeedUserTable())->run(); (new SeedGedcomTable())->run();
php
{ "resource": "" }
q20822
Application.dispatch
train
public function dispatch($object, string $method) { $reflector = new ReflectionMethod($object, $method);
php
{ "resource": "" }
q20823
MediaFile.fileSizeKB
train
public function fileSizeKB(): string { $size = $this->fileSizeBytes(); $size = intdiv($size + 1023, 1024); /* I18N: size of
php
{ "resource": "" }
q20824
MediaFile.downloadUrl
train
public function downloadUrl(): string { return route('media-download', [ 'xref' => $this->media->xref(), 'ged'
php
{ "resource": "" }
q20825
MediaFile.imageUrl
train
public function imageUrl($width, $height, $fit): string { // Sign the URL, to protect against mass-resize attacks. $glide_key = Site::getPreference('glide-key'); if (empty($glide_key)) { $glide_key = bin2hex(random_bytes(128)); Site::setPreference('glide-key', $glide_...
php
{ "resource": "" }
q20826
Statistics.getAllTagsTable
train
public function getAllTagsTable(): string { $examples = []; foreach (get_class_methods($this) as $method) { $reflection = new ReflectionMethod($this, $method); if ($reflection->isPublic() && !in_array($method, self::$public_but_not_allowed, true) && (string) $reflection->get...
php
{ "resource": "" }
q20827
Statistics.getAllTagsText
train
public function getAllTagsText(): string { $examples = []; foreach (get_class_methods($this) as $method) { $reflection = new ReflectionMethod($this, $method); if ($reflection->isPublic() && !in_array($method, self::$public_but_not_allowed, true)
php
{ "resource": "" }
q20828
Statistics.getTags
train
private function getTags(string $text): array { $tags = []; $matches = []; preg_match_all('/#([^#]+)#/', $text, $matches, PREG_SET_ORDER); foreach ($matches as $match) { $params = explode(':', $match[1]); $method = array_shift($params);
php
{ "resource": "" }
q20829
Statistics.embedTags
train
public function embedTags(string $text): string { if (strpos($text, '#') !== false) { $text =
php
{ "resource": "" }
q20830
RecentChangesModule.getRecentChanges
train
private function getRecentChanges(Tree $tree, int $days): array { return DB::table('change') ->where('gedcom_id', '=', $tree->id()) ->where('status', '=', 'accepted') ->where('new_gedcom', '<>', '') ->where('change_time', '>', Carbon::now()->subDays($days)) ...
php
{ "resource": "" }
q20831
HelpTextController.formatDates
train
private function formatDates(array $gedcom_dates): array { $dates = []; foreach ($gedcom_dates as $gedcom_date) { // PHP converts numeric array keys ('1900') to integers (1900), so reverse this. $gedcom_date = (string) $gedcom_date; $date
php
{ "resource": "" }
q20832
UserMessagesModule.postDeleteMessageAction
train
public function postDeleteMessageAction(ServerRequestInterface $request, Tree $tree): ResponseInterface { $message_ids = (array) $request->get('message_id', []); DB::table('message') ->where('user_id', '=', Auth::id()) ->whereIn('message_id', $message_ids) ->dele...
php
{ "resource": "" }
q20833
AlbumModule.getMedia
train
private function getMedia(Individual $individual): array { if ($this->media_list === null) { // Use facts from this individual and all their spouses $facts = $individual->facts(); foreach ($individual->spouseFamilies() as $family) { foreach ($family->facts...
php
{ "resource": "" }
q20834
StatisticsChartModule.axisMonths
train
private function axisMonths(): array { return [ 'JAN' => I18N::translateContext('NOMINATIVE', 'January'), 'FEB' => I18N::translateContext('NOMINATIVE', 'February'), 'MAR' => I18N::translateContext('NOMINATIVE', 'March'), 'APR' => I18N::translateContext('NOMINA...
php
{ "resource": "" }
q20835
StatisticsChartModule.axisYears
train
private function axisYears(string $boundaries_csv): array { $boundaries = explode(',', $boundaries_csv); $axis = []; foreach ($boundaries as $n => $boundary) { if ($n === 0) { $date = new Date('BEF ' . $boundary); } else { $date = new ...
php
{ "resource": "" }
q20836
StatisticsChartModule.fillYData
train
private function fillYData($x, $z, $value, array $x_axis, array $z_axis, array &$ydata): void { $x = $this->findAxisEntry($x, $x_axis); $z = $this->findAxisEntry($z, $z_axis); if (!array_key_exists($z, $z_axis)) { foreach (array_keys($z_axis) as $key) { if ($valu...
php
{ "resource": "" }
q20837
StatisticsChartModule.myPlot
train
private function myPlot( string $chart_title, array $x_axis, string $x_axis_title, array $ydata, string $y_axis_title, array $z_axis, int $y_axis_type ): string { if (!count($ydata)) { return I18N::translate('This information is not availab...
php
{ "resource": "" }
q20838
FunctionsImport.updatePlaces
train
public static function updatePlaces(string $xref, Tree $tree, string $gedrec): void { preg_match_all('/^[2-9] PLAC (.+)/m', $gedrec, $matches); $places = array_unique($matches[1]); foreach ($places as $place_name) { $place = new Place($place_name, $tree); // Callin...
php
{ "resource": "" }
q20839
FunctionsImport.updateDates
train
public static function updateDates($xref, $ged_id, $gedrec): void { if (strpos($gedrec, '2 DATE ') && preg_match_all("/\n1 (\w+).*(?:\n[2-9].*)*(?:\n2 DATE (.+))(?:\n[2-9].*)*/", $gedrec, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { $fact = $match[1]; ...
php
{ "resource": "" }
q20840
FunctionsImport.updateLinks
train
public static function updateLinks($xref, $ged_id, $gedrec): void { if (preg_match_all('/^\d+ (' . Gedcom::REGEX_TAG . ') @(' . Gedcom::REGEX_XREF . ')@/m', $gedrec, $matches, PREG_SET_ORDER)) { $data = []; foreach ($matches as $match) { // Include each link once only...
php
{ "resource": "" }
q20841
FunctionsImport.updateNames
train
public static function updateNames($xref, $ged_id, GedcomRecord $record): void { foreach ($record->getAllNames() as $n => $name) { if ($record instanceof Individual) { if ($name['givn'] === '@P.N.') { $soundex_givn_std = null; $soundex_givn...
php
{ "resource": "" }
q20842
FunctionsImport.convertInlineMedia
train
public static function convertInlineMedia(Tree $tree, $gedrec): string { while (preg_match('/\n1 OBJE(?:\n[2-9].+)+/', $gedrec, $match)) { $gedrec = str_replace($match[0], self::createMediaObject(1, $match[0], $tree), $gedrec); } while (preg_match('/\n2 OBJE(?:\n[3-9].+)+/', $ged...
php
{ "resource": "" }
q20843
FunctionsImport.createMediaObject
train
public static function createMediaObject($level, $gedrec, Tree $tree): string { if (preg_match('/\n\d FILE (.+)/', $gedrec, $file_match)) { $file = $file_match[1]; } else { $file = ''; } if (preg_match('/\n\d TITL (.+)/', $gedrec, $file_match)) { ...
php
{ "resource": "" }
q20844
FunctionsImport.acceptAllChanges
train
public static function acceptAllChanges($xref, Tree $tree): void { $changes = DB::table('change') ->join('gedcom', 'change.gedcom_id', '=', 'gedcom.gedcom_id') ->where('status', '=', 'pending') ->where('xref', '=', $xref) ->where('gedcom.gedcom_id', '=', $tree...
php
{ "resource": "" }
q20845
NoteController.show
train
public function show(ServerRequestInterface $request, Tree $tree, ClipboardService $clipboard_service): ResponseInterface { $xref = $request->get('xref', ''); $record = Note::getInstance($xref, $tree); Auth::checkNoteAccess($record, false); return $this->viewResponse('note-page',...
php
{ "resource": "" }
q20846
GoogleAnalyticsModule.analyticsSnippet
train
public function analyticsSnippet(array $parameters): string { // Add extra dimensions (i.e. filtering categories) $tree = app(Tree::class); $user = app(UserInterface::class); $parameters['dimensions'] = (object) [ 'dimension1' => $tree instanceof Tree ? $tree->name() : '...
php
{ "resource": "" }
q20847
GedcomCodeStat.statusName
train
public static function statusName(string $status_code): string { switch ($status_code) { case 'BIC': /* I18N: LDS sealing status; see http://en.wikipedia.org/wiki/Sealing_(Latter_Day_Saints) */ return I18N::translate('Born in the covenant'); case 'CANC...
php
{ "resource": "" }
q20848
GedcomCodeStat.statusNames
train
public static function statusNames(string $tag): array { $status_names = []; foreach (self::statusCodes($tag) as $status_code) {
php
{ "resource": "" }
q20849
AbstractEditController.addNewFact
train
protected function addNewFact(ServerRequestInterface $request, Tree $tree, $fact): string { $FACT = $request->get($fact, ''); $DATE = $request->get($fact . '_DATE', ''); $PLAC = $request->get($fact . '_PLAC', ''); if ($DATE !== '' || $PLAC !== '' || $FACT !== '' && $FACT !== 'Y') { ...
php
{ "resource": "" }
q20850
AbstractEditController.addNewName
train
protected function addNewName(ServerRequestInterface $request, Tree $tree): string { $gedrec = "\n1 NAME " . $request->get('NAME', ''); $tags = [ 'NPFX', 'GIVN', 'SPFX', 'SURN', 'NSFX', ]; if (preg_match_all('/(' . Gedcom:...
php
{ "resource": "" }
q20851
ModuleAction.handle
train
public function handle(ServerRequestInterface $request): ResponseInterface { $module_name = $request->getQueryParams()['module'] ?? $request->getParsedBody()['module'] ?? ''; $action = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? ''; // Check that the ...
php
{ "resource": "" }
q20852
MediaTabModule.getFactsWithMedia
train
private function getFactsWithMedia(Individual $individual): Collection { if ($this->facts === null) { $facts = $individual->facts(); foreach ($individual->spouseFamilies() as $family) { if ($family->canShow()) { foreach ($family->facts() as $fact) ...
php
{ "resource": "" }
q20853
AbstractCensusColumn.father
train
public function father(Individual $individual): ?Individual { $family = $individual->primaryChildFamily(); if ($family) {
php
{ "resource": "" }
q20854
AbstractCensusColumn.mother
train
public function mother(Individual $individual): ?Individual { $family = $individual->primaryChildFamily(); if ($family) {
php
{ "resource": "" }
q20855
AbstractCensusColumn.spouseFamily
train
public function spouseFamily(Individual $individual): ?Family { // Exclude families that were created after this census date $families = []; foreach ($individual->spouseFamilies() as $family) { if (Date::compare($family->getMarriageDate(), $this->date()) <= 0) { $...
php
{ "resource": "" }
q20856
AbstractCensusColumn.notCountry
train
protected function notCountry(string $place): string { $parts = explode(', ', $place); if (end($parts) === $this->place()) {
php
{ "resource": "" }
q20857
LocalizationService.alphabet
train
public function alphabet(): array { $locale = $this->locale->languageTag(); $script = $this->locale->script()->code();
php
{ "resource": "" }
q20858
LocalizationService.calendar
train
public function calendar(): CalendarInterface { $non_gregorian_calendars = [ 'ar' => new ArabicCalendar(), 'fa' => new PersianCalendar(), 'he' => new JewishCalendar(), 'yi' => new JewishCalendar(),
php
{ "resource": "" }
q20859
LoginController.loginPage
train
public function loginPage(ServerRequestInterface $request, ?Tree $tree): ResponseInterface { // Already logged in? if (Auth::check()) { $ged = $tree !== null ? $tree->name() : ''; return redirect(route('user-page', ['ged' => $ged])); } $error = $request->...
php
{ "resource": "" }
q20860
LoginController.loginAction
train
public function loginAction(ServerRequestInterface $request, UpgradeService $upgrade_service): ResponseInterface { $username = $request->get('username', ''); $password = $request->get('password', ''); $url = $request->get('url', ''); try { $this->doLogin($username, ...
php
{ "resource": "" }
q20861
LoginController.doLogin
train
private function doLogin(string $username, string $password): void { if (!$_COOKIE) { Log::addAuthenticationLog('Login failed (no session cookies): ' . $username); throw new Exception(I18N::translate('You cannot sign in because your browser does not accept cookies.')); } ...
php
{ "resource": "" }
q20862
LoginController.logoutAction
train
public function logoutAction(Tree $tree = null): ResponseInterface { if (Auth::check()) { Log::addAuthenticationLog('Logout: ' . Auth::user()->userName() . '/' . Auth::user()->realName()); Auth::logout(); FlashMessages::addMessage(I18N::translate('You have signed out.'), ...
php
{ "resource": "" }
q20863
ChartService.sosaStradonitzAncestors
train
public function sosaStradonitzAncestors(Individual $individual, int $generations): Collection { $ancestors = [1 => $individual]; $queue = [1]; $max = 2 ** ($generations - 1); while (!empty($queue)) { $sosa_stradonitz_number = array_shift($queue); if ($sosa...
php
{ "resource": "" }
q20864
ChartService.descendants
train
public function descendants(Individual $individual, int $generations): Collection { $descendants = new Collection([$individual]); if ($generations > 0) { foreach ($individual->spouseFamilies() as $family) { foreach ($family->children() as $child) {
php
{ "resource": "" }
q20865
CenturyService.centuryName
train
public function centuryName(int $century): string { if ($century < 0) { return I18N::translate('%s BCE', $this->centuryName(-$century)); } // The current chart engine (Google charts) can't handle <sup></sup> markup switch ($century) { case 21: ...
php
{ "resource": "" }
q20866
DebugBar.enable
train
public static function enable(): void { self::$debugbar = new StandardDebugBar(); self::$debugbar->addCollector(new ViewCollector());
php
{ "resource": "" }
q20867
DebugBar.initPDO
train
public static function initPDO(PDO $pdo): PDO { if (self::$debugbar instanceof StandardDebugBar) { $traceable_pdo = new TraceablePDO($pdo);
php
{ "resource": "" }
q20868
DebugBar.stopMeasure
train
public static function stopMeasure($name): void { if (self::$debugbar instanceof StandardDebugBar) { $collector = self::$debugbar->getCollector('time'); if ($collector instanceof
php
{ "resource": "" }
q20869
ViewCollector.addView
train
public function addView(string $view, array $data): void { $num = count($this->views) + 1; $key = '#' . $num . ' '
php
{ "resource": "" }
q20870
EditMediaController.editMediaFile
train
public function editMediaFile(ServerRequestInterface $request, Tree $tree): ResponseInterface { $xref = $request->get('xref', ''); $fact_id = $request->get('fact_id', ''); $media = Media::getInstance($xref, $tree); try { Auth::checkMediaAccess($media); } cat...
php
{ "resource": "" }
q20871
EditMediaController.createMediaObject
train
public function createMediaObject(Tree $tree): ResponseInterface { return response(view('modals/create-media-object', [
php
{ "resource": "" }
q20872
EditMediaController.createMediaObjectAction
train
public function createMediaObjectAction(ServerRequestInterface $request, Tree $tree): ResponseInterface { $note = $request->get('note'); $title = $request->get('title'); $type = $request->get('type'); $privacy_restriction = $request->get('p...
php
{ "resource": "" }
q20873
EditMediaController.createMediaFileGedcom
train
private function createMediaFileGedcom(string $file, string $type, string $title): string { if (preg_match('/\.([a-z0-9]+)/i', $file, $match)) { $extension = strtolower($match[1]); $extension = str_replace('jpg', 'jpeg', $extension); $extension = ' ' . $extension; ...
php
{ "resource": "" }
q20874
EditMediaController.maxUploadFilesize
train
private function maxUploadFilesize(): string { $bytes = UploadedFile::getMaxFilesize(); $kb = intdiv($bytes + 1023, 1024);
php
{ "resource": "" }
q20875
EditMediaController.unusedFiles
train
private function unusedFiles(Tree $tree): array { $used_files = DB::table('media_file') ->where('m_file', '=', $tree->id()) ->where('multimedia_file_refn', 'NOT LIKE', 'http://%') ->where('multimedia_file_refn', 'NOT LIKE', 'https://%') ->pluck('multimedia_fil...
php
{ "resource": "" }
q20876
ReportPdf.setup
train
public function setup(): void { parent::setup(); // Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4 $this->pdf = new ReportTcpdf($this->orientation, parent::UNITS, [ $this->page_width, ...
php
{ "resource": "" }
q20877
ReportPdf.createImage
train
public function createImage(string $file, float $x, float $y, float $w, float $h, string $align,
php
{ "resource": "" }
q20878
Html.url
train
public static function url($path, array $data): string { $path = str_replace(' ',
php
{ "resource": "" }
q20879
Compiler.findScopeSelectors
train
protected function findScopeSelectors($scope, $depth) { if ($scope->depth === $depth && $scope->selectors) { return $scope->selectors; } if ($scope->children) { foreach (array_reverse($scope->children) as $c) {
php
{ "resource": "" }
q20880
Compiler.compileChildren
train
protected function compileChildren($stms, OutputBlock $out) { foreach ($stms as $stm) { $ret = $this->compileChild($stm, $out);
php
{ "resource": "" }
q20881
Compiler.joinSelectors
train
protected function joinSelectors($parent, $child, $selfParentSelectors = null) { $setSelf = false; $out = []; foreach ($child as $part) { $newPart = []; foreach ($part as $p) { if ($p === static::$selfSelector) { $setSelf = true; ...
php
{ "resource": "" }
q20882
Compiler.extractEnv
train
protected function extractEnv($envs) { for ($env = null; $e = array_pop($envs);) { $e->parent = $env;
php
{ "resource": "" }
q20883
Compiler.setExisting
train
protected function setExisting($name, $value, Environment $env, $valueUnreduced = null) { $storeEnv = $env; $hasNamespace = $name[0] === '^' || $name[0] === '@' || $name[0] === '%'; for (;;) { if (array_key_exists($name, $env->store)) { break; } ...
php
{ "resource": "" }
q20884
Compiler.setRaw
train
protected function setRaw($name, $value, Environment $env, $valueUnreduced = null) { $env->store[$name] = $value; if ($valueUnreduced)
php
{ "resource": "" }
q20885
Compiler.sortArgs
train
protected function sortArgs($prototype, $args) { $keyArgs = []; $posArgs = []; // separate positional and keyword arguments foreach ($args as $arg) { list($key, $value) = $arg; $key = $key[1]; if (empty($key)) { $posArgs[] = empt...
php
{ "resource": "" }
q20886
Compiler.coerceValue
train
protected function coerceValue($value) { if (is_array($value) || $value instanceof \ArrayAccess) { return $value; } if (is_bool($value)) { return $this->toBool($value); } if ($value === null) { return static::$null; } if ...
php
{ "resource": "" }
q20887
Compiler.assertMap
train
public function assertMap($value) { $value = $this->coerceMap($value); if ($value[0]
php
{ "resource": "" }
q20888
Compiler.assertColor
train
public function assertColor($value) { if ($color = $this->coerceColor($value)) {
php
{ "resource": "" }
q20889
Compiler.hueToRGB
train
protected function hueToRGB($m1, $m2, $h) { if ($h < 0) { $h += 1; } elseif ($h > 1) { $h -= 1; } if ($h * 6 < 1)
php
{ "resource": "" }
q20890
Server.inputName
train
protected function inputName() { switch (true) { case isset($_GET['p']): return $_GET['p']; case isset($_SERVER['PATH_INFO']):
php
{ "resource": "" }
q20891
Server.findInput
train
protected function findInput() { if (($input = $this->inputName()) && strpos($input, '..') === false && substr($input, -5) === '.scss' ) { $name = $this->join($this->dir, $input);
php
{ "resource": "" }
q20892
Server.getIfModifiedSinceHeader
train
protected function getIfModifiedSinceHeader() { $modifiedSince = null; if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $modifiedSince = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
php
{ "resource": "" }
q20893
Server.checkedCompile
train
public function checkedCompile($in, $out) { if (! is_file($out) || filemtime($in) >
php
{ "resource": "" }
q20894
Server.cachedCompile
train
public function cachedCompile($in, $force = false) { // assume no root $root = null; if (is_string($in)) { $root = $in; } elseif (is_array($in) and isset($in['root'])) { if ($force or ! isset($in['files'])) { // If we are forcing a recompile o...
php
{ "resource": "" }
q20895
Parser.match
train
protected function match($regex, &$out, $eatWhitespace = null) { $r = '/' . $regex . '/' . $this->patternModifiers; if (! preg_match($r, $this->buffer, $out, null, $this->count)) { return false; } $this->count += strlen($out[0]);
php
{ "resource": "" }
q20896
Parser.matchChar
train
protected function matchChar($char, $eatWhitespace = null) { if (! isset($this->buffer[$this->count]) || $this->buffer[$this->count] !== $char) { return false; } $this->count++; if (! isset($eatWhitespace)) {
php
{ "resource": "" }
q20897
Parser.mediaQuery
train
protected function mediaQuery(&$out) { $expressions = null; $parts = []; if (($this->literal('only', 4) && ($only = true) || $this->literal('not', 3) && ($not = true) || true) && $this->mixedKeyword($mediaType) ) { $prop = [Type::T_MEDIA_TYPE]; i...
php
{ "resource": "" }
q20898
Parser.argValue
train
protected function argValue(&$out) { $s = $this->count; $keyword = null; if (! $this->variable($keyword) || ! $this->matchChar(':')) { $this->seek($s); $keyword = null; } if ($this->genericList($value, 'expression')) { $out = [$keyword, ...
php
{ "resource": "" }
q20899
Parser.func
train
protected function func($name, &$func) { $s = $this->count; if ($this->matchChar('(')) { if ($name === 'alpha' && $this->argumentList($args)) { $func = [Type::T_FUNCTION, $name, [Type::T_STRING, '', $args]]; return true; } if ($n...
php
{ "resource": "" }