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 |
|---|---|---|---|---|---|---|---|---|---|---|
simbiosis-group/yii2-helper | models/ExcelImportForm.php | ExcelImportForm.import | public function import($modelName, $defaultValues = [], $updateMultipleModel = false, $queryConfigs = [])
{
$isSuccessful = true;
$sheetData = $this->arrayFromExcel;
$this->header = array_shift($sheetData);
foreach ($sheetData as $record) {
if ($updateMultipleModel) {
$parentId = $this->g... | php | public function import($modelName, $defaultValues = [], $updateMultipleModel = false, $queryConfigs = [])
{
$isSuccessful = true;
$sheetData = $this->arrayFromExcel;
$this->header = array_shift($sheetData);
foreach ($sheetData as $record) {
if ($updateMultipleModel) {
$parentId = $this->g... | [
"public",
"function",
"import",
"(",
"$",
"modelName",
",",
"$",
"defaultValues",
"=",
"[",
"]",
",",
"$",
"updateMultipleModel",
"=",
"false",
",",
"$",
"queryConfigs",
"=",
"[",
"]",
")",
"{",
"$",
"isSuccessful",
"=",
"true",
";",
"$",
"sheetData",
... | Import the excel to the model using active record
@param string $model The model name to save the excel rows into
@param array $defaultValues The default values to be assigned
@return Return true if all records is saved | [
"Import",
"the",
"excel",
"to",
"the",
"model",
"using",
"active",
"record"
] | train | https://github.com/simbiosis-group/yii2-helper/blob/c85c4204dd06b16e54210e75fe6deb51869d1dd9/models/ExcelImportForm.php#L108-L139 |
simbiosis-group/yii2-helper | models/ExcelImportForm.php | ExcelImportForm.getCellValue | public function getCellValue($value, $model, $record, $key, $isParent = true)
{
if ($isParent) {
if(isset($model->importSafeAttributes()[$value]) && is_array($model->importSafeAttributes()[$value])) {
$array = $model->importSafeAttributes()[$value];
return $array['model']::find()
->andWhere([$... | php | public function getCellValue($value, $model, $record, $key, $isParent = true)
{
if ($isParent) {
if(isset($model->importSafeAttributes()[$value]) && is_array($model->importSafeAttributes()[$value])) {
$array = $model->importSafeAttributes()[$value];
return $array['model']::find()
->andWhere([$... | [
"public",
"function",
"getCellValue",
"(",
"$",
"value",
",",
"$",
"model",
",",
"$",
"record",
",",
"$",
"key",
",",
"$",
"isParent",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"isParent",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"model",
"->",
"impo... | Get excel cell value. If the import safe attributes has the model declared, it will grab the id from that model instead of the cell value
@param string $model The model name to save the excel rows into
@param array $value The values to be assigned
@param string $record The model name to save the excel rows into
@param ... | [
"Get",
"excel",
"cell",
"value",
".",
"If",
"the",
"import",
"safe",
"attributes",
"has",
"the",
"model",
"declared",
"it",
"will",
"grab",
"the",
"id",
"from",
"that",
"model",
"instead",
"of",
"the",
"cell",
"value"
] | train | https://github.com/simbiosis-group/yii2-helper/blob/c85c4204dd06b16e54210e75fe6deb51869d1dd9/models/ExcelImportForm.php#L149-L172 |
phpnfe/tools | src/Soap/Wsdl.php | Wsdl.downLoadWsdl | public function downLoadWsdl($url, $priKeyPath, $pubKeyPath, $certKeyPath)
{
$soap = new CurlSoap($priKeyPath, $pubKeyPath, $certKeyPath);
$resposta = $soap->getWsdl($url);
if (! $resposta) {
$this->soapDebug = $soap->soapDebug;
return '';
}
return $... | php | public function downLoadWsdl($url, $priKeyPath, $pubKeyPath, $certKeyPath)
{
$soap = new CurlSoap($priKeyPath, $pubKeyPath, $certKeyPath);
$resposta = $soap->getWsdl($url);
if (! $resposta) {
$this->soapDebug = $soap->soapDebug;
return '';
}
return $... | [
"public",
"function",
"downLoadWsdl",
"(",
"$",
"url",
",",
"$",
"priKeyPath",
",",
"$",
"pubKeyPath",
",",
"$",
"certKeyPath",
")",
"{",
"$",
"soap",
"=",
"new",
"CurlSoap",
"(",
"$",
"priKeyPath",
",",
"$",
"pubKeyPath",
",",
"$",
"certKeyPath",
")",
... | downloadWsdl
Baixa o arquivo wsdl necessário para a comunicação SOAP nativa
O WSDL pode também ser usado para verificar a mensagem SOAP com o
uso do SOAPUI um recurso muito importante para testes off-line.
@param string $url
@param string $priKeyPath
@param string $pubKeyPath
@param string $certKeyPath
@return string | [
"downloadWsdl",
"Baixa",
"o",
"arquivo",
"wsdl",
"necessário",
"para",
"a",
"comunicação",
"SOAP",
"nativa",
"O",
"WSDL",
"pode",
"também",
"ser",
"usado",
"para",
"verificar",
"a",
"mensagem",
"SOAP",
"com",
"o",
"uso",
"do",
"SOAPUI",
"um",
"recurso",
"mui... | train | https://github.com/phpnfe/tools/blob/303ca311989e0b345071f61b71d2b3bf7ee80454/src/Soap/Wsdl.php#L31-L42 |
gregorybesson/PlaygroundCms | src/Entity/Slide.php | Slide.populate | public function populate($data = array())
{
if (isset($data['title']) && $data['title'] != null) {
$this->title = $data['title'];
}
if (isset($data['subtitle'])) {
$this->subtitle = $data['subtitle'];
}
if (isset($data['type']) && $data['type... | php | public function populate($data = array())
{
if (isset($data['title']) && $data['title'] != null) {
$this->title = $data['title'];
}
if (isset($data['subtitle'])) {
$this->subtitle = $data['subtitle'];
}
if (isset($data['type']) && $data['type... | [
"public",
"function",
"populate",
"(",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'title'",
"]",
")",
"&&",
"$",
"data",
"[",
"'title'",
"]",
"!=",
"null",
")",
"{",
"$",
"this",
"->",
"title",
"=... | Populate from an array.
@param array $data | [
"Populate",
"from",
"an",
"array",
"."
] | train | https://github.com/gregorybesson/PlaygroundCms/blob/e929a283f2a6e82d4f248c930f7aa454ce20cbc3/src/Entity/Slide.php#L387-L420 |
zhouyl/mellivora | Mellivora/Session/Session.php | Session.start | public function start()
{
if (!headers_sent()) {
if (!$this->started && $this->status() !== PHP_SESSION_ACTIVE) {
session_start();
$this->started = true;
return true;
}
}
return false;
} | php | public function start()
{
if (!headers_sent()) {
if (!$this->started && $this->status() !== PHP_SESSION_ACTIVE) {
session_start();
$this->started = true;
return true;
}
}
return false;
} | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"!",
"headers_sent",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"started",
"&&",
"$",
"this",
"->",
"status",
"(",
")",
"!==",
"PHP_SESSION_ACTIVE",
")",
"{",
"session_start",
"(",
... | 启动 session
@return bool | [
"启动",
"session"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Session/Session.php#L40-L52 |
zhouyl/mellivora | Mellivora/Session/Session.php | Session.set | public function set($key, $value = null)
{
$data = is_array($key) ? $key : [$key => $value];
foreach ($data as $key => $value) {
Arr::set($_SESSION, $key, $value);
}
return $this;
} | php | public function set($key, $value = null)
{
$data = is_array($key) ? $key : [$key => $value];
foreach ($data as $key => $value) {
Arr::set($_SESSION, $key, $value);
}
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"is_array",
"(",
"$",
"key",
")",
"?",
"$",
"key",
":",
"[",
"$",
"key",
"=>",
"$",
"value",
"]",
";",
"foreach",
"(",
"$",
"data",
"as"... | 设定 session 数据
<code>
$session->has("foo", "bar");
$session->has("foo.bar", 1);
</code>
@param string $key
@param mixed $value
@return \Mellivora\Session\Session | [
"设定",
"session",
"数据"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Session/Session.php#L105-L114 |
zhouyl/mellivora | Mellivora/Session/Session.php | Session.get | public function get($key, $default = null, $remove = false)
{
$data = Arr::get($_SESSION, $key, $default);
if ($remove) {
$this->delete($key);
}
return $data;
} | php | public function get($key, $default = null, $remove = false)
{
$data = Arr::get($_SESSION, $key, $default);
if ($remove) {
$this->delete($key);
}
return $data;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
",",
"$",
"remove",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"Arr",
"::",
"get",
"(",
"$",
"_SESSION",
",",
"$",
"key",
",",
"$",
"default",
")",
";",
"if",
"(",
... | 获取 session 数据
<code>
$session->get("foo");
$session->get("foo.bar");
</code>
@param string $key
@param mixed $default
@param bool $remove
@return mixed | [
"获取",
"session",
"数据"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Session/Session.php#L130-L139 |
zhouyl/mellivora | Mellivora/Session/Session.php | Session.destroy | public function destroy($removeData = false)
{
if ($removeData) {
$_SESSION = [];
}
$this->started = false;
session_destroy();
return $this;
} | php | public function destroy($removeData = false)
{
if ($removeData) {
$_SESSION = [];
}
$this->started = false;
session_destroy();
return $this;
} | [
"public",
"function",
"destroy",
"(",
"$",
"removeData",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"removeData",
")",
"{",
"$",
"_SESSION",
"=",
"[",
"]",
";",
"}",
"$",
"this",
"->",
"started",
"=",
"false",
";",
"session_destroy",
"(",
")",
";",
"r... | 销毁 session
@param bool $removeData
@return \Mellivora\Session\Session | [
"销毁",
"session"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Session/Session.php#L240-L251 |
zhouyl/mellivora | Mellivora/Session/Session.php | Session.token | public function token($regenerate = false)
{
$key = '__token';
if (!$this->has($key) || $regenerate) {
$this->set($key, Str::quickRandom(40));
}
return $this->get($key);
} | php | public function token($regenerate = false)
{
$key = '__token';
if (!$this->has($key) || $regenerate) {
$this->set($key, Str::quickRandom(40));
}
return $this->get($key);
} | [
"public",
"function",
"token",
"(",
"$",
"regenerate",
"=",
"false",
")",
"{",
"$",
"key",
"=",
"'__token'",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
"||",
"$",
"regenerate",
")",
"{",
"$",
"this",
"->",
"set",
"(",
... | 获取一个 token,如果不存在则自动生成
@param bool $regenerate
@return string | [
"获取一个",
"token,如果不存在则自动生成"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Session/Session.php#L270-L278 |
zhouyl/mellivora | Mellivora/Session/Session.php | Session.checkToken | public function checkToken($token, $once = true)
{
$check = $this->token() === $token;
if ($once) {
$this->delete('__token');
}
return $check;
} | php | public function checkToken($token, $once = true)
{
$check = $this->token() === $token;
if ($once) {
$this->delete('__token');
}
return $check;
} | [
"public",
"function",
"checkToken",
"(",
"$",
"token",
",",
"$",
"once",
"=",
"true",
")",
"{",
"$",
"check",
"=",
"$",
"this",
"->",
"token",
"(",
")",
"===",
"$",
"token",
";",
"if",
"(",
"$",
"once",
")",
"{",
"$",
"this",
"->",
"delete",
"(... | 校验 token
@param string $token
@param bool $once
@return bool | [
"校验",
"token"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Session/Session.php#L288-L297 |
TangoMan75/CallbackBundle | TwigExtension/Callback.php | Callback.callbackFunction | public function callbackFunction($route = null, $parameters = [])
{
if ($route === null || ! is_string($route)) {
// Gets URI from current request
$uri = $this->request->getUri();
} else {
// Generates URI from '_route'
$uri = $this->router->generate(
... | php | public function callbackFunction($route = null, $parameters = [])
{
if ($route === null || ! is_string($route)) {
// Gets URI from current request
$uri = $this->request->getUri();
} else {
// Generates URI from '_route'
$uri = $this->router->generate(
... | [
"public",
"function",
"callbackFunction",
"(",
"$",
"route",
"=",
"null",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"route",
"===",
"null",
"||",
"!",
"is_string",
"(",
"$",
"route",
")",
")",
"{",
"// Gets URI from current request... | Removes callbacks from query
@param string $route
@param array $parameters
@return string | [
"Removes",
"callbacks",
"from",
"query"
] | train | https://github.com/TangoMan75/CallbackBundle/blob/a56f599c7786ee7a8134e4f7752da427036f8002/TwigExtension/Callback.php#L72-L108 |
php-lug/lug | src/Component/Resource/Domain/AbstractDomainManager.php | AbstractDomainManager.find | public function find($action, $repositoryMethod, array $criteria, array $sorting = [])
{
$event = new DomainEvent($this->resource, $action = 'find.'.$action);
try {
$this->dispatchEvent($event, $action, self::STATE_PRE);
$event->setData($this->doFind($action, $repositoryMeth... | php | public function find($action, $repositoryMethod, array $criteria, array $sorting = [])
{
$event = new DomainEvent($this->resource, $action = 'find.'.$action);
try {
$this->dispatchEvent($event, $action, self::STATE_PRE);
$event->setData($this->doFind($action, $repositoryMeth... | [
"public",
"function",
"find",
"(",
"$",
"action",
",",
"$",
"repositoryMethod",
",",
"array",
"$",
"criteria",
",",
"array",
"$",
"sorting",
"=",
"[",
"]",
")",
"{",
"$",
"event",
"=",
"new",
"DomainEvent",
"(",
"$",
"this",
"->",
"resource",
",",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Resource/Domain/AbstractDomainManager.php#L50-L66 |
php-lug/lug | src/Component/Resource/Domain/AbstractDomainManager.php | AbstractDomainManager.create | public function create($object, $flush = true)
{
$event = new DomainEvent($this->resource, $action = 'create', $object);
try {
$this->dispatchEvent($event, $action, self::STATE_PRE);
$this->doCreate($event->getData(), $flush);
} catch (\Exception $e) {
$t... | php | public function create($object, $flush = true)
{
$event = new DomainEvent($this->resource, $action = 'create', $object);
try {
$this->dispatchEvent($event, $action, self::STATE_PRE);
$this->doCreate($event->getData(), $flush);
} catch (\Exception $e) {
$t... | [
"public",
"function",
"create",
"(",
"$",
"object",
",",
"$",
"flush",
"=",
"true",
")",
"{",
"$",
"event",
"=",
"new",
"DomainEvent",
"(",
"$",
"this",
"->",
"resource",
",",
"$",
"action",
"=",
"'create'",
",",
"$",
"object",
")",
";",
"try",
"{"... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Resource/Domain/AbstractDomainManager.php#L71-L85 |
php-lug/lug | src/Component/Resource/Domain/AbstractDomainManager.php | AbstractDomainManager.flush | public function flush($object = null)
{
$event = new DomainEvent($this->resource, $action = 'flush', $object);
try {
$this->dispatchEvent($event, $action, self::STATE_PRE);
$this->doFlush();
} catch (\Exception $e) {
$this->dispatchEvent($event, $action, ... | php | public function flush($object = null)
{
$event = new DomainEvent($this->resource, $action = 'flush', $object);
try {
$this->dispatchEvent($event, $action, self::STATE_PRE);
$this->doFlush();
} catch (\Exception $e) {
$this->dispatchEvent($event, $action, ... | [
"public",
"function",
"flush",
"(",
"$",
"object",
"=",
"null",
")",
"{",
"$",
"event",
"=",
"new",
"DomainEvent",
"(",
"$",
"this",
"->",
"resource",
",",
"$",
"action",
"=",
"'flush'",
",",
"$",
"object",
")",
";",
"try",
"{",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Resource/Domain/AbstractDomainManager.php#L128-L142 |
zhouyl/mellivora | Mellivora/Database/Schema/Grammars/Grammar.php | Grammar.getCommandsByName | protected function getCommandsByName(Blueprint $blueprint, $name)
{
return array_filter($blueprint->getCommands(), function ($value) use ($name) {
return $value->name === $name;
});
} | php | protected function getCommandsByName(Blueprint $blueprint, $name)
{
return array_filter($blueprint->getCommands(), function ($value) use ($name) {
return $value->name === $name;
});
} | [
"protected",
"function",
"getCommandsByName",
"(",
"Blueprint",
"$",
"blueprint",
",",
"$",
"name",
")",
"{",
"return",
"array_filter",
"(",
"$",
"blueprint",
"->",
"getCommands",
"(",
")",
",",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"name",
... | Get all of the commands with a given name.
@param \Mellivora\Database\Schema\Blueprint $blueprint
@param string $name
@return array | [
"Get",
"all",
"of",
"the",
"commands",
"with",
"a",
"given",
"name",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Schema/Grammars/Grammar.php#L175-L180 |
zhouyl/mellivora | Mellivora/Database/Schema/Grammars/Grammar.php | Grammar.getDefaultValue | protected function getDefaultValue($value)
{
if ($value instanceof Expression) {
return $value;
}
return is_bool($value)
? "'" . (int) $value . "'"
: "'" . strval($value) . "'";
} | php | protected function getDefaultValue($value)
{
if ($value instanceof Expression) {
return $value;
}
return is_bool($value)
? "'" . (int) $value . "'"
: "'" . strval($value) . "'";
} | [
"protected",
"function",
"getDefaultValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Expression",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"is_bool",
"(",
"$",
"value",
")",
"?",
"\"'\"",
".",
"(",
"int",
")",
... | Format a value so that it can be used in "default" clauses.
@param mixed $value
@return string | [
"Format",
"a",
"value",
"so",
"that",
"it",
"can",
"be",
"used",
"in",
"default",
"clauses",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Schema/Grammars/Grammar.php#L234-L243 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.activate | public function activate(Composer $composer, IOInterface $io, $pluginName)
{
$plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
if ($plugin) {
$result = $this->wp(function () use ($plugin) {
wp_cache_set('plugins', [], 'plugins');
... | php | public function activate(Composer $composer, IOInterface $io, $pluginName)
{
$plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
if ($plugin) {
$result = $this->wp(function () use ($plugin) {
wp_cache_set('plugins', [], 'plugins');
... | [
"public",
"function",
"activate",
"(",
"Composer",
"$",
"composer",
",",
"IOInterface",
"$",
"io",
",",
"$",
"pluginName",
")",
"{",
"$",
"plugin",
"=",
"$",
"this",
"->",
"prepare",
"(",
"__FUNCTION__",
",",
"$",
"composer",
",",
"$",
"io",
",",
"$",
... | Activate a plugin.
@param \Composer\Composer $composer
@param \Composer\IO\IOInterface $io
@param string $plugin
@return void | [
"Activate",
"a",
"plugin",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L67-L80 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.deactivate | public function deactivate(Composer $composer, IOInterface $io, $pluginName)
{
$plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
if ($plugin) {
$result = $this->wp(function () use ($plugin) {
return deactivate_plugins($plugin);
});
... | php | public function deactivate(Composer $composer, IOInterface $io, $pluginName)
{
$plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
if ($plugin) {
$result = $this->wp(function () use ($plugin) {
return deactivate_plugins($plugin);
});
... | [
"public",
"function",
"deactivate",
"(",
"Composer",
"$",
"composer",
",",
"IOInterface",
"$",
"io",
",",
"$",
"pluginName",
")",
"{",
"$",
"plugin",
"=",
"$",
"this",
"->",
"prepare",
"(",
"__FUNCTION__",
",",
"$",
"composer",
",",
"$",
"io",
",",
"$"... | Deactivate a plugin.
@param \Composer\Composer $composer
@param \Composer\IO\IOInterface $io
@param string $plugin
@return void | [
"Deactivate",
"a",
"plugin",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L90-L101 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.uninstall | public function uninstall(Composer $composer, IOInterface $io, $pluginName)
{
$plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
if ($plugin) {
$result = $this->wp(function () use ($plugin) {
return uninstall_plugin($plugin);
});
... | php | public function uninstall(Composer $composer, IOInterface $io, $pluginName)
{
$plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
if ($plugin) {
$result = $this->wp(function () use ($plugin) {
return uninstall_plugin($plugin);
});
... | [
"public",
"function",
"uninstall",
"(",
"Composer",
"$",
"composer",
",",
"IOInterface",
"$",
"io",
",",
"$",
"pluginName",
")",
"{",
"$",
"plugin",
"=",
"$",
"this",
"->",
"prepare",
"(",
"__FUNCTION__",
",",
"$",
"composer",
",",
"$",
"io",
",",
"$",... | Uninstall a plugin.
@param \Composer\Composer $composer
@param \Composer\IO\IOInterface $io
@param string $plugin
@return void | [
"Uninstall",
"a",
"plugin",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L111-L122 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.prepare | protected function prepare($action, Composer $composer, IOInterface $io, $pluginName)
{
$this->composer = $composer;
$this->io = $io;
if ($this->isPluginExcluded($action, $pluginName)) {
return $this->excluded($action, $pluginName) && false;
}
$p... | php | protected function prepare($action, Composer $composer, IOInterface $io, $pluginName)
{
$this->composer = $composer;
$this->io = $io;
if ($this->isPluginExcluded($action, $pluginName)) {
return $this->excluded($action, $pluginName) && false;
}
$p... | [
"protected",
"function",
"prepare",
"(",
"$",
"action",
",",
"Composer",
"$",
"composer",
",",
"IOInterface",
"$",
"io",
",",
"$",
"pluginName",
")",
"{",
"$",
"this",
"->",
"composer",
"=",
"$",
"composer",
";",
"$",
"this",
"->",
"io",
"=",
"$",
"i... | Prepare plugin interaction.
@param string $action
@param \Composer\Composer $composer
@param \Composer\IO\IOInterface $io
@param string $pluginName
@return string|false | [
"Prepare",
"plugin",
"interaction",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L133-L151 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.getPlugin | protected function getPlugin($plugin)
{
$path = $this->plugin->getPublicDirectory() . '/plugins/' . $plugin;
if (file_exists($path) && is_dir($path)) {
$files = scandir($path);
foreach ($files as $file) {
$pattern = defined('HHVM_VERSION'... | php | protected function getPlugin($plugin)
{
$path = $this->plugin->getPublicDirectory() . '/plugins/' . $plugin;
if (file_exists($path) && is_dir($path)) {
$files = scandir($path);
foreach ($files as $file) {
$pattern = defined('HHVM_VERSION'... | [
"protected",
"function",
"getPlugin",
"(",
"$",
"plugin",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"plugin",
"->",
"getPublicDirectory",
"(",
")",
".",
"'/plugins/'",
".",
"$",
"plugin",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
"&&",... | Get the main plugin file for a plugin.
@param string $plugin
@return string|false | [
"Get",
"the",
"main",
"plugin",
"file",
"for",
"a",
"plugin",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L174-L203 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.executing | protected function executing($action, $plugin)
{
$this->io->write(' - ' . ucfirst($this->getActionExecuting($action)) . ' plugin <info>' . $plugin . '</info>');
$this->io->write('');
} | php | protected function executing($action, $plugin)
{
$this->io->write(' - ' . ucfirst($this->getActionExecuting($action)) . ' plugin <info>' . $plugin . '</info>');
$this->io->write('');
} | [
"protected",
"function",
"executing",
"(",
"$",
"action",
",",
"$",
"plugin",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"write",
"(",
"' - '",
".",
"ucfirst",
"(",
"$",
"this",
"->",
"getActionExecuting",
"(",
"$",
"action",
")",
")",
".",
"' plugin <i... | Write action executing.
@param string $action
@param string $plugin
@return void | [
"Write",
"action",
"executing",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L224-L228 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.failed | protected function failed($action, $plugin)
{
$this->io->write('<warning>The plugin ' . $plugin . ' could not be ' . $this->getActionPast($action) . '.</warning>');
$this->io->write('');
} | php | protected function failed($action, $plugin)
{
$this->io->write('<warning>The plugin ' . $plugin . ' could not be ' . $this->getActionPast($action) . '.</warning>');
$this->io->write('');
} | [
"protected",
"function",
"failed",
"(",
"$",
"action",
",",
"$",
"plugin",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"write",
"(",
"'<warning>The plugin '",
".",
"$",
"plugin",
".",
"' could not be '",
".",
"$",
"this",
"->",
"getActionPast",
"(",
"$",
"a... | Write failed action warning.
@param string $action
@param string $plugin
@return void | [
"Write",
"failed",
"action",
"warning",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L237-L241 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.excluded | protected function excluded($action, $plugin)
{
$this->io->write('<warning>The plugin ' . $plugin . ' was not ' . $this->getActionPast($action) . ' because it is known to cause issues.</warning>');
$this->io->write('<info>You can still activate this plugin manually.</info>');
$this->io->writ... | php | protected function excluded($action, $plugin)
{
$this->io->write('<warning>The plugin ' . $plugin . ' was not ' . $this->getActionPast($action) . ' because it is known to cause issues.</warning>');
$this->io->write('<info>You can still activate this plugin manually.</info>');
$this->io->writ... | [
"protected",
"function",
"excluded",
"(",
"$",
"action",
",",
"$",
"plugin",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"write",
"(",
"'<warning>The plugin '",
".",
"$",
"plugin",
".",
"' was not '",
".",
"$",
"this",
"->",
"getActionPast",
"(",
"$",
"acti... | Write failed action warning.
@param string $action
@param string $plugin
@return void | [
"Write",
"failed",
"action",
"warning",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L250-L255 |
CupOfTea696/WordPress-Composer | src/PluginInteractor.php | PluginInteractor.wp | protected function wp(Closure $cmd)
{
$cmd = new ReflectionFunction($cmd);
$code = implode(array_slice(file($cmd->getFileName()), ($startLine = $cmd->getStartLine() - 1), $cmd->getEndLine() - $startLine));
preg_match('/\\{(.*)\\}/s', $code, $body);
$vars = $cmd->get... | php | protected function wp(Closure $cmd)
{
$cmd = new ReflectionFunction($cmd);
$code = implode(array_slice(file($cmd->getFileName()), ($startLine = $cmd->getStartLine() - 1), $cmd->getEndLine() - $startLine));
preg_match('/\\{(.*)\\}/s', $code, $body);
$vars = $cmd->get... | [
"protected",
"function",
"wp",
"(",
"Closure",
"$",
"cmd",
")",
"{",
"$",
"cmd",
"=",
"new",
"ReflectionFunction",
"(",
"$",
"cmd",
")",
";",
"$",
"code",
"=",
"implode",
"(",
"array_slice",
"(",
"file",
"(",
"$",
"cmd",
"->",
"getFileName",
"(",
")"... | Run a closure in the WordPress environment.
@param closure $cmd
@return mixed | [
"Run",
"a",
"closure",
"in",
"the",
"WordPress",
"environment",
"."
] | train | https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/PluginInteractor.php#L305-L373 |
php-lug/lug | src/Component/Grid/Filter/Type/NumberType.php | NumberType.process | protected function process($field, $data, array $options)
{
$builder = $options['builder'];
switch ($data['type']) {
case self::TYPE_GREATER_THAN_OR_EQUALS:
return $builder->getExpressionBuilder()->gte(
$builder->getProperty($field),
... | php | protected function process($field, $data, array $options)
{
$builder = $options['builder'];
switch ($data['type']) {
case self::TYPE_GREATER_THAN_OR_EQUALS:
return $builder->getExpressionBuilder()->gte(
$builder->getProperty($field),
... | [
"protected",
"function",
"process",
"(",
"$",
"field",
",",
"$",
"data",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"=",
"$",
"options",
"[",
"'builder'",
"]",
";",
"switch",
"(",
"$",
"data",
"[",
"'type'",
"]",
")",
"{",
"case",
"sel... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Filter/Type/NumberType.php#L86-L162 |
GrupaZero/api | src/Gzero/Api/Controller/Admin/RouteController.php | RouteController.store | public function store($contentId)
{
$content = $this->repository->getById($contentId);
if (!empty($content)) {
$this->authorize('create', $content);
$this->authorize('update', $content);
if ($content->type != 'category') {
$input = $this->validator... | php | public function store($contentId)
{
$content = $this->repository->getById($contentId);
if (!empty($content)) {
$this->authorize('create', $content);
$this->authorize('update', $content);
if ($content->type != 'category') {
$input = $this->validator... | [
"public",
"function",
"store",
"(",
"$",
"contentId",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"repository",
"->",
"getById",
"(",
"$",
"contentId",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"content",
")",
")",
"{",
"$",
"this",
"->",
... | Stores newly created route for specified content entity in database.
@param int $contentId Id of the content
@return \Illuminate\Http\JsonResponse
@throws RepositoryValidationException | [
"Stores",
"newly",
"created",
"route",
"for",
"specified",
"content",
"entity",
"in",
"database",
"."
] | train | https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/RouteController.php#L62-L78 |
Litecms/Team | src/Providers/TeamServiceProvider.php | TeamServiceProvider.boot | public function boot()
{
// Load view
$this->loadViewsFrom(__DIR__ . '/../../resources/views', 'team');
// Load translation
$this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'team');
// Load migrations
$this->loadMigrationsFrom(__DIR__ . '/../../databas... | php | public function boot()
{
// Load view
$this->loadViewsFrom(__DIR__ . '/../../resources/views', 'team');
// Load translation
$this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'team');
// Load migrations
$this->loadMigrationsFrom(__DIR__ . '/../../databas... | [
"public",
"function",
"boot",
"(",
")",
"{",
"// Load view",
"$",
"this",
"->",
"loadViewsFrom",
"(",
"__DIR__",
".",
"'/../../resources/views'",
",",
"'team'",
")",
";",
"// Load translation",
"$",
"this",
"->",
"loadTranslationsFrom",
"(",
"__DIR__",
".",
"'/.... | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/Litecms/Team/blob/a444a6a6604c969df138ac0eb57ed5f4696b0f00/src/Providers/TeamServiceProvider.php#L21-L35 |
Litecms/Team | src/Providers/TeamServiceProvider.php | TeamServiceProvider.register | public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../../config/config.php', 'litecms.team');
// Bind facade
$this->app->bind('litecms.team', function ($app) {
return $this->app->make('Litecms\Team\Team');
});
// Bind Team to repository
... | php | public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../../config/config.php', 'litecms.team');
// Bind facade
$this->app->bind('litecms.team', function ($app) {
return $this->app->make('Litecms\Team\Team');
});
// Bind Team to repository
... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/../../config/config.php'",
",",
"'litecms.team'",
")",
";",
"// Bind facade",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'litecms.team'",
",",
"fu... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/Litecms/Team/blob/a444a6a6604c969df138ac0eb57ed5f4696b0f00/src/Providers/TeamServiceProvider.php#L42-L61 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/writer.php | ezcDbSchemaPhpArrayWriter.saveToFile | public function saveToFile( $file, ezcDbSchema $dbSchema )
{
$schema = $dbSchema->getSchema();
$data = $dbSchema->getData();
$fileData = '<?php return '. var_export( array( $schema, $data ), true ) . '; ?>';
if ( ! @file_put_contents( $file, (string) $fileData ) )
{
... | php | public function saveToFile( $file, ezcDbSchema $dbSchema )
{
$schema = $dbSchema->getSchema();
$data = $dbSchema->getData();
$fileData = '<?php return '. var_export( array( $schema, $data ), true ) . '; ?>';
if ( ! @file_put_contents( $file, (string) $fileData ) )
{
... | [
"public",
"function",
"saveToFile",
"(",
"$",
"file",
",",
"ezcDbSchema",
"$",
"dbSchema",
")",
"{",
"$",
"schema",
"=",
"$",
"dbSchema",
"->",
"getSchema",
"(",
")",
";",
"$",
"data",
"=",
"$",
"dbSchema",
"->",
"getData",
"(",
")",
";",
"$",
"fileD... | Saves the schema definition in $schema to the file $file.
@todo throw exception when file can not be opened
@param string $file
@param ezcDbSchema $dbSchema | [
"Saves",
"the",
"schema",
"definition",
"in",
"$schema",
"to",
"the",
"file",
"$file",
".",
"@todo",
"throw",
"exception",
"when",
"file",
"can",
"not",
"be",
"opened"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/writer.php#L50-L60 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/writer.php | ezcDbSchemaPhpArrayWriter.saveDiffToFile | public function saveDiffToFile( $file, ezcDbSchemaDiff $dbSchemaDiff )
{
$fileData = '<?php return '. var_export( $dbSchemaDiff, true ) . '; ?>';
if ( ! @file_put_contents( $file, (string) $fileData ) )
{
throw new ezcBaseFilePermissionException( $file, ezcBaseFileException::WRIT... | php | public function saveDiffToFile( $file, ezcDbSchemaDiff $dbSchemaDiff )
{
$fileData = '<?php return '. var_export( $dbSchemaDiff, true ) . '; ?>';
if ( ! @file_put_contents( $file, (string) $fileData ) )
{
throw new ezcBaseFilePermissionException( $file, ezcBaseFileException::WRIT... | [
"public",
"function",
"saveDiffToFile",
"(",
"$",
"file",
",",
"ezcDbSchemaDiff",
"$",
"dbSchemaDiff",
")",
"{",
"$",
"fileData",
"=",
"'<?php return '",
".",
"var_export",
"(",
"$",
"dbSchemaDiff",
",",
"true",
")",
".",
"'; ?>'",
";",
"if",
"(",
"!",
"@"... | Saves the differences in $schemaDiff to the file $file
@todo throw exception when file can not be opened
@param string $file
@param ezcDbSchemaDiff $dbSchemaDiff | [
"Saves",
"the",
"differences",
"in",
"$schemaDiff",
"to",
"the",
"file",
"$file",
"@todo",
"throw",
"exception",
"when",
"file",
"can",
"not",
"be",
"opened"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/writer.php#L69-L76 |
Eresus/EresusCMS | src/core/DB.php | Eresus_DB.connect | public static function connect($dsn, $name = false)
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '("%s", %s)', $dsn, $name);
try
{
$db = ezcDbFactory::create($dsn);
}
catch (Exception $e)
{
throw new Eresus_DB_Exception("Can not connect to '$ds... | php | public static function connect($dsn, $name = false)
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '("%s", %s)', $dsn, $name);
try
{
$db = ezcDbFactory::create($dsn);
}
catch (Exception $e)
{
throw new Eresus_DB_Exception("Can not connect to '$ds... | [
"public",
"static",
"function",
"connect",
"(",
"$",
"dsn",
",",
"$",
"name",
"=",
"false",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_DEBUG",
",",
"'(\"%s\", %s)'",
",",
"$",
"dsn",
",",
"$",
"name",
")",
";",
"try",
"{",
"... | Создаёт подключение к БД
@param string $dsn DSN
@param string|bool $name опциональное имя соединения
@throws Eresus_DB_Exception
@return ezcDbHandler | [
"Создаёт",
"подключение",
"к",
"БД"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/DB.php#L54-L76 |
Eresus/EresusCMS | src/core/DB.php | Eresus_DB.lazyConnection | public static function lazyConnection($dsn, $name = false)
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '("%s", %s)', $dsn, $name);
self::$lazyConnectionDSNs[$name] = $dsn;
} | php | public static function lazyConnection($dsn, $name = false)
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '("%s", %s)', $dsn, $name);
self::$lazyConnectionDSNs[$name] = $dsn;
} | [
"public",
"static",
"function",
"lazyConnection",
"(",
"$",
"dsn",
",",
"$",
"name",
"=",
"false",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_DEBUG",
",",
"'(\"%s\", %s)'",
",",
"$",
"dsn",
",",
"$",
"name",
")",
";",
"self",
... | Configures lazy connection to DB
@param string $dsn Connection DSN string
@param string|bool $name Optional connection name
@return void | [
"Configures",
"lazy",
"connection",
"to",
"DB"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/DB.php#L85-L89 |
Eresus/EresusCMS | src/core/DB.php | Eresus_DB.configureObject | public static function configureObject($name)
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '(%s)', $name);
if (!isset(self::$lazyConnectionDSNs[$name]))
{
throw new Eresus_DB_Exception('DSN for lazy connection "' . $name . '" not found');
}
$dsn = self::$lazyConn... | php | public static function configureObject($name)
{
Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '(%s)', $name);
if (!isset(self::$lazyConnectionDSNs[$name]))
{
throw new Eresus_DB_Exception('DSN for lazy connection "' . $name . '" not found');
}
$dsn = self::$lazyConn... | [
"public",
"static",
"function",
"configureObject",
"(",
"$",
"name",
")",
"{",
"Eresus_Kernel",
"::",
"log",
"(",
"__METHOD__",
",",
"LOG_DEBUG",
",",
"'(%s)'",
",",
"$",
"name",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"lazyConnectionD... | eZ Components lazy init
@param bool|string $name Connection name
@throws Eresus_DB_Exception
@return ezcDbHandler | [
"eZ",
"Components",
"lazy",
"init"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/DB.php#L123-L136 |
Eresus/EresusCMS | src/core/DB.php | DBQueryInsider.bindValue | public function bindValue($paramNo, $param, $type = null)
{
$this->values[$paramNo] = var_export($param, true);
return true;
} | php | public function bindValue($paramNo, $param, $type = null)
{
$this->values[$paramNo] = var_export($param, true);
return true;
} | [
"public",
"function",
"bindValue",
"(",
"$",
"paramNo",
",",
"$",
"param",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"values",
"[",
"$",
"paramNo",
"]",
"=",
"var_export",
"(",
"$",
"param",
",",
"true",
")",
";",
"return",
"true"... | Bind value
@param int $paramNo
@param mixed $param
@param int|null $type
@return bool | [
"Bind",
"value"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/DB.php#L213-L217 |
Eresus/EresusCMS | src/core/DB.php | DBQueryInsider.bindParam | public function bindParam($paramNo, &$param, $type = null, $maxLength = null, $driverData = null)
{
$this->bindValue($paramNo, $param, $type);
return true;
} | php | public function bindParam($paramNo, &$param, $type = null, $maxLength = null, $driverData = null)
{
$this->bindValue($paramNo, $param, $type);
return true;
} | [
"public",
"function",
"bindParam",
"(",
"$",
"paramNo",
",",
"&",
"$",
"param",
",",
"$",
"type",
"=",
"null",
",",
"$",
"maxLength",
"=",
"null",
",",
"$",
"driverData",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"bindValue",
"(",
"$",
"paramNo",
"... | Bind param
@param int $paramNo
@param mixed $param
@param int $type
@param int $maxLength
@param mixed $driverData
@return bool | [
"Bind",
"param"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/DB.php#L230-L234 |
Eresus/EresusCMS | src/core/DB.php | DBQueryInsider.subst | public function subst($query)
{
foreach ($this->values as $key => $value)
{
$query = preg_replace("/$key(\s|,|$)/", "$value$1", $query);
}
return $query;
} | php | public function subst($query)
{
foreach ($this->values as $key => $value)
{
$query = preg_replace("/$key(\s|,|$)/", "$value$1", $query);
}
return $query;
} | [
"public",
"function",
"subst",
"(",
"$",
"query",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"query",
"=",
"preg_replace",
"(",
"\"/$key(\\s|,|$)/\"",
",",
"\"$value$1\"",
",",
"$",
"quer... | Substitute values in query
@param string $query
@return string | [
"Substitute",
"values",
"in",
"query"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/DB.php#L242-L250 |
mothership-ec/composer | src/Composer/Repository/Vcs/GitDriver.php | GitDriver.initialize | public function initialize()
{
if (Filesystem::isLocalPath($this->url)) {
$this->repoDir = $this->url;
$cacheUrl = realpath($this->url);
} else {
$this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
... | php | public function initialize()
{
if (Filesystem::isLocalPath($this->url)) {
$this->repoDir = $this->url;
$cacheUrl = realpath($this->url);
} else {
$this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"Filesystem",
"::",
"isLocalPath",
"(",
"$",
"this",
"->",
"url",
")",
")",
"{",
"$",
"this",
"->",
"repoDir",
"=",
"$",
"this",
"->",
"url",
";",
"$",
"cacheUrl",
"=",
"realpath",
"(",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/Vcs/GitDriver.php#L38-L90 |
mothership-ec/composer | src/Composer/Repository/Vcs/GitDriver.php | GitDriver.getComposerInformation | public function getComposerInformation($identifier)
{
if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
$this->infoCache[$identifier] = JsonFile::parseJson($res);
}
if (!isset($this->infoCache[$identifier])) {
$resource = spr... | php | public function getComposerInformation($identifier)
{
if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
$this->infoCache[$identifier] = JsonFile::parseJson($res);
}
if (!isset($this->infoCache[$identifier])) {
$resource = spr... | [
"public",
"function",
"getComposerInformation",
"(",
"$",
"identifier",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'{[a-f0-9]{40}}i'",
",",
"$",
"identifier",
")",
"&&",
"$",
"res",
"=",
"$",
"this",
"->",
"cache",
"->",
"read",
"(",
"$",
"identifier",
")",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/Vcs/GitDriver.php#L143-L173 |
surebert/surebert-framework | src/sb/Cameras/Axis/Q6035.php | Q6035.takeSnapShot | public function takeSnapShot($user_agent='Surebert Kamera', $options=Array()){
$ch = curl_init($this->url.'/jpg/1/image.jpg?timestamp='.time());
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, $this->uname.':'.$this->pass);
curl_setopt($ch, ... | php | public function takeSnapShot($user_agent='Surebert Kamera', $options=Array()){
$ch = curl_init($this->url.'/jpg/1/image.jpg?timestamp='.time());
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, $this->uname.':'.$this->pass);
curl_setopt($ch, ... | [
"public",
"function",
"takeSnapShot",
"(",
"$",
"user_agent",
"=",
"'Surebert Kamera'",
",",
"$",
"options",
"=",
"Array",
"(",
")",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"this",
"->",
"url",
".",
"'/jpg/1/image.jpg?timestamp='",
".",
"time",
"(... | Retrives a current snapshot
@return string jpeg data | [
"Retrives",
"a",
"current",
"snapshot"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cameras/Axis/Q6035.php#L49-L65 |
surebert/surebert-framework | src/sb/Cameras/Axis/Q6035.php | Q6035.saveSnapshot | public function saveSnapshot($dir){
if(!is_dir($dir)){
mkdir($dir, 0775, true);
}
$jpeg = $this->takeSnapShot();
$file = $dir.'/'.date('Y_m_d_H_i_s').'.jpg';
if(file_put_contents($file, $jpeg)){
return $file;
}
re... | php | public function saveSnapshot($dir){
if(!is_dir($dir)){
mkdir($dir, 0775, true);
}
$jpeg = $this->takeSnapShot();
$file = $dir.'/'.date('Y_m_d_H_i_s').'.jpg';
if(file_put_contents($file, $jpeg)){
return $file;
}
re... | [
"public",
"function",
"saveSnapshot",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dir",
")",
")",
"{",
"mkdir",
"(",
"$",
"dir",
",",
"0775",
",",
"true",
")",
";",
"}",
"$",
"jpeg",
"=",
"$",
"this",
"->",
"takeSnapShot",
"... | Retrieves and stores a snapshot by date
@param type $dir
@return string Path if saved, empty string if not | [
"Retrieves",
"and",
"stores",
"a",
"snapshot",
"by",
"date"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Cameras/Axis/Q6035.php#L72-L85 |
Visithor/visithor | src/Visithor/Command/GoCommand.php | GoCommand.configure | protected function configure()
{
$this
->setName('visithor:go')
->setDescription('Visit all defined urls')
->addOption(
'config',
'c',
InputOption::VALUE_OPTIONAL,
"Config file directory",
get... | php | protected function configure()
{
$this
->setName('visithor:go')
->setDescription('Visit all defined urls')
->addOption(
'config',
'c',
InputOption::VALUE_OPTIONAL,
"Config file directory",
get... | [
"protected",
"function",
"configure",
"(",
")",
"{",
"$",
"this",
"->",
"setName",
"(",
"'visithor:go'",
")",
"->",
"setDescription",
"(",
"'Visit all defined urls'",
")",
"->",
"addOption",
"(",
"'config'",
",",
"'c'",
",",
"InputOption",
"::",
"VALUE_OPTIONAL"... | configure | [
"configure"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Command/GoCommand.php#L40-L59 |
Visithor/visithor | src/Visithor/Command/GoCommand.php | GoCommand.execute | protected function execute(
InputInterface $input,
OutputInterface $output
) {
$this->checkEnvironment(
$input,
$output
);
$configPath = rtrim($input->getOption('config'), '/');
$format = $input->getOption('format');
$reader = new Yam... | php | protected function execute(
InputInterface $input,
OutputInterface $output
) {
$this->checkEnvironment(
$input,
$output
);
$configPath = rtrim($input->getOption('config'), '/');
$format = $input->getOption('format');
$reader = new Yam... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"checkEnvironment",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"configPath",
"=",
"rtrim",
"(",
"$",
"... | Execute command
This method returns 0 if all executions passed. 1 otherwise.
@param InputInterface $input Input
@param OutputInterface $output Output
@return integer Execution return
@throws Exception | [
"Execute",
"command"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Command/GoCommand.php#L73-L122 |
Visithor/visithor | src/Visithor/Command/GoCommand.php | GoCommand.executeVisithor | protected function executeVisithor(
OutputInterface $output,
array $config,
$format
) {
$client = new GuzzleClient();
$rendererFactory = new RendererFactory();
$renderer = $rendererFactory->create($format);
$executor = new Executor($client);
$executor-... | php | protected function executeVisithor(
OutputInterface $output,
array $config,
$format
) {
$client = new GuzzleClient();
$rendererFactory = new RendererFactory();
$renderer = $rendererFactory->create($format);
$executor = new Executor($client);
$executor-... | [
"protected",
"function",
"executeVisithor",
"(",
"OutputInterface",
"$",
"output",
",",
"array",
"$",
"config",
",",
"$",
"format",
")",
"{",
"$",
"client",
"=",
"new",
"GuzzleClient",
"(",
")",
";",
"$",
"rendererFactory",
"=",
"new",
"RendererFactory",
"("... | Executes all business logic inside this command
This method returns 0 if all executions passed. 1 otherwise.
@param OutputInterface $output Output
@param array $config Config
@param string $format Format
@return integer Execution return | [
"Executes",
"all",
"business",
"logic",
"inside",
"this",
"command"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Command/GoCommand.php#L135-L161 |
Visithor/visithor | src/Visithor/Command/GoCommand.php | GoCommand.checkEnvironment | protected function checkEnvironment(
InputInterface $input,
OutputInterface $output
) {
$env = $input
->getParameterOption(
['--env', '-e'],
getenv('SYMFONY_ENV') ?: 'dev'
);
if ('test' != $env) {
$output->writeln('... | php | protected function checkEnvironment(
InputInterface $input,
OutputInterface $output
) {
$env = $input
->getParameterOption(
['--env', '-e'],
getenv('SYMFONY_ENV') ?: 'dev'
);
if ('test' != $env) {
$output->writeln('... | [
"protected",
"function",
"checkEnvironment",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"env",
"=",
"$",
"input",
"->",
"getParameterOption",
"(",
"[",
"'--env'",
",",
"'-e'",
"]",
",",
"getenv",
"(",
"'SYMFONY... | Check environment. If not test, add a notice
@param InputInterface $input Input
@param OutputInterface $output Output
@return $this Self object | [
"Check",
"environment",
".",
"If",
"not",
"test",
"add",
"a",
"notice"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Command/GoCommand.php#L171-L186 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.install | public function install()
{
$position = 250;
$exists = array();
foreach (array(
'path' => array('text_input', '../../backups'),
'copy_paths' => array('text_input', '../'),
'exclude_files' => array('text_input', ''),
'ignore_tables'... | php | public function install()
{
$position = 250;
$exists = array();
foreach (array(
'path' => array('text_input', '../../backups'),
'copy_paths' => array('text_input', '../'),
'exclude_files' => array('text_input', ''),
'ignore_tables'... | [
"public",
"function",
"install",
"(",
")",
"{",
"$",
"position",
"=",
"250",
";",
"$",
"exists",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"array",
"(",
"'path'",
"=>",
"array",
"(",
"'text_input'",
",",
"'../../backups'",
")",
",",
"'copy_paths'",
... | Installer. | [
"Installer",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L75-L101 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.takeBackup | public function takeBackup()
{
global $txpcfg;
$directory = txpath . '/' . get_pref('rah_backup_path');
$fileMultiplier = 1;
if (!get_pref('rah_backup_path') || !file_exists($directory) || !is_dir($directory) || !is_writable($directory)) {
throw new Rah_Backup_Exception... | php | public function takeBackup()
{
global $txpcfg;
$directory = txpath . '/' . get_pref('rah_backup_path');
$fileMultiplier = 1;
if (!get_pref('rah_backup_path') || !file_exists($directory) || !is_dir($directory) || !is_writable($directory)) {
throw new Rah_Backup_Exception... | [
"public",
"function",
"takeBackup",
"(",
")",
"{",
"global",
"$",
"txpcfg",
";",
"$",
"directory",
"=",
"txpath",
".",
"'/'",
".",
"get_pref",
"(",
"'rah_backup_path'",
")",
";",
"$",
"fileMultiplier",
"=",
"1",
";",
"if",
"(",
"!",
"get_pref",
"(",
"'... | Takes a new set of backups.
This method creates a new set of backups and it
can be run by triggering 'rah_backup.backup' event.
<code>
callback_event('rah_backup.backup');
</code>
On success it triggers two callback events 'rah_backup.create' and
'rah_backup.created', where the latter contains an data-map of created... | [
"Takes",
"a",
"new",
"set",
"of",
"backups",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L138-L254 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.sanitize | private function sanitize($filename)
{
$filename = preg_replace('/[^A-Za-z0-9\-\._]/', '.', (string) $filename);
return trim(substr(preg_replace('/[_\.\-]{2,}/', '.', $filename), 0, 40), '._-');
} | php | private function sanitize($filename)
{
$filename = preg_replace('/[^A-Za-z0-9\-\._]/', '.', (string) $filename);
return trim(substr(preg_replace('/[_\.\-]{2,}/', '.', $filename), 0, 40), '._-');
} | [
"private",
"function",
"sanitize",
"(",
"$",
"filename",
")",
"{",
"$",
"filename",
"=",
"preg_replace",
"(",
"'/[^A-Za-z0-9\\-\\._]/'",
",",
"'.'",
",",
"(",
"string",
")",
"$",
"filename",
")",
";",
"return",
"trim",
"(",
"substr",
"(",
"preg_replace",
"... | Sanitizes filename.
@param string $filename The filename
@return string A safe filename | [
"Sanitizes",
"filename",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L263-L267 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.pane | public function pane()
{
global $step;
require_privs('rah_backup');
$steps = array(
'browser' => false,
'create' => true,
'download' => true,
'multi_edit' => true,
);
if (!$step || !bouncer($step, $steps) || !has_privs('rah_b... | php | public function pane()
{
global $step;
require_privs('rah_backup');
$steps = array(
'browser' => false,
'create' => true,
'download' => true,
'multi_edit' => true,
);
if (!$step || !bouncer($step, $steps) || !has_privs('rah_b... | [
"public",
"function",
"pane",
"(",
")",
"{",
"global",
"$",
"step",
";",
"require_privs",
"(",
"'rah_backup'",
")",
";",
"$",
"steps",
"=",
"array",
"(",
"'browser'",
"=>",
"false",
",",
"'create'",
"=>",
"true",
",",
"'download'",
"=>",
"true",
",",
"... | Delivers panels. | [
"Delivers",
"panels",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L273-L291 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.head | public function head()
{
global $event, $theme;
if ($event != 'rah_backup') {
return;
}
gTxtScript(array(
'rah_backup_confirm_backup',
));
$msg = array(
'backup' => escape_js($theme->announce_async(gTxt('rah_backup_taking'))),
... | php | public function head()
{
global $event, $theme;
if ($event != 'rah_backup') {
return;
}
gTxtScript(array(
'rah_backup_confirm_backup',
));
$msg = array(
'backup' => escape_js($theme->announce_async(gTxt('rah_backup_taking'))),
... | [
"public",
"function",
"head",
"(",
")",
"{",
"global",
"$",
"event",
",",
"$",
"theme",
";",
"if",
"(",
"$",
"event",
"!=",
"'rah_backup'",
")",
"{",
"return",
";",
"}",
"gTxtScript",
"(",
"array",
"(",
"'rah_backup_confirm_backup'",
",",
")",
")",
";"... | Adds the panel's CSS and JavaScript to the <head>. | [
"Adds",
"the",
"panel",
"s",
"CSS",
"and",
"JavaScript",
"to",
"the",
"<",
";",
"head>",
";",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L297-L349 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.browser | private function browser($message = '')
{
global $event, $app_mode, $theme;
extract(gpsa(array(
'sort',
'dir',
)));
$methods = array();
$path = get_pref('rah_backup_path');
$writeable = $path && file_exists($path) && is_dir($path) && is_writ... | php | private function browser($message = '')
{
global $event, $app_mode, $theme;
extract(gpsa(array(
'sort',
'dir',
)));
$methods = array();
$path = get_pref('rah_backup_path');
$writeable = $path && file_exists($path) && is_dir($path) && is_writ... | [
"private",
"function",
"browser",
"(",
"$",
"message",
"=",
"''",
")",
"{",
"global",
"$",
"event",
",",
"$",
"app_mode",
",",
"$",
"theme",
";",
"extract",
"(",
"gpsa",
"(",
"array",
"(",
"'sort'",
",",
"'dir'",
",",
")",
")",
")",
";",
"$",
"me... | The main panel listing backups.
@param string|array $message The activity message | [
"The",
"main",
"panel",
"listing",
"backups",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L357-L488 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.create | private function create()
{
try {
callback_event('rah_backup.backup');
} catch (Rah_Backup_Exception $e) {
$this->browser(array($e->getMessage(), E_ERROR));
return;
} catch (Exception $e) {
$this->browser(array(txpspecialchars($e->getMessage())... | php | private function create()
{
try {
callback_event('rah_backup.backup');
} catch (Rah_Backup_Exception $e) {
$this->browser(array($e->getMessage(), E_ERROR));
return;
} catch (Exception $e) {
$this->browser(array(txpspecialchars($e->getMessage())... | [
"private",
"function",
"create",
"(",
")",
"{",
"try",
"{",
"callback_event",
"(",
"'rah_backup.backup'",
")",
";",
"}",
"catch",
"(",
"Rah_Backup_Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"browser",
"(",
"array",
"(",
"$",
"e",
"->",
"getMessag... | The panel that creates new backups. | [
"The",
"panel",
"that",
"creates",
"new",
"backups",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L494-L507 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.download | private function download()
{
$file = (string) gps('file');
try {
$backups = $this->getBackups();
} catch (Exception $e) {
}
if (empty($backups) || !isset($backups[$file])) {
$this->browser(array(gTxt('rah_backup_can_not_download'), E_ERROR));
... | php | private function download()
{
$file = (string) gps('file');
try {
$backups = $this->getBackups();
} catch (Exception $e) {
}
if (empty($backups) || !isset($backups[$file])) {
$this->browser(array(gTxt('rah_backup_can_not_download'), E_ERROR));
... | [
"private",
"function",
"download",
"(",
")",
"{",
"$",
"file",
"=",
"(",
"string",
")",
"gps",
"(",
"'file'",
")",
";",
"try",
"{",
"$",
"backups",
"=",
"$",
"this",
"->",
"getBackups",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")"... | Streams backups for downloading. | [
"Streams",
"backups",
"for",
"downloading",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L513-L555 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.multi_edit | private function multi_edit()
{
extract(psa(array(
'selected',
'edit_method',
)));
require_privs('rah_backup_'.((string) $edit_method));
if (!is_string($edit_method) || empty($selected) || !is_array($selected)) {
$this->browser(array(gTxt('rah_ba... | php | private function multi_edit()
{
extract(psa(array(
'selected',
'edit_method',
)));
require_privs('rah_backup_'.((string) $edit_method));
if (!is_string($edit_method) || empty($selected) || !is_array($selected)) {
$this->browser(array(gTxt('rah_ba... | [
"private",
"function",
"multi_edit",
"(",
")",
"{",
"extract",
"(",
"psa",
"(",
"array",
"(",
"'selected'",
",",
"'edit_method'",
",",
")",
")",
")",
";",
"require_privs",
"(",
"'rah_backup_'",
".",
"(",
"(",
"string",
")",
"$",
"edit_method",
")",
")",
... | Multi-edit handler. | [
"Multi",
"-",
"edit",
"handler",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L561-L582 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.multi_option_delete | private function multi_option_delete()
{
$selected = ps('selected');
$deleted = array();
try {
foreach ($this->getBackups() as $name => $file) {
if (in_array($name, $selected, true)) {
$deleted[$name] = $file['path'];
@unli... | php | private function multi_option_delete()
{
$selected = ps('selected');
$deleted = array();
try {
foreach ($this->getBackups() as $name => $file) {
if (in_array($name, $selected, true)) {
$deleted[$name] = $file['path'];
@unli... | [
"private",
"function",
"multi_option_delete",
"(",
")",
"{",
"$",
"selected",
"=",
"ps",
"(",
"'selected'",
")",
";",
"$",
"deleted",
"=",
"array",
"(",
")",
";",
"try",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getBackups",
"(",
")",
"as",
"$",
"name... | Deletes selected backups. | [
"Deletes",
"selected",
"backups",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L588-L608 |
gocom/rah_backup | src/Rah/Backup.php | Rah_Backup.getBackups | private function getBackups($sort = 'name', $direction = 'asc', $offset = 0, $limit = null)
{
$directory = txpath . '/' . get_pref('rah_backup_path');
if (!get_pref('rah_backup_path') || !file_exists($directory) || !is_dir($directory) || !is_readable($directory)) {
throw new Rah_Backup_... | php | private function getBackups($sort = 'name', $direction = 'asc', $offset = 0, $limit = null)
{
$directory = txpath . '/' . get_pref('rah_backup_path');
if (!get_pref('rah_backup_path') || !file_exists($directory) || !is_dir($directory) || !is_readable($directory)) {
throw new Rah_Backup_... | [
"private",
"function",
"getBackups",
"(",
"$",
"sort",
"=",
"'name'",
",",
"$",
"direction",
"=",
"'asc'",
",",
"$",
"offset",
"=",
"0",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"directory",
"=",
"txpath",
".",
"'/'",
".",
"get_pref",
"(",
"'... | Gets a list of backups.
@param string $sort Sorting criteria, either 'name', 'ext', 'date', 'size', 'type'
@param string $direction Sorting direction, either 'asc' or 'desc'
@param int $offset Offset
@param int $limit Limit results
@return array | [
"Gets",
"a",
"list",
"of",
"backups",
"."
] | train | https://github.com/gocom/rah_backup/blob/1a757c0fd569f4baf59471da8b1b487472a71390/src/Rah/Backup.php#L620-L680 |
zhouyl/mellivora | Mellivora/Database/Eloquent/Collection.php | Collection.find | public function find($key, $default = null)
{
if ($key instanceof Model) {
$key = $key->getKey();
}
if (is_array($key)) {
if ($this->isEmpty()) {
return new static;
}
return $this->whereIn($this->first()->getKeyName(), $key);
... | php | public function find($key, $default = null)
{
if ($key instanceof Model) {
$key = $key->getKey();
}
if (is_array($key)) {
if ($this->isEmpty()) {
return new static;
}
return $this->whereIn($this->first()->getKeyName(), $key);
... | [
"public",
"function",
"find",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
"instanceof",
"Model",
")",
"{",
"$",
"key",
"=",
"$",
"key",
"->",
"getKey",
"(",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",... | Find a model in the collection by key.
@param mixed $key
@param mixed $default
@return \Mellivora\Database\Eloquent\Model|static | [
"Find",
"a",
"model",
"in",
"the",
"collection",
"by",
"key",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Eloquent/Collection.php#L20-L37 |
zhouyl/mellivora | Mellivora/Database/Eloquent/Collection.php | Collection.load | public function load($relations)
{
if (count($this->items) > 0) {
if (is_string($relations)) {
$relations = func_get_args();
}
$query = $this->first()->newQuery()->with($relations);
$this->items = $query->eagerLoadRelations($this->items);
... | php | public function load($relations)
{
if (count($this->items) > 0) {
if (is_string($relations)) {
$relations = func_get_args();
}
$query = $this->first()->newQuery()->with($relations);
$this->items = $query->eagerLoadRelations($this->items);
... | [
"public",
"function",
"load",
"(",
"$",
"relations",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"items",
")",
">",
"0",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"relations",
")",
")",
"{",
"$",
"relations",
"=",
"func_get_args",
"(",
... | Load a set of relationships onto the collection.
@param mixed $relations
@return $this | [
"Load",
"a",
"set",
"of",
"relationships",
"onto",
"the",
"collection",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Eloquent/Collection.php#L46-L59 |
arndtteunissen/column-layout | Classes/Hook/LayoutPreviewHook.php | LayoutPreviewHook.injectStylesAndScripts | public function injectStylesAndScripts(array $params, PageLayoutController $ref): string
{
$jsCallbackFunction = null;
// The translation view is shown. Disable floating elements for that view.
if ($ref->MOD_SETTINGS['function'] === '2') {
$jsCallbackFunction = 'function(ColumnL... | php | public function injectStylesAndScripts(array $params, PageLayoutController $ref): string
{
$jsCallbackFunction = null;
// The translation view is shown. Disable floating elements for that view.
if ($ref->MOD_SETTINGS['function'] === '2') {
$jsCallbackFunction = 'function(ColumnL... | [
"public",
"function",
"injectStylesAndScripts",
"(",
"array",
"$",
"params",
",",
"PageLayoutController",
"$",
"ref",
")",
":",
"string",
"{",
"$",
"jsCallbackFunction",
"=",
"null",
";",
"// The translation view is shown. Disable floating elements for that view.",
"if",
... | Hook for header rendering of the PageLayoutController to inject stylesheet required for custom column layout
display.
@see PageLayoutController::renderContent()
@param array $params
@param PageLayoutController $ref
@return string html to be added to the page layout | [
"Hook",
"for",
"header",
"rendering",
"of",
"the",
"PageLayoutController",
"to",
"inject",
"stylesheet",
"required",
"for",
"custom",
"column",
"layout",
"display",
"."
] | train | https://github.com/arndtteunissen/column-layout/blob/ad737068eef3b084d4d0e3a48e6a3d8277af9560/Classes/Hook/LayoutPreviewHook.php#L38-L54 |
arndtteunissen/column-layout | Classes/Hook/LayoutPreviewHook.php | LayoutPreviewHook.preProcess | public function preProcess(PageLayoutView &$parentObject, &$info, array &$row)
{
if ($this->skipRendering($parentObject, $row)) {
return;
}
$renderer = GeneralUtility::makeInstance(ColumnRenderer::class, $row);
if (!$renderer->skipRendering()) {
list($html, ... | php | public function preProcess(PageLayoutView &$parentObject, &$info, array &$row)
{
if ($this->skipRendering($parentObject, $row)) {
return;
}
$renderer = GeneralUtility::makeInstance(ColumnRenderer::class, $row);
if (!$renderer->skipRendering()) {
list($html, ... | [
"public",
"function",
"preProcess",
"(",
"PageLayoutView",
"&",
"$",
"parentObject",
",",
"&",
"$",
"info",
",",
"array",
"&",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"skipRendering",
"(",
"$",
"parentObject",
",",
"$",
"row",
")",
")",
"... | {@inheritdoc}
@param array $info | [
"{"
] | train | https://github.com/arndtteunissen/column-layout/blob/ad737068eef3b084d4d0e3a48e6a3d8277af9560/Classes/Hook/LayoutPreviewHook.php#L60-L76 |
arndtteunissen/column-layout | Classes/Hook/LayoutPreviewHook.php | LayoutPreviewHook.skipRendering | protected function skipRendering(PageLayoutView &$parentObject, array $row): bool
{
$tsConf = $parentObject->modTSconfig['column_layout'] ?? [];
return (
$tsConf['hidePreview'] ?? false // Hidden via page TSConfig
|| empty($row['tx_column_layout_column_co... | php | protected function skipRendering(PageLayoutView &$parentObject, array $row): bool
{
$tsConf = $parentObject->modTSconfig['column_layout'] ?? [];
return (
$tsConf['hidePreview'] ?? false // Hidden via page TSConfig
|| empty($row['tx_column_layout_column_co... | [
"protected",
"function",
"skipRendering",
"(",
"PageLayoutView",
"&",
"$",
"parentObject",
",",
"array",
"$",
"row",
")",
":",
"bool",
"{",
"$",
"tsConf",
"=",
"$",
"parentObject",
"->",
"modTSconfig",
"[",
"'column_layout'",
"]",
"??",
"[",
"]",
";",
"ret... | Checks if the rendering of the column markup should be skipped.
@param PageLayoutView $parentObject
@return bool | [
"Checks",
"if",
"the",
"rendering",
"of",
"the",
"column",
"markup",
"should",
"be",
"skipped",
"."
] | train | https://github.com/arndtteunissen/column-layout/blob/ad737068eef3b084d4d0e3a48e6a3d8277af9560/Classes/Hook/LayoutPreviewHook.php#L84-L93 |
krakphp/job | src/Queue/Sync/SyncQueue.php | SyncQueue.enqueue | public function enqueue(Job\WrappedJob $job) {
$serialized = Job\serializeJobs([$job->withQueueProvider('sync')]);
$res = unserialize($this->worker->work($serialized));
if ($res[0]->isFailed()) {
throw new \RuntimeException("Job Failed - " . json_encode($res[0], JSON_PRETTY_PRINT));
... | php | public function enqueue(Job\WrappedJob $job) {
$serialized = Job\serializeJobs([$job->withQueueProvider('sync')]);
$res = unserialize($this->worker->work($serialized));
if ($res[0]->isFailed()) {
throw new \RuntimeException("Job Failed - " . json_encode($res[0], JSON_PRETTY_PRINT));
... | [
"public",
"function",
"enqueue",
"(",
"Job",
"\\",
"WrappedJob",
"$",
"job",
")",
"{",
"$",
"serialized",
"=",
"Job",
"\\",
"serializeJobs",
"(",
"[",
"$",
"job",
"->",
"withQueueProvider",
"(",
"'sync'",
")",
"]",
")",
";",
"$",
"res",
"=",
"unseriali... | push a job onto the queue | [
"push",
"a",
"job",
"onto",
"the",
"queue"
] | train | https://github.com/krakphp/job/blob/0c16020c1baa13d91f819ecba8334861ba7c4d6c/src/Queue/Sync/SyncQueue.php#L17-L23 |
HedronDev/hedron | src/Factory/ProjectTypeFactory.php | ProjectTypeFactory.createInstance | public function createInstance(PluginDefinitionInterface $definition, ...$constructors) {
$class = $definition->getClass();
return new $class($definition->getPluginId(), $definition, ...$constructors);
} | php | public function createInstance(PluginDefinitionInterface $definition, ...$constructors) {
$class = $definition->getClass();
return new $class($definition->getPluginId(), $definition, ...$constructors);
} | [
"public",
"function",
"createInstance",
"(",
"PluginDefinitionInterface",
"$",
"definition",
",",
"...",
"$",
"constructors",
")",
"{",
"$",
"class",
"=",
"$",
"definition",
"->",
"getClass",
"(",
")",
";",
"return",
"new",
"$",
"class",
"(",
"$",
"definitio... | {@inheritdoc} | [
"{"
] | train | https://github.com/HedronDev/hedron/blob/3b4adec4912f2d7c0b7e7262dc36515fbc2e8e00/src/Factory/ProjectTypeFactory.php#L13-L16 |
surebert/surebert-framework | src/sb/Controller/HTTP/Proxy.php | Proxy.get | public function get() {
if (!isset($this->request->args[0])) {
exit;
}
$url = $this->request->args[0];
//add the $_GET vars to the request
$query_string = http_build_query($this->request->get);
$destination_url = $url . ($query_string ? '?'.$query_s... | php | public function get() {
if (!isset($this->request->args[0])) {
exit;
}
$url = $this->request->args[0];
//add the $_GET vars to the request
$query_string = http_build_query($this->request->get);
$destination_url = $url . ($query_string ? '?'.$query_s... | [
"public",
"function",
"get",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"request",
"->",
"args",
"[",
"0",
"]",
")",
")",
"{",
"exit",
";",
"}",
"$",
"url",
"=",
"$",
"this",
"->",
"request",
"->",
"args",
"[",
"0",
"]",
... | proxies request and responds
It will proxy both GET and POST data and return respose
@servable true
e.g. SITE_URL/proxy/get/http://someothersite?test=rest&ff=gg | [
"proxies",
"request",
"and",
"responds"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/HTTP/Proxy.php#L77-L142 |
surebert/surebert-framework | src/sb/Controller/HTTP/Proxy.php | Proxy.headerCallBack | protected function headerCallBack($ch, $data){
if (!is_null($data)) {
if (preg_match("~^HTTP/.*? 404~", $data)) {
header(trim($data));
while (ob_get_level() > 0) {
ob_end_flush();
}
... | php | protected function headerCallBack($ch, $data){
if (!is_null($data)) {
if (preg_match("~^HTTP/.*? 404~", $data)) {
header(trim($data));
while (ob_get_level() > 0) {
ob_end_flush();
}
... | [
"protected",
"function",
"headerCallBack",
"(",
"$",
"ch",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"data",
")",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"~^HTTP/.*? 404~\"",
",",
"$",
"data",
")",
")",
"{",
"header",
"(",
... | Called to process headers from URL being proxied
@param resource $ch The curl connection
@param string $data The header data
@return int length of the data from header | [
"Called",
"to",
"process",
"headers",
"from",
"URL",
"being",
"proxied"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/HTTP/Proxy.php#L150-L176 |
eghojansu/moe | src/tools/web/OpenID.php | OpenID.discover | protected function discover($proxy) {
// Normalize
if (!preg_match('/https?:\/\//i',$this->args['identity']))
$this->args['identity']='http://'.$this->args['identity'];
$url=parse_url($this->args['identity']);
// Remove fragment; reconnect parts
$this->args['identity']=$url['scheme'].'://'.
(isset($url[... | php | protected function discover($proxy) {
// Normalize
if (!preg_match('/https?:\/\//i',$this->args['identity']))
$this->args['identity']='http://'.$this->args['identity'];
$url=parse_url($this->args['identity']);
// Remove fragment; reconnect parts
$this->args['identity']=$url['scheme'].'://'.
(isset($url[... | [
"protected",
"function",
"discover",
"(",
"$",
"proxy",
")",
"{",
"// Normalize",
"if",
"(",
"!",
"preg_match",
"(",
"'/https?:\\/\\//i'",
",",
"$",
"this",
"->",
"args",
"[",
"'identity'",
"]",
")",
")",
"$",
"this",
"->",
"args",
"[",
"'identity'",
"]"... | Determine OpenID provider
@return string|FALSE
@param $proxy string | [
"Determine",
"OpenID",
"provider"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/web/OpenID.php#L23-L117 |
eghojansu/moe | src/tools/web/OpenID.php | OpenID.auth | function auth($proxy=NULL,$attr=array(),array $reqd=NULL) {
$fw=Base::instance();
$root=$fw->get('SCHEME').'://'.$fw->get('HOST');
if (empty($this->args['trust_root']))
$this->args['trust_root']=$root.$fw->get('BASE').'/';
if (empty($this->args['return_to']))
$this->args['return_to']=$root.$_SERVER['REQUE... | php | function auth($proxy=NULL,$attr=array(),array $reqd=NULL) {
$fw=Base::instance();
$root=$fw->get('SCHEME').'://'.$fw->get('HOST');
if (empty($this->args['trust_root']))
$this->args['trust_root']=$root.$fw->get('BASE').'/';
if (empty($this->args['return_to']))
$this->args['return_to']=$root.$_SERVER['REQUE... | [
"function",
"auth",
"(",
"$",
"proxy",
"=",
"NULL",
",",
"$",
"attr",
"=",
"array",
"(",
")",
",",
"array",
"$",
"reqd",
"=",
"NULL",
")",
"{",
"$",
"fw",
"=",
"Base",
"::",
"instance",
"(",
")",
";",
"$",
"root",
"=",
"$",
"fw",
"->",
"get",... | Initiate OpenID authentication sequence; Return FALSE on failure
or redirect to OpenID provider URL
@return bool
@param $proxy string
@param $attr array
@param $reqd string|array | [
"Initiate",
"OpenID",
"authentication",
"sequence",
";",
"Return",
"FALSE",
"on",
"failure",
"or",
"redirect",
"to",
"OpenID",
"provider",
"URL"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/web/OpenID.php#L127-L150 |
Isset/pushnotification | src/PushNotification/Type/Apple/AppleConnection.php | AppleConnection.getResponseData | public function getResponseData(): Response
{
$connectionResponse = new ConnectionResponseImpl();
$errorResponse = $this->streamSocket->read();
if ($errorResponse !== null) {
$this->getLogger()->error('Send error: ' . $errorResponse);
$this->streamSocket->disconnect()... | php | public function getResponseData(): Response
{
$connectionResponse = new ConnectionResponseImpl();
$errorResponse = $this->streamSocket->read();
if ($errorResponse !== null) {
$this->getLogger()->error('Send error: ' . $errorResponse);
$this->streamSocket->disconnect()... | [
"public",
"function",
"getResponseData",
"(",
")",
":",
"Response",
"{",
"$",
"connectionResponse",
"=",
"new",
"ConnectionResponseImpl",
"(",
")",
";",
"$",
"errorResponse",
"=",
"$",
"this",
"->",
"streamSocket",
"->",
"read",
"(",
")",
";",
"if",
"(",
"... | @throws ConnectionHandlerException
@return Response | [
"@throws",
"ConnectionHandlerException"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/AppleConnection.php#L86-L102 |
Isset/pushnotification | src/PushNotification/Type/Apple/AppleConnection.php | AppleConnection.send | public function send(Message $message)
{
/* @var AppleMessage $message */
$buildMessage = $this->buildMessage($message);
$this->streamSocket->connect();
$bytesSend = $this->streamSocket->write($buildMessage);
if (strlen($buildMessage) !== $bytesSend) {
$this->stre... | php | public function send(Message $message)
{
/* @var AppleMessage $message */
$buildMessage = $this->buildMessage($message);
$this->streamSocket->connect();
$bytesSend = $this->streamSocket->write($buildMessage);
if (strlen($buildMessage) !== $bytesSend) {
$this->stre... | [
"public",
"function",
"send",
"(",
"Message",
"$",
"message",
")",
"{",
"/* @var AppleMessage $message */",
"$",
"buildMessage",
"=",
"$",
"this",
"->",
"buildMessage",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"streamSocket",
"->",
"connect",
"(",
"... | Send a message without waiting on response.
@param Message $message
@throws ConnectionException
@throws ConnectionHandlerException | [
"Send",
"a",
"message",
"without",
"waiting",
"on",
"response",
"."
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/AppleConnection.php#L112-L123 |
Isset/pushnotification | src/PushNotification/Type/Apple/AppleConnection.php | AppleConnection.buildMessage | private function buildMessage(AppleMessage $message): string
{
$jsonMessage = json_encode($message->getMessage());
$jsonMessageLength = strlen($jsonMessage);
$payload =
pack(
'CNNnH*n',
self::COMMAND,
$message->getIdentifier(),
... | php | private function buildMessage(AppleMessage $message): string
{
$jsonMessage = json_encode($message->getMessage());
$jsonMessageLength = strlen($jsonMessage);
$payload =
pack(
'CNNnH*n',
self::COMMAND,
$message->getIdentifier(),
... | [
"private",
"function",
"buildMessage",
"(",
"AppleMessage",
"$",
"message",
")",
":",
"string",
"{",
"$",
"jsonMessage",
"=",
"json_encode",
"(",
"$",
"message",
"->",
"getMessage",
"(",
")",
")",
";",
"$",
"jsonMessageLength",
"=",
"strlen",
"(",
"$",
"js... | @param AppleMessage $message
@return string | [
"@param",
"AppleMessage",
"$message"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/AppleConnection.php#L146-L164 |
nabab/bbn | src/bbn/appui/dbsync.php | dbsync.check | public static function check(){
return ( \is_object(self::$db) && \is_object(self::$dbs) && self::$db->check() && self::$dbs->check() );
} | php | public static function check(){
return ( \is_object(self::$db) && \is_object(self::$dbs) && self::$db->check() && self::$dbs->check() );
} | [
"public",
"static",
"function",
"check",
"(",
")",
"{",
"return",
"(",
"\\",
"is_object",
"(",
"self",
"::",
"$",
"db",
")",
"&&",
"\\",
"is_object",
"(",
"self",
"::",
"$",
"dbs",
")",
"&&",
"self",
"::",
"$",
"db",
"->",
"check",
"(",
")",
"&&"... | Checks if the initialization has been all right
@return bool | [
"Checks",
"if",
"the",
"initialization",
"has",
"been",
"all",
"right"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/dbsync.php#L154-L156 |
nabab/bbn | src/bbn/appui/dbsync.php | dbsync.trigger | public static function trigger(array $cfg){
self::first_call();
if ( !isset($cfg['run']) ){
$cfg['run'] = 1;
}
if ( !isset($cfg['trig']) ){
$cfg['run'] = 1;
}
if ( !self::$disabled &&
self::check() &&
(count($cfg['tables']) === 1) &&
($table = self::$db->tfn(current... | php | public static function trigger(array $cfg){
self::first_call();
if ( !isset($cfg['run']) ){
$cfg['run'] = 1;
}
if ( !isset($cfg['trig']) ){
$cfg['run'] = 1;
}
if ( !self::$disabled &&
self::check() &&
(count($cfg['tables']) === 1) &&
($table = self::$db->tfn(current... | [
"public",
"static",
"function",
"trigger",
"(",
"array",
"$",
"cfg",
")",
"{",
"self",
"::",
"first_call",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"cfg",
"[",
"'run'",
"]",
")",
")",
"{",
"$",
"cfg",
"[",
"'run'",
"]",
"=",
"1",
";",
... | Gets all information about a given table
@param array $cfg Configuration array
@return array Resulting configuration | [
"Gets",
"all",
"information",
"about",
"a",
"given",
"table"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/dbsync.php#L172-L205 |
nabab/bbn | src/bbn/appui/dbsync.php | dbsync.sync | public static function sync(bbn\db $db, $dbs='', $dbs_table='', $num_try = 0){
if ( !$num_try ){
self::def($dbs, $dbs_table);
self::first_call();
self::disable();
$mode_db = self::$db->get_error_mode();
$mode_dbs = self::$dbs->get_error_mode();
self::$db->set_error_mode("continu... | php | public static function sync(bbn\db $db, $dbs='', $dbs_table='', $num_try = 0){
if ( !$num_try ){
self::def($dbs, $dbs_table);
self::first_call();
self::disable();
$mode_db = self::$db->get_error_mode();
$mode_dbs = self::$dbs->get_error_mode();
self::$db->set_error_mode("continu... | [
"public",
"static",
"function",
"sync",
"(",
"bbn",
"\\",
"db",
"$",
"db",
",",
"$",
"dbs",
"=",
"''",
",",
"$",
"dbs_table",
"=",
"''",
",",
"$",
"num_try",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"$",
"num_try",
")",
"{",
"self",
"::",
"def",
"... | Deleting the rows from this DB which have state = 1 | [
"Deleting",
"the",
"rows",
"from",
"this",
"DB",
"which",
"have",
"state",
"=",
"1"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/dbsync.php#L218-L427 |
cultuurnet/deserializer | src/JSONDeserializer.php | JSONDeserializer.deserialize | public function deserialize(StringLiteral $data)
{
$data = json_decode($data->toNative(), $this->assoc);
if (null === $data) {
throw new NotWellFormedException('Invalid JSON');
}
return $data;
} | php | public function deserialize(StringLiteral $data)
{
$data = json_decode($data->toNative(), $this->assoc);
if (null === $data) {
throw new NotWellFormedException('Invalid JSON');
}
return $data;
} | [
"public",
"function",
"deserialize",
"(",
"StringLiteral",
"$",
"data",
")",
"{",
"$",
"data",
"=",
"json_decode",
"(",
"$",
"data",
"->",
"toNative",
"(",
")",
",",
"$",
"this",
"->",
"assoc",
")",
";",
"if",
"(",
"null",
"===",
"$",
"data",
")",
... | Decodes a JSON string into a generic PHP object.
@param StringLiteral $data
@return \stdClass | [
"Decodes",
"a",
"JSON",
"string",
"into",
"a",
"generic",
"PHP",
"object",
"."
] | train | https://github.com/cultuurnet/deserializer/blob/ec7830eb860ea83f7c28c38649b0057177ade784/src/JSONDeserializer.php#L30-L39 |
GrupaZero/social | src/Gzero/Social/SocialLoginService.php | SocialLoginService.login | public function login($serviceName, AbstractUser $response)
{
$userId = $this->repo->getUserIdBySocialId($response->id, $serviceName);
if (auth()->check()) { // user already logged and service has not been connected
$user = auth()->user();
if ($userId) { // This service has a... | php | public function login($serviceName, AbstractUser $response)
{
$userId = $this->repo->getUserIdBySocialId($response->id, $serviceName);
if (auth()->check()) { // user already logged and service has not been connected
$user = auth()->user();
if ($userId) { // This service has a... | [
"public",
"function",
"login",
"(",
"$",
"serviceName",
",",
"AbstractUser",
"$",
"response",
")",
"{",
"$",
"userId",
"=",
"$",
"this",
"->",
"repo",
"->",
"getUserIdBySocialId",
"(",
"$",
"response",
"->",
"id",
",",
"$",
"serviceName",
")",
";",
"if",... | Login using social service.
@param $serviceName string social service name
@param $response AbstractUser response data
@throws SocialException | [
"Login",
"using",
"social",
"service",
"."
] | train | https://github.com/GrupaZero/social/blob/f7cbf50765bd228010a2c61d950f915828306cf7/src/Gzero/Social/SocialLoginService.php#L50-L76 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.quoteInputVar | public static function quoteInputVar($str, $allowArray = true)
{
// 字符串进行转义
if (is_string($str)) {
return '\'' . addcslashes($str, "\n\r\\'\"\032") . '\'';
}
// 数字
if (is_numeric($str)) {
return '\'' . $str . '\'';
}
... | php | public static function quoteInputVar($str, $allowArray = true)
{
// 字符串进行转义
if (is_string($str)) {
return '\'' . addcslashes($str, "\n\r\\'\"\032") . '\'';
}
// 数字
if (is_numeric($str)) {
return '\'' . $str . '\'';
}
... | [
"public",
"static",
"function",
"quoteInputVar",
"(",
"$",
"str",
",",
"$",
"allowArray",
"=",
"true",
")",
"{",
"// 字符串进行转义",
"if",
"(",
"is_string",
"(",
"$",
"str",
")",
")",
"{",
"return",
"'\\''",
".",
"addcslashes",
"(",
"$",
"str",
",",
"\"\\n\\... | 变量进行注入转义并加上引号
@param mixed $str
@param bool $allowArray = true
@return string | [
"变量进行注入转义并加上引号"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L42-L75 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.quoteFieldName | public static function quoteFieldName($field)
{
$field = trim($field);
if(!$field || is_numeric($field)) {
return $field;
}
if (strpos($field, '`') !== false) {
$field = str_replace('`', '', $field);
}
$field = preg_replace("/(\\... | php | public static function quoteFieldName($field)
{
$field = trim($field);
if(!$field || is_numeric($field)) {
return $field;
}
if (strpos($field, '`') !== false) {
$field = str_replace('`', '', $field);
}
$field = preg_replace("/(\\... | [
"public",
"static",
"function",
"quoteFieldName",
"(",
"$",
"field",
")",
"{",
"$",
"field",
"=",
"trim",
"(",
"$",
"field",
")",
";",
"if",
"(",
"!",
"$",
"field",
"||",
"is_numeric",
"(",
"$",
"field",
")",
")",
"{",
"return",
"$",
"field",
";",
... | 字段转义
@param string $field
@return string | [
"字段转义"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L83-L100 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.quoteFieldNames | public static function quoteFieldNames($fields)
{
$fieldArr = is_string($fields) ? explode(',', trim($fields)) : (array)$fields;
foreach ($fieldArr as $k => $field) {
$field = preg_replace("/(\s+)/", ' ', trim($field));
if ($field == '*') {
// do noth... | php | public static function quoteFieldNames($fields)
{
$fieldArr = is_string($fields) ? explode(',', trim($fields)) : (array)$fields;
foreach ($fieldArr as $k => $field) {
$field = preg_replace("/(\s+)/", ' ', trim($field));
if ($field == '*') {
// do noth... | [
"public",
"static",
"function",
"quoteFieldNames",
"(",
"$",
"fields",
")",
"{",
"$",
"fieldArr",
"=",
"is_string",
"(",
"$",
"fields",
")",
"?",
"explode",
"(",
"','",
",",
"trim",
"(",
"$",
"fields",
")",
")",
":",
"(",
"array",
")",
"$",
"fields",... | 字段名转义
可以是多个字段一起,如:table.field1 或 a.f1, b.f2, c.*
@param string|array $fields
@return string | [
"字段名转义"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L110-L153 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.quoteOrder | protected static function quoteOrder($str)
{
if ($str && is_array($str) && isset($str[1])) {
$str = $str[1];
}
if ($str && !is_string($str)) {
throw new \wf\db\Exception('Order fields must be string!');
}
if ($str && strtolower($str) ... | php | protected static function quoteOrder($str)
{
if ($str && is_array($str) && isset($str[1])) {
$str = $str[1];
}
if ($str && !is_string($str)) {
throw new \wf\db\Exception('Order fields must be string!');
}
if ($str && strtolower($str) ... | [
"protected",
"static",
"function",
"quoteOrder",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"$",
"str",
"&&",
"is_array",
"(",
"$",
"str",
")",
"&&",
"isset",
"(",
"$",
"str",
"[",
"1",
"]",
")",
")",
"{",
"$",
"str",
"=",
"$",
"str",
"[",
"1",
"]... | 排序参数过滤
@param string $str
@return string
@throws \wf\db\Exception | [
"排序参数过滤"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L162-L177 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.where | public static function where($field, $val, $glue = '=', $type = 'string')
{
$glue = strtolower($glue);
$glue = str_replace(' ', '', $glue);
$type = str_replace(' ', '', $type);
$field = static::quoteFieldNames($field);
if (is_array($val)) {
$glue... | php | public static function where($field, $val, $glue = '=', $type = 'string')
{
$glue = strtolower($glue);
$glue = str_replace(' ', '', $glue);
$type = str_replace(' ', '', $type);
$field = static::quoteFieldNames($field);
if (is_array($val)) {
$glue... | [
"public",
"static",
"function",
"where",
"(",
"$",
"field",
",",
"$",
"val",
",",
"$",
"glue",
"=",
"'='",
",",
"$",
"type",
"=",
"'string'",
")",
"{",
"$",
"glue",
"=",
"strtolower",
"(",
"$",
"glue",
")",
";",
"$",
"glue",
"=",
"str_replace",
"... | 查询条件
@param string $field 字段名
@param string|array $val 值,使用in/notin的时候为array类型
@param string $glue =,+,-,|,&,^,like,in,notin,not in,>,<,<>,>=,<=,!=
@param string $type $val参数值的类型,string:字符串,field:字段,int:整形,float:浮点型,sql:sql语句
@throws \wf\db\Exception
@return string | [
"查询条件"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L189-L263 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.whereArr | public static function whereArr($options)
{
if (!is_array($options) || empty($options[0]) || !(is_string($options[0]) || is_array($options[0]))) {
throw new \wf\db\Exception('Illegal param, the param should be array, but string has given: $options = ' . var_export($options, 1));
}
... | php | public static function whereArr($options)
{
if (!is_array($options) || empty($options[0]) || !(is_string($options[0]) || is_array($options[0]))) {
throw new \wf\db\Exception('Illegal param, the param should be array, but string has given: $options = ' . var_export($options, 1));
}
... | [
"public",
"static",
"function",
"whereArr",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
"||",
"empty",
"(",
"$",
"options",
"[",
"0",
"]",
")",
"||",
"!",
"(",
"is_string",
"(",
"$",
"options",
"[",
"0",
"... | 构造sql多个查询条件
<div>
<b>规则:</b>查询条件有两部分构成
<ul>
<li>一个是查询元素(比较表达式), array('字段', '值', '比较逻辑 = > < ...')</li>
<li>一个是查询条件之间的逻辑关系 AND|OR 字符,这个不是必须的。如果指定and/or,必须放在数组的第一位,即下标为0。</li>
</ul>
</div>
<b>构造格式为:</b>
<ul>
<li>不指定and/or(默认and):array(比较表达式1,比较表达式2, ...)</li>
<li>指定and/or:array('AND|OR', 比较表达式1,比较表达式2, ...)</li>
<li>嵌套... | [
"构造sql多个查询条件"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L293-L328 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.format | public static function format($sql, $arg)
{
$arg = (array)$arg;
if(preg_match('/(\"|\')/', $sql)) {
throw new \wf\db\Exception('SQL string format error! It\'s Unsafe to take "|\' in SQL.');
}
$count = substr_count($sql, '%');
if (!$count) {
... | php | public static function format($sql, $arg)
{
$arg = (array)$arg;
if(preg_match('/(\"|\')/', $sql)) {
throw new \wf\db\Exception('SQL string format error! It\'s Unsafe to take "|\' in SQL.');
}
$count = substr_count($sql, '%');
if (!$count) {
... | [
"public",
"static",
"function",
"format",
"(",
"$",
"sql",
",",
"$",
"arg",
")",
"{",
"$",
"arg",
"=",
"(",
"array",
")",
"$",
"arg",
";",
"if",
"(",
"preg_match",
"(",
"'/(\\\"|\\')/'",
",",
"$",
"sql",
")",
")",
"{",
"throw",
"new",
"\\",
"wf",... | sql格式化
在$sql参数中加入"%参数类型字符"的格式,并在$arg参数设置该格式的值,$sql中的第n个参数对应$arg中的第n个元素。
<pre>
$exp = "SELECT `uid`,`uname`,`password` FROM `user` WHERE `uid` = 100 AND `checked` = 1";
$sql = "SELECT %c FROM %t WHERE %c = %i AND `checked` = %i";
$arg = [
'uid,uname,password', // %c
'user', // %t
'uid', //... | [
"sql格式化"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L362-L412 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.buildQueryOptions | public static function buildQueryOptions($options = [])
{
if(!is_array($options)) {
throw new \wf\db\Exception('The param must be array!');
}
isset($options['field']) or $options['field'] = '*';
isset($options['join']) or $options['join'] = [];
isset($op... | php | public static function buildQueryOptions($options = [])
{
if(!is_array($options)) {
throw new \wf\db\Exception('The param must be array!');
}
isset($options['field']) or $options['field'] = '*';
isset($options['join']) or $options['join'] = [];
isset($op... | [
"public",
"static",
"function",
"buildQueryOptions",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"throw",
"new",
"\\",
"wf",
"\\",
"db",
"\\",
"Exception",
"(",
"'The param must be array!'... | 查询选项解析
@param array $options = <pre>array(
'field' =>'f.a, f.b', // 字段名列表,默认是 *
'table' => 'table_a, table_b AS b', // 查询的表名,可以是多个表,默认是当前模型的表
'join' => [] // [['table_name', 'ON_field_a', 'ON_field_b', 'LEFT|RIGHT|CROSS|INNSER'], ..., "格式2直接写join语法"], // => LEFT JOIN `table_name` ON `field_a` = `field_b`
'where' ... | [
"查询选项解析"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L431-L460 |
windwork/wf-db | lib/QueryBuilder.php | QueryBuilder.buildSqlSet | public static function buildSqlSet(array $data, array $keyInArray, array $keyNotInArray = [])
{
$set = [];
$arg = [];
$fields = $keyNotInArray ? array_diff($keyInArray, $keyNotInArray) : $keyInArray;
// 取表中存在的字段(MySQL字段名本身不区分大小写,我们全部转成小写)
foreach($data as $k => $v) {
... | php | public static function buildSqlSet(array $data, array $keyInArray, array $keyNotInArray = [])
{
$set = [];
$arg = [];
$fields = $keyNotInArray ? array_diff($keyInArray, $keyNotInArray) : $keyInArray;
// 取表中存在的字段(MySQL字段名本身不区分大小写,我们全部转成小写)
foreach($data as $k => $v) {
... | [
"public",
"static",
"function",
"buildSqlSet",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"keyInArray",
",",
"array",
"$",
"keyNotInArray",
"=",
"[",
"]",
")",
"{",
"$",
"set",
"=",
"[",
"]",
";",
"$",
"arg",
"=",
"[",
"]",
";",
"$",
"fields",
... | 从数组的下标对应的值中获取SQL的"字段1=值1,字段2=值2"的结构
@param array $data 下标 => 值结构
@param array $keyInArray 包含此数组中 的下标则保留,否则去掉
@param array $keyNotInArray = [] 要去掉的下标
@throws \wf\db\Exception
@return string 返回 "`f1` = 'xx', `f2` = 'xxx'" | [
"从数组的下标对应的值中获取SQL的",
"字段1",
"=",
"值1",
"字段2",
"=",
"值2",
"的结构"
] | train | https://github.com/windwork/wf-db/blob/b9ee5740a42d572ce728907ea24ba22c158863f5/lib/QueryBuilder.php#L644-L679 |
rattfieldnz/url-validation | src/RattfieldNz/UrlValidation/UrlValidation.php | UrlValidation.getUrlStatusCode | public static function getUrlStatusCode($url)
{
//Instantiate the EpiCurl class to be used
//with checking URL HTTP status code.
$epi_curl_checker = EpiCurl::getInstance();
// Add the given URL to the url checker.
$url_check = $epi_curl_checker->addURL($url);
... | php | public static function getUrlStatusCode($url)
{
//Instantiate the EpiCurl class to be used
//with checking URL HTTP status code.
$epi_curl_checker = EpiCurl::getInstance();
// Add the given URL to the url checker.
$url_check = $epi_curl_checker->addURL($url);
... | [
"public",
"static",
"function",
"getUrlStatusCode",
"(",
"$",
"url",
")",
"{",
"//Instantiate the EpiCurl class to be used\r",
"//with checking URL HTTP status code.\r",
"$",
"epi_curl_checker",
"=",
"EpiCurl",
"::",
"getInstance",
"(",
")",
";",
"// Add the given URL to the ... | This function obtains an HTTP status
code from a given URL.
@param $url
@uses EpiCurl::getInstance
@return int | [
"This",
"function",
"obtains",
"an",
"HTTP",
"status",
"code",
"from",
"a",
"given",
"URL",
"."
] | train | https://github.com/rattfieldnz/url-validation/blob/ff44a463a9119fa3bea9bd7fef3d44b7e6f9a44c/src/RattfieldNz/UrlValidation/UrlValidation.php#L53-L64 |
video-games-records/TeamBundle | Controller/GameController.php | GameController.rankingTeamPointsAction | public function rankingTeamPointsAction($id)
{
$game = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Game')->find($id);
$breadcrumbs = $this->getGameBreadcrumbs($game);
$breadcrumbs->addItem('game.pointchartranking.full');
return $this->render(
'Video... | php | public function rankingTeamPointsAction($id)
{
$game = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Game')->find($id);
$breadcrumbs = $this->getGameBreadcrumbs($game);
$breadcrumbs->addItem('game.pointchartranking.full');
return $this->render(
'Video... | [
"public",
"function",
"rankingTeamPointsAction",
"(",
"$",
"id",
")",
"{",
"$",
"game",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getRepository",
"(",
"'VideoGamesRecordsCoreBundle:Game'",
")",
"->",
"find",
"(",
"$",
"id",
")",
";",
"$",
"br... | @Route("/ranking-points/id/{id}", requirements={"id": "[1-9]\d*"}, name="vgr_team_game_ranking_points")
@Method("GET")
@Cache(smaxage="10")
@param int $id
@return \Symfony\Component\HttpFoundation\Response | [
"@Route",
"(",
"/",
"ranking",
"-",
"points",
"/",
"id",
"/",
"{",
"id",
"}",
"requirements",
"=",
"{",
"id",
":",
"[",
"1",
"-",
"9",
"]",
"\\",
"d",
"*",
"}",
"name",
"=",
"vgr_team_game_ranking_points",
")",
"@Method",
"(",
"GET",
")",
"@Cache",... | train | https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/GameController.php#L25-L38 |
video-games-records/TeamBundle | Controller/GameController.php | GameController.rankingTeamMedalsAction | public function rankingTeamMedalsAction($id)
{
$game = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Game')->find($id);
$breadcrumbs = $this->getGameBreadcrumbs($game);
$breadcrumbs->addItem('game.medalranking.full');
return $this->render(
'VideoGames... | php | public function rankingTeamMedalsAction($id)
{
$game = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Game')->find($id);
$breadcrumbs = $this->getGameBreadcrumbs($game);
$breadcrumbs->addItem('game.medalranking.full');
return $this->render(
'VideoGames... | [
"public",
"function",
"rankingTeamMedalsAction",
"(",
"$",
"id",
")",
"{",
"$",
"game",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getRepository",
"(",
"'VideoGamesRecordsCoreBundle:Game'",
")",
"->",
"find",
"(",
"$",
"id",
")",
";",
"$",
"br... | @Route("/ranking-medals/id/{id}", requirements={"id": "[1-9]\d*"}, name="vgr_team_game_ranking_medals")
@Method("GET")
@Cache(smaxage="10")
@param int $id
@return \Symfony\Component\HttpFoundation\Response | [
"@Route",
"(",
"/",
"ranking",
"-",
"medals",
"/",
"id",
"/",
"{",
"id",
"}",
"requirements",
"=",
"{",
"id",
":",
"[",
"1",
"-",
"9",
"]",
"\\",
"d",
"*",
"}",
"name",
"=",
"vgr_team_game_ranking_medals",
")",
"@Method",
"(",
"GET",
")",
"@Cache",... | train | https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/GameController.php#L49-L62 |
interactivesolutions/honeycomb-core | src/http/controllers/HCFormManagerController.php | HCFormManagerController.getForm | private function getForm(string $key)
{
if (!Cache::has('hc-forms'))
Artisan::call('hc:forms');
$list = Cache::get('hc-forms');
$new = substr($key, 0, -4);
$edit = substr($key, 0, -5);
if (isset($list[$new])) {
$form = new $list[$new]();
... | php | private function getForm(string $key)
{
if (!Cache::has('hc-forms'))
Artisan::call('hc:forms');
$list = Cache::get('hc-forms');
$new = substr($key, 0, -4);
$edit = substr($key, 0, -5);
if (isset($list[$new])) {
$form = new $list[$new]();
... | [
"private",
"function",
"getForm",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"Cache",
"::",
"has",
"(",
"'hc-forms'",
")",
")",
"Artisan",
"::",
"call",
"(",
"'hc:forms'",
")",
";",
"$",
"list",
"=",
"Cache",
"::",
"get",
"(",
"'hc-forms'",... | Get form from cache or get it from class and than store it to cache
@param string $key
@return mixed | [
"Get",
"form",
"from",
"cache",
"or",
"get",
"it",
"from",
"class",
"and",
"than",
"store",
"it",
"to",
"cache"
] | train | https://github.com/interactivesolutions/honeycomb-core/blob/06b8d88bb285e73a1a286e60411ca5f41863f39f/src/http/controllers/HCFormManagerController.php#L40-L61 |
webcreate/util | src/Webcreate/Util/Cli.php | Cli.prepare | public function prepare($command, array $arguments = array())
{
$commandline = $command;
foreach ($arguments as $option => $value) {
if (is_bool($value)) {
if ($value === true) {
$commandline .= ' ' . $option;
}
} else {
... | php | public function prepare($command, array $arguments = array())
{
$commandline = $command;
foreach ($arguments as $option => $value) {
if (is_bool($value)) {
if ($value === true) {
$commandline .= ' ' . $option;
}
} else {
... | [
"public",
"function",
"prepare",
"(",
"$",
"command",
",",
"array",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"$",
"commandline",
"=",
"$",
"command",
";",
"foreach",
"(",
"$",
"arguments",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",... | Prepares a commandline
@param string $command
@param array $arguments
@return string | [
"Prepares",
"a",
"commandline"
] | train | https://github.com/webcreate/util/blob/16c53697a3d96431d0afd57f8ab9f1df6c21e976/src/Webcreate/Util/Cli.php#L53-L75 |
webcreate/util | src/Webcreate/Util/Cli.php | Cli.execute | public function execute($commandline, $callback = null, $cwd = null)
{
$this->process = new Process($commandline, $cwd, null, null, $this->timeout);
return $this->process->run($callback);
} | php | public function execute($commandline, $callback = null, $cwd = null)
{
$this->process = new Process($commandline, $cwd, null, null, $this->timeout);
return $this->process->run($callback);
} | [
"public",
"function",
"execute",
"(",
"$",
"commandline",
",",
"$",
"callback",
"=",
"null",
",",
"$",
"cwd",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"process",
"=",
"new",
"Process",
"(",
"$",
"commandline",
",",
"$",
"cwd",
",",
"null",
",",
"n... | Runs the process.
The callback receives the type of output (out or err) and
some bytes from the output in real-time. It allows to have feedback
from the independent process during execution.
The STDOUT and STDERR are also available after the process is finished
via the getOutput() and getErrorOutput() methods.
@para... | [
"Runs",
"the",
"process",
"."
] | train | https://github.com/webcreate/util/blob/16c53697a3d96431d0afd57f8ab9f1df6c21e976/src/Webcreate/Util/Cli.php#L96-L101 |
WScore/Validation | src/Utils/ValueTO.php | ValueTO.message | public function message()
{
if (!$this->error) {
return '';
}
if (isset($this->message)) {
return $this->message;
}
if ($this->messenger) {
$type = $this->getType();
$method = $this->getErrorMethod();
... | php | public function message()
{
if (!$this->error) {
return '';
}
if (isset($this->message)) {
return $this->message;
}
if ($this->messenger) {
$type = $this->getType();
$method = $this->getErrorMethod();
... | [
"public",
"function",
"message",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"error",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"message",
")",
")",
"{",
"return",
"$",
"this",
"->",
"message",
";",
"... | gets message regardless of the error state of this ValueTO.
use this message ONLY WHEN valueTO is error.
@return string|array | [
"gets",
"message",
"regardless",
"of",
"the",
"error",
"state",
"of",
"this",
"ValueTO",
".",
"use",
"this",
"message",
"ONLY",
"WHEN",
"valueTO",
"is",
"error",
"."
] | train | https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Utils/ValueTO.php#L185-L203 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.addChild | protected function addChild($mom_node, $name, $value='')
{
return $this->oai_pmh->addChild($mom_node, $name, $value);
} | php | protected function addChild($mom_node, $name, $value='')
{
return $this->oai_pmh->addChild($mom_node, $name, $value);
} | [
"protected",
"function",
"addChild",
"(",
"$",
"mom_node",
",",
"$",
"name",
",",
"$",
"value",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"oai_pmh",
"->",
"addChild",
"(",
"$",
"mom_node",
",",
"$",
"name",
",",
"$",
"value",
")",
";",
"}"
... | A worker function for easily adding a newly created node to current XML Doc.
@param $mom_node Type: DOMElement. Node the new child will be attached to.
@param $name Type: sting. The name of the child node is being added.
@param $value Type: sting. The text content of the child node is being added. The default is ''.
@r... | [
"A",
"worker",
"function",
"for",
"easily",
"adding",
"a",
"newly",
"created",
"node",
"to",
"current",
"XML",
"Doc",
"."
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L83-L86 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_regObject | protected function create_regObject($group, $key, $originatingSource)
{
$regObj_node = $this->addChild($this->working_node, 'registryObject');
$regObj_node->setAttribute('group', $group);
$this->addChild($regObj_node, 'key', $key);
$this->addChild($regObj_node, 'originatingSource', $... | php | protected function create_regObject($group, $key, $originatingSource)
{
$regObj_node = $this->addChild($this->working_node, 'registryObject');
$regObj_node->setAttribute('group', $group);
$this->addChild($regObj_node, 'key', $key);
$this->addChild($regObj_node, 'originatingSource', $... | [
"protected",
"function",
"create_regObject",
"(",
"$",
"group",
",",
"$",
"key",
",",
"$",
"originatingSource",
")",
"{",
"$",
"regObj_node",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"working_node",
",",
"'registryObject'",
")",
";",
"$"... | Create a single registryObject node. Each set has its own structure but they all have an attribute of group, a key node and an originatingSource node. The newly created node will be used as the working node.
\param $group string, group attribute of the new registryObject node .
\param $key string, key node, used as an... | [
"Create",
"a",
"single",
"registryObject",
"node",
".",
"Each",
"set",
"has",
"its",
"own",
"structure",
"but",
"they",
"all",
"have",
"an",
"attribute",
"of",
"group",
"a",
"key",
"node",
"and",
"an",
"originatingSource",
"node",
".",
"The",
"newly",
"cre... | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L106-L113 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_dcs_node | protected function create_dcs_node($set_name, $set_type)
{
$this->working_node = $this->addChild($this->working_node, $set_name);
$this->working_node->setAttribute('type', $set_type);
} | php | protected function create_dcs_node($set_name, $set_type)
{
$this->working_node = $this->addChild($this->working_node, $set_name);
$this->working_node->setAttribute('type', $set_type);
} | [
"protected",
"function",
"create_dcs_node",
"(",
"$",
"set_name",
",",
"$",
"set_type",
")",
"{",
"$",
"this",
"->",
"working_node",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"working_node",
",",
"$",
"set_name",
")",
";",
"$",
"this",
... | RIF-CS node is the content node of RIF-CS metadata node which starts from regObjects.
Each set supportted in RIF-CS has its own content model. The created node will be used as the
root node of this record for following nodes will be created.
\param $set_name string, the name of set. For ANDS, they are Activity, Party ... | [
"RIF",
"-",
"CS",
"node",
"is",
"the",
"content",
"node",
"of",
"RIF",
"-",
"CS",
"metadata",
"node",
"which",
"starts",
"from",
"regObjects",
".",
"Each",
"set",
"supportted",
"in",
"RIF",
"-",
"CS",
"has",
"its",
"own",
"content",
"model",
".",
"The"... | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L122-L126 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_name_node | protected function create_name_node($name_type = 'primary')
{
$c = $this->addChild($this->working_node, 'name');
$c->setAttribute('type', $name_type);
return $c;
} | php | protected function create_name_node($name_type = 'primary')
{
$c = $this->addChild($this->working_node, 'name');
$c->setAttribute('type', $name_type);
return $c;
} | [
"protected",
"function",
"create_name_node",
"(",
"$",
"name_type",
"=",
"'primary'",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"working_node",
",",
"'name'",
")",
";",
"$",
"c",
"->",
"setAttribute",
"(",
"'type'",
... | Create a top level name node.
@param $name_type string. Text for the types, can be either primary or abbreviated. Default: primary
@return DOMElement $added_name_node.
The newly created node, it will be used for further expansion by adding namePart. | [
"Create",
"a",
"top",
"level",
"name",
"node",
".",
"@param",
"$name_type",
"string",
".",
"Text",
"for",
"the",
"types",
"can",
"be",
"either",
"primary",
"or",
"abbreviated",
".",
"Default",
":",
"primary"
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L135-L140 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_namePart | protected function create_namePart($name_node, $value, $part_type = '')
{
$c = $this->addChild($name_node, 'namePart', $value);
if (!empty($part_type)) {
$c->setAttribute('type', $part_type);
}
} | php | protected function create_namePart($name_node, $value, $part_type = '')
{
$c = $this->addChild($name_node, 'namePart', $value);
if (!empty($part_type)) {
$c->setAttribute('type', $part_type);
}
} | [
"protected",
"function",
"create_namePart",
"(",
"$",
"name_node",
",",
"$",
"value",
",",
"$",
"part_type",
"=",
"''",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"name_node",
",",
"'namePart'",
",",
"$",
"value",
")",
";",
"if... | Create a namePart of a name node.
@param $name_node
Type: DOMElement. Node of name_node created previously
@param $value
Type: string. Text fror this namePart
@param $part_type Type: string, used for group:person record. Types can be: titile, given, family | [
"Create",
"a",
"namePart",
"of",
"a",
"name",
"node",
".",
"@param",
"$name_node",
"Type",
":",
"DOMElement",
".",
"Node",
"of",
"name_node",
"created",
"previously"
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L153-L159 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_relatedObject | protected function create_relatedObject($key, $relation_type)
{
$c = $this->addChild($this->working_node, 'relatedObject');
$this->addChild($c, 'key', $key);
$c = $this->addChild($c, 'relation');
// Mimick ANDS with enpty value to get both tags for relation. Only for better display
... | php | protected function create_relatedObject($key, $relation_type)
{
$c = $this->addChild($this->working_node, 'relatedObject');
$this->addChild($c, 'key', $key);
$c = $this->addChild($c, 'relation');
// Mimick ANDS with enpty value to get both tags for relation. Only for better display
... | [
"protected",
"function",
"create_relatedObject",
"(",
"$",
"key",
",",
"$",
"relation_type",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"working_node",
",",
"'relatedObject'",
")",
";",
"$",
"this",
"->",
"addChild",
... | Create related object. One RIF-CS can have more than one related object nodes,
each object is described by one node.
\param $key
Type: string. The identifier of the related object.
\param $relation_type
Type: string. Type of relationship. | [
"Create",
"related",
"object",
".",
"One",
"RIF",
"-",
"CS",
"can",
"have",
"more",
"than",
"one",
"related",
"object",
"nodes",
"each",
"object",
"is",
"described",
"by",
"one",
"node",
".",
"\\",
"param",
"$key",
"Type",
":",
"string",
".",
"The",
"i... | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L169-L177 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_description_node | protected function create_description_node($value, $des_type='brief')
{
$c = $this->addChild($this->working_node, 'description', $value);
$c->setAttribute('type', $des_type);
} | php | protected function create_description_node($value, $des_type='brief')
{
$c = $this->addChild($this->working_node, 'description', $value);
$c->setAttribute('type', $des_type);
} | [
"protected",
"function",
"create_description_node",
"(",
"$",
"value",
",",
"$",
"des_type",
"=",
"'brief'",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"working_node",
",",
"'description'",
",",
"$",
"value",
")",
";"... | Create description node. One RIF-CS can have more than one description nodes.
Each description node has only one description.
\param $value Type: string. The content of the description.
\param $des_type Type: string. Type of the description. Types can be brief, full, acessRights and note. Default is 'brief'. | [
"Create",
"description",
"node",
".",
"One",
"RIF",
"-",
"CS",
"can",
"have",
"more",
"than",
"one",
"description",
"nodes",
".",
"Each",
"description",
"node",
"has",
"only",
"one",
"description",
".",
"\\",
"param",
"$value",
"Type",
":",
"string",
".",
... | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L184-L188 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_identifier_node | protected function create_identifier_node($key, $i_type='local')
{
$c = $this->addChild($this->working_node, 'identifier', $key);
$c->setAttribute('type', $i_type);
} | php | protected function create_identifier_node($key, $i_type='local')
{
$c = $this->addChild($this->working_node, 'identifier', $key);
$c->setAttribute('type', $i_type);
} | [
"protected",
"function",
"create_identifier_node",
"(",
"$",
"key",
",",
"$",
"i_type",
"=",
"'local'",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"this",
"->",
"working_node",
",",
"'identifier'",
",",
"$",
"key",
")",
";",
"$",... | Create local or other type of identifier inside of RIF-CS metadata node
\param $key
Type string. The indentifier itself.
\param $i_type
Type string. Type of identifier. Can be abn, uri, local, etc.. Default is local. | [
"Create",
"local",
"or",
"other",
"type",
"of",
"identifier",
"inside",
"of",
"RIF",
"-",
"CS",
"metadata",
"node",
"\\",
"param",
"$key",
"Type",
"string",
".",
"The",
"indentifier",
"itself",
".",
"\\",
"param",
"$i_type",
"Type",
"string",
".",
"Type",
... | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L196-L200 |
fccn/oai-pmh-core | src/schemas/ands_oai.php | ANDS_OAI.create_e_node | protected function create_e_node($addr_node, $e_node, $e_type = 'email')
{
$c = $this->addChild($addr_node, 'electronic');
$c->setAttribute('type', $e_type);
$this->addChild($c, 'value', $e_node);
} | php | protected function create_e_node($addr_node, $e_node, $e_type = 'email')
{
$c = $this->addChild($addr_node, 'electronic');
$c->setAttribute('type', $e_type);
$this->addChild($c, 'value', $e_node);
} | [
"protected",
"function",
"create_e_node",
"(",
"$",
"addr_node",
",",
"$",
"e_node",
",",
"$",
"e_type",
"=",
"'email'",
")",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"addChild",
"(",
"$",
"addr_node",
",",
"'electronic'",
")",
";",
"$",
"c",
"->",
"se... | Electrical address node. Used for email, url, etc
\param $addr_node Type: DOMElement. Previously created address node.
\param $e_node Type: string. The content of the adding node.
\param $e_type Type: string. Default is email. | [
"Electrical",
"address",
"node",
".",
"Used",
"for",
"email",
"url",
"etc",
"\\",
"param",
"$addr_node",
"Type",
":",
"DOMElement",
".",
"Previously",
"created",
"address",
"node",
".",
"\\",
"param",
"$e_node",
"Type",
":",
"string",
".",
"The",
"content",
... | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/schemas/ands_oai.php#L224-L229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.