repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
oscarotero/Gettext
src/Translation.php
Translation.getClone
public function getClone($context = null, $original = null) { $new = clone $this; if ($context !== null) { $new->context = (string) $context; } if ($original !== null) { $new->original = (string) $original; } return $new; }
php
public function getClone($context = null, $original = null) { $new = clone $this; if ($context !== null) { $new->context = (string) $context; } if ($original !== null) { $new->original = (string) $original; } return $new; }
[ "public", "function", "getClone", "(", "$", "context", "=", "null", ",", "$", "original", "=", "null", ")", "{", "$", "new", "=", "clone", "$", "this", ";", "if", "(", "$", "context", "!==", "null", ")", "{", "$", "new", "->", "context", "=", "("...
Clones this translation. @param null|string $context Optional new context @param null|string $original Optional new original @return Translation
[ "Clones", "this", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translation.php#L57-L70
oscarotero/Gettext
src/Translation.php
Translation.is
public function is($context, $original = '') { return (($this->context === $context) && ($this->original === $original)) ? true : false; }
php
public function is($context, $original = '') { return (($this->context === $context) && ($this->original === $original)) ? true : false; }
[ "public", "function", "is", "(", "$", "context", ",", "$", "original", "=", "''", ")", "{", "return", "(", "(", "$", "this", "->", "context", "===", "$", "context", ")", "&&", "(", "$", "this", "->", "original", "===", "$", "original", ")", ")", ...
Checks whether the translation matches with the arguments. @param string $context @param string $original @return bool
[ "Checks", "whether", "the", "translation", "matches", "with", "the", "arguments", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translation.php#L90-L93
oscarotero/Gettext
src/Translation.php
Translation.addReference
public function addReference($filename, $line = null) { $key = "{$filename}:{$line}"; $this->references[$key] = [$filename, $line]; return $this; }
php
public function addReference($filename, $line = null) { $key = "{$filename}:{$line}"; $this->references[$key] = [$filename, $line]; return $this; }
[ "public", "function", "addReference", "(", "$", "filename", ",", "$", "line", "=", "null", ")", "{", "$", "key", "=", "\"{$filename}:{$line}\"", ";", "$", "this", "->", "references", "[", "$", "key", "]", "=", "[", "$", "filename", ",", "$", "line", ...
Adds a new reference for this translation. @param string $filename The file path where the translation has been found @param null|int $line The line number where the translation has been found @return self
[ "Adds", "a", "new", "reference", "for", "this", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translation.php#L303-L309
oscarotero/Gettext
src/Translation.php
Translation.addComment
public function addComment($comment) { if (!in_array($comment, $this->comments, true)) { $this->comments[] = $comment; } return $this; }
php
public function addComment($comment) { if (!in_array($comment, $this->comments, true)) { $this->comments[] = $comment; } return $this; }
[ "public", "function", "addComment", "(", "$", "comment", ")", "{", "if", "(", "!", "in_array", "(", "$", "comment", ",", "$", "this", "->", "comments", ",", "true", ")", ")", "{", "$", "this", "->", "comments", "[", "]", "=", "$", "comment", ";", ...
Adds a new comment for this translation. @param string $comment @return self
[ "Adds", "a", "new", "comment", "for", "this", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translation.php#L350-L357
oscarotero/Gettext
src/Translation.php
Translation.addFlag
public function addFlag($flag) { if (!in_array($flag, $this->flags, true)) { $this->flags[] = $flag; } return $this; }
php
public function addFlag($flag) { if (!in_array($flag, $this->flags, true)) { $this->flags[] = $flag; } return $this; }
[ "public", "function", "addFlag", "(", "$", "flag", ")", "{", "if", "(", "!", "in_array", "(", "$", "flag", ",", "$", "this", "->", "flags", ",", "true", ")", ")", "{", "$", "this", "->", "flags", "[", "]", "=", "$", "flag", ";", "}", "return", ...
Adds a new flag for this translation. @param string $flag @return self
[ "Adds", "a", "new", "flag", "for", "this", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translation.php#L446-L453
oscarotero/Gettext
src/Translation.php
Translation.mergeWith
public function mergeWith(Translation $translation, $options = Merge::DEFAULTS) { Merge::mergeTranslation($translation, $this, $options); Merge::mergeReferences($translation, $this, $options); Merge::mergeComments($translation, $this, $options); Merge::mergeExtractedComments($transla...
php
public function mergeWith(Translation $translation, $options = Merge::DEFAULTS) { Merge::mergeTranslation($translation, $this, $options); Merge::mergeReferences($translation, $this, $options); Merge::mergeComments($translation, $this, $options); Merge::mergeExtractedComments($transla...
[ "public", "function", "mergeWith", "(", "Translation", "$", "translation", ",", "$", "options", "=", "Merge", "::", "DEFAULTS", ")", "{", "Merge", "::", "mergeTranslation", "(", "$", "translation", ",", "$", "this", ",", "$", "options", ")", ";", "Merge", ...
Merges this translation with other translation. @param Translation $translation The translation to merge with @param int $options @return self
[ "Merges", "this", "translation", "with", "other", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translation.php#L495-L504
oscarotero/Gettext
src/Generators/Csv.php
Csv.toString
public static function toString(Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); if ($options['includeHeaders']) { self::fputcsv($handle, ['', '', self::generateHeaders($translations)], $options); } ...
php
public static function toString(Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); if ($options['includeHeaders']) { self::fputcsv($handle, ['', '', self::generateHeaders($translations)], $options); } ...
[ "public", "static", "function", "toString", "(", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "static", "::", "$", "options", ";", "$", "handle", "=", "fopen", "(", "'php://memory'", ",...
{@parentDoc}.
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Generators/Csv.php#L27-L55
oscarotero/Gettext
src/Extractors/Twig.php
Twig.fromString
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $twig = $options['twig'] ?: self::createTwig(); PhpCode::fromString($twig->compileSource(new Twig_Source($string, '')), $translations, $options); }
php
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $twig = $options['twig'] ?: self::createTwig(); PhpCode::fromString($twig->compileSource(new Twig_Source($string, '')), $translations, $options); }
[ "public", "static", "function", "fromString", "(", "$", "string", ",", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "static", "::", "$", "options", ";", "$", "twig", "=", "$", "option...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/Twig.php#L24-L31
oscarotero/Gettext
src/Utils/DictionaryTrait.php
DictionaryTrait.toArray
private static function toArray(Translations $translations, $includeHeaders) { $messages = []; if ($includeHeaders) { $messages[''] = self::generateHeaders($translations); } foreach ($translations as $translation) { if ($translation->isDisabled()) { ...
php
private static function toArray(Translations $translations, $includeHeaders) { $messages = []; if ($includeHeaders) { $messages[''] = self::generateHeaders($translations); } foreach ($translations as $translation) { if ($translation->isDisabled()) { ...
[ "private", "static", "function", "toArray", "(", "Translations", "$", "translations", ",", "$", "includeHeaders", ")", "{", "$", "messages", "=", "[", "]", ";", "if", "(", "$", "includeHeaders", ")", "{", "$", "messages", "[", "''", "]", "=", "self", "...
Returns a plain dictionary with the format [original => translation]. @param Translations $translations @param bool $includeHeaders @return array
[ "Returns", "a", "plain", "dictionary", "with", "the", "format", "[", "original", "=", ">", "translation", "]", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/DictionaryTrait.php#L23-L40
oscarotero/Gettext
src/Utils/DictionaryTrait.php
DictionaryTrait.fromArray
private static function fromArray(array $messages, Translations $translations) { foreach ($messages as $original => $translation) { if ($original === '') { self::extractHeaders($translation, $translations); continue; } $translations->inser...
php
private static function fromArray(array $messages, Translations $translations) { foreach ($messages as $original => $translation) { if ($original === '') { self::extractHeaders($translation, $translations); continue; } $translations->inser...
[ "private", "static", "function", "fromArray", "(", "array", "$", "messages", ",", "Translations", "$", "translations", ")", "{", "foreach", "(", "$", "messages", "as", "$", "original", "=>", "$", "translation", ")", "{", "if", "(", "$", "original", "===", ...
Extract the entries from a dictionary. @param array $messages @param Translations $translations
[ "Extract", "the", "entries", "from", "a", "dictionary", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/DictionaryTrait.php#L48-L58
oscarotero/Gettext
src/Utils/PhpFunctionsScanner.php
PhpFunctionsScanner.getFunctions
public function getFunctions(array $constants = []) { $count = count($this->tokens); /* @var ParsedFunction[] $bufferFunctions */ $bufferFunctions = []; /* @var ParsedComment[] $bufferComments */ $bufferComments = []; /* @var array $functions */ $functions = [...
php
public function getFunctions(array $constants = []) { $count = count($this->tokens); /* @var ParsedFunction[] $bufferFunctions */ $bufferFunctions = []; /* @var ParsedComment[] $bufferComments */ $bufferComments = []; /* @var array $functions */ $functions = [...
[ "public", "function", "getFunctions", "(", "array", "$", "constants", "=", "[", "]", ")", "{", "$", "count", "=", "count", "(", "$", "this", "->", "tokens", ")", ";", "/* @var ParsedFunction[] $bufferFunctions */", "$", "bufferFunctions", "=", "[", "]", ";",...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/PhpFunctionsScanner.php#L61-L165
oscarotero/Gettext
src/Utils/PhpFunctionsScanner.php
PhpFunctionsScanner.parsePhpComment
protected function parsePhpComment($value, $line) { if ($this->extractComments === false) { return null; } //this returns a comment or null $comment = ParsedComment::create($value, $line); $prefixes = array_filter((array) $this->extractComments); if ($c...
php
protected function parsePhpComment($value, $line) { if ($this->extractComments === false) { return null; } //this returns a comment or null $comment = ParsedComment::create($value, $line); $prefixes = array_filter((array) $this->extractComments); if ($c...
[ "protected", "function", "parsePhpComment", "(", "$", "value", ",", "$", "line", ")", "{", "if", "(", "$", "this", "->", "extractComments", "===", "false", ")", "{", "return", "null", ";", "}", "//this returns a comment or null", "$", "comment", "=", "Parsed...
Extract the actual text from a PHP comment. If set, only returns comments that match the prefix(es). @param string $value The PHP comment. @param int $line Line number. @return null|ParsedComment Comment or null if comment extraction is disabled or if there is a prefix mismatch.
[ "Extract", "the", "actual", "text", "from", "a", "PHP", "comment", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/PhpFunctionsScanner.php#L177-L193
oscarotero/Gettext
src/Generators/CsvDictionary.php
CsvDictionary.toString
public static function toString(Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); foreach (self::toArray($translations, $options['includeHeaders']) as $original => $translation) { self::fputcsv($handle, [$origi...
php
public static function toString(Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); foreach (self::toArray($translations, $options['includeHeaders']) as $original => $translation) { self::fputcsv($handle, [$origi...
[ "public", "static", "function", "toString", "(", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "static", "::", "$", "options", ";", "$", "handle", "=", "fopen", "(", "'php://memory'", ",...
{@parentDoc}.
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Generators/CsvDictionary.php#L24-L38
oscarotero/Gettext
src/Extractors/CsvDictionary.php
CsvDictionary.fromString
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); fputs($handle, $string); rewind($handle); while ($row = self::fgetcsv($handle, $options)) { list($or...
php
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); fputs($handle, $string); rewind($handle); while ($row = self::fgetcsv($handle, $options)) { list($or...
[ "public", "static", "function", "fromString", "(", "$", "string", ",", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "static", "::", "$", "options", ";", "$", "handle", "=", "fopen", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/CsvDictionary.php#L26-L46
oscarotero/Gettext
src/Utils/ParsedFunction.php
ParsedFunction.nextArgument
public function nextArgument() { if ($this->argumentIndex === -1) { // This should neve occur, but let's stay safe - During test/development an Exception should be thrown. $this->argumentIndex = 1; } else { ++$this->argumentIndex; } $this->argument...
php
public function nextArgument() { if ($this->argumentIndex === -1) { // This should neve occur, but let's stay safe - During test/development an Exception should be thrown. $this->argumentIndex = 1; } else { ++$this->argumentIndex; } $this->argument...
[ "public", "function", "nextArgument", "(", ")", "{", "if", "(", "$", "this", "->", "argumentIndex", "===", "-", "1", ")", "{", "// This should neve occur, but let's stay safe - During test/development an Exception should be thrown.", "$", "this", "->", "argumentIndex", "=...
Go to the next argument because we a comma was found.
[ "Go", "to", "the", "next", "argument", "because", "we", "a", "comma", "was", "found", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/ParsedFunction.php#L82-L91
oscarotero/Gettext
src/Utils/ParsedFunction.php
ParsedFunction.addArgumentChunk
public function addArgumentChunk($chunk) { if ($this->argumentStopped === false) { if ($this->argumentIndex === -1) { $this->argumentIndex = 0; } if (isset($this->arguments[$this->argumentIndex])) { $this->arguments[$this->argumentIndex] .=...
php
public function addArgumentChunk($chunk) { if ($this->argumentStopped === false) { if ($this->argumentIndex === -1) { $this->argumentIndex = 0; } if (isset($this->arguments[$this->argumentIndex])) { $this->arguments[$this->argumentIndex] .=...
[ "public", "function", "addArgumentChunk", "(", "$", "chunk", ")", "{", "if", "(", "$", "this", "->", "argumentStopped", "===", "false", ")", "{", "if", "(", "$", "this", "->", "argumentIndex", "===", "-", "1", ")", "{", "$", "this", "->", "argumentInde...
Add a string to the current argument. @param string|null $chunk
[ "Add", "a", "string", "to", "the", "current", "argument", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/ParsedFunction.php#L98-L110
oscarotero/Gettext
src/Utils/ParsedFunction.php
ParsedFunction.addComment
public function addComment($comment) { if ($this->comments === null) { $this->comments = []; } $this->comments[] = $comment; }
php
public function addComment($comment) { if ($this->comments === null) { $this->comments = []; } $this->comments[] = $comment; }
[ "public", "function", "addComment", "(", "$", "comment", ")", "{", "if", "(", "$", "this", "->", "comments", "===", "null", ")", "{", "$", "this", "->", "comments", "=", "[", "]", ";", "}", "$", "this", "->", "comments", "[", "]", "=", "$", "comm...
Add a comment associated to this function. @param string $comment
[ "Add", "a", "comment", "associated", "to", "this", "function", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/ParsedFunction.php#L117-L123
oscarotero/Gettext
src/Utils/ParsedFunction.php
ParsedFunction.close
public function close() { $arguments = []; for ($i = 0; $i <= $this->argumentIndex; ++$i) { $arguments[$i] = isset($this->arguments[$i]) ? $this->arguments[$i] : null; } return [ $this->name, $this->line, $arguments, $this-...
php
public function close() { $arguments = []; for ($i = 0; $i <= $this->argumentIndex; ++$i) { $arguments[$i] = isset($this->arguments[$i]) ? $this->arguments[$i] : null; } return [ $this->name, $this->line, $arguments, $this-...
[ "public", "function", "close", "(", ")", "{", "$", "arguments", "=", "[", "]", ";", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<=", "$", "this", "->", "argumentIndex", ";", "++", "$", "i", ")", "{", "$", "arguments", "[", "$", "i", "]", ...
A closing parenthesis was found: return the final data. The array returned has the following values: 0 => string The function name. 1 => int The line where the function starts. 2 => string[] the strings extracted from the function arguments. 3 => string[] the comments associated to the function. @return array
[ "A", "closing", "parenthesis", "was", "found", ":", "return", "the", "final", "data", ".", "The", "array", "returned", "has", "the", "following", "values", ":", "0", "=", ">", "string", "The", "function", "name", ".", "1", "=", ">", "int", "The", "line...
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/ParsedFunction.php#L145-L158
oscarotero/Gettext
src/Utils/StringReader.php
StringReader.read
public function read($bytes) { $data = substr($this->str, $this->pos, $bytes); $this->seekto($this->pos + $bytes); return $data; }
php
public function read($bytes) { $data = substr($this->str, $this->pos, $bytes); $this->seekto($this->pos + $bytes); return $data; }
[ "public", "function", "read", "(", "$", "bytes", ")", "{", "$", "data", "=", "substr", "(", "$", "this", "->", "str", ",", "$", "this", "->", "pos", ",", "$", "bytes", ")", ";", "$", "this", "->", "seekto", "(", "$", "this", "->", "pos", "+", ...
Read and returns a part of the string. @param int $bytes The number of bytes to read @return string
[ "Read", "and", "returns", "a", "part", "of", "the", "string", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/StringReader.php#L29-L36
oscarotero/Gettext
src/Utils/StringReader.php
StringReader.seekto
public function seekto($pos) { $this->pos = ($this->strlen < $pos) ? $this->strlen : $pos; return $this->pos; }
php
public function seekto($pos) { $this->pos = ($this->strlen < $pos) ? $this->strlen : $pos; return $this->pos; }
[ "public", "function", "seekto", "(", "$", "pos", ")", "{", "$", "this", "->", "pos", "=", "(", "$", "this", "->", "strlen", "<", "$", "pos", ")", "?", "$", "this", "->", "strlen", ":", "$", "pos", ";", "return", "$", "this", "->", "pos", ";", ...
Move the cursor to a specific position. @param int $pos The amount of bytes to move @return int The new position
[ "Move", "the", "cursor", "to", "a", "specific", "position", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/StringReader.php#L45-L50
oscarotero/Gettext
src/Translator.php
Translator.loadTranslations
public function loadTranslations($translations) { if (is_object($translations) && $translations instanceof Translations) { $translations = PhpArray::generate($translations, ['includeHeaders' => false]); } elseif (is_string($translations) && is_file($translations)) { $translat...
php
public function loadTranslations($translations) { if (is_object($translations) && $translations instanceof Translations) { $translations = PhpArray::generate($translations, ['includeHeaders' => false]); } elseif (is_string($translations) && is_file($translations)) { $translat...
[ "public", "function", "loadTranslations", "(", "$", "translations", ")", "{", "if", "(", "is_object", "(", "$", "translations", ")", "&&", "$", "translations", "instanceof", "Translations", ")", "{", "$", "translations", "=", "PhpArray", "::", "generate", "(",...
Loads translation from a Translations instance, a file on an array. @param Translations|string|array $translations @return self
[ "Loads", "translation", "from", "a", "Translations", "instance", "a", "file", "on", "an", "array", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L20-L35
oscarotero/Gettext
src/Translator.php
Translator.ngettext
public function ngettext($original, $plural, $value) { return $this->dnpgettext($this->domain, null, $original, $plural, $value); }
php
public function ngettext($original, $plural, $value) { return $this->dnpgettext($this->domain, null, $original, $plural, $value); }
[ "public", "function", "ngettext", "(", "$", "original", ",", "$", "plural", ",", "$", "value", ")", "{", "return", "$", "this", "->", "dnpgettext", "(", "$", "this", "->", "domain", ",", "null", ",", "$", "original", ",", "$", "plural", ",", "$", "...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L66-L69
oscarotero/Gettext
src/Translator.php
Translator.dngettext
public function dngettext($domain, $original, $plural, $value) { return $this->dnpgettext($domain, null, $original, $plural, $value); }
php
public function dngettext($domain, $original, $plural, $value) { return $this->dnpgettext($domain, null, $original, $plural, $value); }
[ "public", "function", "dngettext", "(", "$", "domain", ",", "$", "original", ",", "$", "plural", ",", "$", "value", ")", "{", "return", "$", "this", "->", "dnpgettext", "(", "$", "domain", ",", "null", ",", "$", "original", ",", "$", "plural", ",", ...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L76-L79
oscarotero/Gettext
src/Translator.php
Translator.npgettext
public function npgettext($context, $original, $plural, $value) { return $this->dnpgettext($this->domain, $context, $original, $plural, $value); }
php
public function npgettext($context, $original, $plural, $value) { return $this->dnpgettext($this->domain, $context, $original, $plural, $value); }
[ "public", "function", "npgettext", "(", "$", "context", ",", "$", "original", ",", "$", "plural", ",", "$", "value", ")", "{", "return", "$", "this", "->", "dnpgettext", "(", "$", "this", "->", "domain", ",", "$", "context", ",", "$", "original", ","...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L86-L89
oscarotero/Gettext
src/Translator.php
Translator.dpgettext
public function dpgettext($domain, $context, $original) { $translation = $this->getTranslation($domain, $context, $original); if (isset($translation[0]) && $translation[0] !== '') { return $translation[0]; } return $original; }
php
public function dpgettext($domain, $context, $original) { $translation = $this->getTranslation($domain, $context, $original); if (isset($translation[0]) && $translation[0] !== '') { return $translation[0]; } return $original; }
[ "public", "function", "dpgettext", "(", "$", "domain", ",", "$", "context", ",", "$", "original", ")", "{", "$", "translation", "=", "$", "this", "->", "getTranslation", "(", "$", "domain", ",", "$", "context", ",", "$", "original", ")", ";", "if", "...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L116-L125
oscarotero/Gettext
src/Translator.php
Translator.dnpgettext
public function dnpgettext($domain, $context, $original, $plural, $value) { $translation = $this->getTranslation($domain, $context, $original); $key = $this->getPluralIndex($domain, $value, $translation === false); if (isset($translation[$key]) && $translation[$key] !== '') { re...
php
public function dnpgettext($domain, $context, $original, $plural, $value) { $translation = $this->getTranslation($domain, $context, $original); $key = $this->getPluralIndex($domain, $value, $translation === false); if (isset($translation[$key]) && $translation[$key] !== '') { re...
[ "public", "function", "dnpgettext", "(", "$", "domain", ",", "$", "context", ",", "$", "original", ",", "$", "plural", ",", "$", "value", ")", "{", "$", "translation", "=", "$", "this", "->", "getTranslation", "(", "$", "domain", ",", "$", "context", ...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L132-L142
oscarotero/Gettext
src/Translator.php
Translator.getTranslation
protected function getTranslation($domain, $context, $original) { return isset($this->dictionary[$domain][$context][$original]) ? $this->dictionary[$domain][$context][$original] : false; }
php
protected function getTranslation($domain, $context, $original) { return isset($this->dictionary[$domain][$context][$original]) ? $this->dictionary[$domain][$context][$original] : false; }
[ "protected", "function", "getTranslation", "(", "$", "domain", ",", "$", "context", ",", "$", "original", ")", "{", "return", "isset", "(", "$", "this", "->", "dictionary", "[", "$", "domain", "]", "[", "$", "context", "]", "[", "$", "original", "]", ...
Search and returns a translation. @param string $domain @param string $context @param string $original @return string|false
[ "Search", "and", "returns", "a", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L187-L192
oscarotero/Gettext
src/Translator.php
Translator.getPluralIndex
protected function getPluralIndex($domain, $n, $fallback) { //Not loaded domain or translation, use a fallback if (!isset($this->plurals[$domain]) || $fallback === true) { return $n == 1 ? 0 : 1; } if (!isset($this->plurals[$domain]['function'])) { $code = se...
php
protected function getPluralIndex($domain, $n, $fallback) { //Not loaded domain or translation, use a fallback if (!isset($this->plurals[$domain]) || $fallback === true) { return $n == 1 ? 0 : 1; } if (!isset($this->plurals[$domain]['function'])) { $code = se...
[ "protected", "function", "getPluralIndex", "(", "$", "domain", ",", "$", "n", ",", "$", "fallback", ")", "{", "//Not loaded domain or translation, use a fallback", "if", "(", "!", "isset", "(", "$", "this", "->", "plurals", "[", "$", "domain", "]", ")", "||"...
Executes the plural decision code given the number to decide which plural version to take. @param string $domain @param string $n @param bool $fallback set to true to get fallback plural index @return int
[ "Executes", "the", "plural", "decision", "code", "given", "the", "number", "to", "decide", "which", "plural", "version", "to", "take", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translator.php#L204-L221
oscarotero/Gettext
src/Extractors/Csv.php
Csv.fromString
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); fputs($handle, $string); rewind($handle); while ($row = self::fgetcsv($handle, $options)) { $context...
php
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); fputs($handle, $string); rewind($handle); while ($row = self::fgetcsv($handle, $options)) { $context...
[ "public", "static", "function", "fromString", "(", "$", "string", ",", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "static", "::", "$", "options", ";", "$", "handle", "=", "fopen", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/Csv.php#L26-L52
oscarotero/Gettext
src/Utils/ParsedComment.php
ParsedComment.create
public static function create($value, $line) { $lastLine = $line + substr_count($value, "\n"); $lines = array_map(function ($line) { if ('' === trim($line)) { return null; } $line = ltrim($line, '#*/ '); $line = rtrim($line, '#*/ '); ...
php
public static function create($value, $line) { $lastLine = $line + substr_count($value, "\n"); $lines = array_map(function ($line) { if ('' === trim($line)) { return null; } $line = ltrim($line, '#*/ '); $line = rtrim($line, '#*/ '); ...
[ "public", "static", "function", "create", "(", "$", "value", ",", "$", "line", ")", "{", "$", "lastLine", "=", "$", "line", "+", "substr_count", "(", "$", "value", ",", "\"\\n\"", ")", ";", "$", "lines", "=", "array_map", "(", "function", "(", "$", ...
Create new object from raw comment data. @param string $value The PHP comment string. @param int $line The line where the comment starts. @return self The parsed comment.
[ "Create", "new", "object", "from", "raw", "comment", "data", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/ParsedComment.php#L53-L73
oscarotero/Gettext
src/Utils/ParsedComment.php
ParsedComment.checkPrefixes
public function checkPrefixes(array $prefixes) { if ('' === $this->comment) { return false; } if (empty($prefixes)) { return true; } foreach ($prefixes as $prefix) { if (strpos($this->comment, $prefix) === 0) { return true...
php
public function checkPrefixes(array $prefixes) { if ('' === $this->comment) { return false; } if (empty($prefixes)) { return true; } foreach ($prefixes as $prefix) { if (strpos($this->comment, $prefix) === 0) { return true...
[ "public", "function", "checkPrefixes", "(", "array", "$", "prefixes", ")", "{", "if", "(", "''", "===", "$", "this", "->", "comment", ")", "{", "return", "false", ";", "}", "if", "(", "empty", "(", "$", "prefixes", ")", ")", "{", "return", "true", ...
Whether the comment matches the required prefixes. @param array $prefixes An array of prefixes to check. @return bool Whether the comment matches the prefixes or not.
[ "Whether", "the", "comment", "matches", "the", "required", "prefixes", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/ParsedComment.php#L122-L139
oscarotero/Gettext
src/Extractors/VueJs.php
VueJs.getScriptTranslationsFromString
private static function getScriptTranslationsFromString( $scriptContents, Translations $translations, array $options = [], $lineOffset = 0 ) { $functions = new JsFunctionsScanner($scriptContents); $options['lineOffset'] = $lineOffset; $functions->saveGettextFu...
php
private static function getScriptTranslationsFromString( $scriptContents, Translations $translations, array $options = [], $lineOffset = 0 ) { $functions = new JsFunctionsScanner($scriptContents); $options['lineOffset'] = $lineOffset; $functions->saveGettextFu...
[ "private", "static", "function", "getScriptTranslationsFromString", "(", "$", "scriptContents", ",", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ",", "$", "lineOffset", "=", "0", ")", "{", "$", "functions", "=", "new", "...
Extract translations from script part @param string $scriptContents Only script tag contents, not the whole template @param Translations $translations @param array $options @param int $lineOffset Number of lines the script is offset in the vue template file @throws \Exception
[ "Extract", "translations", "from", "script", "part" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/VueJs.php#L132-L141
oscarotero/Gettext
src/Extractors/VueJs.php
VueJs.getTemplateAttributeFakeJs
private static function getTemplateAttributeFakeJs(array $options, DOMElement $dom) { $expressionsByLine = self::getVueAttributeExpressions($options['attributePrefixes'], $dom); if (empty($expressionsByLine)) { return ''; } $maxLines = max(array_keys($expressionsByLine)...
php
private static function getTemplateAttributeFakeJs(array $options, DOMElement $dom) { $expressionsByLine = self::getVueAttributeExpressions($options['attributePrefixes'], $dom); if (empty($expressionsByLine)) { return ''; } $maxLines = max(array_keys($expressionsByLine)...
[ "private", "static", "function", "getTemplateAttributeFakeJs", "(", "array", "$", "options", ",", "DOMElement", "$", "dom", ")", "{", "$", "expressionsByLine", "=", "self", "::", "getVueAttributeExpressions", "(", "$", "options", "[", "'attributePrefixes'", "]", "...
Extract JS expressions from element attribute bindings (excluding text within elements) For example: <span :title="__('extract this')"> skip element content </span> @param array $options @param DOMElement $dom @return string JS code
[ "Extract", "JS", "expressions", "from", "element", "attribute", "bindings", "(", "excluding", "text", "within", "elements", ")", "For", "example", ":", "<span", ":", "title", "=", "__", "(", "extract", "this", ")", ">", "skip", "element", "content", "<", "...
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/VueJs.php#L231-L250
oscarotero/Gettext
src/Extractors/VueJs.php
VueJs.getVueAttributeExpressions
private static function getVueAttributeExpressions( array $attributePrefixes, DOMElement $dom, array &$expressionByLine = [] ) { $children = $dom->childNodes; for ($i = 0; $i < $children->length; $i++) { $node = $children->item($i); if (!($node insta...
php
private static function getVueAttributeExpressions( array $attributePrefixes, DOMElement $dom, array &$expressionByLine = [] ) { $children = $dom->childNodes; for ($i = 0; $i < $children->length; $i++) { $node = $children->item($i); if (!($node insta...
[ "private", "static", "function", "getVueAttributeExpressions", "(", "array", "$", "attributePrefixes", ",", "DOMElement", "$", "dom", ",", "array", "&", "$", "expressionByLine", "=", "[", "]", ")", "{", "$", "children", "=", "$", "dom", "->", "childNodes", "...
Loop DOM element recursively and parse out all dynamic vue attributes which are basically JS expressions @param array $attributePrefixes List of attribute prefixes we parse as JS (may contain translations) @param DOMElement $dom @param array $expressionByLine [lineNumber => [jsExpression, ..], ..] @return array [lineN...
[ "Loop", "DOM", "element", "recursively", "and", "parse", "out", "all", "dynamic", "vue", "attributes", "which", "are", "basically", "JS", "expressions" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/VueJs.php#L260-L293
oscarotero/Gettext
src/Extractors/VueJs.php
VueJs.getTemplateFakeJs
private static function getTemplateFakeJs(DOMElement $dom) { $fakeJs = ''; $lines = explode("\n", $dom->textContent); // Build a fake JS file from template by extracting JS expressions within each template line foreach ($lines as $line) { $expressionMatched = self::parse...
php
private static function getTemplateFakeJs(DOMElement $dom) { $fakeJs = ''; $lines = explode("\n", $dom->textContent); // Build a fake JS file from template by extracting JS expressions within each template line foreach ($lines as $line) { $expressionMatched = self::parse...
[ "private", "static", "function", "getTemplateFakeJs", "(", "DOMElement", "$", "dom", ")", "{", "$", "fakeJs", "=", "''", ";", "$", "lines", "=", "explode", "(", "\"\\n\"", ",", "$", "dom", "->", "textContent", ")", ";", "// Build a fake JS file from template b...
Extract JS expressions from within template elements (excluding attributes) For example: <span :title="skip attributes"> {{__("extract element content")}} </span> @param DOMElement $dom @return string JS code
[ "Extract", "JS", "expressions", "from", "within", "template", "elements", "(", "excluding", "attributes", ")", "For", "example", ":", "<span", ":", "title", "=", "skip", "attributes", ">", "{{", "__", "(", "extract", "element", "content", ")", "}}", "<", "...
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/VueJs.php#L319-L332
oscarotero/Gettext
src/Extractors/VueJs.php
VueJs.parseOneTemplateLine
private static function parseOneTemplateLine($line) { $line = trim($line); if (!$line) { return []; } $regex = '#\{\{(.*?)\}\}#'; preg_match_all($regex, $line, $matches); $matched = array_map(function ($v) { return trim($v, '\'"{}'); ...
php
private static function parseOneTemplateLine($line) { $line = trim($line); if (!$line) { return []; } $regex = '#\{\{(.*?)\}\}#'; preg_match_all($regex, $line, $matches); $matched = array_map(function ($v) { return trim($v, '\'"{}'); ...
[ "private", "static", "function", "parseOneTemplateLine", "(", "$", "line", ")", "{", "$", "line", "=", "trim", "(", "$", "line", ")", ";", "if", "(", "!", "$", "line", ")", "{", "return", "[", "]", ";", "}", "$", "regex", "=", "'#\\{\\{(.*?)\\}\\}#'"...
Match JS expressions in a template line @param string $line @return string[]
[ "Match", "JS", "expressions", "in", "a", "template", "line" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/VueJs.php#L340-L357
oscarotero/Gettext
src/Utils/JsFunctionsScanner.php
JsFunctionsScanner.getFunctions
public function getFunctions(array $constants = []) { $length = strlen($this->code); $line = 1; $buffer = ''; $functions = []; $bufferFunctions = []; $char = null; for ($pos = 0; $pos < $length; ++$pos) { $prev = $char; $char = $this->...
php
public function getFunctions(array $constants = []) { $length = strlen($this->code); $line = 1; $buffer = ''; $functions = []; $bufferFunctions = []; $char = null; for ($pos = 0; $pos < $length; ++$pos) { $prev = $char; $char = $this->...
[ "public", "function", "getFunctions", "(", "array", "$", "constants", "=", "[", "]", ")", "{", "$", "length", "=", "strlen", "(", "$", "this", "->", "code", ")", ";", "$", "line", "=", "1", ";", "$", "buffer", "=", "''", ";", "$", "functions", "=...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/JsFunctionsScanner.php#L24-L200
oscarotero/Gettext
src/Utils/JsFunctionsScanner.php
JsFunctionsScanner.status
protected function status($match = null) { $status = isset($this->status[0]) ? $this->status[0] : null; if ($match !== null) { return $status === $match; } return $status; }
php
protected function status($match = null) { $status = isset($this->status[0]) ? $this->status[0] : null; if ($match !== null) { return $status === $match; } return $status; }
[ "protected", "function", "status", "(", "$", "match", "=", "null", ")", "{", "$", "status", "=", "isset", "(", "$", "this", "->", "status", "[", "0", "]", ")", "?", "$", "this", "->", "status", "[", "0", "]", ":", "null", ";", "if", "(", "$", ...
Get the current context of the scan. @param null|string $match To check whether the current status is this value @return string|bool
[ "Get", "the", "current", "context", "of", "the", "scan", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/JsFunctionsScanner.php#L209-L218
oscarotero/Gettext
src/Utils/JsFunctionsScanner.php
JsFunctionsScanner.convertString
protected static function convertString($value) { if (strpos($value, '\\') === false) { return $value; } return preg_replace_callback( '/\\\(n|r|t|v|e|f|"|\\\)/', function ($match) { switch ($match[1][0]) { case 'n': ...
php
protected static function convertString($value) { if (strpos($value, '\\') === false) { return $value; } return preg_replace_callback( '/\\\(n|r|t|v|e|f|"|\\\)/', function ($match) { switch ($match[1][0]) { case 'n': ...
[ "protected", "static", "function", "convertString", "(", "$", "value", ")", "{", "if", "(", "strpos", "(", "$", "value", ",", "'\\\\'", ")", "===", "false", ")", "{", "return", "$", "value", ";", "}", "return", "preg_replace_callback", "(", "'/\\\\\\(n|r|t...
Decodes a string with an argument. @param string $value @return string
[ "Decodes", "a", "string", "with", "an", "argument", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/JsFunctionsScanner.php#L261-L291
oscarotero/Gettext
src/Generators/Mo.php
Mo.toString
public static function toString(Translations $translations, array $options = []) { $options += static::$options; $messages = []; if ($options['includeHeaders']) { $messages[''] = self::generateHeaders($translations); } foreach ($translations as $translation) { ...
php
public static function toString(Translations $translations, array $options = []) { $options += static::$options; $messages = []; if ($options['includeHeaders']) { $messages[''] = self::generateHeaders($translations); } foreach ($translations as $translation) { ...
[ "public", "static", "function", "toString", "(", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "static", "::", "$", "options", ";", "$", "messages", "=", "[", "]", ";", "if", "(", "$...
{@parentDoc}.
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Generators/Mo.php#L19-L139
oscarotero/Gettext
src/Extractors/Mo.php
Mo.fromString
public static function fromString($string, Translations $translations, array $options = []) { $stream = new StringReader($string); $magic = self::readInt($stream, 'V'); if (($magic === self::MAGIC1) || ($magic === self::MAGIC3)) { //to make sure it works for 64-bit platforms $by...
php
public static function fromString($string, Translations $translations, array $options = []) { $stream = new StringReader($string); $magic = self::readInt($stream, 'V'); if (($magic === self::MAGIC1) || ($magic === self::MAGIC3)) { //to make sure it works for 64-bit platforms $by...
[ "public", "static", "function", "fromString", "(", "$", "string", ",", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "stream", "=", "new", "StringReader", "(", "$", "string", ")", ";", "$", "magic", "=...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/Mo.php#L21-L102
oscarotero/Gettext
src/Utils/MultidimensionalArrayTrait.php
MultidimensionalArrayTrait.toArray
private static function toArray(Translations $translations, $includeHeaders, $forceArray = false) { $pluralForm = $translations->getPluralForms(); $pluralSize = is_array($pluralForm) ? ($pluralForm[0] - 1) : null; $messages = []; if ($includeHeaders) { $messages[''] = [ ...
php
private static function toArray(Translations $translations, $includeHeaders, $forceArray = false) { $pluralForm = $translations->getPluralForms(); $pluralSize = is_array($pluralForm) ? ($pluralForm[0] - 1) : null; $messages = []; if ($includeHeaders) { $messages[''] = [ ...
[ "private", "static", "function", "toArray", "(", "Translations", "$", "translations", ",", "$", "includeHeaders", ",", "$", "forceArray", "=", "false", ")", "{", "$", "pluralForm", "=", "$", "translations", "->", "getPluralForms", "(", ")", ";", "$", "plural...
Returns a multidimensional array. @param Translations $translations @param bool $includeHeaders @param bool $forceArray @return array
[ "Returns", "a", "multidimensional", "array", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/MultidimensionalArrayTrait.php#L25-L64
oscarotero/Gettext
src/Utils/MultidimensionalArrayTrait.php
MultidimensionalArrayTrait.fromArray
private static function fromArray(array $messages, Translations $translations) { if (!empty($messages['domain'])) { $translations->setDomain($messages['domain']); } if (!empty($messages['plural-forms'])) { $translations->setHeader(Translations::HEADER_PLURAL, $messag...
php
private static function fromArray(array $messages, Translations $translations) { if (!empty($messages['domain'])) { $translations->setDomain($messages['domain']); } if (!empty($messages['plural-forms'])) { $translations->setHeader(Translations::HEADER_PLURAL, $messag...
[ "private", "static", "function", "fromArray", "(", "array", "$", "messages", ",", "Translations", "$", "translations", ")", "{", "if", "(", "!", "empty", "(", "$", "messages", "[", "'domain'", "]", ")", ")", "{", "$", "translations", "->", "setDomain", "...
Extract the entries from a multidimensional array. @param array $messages @param Translations $translations
[ "Extract", "the", "entries", "from", "a", "multidimensional", "array", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Utils/MultidimensionalArrayTrait.php#L72-L99
oscarotero/Gettext
src/Translations.php
Translations.offsetSet
public function offsetSet($index, $value) { if (!($value instanceof Translation)) { throw new InvalidArgumentException( 'Only instances of Gettext\\Translation must be added to a Gettext\\Translations' ); } $id = $value->getId(); if ($this->o...
php
public function offsetSet($index, $value) { if (!($value instanceof Translation)) { throw new InvalidArgumentException( 'Only instances of Gettext\\Translation must be added to a Gettext\\Translations' ); } $id = $value->getId(); if ($this->o...
[ "public", "function", "offsetSet", "(", "$", "index", ",", "$", "value", ")", "{", "if", "(", "!", "(", "$", "value", "instanceof", "Translation", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Only instances of Gettext\\\\Translation must be ad...
Control the new translations added. @param mixed $index @param Translation $value @throws InvalidArgumentException If the value is not an instance of Gettext\Translation @return Translation
[ "Control", "the", "new", "translations", "added", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translations.php#L210-L229
oscarotero/Gettext
src/Translations.php
Translations.setPluralForms
public function setPluralForms($count, $rule) { if (preg_match('/[a-z]/i', str_replace('n', '', $rule))) { throw new \InvalidArgumentException('Invalid Plural form: ' . $rule); } $this->setHeader(self::HEADER_PLURAL, "nplurals={$count}; plural={$rule};"); return $this; ...
php
public function setPluralForms($count, $rule) { if (preg_match('/[a-z]/i', str_replace('n', '', $rule))) { throw new \InvalidArgumentException('Invalid Plural form: ' . $rule); } $this->setHeader(self::HEADER_PLURAL, "nplurals={$count}; plural={$rule};"); return $this; ...
[ "public", "function", "setPluralForms", "(", "$", "count", ",", "$", "rule", ")", "{", "if", "(", "preg_match", "(", "'/[a-z]/i'", ",", "str_replace", "(", "'n'", ",", "''", ",", "$", "rule", ")", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentEx...
Set the plural definition. @param int $count @param string $rule @return self
[ "Set", "the", "plural", "definition", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translations.php#L239-L247
oscarotero/Gettext
src/Translations.php
Translations.getPluralForms
public function getPluralForms() { $header = $this->getHeader(self::HEADER_PLURAL); if (!empty($header) && preg_match('/^nplurals\s*=\s*(\d+)\s*;\s*plural\s*=\s*([^;]+)\s*;$/', $header, $matches) ) { return [intval($matches[1]), $matches[2]]; } }
php
public function getPluralForms() { $header = $this->getHeader(self::HEADER_PLURAL); if (!empty($header) && preg_match('/^nplurals\s*=\s*(\d+)\s*;\s*plural\s*=\s*([^;]+)\s*;$/', $header, $matches) ) { return [intval($matches[1]), $matches[2]]; } }
[ "public", "function", "getPluralForms", "(", ")", "{", "$", "header", "=", "$", "this", "->", "getHeader", "(", "self", "::", "HEADER_PLURAL", ")", ";", "if", "(", "!", "empty", "(", "$", "header", ")", "&&", "preg_match", "(", "'/^nplurals\\s*=\\s*(\\d+)\...
Returns the parsed plural definition. @param null|array [count, rule]
[ "Returns", "the", "parsed", "plural", "definition", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translations.php#L254-L263
oscarotero/Gettext
src/Translations.php
Translations.setHeader
public function setHeader($name, $value) { $name = trim($name); $this->headers[$name] = trim($value); return $this; }
php
public function setHeader($name, $value) { $name = trim($name); $this->headers[$name] = trim($value); return $this; }
[ "public", "function", "setHeader", "(", "$", "name", ",", "$", "value", ")", "{", "$", "name", "=", "trim", "(", "$", "name", ")", ";", "$", "this", "->", "headers", "[", "$", "name", "]", "=", "trim", "(", "$", "value", ")", ";", "return", "$"...
Set a new header. @param string $name @param string $value @return self
[ "Set", "a", "new", "header", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translations.php#L273-L279
oscarotero/Gettext
src/Translations.php
Translations.find
public function find($context, $original = '') { if ($context instanceof Translation) { $id = $context->getId(); } else { $id = Translation::generateId($context, $original); } return $this->offsetExists($id) ? $this[$id] : false; }
php
public function find($context, $original = '') { if ($context instanceof Translation) { $id = $context->getId(); } else { $id = Translation::generateId($context, $original); } return $this->offsetExists($id) ? $this[$id] : false; }
[ "public", "function", "find", "(", "$", "context", ",", "$", "original", "=", "''", ")", "{", "if", "(", "$", "context", "instanceof", "Translation", ")", "{", "$", "id", "=", "$", "context", "->", "getId", "(", ")", ";", "}", "else", "{", "$", "...
Search for a specific translation. @param string|Translation $context The context of the translation or a translation instance @param string $original The original string @return Translation|false
[ "Search", "for", "a", "specific", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translations.php#L419-L428
oscarotero/Gettext
src/Translations.php
Translations.insert
public function insert($context, $original, $plural = '') { return $this->offsetSet(null, new Translation($context, $original, $plural)); }
php
public function insert($context, $original, $plural = '') { return $this->offsetSet(null, new Translation($context, $original, $plural)); }
[ "public", "function", "insert", "(", "$", "context", ",", "$", "original", ",", "$", "plural", "=", "''", ")", "{", "return", "$", "this", "->", "offsetSet", "(", "null", ",", "new", "Translation", "(", "$", "context", ",", "$", "original", ",", "$",...
Creates and insert/merges a new translation. @param string $context The translation context @param string $original The translation original string @param string $plural The translation original plural string @return Translation The translation created
[ "Creates", "and", "insert", "/", "merges", "a", "new", "translation", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translations.php#L453-L456
oscarotero/Gettext
src/Translations.php
Translations.mergeWith
public function mergeWith(Translations $translations, $options = Merge::DEFAULTS) { Merge::mergeHeaders($translations, $this, $options); Merge::mergeTranslations($translations, $this, $options); return $this; }
php
public function mergeWith(Translations $translations, $options = Merge::DEFAULTS) { Merge::mergeHeaders($translations, $this, $options); Merge::mergeTranslations($translations, $this, $options); return $this; }
[ "public", "function", "mergeWith", "(", "Translations", "$", "translations", ",", "$", "options", "=", "Merge", "::", "DEFAULTS", ")", "{", "Merge", "::", "mergeHeaders", "(", "$", "translations", ",", "$", "this", ",", "$", "options", ")", ";", "Merge", ...
Merges this translations with other translations. @param Translations $translations The translations instance to merge with @param int $options @return self
[ "Merges", "this", "translations", "with", "other", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Translations.php#L466-L472
oscarotero/Gettext
src/Merge.php
Merge.mergeFlags
public static function mergeFlags(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::FLAGS_THEIRS) { $to->deleteFlags(); } if (!($options & self::FLAGS_OURS)) { foreach ($from->getFlags() as $flag) { $to->addFlag($fl...
php
public static function mergeFlags(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::FLAGS_THEIRS) { $to->deleteFlags(); } if (!($options & self::FLAGS_OURS)) { foreach ($from->getFlags() as $flag) { $to->addFlag($fl...
[ "public", "static", "function", "mergeFlags", "(", "Translation", "$", "from", ",", "Translation", "$", "to", ",", "$", "options", "=", "self", "::", "DEFAULTS", ")", "{", "if", "(", "$", "options", "&", "self", "::", "FLAGS_THEIRS", ")", "{", "$", "to...
Merge the flags of two translations. @param Translation $from @param Translation $to @param int $options
[ "Merge", "the", "flags", "of", "two", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Merge.php#L42-L53
oscarotero/Gettext
src/Merge.php
Merge.mergeExtractedComments
public static function mergeExtractedComments(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::EXTRACTED_COMMENTS_THEIRS) { $to->deleteExtractedComments(); } if (!($options & self::EXTRACTED_COMMENTS_OURS)) { foreach ($from->getEx...
php
public static function mergeExtractedComments(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::EXTRACTED_COMMENTS_THEIRS) { $to->deleteExtractedComments(); } if (!($options & self::EXTRACTED_COMMENTS_OURS)) { foreach ($from->getEx...
[ "public", "static", "function", "mergeExtractedComments", "(", "Translation", "$", "from", ",", "Translation", "$", "to", ",", "$", "options", "=", "self", "::", "DEFAULTS", ")", "{", "if", "(", "$", "options", "&", "self", "::", "EXTRACTED_COMMENTS_THEIRS", ...
Merge the extracted comments of two translations. @param Translation $from @param Translation $to @param int $options
[ "Merge", "the", "extracted", "comments", "of", "two", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Merge.php#L62-L73
oscarotero/Gettext
src/Merge.php
Merge.mergeComments
public static function mergeComments(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::COMMENTS_THEIRS) { $to->deleteComments(); } if (!($options & self::COMMENTS_OURS)) { foreach ($from->getComments() as $comment) { ...
php
public static function mergeComments(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::COMMENTS_THEIRS) { $to->deleteComments(); } if (!($options & self::COMMENTS_OURS)) { foreach ($from->getComments() as $comment) { ...
[ "public", "static", "function", "mergeComments", "(", "Translation", "$", "from", ",", "Translation", "$", "to", ",", "$", "options", "=", "self", "::", "DEFAULTS", ")", "{", "if", "(", "$", "options", "&", "self", "::", "COMMENTS_THEIRS", ")", "{", "$",...
Merge the comments of two translations. @param Translation $from @param Translation $to @param int $options
[ "Merge", "the", "comments", "of", "two", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Merge.php#L82-L93
oscarotero/Gettext
src/Merge.php
Merge.mergeReferences
public static function mergeReferences(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::REFERENCES_THEIRS) { $to->deleteReferences(); } if (!($options & self::REFERENCES_OURS)) { foreach ($from->getReferences() as $reference) { ...
php
public static function mergeReferences(Translation $from, Translation $to, $options = self::DEFAULTS) { if ($options & self::REFERENCES_THEIRS) { $to->deleteReferences(); } if (!($options & self::REFERENCES_OURS)) { foreach ($from->getReferences() as $reference) { ...
[ "public", "static", "function", "mergeReferences", "(", "Translation", "$", "from", ",", "Translation", "$", "to", ",", "$", "options", "=", "self", "::", "DEFAULTS", ")", "{", "if", "(", "$", "options", "&", "self", "::", "REFERENCES_THEIRS", ")", "{", ...
Merge the references of two translations. @param Translation $from @param Translation $to @param int $options
[ "Merge", "the", "references", "of", "two", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Merge.php#L102-L113
oscarotero/Gettext
src/Merge.php
Merge.mergeTranslation
public static function mergeTranslation(Translation $from, Translation $to, $options = self::DEFAULTS) { $override = (boolean) ($options & self::TRANSLATION_OVERRIDE); if (!$to->hasTranslation() || ($from->hasTranslation() && $override)) { $to->setTranslation($from->getTranslation()); ...
php
public static function mergeTranslation(Translation $from, Translation $to, $options = self::DEFAULTS) { $override = (boolean) ($options & self::TRANSLATION_OVERRIDE); if (!$to->hasTranslation() || ($from->hasTranslation() && $override)) { $to->setTranslation($from->getTranslation()); ...
[ "public", "static", "function", "mergeTranslation", "(", "Translation", "$", "from", ",", "Translation", "$", "to", ",", "$", "options", "=", "self", "::", "DEFAULTS", ")", "{", "$", "override", "=", "(", "boolean", ")", "(", "$", "options", "&", "self",...
Merge the translations of two translations. @param Translation $from @param Translation $to @param int $options
[ "Merge", "the", "translations", "of", "two", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Merge.php#L122-L137
oscarotero/Gettext
src/Merge.php
Merge.mergeTranslations
public static function mergeTranslations(Translations $from, Translations $to, $options = self::DEFAULTS) { if ($options & self::REMOVE) { $filtered = []; foreach ($to as $entry) { if ($from->find($entry)) { $filtered[$entry->getId()] = $entry; ...
php
public static function mergeTranslations(Translations $from, Translations $to, $options = self::DEFAULTS) { if ($options & self::REMOVE) { $filtered = []; foreach ($to as $entry) { if ($from->find($entry)) { $filtered[$entry->getId()] = $entry; ...
[ "public", "static", "function", "mergeTranslations", "(", "Translations", "$", "from", ",", "Translations", "$", "to", ",", "$", "options", "=", "self", "::", "DEFAULTS", ")", "{", "if", "(", "$", "options", "&", "self", "::", "REMOVE", ")", "{", "$", ...
Merge the translations of two translations. @param Translations $from @param Translations $to @param int $options
[ "Merge", "the", "translations", "of", "two", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Merge.php#L146-L167
oscarotero/Gettext
src/Merge.php
Merge.mergeHeaders
public static function mergeHeaders(Translations $from, Translations $to, $options = self::DEFAULTS) { if ($options & self::HEADERS_REMOVE) { foreach (array_keys($to->getHeaders()) as $name) { if ($from->getHeader($name) === null) { $to->deleteHeader($name); ...
php
public static function mergeHeaders(Translations $from, Translations $to, $options = self::DEFAULTS) { if ($options & self::HEADERS_REMOVE) { foreach (array_keys($to->getHeaders()) as $name) { if ($from->getHeader($name) === null) { $to->deleteHeader($name); ...
[ "public", "static", "function", "mergeHeaders", "(", "Translations", "$", "from", ",", "Translations", "$", "to", ",", "$", "options", "=", "self", "::", "DEFAULTS", ")", "{", "if", "(", "$", "options", "&", "self", "::", "HEADERS_REMOVE", ")", "{", "for...
Merge the headers of two translations. @param Translations $from @param Translations $to @param int $options
[ "Merge", "the", "headers", "of", "two", "translations", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Merge.php#L176-L220
oscarotero/Gettext
src/Extractors/Blade.php
Blade.fromString
public static function fromString($string, Translations $translations, array $options = []) { if (empty($options['facade'])) { $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath']; $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath); ...
php
public static function fromString($string, Translations $translations, array $options = []) { if (empty($options['facade'])) { $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath']; $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath); ...
[ "public", "static", "function", "fromString", "(", "$", "string", ",", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "options", "[", "'facade'", "]", ")", ")", "{", "$", "cac...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/Blade.php#L17-L28
oscarotero/Gettext
src/Extractors/PhpCode.php
PhpCode.fromString
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $functions = new PhpFunctionsScanner($string); if ($options['extractComments'] !== false) { $functions->enableCommentsExtraction($options['extractComments...
php
public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $functions = new PhpFunctionsScanner($string); if ($options['extractComments'] !== false) { $functions->enableCommentsExtraction($options['extractComments...
[ "public", "static", "function", "fromString", "(", "$", "string", ",", "Translations", "$", "translations", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "+=", "static", "::", "$", "options", ";", "$", "functions", "=", "new", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/PhpCode.php#L47-L58
oscarotero/Gettext
src/Extractors/PhpCode.php
PhpCode.convertString
public static function convertString($value) { if (strpos($value, '\\') === false) { return substr($value, 1, -1); } if ($value[0] === "'") { return strtr(substr($value, 1, -1), ['\\\\' => '\\', '\\\'' => '\'']); } $value = substr($value, 1, -1); ...
php
public static function convertString($value) { if (strpos($value, '\\') === false) { return substr($value, 1, -1); } if ($value[0] === "'") { return strtr(substr($value, 1, -1), ['\\\\' => '\\', '\\\'' => '\'']); } $value = substr($value, 1, -1); ...
[ "public", "static", "function", "convertString", "(", "$", "value", ")", "{", "if", "(", "strpos", "(", "$", "value", ",", "'\\\\'", ")", "===", "false", ")", "{", "return", "substr", "(", "$", "value", ",", "1", ",", "-", "1", ")", ";", "}", "if...
Decodes a T_CONSTANT_ENCAPSED_STRING string. @param string $value @return string
[ "Decodes", "a", "T_CONSTANT_ENCAPSED_STRING", "string", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/PhpCode.php#L67-L111
oscarotero/Gettext
src/Extractors/PhpCode.php
PhpCode.unicodeChar
private static function unicodeChar($dec) { if ($dec < 0x80) { return chr($dec); } if ($dec < 0x0800) { return chr(0xC0 + ($dec >> 6)) .chr(0x80 + ($dec & 0x3f)); } if ($dec < 0x010000) { return chr(0xE0 + ($dec >> 12)) ...
php
private static function unicodeChar($dec) { if ($dec < 0x80) { return chr($dec); } if ($dec < 0x0800) { return chr(0xC0 + ($dec >> 6)) .chr(0x80 + ($dec & 0x3f)); } if ($dec < 0x010000) { return chr(0xE0 + ($dec >> 12)) ...
[ "private", "static", "function", "unicodeChar", "(", "$", "dec", ")", "{", "if", "(", "$", "dec", "<", "0x80", ")", "{", "return", "chr", "(", "$", "dec", ")", ";", "}", "if", "(", "$", "dec", "<", "0x0800", ")", "{", "return", "chr", "(", "0xC...
http://php.net/manual/en/function.chr.php#118804
[ "http", ":", "//", "php", ".", "net", "/", "manual", "/", "en", "/", "function", ".", "chr", ".", "php#118804" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/Extractors/PhpCode.php#L114-L137
oscarotero/Gettext
src/GettextTranslator.php
GettextTranslator.setLanguage
public function setLanguage($language, $category = null) { if ($category === null) { $category = defined('LC_MESSAGES') ? LC_MESSAGES : LC_ALL; } setlocale($category, $language); putenv('LANGUAGE='.$language); return $this; }
php
public function setLanguage($language, $category = null) { if ($category === null) { $category = defined('LC_MESSAGES') ? LC_MESSAGES : LC_ALL; } setlocale($category, $language); putenv('LANGUAGE='.$language); return $this; }
[ "public", "function", "setLanguage", "(", "$", "language", ",", "$", "category", "=", "null", ")", "{", "if", "(", "$", "category", "===", "null", ")", "{", "$", "category", "=", "defined", "(", "'LC_MESSAGES'", ")", "?", "LC_MESSAGES", ":", "LC_ALL", ...
Define the current locale. @param string $language @param int|null $category @return self
[ "Define", "the", "current", "locale", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/GettextTranslator.php#L37-L47
oscarotero/Gettext
src/GettextTranslator.php
GettextTranslator.loadDomain
public function loadDomain($domain, $path = null, $default = true) { bindtextdomain($domain, $path); bind_textdomain_codeset($domain, 'UTF-8'); if ($default) { textdomain($domain); } return $this; }
php
public function loadDomain($domain, $path = null, $default = true) { bindtextdomain($domain, $path); bind_textdomain_codeset($domain, 'UTF-8'); if ($default) { textdomain($domain); } return $this; }
[ "public", "function", "loadDomain", "(", "$", "domain", ",", "$", "path", "=", "null", ",", "$", "default", "=", "true", ")", "{", "bindtextdomain", "(", "$", "domain", ",", "$", "path", ")", ";", "bind_textdomain_codeset", "(", "$", "domain", ",", "'U...
Loads a gettext domain. @param string $domain @param string $path @param bool $default @return self
[ "Loads", "a", "gettext", "domain", "." ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/GettextTranslator.php#L58-L68
oscarotero/Gettext
src/GettextTranslator.php
GettextTranslator.npgettext
public function npgettext($context, $original, $plural, $value) { $message = $context."\x04".$original; $translation = ngettext($message, $plural, $value); return ($translation === $message) ? $original : $translation; }
php
public function npgettext($context, $original, $plural, $value) { $message = $context."\x04".$original; $translation = ngettext($message, $plural, $value); return ($translation === $message) ? $original : $translation; }
[ "public", "function", "npgettext", "(", "$", "context", ",", "$", "original", ",", "$", "plural", ",", "$", "value", ")", "{", "$", "message", "=", "$", "context", ".", "\"\\x04\"", ".", "$", "original", ";", "$", "translation", "=", "ngettext", "(", ...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/GettextTranslator.php#L105-L111
oscarotero/Gettext
src/GettextTranslator.php
GettextTranslator.pgettext
public function pgettext($context, $original) { $message = $context."\x04".$original; $translation = gettext($message); return ($translation === $message) ? $original : $translation; }
php
public function pgettext($context, $original) { $message = $context."\x04".$original; $translation = gettext($message); return ($translation === $message) ? $original : $translation; }
[ "public", "function", "pgettext", "(", "$", "context", ",", "$", "original", ")", "{", "$", "message", "=", "$", "context", ".", "\"\\x04\"", ".", "$", "original", ";", "$", "translation", "=", "gettext", "(", "$", "message", ")", ";", "return", "(", ...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/GettextTranslator.php#L118-L124
oscarotero/Gettext
src/GettextTranslator.php
GettextTranslator.dpgettext
public function dpgettext($domain, $context, $original) { $message = $context."\x04".$original; $translation = dgettext($domain, $message); return ($translation === $message) ? $original : $translation; }
php
public function dpgettext($domain, $context, $original) { $message = $context."\x04".$original; $translation = dgettext($domain, $message); return ($translation === $message) ? $original : $translation; }
[ "public", "function", "dpgettext", "(", "$", "domain", ",", "$", "context", ",", "$", "original", ")", "{", "$", "message", "=", "$", "context", ".", "\"\\x04\"", ".", "$", "original", ";", "$", "translation", "=", "dgettext", "(", "$", "domain", ",", ...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/GettextTranslator.php#L141-L147
oscarotero/Gettext
src/GettextTranslator.php
GettextTranslator.dnpgettext
public function dnpgettext($domain, $context, $original, $plural, $value) { $message = $context."\x04".$original; $translation = dngettext($domain, $message, $plural, $value); return ($translation === $message) ? $original : $translation; }
php
public function dnpgettext($domain, $context, $original, $plural, $value) { $message = $context."\x04".$original; $translation = dngettext($domain, $message, $plural, $value); return ($translation === $message) ? $original : $translation; }
[ "public", "function", "dnpgettext", "(", "$", "domain", ",", "$", "context", ",", "$", "original", ",", "$", "plural", ",", "$", "value", ")", "{", "$", "message", "=", "$", "context", ".", "\"\\x04\"", ".", "$", "original", ";", "$", "translation", ...
@see TranslatorInterface {@inheritdoc}
[ "@see", "TranslatorInterface" ]
train
https://github.com/oscarotero/Gettext/blob/2a3fe4b5b22c6a73099b7ac074713ae471258ebe/src/GettextTranslator.php#L154-L160
doctrine/persistence
lib/Doctrine/Persistence/ObjectManagerDecorator.php
ObjectManagerDecorator.find
public function find(string $className, $id) : ?object { return $this->wrapped->find($className, $id); }
php
public function find(string $className, $id) : ?object { return $this->wrapped->find($className, $id); }
[ "public", "function", "find", "(", "string", "$", "className", ",", "$", "id", ")", ":", "?", "object", "{", "return", "$", "this", "->", "wrapped", "->", "find", "(", "$", "className", ",", "$", "id", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/ObjectManagerDecorator.php#L21-L24
doctrine/persistence
lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php
AbstractClassMetadataFactory.getMetadataFor
public function getMetadataFor(string $className) : ClassMetadata { if (isset($this->loadedMetadata[$className])) { return $this->loadedMetadata[$className]; } // Check for namespace alias if (strpos($className, ':') !== false) { [$namespaceAlias, $simpleClas...
php
public function getMetadataFor(string $className) : ClassMetadata { if (isset($this->loadedMetadata[$className])) { return $this->loadedMetadata[$className]; } // Check for namespace alias if (strpos($className, ':') !== false) { [$namespaceAlias, $simpleClas...
[ "public", "function", "getMetadataFor", "(", "string", "$", "className", ")", ":", "ClassMetadata", "{", "if", "(", "isset", "(", "$", "this", "->", "loadedMetadata", "[", "$", "className", "]", ")", ")", "{", "return", "$", "this", "->", "loadedMetadata",...
Gets the class metadata descriptor for a class. @param string $className The name of the class. @throws ReflectionException @throws MappingException
[ "Gets", "the", "class", "metadata", "descriptor", "for", "a", "class", "." ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php#L143-L200
doctrine/persistence
lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php
AbstractClassMetadataFactory.getParentClasses
protected function getParentClasses(string $name) : array { // Collect parent classes, ignoring transient (not-mapped) classes. $parentClasses = []; $parentClasses = $this->getReflectionService() ->getParentClasses($name); foreach (array_reverse($parentClasses) as $pare...
php
protected function getParentClasses(string $name) : array { // Collect parent classes, ignoring transient (not-mapped) classes. $parentClasses = []; $parentClasses = $this->getReflectionService() ->getParentClasses($name); foreach (array_reverse($parentClasses) as $pare...
[ "protected", "function", "getParentClasses", "(", "string", "$", "name", ")", ":", "array", "{", "// Collect parent classes, ignoring transient (not-mapped) classes.", "$", "parentClasses", "=", "[", "]", ";", "$", "parentClasses", "=", "$", "this", "->", "getReflecti...
Gets an array of parent classes for the given entity class. @return array<int, string>
[ "Gets", "an", "array", "of", "parent", "classes", "for", "the", "given", "entity", "class", "." ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php#L227-L244
doctrine/persistence
lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php
AbstractClassMetadataFactory.loadMetadata
protected function loadMetadata(string $name) : array { if (! $this->initialized) { $this->initialize(); } $loaded = []; $parentClasses = $this->getParentClasses($name); $parentClasses[] = $name; // Move down the hierarchy of parent classes, starting ...
php
protected function loadMetadata(string $name) : array { if (! $this->initialized) { $this->initialize(); } $loaded = []; $parentClasses = $this->getParentClasses($name); $parentClasses[] = $name; // Move down the hierarchy of parent classes, starting ...
[ "protected", "function", "loadMetadata", "(", "string", "$", "name", ")", ":", "array", "{", "if", "(", "!", "$", "this", "->", "initialized", ")", "{", "$", "this", "->", "initialize", "(", ")", ";", "}", "$", "loaded", "=", "[", "]", ";", "$", ...
Loads the metadata of the class in question and all it's ancestors whose metadata is still not loaded. Important: The class $name does not necessarily exist at this point here. Scenarios in a code-generation setup might have access to XML/YAML Mapping files without the actual PHP code existing here. That is why the {@...
[ "Loads", "the", "metadata", "of", "the", "class", "in", "question", "and", "all", "it", "s", "ancestors", "whose", "metadata", "is", "still", "not", "loaded", "." ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php#L260-L311
doctrine/persistence
lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php
AbstractClassMetadataFactory.isTransient
public function isTransient(string $class) : bool { if (! $this->initialized) { $this->initialize(); } // Check for namespace alias if (strpos($class, ':') !== false) { [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); $class = $this...
php
public function isTransient(string $class) : bool { if (! $this->initialized) { $this->initialize(); } // Check for namespace alias if (strpos($class, ':') !== false) { [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); $class = $this...
[ "public", "function", "isTransient", "(", "string", "$", "class", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "initialized", ")", "{", "$", "this", "->", "initialize", "(", ")", ";", "}", "// Check for namespace alias", "if", "(", "strpos",...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php#L343-L357
doctrine/persistence
lib/Doctrine/Persistence/Mapping/RuntimeReflectionService.php
RuntimeReflectionService.getAccessibleProperty
public function getAccessibleProperty(string $class, string $property) : ?ReflectionProperty { $reflectionProperty = new ReflectionProperty($class, $property); if ($reflectionProperty->isPublic()) { $reflectionProperty = new RuntimePublicReflectionProperty($class, $property); } ...
php
public function getAccessibleProperty(string $class, string $property) : ?ReflectionProperty { $reflectionProperty = new ReflectionProperty($class, $property); if ($reflectionProperty->isPublic()) { $reflectionProperty = new RuntimePublicReflectionProperty($class, $property); } ...
[ "public", "function", "getAccessibleProperty", "(", "string", "$", "class", ",", "string", "$", "property", ")", ":", "?", "ReflectionProperty", "{", "$", "reflectionProperty", "=", "new", "ReflectionProperty", "(", "$", "class", ",", "$", "property", ")", ";"...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/RuntimeReflectionService.php#L63-L74
doctrine/persistence
lib/Doctrine/Persistence/Mapping/RuntimeReflectionService.php
RuntimeReflectionService.hasPublicMethod
public function hasPublicMethod(string $class, string $method) : bool { try { $reflectionMethod = new ReflectionMethod($class, $method); } catch (ReflectionException $e) { return false; } return $reflectionMethod->isPublic(); }
php
public function hasPublicMethod(string $class, string $method) : bool { try { $reflectionMethod = new ReflectionMethod($class, $method); } catch (ReflectionException $e) { return false; } return $reflectionMethod->isPublic(); }
[ "public", "function", "hasPublicMethod", "(", "string", "$", "class", ",", "string", "$", "method", ")", ":", "bool", "{", "try", "{", "$", "reflectionMethod", "=", "new", "ReflectionMethod", "(", "$", "class", ",", "$", "method", ")", ";", "}", "catch",...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/RuntimeReflectionService.php#L79-L88
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/DefaultFileLocator.php
DefaultFileLocator.findMappingFile
public function findMappingFile(string $className) : string { $fileName = str_replace('\\', '.', $className) . $this->fileExtension; // Check whether file exists foreach ($this->paths as $path) { if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return $pat...
php
public function findMappingFile(string $className) : string { $fileName = str_replace('\\', '.', $className) . $this->fileExtension; // Check whether file exists foreach ($this->paths as $path) { if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return $pat...
[ "public", "function", "findMappingFile", "(", "string", "$", "className", ")", ":", "string", "{", "$", "fileName", "=", "str_replace", "(", "'\\\\'", ",", "'.'", ",", "$", "className", ")", ".", "$", "this", "->", "fileExtension", ";", "// Check whether fil...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/DefaultFileLocator.php#L97-L109
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/DefaultFileLocator.php
DefaultFileLocator.getAllClassNames
public function getAllClassNames(string $globalBasename) : array { if ($this->paths === []) { return []; } $classes = []; foreach ($this->paths as $path) { if (! is_dir($path)) { throw MappingException::fileMappingDriversRequireConfiguredDire...
php
public function getAllClassNames(string $globalBasename) : array { if ($this->paths === []) { return []; } $classes = []; foreach ($this->paths as $path) { if (! is_dir($path)) { throw MappingException::fileMappingDriversRequireConfiguredDire...
[ "public", "function", "getAllClassNames", "(", "string", "$", "globalBasename", ")", ":", "array", "{", "if", "(", "$", "this", "->", "paths", "===", "[", "]", ")", "{", "return", "[", "]", ";", "}", "$", "classes", "=", "[", "]", ";", "foreach", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/DefaultFileLocator.php#L114-L149
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/DefaultFileLocator.php
DefaultFileLocator.fileExists
public function fileExists(string $className) : bool { $fileName = str_replace('\\', '.', $className) . $this->fileExtension; // Check whether file exists foreach ($this->paths as $path) { if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return true; ...
php
public function fileExists(string $className) : bool { $fileName = str_replace('\\', '.', $className) . $this->fileExtension; // Check whether file exists foreach ($this->paths as $path) { if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return true; ...
[ "public", "function", "fileExists", "(", "string", "$", "className", ")", ":", "bool", "{", "$", "fileName", "=", "str_replace", "(", "'\\\\'", ",", "'.'", ",", "$", "className", ")", ".", "$", "this", "->", "fileExtension", ";", "// Check whether file exist...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/DefaultFileLocator.php#L154-L166
doctrine/persistence
lib/Doctrine/Persistence/Mapping/StaticReflectionService.php
StaticReflectionService.getClassShortName
public function getClassShortName(string $className) : string { if (strpos($className, '\\') !== false) { /** @var int $pos */ $pos = strrpos($className, '\\'); $className = substr($className, $pos + 1); } return $className; }
php
public function getClassShortName(string $className) : string { if (strpos($className, '\\') !== false) { /** @var int $pos */ $pos = strrpos($className, '\\'); $className = substr($className, $pos + 1); } return $className; }
[ "public", "function", "getClassShortName", "(", "string", "$", "className", ")", ":", "string", "{", "if", "(", "strpos", "(", "$", "className", ",", "'\\\\'", ")", "!==", "false", ")", "{", "/** @var int $pos */", "$", "pos", "=", "strrpos", "(", "$", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/StaticReflectionService.php#L30-L40
doctrine/persistence
lib/Doctrine/Persistence/Mapping/StaticReflectionService.php
StaticReflectionService.getClassNamespace
public function getClassNamespace(string $className) : string { $namespace = ''; if (strpos($className, '\\') !== false) { /** @var int $pos */ $pos = strpos(strrev($className), '\\'); $namespace = strrev(substr(strrev($className), $pos + 1)); } ...
php
public function getClassNamespace(string $className) : string { $namespace = ''; if (strpos($className, '\\') !== false) { /** @var int $pos */ $pos = strpos(strrev($className), '\\'); $namespace = strrev(substr(strrev($className), $pos + 1)); } ...
[ "public", "function", "getClassNamespace", "(", "string", "$", "className", ")", ":", "string", "{", "$", "namespace", "=", "''", ";", "if", "(", "strpos", "(", "$", "className", ",", "'\\\\'", ")", "!==", "false", ")", "{", "/** @var int $pos */", "$", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/StaticReflectionService.php#L45-L57
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php
SymfonyFileLocator.addNamespacePrefixes
public function addNamespacePrefixes(array $prefixes) : void { $this->prefixes = array_merge($this->prefixes, $prefixes); $this->paths = array_merge($this->paths, array_keys($prefixes)); }
php
public function addNamespacePrefixes(array $prefixes) : void { $this->prefixes = array_merge($this->prefixes, $prefixes); $this->paths = array_merge($this->paths, array_keys($prefixes)); }
[ "public", "function", "addNamespacePrefixes", "(", "array", "$", "prefixes", ")", ":", "void", "{", "$", "this", "->", "prefixes", "=", "array_merge", "(", "$", "this", "->", "prefixes", ",", "$", "prefixes", ")", ";", "$", "this", "->", "paths", "=", ...
Adds Namespace Prefixes. @param array<string, string> $prefixes
[ "Adds", "Namespace", "Prefixes", "." ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php#L86-L90
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php
SymfonyFileLocator.fileExists
public function fileExists(string $className) : bool { $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; foreach ($this->paths as $path) { if (! isset($this->prefixes[$path])) { // global namespace class if (is_f...
php
public function fileExists(string $className) : bool { $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; foreach ($this->paths as $path) { if (! isset($this->prefixes[$path])) { // global namespace class if (is_f...
[ "public", "function", "fileExists", "(", "string", "$", "className", ")", ":", "bool", "{", "$", "defaultFileName", "=", "str_replace", "(", "'\\\\'", ",", "$", "this", "->", "nsSeparator", ",", "$", "className", ")", ".", "$", "this", "->", "fileExtension...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php#L131-L159
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php
SymfonyFileLocator.getAllClassNames
public function getAllClassNames(string $globalBasename) : array { if ($this->paths === []) { return []; } $classes = []; foreach ($this->paths as $path) { if (! is_dir($path)) { throw MappingException::fileMappingDriversRequireConfiguredDire...
php
public function getAllClassNames(string $globalBasename) : array { if ($this->paths === []) { return []; } $classes = []; foreach ($this->paths as $path) { if (! is_dir($path)) { throw MappingException::fileMappingDriversRequireConfiguredDire...
[ "public", "function", "getAllClassNames", "(", "string", "$", "globalBasename", ")", ":", "array", "{", "if", "(", "$", "this", "->", "paths", "===", "[", "]", ")", "{", "return", "[", "]", ";", "}", "$", "classes", "=", "[", "]", ";", "foreach", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php#L164-L209
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php
SymfonyFileLocator.findMappingFile
public function findMappingFile(string $className) : string { $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; foreach ($this->paths as $path) { if (! isset($this->prefixes[$path])) { if (is_file($path . DIRECTORY_SEPARATOR . $d...
php
public function findMappingFile(string $className) : string { $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; foreach ($this->paths as $path) { if (! isset($this->prefixes[$path])) { if (is_file($path . DIRECTORY_SEPARATOR . $d...
[ "public", "function", "findMappingFile", "(", "string", "$", "className", ")", ":", "string", "{", "$", "defaultFileName", "=", "str_replace", "(", "'\\\\'", ",", "$", "this", "->", "nsSeparator", ",", "$", "className", ")", ".", "$", "this", "->", "fileEx...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/SymfonyFileLocator.php#L214-L245
doctrine/persistence
lib/Doctrine/Persistence/AbstractManagerRegistry.php
AbstractManagerRegistry.getConnection
public function getConnection(?string $name = null) : object { if ($name === null) { $name = $this->defaultConnection; } if (! isset($this->connections[$name])) { throw new InvalidArgumentException( sprintf('Doctrine %s Connection named "%s" does not ...
php
public function getConnection(?string $name = null) : object { if ($name === null) { $name = $this->defaultConnection; } if (! isset($this->connections[$name])) { throw new InvalidArgumentException( sprintf('Doctrine %s Connection named "%s" does not ...
[ "public", "function", "getConnection", "(", "?", "string", "$", "name", "=", "null", ")", ":", "object", "{", "if", "(", "$", "name", "===", "null", ")", "{", "$", "name", "=", "$", "this", "->", "defaultConnection", ";", "}", "if", "(", "!", "isse...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L87-L100
doctrine/persistence
lib/Doctrine/Persistence/AbstractManagerRegistry.php
AbstractManagerRegistry.getConnections
public function getConnections() : array { $connections = []; foreach ($this->connections as $name => $id) { $connections[$name] = $this->getService($id); } return $connections; }
php
public function getConnections() : array { $connections = []; foreach ($this->connections as $name => $id) { $connections[$name] = $this->getService($id); } return $connections; }
[ "public", "function", "getConnections", "(", ")", ":", "array", "{", "$", "connections", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "connections", "as", "$", "name", "=>", "$", "id", ")", "{", "$", "connections", "[", "$", "name", "]", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L113-L121
doctrine/persistence
lib/Doctrine/Persistence/AbstractManagerRegistry.php
AbstractManagerRegistry.getManager
public function getManager(?string $name = null) : ObjectManager { if ($name === null) { $name = $this->defaultManager; } if (! isset($this->managers[$name])) { throw new InvalidArgumentException( sprintf('Doctrine %s Manager named "%s" does not exist...
php
public function getManager(?string $name = null) : ObjectManager { if ($name === null) { $name = $this->defaultManager; } if (! isset($this->managers[$name])) { throw new InvalidArgumentException( sprintf('Doctrine %s Manager named "%s" does not exist...
[ "public", "function", "getManager", "(", "?", "string", "$", "name", "=", "null", ")", ":", "ObjectManager", "{", "if", "(", "$", "name", "===", "null", ")", "{", "$", "name", "=", "$", "this", "->", "defaultManager", ";", "}", "if", "(", "!", "iss...
{@inheritdoc} @throws InvalidArgumentException
[ "{", "@inheritdoc", "}" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L144-L160
doctrine/persistence
lib/Doctrine/Persistence/AbstractManagerRegistry.php
AbstractManagerRegistry.getManagerForClass
public function getManagerForClass(string $class) : ?ObjectManager { // Check for namespace alias if (strpos($class, ':') !== false) { [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;...
php
public function getManagerForClass(string $class) : ?ObjectManager { // Check for namespace alias if (strpos($class, ':') !== false) { [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;...
[ "public", "function", "getManagerForClass", "(", "string", "$", "class", ")", ":", "?", "ObjectManager", "{", "// Check for namespace alias", "if", "(", "strpos", "(", "$", "class", ",", "':'", ")", "!==", "false", ")", "{", "[", "$", "namespaceAlias", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L165-L196
doctrine/persistence
lib/Doctrine/Persistence/AbstractManagerRegistry.php
AbstractManagerRegistry.getManagers
public function getManagers() : array { $managers = []; foreach ($this->managers as $name => $id) { /** @var ObjectManager $manager */ $manager = $this->getService($id); $managers[$name] = $manager; } return $managers; }
php
public function getManagers() : array { $managers = []; foreach ($this->managers as $name => $id) { /** @var ObjectManager $manager */ $manager = $this->getService($id); $managers[$name] = $manager; } return $managers; }
[ "public", "function", "getManagers", "(", ")", ":", "array", "{", "$", "managers", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "managers", "as", "$", "name", "=>", "$", "id", ")", "{", "/** @var ObjectManager $manager */", "$", "manager", "=",...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L209-L221
doctrine/persistence
lib/Doctrine/Persistence/AbstractManagerRegistry.php
AbstractManagerRegistry.getRepository
public function getRepository( string $persistentObjectName, ?string $persistentManagerName = null ) : ObjectRepository { return $this ->selectManager($persistentObjectName, $persistentManagerName) ->getRepository($persistentObjectName); }
php
public function getRepository( string $persistentObjectName, ?string $persistentManagerName = null ) : ObjectRepository { return $this ->selectManager($persistentObjectName, $persistentManagerName) ->getRepository($persistentObjectName); }
[ "public", "function", "getRepository", "(", "string", "$", "persistentObjectName", ",", "?", "string", "$", "persistentManagerName", "=", "null", ")", ":", "ObjectRepository", "{", "return", "$", "this", "->", "selectManager", "(", "$", "persistentObjectName", ","...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L226-L233
doctrine/persistence
lib/Doctrine/Persistence/AbstractManagerRegistry.php
AbstractManagerRegistry.resetManager
public function resetManager(?string $name = null) : ObjectManager { if ($name === null) { $name = $this->defaultManager; } if (! isset($this->managers[$name])) { throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name...
php
public function resetManager(?string $name = null) : ObjectManager { if ($name === null) { $name = $this->defaultManager; } if (! isset($this->managers[$name])) { throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name...
[ "public", "function", "resetManager", "(", "?", "string", "$", "name", "=", "null", ")", ":", "ObjectManager", "{", "if", "(", "$", "name", "===", "null", ")", "{", "$", "name", "=", "$", "this", "->", "defaultManager", ";", "}", "if", "(", "!", "i...
{@inheritdoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/AbstractManagerRegistry.php#L238-L253
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/PHPDriver.php
PHPDriver.loadMetadataForClass
public function loadMetadataForClass(string $className, ClassMetadata $metadata) : void { $this->metadata = $metadata; $this->loadMappingFile($this->locator->findMappingFile($className)); }
php
public function loadMetadataForClass(string $className, ClassMetadata $metadata) : void { $this->metadata = $metadata; $this->loadMappingFile($this->locator->findMappingFile($className)); }
[ "public", "function", "loadMetadataForClass", "(", "string", "$", "className", ",", "ClassMetadata", "$", "metadata", ")", ":", "void", "{", "$", "this", "->", "metadata", "=", "$", "metadata", ";", "$", "this", "->", "loadMappingFile", "(", "$", "this", "...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/PHPDriver.php#L29-L34
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/PHPDriver.php
PHPDriver.loadMappingFile
protected function loadMappingFile(string $file) : array { $metadata = $this->metadata; include $file; return [$metadata->getName() => $metadata]; }
php
protected function loadMappingFile(string $file) : array { $metadata = $this->metadata; include $file; return [$metadata->getName() => $metadata]; }
[ "protected", "function", "loadMappingFile", "(", "string", "$", "file", ")", ":", "array", "{", "$", "metadata", "=", "$", "this", "->", "metadata", ";", "include", "$", "file", ";", "return", "[", "$", "metadata", "->", "getName", "(", ")", "=>", "$",...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/PHPDriver.php#L39-L45
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/MappingDriverChain.php
MappingDriverChain.loadMetadataForClass
public function loadMetadataForClass(string $className, ClassMetadata $metadata) : void { /** @var MappingDriver $driver */ foreach ($this->drivers as $namespace => $driver) { if (strpos($className, $namespace) === 0) { $driver->loadMetadataForClass($className, $metadata)...
php
public function loadMetadataForClass(string $className, ClassMetadata $metadata) : void { /** @var MappingDriver $driver */ foreach ($this->drivers as $namespace => $driver) { if (strpos($className, $namespace) === 0) { $driver->loadMetadataForClass($className, $metadata)...
[ "public", "function", "loadMetadataForClass", "(", "string", "$", "className", ",", "ClassMetadata", "$", "metadata", ")", ":", "void", "{", "/** @var MappingDriver $driver */", "foreach", "(", "$", "this", "->", "drivers", "as", "$", "namespace", "=>", "$", "dr...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/MappingDriverChain.php#L66-L84
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/MappingDriverChain.php
MappingDriverChain.isTransient
public function isTransient(string $className) : bool { /** @var MappingDriver $driver */ foreach ($this->drivers as $namespace => $driver) { if (strpos($className, $namespace) === 0) { return $driver->isTransient($className); } } if ($this->d...
php
public function isTransient(string $className) : bool { /** @var MappingDriver $driver */ foreach ($this->drivers as $namespace => $driver) { if (strpos($className, $namespace) === 0) { return $driver->isTransient($className); } } if ($this->d...
[ "public", "function", "isTransient", "(", "string", "$", "className", ")", ":", "bool", "{", "/** @var MappingDriver $driver */", "foreach", "(", "$", "this", "->", "drivers", "as", "$", "namespace", "=>", "$", "driver", ")", "{", "if", "(", "strpos", "(", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/MappingDriverChain.php#L123-L137
doctrine/persistence
lib/Doctrine/Persistence/Mapping/Driver/AnnotationDriver.php
AnnotationDriver.addExcludePaths
public function addExcludePaths(array $paths) : void { $this->excludePaths = array_unique(array_merge($this->excludePaths, $paths)); }
php
public function addExcludePaths(array $paths) : void { $this->excludePaths = array_unique(array_merge($this->excludePaths, $paths)); }
[ "public", "function", "addExcludePaths", "(", "array", "$", "paths", ")", ":", "void", "{", "$", "this", "->", "excludePaths", "=", "array_unique", "(", "array_merge", "(", "$", "this", "->", "excludePaths", ",", "$", "paths", ")", ")", ";", "}" ]
Append exclude lookup paths to metadata driver. @param array<int, string> $paths
[ "Append", "exclude", "lookup", "paths", "to", "metadata", "driver", "." ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Mapping/Driver/AnnotationDriver.php#L124-L127
doctrine/persistence
lib/Doctrine/Persistence/Event/PreUpdateEventArgs.php
PreUpdateEventArgs.setNewValue
public function setNewValue(string $field, $value) : void { $this->assertValidField($field); $this->entityChangeSet[$field][1] = $value; }
php
public function setNewValue(string $field, $value) : void { $this->assertValidField($field); $this->entityChangeSet[$field][1] = $value; }
[ "public", "function", "setNewValue", "(", "string", "$", "field", ",", "$", "value", ")", ":", "void", "{", "$", "this", "->", "assertValidField", "(", "$", "field", ")", ";", "$", "this", "->", "entityChangeSet", "[", "$", "field", "]", "[", "1", "]...
Sets the new value of this field. @param mixed $value
[ "Sets", "the", "new", "value", "of", "this", "field", "." ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Event/PreUpdateEventArgs.php#L77-L82
doctrine/persistence
lib/Doctrine/Persistence/Event/PreUpdateEventArgs.php
PreUpdateEventArgs.assertValidField
private function assertValidField(string $field) : void { if (! isset($this->entityChangeSet[$field])) { throw new InvalidArgumentException(sprintf( 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', $field, get_class($thi...
php
private function assertValidField(string $field) : void { if (! isset($this->entityChangeSet[$field])) { throw new InvalidArgumentException(sprintf( 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', $field, get_class($thi...
[ "private", "function", "assertValidField", "(", "string", "$", "field", ")", ":", "void", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "entityChangeSet", "[", "$", "field", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sp...
Asserts the field exists in changeset. @throws InvalidArgumentException
[ "Asserts", "the", "field", "exists", "in", "changeset", "." ]
train
https://github.com/doctrine/persistence/blob/fc953e7e92d73bf864f4e0f5c25dea6eb23901d4/lib/Doctrine/Persistence/Event/PreUpdateEventArgs.php#L89-L98
aelvan/Imager-Craft
src/services/ImagerService.php
ImagerService.detectImageDriver
public static function detectImageDriver() { $extension = mb_strtolower(Craft::$app->getConfig()->getGeneral()->imageDriver); if ($extension === 'gd') { self::$imageDriver = 'gd'; } else if ($extension === 'imagick') { self::$imageDriver = 'imagick'; } else {...
php
public static function detectImageDriver() { $extension = mb_strtolower(Craft::$app->getConfig()->getGeneral()->imageDriver); if ($extension === 'gd') { self::$imageDriver = 'gd'; } else if ($extension === 'imagick') { self::$imageDriver = 'imagick'; } else {...
[ "public", "static", "function", "detectImageDriver", "(", ")", "{", "$", "extension", "=", "mb_strtolower", "(", "Craft", "::", "$", "app", "->", "getConfig", "(", ")", "->", "getGeneral", "(", ")", "->", "imageDriver", ")", ";", "if", "(", "$", "extensi...
Detects which image driver to use
[ "Detects", "which", "image", "driver", "to", "use" ]
train
https://github.com/aelvan/Imager-Craft/blob/f7e80a3cd8c3b3a29fd8ca8961bf452727d52a32/src/services/ImagerService.php#L217-L228
aelvan/Imager-Craft
src/services/ImagerService.php
ImagerService.transformImage
public function transformImage($image, $transforms, $transformDefaults = null, $configOverrides = null) { if (!$image) { return null; } $returnType = 'array'; if (!isset($transforms[0])) { $transforms = [$transforms]; $returnType = 'object'; ...
php
public function transformImage($image, $transforms, $transformDefaults = null, $configOverrides = null) { if (!$image) { return null; } $returnType = 'array'; if (!isset($transforms[0])) { $transforms = [$transforms]; $returnType = 'object'; ...
[ "public", "function", "transformImage", "(", "$", "image", ",", "$", "transforms", ",", "$", "transformDefaults", "=", "null", ",", "$", "configOverrides", "=", "null", ")", "{", "if", "(", "!", "$", "image", ")", "{", "return", "null", ";", "}", "$", ...
@param Asset|string $image @param array $transforms @param array $transformDefaults @param array $configOverrides @return array|TransformedImageInterface|null @throws ImagerException
[ "@param", "Asset|string", "$image", "@param", "array", "$transforms", "@param", "array", "$transformDefaults", "@param", "array", "$configOverrides" ]
train
https://github.com/aelvan/Imager-Craft/blob/f7e80a3cd8c3b3a29fd8ca8961bf452727d52a32/src/services/ImagerService.php#L302-L355
aelvan/Imager-Craft
src/services/ImagerService.php
ImagerService.srcset
public function srcset($images, $descriptor = 'w'): string { $r = ''; $generated = []; if (!\is_array($images)) { return ''; } foreach ($images as $image) { switch ($descriptor) { case 'w': if (!isset($generated[$i...
php
public function srcset($images, $descriptor = 'w'): string { $r = ''; $generated = []; if (!\is_array($images)) { return ''; } foreach ($images as $image) { switch ($descriptor) { case 'w': if (!isset($generated[$i...
[ "public", "function", "srcset", "(", "$", "images", ",", "$", "descriptor", "=", "'w'", ")", ":", "string", "{", "$", "r", "=", "''", ";", "$", "generated", "=", "[", "]", ";", "if", "(", "!", "\\", "is_array", "(", "$", "images", ")", ")", "{"...
Creates srcset string @param array|mixed $images @param string $descriptor @return string
[ "Creates", "srcset", "string" ]
train
https://github.com/aelvan/Imager-Craft/blob/f7e80a3cd8c3b3a29fd8ca8961bf452727d52a32/src/services/ImagerService.php#L365-L399