repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
orchidsoftware/platform | src/Screen/Field.php | Field.translate | private function translate(): self
{
if (empty($this->translations)) {
return $this;
}
$lang = $this->get('lang');
foreach ($this->attributes as $key => $attribute) {
if (in_array($key, $this->translations, true)) {
$this->set($key, __($attri... | php | private function translate(): self
{
if (empty($this->translations)) {
return $this;
}
$lang = $this->get('lang');
foreach ($this->attributes as $key => $attribute) {
if (in_array($key, $this->translations, true)) {
$this->set($key, __($attri... | [
"private",
"function",
"translate",
"(",
")",
":",
"self",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"translations",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"lang",
"=",
"$",
"this",
"->",
"get",
"(",
"'lang'",
")",
";",
"fore... | Localization of fields.
@return $this | [
"Localization",
"of",
"fields",
"."
] | 4930f527629e11c404d0a89592e67c857a29b8ff | https://github.com/orchidsoftware/platform/blob/4930f527629e11c404d0a89592e67c857a29b8ff/src/Screen/Field.php#L222-L237 | train |
orchidsoftware/platform | src/Platform/Providers/FoundationServiceProvider.php | FoundationServiceProvider.registerOrchid | protected function registerOrchid(): self
{
$this->publishes([
realpath(PLATFORM_PATH.'/install-stubs/routes/') => base_path('routes'),
realpath(PLATFORM_PATH.'/install-stubs/Orchid/') => app_path('Orchid'),
], 'orchid-stubs');
return $this;
} | php | protected function registerOrchid(): self
{
$this->publishes([
realpath(PLATFORM_PATH.'/install-stubs/routes/') => base_path('routes'),
realpath(PLATFORM_PATH.'/install-stubs/Orchid/') => app_path('Orchid'),
], 'orchid-stubs');
return $this;
} | [
"protected",
"function",
"registerOrchid",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"publishes",
"(",
"[",
"realpath",
"(",
"PLATFORM_PATH",
".",
"'/install-stubs/routes/'",
")",
"=>",
"base_path",
"(",
"'routes'",
")",
",",
"realpath",
"(",
"PLATFORM_PA... | Register orchid.
@return $this | [
"Register",
"orchid",
"."
] | 4930f527629e11c404d0a89592e67c857a29b8ff | https://github.com/orchidsoftware/platform/blob/4930f527629e11c404d0a89592e67c857a29b8ff/src/Platform/Providers/FoundationServiceProvider.php#L105-L113 | train |
orchidsoftware/platform | src/Platform/Providers/FoundationServiceProvider.php | FoundationServiceProvider.registerViews | public function registerViews(): self
{
$this->loadViewsFrom(PLATFORM_PATH.'/resources/views', 'platform');
$this->publishes([
PLATFORM_PATH.'/resources/views' => resource_path('views/vendor/platform'),
], 'views');
return $this;
} | php | public function registerViews(): self
{
$this->loadViewsFrom(PLATFORM_PATH.'/resources/views', 'platform');
$this->publishes([
PLATFORM_PATH.'/resources/views' => resource_path('views/vendor/platform'),
], 'views');
return $this;
} | [
"public",
"function",
"registerViews",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"loadViewsFrom",
"(",
"PLATFORM_PATH",
".",
"'/resources/views'",
",",
"'platform'",
")",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"PLATFORM_PATH",
".",
"'/resources/vi... | Register views & Publish views.
@return $this | [
"Register",
"views",
"&",
"Publish",
"views",
"."
] | 4930f527629e11c404d0a89592e67c857a29b8ff | https://github.com/orchidsoftware/platform/blob/4930f527629e11c404d0a89592e67c857a29b8ff/src/Platform/Providers/FoundationServiceProvider.php#L120-L129 | train |
orchidsoftware/platform | src/Platform/Providers/FoundationServiceProvider.php | FoundationServiceProvider.register | public function register(): void
{
$this->commands($this->commands);
$this->app->singleton(Dashboard::class, function () {
return new Dashboard();
});
if (! Route::hasMacro('screen')) {
Route::macro('screen', function ($url, $screen, $name = null) {
... | php | public function register(): void
{
$this->commands($this->commands);
$this->app->singleton(Dashboard::class, function () {
return new Dashboard();
});
if (! Route::hasMacro('screen')) {
Route::macro('screen', function ($url, $screen, $name = null) {
... | [
"public",
"function",
"register",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"commands",
"(",
"$",
"this",
"->",
"commands",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"Dashboard",
"::",
"class",
",",
"function",
"(",
")",
"{",
... | Register bindings the service provider. | [
"Register",
"bindings",
"the",
"service",
"provider",
"."
] | 4930f527629e11c404d0a89592e67c857a29b8ff | https://github.com/orchidsoftware/platform/blob/4930f527629e11c404d0a89592e67c857a29b8ff/src/Platform/Providers/FoundationServiceProvider.php#L161-L187 | train |
orchidsoftware/platform | src/Press/Models/Category.php | Category.getAllCategories | public function getAllCategories()
{
$categories = $this->exists ? self::whereNotIn('id', [$this->id])->get() : self::get();
return $categories->mapWithKeys(function ($item) {
return [$item->id => $item->term->GetContent('name')];
})->toArray();
} | php | public function getAllCategories()
{
$categories = $this->exists ? self::whereNotIn('id', [$this->id])->get() : self::get();
return $categories->mapWithKeys(function ($item) {
return [$item->id => $item->term->GetContent('name')];
})->toArray();
} | [
"public",
"function",
"getAllCategories",
"(",
")",
"{",
"$",
"categories",
"=",
"$",
"this",
"->",
"exists",
"?",
"self",
"::",
"whereNotIn",
"(",
"'id'",
",",
"[",
"$",
"this",
"->",
"id",
"]",
")",
"->",
"get",
"(",
")",
":",
"self",
"::",
"get"... | Select all categories, except current.
@return array | [
"Select",
"all",
"categories",
"except",
"current",
"."
] | 4930f527629e11c404d0a89592e67c857a29b8ff | https://github.com/orchidsoftware/platform/blob/4930f527629e11c404d0a89592e67c857a29b8ff/src/Press/Models/Category.php#L39-L46 | train |
orchidsoftware/platform | src/Press/Models/Category.php | Category.newWithCreateTerm | public function newWithCreateTerm($term): self
{
$newTerm = Term::firstOrCreate($term);
$this->term_id = $newTerm->id;
$this->term()->associate($newTerm);
$this->setTaxonomy();
return $this;
} | php | public function newWithCreateTerm($term): self
{
$newTerm = Term::firstOrCreate($term);
$this->term_id = $newTerm->id;
$this->term()->associate($newTerm);
$this->setTaxonomy();
return $this;
} | [
"public",
"function",
"newWithCreateTerm",
"(",
"$",
"term",
")",
":",
"self",
"{",
"$",
"newTerm",
"=",
"Term",
"::",
"firstOrCreate",
"(",
"$",
"term",
")",
";",
"$",
"this",
"->",
"term_id",
"=",
"$",
"newTerm",
"->",
"id",
";",
"$",
"this",
"->",... | Create category term.
@param array $term
@return self | [
"Create",
"category",
"term",
"."
] | 4930f527629e11c404d0a89592e67c857a29b8ff | https://github.com/orchidsoftware/platform/blob/4930f527629e11c404d0a89592e67c857a29b8ff/src/Press/Models/Category.php#L55-L63 | train |
orchidsoftware/platform | src/Press/Models/Category.php | Category.setParent | public function setParent($parent_id = null): self
{
$parent_id = ((int) $parent_id > 0) ? (int) $parent_id : null;
$this->setAttribute('parent_id', $parent_id);
return $this;
} | php | public function setParent($parent_id = null): self
{
$parent_id = ((int) $parent_id > 0) ? (int) $parent_id : null;
$this->setAttribute('parent_id', $parent_id);
return $this;
} | [
"public",
"function",
"setParent",
"(",
"$",
"parent_id",
"=",
"null",
")",
":",
"self",
"{",
"$",
"parent_id",
"=",
"(",
"(",
"int",
")",
"$",
"parent_id",
">",
"0",
")",
"?",
"(",
"int",
")",
"$",
"parent_id",
":",
"null",
";",
"$",
"this",
"->... | Set parent category.
@param int|null $parent_id
@return self | [
"Set",
"parent",
"category",
"."
] | 4930f527629e11c404d0a89592e67c857a29b8ff | https://github.com/orchidsoftware/platform/blob/4930f527629e11c404d0a89592e67c857a29b8ff/src/Press/Models/Category.php#L72-L79 | train |
mpdf/mpdf | src/Writer/BaseWriter.php | BaseWriter.utf8ToUtf16BigEndian | public function utf8ToUtf16BigEndian($str, $setbom = true) // UTF8ToUTF16BE
{
if ($this->mpdf->checkSIP && preg_match("/([\x{20000}-\x{2FFFF}])/u", $str)) {
if (!in_array($this->mpdf->currentfontfamily, ['gb', 'big5', 'sjis', 'uhc', 'gbB', 'big5B', 'sjisB', 'uhcB', 'gbI', 'big5I', 'sjisI', 'uhcI',
'gbBI', 'bi... | php | public function utf8ToUtf16BigEndian($str, $setbom = true) // UTF8ToUTF16BE
{
if ($this->mpdf->checkSIP && preg_match("/([\x{20000}-\x{2FFFF}])/u", $str)) {
if (!in_array($this->mpdf->currentfontfamily, ['gb', 'big5', 'sjis', 'uhc', 'gbB', 'big5B', 'sjisB', 'uhcB', 'gbI', 'big5I', 'sjisI', 'uhcI',
'gbBI', 'bi... | [
"public",
"function",
"utf8ToUtf16BigEndian",
"(",
"$",
"str",
",",
"$",
"setbom",
"=",
"true",
")",
"// UTF8ToUTF16BE",
"{",
"if",
"(",
"$",
"this",
"->",
"mpdf",
"->",
"checkSIP",
"&&",
"preg_match",
"(",
"\"/([\\x{20000}-\\x{2FFFF}])/u\"",
",",
"$",
"str",
... | Converts UTF-8 strings to UTF16-BE. | [
"Converts",
"UTF",
"-",
"8",
"strings",
"to",
"UTF16",
"-",
"BE",
"."
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Writer/BaseWriter.php#L85-L105 | train |
mpdf/mpdf | src/Otl.php | Otl._getXAdvancePos | private function _getXAdvancePos($pos)
{
// NB Not all fonts have all marks specified in GlyphClassMarks
// If the current glyph is not a base (but a mark) then ignore this, and apply to the current position
if (strpos($this->GlyphClassMarks, $this->OTLdata[$pos]['hex']) !== false) {
return $pos;
}
while... | php | private function _getXAdvancePos($pos)
{
// NB Not all fonts have all marks specified in GlyphClassMarks
// If the current glyph is not a base (but a mark) then ignore this, and apply to the current position
if (strpos($this->GlyphClassMarks, $this->OTLdata[$pos]['hex']) !== false) {
return $pos;
}
while... | [
"private",
"function",
"_getXAdvancePos",
"(",
"$",
"pos",
")",
"{",
"// NB Not all fonts have all marks specified in GlyphClassMarks",
"// If the current glyph is not a base (but a mark) then ignore this, and apply to the current position",
"if",
"(",
"strpos",
"(",
"$",
"this",
"->... | the last of any Marks which immediately follow the current glyph | [
"the",
"last",
"of",
"any",
"Marks",
"which",
"immediately",
"follow",
"the",
"current",
"glyph"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Otl.php#L3268-L3280 | train |
mpdf/mpdf | src/PageFormat.php | PageFormat.getSizeFromName | public static function getSizeFromName($name)
{
$format = strtoupper($name);
$formats = [
'4A0' => [4767.87, 6740.79],
'2A0' => [3370.39, 4767.87],
'A0' => [2383.94, 3370.39],
'A1' => [1683.78, 2383.94],
'A2' => [1190.55, 1683.78],
'A3' => [841.89, 1190.55],
'A4' => [595.28, 841.89],
'A5' =... | php | public static function getSizeFromName($name)
{
$format = strtoupper($name);
$formats = [
'4A0' => [4767.87, 6740.79],
'2A0' => [3370.39, 4767.87],
'A0' => [2383.94, 3370.39],
'A1' => [1683.78, 2383.94],
'A2' => [1190.55, 1683.78],
'A3' => [841.89, 1190.55],
'A4' => [595.28, 841.89],
'A5' =... | [
"public",
"static",
"function",
"getSizeFromName",
"(",
"$",
"name",
")",
"{",
"$",
"format",
"=",
"strtoupper",
"(",
"$",
"name",
")",
";",
"$",
"formats",
"=",
"[",
"'4A0'",
"=>",
"[",
"4767.87",
",",
"6740.79",
"]",
",",
"'2A0'",
"=>",
"[",
"3370.... | This method returns an array of width and height of given named format.
Returned values are milimeters multiplied by scale factor of 72 / 25.4
@param string $name
@return float[] Width and height of given format | [
"This",
"method",
"returns",
"an",
"array",
"of",
"width",
"and",
"height",
"of",
"given",
"named",
"format",
"."
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/PageFormat.php#L16-L82 | train |
mpdf/mpdf | src/CssManager.php | CssManager.array_merge_recursive_unique | function array_merge_recursive_unique($array1, $array2)
{
$arrays = func_get_args();
$narrays = count($arrays);
$ret = $arrays[0];
for ($i = 1; $i < $narrays; $i ++) {
foreach ($arrays[$i] as $key => $value) {
if (((string) $key) === ((string)((int) $key))) { // integer or string as integer key - append... | php | function array_merge_recursive_unique($array1, $array2)
{
$arrays = func_get_args();
$narrays = count($arrays);
$ret = $arrays[0];
for ($i = 1; $i < $narrays; $i ++) {
foreach ($arrays[$i] as $key => $value) {
if (((string) $key) === ((string)((int) $key))) { // integer or string as integer key - append... | [
"function",
"array_merge_recursive_unique",
"(",
"$",
"array1",
",",
"$",
"array2",
")",
"{",
"$",
"arrays",
"=",
"func_get_args",
"(",
")",
";",
"$",
"narrays",
"=",
"count",
"(",
"$",
"arrays",
")",
";",
"$",
"ret",
"=",
"$",
"arrays",
"[",
"0",
"]... | for CSS handling | [
"for",
"CSS",
"handling"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/CssManager.php#L1326-L1345 | train |
mpdf/mpdf | src/CssManager.php | CssManager._nthchild | function _nthchild($f, $c)
{
// $f is formula e.g. 2N+1 split into a preg_match array
// $c is the comparator value e.g row or column number
$c += 1;
$select = false;
$f_count = count($f);
if ($f[0] === 'ODD') {
$a = 2;
$b = 1;
} elseif ($f[0] === 'EVEN') {
$a = 2;
$b = 0;
} elseif ($f_cou... | php | function _nthchild($f, $c)
{
// $f is formula e.g. 2N+1 split into a preg_match array
// $c is the comparator value e.g row or column number
$c += 1;
$select = false;
$f_count = count($f);
if ($f[0] === 'ODD') {
$a = 2;
$b = 1;
} elseif ($f[0] === 'EVEN') {
$a = 2;
$b = 0;
} elseif ($f_cou... | [
"function",
"_nthchild",
"(",
"$",
"f",
",",
"$",
"c",
")",
"{",
"// $f is formula e.g. 2N+1 split into a preg_match array",
"// $c is the comparator value e.g row or column number",
"$",
"c",
"+=",
"1",
";",
"$",
"select",
"=",
"false",
";",
"$",
"f_count",
"=",
"c... | mPDF 5.7.4 nth-child | [
"mPDF",
"5",
".",
"7",
".",
"4",
"nth",
"-",
"child"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/CssManager.php#L2187-L2240 | train |
mpdf/mpdf | src/Barcode/AbstractBarcode.php | AbstractBarcode.binseqToArray | protected function binseqToArray($seq, array $barcodeData)
{
$len = strlen($seq);
$w = 0;
$k = 0;
for ($i = 0; $i < $len; ++$i) {
$w += 1;
if (($i == ($len - 1)) or (($i < ($len - 1)) and ($seq[$i] != $seq[($i + 1)]))) {
if ($seq[$i] == '1') {
$t = true; // bar
} else {
$t = false; // s... | php | protected function binseqToArray($seq, array $barcodeData)
{
$len = strlen($seq);
$w = 0;
$k = 0;
for ($i = 0; $i < $len; ++$i) {
$w += 1;
if (($i == ($len - 1)) or (($i < ($len - 1)) and ($seq[$i] != $seq[($i + 1)]))) {
if ($seq[$i] == '1') {
$t = true; // bar
} else {
$t = false; // s... | [
"protected",
"function",
"binseqToArray",
"(",
"$",
"seq",
",",
"array",
"$",
"barcodeData",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"seq",
")",
";",
"$",
"w",
"=",
"0",
";",
"$",
"k",
"=",
"0",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";"... | Convert binary barcode sequence to barcode array
@param string $seq
@param mixed[] $barcodeData
@return mixed[] | [
"Convert",
"binary",
"barcode",
"sequence",
"to",
"barcode",
"array"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Barcode/AbstractBarcode.php#L47-L67 | train |
mpdf/mpdf | src/Barcode/S25.php | S25.checksum | private function checksum($code)
{
$len = strlen($code);
$sum = 0;
for ($i = 0; $i < $len; $i += 2) {
$sum += $code[$i];
}
$sum *= 3;
for ($i = 1; $i < $len; $i += 2) {
$sum += ($code[$i]);
}
$r = $sum % 10;
if ($r > 0) {
$r = (10 - $r);
}
return $r;
} | php | private function checksum($code)
{
$len = strlen($code);
$sum = 0;
for ($i = 0; $i < $len; $i += 2) {
$sum += $code[$i];
}
$sum *= 3;
for ($i = 1; $i < $len; $i += 2) {
$sum += ($code[$i]);
}
$r = $sum % 10;
if ($r > 0) {
$r = (10 - $r);
}
return $r;
} | [
"private",
"function",
"checksum",
"(",
"$",
"code",
")",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"code",
")",
";",
"$",
"sum",
"=",
"0",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"len",
";",
"$",
"i",
"+=",
"2",
")"... | Checksum for standard 2 of 5 barcodes.
@param string $code
@return int | [
"Checksum",
"for",
"standard",
"2",
"of",
"5",
"barcodes",
"."
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Barcode/S25.php#L85-L101 | train |
mpdf/mpdf | src/FpdiTrait.php | FpdiTrait.getImportedExternalPageLinks | public function getImportedExternalPageLinks($pageNumber)
{
$links = [];
$reader = $this->getPdfReader($this->currentReaderId);
$parser = $reader->getParser();
$page = $reader->getPage($pageNumber);
$page->getPageDictionary();
$annotations = $page->getAttribute('Annots');
if ($annotations instanceof P... | php | public function getImportedExternalPageLinks($pageNumber)
{
$links = [];
$reader = $this->getPdfReader($this->currentReaderId);
$parser = $reader->getParser();
$page = $reader->getPage($pageNumber);
$page->getPageDictionary();
$annotations = $page->getAttribute('Annots');
if ($annotations instanceof P... | [
"public",
"function",
"getImportedExternalPageLinks",
"(",
"$",
"pageNumber",
")",
"{",
"$",
"links",
"=",
"[",
"]",
";",
"$",
"reader",
"=",
"$",
"this",
"->",
"getPdfReader",
"(",
"$",
"this",
"->",
"currentReaderId",
")",
";",
"$",
"parser",
"=",
"$",... | Imports the external page links
@param int $pageNumber The page number.
@return array
@throws CrossReferenceException
@throws PdfTypeException
@throws \setasign\Fpdi\PdfParser\PdfParserException | [
"Imports",
"the",
"external",
"page",
"links"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/FpdiTrait.php#L183-L247 | train |
mpdf/mpdf | src/OtlDump.php | OtlDump._checkGSUBignore | function _checkGSUBignore($flag, $glyph, $MarkFilteringSet)
{
$ignore = false;
// Flag & 0x0008 = Ignore Marks
if ((($flag & 0x0008) == 0x0008) && strpos($this->GlyphClassMarks, $glyph)) {
$ignore = true;
}
if ((($flag & 0x0004) == 0x0004) && strpos($this->GlyphClassLigatures, $glyph)) {
$ignore = true... | php | function _checkGSUBignore($flag, $glyph, $MarkFilteringSet)
{
$ignore = false;
// Flag & 0x0008 = Ignore Marks
if ((($flag & 0x0008) == 0x0008) && strpos($this->GlyphClassMarks, $glyph)) {
$ignore = true;
}
if ((($flag & 0x0004) == 0x0004) && strpos($this->GlyphClassLigatures, $glyph)) {
$ignore = true... | [
"function",
"_checkGSUBignore",
"(",
"$",
"flag",
",",
"$",
"glyph",
",",
"$",
"MarkFilteringSet",
")",
"{",
"$",
"ignore",
"=",
"false",
";",
"// Flag & 0x0008 = Ignore Marks",
"if",
"(",
"(",
"(",
"$",
"flag",
"&",
"0x0008",
")",
"==",
"0x0008",
")",
"... | mPDF 5.7.1 | [
"mPDF",
"5",
".",
"7",
".",
"1"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/OtlDump.php#L2688-L2711 | train |
mpdf/mpdf | src/OtlDump.php | OtlDump.getGlyphData | function getGlyphData($originalGlyphIdx, &$maxdepth, &$depth, &$points, &$contours)
{
$depth++;
$maxdepth = max($maxdepth, $depth);
if (count($this->glyphdata[$originalGlyphIdx]['compGlyphs'])) {
foreach ($this->glyphdata[$originalGlyphIdx]['compGlyphs'] as $glyphIdx) {
$this->getGlyphData($glyphIdx, $max... | php | function getGlyphData($originalGlyphIdx, &$maxdepth, &$depth, &$points, &$contours)
{
$depth++;
$maxdepth = max($maxdepth, $depth);
if (count($this->glyphdata[$originalGlyphIdx]['compGlyphs'])) {
foreach ($this->glyphdata[$originalGlyphIdx]['compGlyphs'] as $glyphIdx) {
$this->getGlyphData($glyphIdx, $max... | [
"function",
"getGlyphData",
"(",
"$",
"originalGlyphIdx",
",",
"&",
"$",
"maxdepth",
",",
"&",
"$",
"depth",
",",
"&",
"$",
"points",
",",
"&",
"$",
"contours",
")",
"{",
"$",
"depth",
"++",
";",
"$",
"maxdepth",
"=",
"max",
"(",
"$",
"maxdepth",
"... | Recursively get composite glyph data | [
"Recursively",
"get",
"composite",
"glyph",
"data"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/OtlDump.php#L4007-L4022 | train |
mpdf/mpdf | src/OtlDump.php | OtlDump.getGlyphs | function getGlyphs($originalGlyphIdx, &$start, &$glyphSet, &$subsetglyphs)
{
$glyphPos = $this->glyphPos[$originalGlyphIdx];
$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
if (!$glyphLen) {
return;
}
$this->seek($start + $glyphPos);
$numberOfContours = $this->read_short();
if ($number... | php | function getGlyphs($originalGlyphIdx, &$start, &$glyphSet, &$subsetglyphs)
{
$glyphPos = $this->glyphPos[$originalGlyphIdx];
$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
if (!$glyphLen) {
return;
}
$this->seek($start + $glyphPos);
$numberOfContours = $this->read_short();
if ($number... | [
"function",
"getGlyphs",
"(",
"$",
"originalGlyphIdx",
",",
"&",
"$",
"start",
",",
"&",
"$",
"glyphSet",
",",
"&",
"$",
"subsetglyphs",
")",
"{",
"$",
"glyphPos",
"=",
"$",
"this",
"->",
"glyphPos",
"[",
"$",
"originalGlyphIdx",
"]",
";",
"$",
"glyphL... | Recursively get composite glyphs | [
"Recursively",
"get",
"composite",
"glyphs"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/OtlDump.php#L4026-L4066 | train |
mpdf/mpdf | src/OtlDump.php | OtlDump.getCMAP4 | function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph)
{
$this->maxUniChar = 0;
$this->seek($unicode_cmap_offset + 2);
$length = $this->read_ushort();
$limit = $unicode_cmap_offset + $length;
$this->skip(2);
$segCount = $this->read_ushort() / 2;
$this->skip(6);
$endCount = [];
for ($i... | php | function getCMAP4($unicode_cmap_offset, &$glyphToChar, &$charToGlyph)
{
$this->maxUniChar = 0;
$this->seek($unicode_cmap_offset + 2);
$length = $this->read_ushort();
$limit = $unicode_cmap_offset + $length;
$this->skip(2);
$segCount = $this->read_ushort() / 2;
$this->skip(6);
$endCount = [];
for ($i... | [
"function",
"getCMAP4",
"(",
"$",
"unicode_cmap_offset",
",",
"&",
"$",
"glyphToChar",
",",
"&",
"$",
"charToGlyph",
")",
"{",
"$",
"this",
"->",
"maxUniChar",
"=",
"0",
";",
"$",
"this",
"->",
"seek",
"(",
"$",
"unicode_cmap_offset",
"+",
"2",
")",
";... | CMAP Format 4 | [
"CMAP",
"Format",
"4"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/OtlDump.php#L4188-L4241 | train |
mpdf/mpdf | src/Pdf/Protection.php | Protection.objectKey | public function objectKey($n)
{
if ($this->useRC128Encryption) {
$len = 16;
} else {
$len = 10;
}
return substr($this->md5toBinary($this->encryptionKey . pack('VXxx', $n)), 0, $len);
} | php | public function objectKey($n)
{
if ($this->useRC128Encryption) {
$len = 16;
} else {
$len = 10;
}
return substr($this->md5toBinary($this->encryptionKey . pack('VXxx', $n)), 0, $len);
} | [
"public",
"function",
"objectKey",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useRC128Encryption",
")",
"{",
"$",
"len",
"=",
"16",
";",
"}",
"else",
"{",
"$",
"len",
"=",
"10",
";",
"}",
"return",
"substr",
"(",
"$",
"this",
"->",
... | Compute key depending on object number where the encrypted data is stored
@param int $n
@return string | [
"Compute",
"key",
"depending",
"on",
"object",
"number",
"where",
"the",
"encrypted",
"data",
"is",
"stored"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Pdf/Protection.php#L135-L144 | train |
mpdf/mpdf | src/Pdf/Protection.php | Protection.rc4 | public function rc4($key, $text)
{
if ($this->lastRc4Key != $key) {
$k = str_repeat($key, 256 / strlen($key) + 1);
$rc4 = range(0, 255);
$j = 0;
for ($i = 0; $i < 256; $i++) {
$t = $rc4[$i];
$j = ($j + $t + ord($k[$i])) % 256;
$rc4[$i] = $rc4[$j];
$rc4[$j] = $t;
}
$this->lastRc4Key ... | php | public function rc4($key, $text)
{
if ($this->lastRc4Key != $key) {
$k = str_repeat($key, 256 / strlen($key) + 1);
$rc4 = range(0, 255);
$j = 0;
for ($i = 0; $i < 256; $i++) {
$t = $rc4[$i];
$j = ($j + $t + ord($k[$i])) % 256;
$rc4[$i] = $rc4[$j];
$rc4[$j] = $t;
}
$this->lastRc4Key ... | [
"public",
"function",
"rc4",
"(",
"$",
"key",
",",
"$",
"text",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"lastRc4Key",
"!=",
"$",
"key",
")",
"{",
"$",
"k",
"=",
"str_repeat",
"(",
"$",
"key",
",",
"256",
"/",
"strlen",
"(",
"$",
"key",
")",
"... | RC4 is the standard encryption algorithm used in PDF format
@param string $key
@param string $text
@return string | [
"RC4",
"is",
"the",
"standard",
"encryption",
"algorithm",
"used",
"in",
"PDF",
"format"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Pdf/Protection.php#L154-L187 | train |
mpdf/mpdf | src/Image/Svg.php | Svg.svg_overflow | function svg_overflow($x, $y)
{
$x2 = $x;
$y2 = $y;
if (isset($this->svg_attribs['overflow'])) {
if ($this->svg_attribs['overflow'] == 'hidden') {
// Not sure if this is supposed to strip off units, but since I dont use any I will omlt this step
$svg_w = preg_replace("/([0-9\.]*)(.*)/i", "$1", $this->... | php | function svg_overflow($x, $y)
{
$x2 = $x;
$y2 = $y;
if (isset($this->svg_attribs['overflow'])) {
if ($this->svg_attribs['overflow'] == 'hidden') {
// Not sure if this is supposed to strip off units, but since I dont use any I will omlt this step
$svg_w = preg_replace("/([0-9\.]*)(.*)/i", "$1", $this->... | [
"function",
"svg_overflow",
"(",
"$",
"x",
",",
"$",
"y",
")",
"{",
"$",
"x2",
"=",
"$",
"x",
";",
"$",
"y2",
"=",
"$",
"y",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"svg_attribs",
"[",
"'overflow'",
"]",
")",
")",
"{",
"if",
"(",
"... | check if points are within svg, if not, set to max | [
"check",
"if",
"points",
"are",
"within",
"svg",
"if",
"not",
"set",
"to",
"max"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Image/Svg.php#L1094-L1128 | train |
mpdf/mpdf | src/Image/ImageProcessor.php | ImageProcessor.fourBytesToInt | private function fourBytesToInt($s)
{
return (ord($s[0]) << 24) + (ord($s[1]) << 16) + (ord($s[2]) << 8) + ord($s[3]);
} | php | private function fourBytesToInt($s)
{
return (ord($s[0]) << 24) + (ord($s[1]) << 16) + (ord($s[2]) << 8) + ord($s[3]);
} | [
"private",
"function",
"fourBytesToInt",
"(",
"$",
"s",
")",
"{",
"return",
"(",
"ord",
"(",
"$",
"s",
"[",
"0",
"]",
")",
"<<",
"24",
")",
"+",
"(",
"ord",
"(",
"$",
"s",
"[",
"1",
"]",
")",
"<<",
"16",
")",
"+",
"(",
"ord",
"(",
"$",
"s... | Read a 4-byte integer from string | [
"Read",
"a",
"4",
"-",
"byte",
"integer",
"from",
"string"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Image/ImageProcessor.php#L1375-L1378 | train |
mpdf/mpdf | src/Image/ImageProcessor.php | ImageProcessor.imageError | private function imageError($file, $firsttime, $msg)
{
$this->failedImages[$file] = true;
if ($firsttime && ($this->mpdf->showImageErrors || $this->mpdf->debug)) {
throw new \Mpdf\MpdfImageException(sprintf('%s (%s)', $msg, $file));
}
$this->logger->warning(sprintf('%s (%s)', $msg, $file), ['context' => L... | php | private function imageError($file, $firsttime, $msg)
{
$this->failedImages[$file] = true;
if ($firsttime && ($this->mpdf->showImageErrors || $this->mpdf->debug)) {
throw new \Mpdf\MpdfImageException(sprintf('%s (%s)', $msg, $file));
}
$this->logger->warning(sprintf('%s (%s)', $msg, $file), ['context' => L... | [
"private",
"function",
"imageError",
"(",
"$",
"file",
",",
"$",
"firsttime",
",",
"$",
"msg",
")",
"{",
"$",
"this",
"->",
"failedImages",
"[",
"$",
"file",
"]",
"=",
"true",
";",
"if",
"(",
"$",
"firsttime",
"&&",
"(",
"$",
"this",
"->",
"mpdf",
... | Throw an exception and save re-trying image URL's which have already failed | [
"Throw",
"an",
"exception",
"and",
"save",
"re",
"-",
"trying",
"image",
"URL",
"s",
"which",
"have",
"already",
"failed"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Image/ImageProcessor.php#L1401-L1410 | train |
mpdf/mpdf | src/Tag.php | Tag.getTagClassName | public static function getTagClassName($tag)
{
static $map = [
'BARCODE' => 'BarCode',
'BLOCKQUOTE' => 'BlockQuote',
'COLUMN_BREAK' => 'ColumnBreak',
'COLUMNBREAK' => 'ColumnBreak',
'DOTTAB' => 'DotTab',
'FIELDSET' => 'FieldSet',
'FIGCAPTION' => 'FigCaption',
'FORMFEED' => 'FormFeed',
'HGR... | php | public static function getTagClassName($tag)
{
static $map = [
'BARCODE' => 'BarCode',
'BLOCKQUOTE' => 'BlockQuote',
'COLUMN_BREAK' => 'ColumnBreak',
'COLUMNBREAK' => 'ColumnBreak',
'DOTTAB' => 'DotTab',
'FIELDSET' => 'FieldSet',
'FIGCAPTION' => 'FigCaption',
'FORMFEED' => 'FormFeed',
'HGR... | [
"public",
"static",
"function",
"getTagClassName",
"(",
"$",
"tag",
")",
"{",
"static",
"$",
"map",
"=",
"[",
"'BARCODE'",
"=>",
"'BarCode'",
",",
"'BLOCKQUOTE'",
"=>",
"'BlockQuote'",
",",
"'COLUMN_BREAK'",
"=>",
"'ColumnBreak'",
",",
"'COLUMNBREAK'",
"=>",
"... | Returns the fully qualified name of the class handling the rendering of the given tag
@param string $tag The tag name
@return string The fully qualified name | [
"Returns",
"the",
"fully",
"qualified",
"name",
"of",
"the",
"class",
"handling",
"the",
"rendering",
"of",
"the",
"given",
"tag"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Tag.php#L134-L174 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.GetFirstBlockFill | function GetFirstBlockFill()
{
// Returns the first blocklevel that uses a bgcolor fill
$startfill = 0;
for ($i = 1; $i <= $this->blklvl; $i++) {
if ($this->blk[$i]['bgcolor'] || $this->blk[$i]['border_left']['w'] || $this->blk[$i]['border_right']['w'] || $this->blk[$i]['border_top']['w'] || $this->blk[$i]['b... | php | function GetFirstBlockFill()
{
// Returns the first blocklevel that uses a bgcolor fill
$startfill = 0;
for ($i = 1; $i <= $this->blklvl; $i++) {
if ($this->blk[$i]['bgcolor'] || $this->blk[$i]['border_left']['w'] || $this->blk[$i]['border_right']['w'] || $this->blk[$i]['border_top']['w'] || $this->blk[$i]['b... | [
"function",
"GetFirstBlockFill",
"(",
")",
"{",
"// Returns the first blocklevel that uses a bgcolor fill",
"$",
"startfill",
"=",
"0",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"$",
"this",
"->",
"blklvl",
";",
"$",
"i",
"++",
")",
"{",
... | Used when ColActive for tables - updated to return first block with background fill OR borders | [
"Used",
"when",
"ColActive",
"for",
"tables",
"-",
"updated",
"to",
"return",
"first",
"block",
"with",
"background",
"fill",
"OR",
"borders"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L6173-L6184 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf._moveToPrevChar | function _moveToPrevChar(&$contentctr, &$charctr, $content)
{
$lastchar = false;
$charctr--;
while ($charctr < 0) { // go back to previous $content[]
$contentctr--;
if ($contentctr < 0) {
return false;
}
if ($this->usingCoreFont) {
$charctr = strlen($content[$contentctr]) - 1;
} else {
... | php | function _moveToPrevChar(&$contentctr, &$charctr, $content)
{
$lastchar = false;
$charctr--;
while ($charctr < 0) { // go back to previous $content[]
$contentctr--;
if ($contentctr < 0) {
return false;
}
if ($this->usingCoreFont) {
$charctr = strlen($content[$contentctr]) - 1;
} else {
... | [
"function",
"_moveToPrevChar",
"(",
"&",
"$",
"contentctr",
",",
"&",
"$",
"charctr",
",",
"$",
"content",
")",
"{",
"$",
"lastchar",
"=",
"false",
";",
"$",
"charctr",
"--",
";",
"while",
"(",
"$",
"charctr",
"<",
"0",
")",
"{",
"// go back to previou... | Get previous character and move pointers | [
"Get",
"previous",
"character",
"and",
"move",
"pointers"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L7540-L7561 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf._advanceFloatMargins | function _advanceFloatMargins()
{
// Update floatmargins - L
if (isset($this->floatmargins['L']) && $this->floatmargins['L']['skipline'] && $this->floatmargins['L']['y0'] != $this->y) {
$yadj = $this->y - $this->floatmargins['L']['y0'];
$this->floatmargins['L']['y0'] = $this->y;
$this->floatmargins['L']['... | php | function _advanceFloatMargins()
{
// Update floatmargins - L
if (isset($this->floatmargins['L']) && $this->floatmargins['L']['skipline'] && $this->floatmargins['L']['y0'] != $this->y) {
$yadj = $this->y - $this->floatmargins['L']['y0'];
$this->floatmargins['L']['y0'] = $this->y;
$this->floatmargins['L']['... | [
"function",
"_advanceFloatMargins",
"(",
")",
"{",
"// Update floatmargins - L",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"floatmargins",
"[",
"'L'",
"]",
")",
"&&",
"$",
"this",
"->",
"floatmargins",
"[",
"'L'",
"]",
"[",
"'skipline'",
"]",
"&&",
"$",
... | Update values if set to skipline | [
"Update",
"values",
"if",
"set",
"to",
"skipline"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L8611-L8649 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.writeHTMLHeaders | function writeHTMLHeaders()
{
if ($this->mirrorMargins && ($this->page) % 2 == 0) {
$OE = 'E';
} else {
$OE = 'O';
}
if ($OE === 'E') {
$this->saveHTMLHeader[$this->page][$OE]['html'] = $this->HTMLHeaderE['html'];
} else {
$this->saveHTMLHeader[$this->page][$OE]['html'] = $this->HTMLHeader['htm... | php | function writeHTMLHeaders()
{
if ($this->mirrorMargins && ($this->page) % 2 == 0) {
$OE = 'E';
} else {
$OE = 'O';
}
if ($OE === 'E') {
$this->saveHTMLHeader[$this->page][$OE]['html'] = $this->HTMLHeaderE['html'];
} else {
$this->saveHTMLHeader[$this->page][$OE]['html'] = $this->HTMLHeader['htm... | [
"function",
"writeHTMLHeaders",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"mirrorMargins",
"&&",
"(",
"$",
"this",
"->",
"page",
")",
"%",
"2",
"==",
"0",
")",
"{",
"$",
"OE",
"=",
"'E'",
";",
"}",
"else",
"{",
"$",
"OE",
"=",
"'O'",
";",
... | Called internally from Header | [
"Called",
"internally",
"from",
"Header"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L12261-L12292 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.ClearFloats | function ClearFloats($clear, $blklvl = 0)
{
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($blklvl, true);
$end = $currpos = ($this->page * 1000 + $this->y);
if ($clear == 'BOTH' && ($l_exists || $r_exists)) {
$this->pageoutput[$this->page] = [];
$end = max($l_max, ... | php | function ClearFloats($clear, $blklvl = 0)
{
list($l_exists, $r_exists, $l_max, $r_max, $l_width, $r_width) = $this->GetFloatDivInfo($blklvl, true);
$end = $currpos = ($this->page * 1000 + $this->y);
if ($clear == 'BOTH' && ($l_exists || $r_exists)) {
$this->pageoutput[$this->page] = [];
$end = max($l_max, ... | [
"function",
"ClearFloats",
"(",
"$",
"clear",
",",
"$",
"blklvl",
"=",
"0",
")",
"{",
"list",
"(",
"$",
"l_exists",
",",
"$",
"r_exists",
",",
"$",
"l_max",
",",
"$",
"r_max",
",",
"$",
"l_width",
",",
"$",
"r_width",
")",
"=",
"$",
"this",
"->",... | Added mPDF 3.0 Float DIV - CLEAR | [
"Added",
"mPDF",
"3",
".",
"0",
"Float",
"DIV",
"-",
"CLEAR"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L15061-L15089 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.GetFloatDivInfo | function GetFloatDivInfo($blklvl = 0, $clear = false)
{
// If blklvl specified, only returns floats at that level - for ClearFloats
$l_exists = false;
$r_exists = false;
$l_max = 0;
$r_max = 0;
$l_width = 0;
$r_width = 0;
if (count($this->floatDivs)) {
$currpos = ($this->page * 1000 + $this->y);
... | php | function GetFloatDivInfo($blklvl = 0, $clear = false)
{
// If blklvl specified, only returns floats at that level - for ClearFloats
$l_exists = false;
$r_exists = false;
$l_max = 0;
$r_max = 0;
$l_width = 0;
$r_width = 0;
if (count($this->floatDivs)) {
$currpos = ($this->page * 1000 + $this->y);
... | [
"function",
"GetFloatDivInfo",
"(",
"$",
"blklvl",
"=",
"0",
",",
"$",
"clear",
"=",
"false",
")",
"{",
"// If blklvl specified, only returns floats at that level - for ClearFloats",
"$",
"l_exists",
"=",
"false",
";",
"$",
"r_exists",
"=",
"false",
";",
"$",
"l_m... | Added mPDF 3.0 Float DIV | [
"Added",
"mPDF",
"3",
".",
"0",
"Float",
"DIV"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L15092-L15119 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.SetStylesArray | function SetStylesArray($arr)
{
$style = '';
foreach (['B', 'I'] as $s) {
if (isset($arr[$s])) {
if ($arr[$s]) {
$this->$s = true;
$style .= $s;
} else {
$this->$s = false;
}
} elseif ($this->$s) {
$style .= $s;
}
}
$this->currentfontstyle = $style;
$this->SetFont('', ... | php | function SetStylesArray($arr)
{
$style = '';
foreach (['B', 'I'] as $s) {
if (isset($arr[$s])) {
if ($arr[$s]) {
$this->$s = true;
$style .= $s;
} else {
$this->$s = false;
}
} elseif ($this->$s) {
$style .= $s;
}
}
$this->currentfontstyle = $style;
$this->SetFont('', ... | [
"function",
"SetStylesArray",
"(",
"$",
"arr",
")",
"{",
"$",
"style",
"=",
"''",
";",
"foreach",
"(",
"[",
"'B'",
",",
"'I'",
"]",
"as",
"$",
"s",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"arr",
"[",
"$",
"s",
"]",
")",
")",
"{",
"if",
"(",... | Set multiple styles at one time | [
"Set",
"multiple",
"styles",
"at",
"one",
"time"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L18771-L18788 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.Bookmark | function Bookmark($txt, $level = 0, $y = 0)
{
$txt = $this->purify_utf8_text($txt);
if ($this->text_input_as_HTML) {
$txt = $this->all_entities_to_utf8($txt);
}
if ($y == -1) {
if (!$this->ColActive) {
$y = $this->y;
} else {
$y = $this->y0;
} // If columns are on - mark top of columns
}
... | php | function Bookmark($txt, $level = 0, $y = 0)
{
$txt = $this->purify_utf8_text($txt);
if ($this->text_input_as_HTML) {
$txt = $this->all_entities_to_utf8($txt);
}
if ($y == -1) {
if (!$this->ColActive) {
$y = $this->y;
} else {
$y = $this->y0;
} // If columns are on - mark top of columns
}
... | [
"function",
"Bookmark",
"(",
"$",
"txt",
",",
"$",
"level",
"=",
"0",
",",
"$",
"y",
"=",
"0",
")",
"{",
"$",
"txt",
"=",
"$",
"this",
"->",
"purify_utf8_text",
"(",
"$",
"txt",
")",
";",
"if",
"(",
"$",
"this",
"->",
"text_input_as_HTML",
")",
... | FROM class PDF_Bookmark | [
"FROM",
"class",
"PDF_Bookmark"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L23019-L23048 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.IndexEntry | function IndexEntry($txt, $xref = '')
{
if ($xref) {
$this->IndexEntrySee($txt, $xref);
return;
}
// Search the reference (AND Ref/PageNo) in the array
$Present = false;
if ($this->keep_block_together) {
// do nothing
} /* -- TABLES -- */ elseif ($this->kwt) {
$size = count($this->kwt_Referenc... | php | function IndexEntry($txt, $xref = '')
{
if ($xref) {
$this->IndexEntrySee($txt, $xref);
return;
}
// Search the reference (AND Ref/PageNo) in the array
$Present = false;
if ($this->keep_block_together) {
// do nothing
} /* -- TABLES -- */ elseif ($this->kwt) {
$size = count($this->kwt_Referenc... | [
"function",
"IndexEntry",
"(",
"$",
"txt",
",",
"$",
"xref",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"xref",
")",
"{",
"$",
"this",
"->",
"IndexEntrySee",
"(",
"$",
"txt",
",",
"$",
"xref",
")",
";",
"return",
";",
"}",
"// Search the reference (AND Ref... | FROM class PDF_Ref == INDEX | [
"FROM",
"class",
"PDF_Ref",
"==",
"INDEX"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L23631-L23669 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.IndexEntrySee | function IndexEntrySee($txta, $txtb)
{
if ($this->directionality == 'rtl') { // *OTL*
// ONLY DO THIS IF NOT IN TAGS
if ($txta == strip_tags($txta)) {
$txta = str_replace(':', ' - ', $txta); // *OTL*
}
if ($txtb == strip_tags($txtb)) {
$txtb = str_replace(':', ' - ', $txtb); // *OTL*
}
} // ... | php | function IndexEntrySee($txta, $txtb)
{
if ($this->directionality == 'rtl') { // *OTL*
// ONLY DO THIS IF NOT IN TAGS
if ($txta == strip_tags($txta)) {
$txta = str_replace(':', ' - ', $txta); // *OTL*
}
if ($txtb == strip_tags($txtb)) {
$txtb = str_replace(':', ' - ', $txtb); // *OTL*
}
} // ... | [
"function",
"IndexEntrySee",
"(",
"$",
"txta",
",",
"$",
"txtb",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"directionality",
"==",
"'rtl'",
")",
"{",
"// *OTL*",
"// ONLY DO THIS IF NOT IN TAGS",
"if",
"(",
"$",
"txta",
"==",
"strip_tags",
"(",
"$",
"txta",
... | Added function to add a reference "Elephants. See Chickens" | [
"Added",
"function",
"to",
"add",
"a",
"reference",
"Elephants",
".",
"See",
"Chickens"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L23672-L23692 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.is_utf8 | function is_utf8(&$string)
{
if ($string === mb_convert_encoding(mb_convert_encoding($string, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) {
return true;
}
if ($this->ignore_invalid_utf8) {
$string = mb_convert_encoding(mb_convert_encoding($string, "UTF-32", "UTF-8"), "UTF-8", "UTF-32");
return true;
}
... | php | function is_utf8(&$string)
{
if ($string === mb_convert_encoding(mb_convert_encoding($string, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) {
return true;
}
if ($this->ignore_invalid_utf8) {
$string = mb_convert_encoding(mb_convert_encoding($string, "UTF-32", "UTF-8"), "UTF-8", "UTF-32");
return true;
}
... | [
"function",
"is_utf8",
"(",
"&",
"$",
"string",
")",
"{",
"if",
"(",
"$",
"string",
"===",
"mb_convert_encoding",
"(",
"mb_convert_encoding",
"(",
"$",
"string",
",",
"\"UTF-32\"",
",",
"\"UTF-8\"",
")",
",",
"\"UTF-8\"",
",",
"\"UTF-32\"",
")",
")",
"{",
... | Edited v1.2 Pass by reference; option to continue if invalid UTF-8 chars | [
"Edited",
"v1",
".",
"2",
"Pass",
"by",
"reference",
";",
"option",
"to",
"continue",
"if",
"invalid",
"UTF",
"-",
"8",
"chars"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L25679-L25691 | train |
mpdf/mpdf | src/Mpdf.php | Mpdf.columnAdjustAdd | function columnAdjustAdd($type, $k, $xadj, $yadj, $a, $b, $c = 0, $d = 0, $e = 0, $f = 0)
{
if ($type === 'Td') { // xpos,ypos
$a += ($xadj * $k);
$b -= ($yadj * $k);
return 'BT ' . sprintf('%.3F %.3F', $a, $b) . ' Td';
} elseif ($type === 're') { // xpos,ypos,width,height
$a += ($xadj * $k);
... | php | function columnAdjustAdd($type, $k, $xadj, $yadj, $a, $b, $c = 0, $d = 0, $e = 0, $f = 0)
{
if ($type === 'Td') { // xpos,ypos
$a += ($xadj * $k);
$b -= ($yadj * $k);
return 'BT ' . sprintf('%.3F %.3F', $a, $b) . ' Td';
} elseif ($type === 're') { // xpos,ypos,width,height
$a += ($xadj * $k);
... | [
"function",
"columnAdjustAdd",
"(",
"$",
"type",
",",
"$",
"k",
",",
"$",
"xadj",
",",
"$",
"yadj",
",",
"$",
"a",
",",
"$",
"b",
",",
"$",
"c",
"=",
"0",
",",
"$",
"d",
"=",
"0",
",",
"$",
"e",
"=",
"0",
",",
"$",
"f",
"=",
"0",
")",
... | Callback function from function printcolumnbuffer in mpdf | [
"Callback",
"function",
"from",
"function",
"printcolumnbuffer",
"in",
"mpdf"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Mpdf.php#L26525-L26573 | train |
mpdf/mpdf | src/Barcode/Imb.php | Imb.imbCrc11Fcs | private function imbCrc11Fcs($codeArray)
{
$genpoly = 0x0F35; // generator polynomial
$fcs = 0x07FF; // Frame Check Sequence
// do most significant byte skipping the 2 most significant bits
$data = hexdec($codeArray[0]) << 5;
for ($bit = 2; $bit < 8; ++$bit) {
if (($fcs ^ $data) & 0x400) {
$fcs = ($f... | php | private function imbCrc11Fcs($codeArray)
{
$genpoly = 0x0F35; // generator polynomial
$fcs = 0x07FF; // Frame Check Sequence
// do most significant byte skipping the 2 most significant bits
$data = hexdec($codeArray[0]) << 5;
for ($bit = 2; $bit < 8; ++$bit) {
if (($fcs ^ $data) & 0x400) {
$fcs = ($f... | [
"private",
"function",
"imbCrc11Fcs",
"(",
"$",
"codeArray",
")",
"{",
"$",
"genpoly",
"=",
"0x0F35",
";",
"// generator polynomial",
"$",
"fcs",
"=",
"0x07FF",
";",
"// Frame Check Sequence",
"// do most significant byte skipping the 2 most significant bits",
"$",
"data"... | Intelligent Mail Barcode calculation of Frame Check Sequence
@param string[] $codeArray
@return int | [
"Intelligent",
"Mail",
"Barcode",
"calculation",
"of",
"Frame",
"Check",
"Sequence"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Barcode/Imb.php#L220-L250 | train |
mpdf/mpdf | src/Barcode/Imb.php | Imb.imbReverseUs | private function imbReverseUs($num)
{
$rev = 0;
for ($i = 0; $i < 16; ++$i) {
$rev <<= 1;
$rev |= ($num & 1);
$num >>= 1;
}
return $rev;
} | php | private function imbReverseUs($num)
{
$rev = 0;
for ($i = 0; $i < 16; ++$i) {
$rev <<= 1;
$rev |= ($num & 1);
$num >>= 1;
}
return $rev;
} | [
"private",
"function",
"imbReverseUs",
"(",
"$",
"num",
")",
"{",
"$",
"rev",
"=",
"0",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"16",
";",
"++",
"$",
"i",
")",
"{",
"$",
"rev",
"<<=",
"1",
";",
"$",
"rev",
"|=",
"(",
"$",... | Reverse unsigned short value
@param int $num
@return int | [
"Reverse",
"unsigned",
"short",
"value"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Barcode/Imb.php#L258-L267 | train |
mpdf/mpdf | src/Barcode/Imb.php | Imb.imbTables | private function imbTables($n, $size)
{
$table = [];
$lli = 0; // LUT lower index
$lui = $size - 1; // LUT upper index
for ($count = 0; $count < 8192; ++$count) {
$bitCount = 0;
for ($bit_index = 0; $bit_index < 13; ++$bit_index) {
$bitCount += (int) (($count & (1 << $bit_index)) != 0);
}
// ... | php | private function imbTables($n, $size)
{
$table = [];
$lli = 0; // LUT lower index
$lui = $size - 1; // LUT upper index
for ($count = 0; $count < 8192; ++$count) {
$bitCount = 0;
for ($bit_index = 0; $bit_index < 13; ++$bit_index) {
$bitCount += (int) (($count & (1 << $bit_index)) != 0);
}
// ... | [
"private",
"function",
"imbTables",
"(",
"$",
"n",
",",
"$",
"size",
")",
"{",
"$",
"table",
"=",
"[",
"]",
";",
"$",
"lli",
"=",
"0",
";",
"// LUT lower index",
"$",
"lui",
"=",
"$",
"size",
"-",
"1",
";",
"// LUT upper index",
"for",
"(",
"$",
... | Generate Nof13 tables used for Intelligent Mail Barcode
@param int $n
@param int $size
@return mixed[] | [
"Generate",
"Nof13",
"tables",
"used",
"for",
"Intelligent",
"Mail",
"Barcode"
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Barcode/Imb.php#L277-L310 | train |
mpdf/mpdf | src/Barcode/Imb.php | Imb.decToHex | private function decToHex($number)
{
$hex = [];
if ($number == 0) {
return '00';
}
while ($number > 0) {
if ($number == 0) {
array_push($hex, '0');
} else {
array_push($hex, strtoupper(dechex(bcmod($number, '16'))));
$number = bcdiv($number, '16', 0);
}
}
$hex = array_reverse($he... | php | private function decToHex($number)
{
$hex = [];
if ($number == 0) {
return '00';
}
while ($number > 0) {
if ($number == 0) {
array_push($hex, '0');
} else {
array_push($hex, strtoupper(dechex(bcmod($number, '16'))));
$number = bcdiv($number, '16', 0);
}
}
$hex = array_reverse($he... | [
"private",
"function",
"decToHex",
"(",
"$",
"number",
")",
"{",
"$",
"hex",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"number",
"==",
"0",
")",
"{",
"return",
"'00'",
";",
"}",
"while",
"(",
"$",
"number",
">",
"0",
")",
"{",
"if",
"(",
"$",
"numb... | Convert large integer number to hexadecimal representation.
@param int $number
@return string | [
"Convert",
"large",
"integer",
"number",
"to",
"hexadecimal",
"representation",
"."
] | ee370f89a21956ec0ea3e38c0678ced491c6b56a | https://github.com/mpdf/mpdf/blob/ee370f89a21956ec0ea3e38c0678ced491c6b56a/src/Barcode/Imb.php#L318-L337 | train |
nuwave/lighthouse | src/Subscriptions/StorageManager.php | StorageManager.subscriberByRequest | public function subscriberByRequest(array $input, array $headers): ?Subscriber
{
$channel = Arr::get($input, 'channel_name');
return $channel
? $this->subscriberByChannel($channel)
: null;
} | php | public function subscriberByRequest(array $input, array $headers): ?Subscriber
{
$channel = Arr::get($input, 'channel_name');
return $channel
? $this->subscriberByChannel($channel)
: null;
} | [
"public",
"function",
"subscriberByRequest",
"(",
"array",
"$",
"input",
",",
"array",
"$",
"headers",
")",
":",
"?",
"Subscriber",
"{",
"$",
"channel",
"=",
"Arr",
"::",
"get",
"(",
"$",
"input",
",",
"'channel_name'",
")",
";",
"return",
"$",
"channel"... | Get subscriber by request.
@param array $input
@param array $headers
@return \Nuwave\Lighthouse\Subscriptions\Subscriber|null | [
"Get",
"subscriber",
"by",
"request",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/StorageManager.php#L49-L56 | train |
nuwave/lighthouse | src/Subscriptions/StorageManager.php | StorageManager.subscriberByChannel | public function subscriberByChannel(string $channel): ?Subscriber
{
$key = self::SUBSCRIBER_KEY.".{$channel}";
return $this->cache->get($key);
} | php | public function subscriberByChannel(string $channel): ?Subscriber
{
$key = self::SUBSCRIBER_KEY.".{$channel}";
return $this->cache->get($key);
} | [
"public",
"function",
"subscriberByChannel",
"(",
"string",
"$",
"channel",
")",
":",
"?",
"Subscriber",
"{",
"$",
"key",
"=",
"self",
"::",
"SUBSCRIBER_KEY",
".",
"\".{$channel}\"",
";",
"return",
"$",
"this",
"->",
"cache",
"->",
"get",
"(",
"$",
"key",
... | Find subscriber by channel.
@param string $channel
@return \Nuwave\Lighthouse\Subscriptions\Subscriber|null | [
"Find",
"subscriber",
"by",
"channel",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/StorageManager.php#L64-L69 | train |
nuwave/lighthouse | src/Subscriptions/StorageManager.php | StorageManager.subscribersByTopic | public function subscribersByTopic(string $topic)
{
$key = self::TOPIC_KEY.".{$topic}";
if (! $this->cache->has($key)) {
return new Collection;
}
$channels = json_decode($this->cache->get($key), true);
return (new Collection($channels))
->map(functi... | php | public function subscribersByTopic(string $topic)
{
$key = self::TOPIC_KEY.".{$topic}";
if (! $this->cache->has($key)) {
return new Collection;
}
$channels = json_decode($this->cache->get($key), true);
return (new Collection($channels))
->map(functi... | [
"public",
"function",
"subscribersByTopic",
"(",
"string",
"$",
"topic",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"TOPIC_KEY",
".",
"\".{$topic}\"",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"cache",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"return... | Get collection of subscribers by channel.
@param string $topic
@return \Illuminate\Support\Collection<\Nuwave\Lighthouse\Subscriptions\Subscriber> | [
"Get",
"collection",
"of",
"subscribers",
"by",
"channel",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/StorageManager.php#L77-L93 | train |
nuwave/lighthouse | src/Subscriptions/StorageManager.php | StorageManager.storeSubscriber | public function storeSubscriber(Subscriber $subscriber, string $topic): void
{
$topicKey = self::TOPIC_KEY.".{$topic}";
$subscriberKey = self::SUBSCRIBER_KEY.".{$subscriber->channel}";
$topic = $this->cache->has($topicKey)
? json_decode($this->cache->get($topicKey), true)
... | php | public function storeSubscriber(Subscriber $subscriber, string $topic): void
{
$topicKey = self::TOPIC_KEY.".{$topic}";
$subscriberKey = self::SUBSCRIBER_KEY.".{$subscriber->channel}";
$topic = $this->cache->has($topicKey)
? json_decode($this->cache->get($topicKey), true)
... | [
"public",
"function",
"storeSubscriber",
"(",
"Subscriber",
"$",
"subscriber",
",",
"string",
"$",
"topic",
")",
":",
"void",
"{",
"$",
"topicKey",
"=",
"self",
"::",
"TOPIC_KEY",
".",
"\".{$topic}\"",
";",
"$",
"subscriberKey",
"=",
"self",
"::",
"SUBSCRIBE... | Store subscription.
@param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber
@param string $topic
@return void | [
"Store",
"subscription",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/StorageManager.php#L102-L115 | train |
nuwave/lighthouse | src/Subscriptions/StorageManager.php | StorageManager.deleteSubscriber | public function deleteSubscriber(string $channel): ?Subscriber
{
$key = self::SUBSCRIBER_KEY.".{$channel}";
$hasSubscriber = $this->cache->has($key);
$subscriber = $this->cache->get($key);
if ($hasSubscriber) {
$this->cache->forget($key);
}
return $subs... | php | public function deleteSubscriber(string $channel): ?Subscriber
{
$key = self::SUBSCRIBER_KEY.".{$channel}";
$hasSubscriber = $this->cache->has($key);
$subscriber = $this->cache->get($key);
if ($hasSubscriber) {
$this->cache->forget($key);
}
return $subs... | [
"public",
"function",
"deleteSubscriber",
"(",
"string",
"$",
"channel",
")",
":",
"?",
"Subscriber",
"{",
"$",
"key",
"=",
"self",
"::",
"SUBSCRIBER_KEY",
".",
"\".{$channel}\"",
";",
"$",
"hasSubscriber",
"=",
"$",
"this",
"->",
"cache",
"->",
"has",
"("... | Delete subscriber.
@param string $channel
@return \Nuwave\Lighthouse\Subscriptions\Subscriber|null | [
"Delete",
"subscriber",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/StorageManager.php#L123-L135 | train |
nuwave/lighthouse | src/Schema/Source/SchemaStitcher.php | SchemaStitcher.gatherSchemaImportsRecursively | protected static function gatherSchemaImportsRecursively(string $path): string
{
if (! file_exists($path)) {
self::throwFileNotFoundException($path);
}
return (new Collection(file($path)))
->map(function (string $line) use ($path) {
if (! Str::startsW... | php | protected static function gatherSchemaImportsRecursively(string $path): string
{
if (! file_exists($path)) {
self::throwFileNotFoundException($path);
}
return (new Collection(file($path)))
->map(function (string $line) use ($path) {
if (! Str::startsW... | [
"protected",
"static",
"function",
"gatherSchemaImportsRecursively",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"self",
"::",
"throwFileNotFoundException",
"(",
"$",
"path",
")",
";",
... | Get the schema, starting from a root schema, following the imports recursively.
@param string $path
@return string | [
"Get",
"the",
"schema",
"starting",
"from",
"a",
"root",
"schema",
"following",
"the",
"imports",
"recursively",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Source/SchemaStitcher.php#L56-L90 | train |
nuwave/lighthouse | src/Schema/Directives/CacheDirective.php | CacheDirective.store | protected function store(CacheManager $cache, string $key, $value, ?Carbon $expiration, array $tags): void
{
$supportsTags = $this->useTags($cache);
if ($expiration) {
$supportsTags
? $cache->tags($tags)->put($key, $value, $expiration)
: $cache->put($key,... | php | protected function store(CacheManager $cache, string $key, $value, ?Carbon $expiration, array $tags): void
{
$supportsTags = $this->useTags($cache);
if ($expiration) {
$supportsTags
? $cache->tags($tags)->put($key, $value, $expiration)
: $cache->put($key,... | [
"protected",
"function",
"store",
"(",
"CacheManager",
"$",
"cache",
",",
"string",
"$",
"key",
",",
"$",
"value",
",",
"?",
"Carbon",
"$",
"expiration",
",",
"array",
"$",
"tags",
")",
":",
"void",
"{",
"$",
"supportsTags",
"=",
"$",
"this",
"->",
"... | Store value in cache.
@param \Illuminate\Cache\CacheManager $cache
@param string $key
@param mixed $value
@param \Carbon\Carbon|null $expiration
@param mixed[] $tags
@return void | [
"Store",
"value",
"in",
"cache",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/CacheDirective.php#L104-L119 | train |
nuwave/lighthouse | src/Schema/Directives/CacheDirective.php | CacheDirective.setNodeKey | protected function setNodeKey(NodeValue $nodeValue): void
{
if ($nodeValue->getCacheKey()) {
return;
}
$fields = data_get($nodeValue->getTypeDefinition(), 'fields', []);
$nodeKey = (new Collection($fields))->reduce(function (?string $key, FieldDefinitionNode $field): ?st... | php | protected function setNodeKey(NodeValue $nodeValue): void
{
if ($nodeValue->getCacheKey()) {
return;
}
$fields = data_get($nodeValue->getTypeDefinition(), 'fields', []);
$nodeKey = (new Collection($fields))->reduce(function (?string $key, FieldDefinitionNode $field): ?st... | [
"protected",
"function",
"setNodeKey",
"(",
"NodeValue",
"$",
"nodeValue",
")",
":",
"void",
"{",
"if",
"(",
"$",
"nodeValue",
"->",
"getCacheKey",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"fields",
"=",
"data_get",
"(",
"$",
"nodeValue",
"->",
"ge... | Set node's cache key.
@param \Nuwave\Lighthouse\Schema\Values\NodeValue $nodeValue
@return void
@throws \Nuwave\Lighthouse\Exceptions\DirectiveException | [
"Set",
"node",
"s",
"cache",
"key",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/CacheDirective.php#L141-L184 | train |
nuwave/lighthouse | src/Execution/Builder.php | Builder.apply | public function apply($builder, array $args)
{
/*
* Call the queryFilter for backwards compatibility
* @deprecated
*/
$this->queryFilter->filter($builder, $args);
foreach ($args as $key => $value) {
/** @var \Nuwave\Lighthouse\Support\Contracts\ArgBuil... | php | public function apply($builder, array $args)
{
/*
* Call the queryFilter for backwards compatibility
* @deprecated
*/
$this->queryFilter->filter($builder, $args);
foreach ($args as $key => $value) {
/** @var \Nuwave\Lighthouse\Support\Contracts\ArgBuil... | [
"public",
"function",
"apply",
"(",
"$",
"builder",
",",
"array",
"$",
"args",
")",
"{",
"/*\n * Call the queryFilter for backwards compatibility\n * @deprecated\n */",
"$",
"this",
"->",
"queryFilter",
"->",
"filter",
"(",
"$",
"builder",
",",
"... | Apply the bound QueryBuilderDirectives to the given builder.
@param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $builder
@param mixed[] $args
@return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder | [
"Apply",
"the",
"bound",
"QueryBuilderDirectives",
"to",
"the",
"given",
"builder",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/Builder.php#L37-L57 | train |
nuwave/lighthouse | src/Execution/Builder.php | Builder.addScopes | public function addScopes(array $scopes): self
{
$this->scopes = array_merge($this->scopes, $scopes);
return $this;
} | php | public function addScopes(array $scopes): self
{
$this->scopes = array_merge($this->scopes, $scopes);
return $this;
} | [
"public",
"function",
"addScopes",
"(",
"array",
"$",
"scopes",
")",
":",
"self",
"{",
"$",
"this",
"->",
"scopes",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"scopes",
",",
"$",
"scopes",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add scopes that are then called upon the query with the field arguments.
@param string[] $scopes
@return $this | [
"Add",
"scopes",
"that",
"are",
"then",
"called",
"upon",
"the",
"query",
"with",
"the",
"field",
"arguments",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/Builder.php#L65-L70 | train |
nuwave/lighthouse | src/Execution/Builder.php | Builder.addBuilderDirective | public function addBuilderDirective(string $argumentName, ArgBuilderDirective $argBuilderDirective): self
{
$this->builderDirectives[$argumentName] = $argBuilderDirective;
return $this;
} | php | public function addBuilderDirective(string $argumentName, ArgBuilderDirective $argBuilderDirective): self
{
$this->builderDirectives[$argumentName] = $argBuilderDirective;
return $this;
} | [
"public",
"function",
"addBuilderDirective",
"(",
"string",
"$",
"argumentName",
",",
"ArgBuilderDirective",
"$",
"argBuilderDirective",
")",
":",
"self",
"{",
"$",
"this",
"->",
"builderDirectives",
"[",
"$",
"argumentName",
"]",
"=",
"$",
"argBuilderDirective",
... | Add a query builder directive keyed by the argument name.
@param string $argumentName
@param \Nuwave\Lighthouse\Support\Contracts\ArgBuilderDirective $argBuilderDirective
@return $this | [
"Add",
"a",
"query",
"builder",
"directive",
"keyed",
"by",
"the",
"argument",
"name",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/Builder.php#L79-L84 | train |
nuwave/lighthouse | src/Execution/MultipartFormRequest.php | MultipartFormRequest.fieldValue | protected function fieldValue(string $key)
{
return $this->isBatched()
? Arr::get($this->operations, $this->batchIndex.'.'.$key)
: $this->operations[$key] ?? null;
} | php | protected function fieldValue(string $key)
{
return $this->isBatched()
? Arr::get($this->operations, $this->batchIndex.'.'.$key)
: $this->operations[$key] ?? null;
} | [
"protected",
"function",
"fieldValue",
"(",
"string",
"$",
"key",
")",
"{",
"return",
"$",
"this",
"->",
"isBatched",
"(",
")",
"?",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"operations",
",",
"$",
"this",
"->",
"batchIndex",
".",
"'.'",
".",
"$",... | If we are dealing with a batched request, this gets the
contents of the currently resolving batch index.
@param string $key
@return array|string|null | [
"If",
"we",
"are",
"dealing",
"with",
"a",
"batched",
"request",
"this",
"gets",
"the",
"contents",
"of",
"the",
"currently",
"resolving",
"batch",
"index",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/MultipartFormRequest.php#L77-L82 | train |
nuwave/lighthouse | src/Subscriptions/SubscriptionBroadcaster.php | SubscriptionBroadcaster.queueBroadcast | public function queueBroadcast(GraphQLSubscription $subscription, string $fieldName, $root): void
{
$this->eventsDispatcher->dispatch(
new BroadcastSubscriptionEvent($subscription, $fieldName, $root)
);
} | php | public function queueBroadcast(GraphQLSubscription $subscription, string $fieldName, $root): void
{
$this->eventsDispatcher->dispatch(
new BroadcastSubscriptionEvent($subscription, $fieldName, $root)
);
} | [
"public",
"function",
"queueBroadcast",
"(",
"GraphQLSubscription",
"$",
"subscription",
",",
"string",
"$",
"fieldName",
",",
"$",
"root",
")",
":",
"void",
"{",
"$",
"this",
"->",
"eventsDispatcher",
"->",
"dispatch",
"(",
"new",
"BroadcastSubscriptionEvent",
... | Queue pushing subscription data to subscribers.
@param \Nuwave\Lighthouse\Schema\Types\GraphQLSubscription $subscription
@param string $fieldName
@param mixed $root
@return void | [
"Queue",
"pushing",
"subscription",
"data",
"to",
"subscribers",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/SubscriptionBroadcaster.php#L80-L85 | train |
nuwave/lighthouse | src/Subscriptions/SubscriptionBroadcaster.php | SubscriptionBroadcaster.broadcast | public function broadcast(GraphQLSubscription $subscription, string $fieldName, $root): void
{
$topic = $subscription->decodeTopic($fieldName, $root);
$subscribers = $this->storage
->subscribersByTopic($topic)
->filter(function (Subscriber $subscriber) use ($subscription, $r... | php | public function broadcast(GraphQLSubscription $subscription, string $fieldName, $root): void
{
$topic = $subscription->decodeTopic($fieldName, $root);
$subscribers = $this->storage
->subscribersByTopic($topic)
->filter(function (Subscriber $subscriber) use ($subscription, $r... | [
"public",
"function",
"broadcast",
"(",
"GraphQLSubscription",
"$",
"subscription",
",",
"string",
"$",
"fieldName",
",",
"$",
"root",
")",
":",
"void",
"{",
"$",
"topic",
"=",
"$",
"subscription",
"->",
"decodeTopic",
"(",
"$",
"fieldName",
",",
"$",
"roo... | Push subscription data to subscribers.
@param \Nuwave\Lighthouse\Schema\Types\GraphQLSubscription $subscription
@param string $fieldName
@param mixed $root
@return void | [
"Push",
"subscription",
"data",
"to",
"subscribers",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/SubscriptionBroadcaster.php#L95-L122 | train |
nuwave/lighthouse | src/Subscriptions/SubscriptionBroadcaster.php | SubscriptionBroadcaster.authorize | public function authorize(Request $request): Response
{
return $this->auth->authorize($request)
? $this->broadcastManager->authorized($request)
: $this->broadcastManager->unauthorized($request);
} | php | public function authorize(Request $request): Response
{
return $this->auth->authorize($request)
? $this->broadcastManager->authorized($request)
: $this->broadcastManager->unauthorized($request);
} | [
"public",
"function",
"authorize",
"(",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"return",
"$",
"this",
"->",
"auth",
"->",
"authorize",
"(",
"$",
"request",
")",
"?",
"$",
"this",
"->",
"broadcastManager",
"->",
"authorized",
"(",
"$",
"req... | Authorize the subscription.
@param \Illuminate\Http\Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"Authorize",
"the",
"subscription",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/SubscriptionBroadcaster.php#L130-L135 | train |
nuwave/lighthouse | src/Tracing/Tracing.php | Tracing.handleStartRequest | public function handleStartRequest(StartRequest $startRequest): void
{
$this->requestStart = Carbon::now();
$this->requestStartPrecise = $this->getTime();
} | php | public function handleStartRequest(StartRequest $startRequest): void
{
$this->requestStart = Carbon::now();
$this->requestStartPrecise = $this->getTime();
} | [
"public",
"function",
"handleStartRequest",
"(",
"StartRequest",
"$",
"startRequest",
")",
":",
"void",
"{",
"$",
"this",
"->",
"requestStart",
"=",
"Carbon",
"::",
"now",
"(",
")",
";",
"$",
"this",
"->",
"requestStartPrecise",
"=",
"$",
"this",
"->",
"ge... | Handle request start.
@param \Nuwave\Lighthouse\Events\StartRequest $startRequest
@return void | [
"Handle",
"request",
"start",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Tracing/Tracing.php#L62-L66 | train |
nuwave/lighthouse | src/Tracing/Tracing.php | Tracing.handleBuildExtensionsResponse | public function handleBuildExtensionsResponse(BuildExtensionsResponse $buildExtensionsResponse): ExtensionsResponse
{
$requestEnd = Carbon::now();
$requestEndPrecise = $this->getTime();
return new ExtensionsResponse(
'tracing',
[
'version' => 1,
... | php | public function handleBuildExtensionsResponse(BuildExtensionsResponse $buildExtensionsResponse): ExtensionsResponse
{
$requestEnd = Carbon::now();
$requestEndPrecise = $this->getTime();
return new ExtensionsResponse(
'tracing',
[
'version' => 1,
... | [
"public",
"function",
"handleBuildExtensionsResponse",
"(",
"BuildExtensionsResponse",
"$",
"buildExtensionsResponse",
")",
":",
"ExtensionsResponse",
"{",
"$",
"requestEnd",
"=",
"Carbon",
"::",
"now",
"(",
")",
";",
"$",
"requestEndPrecise",
"=",
"$",
"this",
"->"... | Return additional information for the result.
@param \Nuwave\Lighthouse\Events\BuildExtensionsResponse $buildExtensionsResponse
@return \Nuwave\Lighthouse\Execution\ExtensionsResponse | [
"Return",
"additional",
"information",
"for",
"the",
"result",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Tracing/Tracing.php#L85-L102 | train |
nuwave/lighthouse | src/Tracing/Tracing.php | Tracing.record | public function record(ResolveInfo $resolveInfo, $start, $end): void
{
$this->resolverTraces [] = [
'path' => $resolveInfo->path,
'parentType' => $resolveInfo->parentType->name,
'returnType' => $resolveInfo->returnType->__toString(),
'fieldName' => $resolveInf... | php | public function record(ResolveInfo $resolveInfo, $start, $end): void
{
$this->resolverTraces [] = [
'path' => $resolveInfo->path,
'parentType' => $resolveInfo->parentType->name,
'returnType' => $resolveInfo->returnType->__toString(),
'fieldName' => $resolveInf... | [
"public",
"function",
"record",
"(",
"ResolveInfo",
"$",
"resolveInfo",
",",
"$",
"start",
",",
"$",
"end",
")",
":",
"void",
"{",
"$",
"this",
"->",
"resolverTraces",
"[",
"]",
"=",
"[",
"'path'",
"=>",
"$",
"resolveInfo",
"->",
"path",
",",
"'parentT... | Record resolver execution time.
@param \GraphQL\Type\Definition\ResolveInfo $resolveInfo
@param float|int $start
@param float|int $end
@return void | [
"Record",
"resolver",
"execution",
"time",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Tracing/Tracing.php#L112-L122 | train |
nuwave/lighthouse | src/Tracing/Tracing.php | Tracing.diffTimeInNanoseconds | protected function diffTimeInNanoseconds($start, $end): int
{
if ($this->platformSupportsNanoseconds()) {
return $end - $start;
}
// Difference is in seconds (with microsecond precision)
// * 1000 to get to milliseconds
// * 1000 to get to microseconds
//... | php | protected function diffTimeInNanoseconds($start, $end): int
{
if ($this->platformSupportsNanoseconds()) {
return $end - $start;
}
// Difference is in seconds (with microsecond precision)
// * 1000 to get to milliseconds
// * 1000 to get to microseconds
//... | [
"protected",
"function",
"diffTimeInNanoseconds",
"(",
"$",
"start",
",",
"$",
"end",
")",
":",
"int",
"{",
"if",
"(",
"$",
"this",
"->",
"platformSupportsNanoseconds",
"(",
")",
")",
"{",
"return",
"$",
"end",
"-",
"$",
"start",
";",
"}",
"// Difference... | Diff the time results to each other and convert to nanoseconds if needed.
@param float|int $start
@param float|int $end
@return int | [
"Diff",
"the",
"time",
"results",
"to",
"each",
"other",
"and",
"convert",
"to",
"nanoseconds",
"if",
"needed",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Tracing/Tracing.php#L145-L156 | train |
nuwave/lighthouse | src/Schema/Types/Scalars/Date.php | Date.serialize | public function serialize($value): string
{
if ($value instanceof Carbon) {
return $value->toDateString();
}
return $this->tryParsingDate($value, InvariantViolation::class)
->toDateString();
} | php | public function serialize($value): string
{
if ($value instanceof Carbon) {
return $value->toDateString();
}
return $this->tryParsingDate($value, InvariantViolation::class)
->toDateString();
} | [
"public",
"function",
"serialize",
"(",
"$",
"value",
")",
":",
"string",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Carbon",
")",
"{",
"return",
"$",
"value",
"->",
"toDateString",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"tryParsingDate",
"... | Serialize an internal value, ensuring it is a valid date string.
@param \Carbon\Carbon|string $value
@return string | [
"Serialize",
"an",
"internal",
"value",
"ensuring",
"it",
"is",
"a",
"valid",
"date",
"string",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Types/Scalars/Date.php#L21-L29 | train |
nuwave/lighthouse | src/Schema/Values/CacheValue.php | CacheValue.getKey | public function getKey(): string
{
$argKeys = $this->argKeys();
return $this->implode([
$this->privateCache
? 'auth'
: null,
$this->privateCache
? app('auth')->user()->getKey()
: null,
strtolower($th... | php | public function getKey(): string
{
$argKeys = $this->argKeys();
return $this->implode([
$this->privateCache
? 'auth'
: null,
$this->privateCache
? app('auth')->user()->getKey()
: null,
strtolower($th... | [
"public",
"function",
"getKey",
"(",
")",
":",
"string",
"{",
"$",
"argKeys",
"=",
"$",
"this",
"->",
"argKeys",
"(",
")",
";",
"return",
"$",
"this",
"->",
"implode",
"(",
"[",
"$",
"this",
"->",
"privateCache",
"?",
"'auth'",
":",
"null",
",",
"$... | Resolve key from root value.
@return string | [
"Resolve",
"key",
"from",
"root",
"value",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Values/CacheValue.php#L68-L86 | train |
nuwave/lighthouse | src/Schema/Values/CacheValue.php | CacheValue.getTags | public function getTags(): array
{
$typeTag = $this->implode([
'graphql',
strtolower($this->fieldValue->getParentName()),
$this->fieldKey,
]);
$fieldTag = $this->implode([
'graphql',
strtolower($this->fieldValue->getParentName()),
... | php | public function getTags(): array
{
$typeTag = $this->implode([
'graphql',
strtolower($this->fieldValue->getParentName()),
$this->fieldKey,
]);
$fieldTag = $this->implode([
'graphql',
strtolower($this->fieldValue->getParentName()),
... | [
"public",
"function",
"getTags",
"(",
")",
":",
"array",
"{",
"$",
"typeTag",
"=",
"$",
"this",
"->",
"implode",
"(",
"[",
"'graphql'",
",",
"strtolower",
"(",
"$",
"this",
"->",
"fieldValue",
"->",
"getParentName",
"(",
")",
")",
",",
"$",
"this",
"... | Get cache tags.
@todo Check to see if tags are available on the
cache store (or add to config) and use tags to
flush cache w/out args.
@return array | [
"Get",
"cache",
"tags",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Values/CacheValue.php#L97-L113 | train |
nuwave/lighthouse | src/Schema/Values/CacheValue.php | CacheValue.argKeys | protected function argKeys(): Collection
{
$args = $this->args;
ksort($args);
return (new Collection($args))->map(function ($value, $key) {
$keyValue = is_array($value)
? json_encode($value, true)
: $value;
return "{$key}:{$keyValue}... | php | protected function argKeys(): Collection
{
$args = $this->args;
ksort($args);
return (new Collection($args))->map(function ($value, $key) {
$keyValue = is_array($value)
? json_encode($value, true)
: $value;
return "{$key}:{$keyValue}... | [
"protected",
"function",
"argKeys",
"(",
")",
":",
"Collection",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"args",
";",
"ksort",
"(",
"$",
"args",
")",
";",
"return",
"(",
"new",
"Collection",
"(",
"$",
"args",
")",
")",
"->",
"map",
"(",
"function... | Convert input arguments to keys.
@return \Illuminate\Support\Collection | [
"Convert",
"input",
"arguments",
"to",
"keys",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Values/CacheValue.php#L120-L133 | train |
nuwave/lighthouse | src/Schema/Values/CacheValue.php | CacheValue.setFieldKey | protected function setFieldKey()
{
if (! $this->fieldValue || ! $this->rootValue) {
return;
}
$cacheFieldKey = $this->fieldValue
->getParent()
->getCacheKey();
if ($cacheFieldKey) {
$this->fieldKey = data_get($this->rootValue, $cacheF... | php | protected function setFieldKey()
{
if (! $this->fieldValue || ! $this->rootValue) {
return;
}
$cacheFieldKey = $this->fieldValue
->getParent()
->getCacheKey();
if ($cacheFieldKey) {
$this->fieldKey = data_get($this->rootValue, $cacheF... | [
"protected",
"function",
"setFieldKey",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fieldValue",
"||",
"!",
"$",
"this",
"->",
"rootValue",
")",
"{",
"return",
";",
"}",
"$",
"cacheFieldKey",
"=",
"$",
"this",
"->",
"fieldValue",
"->",
"getParen... | Set the field key. | [
"Set",
"the",
"field",
"key",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Values/CacheValue.php#L138-L151 | train |
nuwave/lighthouse | src/Support/Traits/HasResolverArguments.php | HasResolverArguments.setResolverArguments | public function setResolverArguments($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): self
{
return $this
->setRoot($root)
->setArgs($args)
->setContext($context)
->setResolveInfo($resolveInfo);
} | php | public function setResolverArguments($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): self
{
return $this
->setRoot($root)
->setArgs($args)
->setContext($context)
->setResolveInfo($resolveInfo);
} | [
"public",
"function",
"setResolverArguments",
"(",
"$",
"root",
",",
"array",
"$",
"args",
",",
"GraphQLContext",
"$",
"context",
",",
"ResolveInfo",
"$",
"resolveInfo",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"setRoot",
"(",
"$",
"root",
")",
... | Set all resolver arguments at once.
@param mixed|null $root
@param mixed[] $args
@param \Nuwave\Lighthouse\Support\Contracts\GraphQLContext $context
@param \GraphQL\Type\Definition\ResolveInfo $resolveInfo
@return $this | [
"Set",
"all",
"resolver",
"arguments",
"at",
"once",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Traits/HasResolverArguments.php#L115-L122 | train |
nuwave/lighthouse | src/Support/Utils.php | Utils.namespaceClassname | public static function namespaceClassname(string $classCandidate, array $namespacesToTry, callable $determineMatch): ?string
{
if ($determineMatch($classCandidate)) {
return $classCandidate;
}
// Stop if the class is found or we are out of namespaces to try
while (! empt... | php | public static function namespaceClassname(string $classCandidate, array $namespacesToTry, callable $determineMatch): ?string
{
if ($determineMatch($classCandidate)) {
return $classCandidate;
}
// Stop if the class is found or we are out of namespaces to try
while (! empt... | [
"public",
"static",
"function",
"namespaceClassname",
"(",
"string",
"$",
"classCandidate",
",",
"array",
"$",
"namespacesToTry",
",",
"callable",
"$",
"determineMatch",
")",
":",
"?",
"string",
"{",
"if",
"(",
"$",
"determineMatch",
"(",
"$",
"classCandidate",
... | Attempt to find a given class in the given namespaces.
If the class itself exists, it is simply returned as is.
Else, the given namespaces are tried in order.
@param string $classCandidate
@param array $namespacesToTry
@param callable $determineMatch
@return string|null | [
"Attempt",
"to",
"find",
"a",
"given",
"class",
"in",
"the",
"given",
"namespaces",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Utils.php#L21-L38 | train |
nuwave/lighthouse | src/Support/Utils.php | Utils.constructResolver | public static function constructResolver(string $className, string $methodName): Closure
{
if (! method_exists($className, $methodName)) {
throw new DefinitionException("Method '{$methodName}' does not exist on class '{$className}'");
}
return Closure::fromCallable([app($classNa... | php | public static function constructResolver(string $className, string $methodName): Closure
{
if (! method_exists($className, $methodName)) {
throw new DefinitionException("Method '{$methodName}' does not exist on class '{$className}'");
}
return Closure::fromCallable([app($classNa... | [
"public",
"static",
"function",
"constructResolver",
"(",
"string",
"$",
"className",
",",
"string",
"$",
"methodName",
")",
":",
"Closure",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"className",
",",
"$",
"methodName",
")",
")",
"{",
"throw",
"new",... | Construct a closure that passes through the arguments.
@param string $className This class is resolved through the container.
@param string $methodName The method that gets passed the arguments of the closure.
@return \Closure
@throws \Nuwave\Lighthouse\Exceptions\DefinitionException | [
"Construct",
"a",
"closure",
"that",
"passes",
"through",
"the",
"arguments",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Utils.php#L49-L56 | train |
nuwave/lighthouse | src/Defer/Defer.php | Defer.defer | public function defer(Closure $resolver, string $path)
{
if ($data = Arr::get($this->result, "data.{$path}")) {
return $data;
}
if ($this->isDeferred($path) || ! $this->acceptFurtherDeferring) {
return $this->resolve($resolver, $path);
}
$this->defer... | php | public function defer(Closure $resolver, string $path)
{
if ($data = Arr::get($this->result, "data.{$path}")) {
return $data;
}
if ($this->isDeferred($path) || ! $this->acceptFurtherDeferring) {
return $this->resolve($resolver, $path);
}
$this->defer... | [
"public",
"function",
"defer",
"(",
"Closure",
"$",
"resolver",
",",
"string",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"data",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"result",
",",
"\"data.{$path}\"",
")",
")",
"{",
"return",
"$",
"data",
... | Register deferred field.
@param \Closure $resolver
@param string $path
@return mixed | [
"Register",
"deferred",
"field",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Defer/Defer.php#L107-L118 | train |
nuwave/lighthouse | src/Defer/Defer.php | Defer.resolve | public function resolve(Closure $originalResolver, string $path)
{
$isDeferred = $this->isDeferred($path);
$resolver = $isDeferred
? $this->deferred[$path]
: $originalResolver;
if ($isDeferred) {
$this->resolved[] = $path;
unset($this->deferr... | php | public function resolve(Closure $originalResolver, string $path)
{
$isDeferred = $this->isDeferred($path);
$resolver = $isDeferred
? $this->deferred[$path]
: $originalResolver;
if ($isDeferred) {
$this->resolved[] = $path;
unset($this->deferr... | [
"public",
"function",
"resolve",
"(",
"Closure",
"$",
"originalResolver",
",",
"string",
"$",
"path",
")",
"{",
"$",
"isDeferred",
"=",
"$",
"this",
"->",
"isDeferred",
"(",
"$",
"path",
")",
";",
"$",
"resolver",
"=",
"$",
"isDeferred",
"?",
"$",
"thi... | Resolve field with data or resolver.
@param \Closure $originalResolver
@param string $path
@return mixed | [
"Resolve",
"field",
"with",
"data",
"or",
"resolver",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Defer/Defer.php#L145-L159 | train |
nuwave/lighthouse | src/Defer/Defer.php | Defer.createResponse | public function createResponse(array $result): Response
{
if (empty($this->deferred)) {
return response($result);
}
return response()->stream(
function () use ($result): void {
$nested = 1;
$this->result = $result;
$thi... | php | public function createResponse(array $result): Response
{
if (empty($this->deferred)) {
return response($result);
}
return response()->stream(
function () use ($result): void {
$nested = 1;
$this->result = $result;
$thi... | [
"public",
"function",
"createResponse",
"(",
"array",
"$",
"result",
")",
":",
"Response",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"deferred",
")",
")",
"{",
"return",
"response",
"(",
"$",
"result",
")",
";",
"}",
"return",
"response",
"(",
... | Return either a final response or a stream of responses.
@param mixed[] $result
@return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\StreamedResponse | [
"Return",
"either",
"a",
"final",
"response",
"or",
"a",
"stream",
"of",
"responses",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Defer/Defer.php#L185-L228 | train |
nuwave/lighthouse | src/Defer/Defer.php | Defer.maxNestedFieldsResolved | protected function maxNestedFieldsResolved(int $nested): bool
{
if ($this->maxNestedFields === 0) {
return false;
}
return $nested >= $this->maxNestedFields;
} | php | protected function maxNestedFieldsResolved(int $nested): bool
{
if ($this->maxNestedFields === 0) {
return false;
}
return $nested >= $this->maxNestedFields;
} | [
"protected",
"function",
"maxNestedFieldsResolved",
"(",
"int",
"$",
"nested",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"maxNestedFields",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"nested",
">=",
"$",
"this",
"->",
... | Check if the maximum number of nested field has been resolved.
@param int $nested
@return bool | [
"Check",
"if",
"the",
"maximum",
"number",
"of",
"nested",
"field",
"has",
"been",
"resolved",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Defer/Defer.php#L270-L277 | train |
nuwave/lighthouse | src/Defer/Defer.php | Defer.executeDeferred | protected function executeDeferred(): void
{
$this->result = app()->call(
[$this->graphQL, 'executeRequest']
);
$this->stream->stream(
$this->result,
$this->resolved,
empty($this->deferred)
);
$this->resolved = [];
} | php | protected function executeDeferred(): void
{
$this->result = app()->call(
[$this->graphQL, 'executeRequest']
);
$this->stream->stream(
$this->result,
$this->resolved,
empty($this->deferred)
);
$this->resolved = [];
} | [
"protected",
"function",
"executeDeferred",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"result",
"=",
"app",
"(",
")",
"->",
"call",
"(",
"[",
"$",
"this",
"->",
"graphQL",
",",
"'executeRequest'",
"]",
")",
";",
"$",
"this",
"->",
"stream",
"->"... | Execute deferred fields.
@return void | [
"Execute",
"deferred",
"fields",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Defer/Defer.php#L284-L297 | train |
nuwave/lighthouse | src/Schema/Directives/DeleteDirective.php | DeleteDirective.getSingleArgumentDefinition | protected function getSingleArgumentDefinition(): InputValueDefinitionNode
{
if (count($this->definitionNode->arguments) !== 1) {
throw new DirectiveException(
"The @delete directive requires the field {$this->definitionNode->name->value} to only contain a single argument."
... | php | protected function getSingleArgumentDefinition(): InputValueDefinitionNode
{
if (count($this->definitionNode->arguments) !== 1) {
throw new DirectiveException(
"The @delete directive requires the field {$this->definitionNode->name->value} to only contain a single argument."
... | [
"protected",
"function",
"getSingleArgumentDefinition",
"(",
")",
":",
"InputValueDefinitionNode",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"definitionNode",
"->",
"arguments",
")",
"!==",
"1",
")",
"{",
"throw",
"new",
"DirectiveException",
"(",
"\"The ... | Ensure there is only a single argument defined on the field.
@return \GraphQL\Language\AST\InputValueDefinitionNode
@throws \Nuwave\Lighthouse\Exceptions\DirectiveException | [
"Ensure",
"there",
"is",
"only",
"a",
"single",
"argument",
"defined",
"on",
"the",
"field",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Directives/DeleteDirective.php#L104-L113 | train |
nuwave/lighthouse | src/Schema/AST/ASTBuilder.php | ASTBuilder.build | public function build(string $schema): DocumentAST
{
$document = DocumentAST::fromSource($schema);
// Node manipulators may be defined on type extensions
$document = $this->applyNodeManipulators($document);
// After they have been applied, we can safely merge them
$document ... | php | public function build(string $schema): DocumentAST
{
$document = DocumentAST::fromSource($schema);
// Node manipulators may be defined on type extensions
$document = $this->applyNodeManipulators($document);
// After they have been applied, we can safely merge them
$document ... | [
"public",
"function",
"build",
"(",
"string",
"$",
"schema",
")",
":",
"DocumentAST",
"{",
"$",
"document",
"=",
"DocumentAST",
"::",
"fromSource",
"(",
"$",
"schema",
")",
";",
"// Node manipulators may be defined on type extensions",
"$",
"document",
"=",
"$",
... | Convert the base schema string into an AST by applying different manipulations.
@param string $schema
@return \Nuwave\Lighthouse\Schema\AST\DocumentAST | [
"Convert",
"the",
"base",
"schema",
"string",
"into",
"an",
"AST",
"by",
"applying",
"different",
"manipulations",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTBuilder.php#L41-L58 | train |
nuwave/lighthouse | src/Schema/AST/ASTBuilder.php | ASTBuilder.mergeTypeExtensions | protected function mergeTypeExtensions(DocumentAST $document): DocumentAST
{
$document->objectTypeDefinitions()->each(
function (ObjectTypeDefinitionNode $objectType) use ($document) {
$name = $objectType->name->value;
$objectType = $document
... | php | protected function mergeTypeExtensions(DocumentAST $document): DocumentAST
{
$document->objectTypeDefinitions()->each(
function (ObjectTypeDefinitionNode $objectType) use ($document) {
$name = $objectType->name->value;
$objectType = $document
... | [
"protected",
"function",
"mergeTypeExtensions",
"(",
"DocumentAST",
"$",
"document",
")",
":",
"DocumentAST",
"{",
"$",
"document",
"->",
"objectTypeDefinitions",
"(",
")",
"->",
"each",
"(",
"function",
"(",
"ObjectTypeDefinitionNode",
"$",
"objectType",
")",
"us... | The final schema must not contain type extensions, so we merge them here.
@param \Nuwave\Lighthouse\Schema\AST\DocumentAST $document
@return \Nuwave\Lighthouse\Schema\AST\DocumentAST | [
"The",
"final",
"schema",
"must",
"not",
"contain",
"type",
"extensions",
"so",
"we",
"merge",
"them",
"here",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTBuilder.php#L93-L119 | train |
nuwave/lighthouse | src/Schema/AST/ASTBuilder.php | ASTBuilder.addNodeSupport | protected function addNodeSupport(DocumentAST $document): DocumentAST
{
$hasTypeImplementingNode = $document
->objectTypeDefinitions()
->contains(function (ObjectTypeDefinitionNode $objectType): bool {
return (new Collection($objectType->interfaces))
... | php | protected function addNodeSupport(DocumentAST $document): DocumentAST
{
$hasTypeImplementingNode = $document
->objectTypeDefinitions()
->contains(function (ObjectTypeDefinitionNode $objectType): bool {
return (new Collection($objectType->interfaces))
... | [
"protected",
"function",
"addNodeSupport",
"(",
"DocumentAST",
"$",
"document",
")",
":",
"DocumentAST",
"{",
"$",
"hasTypeImplementingNode",
"=",
"$",
"document",
"->",
"objectTypeDefinitions",
"(",
")",
"->",
"contains",
"(",
"function",
"(",
"ObjectTypeDefinition... | Inject the node type and a node field into Query.
@param \Nuwave\Lighthouse\Schema\AST\DocumentAST $document
@return \Nuwave\Lighthouse\Schema\AST\DocumentAST | [
"Inject",
"the",
"node",
"type",
"and",
"a",
"node",
"field",
"into",
"Query",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/AST/ASTBuilder.php#L260-L295 | train |
nuwave/lighthouse | src/Subscriptions/Subscriber.php | Subscriber.unserialize | public function unserialize($subscription): self
{
$data = json_decode($subscription, true);
$this->operationName = $data['operation_name'];
$this->channel = $data['channel'];
$this->args = $data['args'];
$this->context = $this->contextSerializer()->unserialize(
... | php | public function unserialize($subscription): self
{
$data = json_decode($subscription, true);
$this->operationName = $data['operation_name'];
$this->channel = $data['channel'];
$this->args = $data['args'];
$this->context = $this->contextSerializer()->unserialize(
... | [
"public",
"function",
"unserialize",
"(",
"$",
"subscription",
")",
":",
"self",
"{",
"$",
"data",
"=",
"json_decode",
"(",
"$",
"subscription",
",",
"true",
")",
";",
"$",
"this",
"->",
"operationName",
"=",
"$",
"data",
"[",
"'operation_name'",
"]",
";... | Unserialize subscription from a JSON string.
@param string $subscription
@return $this | [
"Unserialize",
"subscription",
"from",
"a",
"JSON",
"string",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/Subscriber.php#L85-L100 | train |
nuwave/lighthouse | src/Subscriptions/Subscriber.php | Subscriber.serialize | public function serialize()
{
return json_encode([
'operation_name' => $this->operationName,
'channel' => $this->channel,
'args' => $this->args,
'context' => $this->contextSerializer()->serialize($this->context),
'query' => serialize(
... | php | public function serialize()
{
return json_encode([
'operation_name' => $this->operationName,
'channel' => $this->channel,
'args' => $this->args,
'context' => $this->contextSerializer()->serialize($this->context),
'query' => serialize(
... | [
"public",
"function",
"serialize",
"(",
")",
"{",
"return",
"json_encode",
"(",
"[",
"'operation_name'",
"=>",
"$",
"this",
"->",
"operationName",
",",
"'channel'",
"=>",
"$",
"this",
"->",
"channel",
",",
"'args'",
"=>",
"$",
"this",
"->",
"args",
",",
... | Convert this into a JSON string.
@return false|string | [
"Convert",
"this",
"into",
"a",
"JSON",
"string",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Subscriptions/Subscriber.php#L107-L118 | train |
nuwave/lighthouse | src/Support/Http/Controllers/GraphQLController.php | GraphQLController.query | public function query(GraphQLRequest $request)
{
$this->eventsDispatcher->dispatch(
new StartRequest($request)
);
$result = $request->isBatched()
? $this->executeBatched($request)
: $this->graphQL->executeRequest($request);
$response = $this->cre... | php | public function query(GraphQLRequest $request)
{
$this->eventsDispatcher->dispatch(
new StartRequest($request)
);
$result = $request->isBatched()
? $this->executeBatched($request)
: $this->graphQL->executeRequest($request);
$response = $this->cre... | [
"public",
"function",
"query",
"(",
"GraphQLRequest",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"eventsDispatcher",
"->",
"dispatch",
"(",
"new",
"StartRequest",
"(",
"$",
"request",
")",
")",
";",
"$",
"result",
"=",
"$",
"request",
"->",
"isBatched",
... | Execute GraphQL query.
@param \Nuwave\Lighthouse\Execution\GraphQLRequest $request
@return \Symfony\Component\HttpFoundation\Response | [
"Execute",
"GraphQL",
"query",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Http/Controllers/GraphQLController.php#L71-L89 | train |
nuwave/lighthouse | src/Support/Http/Controllers/GraphQLController.php | GraphQLController.executeBatched | protected function executeBatched(GraphQLRequest $request): array
{
$results = [];
do {
$results[] = $this->graphQL->executeRequest($request);
} while ($request->advanceBatchIndex());
return $results;
} | php | protected function executeBatched(GraphQLRequest $request): array
{
$results = [];
do {
$results[] = $this->graphQL->executeRequest($request);
} while ($request->advanceBatchIndex());
return $results;
} | [
"protected",
"function",
"executeBatched",
"(",
"GraphQLRequest",
"$",
"request",
")",
":",
"array",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"do",
"{",
"$",
"results",
"[",
"]",
"=",
"$",
"this",
"->",
"graphQL",
"->",
"executeRequest",
"(",
"$",
"req... | Loop through the individual batched queries and collect the results.
@param \Nuwave\Lighthouse\Execution\GraphQLRequest $request
@return mixed[] | [
"Loop",
"through",
"the",
"individual",
"batched",
"queries",
"and",
"collect",
"the",
"results",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Support/Http/Controllers/GraphQLController.php#L97-L105 | train |
nuwave/lighthouse | src/Execution/Utils/GlobalId.php | GlobalId.decodeID | public function decodeID(string $globalID): string
{
[$type, $id] = self::decode($globalID);
return $id;
} | php | public function decodeID(string $globalID): string
{
[$type, $id] = self::decode($globalID);
return $id;
} | [
"public",
"function",
"decodeID",
"(",
"string",
"$",
"globalID",
")",
":",
"string",
"{",
"[",
"$",
"type",
",",
"$",
"id",
"]",
"=",
"self",
"::",
"decode",
"(",
"$",
"globalID",
")",
";",
"return",
"$",
"id",
";",
"}"
] | Decode the Global ID and get just the ID.
@param string $globalID
@return string | [
"Decode",
"the",
"Global",
"ID",
"and",
"get",
"just",
"the",
"ID",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/Utils/GlobalId.php#L50-L55 | train |
nuwave/lighthouse | src/Execution/Utils/GlobalId.php | GlobalId.decodeType | public function decodeType(string $globalID): string
{
[$type, $id] = self::decode($globalID);
return $type;
} | php | public function decodeType(string $globalID): string
{
[$type, $id] = self::decode($globalID);
return $type;
} | [
"public",
"function",
"decodeType",
"(",
"string",
"$",
"globalID",
")",
":",
"string",
"{",
"[",
"$",
"type",
",",
"$",
"id",
"]",
"=",
"self",
"::",
"decode",
"(",
"$",
"globalID",
")",
";",
"return",
"$",
"type",
";",
"}"
] | Decode the Global ID and get just the type.
@param string $globalID
@return string | [
"Decode",
"the",
"Global",
"ID",
"and",
"get",
"just",
"the",
"type",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/Utils/GlobalId.php#L63-L68 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.setRelations | public function setRelations(array $relations): self
{
// Parse and set the relations.
$this->relations = $this->newModelQuery()
->with($relations)
->getEagerLoads();
return $this;
} | php | public function setRelations(array $relations): self
{
// Parse and set the relations.
$this->relations = $this->newModelQuery()
->with($relations)
->getEagerLoads();
return $this;
} | [
"public",
"function",
"setRelations",
"(",
"array",
"$",
"relations",
")",
":",
"self",
"{",
"// Parse and set the relations.",
"$",
"this",
"->",
"relations",
"=",
"$",
"this",
"->",
"newModelQuery",
"(",
")",
"->",
"with",
"(",
"$",
"relations",
")",
"->",... | Set the relations to be loaded.
@param array $relations
@return $this | [
"Set",
"the",
"relations",
"to",
"be",
"loaded",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L52-L60 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.setModels | protected function setModels($models): self
{
// We can not use the collect() helper here, since we require this
// to be an Eloquent Collection
$this->models = $models instanceof EloquentCollection
? $models
: new EloquentCollection($models);
return $this;
... | php | protected function setModels($models): self
{
// We can not use the collect() helper here, since we require this
// to be an Eloquent Collection
$this->models = $models instanceof EloquentCollection
? $models
: new EloquentCollection($models);
return $this;
... | [
"protected",
"function",
"setModels",
"(",
"$",
"models",
")",
":",
"self",
"{",
"// We can not use the collect() helper here, since we require this",
"// to be an Eloquent Collection",
"$",
"this",
"->",
"models",
"=",
"$",
"models",
"instanceof",
"EloquentCollection",
"?"... | Set one or more Model instances as an EloquentCollection.
@param mixed $models
@return $this | [
"Set",
"one",
"or",
"more",
"Model",
"instances",
"as",
"an",
"EloquentCollection",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L90-L99 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.loadRelationsForPage | public function loadRelationsForPage(int $perPage, int $page = 1): self
{
foreach ($this->relations as $name => $constraints) {
$this->loadRelationForPage($perPage, $page, $name, $constraints);
}
return $this;
} | php | public function loadRelationsForPage(int $perPage, int $page = 1): self
{
foreach ($this->relations as $name => $constraints) {
$this->loadRelationForPage($perPage, $page, $name, $constraints);
}
return $this;
} | [
"public",
"function",
"loadRelationsForPage",
"(",
"int",
"$",
"perPage",
",",
"int",
"$",
"page",
"=",
"1",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"this",
"->",
"relations",
"as",
"$",
"name",
"=>",
"$",
"constraints",
")",
"{",
"$",
"this",
"-... | Load all relations for the model, but constrain the query to the current page.
@param int $perPage
@param int $page
@return $this | [
"Load",
"all",
"relations",
"for",
"the",
"model",
"but",
"constrain",
"the",
"query",
"to",
"the",
"current",
"page",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L120-L127 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.loadRelationForPage | public function loadRelationForPage(int $first, int $page, string $relationName, Closure $relationConstraints): self
{
// Load the count of relations of models, this will be the `total` argument of `Paginator`.
// Be aware that this will reload all the models entirely with the count of their relatio... | php | public function loadRelationForPage(int $first, int $page, string $relationName, Closure $relationConstraints): self
{
// Load the count of relations of models, this will be the `total` argument of `Paginator`.
// Be aware that this will reload all the models entirely with the count of their relatio... | [
"public",
"function",
"loadRelationForPage",
"(",
"int",
"$",
"first",
",",
"int",
"$",
"page",
",",
"string",
"$",
"relationName",
",",
"Closure",
"$",
"relationConstraints",
")",
":",
"self",
"{",
"// Load the count of relations of models, this will be the `total` arg... | Load only one page of relations of all the models.
The relation will be converted to a `Paginator` instance.
@param int $first
@param int $page
@param string $relationName
@param \Closure $relationConstraints
@return $this | [
"Load",
"only",
"one",
"page",
"of",
"relations",
"of",
"all",
"the",
"models",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L140-L169 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.buildRelationsFromModels | protected function buildRelationsFromModels(string $relationName, Closure $relationConstraints): Collection
{
return $this->models->toBase()->map(
function (Model $model) use ($relationName, $relationConstraints) {
$relation = $this->getRelationInstance($relationName);
... | php | protected function buildRelationsFromModels(string $relationName, Closure $relationConstraints): Collection
{
return $this->models->toBase()->map(
function (Model $model) use ($relationName, $relationConstraints) {
$relation = $this->getRelationInstance($relationName);
... | [
"protected",
"function",
"buildRelationsFromModels",
"(",
"string",
"$",
"relationName",
",",
"Closure",
"$",
"relationConstraints",
")",
":",
"Collection",
"{",
"return",
"$",
"this",
"->",
"models",
"->",
"toBase",
"(",
")",
"->",
"map",
"(",
"function",
"("... | Get queries to fetch relationships.
@param string $relationName
@param \Closure $relationConstraints
@return \Illuminate\Support\Collection<\Illuminate\Database\Eloquent\Relations\Relation> | [
"Get",
"queries",
"to",
"fetch",
"relationships",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L221-L251 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.loadDefaultWith | protected function loadDefaultWith(EloquentCollection $collection): self
{
if ($collection->isEmpty()) {
return $this;
}
$model = $collection->first();
$reflection = new ReflectionClass($model);
$withProperty = $reflection->getProperty('with');
$withPrope... | php | protected function loadDefaultWith(EloquentCollection $collection): self
{
if ($collection->isEmpty()) {
return $this;
}
$model = $collection->first();
$reflection = new ReflectionClass($model);
$withProperty = $reflection->getProperty('with');
$withPrope... | [
"protected",
"function",
"loadDefaultWith",
"(",
"EloquentCollection",
"$",
"collection",
")",
":",
"self",
"{",
"if",
"(",
"$",
"collection",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"model",
"=",
"$",
"collection",
"->... | Load default eager loads.
@param \Illuminate\Database\Eloquent\Collection<\Illuminate\Database\Eloquent\Model> $collection
@return $this | [
"Load",
"default",
"eager",
"loads",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L259-L279 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.getRelationDictionary | public function getRelationDictionary(string $relationName): array
{
return $this->models
->mapWithKeys(
function (Model $model) use ($relationName) {
return [$this->buildKey($model->getKey()) => $model->getRelation($relationName)];
}
... | php | public function getRelationDictionary(string $relationName): array
{
return $this->models
->mapWithKeys(
function (Model $model) use ($relationName) {
return [$this->buildKey($model->getKey()) => $model->getRelation($relationName)];
}
... | [
"public",
"function",
"getRelationDictionary",
"(",
"string",
"$",
"relationName",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"models",
"->",
"mapWithKeys",
"(",
"function",
"(",
"Model",
"$",
"model",
")",
"use",
"(",
"$",
"relationName",
")",
"... | Get an associative array of relations, keyed by the models primary key.
@param string $relationName
@return mixed[] | [
"Get",
"an",
"associative",
"array",
"of",
"relations",
"keyed",
"by",
"the",
"models",
"primary",
"key",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L300-L308 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.unionAllRelationQueries | protected function unionAllRelationQueries(Collection $relations): EloquentBuilder
{
return $relations
->reduce(
function (EloquentBuilder $builder, Relation $relation) {
return $builder->unionAll(
$relation->getQuery()
... | php | protected function unionAllRelationQueries(Collection $relations): EloquentBuilder
{
return $relations
->reduce(
function (EloquentBuilder $builder, Relation $relation) {
return $builder->unionAll(
$relation->getQuery()
... | [
"protected",
"function",
"unionAllRelationQueries",
"(",
"Collection",
"$",
"relations",
")",
":",
"EloquentBuilder",
"{",
"return",
"$",
"relations",
"->",
"reduce",
"(",
"function",
"(",
"EloquentBuilder",
"$",
"builder",
",",
"Relation",
"$",
"relation",
")",
... | Merge all the relation queries into a single query with UNION ALL.
@param \Illuminate\Support\Collection $relations
@return \Illuminate\Database\Eloquent\Builder | [
"Merge",
"all",
"the",
"relation",
"queries",
"into",
"a",
"single",
"query",
"with",
"UNION",
"ALL",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L316-L328 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.associateRelationModels | protected function associateRelationModels(string $relationName, EloquentCollection $relationModels): self
{
$relation = $this->getRelationInstance($relationName);
$relation->match(
$this->models->all(),
$relationModels,
$relationName
);
return $... | php | protected function associateRelationModels(string $relationName, EloquentCollection $relationModels): self
{
$relation = $this->getRelationInstance($relationName);
$relation->match(
$this->models->all(),
$relationModels,
$relationName
);
return $... | [
"protected",
"function",
"associateRelationModels",
"(",
"string",
"$",
"relationName",
",",
"EloquentCollection",
"$",
"relationModels",
")",
":",
"self",
"{",
"$",
"relation",
"=",
"$",
"this",
"->",
"getRelationInstance",
"(",
"$",
"relationName",
")",
";",
"... | Associate the collection of all fetched relationModels back with their parents.
@param string $relationName
@param \Illuminate\Database\Eloquent\Collection $relationModels
@return $this | [
"Associate",
"the",
"collection",
"of",
"all",
"fetched",
"relationModels",
"back",
"with",
"their",
"parents",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L367-L378 | train |
nuwave/lighthouse | src/Execution/DataLoader/ModelRelationFetcher.php | ModelRelationFetcher.hydratePivotRelation | protected function hydratePivotRelation(string $relationName, EloquentCollection $relationModels): self
{
$relation = $this->getRelationInstance($relationName);
if ($relationModels->isNotEmpty() && method_exists($relation, 'hydratePivotRelation')) {
$hydrationMethod = new ReflectionMeth... | php | protected function hydratePivotRelation(string $relationName, EloquentCollection $relationModels): self
{
$relation = $this->getRelationInstance($relationName);
if ($relationModels->isNotEmpty() && method_exists($relation, 'hydratePivotRelation')) {
$hydrationMethod = new ReflectionMeth... | [
"protected",
"function",
"hydratePivotRelation",
"(",
"string",
"$",
"relationName",
",",
"EloquentCollection",
"$",
"relationModels",
")",
":",
"self",
"{",
"$",
"relation",
"=",
"$",
"this",
"->",
"getRelationInstance",
"(",
"$",
"relationName",
")",
";",
"if"... | Ensure the pivot relation is hydrated too, if it exists.
@param string $relationName
@param \Illuminate\Database\Eloquent\Collection<\Illuminate\Database\Eloquent\Model> $relationModels
@return $this | [
"Ensure",
"the",
"pivot",
"relation",
"is",
"hydrated",
"too",
"if",
"it",
"exists",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Execution/DataLoader/ModelRelationFetcher.php#L387-L398 | train |
nuwave/lighthouse | src/Schema/Conversion/DefinitionNodeConverter.php | DefinitionNodeConverter.convertWrappedDefinitionNode | protected function convertWrappedDefinitionNode($node, array $wrappers = []): Type
{
// Recursively unwrap the type and save the wrappers
if ($node->kind === NodeKind::NON_NULL_TYPE || $node->kind === NodeKind::LIST_TYPE) {
$wrappers[] = $node->kind;
return $this->convertWra... | php | protected function convertWrappedDefinitionNode($node, array $wrappers = []): Type
{
// Recursively unwrap the type and save the wrappers
if ($node->kind === NodeKind::NON_NULL_TYPE || $node->kind === NodeKind::LIST_TYPE) {
$wrappers[] = $node->kind;
return $this->convertWra... | [
"protected",
"function",
"convertWrappedDefinitionNode",
"(",
"$",
"node",
",",
"array",
"$",
"wrappers",
"=",
"[",
"]",
")",
":",
"Type",
"{",
"// Recursively unwrap the type and save the wrappers",
"if",
"(",
"$",
"node",
"->",
"kind",
"===",
"NodeKind",
"::",
... | Unwrap the node if needed and convert to type.
@param mixed $node
@param string[] $wrappers
@return \GraphQL\Type\Definition\Type | [
"Unwrap",
"the",
"node",
"if",
"needed",
"and",
"convert",
"to",
"type",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Conversion/DefinitionNodeConverter.php#L45-L74 | train |
nuwave/lighthouse | src/Schema/Conversion/DefinitionNodeConverter.php | DefinitionNodeConverter.convertNamedTypeNode | protected function convertNamedTypeNode(NamedTypeNode $node): Type
{
$nodeName = $node->name->value;
switch ($nodeName) {
case 'ID':
return Type::id();
case 'Int':
return Type::int();
case 'Boolean':
return Type::boo... | php | protected function convertNamedTypeNode(NamedTypeNode $node): Type
{
$nodeName = $node->name->value;
switch ($nodeName) {
case 'ID':
return Type::id();
case 'Int':
return Type::int();
case 'Boolean':
return Type::boo... | [
"protected",
"function",
"convertNamedTypeNode",
"(",
"NamedTypeNode",
"$",
"node",
")",
":",
"Type",
"{",
"$",
"nodeName",
"=",
"$",
"node",
"->",
"name",
"->",
"value",
";",
"switch",
"(",
"$",
"nodeName",
")",
"{",
"case",
"'ID'",
":",
"return",
"Type... | Converted named node to type.
@param \GraphQL\Language\AST\NamedTypeNode $node
@return \GraphQL\Type\Definition\Type | [
"Converted",
"named",
"node",
"to",
"type",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Conversion/DefinitionNodeConverter.php#L82-L99 | train |
nuwave/lighthouse | src/Schema/Factories/FieldFactory.php | FieldFactory.handle | public function handle(FieldValue $fieldValue): array
{
$fieldDefinitionNode = $fieldValue->getField();
// Directives have the first priority for defining a resolver for a field
if ($resolverDirective = $this->directiveFactory->createFieldResolver($fieldDefinitionNode)) {
$this-... | php | public function handle(FieldValue $fieldValue): array
{
$fieldDefinitionNode = $fieldValue->getField();
// Directives have the first priority for defining a resolver for a field
if ($resolverDirective = $this->directiveFactory->createFieldResolver($fieldDefinitionNode)) {
$this-... | [
"public",
"function",
"handle",
"(",
"FieldValue",
"$",
"fieldValue",
")",
":",
"array",
"{",
"$",
"fieldDefinitionNode",
"=",
"$",
"fieldValue",
"->",
"getField",
"(",
")",
";",
"// Directives have the first priority for defining a resolver for a field",
"if",
"(",
"... | Convert a FieldValue to an executable FieldDefinition.
@param \Nuwave\Lighthouse\Schema\Values\FieldValue $fieldValue
@return array Configuration array for a FieldDefinition | [
"Convert",
"a",
"FieldValue",
"to",
"an",
"executable",
"FieldDefinition",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/FieldFactory.php#L138-L227 | train |
nuwave/lighthouse | src/Schema/Factories/FieldFactory.php | FieldFactory.getArgumentValues | protected function getArgumentValues(): Collection
{
return (new Collection($this->fieldValue->getField()->arguments))
->map(function (InputValueDefinitionNode $inputValueDefinition): ArgumentValue {
return new ArgumentValue($inputValueDefinition, $this->fieldValue);
... | php | protected function getArgumentValues(): Collection
{
return (new Collection($this->fieldValue->getField()->arguments))
->map(function (InputValueDefinitionNode $inputValueDefinition): ArgumentValue {
return new ArgumentValue($inputValueDefinition, $this->fieldValue);
... | [
"protected",
"function",
"getArgumentValues",
"(",
")",
":",
"Collection",
"{",
"return",
"(",
"new",
"Collection",
"(",
"$",
"this",
"->",
"fieldValue",
"->",
"getField",
"(",
")",
"->",
"arguments",
")",
")",
"->",
"map",
"(",
"function",
"(",
"InputValu... | Get a collection of the fields argument definitions.
@return \Illuminate\Support\Collection<\Nuwave\Lighthouse\Schema\Values\ArgumentValue> | [
"Get",
"a",
"collection",
"of",
"the",
"fields",
"argument",
"definitions",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/FieldFactory.php#L234-L240 | train |
nuwave/lighthouse | src/Schema/Factories/FieldFactory.php | FieldFactory.handleArgDirectivesRecursively | protected function handleArgDirectivesRecursively(
InputType $type,
InputValueDefinitionNode $astNode,
array $argumentPath
): void {
if ($type instanceof NonNull) {
$this->handleArgDirectivesRecursively(
$type->getWrappedType(),
$astNode,
... | php | protected function handleArgDirectivesRecursively(
InputType $type,
InputValueDefinitionNode $astNode,
array $argumentPath
): void {
if ($type instanceof NonNull) {
$this->handleArgDirectivesRecursively(
$type->getWrappedType(),
$astNode,
... | [
"protected",
"function",
"handleArgDirectivesRecursively",
"(",
"InputType",
"$",
"type",
",",
"InputValueDefinitionNode",
"$",
"astNode",
",",
"array",
"$",
"argumentPath",
")",
":",
"void",
"{",
"if",
"(",
"$",
"type",
"instanceof",
"NonNull",
")",
"{",
"$",
... | Handle the ArgMiddleware.
@param \GraphQL\Type\Definition\InputType $type
@param \GraphQL\Language\AST\InputValueDefinitionNode $astNode
@param mixed[] $argumentPath
@return void | [
"Handle",
"the",
"ArgMiddleware",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/FieldFactory.php#L250-L306 | train |
nuwave/lighthouse | src/Schema/Factories/FieldFactory.php | FieldFactory.validateArgs | protected function validateArgs(): void
{
if (! $this->rules) {
return;
}
$validator = validator(
$this->args,
$this->rules,
$this->messages,
[
'root' => $this->root,
'context' => $this->context,
... | php | protected function validateArgs(): void
{
if (! $this->rules) {
return;
}
$validator = validator(
$this->args,
$this->rules,
$this->messages,
[
'root' => $this->root,
'context' => $this->context,
... | [
"protected",
"function",
"validateArgs",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"rules",
")",
"{",
"return",
";",
"}",
"$",
"validator",
"=",
"validator",
"(",
"$",
"this",
"->",
"args",
",",
"$",
"this",
"->",
"rules",
",",... | Run the gathered validation rules on the arguments.
@return void | [
"Run",
"the",
"gathered",
"validation",
"rules",
"on",
"the",
"arguments",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/FieldFactory.php#L437-L474 | train |
nuwave/lighthouse | src/Schema/Factories/FieldFactory.php | FieldFactory.resumeHandlingArgDirectives | protected function resumeHandlingArgDirectives(): void
{
// copy and reset
$snapshots = $this->handleArgDirectivesSnapshots;
$this->handleArgDirectivesSnapshots = [];
foreach ($snapshots as $handlerArgs) {
$this->handleArgDirectives(...$handlerArgs);
}
/... | php | protected function resumeHandlingArgDirectives(): void
{
// copy and reset
$snapshots = $this->handleArgDirectivesSnapshots;
$this->handleArgDirectivesSnapshots = [];
foreach ($snapshots as $handlerArgs) {
$this->handleArgDirectives(...$handlerArgs);
}
/... | [
"protected",
"function",
"resumeHandlingArgDirectives",
"(",
")",
":",
"void",
"{",
"// copy and reset",
"$",
"snapshots",
"=",
"$",
"this",
"->",
"handleArgDirectivesSnapshots",
";",
"$",
"this",
"->",
"handleArgDirectivesSnapshots",
"=",
"[",
"]",
";",
"foreach",
... | Continue evaluating the arg directives after validation has run.
@return void | [
"Continue",
"evaluating",
"the",
"arg",
"directives",
"after",
"validation",
"has",
"run",
"."
] | f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8 | https://github.com/nuwave/lighthouse/blob/f92f779ab49e32bcb746f51e45b3dd0ad00dc8b8/src/Schema/Factories/FieldFactory.php#L481-L495 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.