repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.handle
public function handle() { // Filter global methods if (method_exists($this, 'setup')) { $this->setup(); } // Run input filters $this->filterInput(); // Set up all the whereHas and joins constraints $this->filterRelations(); return $this-...
php
public function handle() { // Filter global methods if (method_exists($this, 'setup')) { $this->setup(); } // Run input filters $this->filterInput(); // Set up all the whereHas and joins constraints $this->filterRelations(); return $this-...
[ "public", "function", "handle", "(", ")", "{", "// Filter global methods", "if", "(", "method_exists", "(", "$", "this", ",", "'setup'", ")", ")", "{", "$", "this", "->", "setup", "(", ")", ";", "}", "// Run input filters", "$", "this", "->", "filterInput"...
Handle all filters. @return QueryBuilder
[ "Handle", "all", "filters", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L136-L149
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.related
public function related($relation, $column, $operator = null, $value = null, $boolean = 'and') { if ($column instanceof \Closure) { return $this->addRelated($relation, $column); } // If there is no value it is a where = ? query and we set the appropriate params if ($valu...
php
public function related($relation, $column, $operator = null, $value = null, $boolean = 'and') { if ($column instanceof \Closure) { return $this->addRelated($relation, $column); } // If there is no value it is a where = ? query and we set the appropriate params if ($valu...
[ "public", "function", "related", "(", "$", "relation", ",", "$", "column", ",", "$", "operator", "=", "null", ",", "$", "value", "=", "null", ",", "$", "boolean", "=", "'and'", ")", "{", "if", "(", "$", "column", "instanceof", "\\", "Closure", ")", ...
Add a where constraint to a relationship. @param $relation @param $column @param null $operator @param null $value @param string $boolean @return $this
[ "Add", "a", "where", "constraint", "to", "a", "relationship", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L175-L190
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.filterInput
public function filterInput() { foreach ($this->input as $key => $val) { // Call all local methods on filter $method = $this->getFilterMethod($key); if ($this->methodIsCallable($method)) { $this->{$method}($val); } } }
php
public function filterInput() { foreach ($this->input as $key => $val) { // Call all local methods on filter $method = $this->getFilterMethod($key); if ($this->methodIsCallable($method)) { $this->{$method}($val); } } }
[ "public", "function", "filterInput", "(", ")", "{", "foreach", "(", "$", "this", "->", "input", "as", "$", "key", "=>", "$", "val", ")", "{", "// Call all local methods on filter", "$", "method", "=", "$", "this", "->", "getFilterMethod", "(", "$", "key", ...
Filter with input array.
[ "Filter", "with", "input", "array", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L208-L218
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.getAllRelations
public function getAllRelations() { if (count($this->allRelations) === 0) { $allRelations = array_merge(array_keys($this->relations), array_keys($this->localRelatedFilters)); foreach ($allRelations as $related) { $this->allRelations[$related] = array_merge($this->get...
php
public function getAllRelations() { if (count($this->allRelations) === 0) { $allRelations = array_merge(array_keys($this->relations), array_keys($this->localRelatedFilters)); foreach ($allRelations as $related) { $this->allRelations[$related] = array_merge($this->get...
[ "public", "function", "getAllRelations", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "allRelations", ")", "===", "0", ")", "{", "$", "allRelations", "=", "array_merge", "(", "array_keys", "(", "$", "this", "->", "relations", ")", ",", "a...
Returns all local relations and relations requiring other Model's Filter's. @return array
[ "Returns", "all", "local", "relations", "and", "relations", "requiring", "other", "Model", "s", "Filter", "s", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L248-L259
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.filterJoinedRelation
public function filterJoinedRelation($related) { // Apply any relation based scope to avoid method duplication $this->callRelatedLocalSetup($related, $this->query); foreach ($this->getLocalRelation($related) as $closure) { // If a relation is defined locally in a method AND is j...
php
public function filterJoinedRelation($related) { // Apply any relation based scope to avoid method duplication $this->callRelatedLocalSetup($related, $this->query); foreach ($this->getLocalRelation($related) as $closure) { // If a relation is defined locally in a method AND is j...
[ "public", "function", "filterJoinedRelation", "(", "$", "related", ")", "{", "// Apply any relation based scope to avoid method duplication", "$", "this", "->", "callRelatedLocalSetup", "(", "$", "related", ",", "$", "this", "->", "query", ")", ";", "foreach", "(", ...
Run the filter on models that already have their tables joined. @param $related
[ "Run", "the", "filter", "on", "models", "that", "already", "have", "their", "tables", "joined", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L284-L303
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.getJoinedTables
public function getJoinedTables() { $joins = []; if (is_array($queryJoins = $this->query->getQuery()->joins)) { $joins = array_map(function ($join) { return $join->table; }, $queryJoins); } return $joins; }
php
public function getJoinedTables() { $joins = []; if (is_array($queryJoins = $this->query->getQuery()->joins)) { $joins = array_map(function ($join) { return $join->table; }, $queryJoins); } return $joins; }
[ "public", "function", "getJoinedTables", "(", ")", "{", "$", "joins", "=", "[", "]", ";", "if", "(", "is_array", "(", "$", "queryJoins", "=", "$", "this", "->", "query", "->", "getQuery", "(", ")", "->", "joins", ")", ")", "{", "$", "joins", "=", ...
Gets all the joined tables. @return array
[ "Gets", "all", "the", "joined", "tables", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L310-L321
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.relationIsJoined
public function relationIsJoined($relation) { if ($this->_joinedTables === null) { $this->_joinedTables = $this->getJoinedTables(); } return in_array($this->getRelatedTable($relation), $this->_joinedTables, true); }
php
public function relationIsJoined($relation) { if ($this->_joinedTables === null) { $this->_joinedTables = $this->getJoinedTables(); } return in_array($this->getRelatedTable($relation), $this->_joinedTables, true); }
[ "public", "function", "relationIsJoined", "(", "$", "relation", ")", "{", "if", "(", "$", "this", "->", "_joinedTables", "===", "null", ")", "{", "$", "this", "->", "_joinedTables", "=", "$", "this", "->", "getJoinedTables", "(", ")", ";", "}", "return",...
Checks if the relation to filter's table is already joined. @param $relation @return bool
[ "Checks", "if", "the", "relation", "to", "filter", "s", "table", "is", "already", "joined", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L329-L336
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.filterUnjoinedRelation
public function filterUnjoinedRelation($related) { $this->query->whereHas($related, function ($q) use ($related) { $this->callRelatedLocalSetup($related, $q); // If we defined it locally then we're running the closure on the related model here right. foreach ($this->getL...
php
public function filterUnjoinedRelation($related) { $this->query->whereHas($related, function ($q) use ($related) { $this->callRelatedLocalSetup($related, $q); // If we defined it locally then we're running the closure on the related model here right. foreach ($this->getL...
[ "public", "function", "filterUnjoinedRelation", "(", "$", "related", ")", "{", "$", "this", "->", "query", "->", "whereHas", "(", "$", "related", ",", "function", "(", "$", "q", ")", "use", "(", "$", "related", ")", "{", "$", "this", "->", "callRelated...
Filters by a relationship that isn't joined by using that relation's ModelFilter. @param $related
[ "Filters", "by", "a", "relationship", "that", "isn", "t", "joined", "by", "using", "that", "relation", "s", "ModelFilter", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L376-L393
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.getRelatedFilterInput
public function getRelatedFilterInput($related) { return array_key_exists($related, $this->relations) ? array_only($this->input, $this->relations[$related]) : []; }
php
public function getRelatedFilterInput($related) { return array_key_exists($related, $this->relations) ? array_only($this->input, $this->relations[$related]) : []; }
[ "public", "function", "getRelatedFilterInput", "(", "$", "related", ")", "{", "return", "array_key_exists", "(", "$", "related", ",", "$", "this", "->", "relations", ")", "?", "array_only", "(", "$", "this", "->", "input", ",", "$", "this", "->", "relation...
Get input to pass to a related Model's Filter. @param $related @return array
[ "Get", "input", "to", "pass", "to", "a", "related", "Model", "s", "Filter", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L401-L404
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.input
public function input($key = null, $default = null) { if ($key === null) { return $this->input; } return array_key_exists($key, $this->input) ? $this->input[$key] : $default; }
php
public function input($key = null, $default = null) { if ($key === null) { return $this->input; } return array_key_exists($key, $this->input) ? $this->input[$key] : $default; }
[ "public", "function", "input", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "{", "return", "$", "this", "->", "input", ";", "}", "return", "array_key_exists", "(", "$", "key", ...
Retrieve input by key or all input as array. @param null $key @param null $default @return array|mixed|null
[ "Retrieve", "input", "by", "key", "or", "all", "input", "as", "array", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L455-L462
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.dropIdSuffix
public function dropIdSuffix($bool = null) { if ($bool === null) { return $this->drop_id; } return $this->drop_id = $bool; }
php
public function dropIdSuffix($bool = null) { if ($bool === null) { return $this->drop_id; } return $this->drop_id = $bool; }
[ "public", "function", "dropIdSuffix", "(", "$", "bool", "=", "null", ")", "{", "if", "(", "$", "bool", "===", "null", ")", "{", "return", "$", "this", "->", "drop_id", ";", "}", "return", "$", "this", "->", "drop_id", "=", "$", "bool", ";", "}" ]
Set to drop `_id` from input. Mainly for testing. @param null $bool @return bool
[ "Set", "to", "drop", "_id", "from", "input", ".", "Mainly", "for", "testing", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L521-L528
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.convertToCamelCasedMethods
public function convertToCamelCasedMethods($bool = null) { if ($bool === null) { return $this->camel_cased_methods; } return $this->camel_cased_methods = $bool; }
php
public function convertToCamelCasedMethods($bool = null) { if ($bool === null) { return $this->camel_cased_methods; } return $this->camel_cased_methods = $bool; }
[ "public", "function", "convertToCamelCasedMethods", "(", "$", "bool", "=", "null", ")", "{", "if", "(", "$", "bool", "===", "null", ")", "{", "return", "$", "this", "->", "camel_cased_methods", ";", "}", "return", "$", "this", "->", "camel_cased_methods", ...
Convert input to camel_case. Mainly for testing. @param null $bool @return bool
[ "Convert", "input", "to", "camel_case", ".", "Mainly", "for", "testing", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L537-L544
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.whitelistMethod
public function whitelistMethod($method) { $this->blacklist = array_filter($this->blacklist, function ($name) use ($method) { return $name !== $method; }); return $this; }
php
public function whitelistMethod($method) { $this->blacklist = array_filter($this->blacklist, function ($name) use ($method) { return $name !== $method; }); return $this; }
[ "public", "function", "whitelistMethod", "(", "$", "method", ")", "{", "$", "this", "->", "blacklist", "=", "array_filter", "(", "$", "this", "->", "blacklist", ",", "function", "(", "$", "name", ")", "use", "(", "$", "method", ")", "{", "return", "$",...
Remove a method from the blacklist. @param string $method @return $this
[ "Remove", "a", "method", "from", "the", "blacklist", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L563-L570
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.methodIsCallable
public function methodIsCallable($method) { return ! $this->methodIsBlacklisted($method) && method_exists($this, $method) && ! method_exists(ModelFilter::class, $method); }
php
public function methodIsCallable($method) { return ! $this->methodIsBlacklisted($method) && method_exists($this, $method) && ! method_exists(ModelFilter::class, $method); }
[ "public", "function", "methodIsCallable", "(", "$", "method", ")", "{", "return", "!", "$", "this", "->", "methodIsBlacklisted", "(", "$", "method", ")", "&&", "method_exists", "(", "$", "this", ",", "$", "method", ")", "&&", "!", "method_exists", "(", "...
Check if the method is not blacklisted and callable on the extended class. @param $method @return bool
[ "Check", "if", "the", "method", "is", "not", "blacklisted", "and", "callable", "on", "the", "extended", "class", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L586-L591
train
Tucker-Eric/EloquentFilter
src/ModelFilter.php
ModelFilter.registerMacros
private function registerMacros() { if ( method_exists(Relation::class, 'hasMacro') && method_exists(Relation::class, 'macro') && ! Relation::hasMacro('paginateFilter') && ! Relation::hasMacro('simplePaginateFilter') ) { Relation::macro('pa...
php
private function registerMacros() { if ( method_exists(Relation::class, 'hasMacro') && method_exists(Relation::class, 'macro') && ! Relation::hasMacro('paginateFilter') && ! Relation::hasMacro('simplePaginateFilter') ) { Relation::macro('pa...
[ "private", "function", "registerMacros", "(", ")", "{", "if", "(", "method_exists", "(", "Relation", "::", "class", ",", "'hasMacro'", ")", "&&", "method_exists", "(", "Relation", "::", "class", ",", "'macro'", ")", "&&", "!", "Relation", "::", "hasMacro", ...
Register paginate and simplePaginate macros on relations BelongsToMany overrides the QueryBuilder's paginate to append the pivot.
[ "Register", "paginate", "and", "simplePaginate", "macros", "on", "relations", "BelongsToMany", "overrides", "the", "QueryBuilder", "s", "paginate", "to", "append", "the", "pivot", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/ModelFilter.php#L597-L618
train
Tucker-Eric/EloquentFilter
src/Filterable.php
Filterable.scopeFilter
public function scopeFilter($query, array $input = [], $filter = null) { // Resolve the current Model's filter if ($filter === null) { $filter = $this->getModelFilterClass(); } // Create the model filter instance $modelFilter = new $filter($query, $input); ...
php
public function scopeFilter($query, array $input = [], $filter = null) { // Resolve the current Model's filter if ($filter === null) { $filter = $this->getModelFilterClass(); } // Create the model filter instance $modelFilter = new $filter($query, $input); ...
[ "public", "function", "scopeFilter", "(", "$", "query", ",", "array", "$", "input", "=", "[", "]", ",", "$", "filter", "=", "null", ")", "{", "// Resolve the current Model's filter", "if", "(", "$", "filter", "===", "null", ")", "{", "$", "filter", "=", ...
Creates local scope to run the filter. @param $query @param array $input @param null|string|ModelFilter $filter @return \Illuminate\Database\Eloquent\Builder
[ "Creates", "local", "scope", "to", "run", "the", "filter", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/Filterable.php#L22-L37
train
Tucker-Eric/EloquentFilter
src/Filterable.php
Filterable.provideFilter
public function provideFilter($filter = null) { if ($filter === null) { $filter = config('eloquentfilter.namespace', 'App\\ModelFilters\\').class_basename($this).'Filter'; } return $filter; }
php
public function provideFilter($filter = null) { if ($filter === null) { $filter = config('eloquentfilter.namespace', 'App\\ModelFilters\\').class_basename($this).'Filter'; } return $filter; }
[ "public", "function", "provideFilter", "(", "$", "filter", "=", "null", ")", "{", "if", "(", "$", "filter", "===", "null", ")", "{", "$", "filter", "=", "config", "(", "'eloquentfilter.namespace'", ",", "'App\\\\ModelFilters\\\\'", ")", ".", "class_basename", ...
Returns ModelFilter class to be instantiated. @param null|string $filter @return string
[ "Returns", "ModelFilter", "class", "to", "be", "instantiated", "." ]
85edfce2e0497f8570d9a8d36a3ad32eb261216f
https://github.com/Tucker-Eric/EloquentFilter/blob/85edfce2e0497f8570d9a8d36a3ad32eb261216f/src/Filterable.php#L85-L92
train
stefanzweifel/laravel-stats
src/Statistics/ProjectStatistics.php
ProjectStatistics.total
public function total() : array { $stats = $this->generate(); return [ 'Total', $stats->sum('number_of_classes'), $stats->sum('methods'), round($stats->avg('methods_per_class'), 2), $stats->sum('lines'), $stats->sum('loc'), ...
php
public function total() : array { $stats = $this->generate(); return [ 'Total', $stats->sum('number_of_classes'), $stats->sum('methods'), round($stats->avg('methods_per_class'), 2), $stats->sum('lines'), $stats->sum('loc'), ...
[ "public", "function", "total", "(", ")", ":", "array", "{", "$", "stats", "=", "$", "this", "->", "generate", "(", ")", ";", "return", "[", "'Total'", ",", "$", "stats", "->", "sum", "(", "'number_of_classes'", ")", ",", "$", "stats", "->", "sum", ...
Create Total Row for current Project Statistics. @return array
[ "Create", "Total", "Row", "for", "current", "Project", "Statistics", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/Statistics/ProjectStatistics.php#L61-L74
train
stefanzweifel/laravel-stats
src/Statistics/ProjectStatistics.php
ProjectStatistics.generate
private function generate() : Collection { if (! $this->cache) { $this->cache = $this->components ->map(function ($classes, $name) { return (new ComponentStatistics($name, $classes))->toArray(); }) ->sortBy(function ($component,...
php
private function generate() : Collection { if (! $this->cache) { $this->cache = $this->components ->map(function ($classes, $name) { return (new ComponentStatistics($name, $classes))->toArray(); }) ->sortBy(function ($component,...
[ "private", "function", "generate", "(", ")", ":", "Collection", "{", "if", "(", "!", "$", "this", "->", "cache", ")", "{", "$", "this", "->", "cache", "=", "$", "this", "->", "components", "->", "map", "(", "function", "(", "$", "classes", ",", "$"...
Generate Project Statistics. @return Collection
[ "Generate", "Project", "Statistics", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/Statistics/ProjectStatistics.php#L81-L94
train
stefanzweifel/laravel-stats
src/Statistics/ComponentStatistics.php
ComponentStatistics.getLines
public function getLines() : int { return $this->classes ->map(function ($class) { return $class->getFileName(); }) ->pipe(function ($classes) { return app(Analyser::class)->countFiles($classes->all(), false)['loc']; }); }
php
public function getLines() : int { return $this->classes ->map(function ($class) { return $class->getFileName(); }) ->pipe(function ($classes) { return app(Analyser::class)->countFiles($classes->all(), false)['loc']; }); }
[ "public", "function", "getLines", "(", ")", ":", "int", "{", "return", "$", "this", "->", "classes", "->", "map", "(", "function", "(", "$", "class", ")", "{", "return", "$", "class", "->", "getFileName", "(", ")", ";", "}", ")", "->", "pipe", "(",...
Return the total number of lines. @return int
[ "Return", "the", "total", "number", "of", "lines", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/Statistics/ComponentStatistics.php#L80-L89
train
stefanzweifel/laravel-stats
src/Statistics/ComponentStatistics.php
ComponentStatistics.getLinesOfCode
public function getLinesOfCode() : float { return $this->classes ->map(function ($class) { return $class->getFileName(); }) ->pipe(function ($classes) { return app(Analyser::class)->countFiles($classes->all(), false)['lloc']; })...
php
public function getLinesOfCode() : float { return $this->classes ->map(function ($class) { return $class->getFileName(); }) ->pipe(function ($classes) { return app(Analyser::class)->countFiles($classes->all(), false)['lloc']; })...
[ "public", "function", "getLinesOfCode", "(", ")", ":", "float", "{", "return", "$", "this", "->", "classes", "->", "map", "(", "function", "(", "$", "class", ")", "{", "return", "$", "class", "->", "getFileName", "(", ")", ";", "}", ")", "->", "pipe"...
Return the total number of lines of code. @return float
[ "Return", "the", "total", "number", "of", "lines", "of", "code", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/Statistics/ComponentStatistics.php#L96-L105
train
stefanzweifel/laravel-stats
src/Statistics/ComponentStatistics.php
ComponentStatistics.toArray
public function toArray() : array { return [ 'component' => $this->name, 'number_of_classes' => $this->getNumberOfClasses(), 'methods' => $this->getNumberOfMethods(), 'methods_per_class' => $this->getNumberOfMethodsPerClass(), 'li...
php
public function toArray() : array { return [ 'component' => $this->name, 'number_of_classes' => $this->getNumberOfClasses(), 'methods' => $this->getNumberOfMethods(), 'methods_per_class' => $this->getNumberOfMethodsPerClass(), 'li...
[ "public", "function", "toArray", "(", ")", ":", "array", "{", "return", "[", "'component'", "=>", "$", "this", "->", "name", ",", "'number_of_classes'", "=>", "$", "this", "->", "getNumberOfClasses", "(", ")", ",", "'methods'", "=>", "$", "this", "->", "...
Generate Statistics Array for the given Component. @return array
[ "Generate", "Statistics", "Array", "for", "the", "given", "Component", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/Statistics/ComponentStatistics.php#L126-L137
train
stefanzweifel/laravel-stats
src/ComponentFinder.php
ComponentFinder.get
public function get() { return $this->findAndLoadClasses() ->map(function ($class) { return new ReflectionClass($class); }) ->reject(function ($class) { return $this->rejectionStrategy->shouldClassBeRejected($class); }) ...
php
public function get() { return $this->findAndLoadClasses() ->map(function ($class) { return new ReflectionClass($class); }) ->reject(function ($class) { return $this->rejectionStrategy->shouldClassBeRejected($class); }) ...
[ "public", "function", "get", "(", ")", "{", "return", "$", "this", "->", "findAndLoadClasses", "(", ")", "->", "map", "(", "function", "(", "$", "class", ")", "{", "return", "new", "ReflectionClass", "(", "$", "class", ")", ";", "}", ")", "->", "reje...
Scan the Project for PHP Classes, turn them into ReflectionClasses, reject unwanted Classes and sort them into Components. @return Collection
[ "Scan", "the", "Project", "for", "PHP", "Classes", "turn", "them", "into", "ReflectionClasses", "reject", "unwanted", "Classes", "and", "sort", "them", "into", "Components", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/ComponentFinder.php#L32-L53
train
stefanzweifel/laravel-stats
src/ComponentFinder.php
ComponentFinder.findFilesInProjectPath
protected function findFilesInProjectPath() : Collection { $excludes = collect(config('stats.exclude', [])); $files = (new Finder)->files() ->in(config('stats.paths', [])) ->name('*.php'); return collect($files) ->reject(function ($file) use ($excludes) ...
php
protected function findFilesInProjectPath() : Collection { $excludes = collect(config('stats.exclude', [])); $files = (new Finder)->files() ->in(config('stats.paths', [])) ->name('*.php'); return collect($files) ->reject(function ($file) use ($excludes) ...
[ "protected", "function", "findFilesInProjectPath", "(", ")", ":", "Collection", "{", "$", "excludes", "=", "collect", "(", "config", "(", "'stats.exclude'", ",", "[", "]", ")", ")", ";", "$", "files", "=", "(", "new", "Finder", ")", "->", "files", "(", ...
Find PHP Files which should be analyzed. @return Collection
[ "Find", "PHP", "Files", "which", "should", "be", "analyzed", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/ComponentFinder.php#L84-L96
train
stefanzweifel/laravel-stats
src/ComponentFinder.php
ComponentFinder.isExcluded
protected function isExcluded(SplFileInfo $file, Collection $excludes) { return $excludes->contains(function ($exclude) use ($file) { return Str::startsWith($file->getPathname(), $exclude); }); }
php
protected function isExcluded(SplFileInfo $file, Collection $excludes) { return $excludes->contains(function ($exclude) use ($file) { return Str::startsWith($file->getPathname(), $exclude); }); }
[ "protected", "function", "isExcluded", "(", "SplFileInfo", "$", "file", ",", "Collection", "$", "excludes", ")", "{", "return", "$", "excludes", "->", "contains", "(", "function", "(", "$", "exclude", ")", "use", "(", "$", "file", ")", "{", "return", "St...
Determine if a file has been defined in the exclude configuration. @param SplFileInfo $file @param Collection $excludes @return bool
[ "Determine", "if", "a", "file", "has", "been", "defined", "in", "the", "exclude", "configuration", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/ComponentFinder.php#L105-L110
train
stefanzweifel/laravel-stats
src/Classifier.php
Classifier.classify
public function classify(ReflectionClass $class) { $mergedClassifiers = array_merge( self::DEFAULT_CLASSIFIER, config('stats.custom_component_classifier', []) ); foreach ($mergedClassifiers as $classifier) { $c = new $classifier(); if (! $thi...
php
public function classify(ReflectionClass $class) { $mergedClassifiers = array_merge( self::DEFAULT_CLASSIFIER, config('stats.custom_component_classifier', []) ); foreach ($mergedClassifiers as $classifier) { $c = new $classifier(); if (! $thi...
[ "public", "function", "classify", "(", "ReflectionClass", "$", "class", ")", "{", "$", "mergedClassifiers", "=", "array_merge", "(", "self", "::", "DEFAULT_CLASSIFIER", ",", "config", "(", "'stats.custom_component_classifier'", ",", "[", "]", ")", ")", ";", "for...
Classify a given Class by an available Classifier Strategy. @param ReflectionClass $class @return string
[ "Classify", "a", "given", "Class", "by", "an", "available", "Classifier", "Strategy", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/Classifier.php#L67-L93
train
stefanzweifel/laravel-stats
src/ReflectionClass.php
ReflectionClass.getDefinedMethods
public function getDefinedMethods() : Collection { return collect($this->getMethods()) ->filter(function ($method) { return $method->getFileName() == $this->getFileName(); }); }
php
public function getDefinedMethods() : Collection { return collect($this->getMethods()) ->filter(function ($method) { return $method->getFileName() == $this->getFileName(); }); }
[ "public", "function", "getDefinedMethods", "(", ")", ":", "Collection", "{", "return", "collect", "(", "$", "this", "->", "getMethods", "(", ")", ")", "->", "filter", "(", "function", "(", "$", "method", ")", "{", "return", "$", "method", "->", "getFileN...
Return a collection of methods defined on the given class. This ignores methods defined in parent class, traits etc. @return Collection
[ "Return", "a", "collection", "of", "methods", "defined", "on", "the", "given", "class", ".", "This", "ignores", "methods", "defined", "in", "parent", "class", "traits", "etc", "." ]
e7bb5b6a376e840167ec26d10754c4c1e0fdf12a
https://github.com/stefanzweifel/laravel-stats/blob/e7bb5b6a376e840167ec26d10754c4c1e0fdf12a/src/ReflectionClass.php#L41-L47
train
beyondcode/laravel-vouchers
src/Vouchers.php
Vouchers.generate
public function generate(int $amount = 1): array { $codes = []; for ($i = 1; $i <= $amount; $i++) { $codes[] = $this->getUniqueVoucher(); } return $codes; }
php
public function generate(int $amount = 1): array { $codes = []; for ($i = 1; $i <= $amount; $i++) { $codes[] = $this->getUniqueVoucher(); } return $codes; }
[ "public", "function", "generate", "(", "int", "$", "amount", "=", "1", ")", ":", "array", "{", "$", "codes", "=", "[", "]", ";", "for", "(", "$", "i", "=", "1", ";", "$", "i", "<=", "$", "amount", ";", "$", "i", "++", ")", "{", "$", "codes"...
Generate the specified amount of codes and return an array with all the generated codes. @param int $amount @return array
[ "Generate", "the", "specified", "amount", "of", "codes", "and", "return", "an", "array", "with", "all", "the", "generated", "codes", "." ]
7b559c86725cf3ddcc27c715314568364f39aa86
https://github.com/beyondcode/laravel-vouchers/blob/7b559c86725cf3ddcc27c715314568364f39aa86/src/Vouchers.php#L27-L36
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.getMetadataForRegion
private function getMetadataForRegion($regionCode) { $countryCallingCode = $this->phoneUtil->getCountryCodeForRegion($regionCode); $mainCountry = $this->phoneUtil->getRegionCodeForCountryCode($countryCallingCode); $metadata = $this->phoneUtil->getMetadataForRegion($mainCountry); if (...
php
private function getMetadataForRegion($regionCode) { $countryCallingCode = $this->phoneUtil->getCountryCodeForRegion($regionCode); $mainCountry = $this->phoneUtil->getRegionCodeForCountryCode($countryCallingCode); $metadata = $this->phoneUtil->getMetadataForRegion($mainCountry); if (...
[ "private", "function", "getMetadataForRegion", "(", "$", "regionCode", ")", "{", "$", "countryCallingCode", "=", "$", "this", "->", "phoneUtil", "->", "getCountryCodeForRegion", "(", "$", "regionCode", ")", ";", "$", "mainCountry", "=", "$", "this", "->", "pho...
The metadata needed by this class is the same for all regions sharing the same country calling code. Therefore, we return the metadata for the 'main' region for this country calling code. @param string $regionCode @return PhoneMetadata
[ "The", "metadata", "needed", "by", "this", "class", "is", "the", "same", "for", "all", "regions", "sharing", "the", "same", "country", "calling", "code", ".", "Therefore", "we", "return", "the", "metadata", "for", "the", "main", "region", "for", "this", "c...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L214-L225
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.maybeCreateNewTemplate
private function maybeCreateNewTemplate() { // When there are multiple available formats, the formatter uses the first format where a // formatting template could be created. foreach ($this->possibleFormats as $key => $numberFormat) { $pattern = $numberFormat->getPattern(); ...
php
private function maybeCreateNewTemplate() { // When there are multiple available formats, the formatter uses the first format where a // formatting template could be created. foreach ($this->possibleFormats as $key => $numberFormat) { $pattern = $numberFormat->getPattern(); ...
[ "private", "function", "maybeCreateNewTemplate", "(", ")", "{", "// When there are multiple available formats, the formatter uses the first format where a", "// formatting template could be created.", "foreach", "(", "$", "this", "->", "possibleFormats", "as", "$", "key", "=>", "...
Returns true if a new template is created as opposed to reusing the existing template. @return bool
[ "Returns", "true", "if", "a", "new", "template", "is", "created", "as", "opposed", "to", "reusing", "the", "existing", "template", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L231-L256
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.getFormattingTemplate
private function getFormattingTemplate($numberPattern, $numberFormat) { // Creates a phone number consisting only of the digit 9 that matches the // numberPattern by applying the pattern to the longestPhoneNumber string. $longestPhoneNumber = '999999999999999'; $m = new Matcher($numb...
php
private function getFormattingTemplate($numberPattern, $numberFormat) { // Creates a phone number consisting only of the digit 9 that matches the // numberPattern by applying the pattern to the longestPhoneNumber string. $longestPhoneNumber = '999999999999999'; $m = new Matcher($numb...
[ "private", "function", "getFormattingTemplate", "(", "$", "numberPattern", ",", "$", "numberFormat", ")", "{", "// Creates a phone number consisting only of the digit 9 that matches the", "// numberPattern by applying the pattern to the longestPhoneNumber string.", "$", "longestPhoneNumb...
Gets a formatting template which can be used to efficiently format a partial number where digits are added one by one. @param string $numberPattern @param string $numberFormat @return string
[ "Gets", "a", "formatting", "template", "which", "can", "be", "used", "to", "efficiently", "format", "a", "partial", "number", "where", "digits", "are", "added", "one", "by", "one", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L349-L367
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.clear
public function clear() { $this->currentOutput = ''; $this->accruedInput = ''; $this->accruedInputWithoutFormatting = ''; $this->formattingTemplate = ''; $this->lastMatchPosition = 0; $this->currentFormattingPattern = ''; $this->prefixBeforeNationalNumber = ''...
php
public function clear() { $this->currentOutput = ''; $this->accruedInput = ''; $this->accruedInputWithoutFormatting = ''; $this->formattingTemplate = ''; $this->lastMatchPosition = 0; $this->currentFormattingPattern = ''; $this->prefixBeforeNationalNumber = ''...
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "currentOutput", "=", "''", ";", "$", "this", "->", "accruedInput", "=", "''", ";", "$", "this", "->", "accruedInputWithoutFormatting", "=", "''", ";", "$", "this", "->", "formattingTemplate"...
Clears the internal state of the formatter, so it can be reused.
[ "Clears", "the", "internal", "state", "of", "the", "formatter", "so", "it", "can", "be", "reused", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L372-L394
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.inputDigit
public function inputDigit($nextChar) { $this->currentOutput = $this->inputDigitWithOptionToRememberPosition($nextChar, false); return $this->currentOutput; }
php
public function inputDigit($nextChar) { $this->currentOutput = $this->inputDigitWithOptionToRememberPosition($nextChar, false); return $this->currentOutput; }
[ "public", "function", "inputDigit", "(", "$", "nextChar", ")", "{", "$", "this", "->", "currentOutput", "=", "$", "this", "->", "inputDigitWithOptionToRememberPosition", "(", "$", "nextChar", ",", "false", ")", ";", "return", "$", "this", "->", "currentOutput"...
Formats a phone number on-the-fly as each digit is entered. @param string $nextChar the most recently entered digit of a phone number. Formatting characters are allowed, but as soon as they are encountered this method foramts the number as entered and not "as you type" anymore. Full width digits and Arabic-indic digit...
[ "Formats", "a", "phone", "number", "on", "-", "the", "-", "fly", "as", "each", "digit", "is", "entered", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L405-L409
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.ableToExtractLongerNdd
private function ableToExtractLongerNdd() { if (mb_strlen($this->extractedNationalPrefix) > 0) { // Put the extracted NDD back to the national number before attempting to extract a new NDD. $this->nationalNumber = $this->extractedNationalPrefix . $this->nationalNumber; //...
php
private function ableToExtractLongerNdd() { if (mb_strlen($this->extractedNationalPrefix) > 0) { // Put the extracted NDD back to the national number before attempting to extract a new NDD. $this->nationalNumber = $this->extractedNationalPrefix . $this->nationalNumber; //...
[ "private", "function", "ableToExtractLongerNdd", "(", ")", "{", "if", "(", "mb_strlen", "(", "$", "this", "->", "extractedNationalPrefix", ")", ">", "0", ")", "{", "// Put the extracted NDD back to the national number before attempting to extract a new NDD.", "$", "this", ...
Some national prefixes are a substring of others. If extracting the shorter NDD doesn't result in a number we can format, we try to see if we can extract a longer version here. @return bool
[ "Some", "national", "prefixes", "are", "a", "substring", "of", "others", ".", "If", "extracting", "the", "shorter", "NDD", "doesn", "t", "result", "in", "a", "number", "we", "can", "format", "we", "try", "to", "see", "if", "we", "can", "extract", "a", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L541-L553
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.attemptToFormatAccruedDigits
public function attemptToFormatAccruedDigits() { foreach ($this->possibleFormats as $numberFormat) { $m = new Matcher($numberFormat->getPattern(), $this->nationalNumber); if ($m->matches()) { $nationalPrefixSeparatorsMatcher = new Matcher(self::$nationalPrefixSeparato...
php
public function attemptToFormatAccruedDigits() { foreach ($this->possibleFormats as $numberFormat) { $m = new Matcher($numberFormat->getPattern(), $this->nationalNumber); if ($m->matches()) { $nationalPrefixSeparatorsMatcher = new Matcher(self::$nationalPrefixSeparato...
[ "public", "function", "attemptToFormatAccruedDigits", "(", ")", "{", "foreach", "(", "$", "this", "->", "possibleFormats", "as", "$", "numberFormat", ")", "{", "$", "m", "=", "new", "Matcher", "(", "$", "numberFormat", "->", "getPattern", "(", ")", ",", "$...
Checks to see if there is an exact pattern match for these digits. If so, we should use this instead of any other formatting template whose leadingDigitsPattern also matches the input. @return string
[ "Checks", "to", "see", "if", "there", "is", "an", "exact", "pattern", "match", "for", "these", "digits", ".", "If", "so", "we", "should", "use", "this", "instead", "of", "any", "other", "formatting", "template", "whose", "leadingDigitsPattern", "also", "matc...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L573-L585
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.attemptToChooseFormattingPattern
private function attemptToChooseFormattingPattern() { // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national // number (excluding national prefix) have been entered. if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) { ...
php
private function attemptToChooseFormattingPattern() { // We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national // number (excluding national prefix) have been entered. if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) { ...
[ "private", "function", "attemptToChooseFormattingPattern", "(", ")", "{", "// We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national", "// number (excluding national prefix) have been entered.", "if", "(", "mb_strlen", "(", "$", "this", "->", "nat...
Attempts to set the formatting template and returns a string which contains the formatted version of the digits entered so far. @return string
[ "Attempts", "to", "set", "the", "formatting", "template", "and", "returns", "a", "string", "which", "contains", "the", "formatted", "version", "of", "the", "digits", "entered", "so", "far", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L638-L653
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.inputAccruedNationalNumber
private function inputAccruedNationalNumber() { $lengthOfNationalNumber = mb_strlen($this->nationalNumber); if ($lengthOfNationalNumber > 0) { $tempNationalNumber = ''; for ($i = 0; $i < $lengthOfNationalNumber; $i++) { $tempNationalNumber = $this->inputDigitH...
php
private function inputAccruedNationalNumber() { $lengthOfNationalNumber = mb_strlen($this->nationalNumber); if ($lengthOfNationalNumber > 0) { $tempNationalNumber = ''; for ($i = 0; $i < $lengthOfNationalNumber; $i++) { $tempNationalNumber = $this->inputDigitH...
[ "private", "function", "inputAccruedNationalNumber", "(", ")", "{", "$", "lengthOfNationalNumber", "=", "mb_strlen", "(", "$", "this", "->", "nationalNumber", ")", ";", "if", "(", "$", "lengthOfNationalNumber", ">", "0", ")", "{", "$", "tempNationalNumber", "=",...
Invokes inputDigitHelper on each digit of the national number accrued, and returns a formatted string in the end @return string
[ "Invokes", "inputDigitHelper", "on", "each", "digit", "of", "the", "national", "number", "accrued", "and", "returns", "a", "formatted", "string", "in", "the", "end" ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L660-L672
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.isNanpaNumberWithNationalPrefix
private function isNanpaNumberWithNationalPrefix() { // For NANPA numbers beginning with 1[2-9], treat the 1 as the national prefix. The reason is // that national significant numbers in NANPA always start with [2-9] after the national prefix. // Numbers beginning with 1[01] can only be shor...
php
private function isNanpaNumberWithNationalPrefix() { // For NANPA numbers beginning with 1[2-9], treat the 1 as the national prefix. The reason is // that national significant numbers in NANPA always start with [2-9] after the national prefix. // Numbers beginning with 1[01] can only be shor...
[ "private", "function", "isNanpaNumberWithNationalPrefix", "(", ")", "{", "// For NANPA numbers beginning with 1[2-9], treat the 1 as the national prefix. The reason is", "// that national significant numbers in NANPA always start with [2-9] after the national prefix.", "// Numbers beginning with 1[0...
Returns true if the current country is a NANPA country and the national number beings with the national prefix @return bool
[ "Returns", "true", "if", "the", "current", "country", "is", "a", "NANPA", "country", "and", "the", "national", "number", "beings", "with", "the", "national", "prefix" ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L679-L687
train
giggsey/libphonenumber-for-php
src/AsYouTypeFormatter.php
AsYouTypeFormatter.removeNationalPrefixFromNationalNumber
private function removeNationalPrefixFromNationalNumber() { $startOfNationalNumber = 0; if ($this->isNanpaNumberWithNationalPrefix()) { $startOfNationalNumber = 1; $this->prefixBeforeNationalNumber .= '1' . self::$seperatorBeforeNationalNumber; $this->isCompleteNu...
php
private function removeNationalPrefixFromNationalNumber() { $startOfNationalNumber = 0; if ($this->isNanpaNumberWithNationalPrefix()) { $startOfNationalNumber = 1; $this->prefixBeforeNationalNumber .= '1' . self::$seperatorBeforeNationalNumber; $this->isCompleteNu...
[ "private", "function", "removeNationalPrefixFromNationalNumber", "(", ")", "{", "$", "startOfNationalNumber", "=", "0", ";", "if", "(", "$", "this", "->", "isNanpaNumberWithNationalPrefix", "(", ")", ")", "{", "$", "startOfNationalNumber", "=", "1", ";", "$", "t...
Returns the national prefix extracted, or an empty string if it is not present. @return string
[ "Returns", "the", "national", "prefix", "extracted", "or", "an", "empty", "string", "if", "it", "is", "not", "present", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/AsYouTypeFormatter.php#L693-L716
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.normalizeHelper
protected static function normalizeHelper($number, array $normalizationReplacements, $removeNonMatches) { $normalizedNumber = ''; $strLength = mb_strlen($number, 'UTF-8'); for ($i = 0; $i < $strLength; $i++) { $character = mb_substr($number, $i, 1, 'UTF-8'); if (isset...
php
protected static function normalizeHelper($number, array $normalizationReplacements, $removeNonMatches) { $normalizedNumber = ''; $strLength = mb_strlen($number, 'UTF-8'); for ($i = 0; $i < $strLength; $i++) { $character = mb_substr($number, $i, 1, 'UTF-8'); if (isset...
[ "protected", "static", "function", "normalizeHelper", "(", "$", "number", ",", "array", "$", "normalizationReplacements", ",", "$", "removeNonMatches", ")", "{", "$", "normalizedNumber", "=", "''", ";", "$", "strLength", "=", "mb_strlen", "(", "$", "number", "...
Normalizes a string of characters representing a phone number by replacing all characters found in the accompanying map with the values therein, and stripping all other characters if removeNonMatches is true. @param string $number a string of characters representing a phone number @param array $normalizationReplacemen...
[ "Normalizes", "a", "string", "of", "characters", "representing", "a", "phone", "number", "by", "replacing", "all", "characters", "found", "in", "the", "accompanying", "map", "with", "the", "values", "therein", "and", "stripping", "all", "other", "characters", "i...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L580-L594
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.formattingRuleHasFirstGroupOnly
public static function formattingRuleHasFirstGroupOnly($nationalPrefixFormattingRule) { $firstGroupOnlyPrefixPatternMatcher = new Matcher(static::FIRST_GROUP_ONLY_PREFIX_PATTERN, $nationalPrefixFormattingRule); return mb_strlen($nationalPrefixFormattingRule) === 0 || $firstG...
php
public static function formattingRuleHasFirstGroupOnly($nationalPrefixFormattingRule) { $firstGroupOnlyPrefixPatternMatcher = new Matcher(static::FIRST_GROUP_ONLY_PREFIX_PATTERN, $nationalPrefixFormattingRule); return mb_strlen($nationalPrefixFormattingRule) === 0 || $firstG...
[ "public", "static", "function", "formattingRuleHasFirstGroupOnly", "(", "$", "nationalPrefixFormattingRule", ")", "{", "$", "firstGroupOnlyPrefixPatternMatcher", "=", "new", "Matcher", "(", "static", "::", "FIRST_GROUP_ONLY_PREFIX_PATTERN", ",", "$", "nationalPrefixFormatting...
Helper function to check if the national prefix formatting rule has the first group only, i.e., does not start with the national prefix. @param string $nationalPrefixFormattingRule @return bool
[ "Helper", "function", "to", "check", "if", "the", "national", "prefix", "formatting", "rule", "has", "the", "first", "group", "only", "i", ".", "e", ".", "does", "not", "start", "with", "the", "national", "prefix", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L602-L609
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getSupportedTypesForMetadata
private function getSupportedTypesForMetadata(PhoneMetadata $metadata) { $types = array(); foreach (array_keys(PhoneNumberType::values()) as $type) { if ($type === PhoneNumberType::FIXED_LINE_OR_MOBILE || $type === PhoneNumberType::UNKNOWN) { // Never return FIXED_LINE_OR...
php
private function getSupportedTypesForMetadata(PhoneMetadata $metadata) { $types = array(); foreach (array_keys(PhoneNumberType::values()) as $type) { if ($type === PhoneNumberType::FIXED_LINE_OR_MOBILE || $type === PhoneNumberType::UNKNOWN) { // Never return FIXED_LINE_OR...
[ "private", "function", "getSupportedTypesForMetadata", "(", "PhoneMetadata", "$", "metadata", ")", "{", "$", "types", "=", "array", "(", ")", ";", "foreach", "(", "array_keys", "(", "PhoneNumberType", "::", "values", "(", ")", ")", "as", "$", "type", ")", ...
Returns the types we have metadata for based on the PhoneMetadata object passed in @param PhoneMetadata $metadata @return array
[ "Returns", "the", "types", "we", "have", "metadata", "for", "based", "on", "the", "PhoneMetadata", "object", "passed", "in" ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L684-L700
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getNationalSignificantNumber
public function getNationalSignificantNumber(PhoneNumber $number) { // If leading zero(s) have been set, we prefix this now. Note this is not a national prefix. $nationalNumber = ''; if ($number->isItalianLeadingZero() && $number->getNumberOfLeadingZeros() > 0) { $zeros = str_rep...
php
public function getNationalSignificantNumber(PhoneNumber $number) { // If leading zero(s) have been set, we prefix this now. Note this is not a national prefix. $nationalNumber = ''; if ($number->isItalianLeadingZero() && $number->getNumberOfLeadingZeros() > 0) { $zeros = str_rep...
[ "public", "function", "getNationalSignificantNumber", "(", "PhoneNumber", "$", "number", ")", "{", "// If leading zero(s) have been set, we prefix this now. Note this is not a national prefix.", "$", "nationalNumber", "=", "''", ";", "if", "(", "$", "number", "->", "isItalian...
Gets the national significant number of the a phone number. Note a national significant number doesn't contain a national prefix or any formatting. @param PhoneNumber $number the phone number for which the national significant number is needed @return string the national significant number of the PhoneNumber object pa...
[ "Gets", "the", "national", "significant", "number", "of", "the", "a", "phone", "number", ".", "Note", "a", "national", "significant", "number", "doesn", "t", "contain", "a", "national", "prefix", "or", "any", "formatting", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L893-L903
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getNumberType
public function getNumberType(PhoneNumber $number) { $regionCode = $this->getRegionCodeForNumber($number); $metadata = $this->getMetadataForRegionOrCallingCode($number->getCountryCode(), $regionCode); if ($metadata === null) { return PhoneNumberType::UNKNOWN; } $n...
php
public function getNumberType(PhoneNumber $number) { $regionCode = $this->getRegionCodeForNumber($number); $metadata = $this->getMetadataForRegionOrCallingCode($number->getCountryCode(), $regionCode); if ($metadata === null) { return PhoneNumberType::UNKNOWN; } $n...
[ "public", "function", "getNumberType", "(", "PhoneNumber", "$", "number", ")", "{", "$", "regionCode", "=", "$", "this", "->", "getRegionCodeForNumber", "(", "$", "number", ")", ";", "$", "metadata", "=", "$", "this", "->", "getMetadataForRegionOrCallingCode", ...
Gets the type of a valid phone number. @param PhoneNumber $number the number the phone number that we want to know the type @return int PhoneNumberType the type of the phone number, or UNKNOWN if it is invalid
[ "Gets", "the", "type", "of", "a", "valid", "phone", "number", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1017-L1026
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.format
public function format(PhoneNumber $number, $numberFormat) { if ($number->getNationalNumber() == 0 && $number->hasRawInput()) { // Unparseable numbers that kept their raw input just use that. // This is the only case where a number can be formatted as E164 without a // le...
php
public function format(PhoneNumber $number, $numberFormat) { if ($number->getNationalNumber() == 0 && $number->hasRawInput()) { // Unparseable numbers that kept their raw input just use that. // This is the only case where a number can be formatted as E164 without a // le...
[ "public", "function", "format", "(", "PhoneNumber", "$", "number", ",", "$", "numberFormat", ")", "{", "if", "(", "$", "number", "->", "getNationalNumber", "(", ")", "==", "0", "&&", "$", "number", "->", "hasRawInput", "(", ")", ")", "{", "// Unparseable...
Formats a phone number in the specified format using default rules. Note that this does not promise to produce a phone number that the user can dial from where they are - although we do format in either 'national' or 'international' format depending on what the client asks for, we do not currently support a more abbrev...
[ "Formats", "a", "phone", "number", "in", "the", "specified", "format", "using", "default", "rules", ".", "Note", "that", "this", "does", "not", "promise", "to", "produce", "a", "phone", "number", "that", "the", "user", "can", "dial", "from", "where", "they...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1137-L1179
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.prefixNumberWithCountryCallingCode
protected function prefixNumberWithCountryCallingCode($countryCallingCode, $numberFormat, &$formattedNumber) { switch ($numberFormat) { case PhoneNumberFormat::E164: $formattedNumber = static::PLUS_SIGN . $countryCallingCode . $formattedNumber; return; ...
php
protected function prefixNumberWithCountryCallingCode($countryCallingCode, $numberFormat, &$formattedNumber) { switch ($numberFormat) { case PhoneNumberFormat::E164: $formattedNumber = static::PLUS_SIGN . $countryCallingCode . $formattedNumber; return; ...
[ "protected", "function", "prefixNumberWithCountryCallingCode", "(", "$", "countryCallingCode", ",", "$", "numberFormat", ",", "&", "$", "formattedNumber", ")", "{", "switch", "(", "$", "numberFormat", ")", "{", "case", "PhoneNumberFormat", "::", "E164", ":", "$", ...
A helper function that is used by format and formatByPattern. @param int $countryCallingCode @param int $numberFormat PhoneNumberFormat @param string $formattedNumber
[ "A", "helper", "function", "that", "is", "used", "by", "format", "and", "formatByPattern", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1187-L1203
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.formatNsnUsingPattern
public function formatNsnUsingPattern( $nationalNumber, NumberFormat $formattingPattern, $numberFormat, $carrierCode = null ) { $numberFormatRule = $formattingPattern->getFormat(); $m = new Matcher($formattingPattern->getPattern(), $nationalNumber); if ($numbe...
php
public function formatNsnUsingPattern( $nationalNumber, NumberFormat $formattingPattern, $numberFormat, $carrierCode = null ) { $numberFormatRule = $formattingPattern->getFormat(); $m = new Matcher($formattingPattern->getPattern(), $nationalNumber); if ($numbe...
[ "public", "function", "formatNsnUsingPattern", "(", "$", "nationalNumber", ",", "NumberFormat", "$", "formattingPattern", ",", "$", "numberFormat", ",", "$", "carrierCode", "=", "null", ")", "{", "$", "numberFormatRule", "=", "$", "formattingPattern", "->", "getFo...
Note that carrierCode is optional - if null or an empty string, no carrier code replacement will take place. @param string $nationalNumber @param NumberFormat $formattingPattern @param int $numberFormat PhoneNumberFormat @param null|string $carrierCode @return string
[ "Note", "that", "carrierCode", "is", "optional", "-", "if", "null", "or", "an", "empty", "string", "no", "carrier", "code", "replacement", "will", "take", "place", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1293-L1338
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.maybeAppendFormattedExtension
protected function maybeAppendFormattedExtension(PhoneNumber $number, $metadata, $numberFormat, &$formattedNumber) { if ($number->hasExtension() && mb_strlen($number->getExtension()) > 0) { if ($numberFormat === PhoneNumberFormat::RFC3966) { $formattedNumber .= static::RFC3966_EX...
php
protected function maybeAppendFormattedExtension(PhoneNumber $number, $metadata, $numberFormat, &$formattedNumber) { if ($number->hasExtension() && mb_strlen($number->getExtension()) > 0) { if ($numberFormat === PhoneNumberFormat::RFC3966) { $formattedNumber .= static::RFC3966_EX...
[ "protected", "function", "maybeAppendFormattedExtension", "(", "PhoneNumber", "$", "number", ",", "$", "metadata", ",", "$", "numberFormat", ",", "&", "$", "formattedNumber", ")", "{", "if", "(", "$", "number", "->", "hasExtension", "(", ")", "&&", "mb_strlen"...
Appends the formatted extension of a phone number to formattedNumber, if the phone number had an extension specified. @param PhoneNumber $number @param PhoneMetadata|null $metadata @param int $numberFormat PhoneNumberFormat @param string $formattedNumber
[ "Appends", "the", "formatted", "extension", "of", "a", "phone", "number", "to", "formattedNumber", "if", "the", "phone", "number", "had", "an", "extension", "specified", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1349-L1360
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getCountryMobileToken
public static function getCountryMobileToken($countryCallingCode) { if (count(static::$MOBILE_TOKEN_MAPPINGS) === 0) { static::initMobileTokenMappings(); } if (array_key_exists($countryCallingCode, static::$MOBILE_TOKEN_MAPPINGS)) { return static::$MOBILE_TOKEN_MAPPI...
php
public static function getCountryMobileToken($countryCallingCode) { if (count(static::$MOBILE_TOKEN_MAPPINGS) === 0) { static::initMobileTokenMappings(); } if (array_key_exists($countryCallingCode, static::$MOBILE_TOKEN_MAPPINGS)) { return static::$MOBILE_TOKEN_MAPPI...
[ "public", "static", "function", "getCountryMobileToken", "(", "$", "countryCallingCode", ")", "{", "if", "(", "count", "(", "static", "::", "$", "MOBILE_TOKEN_MAPPINGS", ")", "===", "0", ")", "{", "static", "::", "initMobileTokenMappings", "(", ")", ";", "}", ...
Returns the mobile token for the provided country calling code if it has one, otherwise returns an empty string. A mobile token is a number inserted before the area code when dialing a mobile number from that country from abroad. @param int $countryCallingCode the country calling code for which we want the mobile toke...
[ "Returns", "the", "mobile", "token", "for", "the", "provided", "country", "calling", "code", "if", "it", "has", "one", "otherwise", "returns", "an", "empty", "string", ".", "A", "mobile", "token", "is", "a", "number", "inserted", "before", "the", "area", "...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1370-L1380
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.isViablePhoneNumber
public static function isViablePhoneNumber($number) { if (static::$VALID_PHONE_NUMBER_PATTERN === null) { static::initValidPhoneNumberPatterns(); } if (mb_strlen($number) < static::MIN_LENGTH_FOR_NSN) { return false; } $validPhoneNumberPattern = stat...
php
public static function isViablePhoneNumber($number) { if (static::$VALID_PHONE_NUMBER_PATTERN === null) { static::initValidPhoneNumberPatterns(); } if (mb_strlen($number) < static::MIN_LENGTH_FOR_NSN) { return false; } $validPhoneNumberPattern = stat...
[ "public", "static", "function", "isViablePhoneNumber", "(", "$", "number", ")", "{", "if", "(", "static", "::", "$", "VALID_PHONE_NUMBER_PATTERN", "===", "null", ")", "{", "static", "::", "initValidPhoneNumberPatterns", "(", ")", ";", "}", "if", "(", "mb_strle...
Checks to see if the string of characters could possibly be a phone number at all. At the moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation commonly found in phone numbers. This method does not require the number to be normalized in advance - but does assume that leading non-...
[ "Checks", "to", "see", "if", "the", "string", "of", "characters", "could", "possibly", "be", "a", "phone", "number", "at", "all", ".", "At", "the", "moment", "checks", "to", "see", "that", "the", "string", "begins", "with", "at", "least", "2", "digits", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1412-L1426
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.setItalianLeadingZerosForPhoneNumber
public static function setItalianLeadingZerosForPhoneNumber($nationalNumber, PhoneNumber $phoneNumber) { if (strlen($nationalNumber) > 1 && substr($nationalNumber, 0, 1) == '0') { $phoneNumber->setItalianLeadingZero(true); $numberOfLeadingZeros = 1; // Note that if the na...
php
public static function setItalianLeadingZerosForPhoneNumber($nationalNumber, PhoneNumber $phoneNumber) { if (strlen($nationalNumber) > 1 && substr($nationalNumber, 0, 1) == '0') { $phoneNumber->setItalianLeadingZero(true); $numberOfLeadingZeros = 1; // Note that if the na...
[ "public", "static", "function", "setItalianLeadingZerosForPhoneNumber", "(", "$", "nationalNumber", ",", "PhoneNumber", "$", "phoneNumber", ")", "{", "if", "(", "strlen", "(", "$", "nationalNumber", ")", ">", "1", "&&", "substr", "(", "$", "nationalNumber", ",",...
A helper function to set the values related to leading zeros in a PhoneNumber. @param string $nationalNumber @param PhoneNumber $phoneNumber
[ "A", "helper", "function", "to", "set", "the", "values", "related", "to", "leading", "zeros", "in", "a", "PhoneNumber", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1525-L1541
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.buildNationalNumberForParsing
protected function buildNationalNumberForParsing($numberToParse, &$nationalNumber) { $indexOfPhoneContext = strpos($numberToParse, static::RFC3966_PHONE_CONTEXT); if ($indexOfPhoneContext !== false) { $phoneContextStart = $indexOfPhoneContext + mb_strlen(static::RFC3966_PHONE_CONTEXT); ...
php
protected function buildNationalNumberForParsing($numberToParse, &$nationalNumber) { $indexOfPhoneContext = strpos($numberToParse, static::RFC3966_PHONE_CONTEXT); if ($indexOfPhoneContext !== false) { $phoneContextStart = $indexOfPhoneContext + mb_strlen(static::RFC3966_PHONE_CONTEXT); ...
[ "protected", "function", "buildNationalNumberForParsing", "(", "$", "numberToParse", ",", "&", "$", "nationalNumber", ")", "{", "$", "indexOfPhoneContext", "=", "strpos", "(", "$", "numberToParse", ",", "static", "::", "RFC3966_PHONE_CONTEXT", ")", ";", "if", "(",...
Converts numberToParse to a form that we can parse and write it to nationalNumber if it is written in RFC3966; otherwise extract a possible number out of it and write to nationalNumber. @param string $numberToParse @param string $nationalNumber
[ "Converts", "numberToParse", "to", "a", "form", "that", "we", "can", "parse", "and", "write", "it", "to", "nationalNumber", "if", "it", "is", "written", "in", "RFC3966", ";", "otherwise", "extract", "a", "possible", "number", "out", "of", "it", "and", "wri...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1738-L1783
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.checkRegionForParsing
protected function checkRegionForParsing($numberToParse, $defaultRegion) { if (!$this->isValidRegionCode($defaultRegion)) { // If the number is null or empty, we can't infer the region. $plusCharsPatternMatcher = new Matcher(static::$PLUS_CHARS_PATTERN, $numberToParse); i...
php
protected function checkRegionForParsing($numberToParse, $defaultRegion) { if (!$this->isValidRegionCode($defaultRegion)) { // If the number is null or empty, we can't infer the region. $plusCharsPatternMatcher = new Matcher(static::$PLUS_CHARS_PATTERN, $numberToParse); i...
[ "protected", "function", "checkRegionForParsing", "(", "$", "numberToParse", ",", "$", "defaultRegion", ")", "{", "if", "(", "!", "$", "this", "->", "isValidRegionCode", "(", "$", "defaultRegion", ")", ")", "{", "// If the number is null or empty, we can't infer the r...
Checks to see that the region code used is valid, or if it is not valid, that the number to parse starts with a + symbol so that we can attempt to infer the region from the number. Returns false if it cannot use the region provided and the region cannot be inferred. @param string $numberToParse @param string $defaultRe...
[ "Checks", "to", "see", "that", "the", "region", "code", "used", "is", "valid", "or", "if", "it", "is", "not", "valid", "that", "the", "number", "to", "parse", "starts", "with", "a", "+", "symbol", "so", "that", "we", "can", "attempt", "to", "infer", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L1836-L1846
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.parsePrefixAsIdd
protected function parsePrefixAsIdd($iddPattern, &$number) { $m = new Matcher($iddPattern, $number); if ($m->lookingAt()) { $matchEnd = $m->end(); // Only strip this if the first digit after the match is not a 0, since country calling codes // cannot begin with 0....
php
protected function parsePrefixAsIdd($iddPattern, &$number) { $m = new Matcher($iddPattern, $number); if ($m->lookingAt()) { $matchEnd = $m->end(); // Only strip this if the first digit after the match is not a 0, since country calling codes // cannot begin with 0....
[ "protected", "function", "parsePrefixAsIdd", "(", "$", "iddPattern", ",", "&", "$", "number", ")", "{", "$", "m", "=", "new", "Matcher", "(", "$", "iddPattern", ",", "$", "number", ")", ";", "if", "(", "$", "m", "->", "lookingAt", "(", ")", ")", "{...
Strips the IDD from the start of the number if present. Helper function used by maybeStripInternationalPrefixAndNormalize. @param string $iddPattern @param string $number @return bool
[ "Strips", "the", "IDD", "from", "the", "start", "of", "the", "number", "if", "present", ".", "Helper", "function", "used", "by", "maybeStripInternationalPrefixAndNormalize", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L2067-L2085
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.extractCountryCode
public function extractCountryCode($fullNumber, &$nationalNumber) { if ((mb_strlen($fullNumber) == 0) || ($fullNumber[0] == '0')) { // Country codes do not begin with a '0'. return 0; } $numberLength = mb_strlen($fullNumber); for ($i = 1; $i <= static::MAX_LEN...
php
public function extractCountryCode($fullNumber, &$nationalNumber) { if ((mb_strlen($fullNumber) == 0) || ($fullNumber[0] == '0')) { // Country codes do not begin with a '0'. return 0; } $numberLength = mb_strlen($fullNumber); for ($i = 1; $i <= static::MAX_LEN...
[ "public", "function", "extractCountryCode", "(", "$", "fullNumber", ",", "&", "$", "nationalNumber", ")", "{", "if", "(", "(", "mb_strlen", "(", "$", "fullNumber", ")", "==", "0", ")", "||", "(", "$", "fullNumber", "[", "0", "]", "==", "'0'", ")", ")...
Extracts country calling code from fullNumber, returns it and places the remaining number in nationalNumber. It assumes that the leading plus sign or IDD has already been removed. Returns 0 if fullNumber doesn't start with a valid country calling code, and leaves nationalNumber unmodified. @param string $fullNumber @p...
[ "Extracts", "country", "calling", "code", "from", "fullNumber", "returns", "it", "and", "places", "the", "remaining", "number", "in", "nationalNumber", ".", "It", "assumes", "that", "the", "leading", "plus", "sign", "or", "IDD", "has", "already", "been", "remo...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L2096-L2111
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getRegionCodesForCountryCode
public function getRegionCodesForCountryCode($countryCallingCode) { $regionCodes = isset($this->countryCallingCodeToRegionCodeMap[$countryCallingCode]) ? $this->countryCallingCodeToRegionCodeMap[$countryCallingCode] : null; return $regionCodes === null ? array() : $regionCodes; }
php
public function getRegionCodesForCountryCode($countryCallingCode) { $regionCodes = isset($this->countryCallingCodeToRegionCodeMap[$countryCallingCode]) ? $this->countryCallingCodeToRegionCodeMap[$countryCallingCode] : null; return $regionCodes === null ? array() : $regionCodes; }
[ "public", "function", "getRegionCodesForCountryCode", "(", "$", "countryCallingCode", ")", "{", "$", "regionCodes", "=", "isset", "(", "$", "this", "->", "countryCallingCodeToRegionCodeMap", "[", "$", "countryCallingCode", "]", ")", "?", "$", "this", "->", "countr...
Returns a list with the region codes that match the specific country calling code. For non-geographical country calling codes, the region code 001 is returned. Also, in the case of no region code being found, an empty list is returned. @param int $countryCallingCode @return array
[ "Returns", "a", "list", "with", "the", "region", "codes", "that", "match", "the", "specific", "country", "calling", "code", ".", "For", "non", "-", "geographical", "country", "calling", "codes", "the", "region", "code", "001", "is", "returned", ".", "Also", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L2293-L2297
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getCountryCodeForValidRegion
protected function getCountryCodeForValidRegion($regionCode) { $metadata = $this->getMetadataForRegion($regionCode); if ($metadata === null) { throw new \InvalidArgumentException('Invalid region code: ' . $regionCode); } return $metadata->getCountryCode(); }
php
protected function getCountryCodeForValidRegion($regionCode) { $metadata = $this->getMetadataForRegion($regionCode); if ($metadata === null) { throw new \InvalidArgumentException('Invalid region code: ' . $regionCode); } return $metadata->getCountryCode(); }
[ "protected", "function", "getCountryCodeForValidRegion", "(", "$", "regionCode", ")", "{", "$", "metadata", "=", "$", "this", "->", "getMetadataForRegion", "(", "$", "regionCode", ")", ";", "if", "(", "$", "metadata", "===", "null", ")", "{", "throw", "new",...
Returns the country calling code for a specific region. For example, this would be 1 for the United States, and 64 for New Zealand. Assumes the region is already valid. @param string $regionCode the region that we want to get the country calling code for @return int the country calling code for the region denoted by r...
[ "Returns", "the", "country", "calling", "code", "for", "a", "specific", "region", ".", "For", "example", "this", "would", "be", "1", "for", "the", "United", "States", "and", "64", "for", "New", "Zealand", ".", "Assumes", "the", "region", "is", "already", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L2322-L2329
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.formatOutOfCountryKeepingAlphaChars
public function formatOutOfCountryKeepingAlphaChars(PhoneNumber $number, $regionCallingFrom) { $rawInput = $number->getRawInput(); // If there is no raw input, then we can't keep alpha characters because there aren't any. // In this case, we return formatOutOfCountryCallingNumber. if...
php
public function formatOutOfCountryKeepingAlphaChars(PhoneNumber $number, $regionCallingFrom) { $rawInput = $number->getRawInput(); // If there is no raw input, then we can't keep alpha characters because there aren't any. // In this case, we return formatOutOfCountryCallingNumber. if...
[ "public", "function", "formatOutOfCountryKeepingAlphaChars", "(", "PhoneNumber", "$", "number", ",", "$", "regionCallingFrom", ")", "{", "$", "rawInput", "=", "$", "number", "->", "getRawInput", "(", ")", ";", "// If there is no raw input, then we can't keep alpha charact...
Formats a phone number for out-of-country dialing purposes. Note that in this version, if the number was entered originally using alpha characters and this version of the number is stored in raw_input, this representation of the number will be used rather than the digit representation. Grouping information, as specifi...
[ "Formats", "a", "phone", "number", "for", "out", "-", "of", "-", "country", "dialing", "purposes", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L2559-L2651
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.formatOutOfCountryCallingNumber
public function formatOutOfCountryCallingNumber(PhoneNumber $number, $regionCallingFrom) { if (!$this->isValidRegionCode($regionCallingFrom)) { return $this->format($number, PhoneNumberFormat::INTERNATIONAL); } $countryCallingCode = $number->getCountryCode(); $nationalSig...
php
public function formatOutOfCountryCallingNumber(PhoneNumber $number, $regionCallingFrom) { if (!$this->isValidRegionCode($regionCallingFrom)) { return $this->format($number, PhoneNumberFormat::INTERNATIONAL); } $countryCallingCode = $number->getCountryCode(); $nationalSig...
[ "public", "function", "formatOutOfCountryCallingNumber", "(", "PhoneNumber", "$", "number", ",", "$", "regionCallingFrom", ")", "{", "if", "(", "!", "$", "this", "->", "isValidRegionCode", "(", "$", "regionCallingFrom", ")", ")", "{", "return", "$", "this", "-...
Formats a phone number for out-of-country dialing purposes. If no regionCallingFrom is supplied, we format the number in its INTERNATIONAL format. If the country calling code is the same as that of the region where the number is from, then NATIONAL formatting will be applied. <p>If the number itself has a country call...
[ "Formats", "a", "phone", "number", "for", "out", "-", "of", "-", "country", "dialing", "purposes", ".", "If", "no", "regionCallingFrom", "is", "supplied", "we", "format", "the", "number", "in", "its", "INTERNATIONAL", "format", ".", "If", "the", "country", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L2670-L2736
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.rawInputContainsNationalPrefix
protected function rawInputContainsNationalPrefix($rawInput, $nationalPrefix, $regionCode) { $normalizedNationalNumber = static::normalizeDigitsOnly($rawInput); if (strpos($normalizedNationalNumber, $nationalPrefix) === 0) { try { // Some Japanese numbers (e.g. 00777123) ...
php
protected function rawInputContainsNationalPrefix($rawInput, $nationalPrefix, $regionCode) { $normalizedNationalNumber = static::normalizeDigitsOnly($rawInput); if (strpos($normalizedNationalNumber, $nationalPrefix) === 0) { try { // Some Japanese numbers (e.g. 00777123) ...
[ "protected", "function", "rawInputContainsNationalPrefix", "(", "$", "rawInput", ",", "$", "nationalPrefix", ",", "$", "regionCode", ")", "{", "$", "normalizedNationalNumber", "=", "static", "::", "normalizeDigitsOnly", "(", "$", "rawInput", ")", ";", "if", "(", ...
Check if rawInput, which is assumed to be in the national format, has a national prefix. The national prefix is assumed to be in digits-only form. @param string $rawInput @param string $nationalPrefix @param string $regionCode @return bool
[ "Check", "if", "rawInput", "which", "is", "assumed", "to", "be", "in", "the", "national", "format", "has", "a", "national", "prefix", ".", "The", "national", "prefix", "is", "assumed", "to", "be", "in", "digits", "-", "only", "form", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L2918-L2935
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.formatByPattern
public function formatByPattern(PhoneNumber $number, $numberFormat, array $userDefinedFormats) { $countryCallingCode = $number->getCountryCode(); $nationalSignificantNumber = $this->getNationalSignificantNumber($number); if (!$this->hasValidCountryCallingCode($countryCallingCode)) { ...
php
public function formatByPattern(PhoneNumber $number, $numberFormat, array $userDefinedFormats) { $countryCallingCode = $number->getCountryCode(); $nationalSignificantNumber = $this->getNationalSignificantNumber($number); if (!$this->hasValidCountryCallingCode($countryCallingCode)) { ...
[ "public", "function", "formatByPattern", "(", "PhoneNumber", "$", "number", ",", "$", "numberFormat", ",", "array", "$", "userDefinedFormats", ")", "{", "$", "countryCallingCode", "=", "$", "number", "->", "getCountryCode", "(", ")", ";", "$", "nationalSignifica...
Formats a phone number in the specified format using client-defined formatting rules. Note that if the phone number has a country calling code of zero or an otherwise invalid country calling code, we cannot work out things like whether there should be a national prefix applied, or how to format extensions, so we return...
[ "Formats", "a", "phone", "number", "in", "the", "specified", "format", "using", "client", "-", "defined", "formatting", "rules", ".", "Note", "that", "if", "the", "phone", "number", "has", "a", "country", "calling", "code", "of", "zero", "or", "an", "other...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L3042-L3086
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getExampleNumberForType
public function getExampleNumberForType($regionCodeOrType, $type = null) { if ($regionCodeOrType !== null && $type === null) { /* * Gets a valid number for the specified number type (it may belong to any country). */ foreach ($this->getSupportedRegions() as ...
php
public function getExampleNumberForType($regionCodeOrType, $type = null) { if ($regionCodeOrType !== null && $type === null) { /* * Gets a valid number for the specified number type (it may belong to any country). */ foreach ($this->getSupportedRegions() as ...
[ "public", "function", "getExampleNumberForType", "(", "$", "regionCodeOrType", ",", "$", "type", "=", "null", ")", "{", "if", "(", "$", "regionCodeOrType", "!==", "null", "&&", "$", "type", "===", "null", ")", "{", "/*\n * Gets a valid number for the s...
Gets a valid number for the specified region and number type. @param string|int $regionCodeOrType the region for which an example number is needed @param int $type the PhoneNumberType of number that is needed @return PhoneNumber a valid number for the specified region and type. Returns null when the metadata does not ...
[ "Gets", "a", "valid", "number", "for", "the", "specified", "region", "and", "number", "type", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L3172-L3213
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.getExampleNumberForNonGeoEntity
public function getExampleNumberForNonGeoEntity($countryCallingCode) { $metadata = $this->getMetadataForNonGeographicalRegion($countryCallingCode); if ($metadata !== null) { // For geographical entities, fixed-line data is always present. However, for non-geographical // enti...
php
public function getExampleNumberForNonGeoEntity($countryCallingCode) { $metadata = $this->getMetadataForNonGeographicalRegion($countryCallingCode); if ($metadata !== null) { // For geographical entities, fixed-line data is always present. However, for non-geographical // enti...
[ "public", "function", "getExampleNumberForNonGeoEntity", "(", "$", "countryCallingCode", ")", "{", "$", "metadata", "=", "$", "this", "->", "getMetadataForNonGeographicalRegion", "(", "$", "countryCallingCode", ")", ";", "if", "(", "$", "metadata", "!==", "null", ...
Gets a valid number for the specified country calling code for a non-geographical entity. @param int $countryCallingCode the country calling code for a non-geographical entity @return PhoneNumber a valid number for the non-geographical entity. Returns null when the metadata does not contain such information, or the co...
[ "Gets", "a", "valid", "number", "for", "the", "specified", "country", "calling", "code", "for", "a", "non", "-", "geographical", "entity", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L3257-L3286
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.isNationalNumberSuffixOfTheOther
protected function isNationalNumberSuffixOfTheOther(PhoneNumber $firstNumber, PhoneNumber $secondNumber) { $firstNumberNationalNumber = trim((string)$firstNumber->getNationalNumber()); $secondNumberNationalNumber = trim((string)$secondNumber->getNationalNumber()); return $this->stringEndsWit...
php
protected function isNationalNumberSuffixOfTheOther(PhoneNumber $firstNumber, PhoneNumber $secondNumber) { $firstNumberNationalNumber = trim((string)$firstNumber->getNationalNumber()); $secondNumberNationalNumber = trim((string)$secondNumber->getNationalNumber()); return $this->stringEndsWit...
[ "protected", "function", "isNationalNumberSuffixOfTheOther", "(", "PhoneNumber", "$", "firstNumber", ",", "PhoneNumber", "$", "secondNumber", ")", "{", "$", "firstNumberNationalNumber", "=", "trim", "(", "(", "string", ")", "$", "firstNumber", "->", "getNationalNumber...
Returns true when one national number is the suffix of the other or both are the same. @param PhoneNumber $firstNumber @param PhoneNumber $secondNumber @return bool
[ "Returns", "true", "when", "one", "national", "number", "is", "the", "suffix", "of", "the", "other", "or", "both", "are", "the", "same", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L3424-L3430
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.isMobileNumberPortableRegion
public function isMobileNumberPortableRegion($regionCode) { $metadata = $this->getMetadataForRegion($regionCode); if ($metadata === null) { return false; } return $metadata->isMobileNumberPortableRegion(); }
php
public function isMobileNumberPortableRegion($regionCode) { $metadata = $this->getMetadataForRegion($regionCode); if ($metadata === null) { return false; } return $metadata->isMobileNumberPortableRegion(); }
[ "public", "function", "isMobileNumberPortableRegion", "(", "$", "regionCode", ")", "{", "$", "metadata", "=", "$", "this", "->", "getMetadataForRegion", "(", "$", "regionCode", ")", ";", "if", "(", "$", "metadata", "===", "null", ")", "{", "return", "false",...
Returns true if the supplied region supports mobile number portability. Returns false for invalid, unknown or regions that don't support mobile number portability. @param string $regionCode the region for which we want to know whether it supports mobile number portability or not. @return bool
[ "Returns", "true", "if", "the", "supplied", "region", "supports", "mobile", "number", "portability", ".", "Returns", "false", "for", "invalid", "unknown", "or", "regions", "that", "don", "t", "support", "mobile", "number", "portability", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L3447-L3455
train
giggsey/libphonenumber-for-php
src/PhoneNumberUtil.php
PhoneNumberUtil.truncateTooLongNumber
public function truncateTooLongNumber(PhoneNumber $number) { if ($this->isValidNumber($number)) { return true; } $numberCopy = new PhoneNumber(); $numberCopy->mergeFrom($number); $nationalNumber = $number->getNationalNumber(); do { $nationalNum...
php
public function truncateTooLongNumber(PhoneNumber $number) { if ($this->isValidNumber($number)) { return true; } $numberCopy = new PhoneNumber(); $numberCopy->mergeFrom($number); $nationalNumber = $number->getNationalNumber(); do { $nationalNum...
[ "public", "function", "truncateTooLongNumber", "(", "PhoneNumber", "$", "number", ")", "{", "if", "(", "$", "this", "->", "isValidNumber", "(", "$", "number", ")", ")", "{", "return", "true", ";", "}", "$", "numberCopy", "=", "new", "PhoneNumber", "(", "...
Attempts to extract a valid number from a phone number that is too long to be valid, and resets the PhoneNumber object passed in to that valid version. If no valid number could be extracted, the PhoneNumber object passed in will not be modified. @param PhoneNumber $number a PhoneNumber object which contains a number th...
[ "Attempts", "to", "extract", "a", "valid", "number", "from", "a", "phone", "number", "that", "is", "too", "long", "to", "be", "valid", "and", "resets", "the", "PhoneNumber", "object", "passed", "in", "to", "that", "valid", "version", ".", "If", "no", "va...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberUtil.php#L3582-L3599
train
giggsey/libphonenumber-for-php
src/PhoneNumberToTimeZonesMapper.php
PhoneNumberToTimeZonesMapper.getTimeZonesForGeocodableNumber
protected function getTimeZonesForGeocodableNumber(PhoneNumber $number) { $timezones = $this->prefixTimeZonesMap->lookupTimeZonesForNumber($number); return (count($timezones) == 0) ? $this->unknownTimeZoneList : $timezones; }
php
protected function getTimeZonesForGeocodableNumber(PhoneNumber $number) { $timezones = $this->prefixTimeZonesMap->lookupTimeZonesForNumber($number); return (count($timezones) == 0) ? $this->unknownTimeZoneList : $timezones; }
[ "protected", "function", "getTimeZonesForGeocodableNumber", "(", "PhoneNumber", "$", "number", ")", "{", "$", "timezones", "=", "$", "this", "->", "prefixTimeZonesMap", "->", "lookupTimeZonesForNumber", "(", "$", "number", ")", ";", "return", "(", "count", "(", ...
Returns a list of time zones to which a geocodable phone number belongs. @param PhoneNumber $number The phone number for which we want to get the time zones to which it belongs @return array the list of correspondiing time zones or a single element list with the default unknown timezone if no other time zone was found...
[ "Returns", "a", "list", "of", "time", "zones", "to", "which", "a", "geocodable", "phone", "number", "belongs", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberToTimeZonesMapper.php#L138-L142
train
giggsey/libphonenumber-for-php
src/prefixmapper/PrefixFileReader.php
PrefixFileReader.getDescriptionForNumber
public function getDescriptionForNumber(PhoneNumber $number, $language, $script, $region) { $phonePrefix = $number->getCountryCode() . PhoneNumberUtil::getInstance()->getNationalSignificantNumber($number); $phonePrefixDescriptions = $this->getPhonePrefixDescriptions($phonePrefix, $language, $script...
php
public function getDescriptionForNumber(PhoneNumber $number, $language, $script, $region) { $phonePrefix = $number->getCountryCode() . PhoneNumberUtil::getInstance()->getNationalSignificantNumber($number); $phonePrefixDescriptions = $this->getPhonePrefixDescriptions($phonePrefix, $language, $script...
[ "public", "function", "getDescriptionForNumber", "(", "PhoneNumber", "$", "number", ",", "$", "language", ",", "$", "script", ",", "$", "region", ")", "{", "$", "phonePrefix", "=", "$", "number", "->", "getCountryCode", "(", ")", ".", "PhoneNumberUtil", "::"...
Returns a text description in the given language for the given phone number. @param PhoneNumber $number the phone number for which we want to get a text description @param string $language two or three-letter lowercase ISO language as defined by ISO 639 @param string $script four-letter titlecase (the first letter is ...
[ "Returns", "a", "text", "description", "in", "the", "given", "language", "for", "the", "given", "phone", "number", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/prefixmapper/PrefixFileReader.php#L102-L119
train
giggsey/libphonenumber-for-php
build/BuildMetadataFromXml.php
BuildMetadataFromXml.getMetadataFilter
public static function getMetadataFilter($liteBuild, $specialBuild) { if ($specialBuild) { if ($liteBuild) { throw new \RuntimeException('liteBuild and specialBuild may not both be set'); } return MetadataFilter::forSpecialBuild(); } if ($l...
php
public static function getMetadataFilter($liteBuild, $specialBuild) { if ($specialBuild) { if ($liteBuild) { throw new \RuntimeException('liteBuild and specialBuild may not both be set'); } return MetadataFilter::forSpecialBuild(); } if ($l...
[ "public", "static", "function", "getMetadataFilter", "(", "$", "liteBuild", ",", "$", "specialBuild", ")", "{", "if", "(", "$", "specialBuild", ")", "{", "if", "(", "$", "liteBuild", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'liteBuild and sp...
Processes the custom build flags and gets a MetadataFilter which may be used to filter PhoneMetadata objects. Incompatible flag combinations throw RuntimeException. @param bool $liteBuild @param bool $specialBuild @return MetadataFilter
[ "Processes", "the", "custom", "build", "flags", "and", "gets", "a", "MetadataFilter", "which", "may", "be", "used", "to", "filter", "PhoneMetadata", "objects", ".", "Incompatible", "flag", "combinations", "throw", "RuntimeException", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/BuildMetadataFromXml.php#L156-L169
train
giggsey/libphonenumber-for-php
build/BuildMetadataFromXml.php
BuildMetadataFromXml.getNationalPrefix
public static function getNationalPrefix(\DOMElement $element) { return $element->hasAttribute(self::NATIONAL_PREFIX) ? $element->getAttribute(self::NATIONAL_PREFIX) : ''; }
php
public static function getNationalPrefix(\DOMElement $element) { return $element->hasAttribute(self::NATIONAL_PREFIX) ? $element->getAttribute(self::NATIONAL_PREFIX) : ''; }
[ "public", "static", "function", "getNationalPrefix", "(", "\\", "DOMElement", "$", "element", ")", "{", "return", "$", "element", "->", "hasAttribute", "(", "self", "::", "NATIONAL_PREFIX", ")", "?", "$", "element", "->", "getAttribute", "(", "self", "::", "...
Returns the national prefix of the provided country element. @internal @param \DOMElement $element @return string
[ "Returns", "the", "national", "prefix", "of", "the", "provided", "country", "element", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/BuildMetadataFromXml.php#L177-L180
train
giggsey/libphonenumber-for-php
build/BuildMetadataFromXml.php
BuildMetadataFromXml.loadNationalFormat
public static function loadNationalFormat( PhoneMetadata $metadata, \DOMElement $numberFormatElement, NumberFormat $format ) { self::setLeadingDigitsPatterns($numberFormatElement, $format); $format->setPattern(self::validateRE($numberFormatElement->getAttribute(self::PATTERN)...
php
public static function loadNationalFormat( PhoneMetadata $metadata, \DOMElement $numberFormatElement, NumberFormat $format ) { self::setLeadingDigitsPatterns($numberFormatElement, $format); $format->setPattern(self::validateRE($numberFormatElement->getAttribute(self::PATTERN)...
[ "public", "static", "function", "loadNationalFormat", "(", "PhoneMetadata", "$", "metadata", ",", "\\", "DOMElement", "$", "numberFormatElement", ",", "NumberFormat", "$", "format", ")", "{", "self", "::", "setLeadingDigitsPatterns", "(", "$", "numberFormatElement", ...
Extracts the pattern for the national format. @internal @param PhoneMetadata $metadata @param \DOMElement $numberFormatElement @param NumberFormat $format @throws \RuntimeException if multiple or no formats have been encountered.
[ "Extracts", "the", "pattern", "for", "the", "national", "format", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/BuildMetadataFromXml.php#L341-L356
train
giggsey/libphonenumber-for-php
build/BuildMetadataFromXml.php
BuildMetadataFromXml.loadInternationalFormat
public static function loadInternationalFormat( PhoneMetadata $metadata, \DOMElement $numberFormatElement, NumberFormat $nationalFormat ) { $intlFormat = new NumberFormat(); $intlFormatPattern = $numberFormatElement->getElementsByTagName(self::INTL_FORMAT); $hasExplic...
php
public static function loadInternationalFormat( PhoneMetadata $metadata, \DOMElement $numberFormatElement, NumberFormat $nationalFormat ) { $intlFormat = new NumberFormat(); $intlFormatPattern = $numberFormatElement->getElementsByTagName(self::INTL_FORMAT); $hasExplic...
[ "public", "static", "function", "loadInternationalFormat", "(", "PhoneMetadata", "$", "metadata", ",", "\\", "DOMElement", "$", "numberFormatElement", ",", "NumberFormat", "$", "nationalFormat", ")", "{", "$", "intlFormat", "=", "new", "NumberFormat", "(", ")", ";...
Extracts the pattern for international format. If there is no intlFormat, default to using the national format. If the intlFormat is set to "NA" the intlFormat should be ignored. @internal @param PhoneMetadata $metadata @param \DOMElement $numberFormatElement @param NumberFormat $nationalFormat @throws \RuntimeExcepti...
[ "Extracts", "the", "pattern", "for", "international", "format", ".", "If", "there", "is", "no", "intlFormat", "default", "to", "using", "the", "national", "format", ".", "If", "the", "intlFormat", "is", "set", "to", "NA", "the", "intlFormat", "should", "be",...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/BuildMetadataFromXml.php#L385-L416
train
giggsey/libphonenumber-for-php
build/BuildMetadataFromXml.php
BuildMetadataFromXml.parsePossibleLengthStringToSet
private static function parsePossibleLengthStringToSet($possibleLengthString) { if (strlen($possibleLengthString) === 0) { throw new \RuntimeException('Empty possibleLength string found.'); } $lengths = explode(',', $possibleLengthString); $lengthSet = array(); ...
php
private static function parsePossibleLengthStringToSet($possibleLengthString) { if (strlen($possibleLengthString) === 0) { throw new \RuntimeException('Empty possibleLength string found.'); } $lengths = explode(',', $possibleLengthString); $lengthSet = array(); ...
[ "private", "static", "function", "parsePossibleLengthStringToSet", "(", "$", "possibleLengthString", ")", "{", "if", "(", "strlen", "(", "$", "possibleLengthString", ")", "===", "0", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Empty possibleLength str...
Parses a possible length string into a set of the integers that are covered. @param string $possibleLengthString a string specifying the possible lengths of phone numbers. Follows this syntax: ranges or elements are separated by commas, and ranges are specified in [min-max] notation, inclusive. For example, [3-5],7,9,...
[ "Parses", "a", "possible", "length", "string", "into", "a", "set", "of", "the", "integers", "that", "are", "covered", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/BuildMetadataFromXml.php#L469-L522
train
giggsey/libphonenumber-for-php
build/BuildMetadataFromXml.php
BuildMetadataFromXml.setPossibleLengthsGeneralDesc
public static function setPossibleLengthsGeneralDesc(PhoneNumberDesc $generalDesc, $metadataId, \DOMElement $data, $isShortNumberMetadata) { $lengths = array(); $localOnlyLengths = array(); // The general description node should *always* be present if metadata for other types is // p...
php
public static function setPossibleLengthsGeneralDesc(PhoneNumberDesc $generalDesc, $metadataId, \DOMElement $data, $isShortNumberMetadata) { $lengths = array(); $localOnlyLengths = array(); // The general description node should *always* be present if metadata for other types is // p...
[ "public", "static", "function", "setPossibleLengthsGeneralDesc", "(", "PhoneNumberDesc", "$", "generalDesc", ",", "$", "metadataId", ",", "\\", "DOMElement", "$", "data", ",", "$", "isShortNumberMetadata", ")", "{", "$", "lengths", "=", "array", "(", ")", ";", ...
Sets possible lengths in the general description, derived from certain child elements @internal @param PhoneNumberDesc $generalDesc @param string $metadataId @param \DOMElement $data @param bool $isShortNumberMetadata
[ "Sets", "possible", "lengths", "in", "the", "general", "description", "derived", "from", "certain", "child", "elements" ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/BuildMetadataFromXml.php#L577-L624
train
giggsey/libphonenumber-for-php
build/BuildMetadataFromXml.php
BuildMetadataFromXml.setPossibleLengths
private static function setPossibleLengths($lengths, $localOnlyLengths, PhoneNumberDesc $parentDesc = null, PhoneNumberDesc $desc) { // We clear these fields since the metadata tends to inherit from the parent element for other // fields (via a mergeFrom). $desc->clearPossibleLength(); ...
php
private static function setPossibleLengths($lengths, $localOnlyLengths, PhoneNumberDesc $parentDesc = null, PhoneNumberDesc $desc) { // We clear these fields since the metadata tends to inherit from the parent element for other // fields (via a mergeFrom). $desc->clearPossibleLength(); ...
[ "private", "static", "function", "setPossibleLengths", "(", "$", "lengths", ",", "$", "localOnlyLengths", ",", "PhoneNumberDesc", "$", "parentDesc", "=", "null", ",", "PhoneNumberDesc", "$", "desc", ")", "{", "// We clear these fields since the metadata tends to inherit f...
Sets the possible length fields in the metadata from the sets of data passed in. Checks that the length is covered by the "parent" phone number description element if one is present, and if the lengths are exactly the same as this, they are not filled in for efficiency reasons. @param array $lengths @param array $loca...
[ "Sets", "the", "possible", "length", "fields", "in", "the", "metadata", "from", "the", "sets", "of", "data", "passed", "in", ".", "Checks", "that", "the", "length", "is", "covered", "by", "the", "parent", "phone", "number", "description", "element", "if", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/BuildMetadataFromXml.php#L636-L677
train
giggsey/libphonenumber-for-php
build/GeneratePhonePrefixData.php
GeneratePhonePrefixData.parseTextFile
private function parseTextFile($filePath, \Closure $handler) { if (!file_exists($filePath) || !is_readable($filePath)) { throw new \InvalidArgumentException("File '{$filePath}' does not exist"); } $data = file($filePath); $countryData = array(); foreach ($data ...
php
private function parseTextFile($filePath, \Closure $handler) { if (!file_exists($filePath) || !is_readable($filePath)) { throw new \InvalidArgumentException("File '{$filePath}' does not exist"); } $data = file($filePath); $countryData = array(); foreach ($data ...
[ "private", "function", "parseTextFile", "(", "$", "filePath", ",", "\\", "Closure", "$", "handler", ")", "{", "if", "(", "!", "file_exists", "(", "$", "filePath", ")", "||", "!", "is_readable", "(", "$", "filePath", ")", ")", "{", "throw", "new", "\\",...
Reads phone prefix data from the provides file path and invokes the given handler for each mapping read. @param string $filePath @param \Closure $handler @return array @throws \InvalidArgumentException
[ "Reads", "phone", "prefix", "data", "from", "the", "provides", "file", "path", "and", "invokes", "the", "given", "handler", "for", "each", "mapping", "read", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/GeneratePhonePrefixData.php#L183-L214
train
giggsey/libphonenumber-for-php
build/GeneratePhonePrefixData.php
GeneratePhonePrefixData.makeDataFallbackToEnglish
private function makeDataFallbackToEnglish($textFile, &$mappings) { $englishPath = $this->getEnglishDataPath($textFile); if ($textFile == $englishPath || !file_exists($this->getFilePath($englishPath))) { return; } $countryCode = substr($textFile, 3, 2); if (!ar...
php
private function makeDataFallbackToEnglish($textFile, &$mappings) { $englishPath = $this->getEnglishDataPath($textFile); if ($textFile == $englishPath || !file_exists($this->getFilePath($englishPath))) { return; } $countryCode = substr($textFile, 3, 2); if (!ar...
[ "private", "function", "makeDataFallbackToEnglish", "(", "$", "textFile", ",", "&", "$", "mappings", ")", "{", "$", "englishPath", "=", "$", "this", "->", "getEnglishDataPath", "(", "$", "textFile", ")", ";", "if", "(", "$", "textFile", "==", "$", "english...
Compress the provided mappings according to the English data file if any. @param string $textFile @param array $mappings
[ "Compress", "the", "provided", "mappings", "according", "to", "the", "English", "data", "file", "if", "any", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/GeneratePhonePrefixData.php#L307-L324
train
giggsey/libphonenumber-for-php
build/GeneratePhonePrefixData.php
GeneratePhonePrefixData.getPhonePrefixLanguagePairFromFilename
private function getPhonePrefixLanguagePairFromFilename($outputFile) { $parts = explode(DIRECTORY_SEPARATOR, $outputFile); $returnObj = new \stdClass(); $returnObj->language = $parts[0]; $returnObj->prefix = $this->getCountryCodeFromTextFileName($parts[1]); return $returnO...
php
private function getPhonePrefixLanguagePairFromFilename($outputFile) { $parts = explode(DIRECTORY_SEPARATOR, $outputFile); $returnObj = new \stdClass(); $returnObj->language = $parts[0]; $returnObj->prefix = $this->getCountryCodeFromTextFileName($parts[1]); return $returnO...
[ "private", "function", "getPhonePrefixLanguagePairFromFilename", "(", "$", "outputFile", ")", "{", "$", "parts", "=", "explode", "(", "DIRECTORY_SEPARATOR", ",", "$", "outputFile", ")", ";", "$", "returnObj", "=", "new", "\\", "stdClass", "(", ")", ";", "$", ...
Extracts the phone prefix and the language code contained in the provided file name.
[ "Extracts", "the", "phone", "prefix", "and", "the", "language", "code", "contained", "in", "the", "provided", "file", "name", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/GeneratePhonePrefixData.php#L387-L397
train
giggsey/libphonenumber-for-php
src/PhoneNumberToCarrierMapper.php
PhoneNumberToCarrierMapper.getNameForValidNumber
public function getNameForValidNumber(PhoneNumber $number, $languageCode) { $languageStr = Locale::getPrimaryLanguage($languageCode); $scriptStr = ''; $regionStr = Locale::getRegion($languageCode); return $this->prefixFileReader->getDescriptionForNumber($number, $languageStr, $scrip...
php
public function getNameForValidNumber(PhoneNumber $number, $languageCode) { $languageStr = Locale::getPrimaryLanguage($languageCode); $scriptStr = ''; $regionStr = Locale::getRegion($languageCode); return $this->prefixFileReader->getDescriptionForNumber($number, $languageStr, $scrip...
[ "public", "function", "getNameForValidNumber", "(", "PhoneNumber", "$", "number", ",", "$", "languageCode", ")", "{", "$", "languageStr", "=", "Locale", "::", "getPrimaryLanguage", "(", "$", "languageCode", ")", ";", "$", "scriptStr", "=", "''", ";", "$", "r...
Returns a carrier name for the given phone number, in the language provided. The carrier name is the one the number was originally allocated to, however if the country supports mobile number portability the number might not belong to the returned carrier anymore. If no mapping is found an empty string is returned. <p>...
[ "Returns", "a", "carrier", "name", "for", "the", "given", "phone", "number", "in", "the", "language", "provided", ".", "The", "carrier", "name", "is", "the", "one", "the", "number", "was", "originally", "allocated", "to", "however", "if", "the", "country", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberToCarrierMapper.php#L71-L78
train
giggsey/libphonenumber-for-php
src/PhoneNumberToCarrierMapper.php
PhoneNumberToCarrierMapper.isMobile
protected function isMobile($numberType) { return ($numberType === PhoneNumberType::MOBILE || $numberType === PhoneNumberType::FIXED_LINE_OR_MOBILE || $numberType === PhoneNumberType::PAGER ); }
php
protected function isMobile($numberType) { return ($numberType === PhoneNumberType::MOBILE || $numberType === PhoneNumberType::FIXED_LINE_OR_MOBILE || $numberType === PhoneNumberType::PAGER ); }
[ "protected", "function", "isMobile", "(", "$", "numberType", ")", "{", "return", "(", "$", "numberType", "===", "PhoneNumberType", "::", "MOBILE", "||", "$", "numberType", "===", "PhoneNumberType", "::", "FIXED_LINE_OR_MOBILE", "||", "$", "numberType", "===", "P...
Checks if the supplied number type supports carrier lookup. @param int $numberType A PhoneNumberType int @return bool
[ "Checks", "if", "the", "supplied", "number", "type", "supports", "carrier", "lookup", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberToCarrierMapper.php#L124-L130
train
giggsey/libphonenumber-for-php
src/ShortNumberInfo.php
ShortNumberInfo.getRegionCodesForCountryCode
protected function getRegionCodesForCountryCode($countryCallingCode) { if (!array_key_exists($countryCallingCode, $this->countryCallingCodeToRegionCodeMap)) { $regionCodes = null; } else { $regionCodes = $this->countryCallingCodeToRegionCodeMap[$countryCallingCode]; }...
php
protected function getRegionCodesForCountryCode($countryCallingCode) { if (!array_key_exists($countryCallingCode, $this->countryCallingCodeToRegionCodeMap)) { $regionCodes = null; } else { $regionCodes = $this->countryCallingCodeToRegionCodeMap[$countryCallingCode]; }...
[ "protected", "function", "getRegionCodesForCountryCode", "(", "$", "countryCallingCode", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", "countryCallingCode", ",", "$", "this", "->", "countryCallingCodeToRegionCodeMap", ")", ")", "{", "$", "regionCodes", "="...
Returns a list with teh region codes that match the specific country calling code. For non-geographical country calling codes, the region code 001 is returned. Also, in the case of no region code being found, an empty list is returned. @param int $countryCallingCode @return array
[ "Returns", "a", "list", "with", "teh", "region", "codes", "that", "match", "the", "specific", "country", "calling", "code", ".", "For", "non", "-", "geographical", "country", "calling", "codes", "the", "region", "code", "001", "is", "returned", ".", "Also", ...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/ShortNumberInfo.php#L75-L84
train
giggsey/libphonenumber-for-php
src/ShortNumberInfo.php
ShortNumberInfo.regionDialingFromMatchesNumber
protected function regionDialingFromMatchesNumber(PhoneNumber $number, $regionDialingFrom) { $regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode()); return in_array($regionDialingFrom, $regionCodes); }
php
protected function regionDialingFromMatchesNumber(PhoneNumber $number, $regionDialingFrom) { $regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode()); return in_array($regionDialingFrom, $regionCodes); }
[ "protected", "function", "regionDialingFromMatchesNumber", "(", "PhoneNumber", "$", "number", ",", "$", "regionDialingFrom", ")", "{", "$", "regionCodes", "=", "$", "this", "->", "getRegionCodesForCountryCode", "(", "$", "number", "->", "getCountryCode", "(", ")", ...
Helper method to check that the country calling code of the number matches the region it's being dialed from. @param PhoneNumber $number @param string $regionDialingFrom @return bool
[ "Helper", "method", "to", "check", "that", "the", "country", "calling", "code", "of", "the", "number", "matches", "the", "region", "it", "s", "being", "dialed", "from", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/ShortNumberInfo.php#L93-L98
train
giggsey/libphonenumber-for-php
src/ShortNumberInfo.php
ShortNumberInfo.getExampleShortNumber
public function getExampleShortNumber($regionCode) { $phoneMetadata = $this->getMetadataForRegion($regionCode); if ($phoneMetadata === null) { return ''; } /** @var PhoneNumberDesc $desc */ $desc = $phoneMetadata->getShortCode(); if ($desc !== null && $de...
php
public function getExampleShortNumber($regionCode) { $phoneMetadata = $this->getMetadataForRegion($regionCode); if ($phoneMetadata === null) { return ''; } /** @var PhoneNumberDesc $desc */ $desc = $phoneMetadata->getShortCode(); if ($desc !== null && $de...
[ "public", "function", "getExampleShortNumber", "(", "$", "regionCode", ")", "{", "$", "phoneMetadata", "=", "$", "this", "->", "getMetadataForRegion", "(", "$", "regionCode", ")", ";", "if", "(", "$", "phoneMetadata", "===", "null", ")", "{", "return", "''",...
Gets a valid short number for the specified region. @param $regionCode String the region for which an example short number is needed @return string a valid short number for the specified region. Returns an empty string when the metadata does not contain such information.
[ "Gets", "a", "valid", "short", "number", "for", "the", "specified", "region", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/ShortNumberInfo.php#L112-L125
train
giggsey/libphonenumber-for-php
src/ShortNumberInfo.php
ShortNumberInfo.getExampleShortNumberForCost
public function getExampleShortNumberForCost($regionCode, $cost) { $phoneMetadata = $this->getMetadataForRegion($regionCode); if ($phoneMetadata === null) { return ''; } /** @var PhoneNumberDesc $desc */ $desc = null; switch ($cost) { case Sho...
php
public function getExampleShortNumberForCost($regionCode, $cost) { $phoneMetadata = $this->getMetadataForRegion($regionCode); if ($phoneMetadata === null) { return ''; } /** @var PhoneNumberDesc $desc */ $desc = null; switch ($cost) { case Sho...
[ "public", "function", "getExampleShortNumberForCost", "(", "$", "regionCode", ",", "$", "cost", ")", "{", "$", "phoneMetadata", "=", "$", "this", "->", "getMetadataForRegion", "(", "$", "regionCode", ")", ";", "if", "(", "$", "phoneMetadata", "===", "null", ...
Gets a valid short number for the specified cost category. @param string $regionCode the region for which an example short number is needed @param int $cost the cost category of number that is needed @return string a valid short number for the specified region and cost category. Returns an empty string when the metada...
[ "Gets", "a", "valid", "short", "number", "for", "the", "specified", "cost", "category", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/ShortNumberInfo.php#L174-L203
train
giggsey/libphonenumber-for-php
src/ShortNumberInfo.php
ShortNumberInfo.getRegionCodeForShortNumberFromRegionList
protected function getRegionCodeForShortNumberFromRegionList(PhoneNumber $number, $regionCodes) { if (count($regionCodes) == 0) { return null; } if (count($regionCodes) == 1) { return $regionCodes[0]; } $nationalNumber = $this->getNationalSignificant...
php
protected function getRegionCodeForShortNumberFromRegionList(PhoneNumber $number, $regionCodes) { if (count($regionCodes) == 0) { return null; } if (count($regionCodes) == 1) { return $regionCodes[0]; } $nationalNumber = $this->getNationalSignificant...
[ "protected", "function", "getRegionCodeForShortNumberFromRegionList", "(", "PhoneNumber", "$", "number", ",", "$", "regionCodes", ")", "{", "if", "(", "count", "(", "$", "regionCodes", ")", "==", "0", ")", "{", "return", "null", ";", "}", "if", "(", "count",...
Helper method to get the region code for a given phone number, from a list of possible region codes. If the list contains more than one region, the first region for which the number is valid is returned. @param PhoneNumber $number @param $regionCodes @return String|null Region Code (or null if none are found)
[ "Helper", "method", "to", "get", "the", "region", "code", "for", "a", "given", "phone", "number", "from", "a", "list", "of", "possible", "region", "codes", ".", "If", "the", "list", "contains", "more", "than", "one", "region", "the", "first", "region", "...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/ShortNumberInfo.php#L342-L364
train
giggsey/libphonenumber-for-php
src/ShortNumberInfo.php
ShortNumberInfo.isValidShortNumberForRegion
public function isValidShortNumberForRegion(PhoneNumber $number, $regionDialingFrom) { if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) { return false; } $phoneMetadata = $this->getMetadataForRegion($regionDialingFrom); if ($phoneMetadata === null...
php
public function isValidShortNumberForRegion(PhoneNumber $number, $regionDialingFrom) { if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) { return false; } $phoneMetadata = $this->getMetadataForRegion($regionDialingFrom); if ($phoneMetadata === null...
[ "public", "function", "isValidShortNumberForRegion", "(", "PhoneNumber", "$", "number", ",", "$", "regionDialingFrom", ")", "{", "if", "(", "!", "$", "this", "->", "regionDialingFromMatchesNumber", "(", "$", "number", ",", "$", "regionDialingFrom", ")", ")", "{"...
Tests whether a short number matches a valid pattern in a region. Note that this doesn't verify the number is actually in use, which is impossible to tell by just looking at the number itself. @param PhoneNumber $number The Short number for which we want to test the validity @param string $regionDialingFrom the region...
[ "Tests", "whether", "a", "short", "number", "matches", "a", "valid", "pattern", "in", "a", "region", ".", "Note", "that", "this", "doesn", "t", "verify", "the", "number", "is", "actually", "in", "use", "which", "is", "impossible", "to", "tell", "by", "ju...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/ShortNumberInfo.php#L451-L473
train
giggsey/libphonenumber-for-php
src/PhoneNumberMatcher.php
PhoneNumberMatcher.limit
protected static function limit($lower, $upper) { if (($lower < 0) || ($upper <= 0) || ($upper < $lower)) { throw new \InvalidArgumentException(); } return '{' . $lower . ',' . $upper . '}'; }
php
protected static function limit($lower, $upper) { if (($lower < 0) || ($upper <= 0) || ($upper < $lower)) { throw new \InvalidArgumentException(); } return '{' . $lower . ',' . $upper . '}'; }
[ "protected", "static", "function", "limit", "(", "$", "lower", ",", "$", "upper", ")", "{", "if", "(", "(", "$", "lower", "<", "0", ")", "||", "(", "$", "upper", "<=", "0", ")", "||", "(", "$", "upper", "<", "$", "lower", ")", ")", "{", "thro...
Helper function to generate regular expression with an upper and lower limit. @param int $lower @param int $upper @return string
[ "Helper", "function", "to", "generate", "regular", "expression", "with", "an", "upper", "and", "lower", "limit", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberMatcher.php#L200-L207
train
giggsey/libphonenumber-for-php
src/PhoneNumberMatcher.php
PhoneNumberMatcher.isLatinLetter
public static function isLatinLetter($letter) { // Combining marks are a subset of non-spacing-mark. if (preg_match('/\p{L}/u', $letter) !== 1 && preg_match('/\p{Mn}/u', $letter) !== 1) { return false; } return (preg_match('/\p{Latin}/u', $letter) === 1) || (preg...
php
public static function isLatinLetter($letter) { // Combining marks are a subset of non-spacing-mark. if (preg_match('/\p{L}/u', $letter) !== 1 && preg_match('/\p{Mn}/u', $letter) !== 1) { return false; } return (preg_match('/\p{Latin}/u', $letter) === 1) || (preg...
[ "public", "static", "function", "isLatinLetter", "(", "$", "letter", ")", "{", "// Combining marks are a subset of non-spacing-mark.", "if", "(", "preg_match", "(", "'/\\p{L}/u'", ",", "$", "letter", ")", "!==", "1", "&&", "preg_match", "(", "'/\\p{Mn}/u'", ",", "...
Helper method to determine if a character is a Latin-script letter or not. For our purposes, combining marks should also return true since we assume they have been added to a preceding Latin character. @param string $letter @return bool @internal
[ "Helper", "method", "to", "determine", "if", "a", "character", "is", "a", "Latin", "-", "script", "letter", "or", "not", ".", "For", "our", "purposes", "combining", "marks", "should", "also", "return", "true", "since", "we", "assume", "they", "have", "been...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberMatcher.php#L352-L361
train
giggsey/libphonenumber-for-php
src/PhoneNumberMatcher.php
PhoneNumberMatcher.getNationalNumberGroups
protected static function getNationalNumberGroups( PhoneNumberUtil $util, PhoneNumber $number, NumberFormat $formattingPattern = null ) { if ($formattingPattern === null) { // This will be in the format +CC-DG;ext=EXT where DG represents groups of digits. $rfc...
php
protected static function getNationalNumberGroups( PhoneNumberUtil $util, PhoneNumber $number, NumberFormat $formattingPattern = null ) { if ($formattingPattern === null) { // This will be in the format +CC-DG;ext=EXT where DG represents groups of digits. $rfc...
[ "protected", "static", "function", "getNationalNumberGroups", "(", "PhoneNumberUtil", "$", "util", ",", "PhoneNumber", "$", "number", ",", "NumberFormat", "$", "formattingPattern", "=", "null", ")", "{", "if", "(", "$", "formattingPattern", "===", "null", ")", "...
Helper method to get the national-number part of a number, formatted without any national prefix, and return it as a set of digit blocks that would be formatted together. @param PhoneNumberUtil $util @param PhoneNumber $number @param NumberFormat $formattingPattern @return string[]
[ "Helper", "method", "to", "get", "the", "national", "-", "number", "part", "of", "a", "number", "formatted", "without", "any", "national", "prefix", "and", "return", "it", "as", "a", "set", "of", "digit", "blocks", "that", "would", "be", "formatted", "toge...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumberMatcher.php#L625-L649
train
giggsey/libphonenumber-for-php
src/PhoneNumber.php
PhoneNumber.clear
public function clear() { $this->clearCountryCode(); $this->clearNationalNumber(); $this->clearExtension(); $this->clearItalianLeadingZero(); $this->clearNumberOfLeadingZeros(); $this->clearRawInput(); $this->clearCountryCodeSource(); $this->clearPrefe...
php
public function clear() { $this->clearCountryCode(); $this->clearNationalNumber(); $this->clearExtension(); $this->clearItalianLeadingZero(); $this->clearNumberOfLeadingZeros(); $this->clearRawInput(); $this->clearCountryCodeSource(); $this->clearPrefe...
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "clearCountryCode", "(", ")", ";", "$", "this", "->", "clearNationalNumber", "(", ")", ";", "$", "this", "->", "clearExtension", "(", ")", ";", "$", "this", "->", "clearItalianLeadingZero", ...
Clears this phone number. This effectively resets this phone number to the state of a new instance. @return PhoneNumber This PhoneNumber instance, for chaining method calls.
[ "Clears", "this", "phone", "number", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumber.php#L103-L114
train
giggsey/libphonenumber-for-php
src/PhoneNumber.php
PhoneNumber.mergeFrom
public function mergeFrom(PhoneNumber $other) { if ($other->hasCountryCode()) { $this->setCountryCode($other->getCountryCode()); } if ($other->hasNationalNumber()) { $this->setNationalNumber($other->getNationalNumber()); } if ($other->hasExtension()) {...
php
public function mergeFrom(PhoneNumber $other) { if ($other->hasCountryCode()) { $this->setCountryCode($other->getCountryCode()); } if ($other->hasNationalNumber()) { $this->setNationalNumber($other->getNationalNumber()); } if ($other->hasExtension()) {...
[ "public", "function", "mergeFrom", "(", "PhoneNumber", "$", "other", ")", "{", "if", "(", "$", "other", "->", "hasCountryCode", "(", ")", ")", "{", "$", "this", "->", "setCountryCode", "(", "$", "other", "->", "getCountryCode", "(", ")", ")", ";", "}",...
Merges the information from another phone number into this phone number. @param PhoneNumber $other The phone number to copy. @return PhoneNumber This PhoneNumber instance, for chaining method calls.
[ "Merges", "the", "information", "from", "another", "phone", "number", "into", "this", "phone", "number", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumber.php#L212-L239
train
giggsey/libphonenumber-for-php
src/PhoneNumber.php
PhoneNumber.setNumberOfLeadingZeros
public function setNumberOfLeadingZeros($value) { $this->hasNumberOfLeadingZeros = true; $this->numberOfLeadingZeros = (int) $value; return $this; }
php
public function setNumberOfLeadingZeros($value) { $this->hasNumberOfLeadingZeros = true; $this->numberOfLeadingZeros = (int) $value; return $this; }
[ "public", "function", "setNumberOfLeadingZeros", "(", "$", "value", ")", "{", "$", "this", "->", "hasNumberOfLeadingZeros", "=", "true", ";", "$", "this", "->", "numberOfLeadingZeros", "=", "(", "int", ")", "$", "value", ";", "return", "$", "this", ";", "}...
Sets the number of leading zeros of this phone number. @param int $value The number of leading zeros. @return PhoneNumber This PhoneNumber instance, for chaining method calls.
[ "Sets", "the", "number", "of", "leading", "zeros", "of", "this", "phone", "number", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumber.php#L400-L405
train
giggsey/libphonenumber-for-php
src/PhoneNumber.php
PhoneNumber.equals
public function equals(PhoneNumber $other) { $sameType = get_class($other) == get_class($this); $sameCountry = $this->hasCountryCode() == $other->hasCountryCode() && (!$this->hasCountryCode() || $this->getCountryCode() == $other->getCountryCode()); $sameNational = $this->hasNatio...
php
public function equals(PhoneNumber $other) { $sameType = get_class($other) == get_class($this); $sameCountry = $this->hasCountryCode() == $other->hasCountryCode() && (!$this->hasCountryCode() || $this->getCountryCode() == $other->getCountryCode()); $sameNational = $this->hasNatio...
[ "public", "function", "equals", "(", "PhoneNumber", "$", "other", ")", "{", "$", "sameType", "=", "get_class", "(", "$", "other", ")", "==", "get_class", "(", "$", "this", ")", ";", "$", "sameCountry", "=", "$", "this", "->", "hasCountryCode", "(", ")"...
Returns whether this phone number is equal to another. @param PhoneNumber $other The phone number to compare. @return bool True if the phone numbers are equal, false otherwise.
[ "Returns", "whether", "this", "phone", "number", "is", "equal", "to", "another", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/PhoneNumber.php#L513-L533
train
giggsey/libphonenumber-for-php
build/GenerateTimeZonesMapData.php
GenerateTimeZonesMapData.parseTextFile
private function parseTextFile() { $data = file($this->inputTextFile); $timeZoneMap = array(); foreach ($data as $line) { // Remove \n $line = str_replace(array("\n", "\r"), '', $line); $line = trim($line); if (strlen($line) == 0 || substr($...
php
private function parseTextFile() { $data = file($this->inputTextFile); $timeZoneMap = array(); foreach ($data as $line) { // Remove \n $line = str_replace(array("\n", "\r"), '', $line); $line = trim($line); if (strlen($line) == 0 || substr($...
[ "private", "function", "parseTextFile", "(", ")", "{", "$", "data", "=", "file", "(", "$", "this", "->", "inputTextFile", ")", ";", "$", "timeZoneMap", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "line", ")", "{", "// Remove ...
Reads phone prefix data from the provided input stream and returns a SortedMap with the prefix to time zones mappings.
[ "Reads", "phone", "prefix", "data", "from", "the", "provided", "input", "stream", "and", "returns", "a", "SortedMap", "with", "the", "prefix", "to", "time", "zones", "mappings", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/build/GenerateTimeZonesMapData.php#L47-L74
train
giggsey/libphonenumber-for-php
src/geocoding/PhoneNumberOfflineGeocoder.php
PhoneNumberOfflineGeocoder.getDescriptionForNumber
public function getDescriptionForNumber(PhoneNumber $number, $locale, $userRegion = null) { $numberType = $this->phoneUtil->getNumberType($number); if ($numberType === PhoneNumberType::UNKNOWN) { return ''; } if (!$this->phoneUtil->isNumberGeographical($numberType, $num...
php
public function getDescriptionForNumber(PhoneNumber $number, $locale, $userRegion = null) { $numberType = $this->phoneUtil->getNumberType($number); if ($numberType === PhoneNumberType::UNKNOWN) { return ''; } if (!$this->phoneUtil->isNumberGeographical($numberType, $num...
[ "public", "function", "getDescriptionForNumber", "(", "PhoneNumber", "$", "number", ",", "$", "locale", ",", "$", "userRegion", "=", "null", ")", "{", "$", "numberType", "=", "$", "this", "->", "phoneUtil", "->", "getNumberType", "(", "$", "number", ")", "...
As per getDescriptionForValidNumber, but explicitly checks the validity of the number passed in. @see getDescriptionForValidNumber @param PhoneNumber $number a valid phone number for which we want to get a text description @param string $locale the language code for which the description should be written @param stri...
[ "As", "per", "getDescriptionForValidNumber", "but", "explicitly", "checks", "the", "validity", "of", "the", "number", "passed", "in", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/geocoding/PhoneNumberOfflineGeocoder.php#L76-L89
train
giggsey/libphonenumber-for-php
src/geocoding/PhoneNumberOfflineGeocoder.php
PhoneNumberOfflineGeocoder.getCountryNameForNumber
protected function getCountryNameForNumber(PhoneNumber $number, $locale) { $regionCodes = $this->phoneUtil->getRegionCodesForCountryCode($number->getCountryCode()); if (count($regionCodes) === 1) { return $this->getRegionDisplayName($regionCodes[0], $locale); } $regionW...
php
protected function getCountryNameForNumber(PhoneNumber $number, $locale) { $regionCodes = $this->phoneUtil->getRegionCodesForCountryCode($number->getCountryCode()); if (count($regionCodes) === 1) { return $this->getRegionDisplayName($regionCodes[0], $locale); } $regionW...
[ "protected", "function", "getCountryNameForNumber", "(", "PhoneNumber", "$", "number", ",", "$", "locale", ")", "{", "$", "regionCodes", "=", "$", "this", "->", "phoneUtil", "->", "getRegionCodesForCountryCode", "(", "$", "number", "->", "getCountryCode", "(", "...
Returns the customary display name in the given language for the given territory the phone number is from. If it could be from many territories, nothing is returned. @param PhoneNumber $number @param string $locale @return string
[ "Returns", "the", "customary", "display", "name", "in", "the", "given", "language", "for", "the", "given", "territory", "the", "phone", "number", "is", "from", ".", "If", "it", "could", "be", "from", "many", "territories", "nothing", "is", "returned", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/geocoding/PhoneNumberOfflineGeocoder.php#L99-L120
train
giggsey/libphonenumber-for-php
src/geocoding/PhoneNumberOfflineGeocoder.php
PhoneNumberOfflineGeocoder.getRegionDisplayName
protected function getRegionDisplayName($regionCode, $locale) { if ($regionCode === null || $regionCode == 'ZZ' || $regionCode === PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY) { return ''; } return Locale::getDisplayRegion( '-' . $regionCode, $locale ...
php
protected function getRegionDisplayName($regionCode, $locale) { if ($regionCode === null || $regionCode == 'ZZ' || $regionCode === PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY) { return ''; } return Locale::getDisplayRegion( '-' . $regionCode, $locale ...
[ "protected", "function", "getRegionDisplayName", "(", "$", "regionCode", ",", "$", "locale", ")", "{", "if", "(", "$", "regionCode", "===", "null", "||", "$", "regionCode", "==", "'ZZ'", "||", "$", "regionCode", "===", "PhoneNumberUtil", "::", "REGION_CODE_FOR...
Returns the customary display name in the given language for the given region. @param $regionCode @param $locale @return string
[ "Returns", "the", "customary", "display", "name", "in", "the", "given", "language", "for", "the", "given", "region", "." ]
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/geocoding/PhoneNumberOfflineGeocoder.php#L129-L139
train
giggsey/libphonenumber-for-php
src/geocoding/PhoneNumberOfflineGeocoder.php
PhoneNumberOfflineGeocoder.getDescriptionForValidNumber
public function getDescriptionForValidNumber(PhoneNumber $number, $locale, $userRegion = null) { // If the user region matches the number's region, then we just show the lower-level // description, if one exists - if no description exists, we will show the region(country) name // for the num...
php
public function getDescriptionForValidNumber(PhoneNumber $number, $locale, $userRegion = null) { // If the user region matches the number's region, then we just show the lower-level // description, if one exists - if no description exists, we will show the region(country) name // for the num...
[ "public", "function", "getDescriptionForValidNumber", "(", "PhoneNumber", "$", "number", ",", "$", "locale", ",", "$", "userRegion", "=", "null", ")", "{", "// If the user region matches the number's region, then we just show the lower-level", "// description, if one exists - if ...
Returns a text description for the given phone number, in the language provided. The description might consist of the name of the country where the phone number is from, or the name of the geographical area the phone number is from if more detailed information is available. <p>This method assumes the validity of the n...
[ "Returns", "a", "text", "description", "for", "the", "given", "phone", "number", "in", "the", "language", "provided", ".", "The", "description", "might", "consist", "of", "the", "name", "of", "the", "country", "where", "the", "phone", "number", "is", "from",...
98f5983a33d704eafea7cc6e1cc2581883a51ddc
https://github.com/giggsey/libphonenumber-for-php/blob/98f5983a33d704eafea7cc6e1cc2581883a51ddc/src/geocoding/PhoneNumberOfflineGeocoder.php#L170-L205
train
yiisoft/yii-core
src/helpers/BaseIpHelper.php
BaseIpHelper.expandIPv6
public static function expandIPv6($ip) { $addr = inet_pton($ip); if ($addr === false) { return false; } $hex = unpack('H*hex', $addr); return substr(preg_replace('/([a-f0-9]{4})/i', '$1:', $hex['hex']), 0, -1); }
php
public static function expandIPv6($ip) { $addr = inet_pton($ip); if ($addr === false) { return false; } $hex = unpack('H*hex', $addr); return substr(preg_replace('/([a-f0-9]{4})/i', '$1:', $hex['hex']), 0, -1); }
[ "public", "static", "function", "expandIPv6", "(", "$", "ip", ")", "{", "$", "addr", "=", "inet_pton", "(", "$", "ip", ")", ";", "if", "(", "$", "addr", "===", "false", ")", "{", "return", "false", ";", "}", "$", "hex", "=", "unpack", "(", "'H*he...
Expands an IPv6 address to it's full notation. For example `2001:db8::1` will be expanded to `2001:0db8:0000:0000:0000:0000:0000:0001` @param string $ip the original valid IPv6 address @return string|false the expanded IPv6 address; or boolean false, if IP address parsing failed
[ "Expands", "an", "IPv6", "address", "to", "it", "s", "full", "notation", "." ]
50c9eb923394c822d86bfc954cf026a7396bc95a
https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseIpHelper.php#L94-L103
train
yiisoft/yii-core
src/mail/Template.php
Template.compose
public function compose(MessageInterface $message, $params = []) { $this->message = $message; if (is_array($this->viewName)) { if (isset($this->viewName['html'])) { $html = $this->render($this->viewName['html'], $params, $this->htmlLayout); } if (...
php
public function compose(MessageInterface $message, $params = []) { $this->message = $message; if (is_array($this->viewName)) { if (isset($this->viewName['html'])) { $html = $this->render($this->viewName['html'], $params, $this->htmlLayout); } if (...
[ "public", "function", "compose", "(", "MessageInterface", "$", "message", ",", "$", "params", "=", "[", "]", ")", "{", "$", "this", "->", "message", "=", "$", "message", ";", "if", "(", "is_array", "(", "$", "this", "->", "viewName", ")", ")", "{", ...
Composes the given mail message according to this template. @param MessageInterface $message the message to be composed. @param array $params the parameters (name-value pairs) that will be extracted and made available in the view file.
[ "Composes", "the", "given", "mail", "message", "according", "to", "this", "template", "." ]
50c9eb923394c822d86bfc954cf026a7396bc95a
https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/mail/Template.php#L79-L112
train