repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
ericpoe/haystack | src/HString.php | HString.offsetSet | public function offsetSet($offset, $value)
{
$this->str = $this->getPrefix($offset) . $value . $this->getSuffix($offset);
} | php | public function offsetSet($offset, $value)
{
$this->str = $this->getPrefix($offset) . $value . $this->getSuffix($offset);
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"str",
"=",
"$",
"this",
"->",
"getPrefix",
"(",
"$",
"offset",
")",
".",
"$",
"value",
".",
"$",
"this",
"->",
"getSuffix",
"(",
"$",
"offset",
... | (PHP 5 >= 5.0.0)<br/>
Offset to set
@link http://php.net/manual/en/arrayaccess.offsetset.php
@param mixed $offset <p>
The offset to assign the value to.
</p>
@param mixed $value <p>
The value to set.
</p>
@return void | [
"(",
"PHP",
"5",
">",
";",
"=",
"5",
".",
"0",
".",
"0",
")",
"<br",
"/",
">",
"Offset",
"to",
"set"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L98-L101 |
ericpoe/haystack | src/HString.php | HString.offsetUnset | public function offsetUnset($offset)
{
$this->str = $this->getPrefix($offset) . chr(0x00) . $this->getSuffix($offset);
} | php | public function offsetUnset($offset)
{
$this->str = $this->getPrefix($offset) . chr(0x00) . $this->getSuffix($offset);
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"offset",
")",
"{",
"$",
"this",
"->",
"str",
"=",
"$",
"this",
"->",
"getPrefix",
"(",
"$",
"offset",
")",
".",
"chr",
"(",
"0x00",
")",
".",
"$",
"this",
"->",
"getSuffix",
"(",
"$",
"offset",
")",
... | (PHP 5 >= 5.0.0)<br/>
Offset to unset
@link http://php.net/manual/en/arrayaccess.offsetunset.php
@param mixed $offset <p>
The offset to unset.
</p>
@return void | [
"(",
"PHP",
"5",
">",
";",
"=",
"5",
".",
"0",
".",
"0",
")",
"<br",
"/",
">",
"Offset",
"to",
"unset"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L113-L116 |
ericpoe/haystack | src/HString.php | HString.unserialize | public function unserialize($value)
{
if ($value === null || is_scalar($value)) {
$this->str = unserialize($value);
} else {
throw new \InvalidArgumentException(sprintf('HString cannot unserialize a %s', Helper::getType($value)));
}
} | php | public function unserialize($value)
{
if ($value === null || is_scalar($value)) {
$this->str = unserialize($value);
} else {
throw new \InvalidArgumentException(sprintf('HString cannot unserialize a %s', Helper::getType($value)));
}
} | [
"public",
"function",
"unserialize",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
"||",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"str",
"=",
"unserialize",
"(",
"$",
"value",
")",
";",
"}",
"else",
... | (PHP 5 >= 5.1.0)<br/>
Constructs the object
@link http://php.net/manual/en/serializable.unserialize.php
@param null|string $value <p>
The string representation of the object.
</p>
@return void | [
"(",
"PHP",
"5",
">",
";",
"=",
"5",
".",
"1",
".",
"0",
")",
"<br",
"/",
">",
"Constructs",
"the",
"object"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L150-L157 |
ericpoe/haystack | src/HString.php | HString.toHArray | public function toHArray($delim = '', $limit = null)
{
if (empty($this->str)) {
return new HArray();
}
$arr = new StringToArray($this->str, $delim);
return new HArray($arr->stringToArray($limit));
} | php | public function toHArray($delim = '', $limit = null)
{
if (empty($this->str)) {
return new HArray();
}
$arr = new StringToArray($this->str, $delim);
return new HArray($arr->stringToArray($limit));
} | [
"public",
"function",
"toHArray",
"(",
"$",
"delim",
"=",
"''",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"str",
")",
")",
"{",
"return",
"new",
"HArray",
"(",
")",
";",
"}",
"$",
"arr",
"=",
"new",
... | Alias to PHP function `explode`
@param string $delim
@param null|int $limit
@return HArray
@throws \InvalidArgumentException | [
"Alias",
"to",
"PHP",
"function",
"explode"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L273-L281 |
ericpoe/haystack | src/HString.php | HString.insert | public function insert($value, $key = null)
{
$answer = new HStringInsert($this);
return new static($answer->insert($value, $key));
} | php | public function insert($value, $key = null)
{
$answer = new HStringInsert($this);
return new static($answer->insert($value, $key));
} | [
"public",
"function",
"insert",
"(",
"$",
"value",
",",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"answer",
"=",
"new",
"HStringInsert",
"(",
"$",
"this",
")",
";",
"return",
"new",
"static",
"(",
"$",
"answer",
"->",
"insert",
"(",
"$",
"value",
","... | @inheritdoc
@param string $value
@param int|null $key
@return HString
@throws \InvalidArgumentException | [
"@inheritdoc"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L331-L335 |
ericpoe/haystack | src/HString.php | HString.slice | public function slice($start, $length = null)
{
$answer = new HStringSlice($this);
return new static($answer->slice($start, $length));
} | php | public function slice($start, $length = null)
{
$answer = new HStringSlice($this);
return new static($answer->slice($start, $length));
} | [
"public",
"function",
"slice",
"(",
"$",
"start",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"answer",
"=",
"new",
"HStringSlice",
"(",
"$",
"this",
")",
";",
"return",
"new",
"static",
"(",
"$",
"answer",
"->",
"slice",
"(",
"$",
"start",
","... | @inheritdoc
@param int $start
@param int $length
@return HString
@throws \InvalidArgumentException | [
"@inheritdoc"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L358-L362 |
ericpoe/haystack | src/HString.php | HString.map | public function map(callable $func)
{
$containers = array_slice(func_get_args(), 1); // remove `$func`
$haystack = $this->toHArray();
if (empty($containers)) {
return new static((new HArray((new HaystackMap($haystack))->map($func)))->toHString());
}
return new s... | php | public function map(callable $func)
{
$containers = array_slice(func_get_args(), 1); // remove `$func`
$haystack = $this->toHArray();
if (empty($containers)) {
return new static((new HArray((new HaystackMap($haystack))->map($func)))->toHString());
}
return new s... | [
"public",
"function",
"map",
"(",
"callable",
"$",
"func",
")",
"{",
"$",
"containers",
"=",
"array_slice",
"(",
"func_get_args",
"(",
")",
",",
"1",
")",
";",
"// remove `$func`",
"$",
"haystack",
"=",
"$",
"this",
"->",
"toHArray",
"(",
")",
";",
"if... | @inheritdoc
@param callable $func
@return HString | [
"@inheritdoc"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L370-L380 |
ericpoe/haystack | src/HString.php | HString.filter | public function filter(callable $func = null, $flag = null)
{
$answer = new Filter($this->toHArray());
return new static((new HArray($answer->filter($func, $flag)))->toHString());
} | php | public function filter(callable $func = null, $flag = null)
{
$answer = new Filter($this->toHArray());
return new static((new HArray($answer->filter($func, $flag)))->toHString());
} | [
"public",
"function",
"filter",
"(",
"callable",
"$",
"func",
"=",
"null",
",",
"$",
"flag",
"=",
"null",
")",
"{",
"$",
"answer",
"=",
"new",
"Filter",
"(",
"$",
"this",
"->",
"toHArray",
"(",
")",
")",
";",
"return",
"new",
"static",
"(",
"(",
... | @inheritdoc
@return HString
@throws \InvalidArgumentException | [
"@inheritdoc"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L400-L404 |
ericpoe/haystack | src/HString.php | HString.reduce | public function reduce(callable $func, $initial = null)
{
$answer = new HaystackReduce($this->toArray());
return $answer->reduce($func, $initial);
} | php | public function reduce(callable $func, $initial = null)
{
$answer = new HaystackReduce($this->toArray());
return $answer->reduce($func, $initial);
} | [
"public",
"function",
"reduce",
"(",
"callable",
"$",
"func",
",",
"$",
"initial",
"=",
"null",
")",
"{",
"$",
"answer",
"=",
"new",
"HaystackReduce",
"(",
"$",
"this",
"->",
"toArray",
"(",
")",
")",
";",
"return",
"$",
"answer",
"->",
"reduce",
"("... | @inheritdoc
@param callable $func
@param mixed $initial
@return bool|float|int|HString|HArray | [
"@inheritdoc"
] | train | https://github.com/ericpoe/haystack/blob/92c9ec4698fd013c1465efa6d49bc844a5869be0/src/HString.php#L413-L417 |
huasituo/hstcms | src/Console/Commands/HstcmsInstallCommand.php | HstcmsInstallCommand.handle | public function handle()
{
$boolData = $this->option('data');
$this->call('migrate', [
'--force' => true
]);
$this->call('db:seed');
$seedListsClass = [
'CommonConfig', 'CommonRole', 'ManageMenu', 'CommonRoleUri'
];
if($seedListsClass) ... | php | public function handle()
{
$boolData = $this->option('data');
$this->call('migrate', [
'--force' => true
]);
$this->call('db:seed');
$seedListsClass = [
'CommonConfig', 'CommonRole', 'ManageMenu', 'CommonRoleUri'
];
if($seedListsClass) ... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"boolData",
"=",
"$",
"this",
"->",
"option",
"(",
"'data'",
")",
";",
"$",
"this",
"->",
"call",
"(",
"'migrate'",
",",
"[",
"'--force'",
"=>",
"true",
"]",
")",
";",
"$",
"this",
"->",
"call",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HstcmsInstallCommand.php#L49-L80 |
activecollab/databasemigrations | src/Command/Create.php | Create.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$old_umask = umask(0);
try {
$name = $this->getMigrationName($input);
if (empty($name)) {
throw new \InvalidArgumentException('Migration name is required');
}
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$old_umask = umask(0);
try {
$name = $this->getMigrationName($input);
if (empty($name)) {
throw new \InvalidArgumentException('Migration name is required');
}
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"old_umask",
"=",
"umask",
"(",
"0",
")",
";",
"try",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getMigrationName",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasemigrations/blob/ef91d5b5f74d79b4a75695393eb25c7c47dad093/src/Command/Create.php#L25-L69 |
activecollab/databasemigrations | src/Command/Create.php | Create.getMigrationFileContents | private function getMigrationFileContents($class_name)
{
$namespace = $this->getNamespace();
$contents = [
'<?php',
'',
];
if ($header_comment = $this->getHeaderComment()) {
$contents[] = '/*';
$contents = array_merge($contents, array... | php | private function getMigrationFileContents($class_name)
{
$namespace = $this->getNamespace();
$contents = [
'<?php',
'',
];
if ($header_comment = $this->getHeaderComment()) {
$contents[] = '/*';
$contents = array_merge($contents, array... | [
"private",
"function",
"getMigrationFileContents",
"(",
"$",
"class_name",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"getNamespace",
"(",
")",
";",
"$",
"contents",
"=",
"[",
"'<?php'",
",",
"''",
",",
"]",
";",
"if",
"(",
"$",
"header_comment"... | Generate migration class contents.
@param string $class_name
@return string | [
"Generate",
"migration",
"class",
"contents",
"."
] | train | https://github.com/activecollab/databasemigrations/blob/ef91d5b5f74d79b4a75695393eb25c7c47dad093/src/Command/Create.php#L77-L125 |
opis/storages | session/Redis.php | Redis.write | public function write($id, $data)
{
$this->redis->set($this->prefix . $id, $data);
$this->redis->expire($this->prefix . $id, $this->maxLifetime);
return true;
} | php | public function write($id, $data)
{
$this->redis->set($this->prefix . $id, $data);
$this->redis->expire($this->prefix . $id, $this->maxLifetime);
return true;
} | [
"public",
"function",
"write",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"redis",
"->",
"set",
"(",
"$",
"this",
"->",
"prefix",
".",
"$",
"id",
",",
"$",
"data",
")",
";",
"$",
"this",
"->",
"redis",
"->",
"expire",
"(",
... | Writes data to the session.
@param string $id Session id
@param string $data Session data
@return boolean | [
"Writes",
"data",
"to",
"the",
"session",
"."
] | train | https://github.com/opis/storages/blob/548dd631239c7cd75c04d17878b677e646540fde/session/Redis.php#L94-L101 |
kiwiz/ecl | src/Command/Elasticsearch.php | Elasticsearch.setSettings | public function setSettings(array $settings) {
$this->settings = $settings;
$hosts = \ECL\Util::get($settings, 'hosts', []);
$index_hosts = \ECL\Util::get($settings, 'index_hosts', []);
$ssl_cert = \ECL\Util::get($settings, 'ssl_cert', null);
$ssl_client_key = \ECL\Util::get($se... | php | public function setSettings(array $settings) {
$this->settings = $settings;
$hosts = \ECL\Util::get($settings, 'hosts', []);
$index_hosts = \ECL\Util::get($settings, 'index_hosts', []);
$ssl_cert = \ECL\Util::get($settings, 'ssl_cert', null);
$ssl_client_key = \ECL\Util::get($se... | [
"public",
"function",
"setSettings",
"(",
"array",
"$",
"settings",
")",
"{",
"$",
"this",
"->",
"settings",
"=",
"$",
"settings",
";",
"$",
"hosts",
"=",
"\\",
"ECL",
"\\",
"Util",
"::",
"get",
"(",
"$",
"settings",
",",
"'hosts'",
",",
"[",
"]",
... | Set the current list of settings.
@param array $settings List of settings to apply. | [
"Set",
"the",
"current",
"list",
"of",
"settings",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Command/Elasticsearch.php#L51-L87 |
kiwiz/ecl | src/Command/Elasticsearch.php | Elasticsearch.constructQuery | private function constructQuery(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, array $settings=[]) {
foreach($settings as $key=>$val) {
$settings[$key] = $table->resolve($val);
}
$from = \ECL\Util::get($settings, 'from');
$to = \ECL\Util::g... | php | private function constructQuery(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, array $settings=[]) {
foreach($settings as $key=>$val) {
$settings[$key] = $table->resolve($val);
}
$from = \ECL\Util::get($settings, 'from');
$to = \ECL\Util::g... | [
"private",
"function",
"constructQuery",
"(",
"\\",
"ECL",
"\\",
"SymbolTable",
"$",
"table",
",",
"array",
"$",
"filters",
",",
"\\",
"ECL",
"\\",
"Command",
"\\",
"Elasticsearch",
"\\",
"Agg",
"$",
"agg",
"=",
"null",
",",
"array",
"$",
"settings",
"="... | Construct the query portion of the request body. | [
"Construct",
"the",
"query",
"portion",
"of",
"the",
"request",
"body",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Command/Elasticsearch.php#L133-L172 |
kiwiz/ecl | src/Command/Elasticsearch.php | Elasticsearch.constructQueryBody | private function constructQueryBody(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, $fields=null, $sort=null, $size=null, $date_field=null, $from=null, $to=null) {
$query_body = [
'size' => 100,
'query' => [
'bool' => [
... | php | private function constructQueryBody(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, $fields=null, $sort=null, $size=null, $date_field=null, $from=null, $to=null) {
$query_body = [
'size' => 100,
'query' => [
'bool' => [
... | [
"private",
"function",
"constructQueryBody",
"(",
"\\",
"ECL",
"\\",
"SymbolTable",
"$",
"table",
",",
"array",
"$",
"filters",
",",
"\\",
"ECL",
"\\",
"Command",
"\\",
"Elasticsearch",
"\\",
"Agg",
"$",
"agg",
"=",
"null",
",",
"$",
"fields",
"=",
"null... | Construct the query body. | [
"Construct",
"the",
"query",
"body",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Command/Elasticsearch.php#L177-L212 |
kiwiz/ecl | src/Command/Elasticsearch.php | Elasticsearch.constructFilter | private function constructFilter(\ECL\SymbolTable $table, $filters, $date_field, $from, $to) {
$filters = $this->resolveFilter($table, $filters);
// Optionally set date range filter.
if(!is_null($date_field)) {
$filter = ['range' => [$date_field => [
'gte' => $from,
... | php | private function constructFilter(\ECL\SymbolTable $table, $filters, $date_field, $from, $to) {
$filters = $this->resolveFilter($table, $filters);
// Optionally set date range filter.
if(!is_null($date_field)) {
$filter = ['range' => [$date_field => [
'gte' => $from,
... | [
"private",
"function",
"constructFilter",
"(",
"\\",
"ECL",
"\\",
"SymbolTable",
"$",
"table",
",",
"$",
"filters",
",",
"$",
"date_field",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"filters",
"=",
"$",
"this",
"->",
"resolveFilter",
"(",
"$",
... | Construct the filters within the query. | [
"Construct",
"the",
"filters",
"within",
"the",
"query",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Command/Elasticsearch.php#L217-L235 |
kiwiz/ecl | src/Command/Elasticsearch.php | Elasticsearch.query | public function query($query_data, $query_settings) {
$result_set = [];
if($query_settings['scroll']) {
$query_data['scroll'] = self::CUR_TTL;
$response = $this->client->search($query_data);
do {
if(!array_key_exists('_scroll_id', $response)) {
... | php | public function query($query_data, $query_settings) {
$result_set = [];
if($query_settings['scroll']) {
$query_data['scroll'] = self::CUR_TTL;
$response = $this->client->search($query_data);
do {
if(!array_key_exists('_scroll_id', $response)) {
... | [
"public",
"function",
"query",
"(",
"$",
"query_data",
",",
"$",
"query_settings",
")",
"{",
"$",
"result_set",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"query_settings",
"[",
"'scroll'",
"]",
")",
"{",
"$",
"query_data",
"[",
"'scroll'",
"]",
"=",
"self",
... | Send the query off to Elasticsearch and get the raw results back.
@param array $query_data The query body.
@param array $query_settings The query settings.
@return array Raw results. | [
"Send",
"the",
"query",
"off",
"to",
"Elasticsearch",
"and",
"get",
"the",
"raw",
"results",
"back",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Command/Elasticsearch.php#L289-L314 |
kiwiz/ecl | src/Command/Elasticsearch.php | Elasticsearch.processResults | private function processResults(\ECL\SymbolTable $table, $result_set, $query_settings) {
// If no agg, we're processing hits.
if(is_null($this->agg)) {
$results = [];
$this->processHitResults($results, $result_set, $query_settings);
return $results;
}
... | php | private function processResults(\ECL\SymbolTable $table, $result_set, $query_settings) {
// If no agg, we're processing hits.
if(is_null($this->agg)) {
$results = [];
$this->processHitResults($results, $result_set, $query_settings);
return $results;
}
... | [
"private",
"function",
"processResults",
"(",
"\\",
"ECL",
"\\",
"SymbolTable",
"$",
"table",
",",
"$",
"result_set",
",",
"$",
"query_settings",
")",
"{",
"// If no agg, we're processing hits.",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"agg",
")",
")",
... | Process raw results and return parsed results. | [
"Process",
"raw",
"results",
"and",
"return",
"parsed",
"results",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Command/Elasticsearch.php#L319-L329 |
kiwiz/ecl | src/Command/Elasticsearch.php | Elasticsearch.processHitResults | private function processHitResults(&$results, $result_set, $query_settings) {
// If we're only returning hits, we can return the count here.
if($query_settings['count']) {
$results[] = ['count' => array_sum(array_map(function($x) { return $x['hits']['total']; }, $result_set))];
r... | php | private function processHitResults(&$results, $result_set, $query_settings) {
// If we're only returning hits, we can return the count here.
if($query_settings['count']) {
$results[] = ['count' => array_sum(array_map(function($x) { return $x['hits']['total']; }, $result_set))];
r... | [
"private",
"function",
"processHitResults",
"(",
"&",
"$",
"results",
",",
"$",
"result_set",
",",
"$",
"query_settings",
")",
"{",
"// If we're only returning hits, we can return the count here.",
"if",
"(",
"$",
"query_settings",
"[",
"'count'",
"]",
")",
"{",
"$"... | Process any hit results. | [
"Process",
"any",
"hit",
"results",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Command/Elasticsearch.php#L334-L352 |
activecollab/databasestructure | src/Field/Composite/CountryCodeField.php | CountryCodeField.getValidatorLines | public function getValidatorLines($indent, array &$result)
{
$result[] = $indent . '$validator->inArray(' . var_export($this->getName(), true) . ', [' . implode(', ', array_map(function ($country_code) {
return "'$country_code'";
}, $this->valid_country_codes)) . '], ' . ($this->getDefau... | php | public function getValidatorLines($indent, array &$result)
{
$result[] = $indent . '$validator->inArray(' . var_export($this->getName(), true) . ', [' . implode(', ', array_map(function ($country_code) {
return "'$country_code'";
}, $this->valid_country_codes)) . '], ' . ($this->getDefau... | [
"public",
"function",
"getValidatorLines",
"(",
"$",
"indent",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"indent",
".",
"'$validator->inArray('",
".",
"var_export",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/CountryCodeField.php#L288-L293 |
groupby/api-php | src/API/Query.php | Query.requestToJson | private function requestToJson($request)
{
$jsonRequest = null;
try {
$jsonRequest = $this->serializer->serialize($request, 'json');
} catch (RuntimeException $e) {
throw new RuntimeException('Unable to serialize request ' . var_dump($request));
}
return $jsonRequest;
} | php | private function requestToJson($request)
{
$jsonRequest = null;
try {
$jsonRequest = $this->serializer->serialize($request, 'json');
} catch (RuntimeException $e) {
throw new RuntimeException('Unable to serialize request ' . var_dump($request));
}
return $jsonRequest;
} | [
"private",
"function",
"requestToJson",
"(",
"$",
"request",
")",
"{",
"$",
"jsonRequest",
"=",
"null",
";",
"try",
"{",
"$",
"jsonRequest",
"=",
"$",
"this",
"->",
"serializer",
"->",
"serialize",
"(",
"$",
"request",
",",
"'json'",
")",
";",
"}",
"ca... | @param mixed $request
@return string | [
"@param",
"mixed",
"$request"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L100-L110 |
groupby/api-php | src/API/Query.php | Query.getBridgeRefinementsJson | public function getBridgeRefinementsJson($clientKey, $navigationName)
{
$data = new RefinementsRequest();
$data->originalQuery = $this->populateRequest($clientKey);
$data->navigationName = $navigationName;
return $this->requestToJson($data);
} | php | public function getBridgeRefinementsJson($clientKey, $navigationName)
{
$data = new RefinementsRequest();
$data->originalQuery = $this->populateRequest($clientKey);
$data->navigationName = $navigationName;
return $this->requestToJson($data);
} | [
"public",
"function",
"getBridgeRefinementsJson",
"(",
"$",
"clientKey",
",",
"$",
"navigationName",
")",
"{",
"$",
"data",
"=",
"new",
"RefinementsRequest",
"(",
")",
";",
"$",
"data",
"->",
"originalQuery",
"=",
"$",
"this",
"->",
"populateRequest",
"(",
"... | @param string $clientKey Your client key.
@param string $navigationName Name of the navigation to get refinements for
@return string JSON representation of request to Bridge. | [
"@param",
"string",
"$clientKey",
"Your",
"client",
"key",
".",
"@param",
"string",
"$navigationName",
"Name",
"of",
"the",
"navigation",
"to",
"get",
"refinements",
"for"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L129-L135 |
groupby/api-php | src/API/Query.php | Query.populateRequest | private function populateRequest($clientKey)
{
$request = new Request();
$request->clientKey = $clientKey;
$request->area = $this->area;
$request->collection = $this->collection;
$request->userId = $this->userId;
$request->query = $this->query;
$request->fields = $this->fields;
$reques... | php | private function populateRequest($clientKey)
{
$request = new Request();
$request->clientKey = $clientKey;
$request->area = $this->area;
$request->collection = $this->collection;
$request->userId = $this->userId;
$request->query = $this->query;
$request->fields = $this->fields;
$reques... | [
"private",
"function",
"populateRequest",
"(",
"$",
"clientKey",
")",
"{",
"$",
"request",
"=",
"new",
"Request",
"(",
")",
";",
"$",
"request",
"->",
"clientKey",
"=",
"$",
"clientKey",
";",
"$",
"request",
"->",
"area",
"=",
"$",
"this",
"->",
"area"... | @param string $clientKey
@return Request | [
"@param",
"string",
"$clientKey"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L142-L199 |
groupby/api-php | src/API/Query.php | Query.generateSelectedRefinements | private function generateSelectedRefinements($navigations)
{
$refinements = [];
foreach ($navigations as $key => $navigation) {
foreach ($navigation->getRefinements() as $refinement) {
switch ($refinement->getType()) {
case Type::Range: {
/** @var RefinementRange $rr */
... | php | private function generateSelectedRefinements($navigations)
{
$refinements = [];
foreach ($navigations as $key => $navigation) {
foreach ($navigation->getRefinements() as $refinement) {
switch ($refinement->getType()) {
case Type::Range: {
/** @var RefinementRange $rr */
... | [
"private",
"function",
"generateSelectedRefinements",
"(",
"$",
"navigations",
")",
"{",
"$",
"refinements",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"navigations",
"as",
"$",
"key",
"=>",
"$",
"navigation",
")",
"{",
"foreach",
"(",
"$",
"navigation",
"->... | @param Navigation[] $navigations
@return Refinement[] | [
"@param",
"Navigation",
"[]",
"$navigations"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L206-L241 |
groupby/api-php | src/API/Query.php | Query.getBridgeJsonRefinementSearch | public function getBridgeJsonRefinementSearch($clientKey)
{
$data = new Request();
$data->clientKey = $clientKey;
$data->collection = $this->collection;
$data->area = $this->area;
$data->refinementQuery = $this->query;
$wildcardSearchEnabled = $this->wildcardSearchEnabled;
if (isset($wild... | php | public function getBridgeJsonRefinementSearch($clientKey)
{
$data = new Request();
$data->clientKey = $clientKey;
$data->collection = $this->collection;
$data->area = $this->area;
$data->refinementQuery = $this->query;
$wildcardSearchEnabled = $this->wildcardSearchEnabled;
if (isset($wild... | [
"public",
"function",
"getBridgeJsonRefinementSearch",
"(",
"$",
"clientKey",
")",
"{",
"$",
"data",
"=",
"new",
"Request",
"(",
")",
";",
"$",
"data",
"->",
"clientKey",
"=",
"$",
"clientKey",
";",
"$",
"data",
"->",
"collection",
"=",
"$",
"this",
"->"... | @param string $clientKey Your client key.
@return string JSON representation of request to Bridge. | [
"@param",
"string",
"$clientKey",
"Your",
"client",
"key",
"."
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L248-L262 |
groupby/api-php | src/API/Query.php | Query.convertSort | protected static function convertSort($sort)
{
/** @var RSort $convertedSort */
$convertedSort = null;
if (!empty($sort)) {
$convertedSort = new RSort();
$convertedSort->setField($sort->getField());
switch ($sort->getOrder()) {
case MSort\Order::Ascending:
$convertedSor... | php | protected static function convertSort($sort)
{
/** @var RSort $convertedSort */
$convertedSort = null;
if (!empty($sort)) {
$convertedSort = new RSort();
$convertedSort->setField($sort->getField());
switch ($sort->getOrder()) {
case MSort\Order::Ascending:
$convertedSor... | [
"protected",
"static",
"function",
"convertSort",
"(",
"$",
"sort",
")",
"{",
"/** @var RSort $convertedSort */",
"$",
"convertedSort",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sort",
")",
")",
"{",
"$",
"convertedSort",
"=",
"new",
"RSort",
"... | @param MSort $sort
@return RSort | [
"@param",
"MSort",
"$sort"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L814-L831 |
groupby/api-php | src/API/Query.php | Query.convertPartialMatchStrategy | protected static function convertPartialMatchStrategy($strategy)
{
/** @var RMatchStrategy $convertedStrategy */
$convertedStrategy = null;
if (!empty($strategy)) {
$rules = $strategy->getRules();
if (!empty($rules)) {
$convertedStrategy = new RMatchStrategy();
/** @var MPartia... | php | protected static function convertPartialMatchStrategy($strategy)
{
/** @var RMatchStrategy $convertedStrategy */
$convertedStrategy = null;
if (!empty($strategy)) {
$rules = $strategy->getRules();
if (!empty($rules)) {
$convertedStrategy = new RMatchStrategy();
/** @var MPartia... | [
"protected",
"static",
"function",
"convertPartialMatchStrategy",
"(",
"$",
"strategy",
")",
"{",
"/** @var RMatchStrategy $convertedStrategy */",
"$",
"convertedStrategy",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"strategy",
")",
")",
"{",
"$",
"rules... | @param MMatchStrategy $strategy
@return RMatchStrategy | [
"@param",
"MMatchStrategy",
"$strategy"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L838-L854 |
groupby/api-php | src/API/Query.php | Query.convertPartialMatchRule | protected static function convertPartialMatchRule($rule)
{
/** @var RPartialMatchRule $convertedRule */
$convertedRule = null;
if (!empty($rule)) {
$convertedRule = new RPartialMatchRule();
$convertedRule->setTerms($rule->getTerms())
->setTermsGreaterThan($rule->getTermsGreaterThan()... | php | protected static function convertPartialMatchRule($rule)
{
/** @var RPartialMatchRule $convertedRule */
$convertedRule = null;
if (!empty($rule)) {
$convertedRule = new RPartialMatchRule();
$convertedRule->setTerms($rule->getTerms())
->setTermsGreaterThan($rule->getTermsGreaterThan()... | [
"protected",
"static",
"function",
"convertPartialMatchRule",
"(",
"$",
"rule",
")",
"{",
"/** @var RPartialMatchRule $convertedRule */",
"$",
"convertedRule",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"rule",
")",
")",
"{",
"$",
"convertedRule",
"=",... | @param MPartialMatchRule $rule
@return RPartialMatchRule | [
"@param",
"MPartialMatchRule",
"$rule"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L861-L873 |
groupby/api-php | src/API/Query.php | Query.convertBias | protected static function convertBias($bias)
{
return (new MBias())->setName($bias->getName())->setContent($bias->getContent())->setStrength($bias->getStrength());
} | php | protected static function convertBias($bias)
{
return (new MBias())->setName($bias->getName())->setContent($bias->getContent())->setStrength($bias->getStrength());
} | [
"protected",
"static",
"function",
"convertBias",
"(",
"$",
"bias",
")",
"{",
"return",
"(",
"new",
"MBias",
"(",
")",
")",
"->",
"setName",
"(",
"$",
"bias",
"->",
"getName",
"(",
")",
")",
"->",
"setContent",
"(",
"$",
"bias",
"->",
"getContent",
"... | @param MBias $bias
@return Bias | [
"@param",
"MBias",
"$bias"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L880-L883 |
groupby/api-php | src/API/Query.php | Query.convertBiasing | protected static function convertBiasing($biasing)
{
/** @var Biasing $convertedBiasing */
$convertedBiasing = new Biasing();
/** @var $hasData */
$hasData = false;
if (!empty($biasing)) {
// != must be used because empty() only accepts variables in PHP 5.4
if ($biasing->getBringToT... | php | protected static function convertBiasing($biasing)
{
/** @var Biasing $convertedBiasing */
$convertedBiasing = new Biasing();
/** @var $hasData */
$hasData = false;
if (!empty($biasing)) {
// != must be used because empty() only accepts variables in PHP 5.4
if ($biasing->getBringToT... | [
"protected",
"static",
"function",
"convertBiasing",
"(",
"$",
"biasing",
")",
"{",
"/** @var Biasing $convertedBiasing */",
"$",
"convertedBiasing",
"=",
"new",
"Biasing",
"(",
")",
";",
"/** @var $hasData */",
"$",
"hasData",
"=",
"false",
";",
"if",
"(",
"!",
... | @param MBiasing $biasing
@return Biasing | [
"@param",
"MBiasing",
"$biasing"
] | train | https://github.com/groupby/api-php/blob/43c31ed1f729981dd9532ce5c3efbeaaa016c147/src/API/Query.php#L900-L925 |
acasademont/wurfl | WURFL/Configuration/InMemoryConfig.php | WURFL_Configuration_InMemoryConfig.matchMode | public function matchMode($mode)
{
if (!self::validMatchMode($mode)) {
throw new WURFL_WURFLException('Invalid Match Mode: '.$mode);
}
$this->matchMode = $mode;
return $this;
} | php | public function matchMode($mode)
{
if (!self::validMatchMode($mode)) {
throw new WURFL_WURFLException('Invalid Match Mode: '.$mode);
}
$this->matchMode = $mode;
return $this;
} | [
"public",
"function",
"matchMode",
"(",
"$",
"mode",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"validMatchMode",
"(",
"$",
"mode",
")",
")",
"{",
"throw",
"new",
"WURFL_WURFLException",
"(",
"'Invalid Match Mode: '",
".",
"$",
"mode",
")",
";",
"}",
"$",
... | Sets the API match mode
@param string $mode
@return WURFL_Configuration_InMemoryConfig | [
"Sets",
"the",
"API",
"match",
"mode"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Configuration/InMemoryConfig.php#L110-L117 |
blast-project/CoreBundle | src/DependencyInjection/DefaultParameters.php | DefaultParameters.defineDefaultConfiguration | public function defineDefaultConfiguration(array $parameters)
{
foreach ($parameters as $parameterKey => $change) {
// retrieve current defined parameters
$containerParameters = $this->container->getParameter($parameterKey);
// replacing parameter only if defined in yml ... | php | public function defineDefaultConfiguration(array $parameters)
{
foreach ($parameters as $parameterKey => $change) {
// retrieve current defined parameters
$containerParameters = $this->container->getParameter($parameterKey);
// replacing parameter only if defined in yml ... | [
"public",
"function",
"defineDefaultConfiguration",
"(",
"array",
"$",
"parameters",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"parameterKey",
"=>",
"$",
"change",
")",
"{",
"// retrieve current defined parameters",
"$",
"containerParameters",
"=",
"$"... | defineDefaultConfiguration.
@param array $parameters | [
"defineDefaultConfiguration",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/DefaultParameters.php#L46-L70 |
blast-project/CoreBundle | src/DependencyInjection/DefaultParameters.php | DefaultParameters.parameterExists | public function parameterExists($name)
{
if ($this->container->hasParameter($name)) {
return $this->container->getParameter($name);
} else {
return false;
}
} | php | public function parameterExists($name)
{
if ($this->container->hasParameter($name)) {
return $this->container->getParameter($name);
} else {
return false;
}
} | [
"public",
"function",
"parameterExists",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"container",
"->",
"hasParameter",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"container",
"->",
"getParameter",
"(",
"$",
"name",
")"... | parameterExists.
@param $name
@return bool|mixed false if not defined, the parameter if exists | [
"parameterExists",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/DefaultParameters.php#L79-L86 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.build | public function build()
{
$from_file = $this->buildStored();
if (\is_string($from_file) && ! empty($from_file)) {
return $from_file;
}
return (string) $this->config['build'];
} | php | public function build()
{
$from_file = $this->buildStored();
if (\is_string($from_file) && ! empty($from_file)) {
return $from_file;
}
return (string) $this->config['build'];
} | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"from_file",
"=",
"$",
"this",
"->",
"buildStored",
"(",
")",
";",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"from_file",
")",
"&&",
"!",
"empty",
"(",
"$",
"from_file",
")",
")",
"{",
"return",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L94-L103 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.setBuild | public function setBuild($value)
{
$value = (string) $value;
if ($this->config['build'] !== $value && $this->buildStored() !== $value) {
$this->putIntoFile($this->config['build_metadata_path'], $value);
$this->setFormatted($this->formatted());
}
$this->confi... | php | public function setBuild($value)
{
$value = (string) $value;
if ($this->config['build'] !== $value && $this->buildStored() !== $value) {
$this->putIntoFile($this->config['build_metadata_path'], $value);
$this->setFormatted($this->formatted());
}
$this->confi... | [
"public",
"function",
"setBuild",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'build'",
"]",
"!==",
"$",
"value",
"&&",
"$",
"this",
"->",
"buildStored",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L108-L118 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.refresh | public function refresh()
{
$this->setBuild($this->build());
$this->forgetFormatted();
$this->setFormatted($this->formatted());
} | php | public function refresh()
{
$this->setBuild($this->build());
$this->forgetFormatted();
$this->setFormatted($this->formatted());
} | [
"public",
"function",
"refresh",
"(",
")",
"{",
"$",
"this",
"->",
"setBuild",
"(",
"$",
"this",
"->",
"build",
"(",
")",
")",
";",
"$",
"this",
"->",
"forgetFormatted",
"(",
")",
";",
"$",
"this",
"->",
"setFormatted",
"(",
"$",
"this",
"->",
"for... | {@inheritdoc} | [
"{"
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L123-L129 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.formatted | public function formatted()
{
return str_replace(
['{{major}}', '{{minor}}', '{{patch}}', '{{build}}'],
[$this->config['major'], $this->config['minor'], $this->config['patch'], $this->build()],
$this->config['format']
);
} | php | public function formatted()
{
return str_replace(
['{{major}}', '{{minor}}', '{{patch}}', '{{build}}'],
[$this->config['major'], $this->config['minor'], $this->config['patch'], $this->build()],
$this->config['format']
);
} | [
"public",
"function",
"formatted",
"(",
")",
"{",
"return",
"str_replace",
"(",
"[",
"'{{major}}'",
",",
"'{{minor}}'",
",",
"'{{patch}}'",
",",
"'{{build}}'",
"]",
",",
"[",
"$",
"this",
"->",
"config",
"[",
"'major'",
"]",
",",
"$",
"this",
"->",
"conf... | {@inheritdoc} | [
"{"
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L134-L141 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.hashed | public function hashed($length = 6)
{
$length = (int) $length;
$hash = sha1($this->formatted());
return Str::substr($hash, 0, $length > Str::length($hash)
? null
: $length);
} | php | public function hashed($length = 6)
{
$length = (int) $length;
$hash = sha1($this->formatted());
return Str::substr($hash, 0, $length > Str::length($hash)
? null
: $length);
} | [
"public",
"function",
"hashed",
"(",
"$",
"length",
"=",
"6",
")",
"{",
"$",
"length",
"=",
"(",
"int",
")",
"$",
"length",
";",
"$",
"hash",
"=",
"sha1",
"(",
"$",
"this",
"->",
"formatted",
"(",
")",
")",
";",
"return",
"Str",
"::",
"substr",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L154-L162 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.buildStored | protected function buildStored()
{
return $this->files->exists($file_path = $this->config['build_metadata_path'])
? $this->files->get($file_path, $this->use_locking)
: null;
} | php | protected function buildStored()
{
return $this->files->exists($file_path = $this->config['build_metadata_path'])
? $this->files->get($file_path, $this->use_locking)
: null;
} | [
"protected",
"function",
"buildStored",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"file_path",
"=",
"$",
"this",
"->",
"config",
"[",
"'build_metadata_path'",
"]",
")",
"?",
"$",
"this",
"->",
"files",
"->",
"get",
... | Get build value from metadata file.
@return null|string | [
"Get",
"build",
"value",
"from",
"metadata",
"file",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L169-L174 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.forgetFormatted | protected function forgetFormatted()
{
if ($this->files->exists($compiled_path = $this->config['compiled_path'])) {
return $this->files->delete($compiled_path);
}
return false;
} | php | protected function forgetFormatted()
{
if ($this->files->exists($compiled_path = $this->config['compiled_path'])) {
return $this->files->delete($compiled_path);
}
return false;
} | [
"protected",
"function",
"forgetFormatted",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"compiled_path",
"=",
"$",
"this",
"->",
"config",
"[",
"'compiled_path'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"fil... | Forget stored formatted value.
@return bool | [
"Forget",
"stored",
"formatted",
"value",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L181-L188 |
avto-dev/app-version-laravel | src/AppVersionManager.php | AppVersionManager.putIntoFile | protected function putIntoFile($file_path, $data)
{
if ($this->files->isDirectory($this->files->dirname($file_path))) {
$data = str_replace(["\n", "\r"], '', trim((string) $data));
return $this->files->put($file_path, $data, $this->use_locking) > 0;
}
// @codeCovera... | php | protected function putIntoFile($file_path, $data)
{
if ($this->files->isDirectory($this->files->dirname($file_path))) {
$data = str_replace(["\n", "\r"], '', trim((string) $data));
return $this->files->put($file_path, $data, $this->use_locking) > 0;
}
// @codeCovera... | [
"protected",
"function",
"putIntoFile",
"(",
"$",
"file_path",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"files",
"->",
"isDirectory",
"(",
"$",
"this",
"->",
"files",
"->",
"dirname",
"(",
"$",
"file_path",
")",
")",
")",
"{",
"$",
... | Write the contents of a file.
@param string $file_path
@param string $data
@return bool | [
"Write",
"the",
"contents",
"of",
"a",
"file",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionManager.php#L210-L221 |
cronario/cronario | src/Queue.php | Queue.setProducer | public function setProducer(Producer $producer)
{
if (null != $this->producer) {
throw new QueueException('Queue - producer already sets!');
}
$this->producer = $producer;
return $this;
} | php | public function setProducer(Producer $producer)
{
if (null != $this->producer) {
throw new QueueException('Queue - producer already sets!');
}
$this->producer = $producer;
return $this;
} | [
"public",
"function",
"setProducer",
"(",
"Producer",
"$",
"producer",
")",
"{",
"if",
"(",
"null",
"!=",
"$",
"this",
"->",
"producer",
")",
"{",
"throw",
"new",
"QueueException",
"(",
"'Queue - producer already sets!'",
")",
";",
"}",
"$",
"this",
"->",
... | @param Producer $producer
@return $this
@throws QueueException | [
"@param",
"Producer",
"$producer"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L63-L72 |
cronario/cronario | src/Queue.php | Queue.stop | public function stop($queueName)
{
return (bool)$this->getRedis()->hset($this->getRedisQueueStopNamespace(), $queueName, true);
} | php | public function stop($queueName)
{
return (bool)$this->getRedis()->hset($this->getRedisQueueStopNamespace(), $queueName, true);
} | [
"public",
"function",
"stop",
"(",
"$",
"queueName",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"getRedis",
"(",
")",
"->",
"hset",
"(",
"$",
"this",
"->",
"getRedisQueueStopNamespace",
"(",
")",
",",
"$",
"queueName",
",",
"true",
")",
... | @param $queueName
@return bool | [
"@param",
"$queueName"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L146-L149 |
cronario/cronario | src/Queue.php | Queue.getJobCount | public function getJobCount($queue, $state)
{
if ($state === self::STATE_READY) {
return $this->getRedis()->llen($this->getKeyReady($queue));
}
return $this->getRedis()->zcount($this->getKey($queue, $state), '-inf', '+inf');
} | php | public function getJobCount($queue, $state)
{
if ($state === self::STATE_READY) {
return $this->getRedis()->llen($this->getKeyReady($queue));
}
return $this->getRedis()->zcount($this->getKey($queue, $state), '-inf', '+inf');
} | [
"public",
"function",
"getJobCount",
"(",
"$",
"queue",
",",
"$",
"state",
")",
"{",
"if",
"(",
"$",
"state",
"===",
"self",
"::",
"STATE_READY",
")",
"{",
"return",
"$",
"this",
"->",
"getRedis",
"(",
")",
"->",
"llen",
"(",
"$",
"this",
"->",
"ge... | @param $queue
@param $state
@return int|string | [
"@param",
"$queue",
"@param",
"$state"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L216-L223 |
cronario/cronario | src/Queue.php | Queue.getStats | public function getStats()
{
$result = [
self::STATS_QUEUES_LIST => [],
self::STATS_JOBS_TOTAL => 0,
self::STATS_JOBS_READY => 0,
self::STATS_JOBS_RESERVED => 0,
self::STATS_JOBS_DELAYED => 0,
self::STATS_JOBS_BURIED => 0,
... | php | public function getStats()
{
$result = [
self::STATS_QUEUES_LIST => [],
self::STATS_JOBS_TOTAL => 0,
self::STATS_JOBS_READY => 0,
self::STATS_JOBS_RESERVED => 0,
self::STATS_JOBS_DELAYED => 0,
self::STATS_JOBS_BURIED => 0,
... | [
"public",
"function",
"getStats",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"self",
"::",
"STATS_QUEUES_LIST",
"=>",
"[",
"]",
",",
"self",
"::",
"STATS_JOBS_TOTAL",
"=>",
"0",
",",
"self",
"::",
"STATS_JOBS_READY",
"=>",
"0",
",",
"self",
"::",
"STATS_JOB... | Return statistical information about the server, across all clients.
Keys that can be expected to be returned are the following:
@return array | [
"Return",
"statistical",
"information",
"about",
"the",
"server",
"across",
"all",
"clients",
".",
"Keys",
"that",
"can",
"be",
"expected",
"to",
"be",
"returned",
"are",
"the",
"following",
":"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L231-L260 |
cronario/cronario | src/Queue.php | Queue.getQueueInfo | public function getQueueInfo($queueName)
{
$result = [
self::STATS_JOBS_READY => $this->getJobCount($queueName, self::STATE_READY),
self::STATS_JOBS_RESERVED => $this->getJobCount($queueName, self::STATE_RESERVED),
self::STATS_JOBS_DELAYED => $this->getJobCount($queue... | php | public function getQueueInfo($queueName)
{
$result = [
self::STATS_JOBS_READY => $this->getJobCount($queueName, self::STATE_READY),
self::STATS_JOBS_RESERVED => $this->getJobCount($queueName, self::STATE_RESERVED),
self::STATS_JOBS_DELAYED => $this->getJobCount($queue... | [
"public",
"function",
"getQueueInfo",
"(",
"$",
"queueName",
")",
"{",
"$",
"result",
"=",
"[",
"self",
"::",
"STATS_JOBS_READY",
"=>",
"$",
"this",
"->",
"getJobCount",
"(",
"$",
"queueName",
",",
"self",
"::",
"STATE_READY",
")",
",",
"self",
"::",
"ST... | @param $queueName
@return array | [
"@param",
"$queueName"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L268-L281 |
cronario/cronario | src/Queue.php | Queue.getPayload | protected function getPayload($id)
{
$rawPayload = $this->getRedis()->hget($this->getRedisJobNamespace(), $id);
return static::parsePayload($rawPayload);
} | php | protected function getPayload($id)
{
$rawPayload = $this->getRedis()->hget($this->getRedisJobNamespace(), $id);
return static::parsePayload($rawPayload);
} | [
"protected",
"function",
"getPayload",
"(",
"$",
"id",
")",
"{",
"$",
"rawPayload",
"=",
"$",
"this",
"->",
"getRedis",
"(",
")",
"->",
"hget",
"(",
"$",
"this",
"->",
"getRedisJobNamespace",
"(",
")",
",",
"$",
"id",
")",
";",
"return",
"static",
":... | @param $id
@return mixed | [
"@param",
"$id"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L293-L298 |
cronario/cronario | src/Queue.php | Queue.buildPayload | protected static function buildPayload($queueName, $jobState)
{
return serialize([
self::JOB_PAYLOAD_QUEUE => $queueName,
self::JOB_PAYLOAD_STATE => $jobState,
]);
} | php | protected static function buildPayload($queueName, $jobState)
{
return serialize([
self::JOB_PAYLOAD_QUEUE => $queueName,
self::JOB_PAYLOAD_STATE => $jobState,
]);
} | [
"protected",
"static",
"function",
"buildPayload",
"(",
"$",
"queueName",
",",
"$",
"jobState",
")",
"{",
"return",
"serialize",
"(",
"[",
"self",
"::",
"JOB_PAYLOAD_QUEUE",
"=>",
"$",
"queueName",
",",
"self",
"::",
"JOB_PAYLOAD_STATE",
"=>",
"$",
"jobState",... | @param $queueName string
@param $jobState string
@return string | [
"@param",
"$queueName",
"string",
"@param",
"$jobState",
"string"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L306-L312 |
cronario/cronario | src/Queue.php | Queue.getKey | protected function getKey($queue, $state = self::STATE_READY)
{
return implode(':', [$this->getRedisQueueNamespace(), $queue, $state]);
} | php | protected function getKey($queue, $state = self::STATE_READY)
{
return implode(':', [$this->getRedisQueueNamespace(), $queue, $state]);
} | [
"protected",
"function",
"getKey",
"(",
"$",
"queue",
",",
"$",
"state",
"=",
"self",
"::",
"STATE_READY",
")",
"{",
"return",
"implode",
"(",
"':'",
",",
"[",
"$",
"this",
"->",
"getRedisQueueNamespace",
"(",
")",
",",
"$",
"queue",
",",
"$",
"state",... | @param string $queue
@param string $state
@return string | [
"@param",
"string",
"$queue",
"@param",
"string",
"$state"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L353-L356 |
cronario/cronario | src/Queue.php | Queue.putJob | public function putJob($queue, $id, $delay = 0, $priority = self::PRIORITY_LOW)
{
$delay = intval($delay);
$keyReady = $this->getKeyReady($queue);
$keyDelayed = $this->getKeyDelayed($queue);
$redisJobNamespace = $this->getRedisJobNamespace();
$result = $this->getRedis()->tra... | php | public function putJob($queue, $id, $delay = 0, $priority = self::PRIORITY_LOW)
{
$delay = intval($delay);
$keyReady = $this->getKeyReady($queue);
$keyDelayed = $this->getKeyDelayed($queue);
$redisJobNamespace = $this->getRedisJobNamespace();
$result = $this->getRedis()->tra... | [
"public",
"function",
"putJob",
"(",
"$",
"queue",
",",
"$",
"id",
",",
"$",
"delay",
"=",
"0",
",",
"$",
"priority",
"=",
"self",
"::",
"PRIORITY_LOW",
")",
"{",
"$",
"delay",
"=",
"intval",
"(",
"$",
"delay",
")",
";",
"$",
"keyReady",
"=",
"$"... | @param $queue
@param $id
@param int $delay
@param string $priority
@return bool | [
"@param",
"$queue",
"@param",
"$id",
"@param",
"int",
"$delay",
"@param",
"string",
"$priority"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L421-L447 |
cronario/cronario | src/Queue.php | Queue.reserveJob | public function reserveJob($queue, $timeout = null)
{
$this->migrate($queue);
$keyReady = $this->getKeyReady($queue);
$keyReserved = $this->getKeyReserved($queue);
if ($this->isStop($queue)) {
return null;
}
if ($timeout > 0) {
$id = $this->g... | php | public function reserveJob($queue, $timeout = null)
{
$this->migrate($queue);
$keyReady = $this->getKeyReady($queue);
$keyReserved = $this->getKeyReserved($queue);
if ($this->isStop($queue)) {
return null;
}
if ($timeout > 0) {
$id = $this->g... | [
"public",
"function",
"reserveJob",
"(",
"$",
"queue",
",",
"$",
"timeout",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"migrate",
"(",
"$",
"queue",
")",
";",
"$",
"keyReady",
"=",
"$",
"this",
"->",
"getKeyReady",
"(",
"$",
"queue",
")",
";",
"$",
... | @param $queue
@param null $timeout
@return null|string | [
"@param",
"$queue",
"@param",
"null",
"$timeout"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L455-L487 |
cronario/cronario | src/Queue.php | Queue.deleteJob | public function deleteJob($id)
{
$payload = $this->getPayload($id);
if (!in_array($payload[self::JOB_PAYLOAD_STATE], [self::STATE_RESERVED, self::STATE_BURIED])) {
return true;
}
$keyBuried = $this->getKeyBuried($payload[self::JOB_PAYLOAD_QUEUE]);
$keyReserved =... | php | public function deleteJob($id)
{
$payload = $this->getPayload($id);
if (!in_array($payload[self::JOB_PAYLOAD_STATE], [self::STATE_RESERVED, self::STATE_BURIED])) {
return true;
}
$keyBuried = $this->getKeyBuried($payload[self::JOB_PAYLOAD_QUEUE]);
$keyReserved =... | [
"public",
"function",
"deleteJob",
"(",
"$",
"id",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"getPayload",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"payload",
"[",
"self",
"::",
"JOB_PAYLOAD_STATE",
"]",
",",
"[",
"se... | @param $id
@return bool | [
"@param",
"$id"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L494-L516 |
cronario/cronario | src/Queue.php | Queue.buryJob | public function buryJob($id)
{
$payload = $this->getPayload($id);
if ($payload[self::JOB_PAYLOAD_STATE] !== self::STATE_RESERVED) {
throw new QueueException(' Cannot bury state unsupported!' . $payload[self::JOB_PAYLOAD_STATE]);
}
$redisJobNamespace = $this->getRedisJob... | php | public function buryJob($id)
{
$payload = $this->getPayload($id);
if ($payload[self::JOB_PAYLOAD_STATE] !== self::STATE_RESERVED) {
throw new QueueException(' Cannot bury state unsupported!' . $payload[self::JOB_PAYLOAD_STATE]);
}
$redisJobNamespace = $this->getRedisJob... | [
"public",
"function",
"buryJob",
"(",
"$",
"id",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"getPayload",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"payload",
"[",
"self",
"::",
"JOB_PAYLOAD_STATE",
"]",
"!==",
"self",
"::",
"STATE_RESERVED",
... | @param $id
@return bool
@throws QueueException | [
"@param",
"$id"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L524-L547 |
cronario/cronario | src/Queue.php | Queue.kickJob | public function kickJob($id)
{
$payload = $this->getPayload($id);
if ($payload[self::JOB_PAYLOAD_STATE] !== self::STATE_BURIED) {
throw new QueueException(' Cannot kick state unsupported!' . $payload[self::JOB_PAYLOAD_STATE]);
}
$keyReady = $this->getKeyReady($payload[s... | php | public function kickJob($id)
{
$payload = $this->getPayload($id);
if ($payload[self::JOB_PAYLOAD_STATE] !== self::STATE_BURIED) {
throw new QueueException(' Cannot kick state unsupported!' . $payload[self::JOB_PAYLOAD_STATE]);
}
$keyReady = $this->getKeyReady($payload[s... | [
"public",
"function",
"kickJob",
"(",
"$",
"id",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"getPayload",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"payload",
"[",
"self",
"::",
"JOB_PAYLOAD_STATE",
"]",
"!==",
"self",
"::",
"STATE_BURIED",
")... | @param $id
@return bool
@throws QueueException | [
"@param",
"$id"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L555-L578 |
cronario/cronario | src/Queue.php | Queue.releaseJob | public function releaseJob($id, $delay = 0)
{
$payload = $this->getPayload($id);
if ($payload[self::JOB_PAYLOAD_STATE] !== self::STATE_RESERVED) {
throw new QueueException(' Cannot release state unsupported! ' . $payload[self::JOB_PAYLOAD_STATE]);
}
$keyReady = $this->g... | php | public function releaseJob($id, $delay = 0)
{
$payload = $this->getPayload($id);
if ($payload[self::JOB_PAYLOAD_STATE] !== self::STATE_RESERVED) {
throw new QueueException(' Cannot release state unsupported! ' . $payload[self::JOB_PAYLOAD_STATE]);
}
$keyReady = $this->g... | [
"public",
"function",
"releaseJob",
"(",
"$",
"id",
",",
"$",
"delay",
"=",
"0",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"getPayload",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"payload",
"[",
"self",
"::",
"JOB_PAYLOAD_STATE",
"]",
"!=="... | @param $id
@param int $delay
@return bool
@throws QueueException | [
"@param",
"$id",
"@param",
"int",
"$delay"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L587-L620 |
cronario/cronario | src/Queue.php | Queue.migrate | public function migrate($queue = null)
{
if (null === $queue) {
$list = $this->getQueueNames();
foreach ($list as $item) {
$this->migrate($item);
}
return true;
}
$keyReady = $this->getKeyReady($queue);
$keyDelayed = $... | php | public function migrate($queue = null)
{
if (null === $queue) {
$list = $this->getQueueNames();
foreach ($list as $item) {
$this->migrate($item);
}
return true;
}
$keyReady = $this->getKeyReady($queue);
$keyDelayed = $... | [
"public",
"function",
"migrate",
"(",
"$",
"queue",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"queue",
")",
"{",
"$",
"list",
"=",
"$",
"this",
"->",
"getQueueNames",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"item",
")",... | @param null $queue
@return bool | [
"@param",
"null",
"$queue"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Queue.php#L631-L668 |
jan-dolata/crude-crud | src/Engine/Traits/WithPermissionTrait.php | WithPermissionTrait._checkPermission | private function _checkPermission($name, $attribute)
{
if ($name == 'store') {
return $this->permissionStore($attribute);
}
if ($name == 'update') {
return $this->permissionUpdate($attribute);
}
if ($name == 'delete') {
return $this->perm... | php | private function _checkPermission($name, $attribute)
{
if ($name == 'store') {
return $this->permissionStore($attribute);
}
if ($name == 'update') {
return $this->permissionUpdate($attribute);
}
if ($name == 'delete') {
return $this->perm... | [
"private",
"function",
"_checkPermission",
"(",
"$",
"name",
",",
"$",
"attribute",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"'store'",
")",
"{",
"return",
"$",
"this",
"->",
"permissionStore",
"(",
"$",
"attribute",
")",
";",
"}",
"if",
"(",
"$",
"na... | Check permission by name
@param string $name
@param mixed $attribute
@return boolean | [
"Check",
"permission",
"by",
"name"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/WithPermissionTrait.php#L59-L82 |
jan-dolata/crude-crud | src/Engine/Traits/WithPermissionTrait.php | WithPermissionTrait._checkOption | private function _checkOption($name)
{
if ($name == 'list')
return true;
$names = [
'store' => 'add',
'update' => 'edit',
'delete' => 'delete',
'order' => 'order',
'export' => 'export'
];
return $this->crudeSet... | php | private function _checkOption($name)
{
if ($name == 'list')
return true;
$names = [
'store' => 'add',
'update' => 'edit',
'delete' => 'delete',
'order' => 'order',
'export' => 'export'
];
return $this->crudeSet... | [
"private",
"function",
"_checkOption",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"==",
"'list'",
")",
"return",
"true",
";",
"$",
"names",
"=",
"[",
"'store'",
"=>",
"'add'",
",",
"'update'",
"=>",
"'edit'",
",",
"'delete'",
"=>",
"'delete'",... | Check option by name
@param string $name
@return boolean | [
"Check",
"option",
"by",
"name"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/WithPermissionTrait.php#L89-L103 |
jan-dolata/crude-crud | src/Engine/Traits/WithPermissionTrait.php | WithPermissionTrait._formatName | private function _formatName($name)
{
$name = strtolower($name);
if (in_array($name, ['store', 'add']))
return 'store';
if (in_array($name, ['update', 'edit', 'change']))
return 'update';
if (in_array($name, ['delete', 'remove', 'destroy']))
ret... | php | private function _formatName($name)
{
$name = strtolower($name);
if (in_array($name, ['store', 'add']))
return 'store';
if (in_array($name, ['update', 'edit', 'change']))
return 'update';
if (in_array($name, ['delete', 'remove', 'destroy']))
ret... | [
"private",
"function",
"_formatName",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"[",
"'store'",
",",
"'add'",
"]",
")",
")",
"return",
"'store'",
";",
"if",... | Format name to one of [store, update, delete, list]
@param string $name
@return string | [
"Format",
"name",
"to",
"one",
"of",
"[",
"store",
"update",
"delete",
"list",
"]"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/WithPermissionTrait.php#L125-L148 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/UrlGenerator.php | UrlGenerator.to | public function to($path, $extra = [], $secure = null)
{
$url = $baseUrl = home_url($path, $this->getSchemeForUrl($secure));
if (!empty($extra)) {
$url = $baseUrl . '?' . http_build_query($extra);
}
return $url;
} | php | public function to($path, $extra = [], $secure = null)
{
$url = $baseUrl = home_url($path, $this->getSchemeForUrl($secure));
if (!empty($extra)) {
$url = $baseUrl . '?' . http_build_query($extra);
}
return $url;
} | [
"public",
"function",
"to",
"(",
"$",
"path",
",",
"$",
"extra",
"=",
"[",
"]",
",",
"$",
"secure",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"baseUrl",
"=",
"home_url",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"getSchemeForUrl",
"(",
"$",
... | Generate an absolute URL to the given path.
@param string $path
@param mixed $extra
@param bool $secure
@return string | [
"Generate",
"an",
"absolute",
"URL",
"to",
"the",
"given",
"path",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/UrlGenerator.php#L48-L57 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/UrlGenerator.php | UrlGenerator.getScheme | protected function getScheme($secure)
{
if (is_null($secure)) {
return $this->forceSchema ?: $this->plugin->make('request')->getScheme().'://';
}
return $secure ? 'https://' : 'http://';
} | php | protected function getScheme($secure)
{
if (is_null($secure)) {
return $this->forceSchema ?: $this->plugin->make('request')->getScheme().'://';
}
return $secure ? 'https://' : 'http://';
} | [
"protected",
"function",
"getScheme",
"(",
"$",
"secure",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"secure",
")",
")",
"{",
"return",
"$",
"this",
"->",
"forceSchema",
"?",
":",
"$",
"this",
"->",
"plugin",
"->",
"make",
"(",
"'request'",
")",
"->",... | Get the scheme for a raw URL.
@param bool|null $secure
@return string | [
"Get",
"the",
"scheme",
"for",
"a",
"raw",
"URL",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/UrlGenerator.php#L65-L72 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/UrlGenerator.php | UrlGenerator.getSchemeForUrl | protected function getSchemeForUrl($secure)
{
if (is_null($secure)) {
if (is_null($this->cachedScheme)) {
$this->cachedScheme = $this->plugin->make('request')->getScheme().'://';
}
return $this->cachedScheme;
}
return $secure ? 'https://' : 'http://';
} | php | protected function getSchemeForUrl($secure)
{
if (is_null($secure)) {
if (is_null($this->cachedScheme)) {
$this->cachedScheme = $this->plugin->make('request')->getScheme().'://';
}
return $this->cachedScheme;
}
return $secure ? 'https://' : 'http://';
} | [
"protected",
"function",
"getSchemeForUrl",
"(",
"$",
"secure",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"secure",
")",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"cachedScheme",
")",
")",
"{",
"$",
"this",
"->",
"cachedScheme",
"=",
"$... | Get the scheme for a raw URL.
@param bool|null $secure
@return string | [
"Get",
"the",
"scheme",
"for",
"a",
"raw",
"URL",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/UrlGenerator.php#L80-L91 |
phramework/validate | src/BaseValidator.php | BaseValidator.validateCommon | protected function validateCommon($value, $validateResult)
{
//While current status of validation is true,
//keep validating against common keywords
//validate against enum using validateEnum
if ($validateResult->status === true && $this->enum) {
$validateResult = $this-... | php | protected function validateCommon($value, $validateResult)
{
//While current status of validation is true,
//keep validating against common keywords
//validate against enum using validateEnum
if ($validateResult->status === true && $this->enum) {
$validateResult = $this-... | [
"protected",
"function",
"validateCommon",
"(",
"$",
"value",
",",
"$",
"validateResult",
")",
"{",
"//While current status of validation is true,",
"//keep validating against common keywords",
"//validate against enum using validateEnum",
"if",
"(",
"$",
"validateResult",
"->",
... | Common helper method to validate against all common keywords
@uses validateEnum
@param mixed $value Value to validate
@param ValidateResult $validateResult Current ValidateResult status
@return ValidateResult | [
"Common",
"helper",
"method",
"to",
"validate",
"against",
"all",
"common",
"keywords"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L77-L103 |
phramework/validate | src/BaseValidator.php | BaseValidator.validateEnum | protected function validateEnum($value, $parsedValue)
{
$return = new ValidateResult($parsedValue, false);
//Check if $this->enum is set and it's not null since its optional
if ($this->enum !== null) {
if (is_object($value)) {
throw new \Exception('Objects are no... | php | protected function validateEnum($value, $parsedValue)
{
$return = new ValidateResult($parsedValue, false);
//Check if $this->enum is set and it's not null since its optional
if ($this->enum !== null) {
if (is_object($value)) {
throw new \Exception('Objects are no... | [
"protected",
"function",
"validateEnum",
"(",
"$",
"value",
",",
"$",
"parsedValue",
")",
"{",
"$",
"return",
"=",
"new",
"ValidateResult",
"(",
"$",
"parsedValue",
",",
"false",
")",
";",
"//Check if $this->enum is set and it's not null since its optional",
"if",
"... | Common helper method to validate against "enum" keyword
@see 5.5.1. enum http://json-schema.org/latest/json-schema-validation.html#anchor75
@param mixed $value Value to validate
@param mixed $value Parsed value from previous validators
@return ValidateResult
@todo provide support for objects and arrays | [
"Common",
"helper",
"method",
"to",
"validate",
"against",
"enum",
"keyword"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L133-L189 |
phramework/validate | src/BaseValidator.php | BaseValidator.validateNot | protected function validateNot($value, $parsedValue)
{
$return = new ValidateResult($parsedValue, true);
//Check if $this->not is set and it's not null since its optional
if ($this->not && $this->not !== null) {
if (!is_subclass_of(
$this->not,
Ba... | php | protected function validateNot($value, $parsedValue)
{
$return = new ValidateResult($parsedValue, true);
//Check if $this->not is set and it's not null since its optional
if ($this->not && $this->not !== null) {
if (!is_subclass_of(
$this->not,
Ba... | [
"protected",
"function",
"validateNot",
"(",
"$",
"value",
",",
"$",
"parsedValue",
")",
"{",
"$",
"return",
"=",
"new",
"ValidateResult",
"(",
"$",
"parsedValue",
",",
"true",
")",
";",
"//Check if $this->not is set and it's not null since its optional",
"if",
"(",... | Common helper method to validate against "not" keyword
@param mixed $value Value to validate
@param mixed $value Parsed value from previous validators
@return ValidateResult
@throws \Exception | [
"Common",
"helper",
"method",
"to",
"validate",
"against",
"not",
"keyword"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L198-L231 |
phramework/validate | src/BaseValidator.php | BaseValidator.parse | public function parse($value)
{
$validateResult = $this->validate($value);
if (!$validateResult->status) {
throw $validateResult->errorObject;
}
$typeCastedValue = $validateResult->value;
return $typeCastedValue;
} | php | public function parse($value)
{
$validateResult = $this->validate($value);
if (!$validateResult->status) {
throw $validateResult->errorObject;
}
$typeCastedValue = $validateResult->value;
return $typeCastedValue;
} | [
"public",
"function",
"parse",
"(",
"$",
"value",
")",
"{",
"$",
"validateResult",
"=",
"$",
"this",
"->",
"validate",
"(",
"$",
"value",
")",
";",
"if",
"(",
"!",
"$",
"validateResult",
"->",
"status",
")",
"{",
"throw",
"$",
"validateResult",
"->",
... | This method use this validator to parse data from $value argument
and return a clean object
@param mixed $value Input value to validate
@throws \Phramework\Exceptions\MissingParametersException
@throws \Phramework\Exceptions\IncorrectParametersException
@return mixed | [
"This",
"method",
"use",
"this",
"validator",
"to",
"parse",
"data",
"from",
"$value",
"argument",
"and",
"return",
"a",
"clean",
"object"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L453-L464 |
phramework/validate | src/BaseValidator.php | BaseValidator.registerValidator | public static function registerValidator($type, $className)
{
if (!is_string($type)) {
throw new \Exception('"type" MUST be string');
}
if (!is_string($className)) {
throw new \Exception('"className" MUST be string');
}
if (!is_subclass_of(
... | php | public static function registerValidator($type, $className)
{
if (!is_string($type)) {
throw new \Exception('"type" MUST be string');
}
if (!is_string($className)) {
throw new \Exception('"className" MUST be string');
}
if (!is_subclass_of(
... | [
"public",
"static",
"function",
"registerValidator",
"(",
"$",
"type",
",",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'\"type\" MUST be string'",
")",
";",
"}",
"if"... | Register a custom validator for a type
@param string $type Type's name, `x-` SHOULD be used for custom types
@param string $className Validator's full classname.
All validators MUST extend `BaseValidator` class
@example
```php
BaseValidator::registerValidator('x-address', 'My\APP\AddressValidator');
```
@throws ... | [
"Register",
"a",
"custom",
"validator",
"for",
"a",
"type"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L504-L526 |
phramework/validate | src/BaseValidator.php | BaseValidator.createFromObjectForAdditional | protected static function createFromObjectForAdditional($object)
{
$indexProperty = null;
$class = null;
if (property_exists($object, 'anyOf')) {
$indexProperty = 'anyOf';
$class = AnyOf::class;
} elseif (property_exists($object, 'allOf')) {
$inde... | php | protected static function createFromObjectForAdditional($object)
{
$indexProperty = null;
$class = null;
if (property_exists($object, 'anyOf')) {
$indexProperty = 'anyOf';
$class = AnyOf::class;
} elseif (property_exists($object, 'allOf')) {
$inde... | [
"protected",
"static",
"function",
"createFromObjectForAdditional",
"(",
"$",
"object",
")",
"{",
"$",
"indexProperty",
"=",
"null",
";",
"$",
"class",
"=",
"null",
";",
"if",
"(",
"property_exists",
"(",
"$",
"object",
",",
"'anyOf'",
")",
")",
"{",
"$",
... | Helper method.
Used to create anyOf, allOf and oneOf validators from objects
@param object $object Validation object
@return AnyOf|AllOf|OneOf|null | [
"Helper",
"method",
".",
"Used",
"to",
"create",
"anyOf",
"allOf",
"and",
"oneOf",
"validators",
"from",
"objects"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L534-L560 |
phramework/validate | src/BaseValidator.php | BaseValidator.createFromObject | public static function createFromObject($object)
{
$isFromBase = (static::class === self::class);
if (!is_object($object)) {
throw new \Exception('Expecting an object');
}
//Test type if it's set
if (property_exists($object, 'type') && !empty($object->type)) {
... | php | public static function createFromObject($object)
{
$isFromBase = (static::class === self::class);
if (!is_object($object)) {
throw new \Exception('Expecting an object');
}
//Test type if it's set
if (property_exists($object, 'type') && !empty($object->type)) {
... | [
"public",
"static",
"function",
"createFromObject",
"(",
"$",
"object",
")",
"{",
"$",
"isFromBase",
"=",
"(",
"static",
"::",
"class",
"===",
"self",
"::",
"class",
")",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"... | Create validator from validation object
@param object $object Validation object
@return BaseValidator
@todo cleanup class loading
@throws \Exception When validator class cannot be found for object's type | [
"Create",
"validator",
"from",
"validation",
"object"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L569-L662 |
phramework/validate | src/BaseValidator.php | BaseValidator.createFromJSON | public static function createFromJSON($json)
{
$object = json_decode($json);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception(
'JSON parse had errors - ' . json_last_error_msg()
);
}
return static::createFromObject($object);
... | php | public static function createFromJSON($json)
{
$object = json_decode($json);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception(
'JSON parse had errors - ' . json_last_error_msg()
);
}
return static::createFromObject($object);
... | [
"public",
"static",
"function",
"createFromJSON",
"(",
"$",
"json",
")",
"{",
"$",
"object",
"=",
"json_decode",
"(",
"$",
"json",
")",
";",
"if",
"(",
"json_last_error",
"(",
")",
"!==",
"JSON_ERROR_NONE",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(... | Create validator from validation object encoded as json object
@param string $json Validation json encoded object
@return BaseValidator
@throws \Exception when JSON sting is not well formed | [
"Create",
"validator",
"from",
"validation",
"object",
"encoded",
"as",
"json",
"object"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L681-L692 |
phramework/validate | src/BaseValidator.php | BaseValidator.toJSON | public function toJSON($JSON_PRETTY_PRINT = false)
{
$object = $this->toObject();
/*foreach ($object as $key => &$attribute) {
//Check if any of attributes is an instance of BaseValidator
if (is_object($attribute) && is_a($attribute, BaseValidator::class)) {
... | php | public function toJSON($JSON_PRETTY_PRINT = false)
{
$object = $this->toObject();
/*foreach ($object as $key => &$attribute) {
//Check if any of attributes is an instance of BaseValidator
if (is_object($attribute) && is_a($attribute, BaseValidator::class)) {
... | [
"public",
"function",
"toJSON",
"(",
"$",
"JSON_PRETTY_PRINT",
"=",
"false",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"toObject",
"(",
")",
";",
"/*foreach ($object as $key => &$attribute) {\n //Check if any of attributes is an instance of BaseValidator\n ... | Export validator to json encoded string
@param boolean $JSON_PRETTY_PRINT *[Optional]*
@return string | [
"Export",
"validator",
"to",
"json",
"encoded",
"string"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L699-L714 |
phramework/validate | src/BaseValidator.php | BaseValidator.toObject | public function toObject()
{
$object = $this->toArray();
//fix type to object
if (isset($object['properties'])) {
$object['properties'] = (object)$object['properties'];
}
foreach (['anyOf', 'allOf', 'oneOf', 'not'] as $property) {
//fix type to objec... | php | public function toObject()
{
$object = $this->toArray();
//fix type to object
if (isset($object['properties'])) {
$object['properties'] = (object)$object['properties'];
}
foreach (['anyOf', 'allOf', 'oneOf', 'not'] as $property) {
//fix type to objec... | [
"public",
"function",
"toObject",
"(",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"toArray",
"(",
")",
";",
"//fix type to object",
"if",
"(",
"isset",
"(",
"$",
"object",
"[",
"'properties'",
"]",
")",
")",
"{",
"$",
"object",
"[",
"'properties'... | Export validator to object
@return object | [
"Export",
"validator",
"to",
"object"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L720-L739 |
phramework/validate | src/BaseValidator.php | BaseValidator.toArray | public function toArray()
{
$object = [];
if (static::$type) {
$object['type'] = static::$type;
}
$attributes = array_merge(
static::getTypeAttributes(),
static::$commonAttributes
);
foreach ($attributes as $attribute) {
... | php | public function toArray()
{
$object = [];
if (static::$type) {
$object['type'] = static::$type;
}
$attributes = array_merge(
static::getTypeAttributes(),
static::$commonAttributes
);
foreach ($attributes as $attribute) {
... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"object",
"=",
"[",
"]",
";",
"if",
"(",
"static",
"::",
"$",
"type",
")",
"{",
"$",
"object",
"[",
"'type'",
"]",
"=",
"static",
"::",
"$",
"type",
";",
"}",
"$",
"attributes",
"=",
"array_mer... | Export validator to array
@return array | [
"Export",
"validator",
"to",
"array"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/BaseValidator.php#L745-L799 |
tjbp/laravel-verify-emails | src/Auth/VerifyEmails/VerifyEmailBroker.php | VerifyEmailBroker.sendVerificationLink | public function sendVerificationLink(CanVerifyEmailContract $user, Closure $callback = null)
{
// Once we have the verify token, we are ready to send the message out to this
// user with a link to verify their email. We will then redirect back to
// the current URI having nothing set in the ... | php | public function sendVerificationLink(CanVerifyEmailContract $user, Closure $callback = null)
{
// Once we have the verify token, we are ready to send the message out to this
// user with a link to verify their email. We will then redirect back to
// the current URI having nothing set in the ... | [
"public",
"function",
"sendVerificationLink",
"(",
"CanVerifyEmailContract",
"$",
"user",
",",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"// Once we have the verify token, we are ready to send the message out to this",
"// user with a link to verify their email. We will then... | Send an email verification link to a user.
@param \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail $user
@param \Closure|null $callback
@return string | [
"Send",
"an",
"email",
"verification",
"link",
"to",
"a",
"user",
"."
] | train | https://github.com/tjbp/laravel-verify-emails/blob/1e2ac10a696c10f2fdf0d7de6c3388d549bc07c6/src/Auth/VerifyEmails/VerifyEmailBroker.php#L55-L65 |
tjbp/laravel-verify-emails | src/Auth/VerifyEmails/VerifyEmailBroker.php | VerifyEmailBroker.emailVerificationLink | public function emailVerificationLink(CanVerifyEmailContract $user, $token, Closure $callback = null)
{
// We will use the view that was given to the broker to display the
// verification e-mail. We'll pass a "token" variable into the views
// so that it may be displayed for an user to click... | php | public function emailVerificationLink(CanVerifyEmailContract $user, $token, Closure $callback = null)
{
// We will use the view that was given to the broker to display the
// verification e-mail. We'll pass a "token" variable into the views
// so that it may be displayed for an user to click... | [
"public",
"function",
"emailVerificationLink",
"(",
"CanVerifyEmailContract",
"$",
"user",
",",
"$",
"token",
",",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"// We will use the view that was given to the broker to display the",
"// verification e-mail. We'll pass a \"t... | Send the email verification link via e-mail.
@param \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail $user
@param string $token
@param \Closure|null $callback
@return int | [
"Send",
"the",
"email",
"verification",
"link",
"via",
"e",
"-",
"mail",
"."
] | train | https://github.com/tjbp/laravel-verify-emails/blob/1e2ac10a696c10f2fdf0d7de6c3388d549bc07c6/src/Auth/VerifyEmails/VerifyEmailBroker.php#L75-L89 |
tjbp/laravel-verify-emails | src/Auth/VerifyEmails/VerifyEmailBroker.php | VerifyEmailBroker.verify | public function verify(CanVerifyEmailContract $user, $token)
{
// If the responses from the validate method is not a user instance, we will
// assume that it is a redirect and simply return it from this method and
// the user is properly redirected having an error message on the post.
... | php | public function verify(CanVerifyEmailContract $user, $token)
{
// If the responses from the validate method is not a user instance, we will
// assume that it is a redirect and simply return it from this method and
// the user is properly redirected having an error message on the post.
... | [
"public",
"function",
"verify",
"(",
"CanVerifyEmailContract",
"$",
"user",
",",
"$",
"token",
")",
"{",
"// If the responses from the validate method is not a user instance, we will",
"// assume that it is a redirect and simply return it from this method and",
"// the user is properly r... | Verify the email address for the given token.
@param \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail $user
@param string $token
@return mixed | [
"Verify",
"the",
"email",
"address",
"for",
"the",
"given",
"token",
"."
] | train | https://github.com/tjbp/laravel-verify-emails/blob/1e2ac10a696c10f2fdf0d7de6c3388d549bc07c6/src/Auth/VerifyEmails/VerifyEmailBroker.php#L98-L116 |
tjbp/laravel-verify-emails | src/Auth/VerifyEmails/VerifyEmailBroker.php | VerifyEmailBroker.validateVerification | protected function validateVerification(CanVerifyEmailContract $user, $token)
{
if (! $this->tokens->exists($user, $token)) {
return VerifyEmailBrokerContract::INVALID_TOKEN;
}
return $user;
} | php | protected function validateVerification(CanVerifyEmailContract $user, $token)
{
if (! $this->tokens->exists($user, $token)) {
return VerifyEmailBrokerContract::INVALID_TOKEN;
}
return $user;
} | [
"protected",
"function",
"validateVerification",
"(",
"CanVerifyEmailContract",
"$",
"user",
",",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"tokens",
"->",
"exists",
"(",
"$",
"user",
",",
"$",
"token",
")",
")",
"{",
"return",
"VerifyEm... | Validate a verification for the given credentials.
@param \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail $user
@param string $token
@return \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail | [
"Validate",
"a",
"verification",
"for",
"the",
"given",
"credentials",
"."
] | train | https://github.com/tjbp/laravel-verify-emails/blob/1e2ac10a696c10f2fdf0d7de6c3388d549bc07c6/src/Auth/VerifyEmails/VerifyEmailBroker.php#L125-L132 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableMigrateRefreshCommand.php | PluggableMigrateRefreshCommand.fire | public function fire()
{
if (!$this->confirmToProceed()) {
return;
}
$pluggable = $this->argument('pluggable');
$moduleName = Str::studly($pluggable);
$this->call('pluggables:migrate:reset', [
'module' => $pluggable,
'--database' => $... | php | public function fire()
{
if (!$this->confirmToProceed()) {
return;
}
$pluggable = $this->argument('pluggable');
$moduleName = Str::studly($pluggable);
$this->call('pluggables:migrate:reset', [
'module' => $pluggable,
'--database' => $... | [
"public",
"function",
"fire",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirmToProceed",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"pluggable",
"=",
"$",
"this",
"->",
"argument",
"(",
"'pluggable'",
")",
";",
"$",
"moduleName",
"=",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableMigrateRefreshCommand.php#L38-L68 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableMigrateRefreshCommand.php | PluggableMigrateRefreshCommand.runSeeder | protected function runSeeder($module = null, $database = null)
{
$this->call('pluggables:seed', [
'pluggable' => $this->argument('pluggable'),
'--database' => $database,
]);
} | php | protected function runSeeder($module = null, $database = null)
{
$this->call('pluggables:seed', [
'pluggable' => $this->argument('pluggable'),
'--database' => $database,
]);
} | [
"protected",
"function",
"runSeeder",
"(",
"$",
"module",
"=",
"null",
",",
"$",
"database",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"call",
"(",
"'pluggables:seed'",
",",
"[",
"'pluggable'",
"=>",
"$",
"this",
"->",
"argument",
"(",
"'pluggable'",
")"... | Run the module seeder command.
@param string $database
@return void | [
"Run",
"the",
"module",
"seeder",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableMigrateRefreshCommand.php#L87-L93 |
hrevert/HtUserRegistration | src/Controller/UserRegistrationController.php | UserRegistrationController.verifyEmailAction | public function verifyEmailAction()
{
$userId = $this->params()->fromRoute('userId', null);
$token = $this->params()->fromRoute('token', null);
if ($userId === null || $token === null) {
return $this->notFoundAction();
}
$user = $this->getUserMapper()->findById(... | php | public function verifyEmailAction()
{
$userId = $this->params()->fromRoute('userId', null);
$token = $this->params()->fromRoute('token', null);
if ($userId === null || $token === null) {
return $this->notFoundAction();
}
$user = $this->getUserMapper()->findById(... | [
"public",
"function",
"verifyEmailAction",
"(",
")",
"{",
"$",
"userId",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'userId'",
",",
"null",
")",
";",
"$",
"token",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute... | Verifies user`s email address and redirects to login route | [
"Verifies",
"user",
"s",
"email",
"address",
"and",
"redirects",
"to",
"login",
"route"
] | train | https://github.com/hrevert/HtUserRegistration/blob/6b4a0cc364153757290ab5eed9ffafe1228f3bd6/src/Controller/UserRegistrationController.php#L44-L70 |
hrevert/HtUserRegistration | src/Controller/UserRegistrationController.php | UserRegistrationController.setPasswordAction | public function setPasswordAction()
{
$userId = $this->params()->fromRoute('userId', null);
$token = $this->params()->fromRoute('token', null);
if ($userId === null || $token === null) {
return $this->notFoundAction();
}
$user = $this->getUserMapper()->findById(... | php | public function setPasswordAction()
{
$userId = $this->params()->fromRoute('userId', null);
$token = $this->params()->fromRoute('token', null);
if ($userId === null || $token === null) {
return $this->notFoundAction();
}
$user = $this->getUserMapper()->findById(... | [
"public",
"function",
"setPasswordAction",
"(",
")",
"{",
"$",
"userId",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'userId'",
",",
"null",
")",
";",
"$",
"token",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute... | Allows users to set their account password | [
"Allows",
"users",
"to",
"set",
"their",
"account",
"password"
] | train | https://github.com/hrevert/HtUserRegistration/blob/6b4a0cc364153757290ab5eed9ffafe1228f3bd6/src/Controller/UserRegistrationController.php#L75-L117 |
hrevert/HtUserRegistration | src/Controller/UserRegistrationController.php | UserRegistrationController.getUserRegistrationMapper | protected function getUserRegistrationMapper()
{
if (!$this->userRegistrationMapper instanceof UserRegistrationMapperInterface) {
$this->userRegistrationMapper = $this->getServiceLocator()->get('HtUserRegistration\UserRegistrationMapper');
}
return $this->userRegistrationMapper;... | php | protected function getUserRegistrationMapper()
{
if (!$this->userRegistrationMapper instanceof UserRegistrationMapperInterface) {
$this->userRegistrationMapper = $this->getServiceLocator()->get('HtUserRegistration\UserRegistrationMapper');
}
return $this->userRegistrationMapper;... | [
"protected",
"function",
"getUserRegistrationMapper",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"userRegistrationMapper",
"instanceof",
"UserRegistrationMapperInterface",
")",
"{",
"$",
"this",
"->",
"userRegistrationMapper",
"=",
"$",
"this",
"->",
"getServ... | Gets userRegistrationMapper | [
"Gets",
"userRegistrationMapper"
] | train | https://github.com/hrevert/HtUserRegistration/blob/6b4a0cc364153757290ab5eed9ffafe1228f3bd6/src/Controller/UserRegistrationController.php#L134-L141 |
larakit/lk-staticfiles | src/StaticFiles/CommandConditions.php | CommandConditions.handle | public function handle() {
$static_files = app_path('Http/staticfiles.php');
if(file_exists($static_files)) {
require_once $static_files;
}
$static_files = base_path('bootstrap/staticfiles.php');
if(file_exists($static_files)) {
require_once $static... | php | public function handle() {
$static_files = app_path('Http/staticfiles.php');
if(file_exists($static_files)) {
require_once $static_files;
}
$static_files = base_path('bootstrap/staticfiles.php');
if(file_exists($static_files)) {
require_once $static... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"static_files",
"=",
"app_path",
"(",
"'Http/staticfiles.php'",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"static_files",
")",
")",
"{",
"require_once",
"$",
"static_files",
";",
"}",
"$",
"static_files... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/CommandConditions.php#L34-L79 |
movoin/one-swoole | src/Annotation/Parser.php | Parser.parse | public function parse()
{
if ($this->parsed === false) {
foreach ($this->files as $file) {
$className = $this->files->getClassName($file);
$annotation = $this->reader->getClassAnnotations($className)->toArray();
if (! empty($annotation)) {
... | php | public function parse()
{
if ($this->parsed === false) {
foreach ($this->files as $file) {
$className = $this->files->getClassName($file);
$annotation = $this->reader->getClassAnnotations($className)->toArray();
if (! empty($annotation)) {
... | [
"public",
"function",
"parse",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parsed",
"===",
"false",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"files",
"->",
"get... | 解析文件注释 | [
"解析文件注释"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Annotation/Parser.php#L72-L88 |
blast-project/CoreBundle | src/DependencyInjection/BlastCoreExtension.php | BlastCoreExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$this->initialize();
$loader = $this->buildLoader($container);
$this->loadServices($loader);
$this->loadCodeGenerator... | php | public function load(array $configs, ContainerBuilder $container)
{
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$this->initialize();
$loader = $this->buildLoader($container);
$this->loadServices($loader);
$this->loadCodeGenerator... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"this",
"->",
"getConfiguration",
"(",
"[",
"]",
",",
"$",
"container"... | {@inheritdoc} | [
"{"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/BlastCoreExtension.php#L32-L46 |
blast-project/CoreBundle | src/DependencyInjection/BlastCoreExtension.php | BlastCoreExtension.buildLoader | public function buildLoader(ContainerBuilder $container)
{
return new YamlFileLoader($container, new FileLocator($this->dir . $this->prefix));
} | php | public function buildLoader(ContainerBuilder $container)
{
return new YamlFileLoader($container, new FileLocator($this->dir . $this->prefix));
} | [
"public",
"function",
"buildLoader",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"return",
"new",
"YamlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"$",
"this",
"->",
"dir",
".",
"$",
"this",
"->",
"prefix",
")",
")",
";",
... | the buildLoader returns the required FileLoader.
@param ContainerBuilder $container
@return FileLoader | [
"the",
"buildLoader",
"returns",
"the",
"required",
"FileLoader",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/BlastCoreExtension.php#L70-L73 |
blast-project/CoreBundle | src/DependencyInjection/BlastCoreExtension.php | BlastCoreExtension.loadServices | public function loadServices(FileLoader $loader)
{
// services, admin & config files
foreach (['services', 'admin'] as $fileName) {
if (file_exists($this->dir . $this->prefix . $fileName . $this->suffix)) {
$loader->load($fileName . $this->suffix);
}
}... | php | public function loadServices(FileLoader $loader)
{
// services, admin & config files
foreach (['services', 'admin'] as $fileName) {
if (file_exists($this->dir . $this->prefix . $fileName . $this->suffix)) {
$loader->load($fileName . $this->suffix);
}
}... | [
"public",
"function",
"loadServices",
"(",
"FileLoader",
"$",
"loader",
")",
"{",
"// services, admin & config files",
"foreach",
"(",
"[",
"'services'",
",",
"'admin'",
"]",
"as",
"$",
"fileName",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
... | This method is called during the self::load() process, to add the logic related to SonataAdmin.
@param FileLoader $loader
@return self | [
"This",
"method",
"is",
"called",
"during",
"the",
"self",
"::",
"load",
"()",
"process",
"to",
"add",
"the",
"logic",
"related",
"to",
"SonataAdmin",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/BlastCoreExtension.php#L82-L92 |
blast-project/CoreBundle | src/DependencyInjection/BlastCoreExtension.php | BlastCoreExtension.loadParameters | public function loadParameters(ContainerBuilder $container)
{
// the blast.yml
if (file_exists($this->dir . $this->prefix . $this->file . $this->suffix)) {
$this->mergeParameter('blast', $container, $this->dir . $this->prefix);
}
return $this;
} | php | public function loadParameters(ContainerBuilder $container)
{
// the blast.yml
if (file_exists($this->dir . $this->prefix . $this->file . $this->suffix)) {
$this->mergeParameter('blast', $container, $this->dir . $this->prefix);
}
return $this;
} | [
"public",
"function",
"loadParameters",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"// the blast.yml",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"dir",
".",
"$",
"this",
"->",
"prefix",
".",
"$",
"this",
"->",
"file",
".",
"$",
"this",
... | This method is called after loading the services in the self::load() process, to load data fixtures.
@param ContainerBuilder $container
@return self | [
"This",
"method",
"is",
"called",
"after",
"loading",
"the",
"services",
"in",
"the",
"self",
"::",
"load",
"()",
"process",
"to",
"load",
"data",
"fixtures",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/BlastCoreExtension.php#L127-L135 |
blast-project/CoreBundle | src/DependencyInjection/BlastCoreExtension.php | BlastCoreExtension.loadSonataAdmin | public function loadSonataAdmin(ContainerBuilder $container, FileLoader $loader)
{
if (file_exists($path = $this->dir . $this->bundlesPrefix . 'sonata_admin' . $this->suffix)) {
$configSonataAdmin = Yaml::parse(
file_get_contents($path)
);
DefaultParamete... | php | public function loadSonataAdmin(ContainerBuilder $container, FileLoader $loader)
{
if (file_exists($path = $this->dir . $this->bundlesPrefix . 'sonata_admin' . $this->suffix)) {
$configSonataAdmin = Yaml::parse(
file_get_contents($path)
);
DefaultParamete... | [
"public",
"function",
"loadSonataAdmin",
"(",
"ContainerBuilder",
"$",
"container",
",",
"FileLoader",
"$",
"loader",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
"=",
"$",
"this",
"->",
"dir",
".",
"$",
"this",
"->",
"bundlesPrefix",
".",
"'sonat... | This method is called at the end of the self::load() process, to add the logic related to SonataAdmin.
@param ContainerBuilder $container
@param FileLoader $loader
@return self | [
"This",
"method",
"is",
"called",
"at",
"the",
"end",
"of",
"the",
"self",
"::",
"load",
"()",
"process",
"to",
"add",
"the",
"logic",
"related",
"to",
"SonataAdmin",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/BlastCoreExtension.php#L157-L168 |
blast-project/CoreBundle | src/DependencyInjection/BlastCoreExtension.php | BlastCoreExtension.mergeParameter | protected function mergeParameter($var, $container, $dir, $file_name = 'blast.yml')
{
$loader = new YamlFileLoader($newContainer = new ContainerBuilder(), new FileLocator($dir));
$loader->load($file_name);
if (!$container->hasParameter($var) || !is_array($container->getParameter($var))) {
... | php | protected function mergeParameter($var, $container, $dir, $file_name = 'blast.yml')
{
$loader = new YamlFileLoader($newContainer = new ContainerBuilder(), new FileLocator($dir));
$loader->load($file_name);
if (!$container->hasParameter($var) || !is_array($container->getParameter($var))) {
... | [
"protected",
"function",
"mergeParameter",
"(",
"$",
"var",
",",
"$",
"container",
",",
"$",
"dir",
",",
"$",
"file_name",
"=",
"'blast.yml'",
")",
"{",
"$",
"loader",
"=",
"new",
"YamlFileLoader",
"(",
"$",
"newContainer",
"=",
"new",
"ContainerBuilder",
... | @param string $var the parameter name
@param ContainerBuilder $container
@param string $dir
@param string $file_name
@return self | [
"@param",
"string",
"$var",
"the",
"parameter",
"name",
"@param",
"ContainerBuilder",
"$container",
"@param",
"string",
"$dir",
"@param",
"string",
"$file_name"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DependencyInjection/BlastCoreExtension.php#L205-L224 |
baleen/cli | src/CommandBus/Repository/CreateHandler.php | CreateHandler.handle | public function handle(CreateMessage $command)
{
$input = $command->getInput();
$output = $command->getOutput();
/** @var Config $config */
$config = $command->getConfig();
$directory = $config->getMigrationsDirectory();
$filesystem = $command->getFilesystem();
... | php | public function handle(CreateMessage $command)
{
$input = $command->getInput();
$output = $command->getOutput();
/** @var Config $config */
$config = $command->getConfig();
$directory = $config->getMigrationsDirectory();
$filesystem = $command->getFilesystem();
... | [
"public",
"function",
"handle",
"(",
"CreateMessage",
"$",
"command",
")",
"{",
"$",
"input",
"=",
"$",
"command",
"->",
"getInput",
"(",
")",
";",
"$",
"output",
"=",
"$",
"command",
"->",
"getOutput",
"(",
")",
";",
"/** @var Config $config */",
"$",
"... | handle.
@param CreateMessage $command
@return false|string
@throws CliException | [
"handle",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Repository/CreateHandler.php#L50-L107 |
baleen/cli | src/CommandBus/Repository/CreateHandler.php | CreateHandler.generate | protected function generate($className, $namespace = null)
{
$class = new ClassGenerator(
$className,
$namespace,
null,
'SimpleMigration',
[],
[],
[
new MethodGenerator(
'up',
... | php | protected function generate($className, $namespace = null)
{
$class = new ClassGenerator(
$className,
$namespace,
null,
'SimpleMigration',
[],
[],
[
new MethodGenerator(
'up',
... | [
"protected",
"function",
"generate",
"(",
"$",
"className",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"new",
"ClassGenerator",
"(",
"$",
"className",
",",
"$",
"namespace",
",",
"null",
",",
"'SimpleMigration'",
",",
"[",
"]",
",",... | @param string $className
@param string $namespace
@return ClassGenerator
@throws CliException | [
"@param",
"string",
"$className",
"@param",
"string",
"$namespace"
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Repository/CreateHandler.php#L117-L147 |
baleen/cli | src/CommandBus/Repository/CreateHandler.php | CreateHandler.writeClass | protected function writeClass(ClassGenerator $class, Filesystem $filesystem, $destinationDir)
{
$className = $class->getName();
$file = new FileGenerator([
'fileName' => $className.'.php',
'classes' => [$class],
]);
$contents = $file->generate();
$rel... | php | protected function writeClass(ClassGenerator $class, Filesystem $filesystem, $destinationDir)
{
$className = $class->getName();
$file = new FileGenerator([
'fileName' => $className.'.php',
'classes' => [$class],
]);
$contents = $file->generate();
$rel... | [
"protected",
"function",
"writeClass",
"(",
"ClassGenerator",
"$",
"class",
",",
"Filesystem",
"$",
"filesystem",
",",
"$",
"destinationDir",
")",
"{",
"$",
"className",
"=",
"$",
"class",
"->",
"getName",
"(",
")",
";",
"$",
"file",
"=",
"new",
"FileGener... | Function writeClass.
@param ClassGenerator $class
@param Filesystem $filesystem
@param $destinationDir
@return string|false
@throws CliException | [
"Function",
"writeClass",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Repository/CreateHandler.php#L160-L180 |
withfatpanda/illuminate-wordpress | src/WordPress/Providers/Database/DatabaseServiceProvider.php | DatabaseServiceProvider.registerEloquentFactory | protected function registerEloquentFactory()
{
$this->app->singleton(FakerGenerator::class, function () {
return FakerFactory::create();
});
$this->app->singleton(EloquentFactory::class, function ($app) {
$faker = $app->make(FakerGenerator::class);
return EloquentFact... | php | protected function registerEloquentFactory()
{
$this->app->singleton(FakerGenerator::class, function () {
return FakerFactory::create();
});
$this->app->singleton(EloquentFactory::class, function ($app) {
$faker = $app->make(FakerGenerator::class);
return EloquentFact... | [
"protected",
"function",
"registerEloquentFactory",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"FakerGenerator",
"::",
"class",
",",
"function",
"(",
")",
"{",
"return",
"FakerFactory",
"::",
"create",
"(",
")",
";",
"}",
")",
";",
... | Register the Eloquent factory instance in the container.
@return void | [
"Register",
"the",
"Eloquent",
"factory",
"instance",
"in",
"the",
"container",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Providers/Database/DatabaseServiceProvider.php#L14-L25 |
gdbots/pbjx-bundle-php | src/Binder/QueryParsingBinder.php | QueryParsingBinder.bind | public function bind(PbjxEvent $pbjxEvent): void
{
$request = $pbjxEvent->getMessage();
$query = trim((string)$request->get('q'));
if (empty($query)) {
return;
}
$parsedQuery = $this->queryParser->parse($query);
$request
->set('q', $query)
... | php | public function bind(PbjxEvent $pbjxEvent): void
{
$request = $pbjxEvent->getMessage();
$query = trim((string)$request->get('q'));
if (empty($query)) {
return;
}
$parsedQuery = $this->queryParser->parse($query);
$request
->set('q', $query)
... | [
"public",
"function",
"bind",
"(",
"PbjxEvent",
"$",
"pbjxEvent",
")",
":",
"void",
"{",
"$",
"request",
"=",
"$",
"pbjxEvent",
"->",
"getMessage",
"(",
")",
";",
"$",
"query",
"=",
"trim",
"(",
"(",
"string",
")",
"$",
"request",
"->",
"get",
"(",
... | @param PbjxEvent $pbjxEvent
@throws \Throwable | [
"@param",
"PbjxEvent",
"$pbjxEvent"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Binder/QueryParsingBinder.php#L26-L39 |
Srokap/code_review | classes/CodeReview/PhpFileParser.php | PhpFileParser.validateFileContents | protected function validateFileContents() {
if (!$this->fileName) {
throw new \LogicException("Missing file's path. Looks like severe internal error.");
}
$this->validateFilePath($this->fileName);
if (!$this->sha1hash) {
throw new \LogicException("Missing file's SHA1 hash. Looks like severe internal error... | php | protected function validateFileContents() {
if (!$this->fileName) {
throw new \LogicException("Missing file's path. Looks like severe internal error.");
}
$this->validateFilePath($this->fileName);
if (!$this->sha1hash) {
throw new \LogicException("Missing file's SHA1 hash. Looks like severe internal error... | [
"protected",
"function",
"validateFileContents",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"fileName",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"Missing file's path. Looks like severe internal error.\"",
")",
";",
"}",
"$",
"this",
"->",
... | Uses SHA1 hash to determine if file contents has changed since analysis.
@return bool
@throws \CodeReview\IOException
@throws LogicException | [
"Uses",
"SHA1",
"hash",
"to",
"determine",
"if",
"file",
"contents",
"has",
"changed",
"since",
"analysis",
"."
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/CodeReview/PhpFileParser.php#L74-L86 |
Srokap/code_review | classes/CodeReview/PhpFileParser.php | PhpFileParser.validateFilePath | protected function validateFilePath($fileName) {
if (!file_exists($fileName)) {
throw new IOException("File $fileName does not exists");
}
if (!is_file($fileName)) {
throw new IOException("$fileName must be a file");
}
if (!is_readable($fileName)) {
throw new IOException("File $fileName is not readab... | php | protected function validateFilePath($fileName) {
if (!file_exists($fileName)) {
throw new IOException("File $fileName does not exists");
}
if (!is_file($fileName)) {
throw new IOException("$fileName must be a file");
}
if (!is_readable($fileName)) {
throw new IOException("File $fileName is not readab... | [
"protected",
"function",
"validateFilePath",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"File $fileName does not exists\"",
")",
";",
"}",
"if",
"(",
"!",
"is_file... | Checks if file exists and is readable.
@param $fileName
@return bool
@throws \CodeReview\IOException | [
"Checks",
"if",
"file",
"exists",
"and",
"is",
"readable",
"."
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/CodeReview/PhpFileParser.php#L95-L106 |
Srokap/code_review | classes/CodeReview/PhpFileParser.php | PhpFileParser.computeNestingParentTokens | private function computeNestingParentTokens($debug = false) {
$nesting = 0;
$parents = array();
$lastParent = null;
foreach ($this->tokens as $key => $token) {
if (is_array($token)) {
//add info about parent to array
$parent = $parents ? $parents[count($parents)-1] : null;
$this->tokens[$key][3] ... | php | private function computeNestingParentTokens($debug = false) {
$nesting = 0;
$parents = array();
$lastParent = null;
foreach ($this->tokens as $key => $token) {
if (is_array($token)) {
//add info about parent to array
$parent = $parents ? $parents[count($parents)-1] : null;
$this->tokens[$key][3] ... | [
"private",
"function",
"computeNestingParentTokens",
"(",
"$",
"debug",
"=",
"false",
")",
"{",
"$",
"nesting",
"=",
"0",
";",
"$",
"parents",
"=",
"array",
"(",
")",
";",
"$",
"lastParent",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"tokens"... | Compute parents of the tokens to easily determine containing methods and classes.
@param bool $debug | [
"Compute",
"parents",
"of",
"the",
"tokens",
"to",
"easily",
"determine",
"containing",
"methods",
"and",
"classes",
"."
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/CodeReview/PhpFileParser.php#L113-L150 |
shawnsandy/ui-pages | src/Classes/Pages.php | Pages.getView | public function getView($name, $data = [])
{
$view = 'missing-page';
if (view()->exists('page::' . $name)) {
$view = $name;
}
return view('page::' . $view, $data);
} | php | public function getView($name, $data = [])
{
$view = 'missing-page';
if (view()->exists('page::' . $name)) {
$view = $name;
}
return view('page::' . $view, $data);
} | [
"public",
"function",
"getView",
"(",
"$",
"name",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"view",
"=",
"'missing-page'",
";",
"if",
"(",
"view",
"(",
")",
"->",
"exists",
"(",
"'page::'",
".",
"$",
"name",
")",
")",
"{",
"$",
"view",
"... | Search and Load the view or fallbacks to specific view
@param string $name The name of the view
@param array $data View data
@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | [
"Search",
"and",
"Load",
"the",
"view",
"or",
"fallbacks",
"to",
"specific",
"view"
] | train | https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Pages.php#L20-L29 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.