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 |
|---|---|---|---|---|---|---|---|---|---|---|
academic/VipaBibTexBundle | Helper/Bibtex.php | Bibtex._formatAuthor | function _formatAuthor($array)
{
if (!array_key_exists('von', $array)) {
$array['von'] = '';
} else {
$array['von'] = trim($array['von']);
}
if (!array_key_exists('last', $array)) {
$array['last'] = '';
} else {
$array['last'] =... | php | function _formatAuthor($array)
{
if (!array_key_exists('von', $array)) {
$array['von'] = '';
} else {
$array['von'] = trim($array['von']);
}
if (!array_key_exists('last', $array)) {
$array['last'] = '';
} else {
$array['last'] =... | [
"function",
"_formatAuthor",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'von'",
",",
"$",
"array",
")",
")",
"{",
"$",
"array",
"[",
"'von'",
"]",
"=",
"''",
";",
"}",
"else",
"{",
"$",
"array",
"[",
"'von'",
"]",
"=",... | Returns the author formatted
The Author is formatted as setted in the authorstring
@access private
@param array $array Author array
@return string the formatted author string | [
"Returns",
"the",
"author",
"formatted"
] | train | https://github.com/academic/VipaBibTexBundle/blob/1cd82b0961e1a9fee804a85fd774d1384c3e089b/Helper/Bibtex.php#L938-L967 |
academic/VipaBibTexBundle | Helper/Bibtex.php | Bibtex.bibTex | function bibTex()
{
$bibtex = '';
foreach ($this->data as $entry) {
//Intro
$bibtex .= '@' . strtolower($entry['entryType']) . ' { ' . $entry['cite'] . ",\n";
//Other fields except author
foreach ($entry as $key => $val) {
if ($this->_o... | php | function bibTex()
{
$bibtex = '';
foreach ($this->data as $entry) {
//Intro
$bibtex .= '@' . strtolower($entry['entryType']) . ' { ' . $entry['cite'] . ",\n";
//Other fields except author
foreach ($entry as $key => $val) {
if ($this->_o... | [
"function",
"bibTex",
"(",
")",
"{",
"$",
"bibtex",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"entry",
")",
"{",
"//Intro",
"$",
"bibtex",
".=",
"'@'",
".",
"strtolower",
"(",
"$",
"entry",
"[",
"'entryType'",
"]",
")",
... | Converts the stored BibTex entries to a BibTex String
In the field list, the author is the last field.
@access public
@return string The BibTex string | [
"Converts",
"the",
"stored",
"BibTex",
"entries",
"to",
"a",
"BibTex",
"String"
] | train | https://github.com/academic/VipaBibTexBundle/blob/1cd82b0961e1a9fee804a85fd774d1384c3e089b/Helper/Bibtex.php#L977-L1013 |
academic/VipaBibTexBundle | Helper/Bibtex.php | Bibtex.getStatistic | function getStatistic()
{
$ret = array();
foreach ($this->data as $entry) {
if (array_key_exists($entry['entryType'], $ret)) {
$ret[$entry['entryType']]++;
} else {
$ret[$entry['entryType']] = 1;
}
}
return $ret;
... | php | function getStatistic()
{
$ret = array();
foreach ($this->data as $entry) {
if (array_key_exists($entry['entryType'], $ret)) {
$ret[$entry['entryType']]++;
} else {
$ret[$entry['entryType']] = 1;
}
}
return $ret;
... | [
"function",
"getStatistic",
"(",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"entry",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"entry",
"[",
"'entryType'",
"]",
",",
"$",
"ret",... | Returns statistic
This functions returns a hash table. The keys are the different
entry types and the values are the amount of these entries.
@access public
@return array Hash Table with the data | [
"Returns",
"statistic"
] | train | https://github.com/academic/VipaBibTexBundle/blob/1cd82b0961e1a9fee804a85fd774d1384c3e089b/Helper/Bibtex.php#L1036-L1047 |
academic/VipaBibTexBundle | Helper/Bibtex.php | Bibtex.rtf | function rtf()
{
$ret = "{\\rtf\n";
foreach ($this->data as $entry) {
$line = $this->rtfstring;
$title = '';
$journal = '';
$year = '';
$authors = '';
if (array_key_exists('title', $entry)) {
$title = $this->_unw... | php | function rtf()
{
$ret = "{\\rtf\n";
foreach ($this->data as $entry) {
$line = $this->rtfstring;
$title = '';
$journal = '';
$year = '';
$authors = '';
if (array_key_exists('title', $entry)) {
$title = $this->_unw... | [
"function",
"rtf",
"(",
")",
"{",
"$",
"ret",
"=",
"\"{\\\\rtf\\n\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"entry",
")",
"{",
"$",
"line",
"=",
"$",
"this",
"->",
"rtfstring",
";",
"$",
"title",
"=",
"''",
";",
"$",
"journal... | Returns the stored data in RTF format
This method simply returns a RTF formatted string. This is done very
simple and is not intended for heavy using and fine formatting. This
should be done by BibTex! It is intended to give some kind of quick
preview or to send someone a reference list as word/rtf format (even
some p... | [
"Returns",
"the",
"stored",
"data",
"in",
"RTF",
"format"
] | train | https://github.com/academic/VipaBibTexBundle/blob/1cd82b0961e1a9fee804a85fd774d1384c3e089b/Helper/Bibtex.php#L1063-L1105 |
academic/VipaBibTexBundle | Helper/Bibtex.php | Bibtex._escape_tex | function _escape_tex($tex)
{
$tex = str_replace("\\", "\\\\", $tex);
$tex = str_replace('#', '\#', $tex);
$tex = str_replace('$', '\$', $tex);
$tex = str_replace('%', '\%', $tex);
$tex = str_replace('^', '\^', $tex);
$tex = str_replace('&', '\&', $tex);
$tex =... | php | function _escape_tex($tex)
{
$tex = str_replace("\\", "\\\\", $tex);
$tex = str_replace('#', '\#', $tex);
$tex = str_replace('$', '\$', $tex);
$tex = str_replace('%', '\%', $tex);
$tex = str_replace('^', '\^', $tex);
$tex = str_replace('&', '\&', $tex);
$tex =... | [
"function",
"_escape_tex",
"(",
"$",
"tex",
")",
"{",
"$",
"tex",
"=",
"str_replace",
"(",
"\"\\\\\"",
",",
"\"\\\\\\\\\"",
",",
"$",
"tex",
")",
";",
"$",
"tex",
"=",
"str_replace",
"(",
"'#'",
",",
"'\\#'",
",",
"$",
"tex",
")",
";",
"$",
"tex",
... | Returns a string with special TeX characters escaped.
This method is to be used with any method which is exporting TeX, such
as the bibTex method. A series of string replace operations are
performed on the input string, and the escaped string is returned.
This code is taken from the Text_Wiki Pear package.
@author J... | [
"Returns",
"a",
"string",
"with",
"special",
"TeX",
"characters",
"escaped",
"."
] | train | https://github.com/academic/VipaBibTexBundle/blob/1cd82b0961e1a9fee804a85fd774d1384c3e089b/Helper/Bibtex.php#L1179-L1191 |
mustardandrew/muan-laravel-acl | src/Middleware/PermissionMiddleware.php | PermissionMiddleware.handle | public function handle($request, Closure $next, $permission)
{
if (! $user = $request->user()) {
abort(403, "Access denied!");
}
if (! $user->can($permission)) {
abort(403, "Access denied!");
}
return $next($request);
} | php | public function handle($request, Closure $next, $permission)
{
if (! $user = $request->user()) {
abort(403, "Access denied!");
}
if (! $user->can($permission)) {
abort(403, "Access denied!");
}
return $next($request);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"$",
"permission",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"=",
"$",
"request",
"->",
"user",
"(",
")",
")",
"{",
"abort",
"(",
"403",
",",
"\"Access denied!\"",
... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@param string $role
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/mustardandrew/muan-laravel-acl/blob/b5f23340b5536babb98d9fd0d727a7a3371c97d5/src/Middleware/PermissionMiddleware.php#L23-L34 |
zicht/z | src/Zicht/Tool/Script/Tokenizer.php | Tokenizer.getTokens | public function getTokens($string, &$needle = 0)
{
$exprTokenizer = new ExpressionTokenizer();
$ret = array();
$depth = 0;
$needle = 0;
$len = strlen($string);
while ($needle < $len) {
$before = $needle;
$substr = substr($string, $needle);
... | php | public function getTokens($string, &$needle = 0)
{
$exprTokenizer = new ExpressionTokenizer();
$ret = array();
$depth = 0;
$needle = 0;
$len = strlen($string);
while ($needle < $len) {
$before = $needle;
$substr = substr($string, $needle);
... | [
"public",
"function",
"getTokens",
"(",
"$",
"string",
",",
"&",
"$",
"needle",
"=",
"0",
")",
"{",
"$",
"exprTokenizer",
"=",
"new",
"ExpressionTokenizer",
"(",
")",
";",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"$",
"depth",
"=",
"0",
";",
"$",
... | Returns an array of tokens
@param string $string
@param int &$needle
@throws \UnexpectedValueException
@return array | [
"Returns",
"an",
"array",
"of",
"tokens"
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Script/Tokenizer.php#L34-L87 |
PeeHaa/AsyncTwitter | src/Api/Client/Client.php | Client.throwFromErrorResponse | private function throwFromErrorResponse(HttpResponse $response, array $body)
{
list($message, $code, $extra) = $this->getErrorStringFromResponseBody($body);
$exceptions = [
400 => BadRequest::class,
401 => Unauthorized::class,
403 => Forbidden::class,
... | php | private function throwFromErrorResponse(HttpResponse $response, array $body)
{
list($message, $code, $extra) = $this->getErrorStringFromResponseBody($body);
$exceptions = [
400 => BadRequest::class,
401 => Unauthorized::class,
403 => Forbidden::class,
... | [
"private",
"function",
"throwFromErrorResponse",
"(",
"HttpResponse",
"$",
"response",
",",
"array",
"$",
"body",
")",
"{",
"list",
"(",
"$",
"message",
",",
"$",
"code",
",",
"$",
"extra",
")",
"=",
"$",
"this",
"->",
"getErrorStringFromResponseBody",
"(",
... | https://dev.twitter.com/overview/api/response-codes | [
"https",
":",
"//",
"dev",
".",
"twitter",
".",
"com",
"/",
"overview",
"/",
"api",
"/",
"response",
"-",
"codes"
] | train | https://github.com/PeeHaa/AsyncTwitter/blob/a968909e7ed470bd87a0f25ef0c494338273c29c/src/Api/Client/Client.php#L108-L133 |
mergado/mergado-api-client-php | src/mergadoclient/UrlBuilder.php | UrlBuilder.resetUrl | public function resetUrl()
{
if ($this->mode == 'dev') {
$this->url = static::BASEURL_DEV;
} else if ($this->mode == 'local') {
$this->url = static::BASEURL_LOCAL;
} else {
$this->url = static::BASEURL;
}
} | php | public function resetUrl()
{
if ($this->mode == 'dev') {
$this->url = static::BASEURL_DEV;
} else if ($this->mode == 'local') {
$this->url = static::BASEURL_LOCAL;
} else {
$this->url = static::BASEURL;
}
} | [
"public",
"function",
"resetUrl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"mode",
"==",
"'dev'",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"static",
"::",
"BASEURL_DEV",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"mode",
"==",
"'local'",
... | Sets $this->url to base | [
"Sets",
"$this",
"-",
">",
"url",
"to",
"base"
] | train | https://github.com/mergado/mergado-api-client-php/blob/6c13b994a81bf5a3d6f3f791ea1dfbe2c420565f/src/mergadoclient/UrlBuilder.php#L55-L66 |
AOEpeople/Aoe_Layout | app/code/local/Aoe/Layout/Controller/Model.php | Aoe_Layout_Controller_Model.indexAction | public function indexAction()
{
if ($this->getRequest()->isAjax()) {
try {
$this->loadLayout(null, false, false);
$this->getLayout()->getUpdate()->setCacheId(null);
$this->getLayout()->getUpdate()->addHandle(strtolower($this->getFullActionName()) .... | php | public function indexAction()
{
if ($this->getRequest()->isAjax()) {
try {
$this->loadLayout(null, false, false);
$this->getLayout()->getUpdate()->setCacheId(null);
$this->getLayout()->getUpdate()->addHandle(strtolower($this->getFullActionName()) .... | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"isAjax",
"(",
")",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"loadLayout",
"(",
"null",
",",
"false",
",",
"false",
")",
";",
"$",
"th... | List existing records via a grid | [
"List",
"existing",
"records",
"via",
"a",
"grid"
] | train | https://github.com/AOEpeople/Aoe_Layout/blob/d88ba3406cf12dbaf09548477133c3cb27d155ed/app/code/local/Aoe/Layout/Controller/Model.php#L8-L24 |
AOEpeople/Aoe_Layout | app/code/local/Aoe/Layout/Controller/Model.php | Aoe_Layout_Controller_Model.viewAction | public function viewAction()
{
$model = $this->loadModel();
if (!$model->getId()) {
$this->_forward('noroute');
return;
}
$this->loadLayout();
$this->renderLayout();
} | php | public function viewAction()
{
$model = $this->loadModel();
if (!$model->getId()) {
$this->_forward('noroute');
return;
}
$this->loadLayout();
$this->renderLayout();
} | [
"public",
"function",
"viewAction",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"loadModel",
"(",
")",
";",
"if",
"(",
"!",
"$",
"model",
"->",
"getId",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_forward",
"(",
"'noroute'",
")",
";",
"retu... | View existing record | [
"View",
"existing",
"record"
] | train | https://github.com/AOEpeople/Aoe_Layout/blob/d88ba3406cf12dbaf09548477133c3cb27d155ed/app/code/local/Aoe/Layout/Controller/Model.php#L29-L39 |
php-lug/lug | src/Bundle/ResourceBundle/DependencyInjection/Compiler/AbstractRegisterGenericDomainListenerPass.php | AbstractRegisterGenericDomainListenerPass.process | public function process(ContainerBuilder $container)
{
$flashListener = $container->getDefinition($this->listener);
$controllers = $container->findTaggedServiceIds($tag = 'lug.controller');
foreach ($controllers as $controller => $attributes) {
foreach ($attributes as $attribute... | php | public function process(ContainerBuilder $container)
{
$flashListener = $container->getDefinition($this->listener);
$controllers = $container->findTaggedServiceIds($tag = 'lug.controller');
foreach ($controllers as $controller => $attributes) {
foreach ($attributes as $attribute... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"flashListener",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"$",
"this",
"->",
"listener",
")",
";",
"$",
"controllers",
"=",
"$",
"container",
"->",
"findTagg... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/ResourceBundle/DependencyInjection/Compiler/AbstractRegisterGenericDomainListenerPass.php#L62-L87 |
simialbi/yii2-simialbi-base | i18n/TranslationTrait.php | TranslationTrait.registerTranslations | public function registerTranslations() {
$reflector = new \ReflectionClass(static::class);
$dir = rtrim(dirname($reflector->getFileName()), '\\/');
$dir = rtrim(preg_replace('#widgets$#', '', $dir), '\\/') . DIRECTORY_SEPARATOR . 'messages';
$category = str_replace(StringHelper::basename(static::cl... | php | public function registerTranslations() {
$reflector = new \ReflectionClass(static::class);
$dir = rtrim(dirname($reflector->getFileName()), '\\/');
$dir = rtrim(preg_replace('#widgets$#', '', $dir), '\\/') . DIRECTORY_SEPARATOR . 'messages';
$category = str_replace(StringHelper::basename(static::cl... | [
"public",
"function",
"registerTranslations",
"(",
")",
"{",
"$",
"reflector",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"static",
"::",
"class",
")",
";",
"$",
"dir",
"=",
"rtrim",
"(",
"dirname",
"(",
"$",
"reflector",
"->",
"getFileName",
"(",
")",
")... | Init translations
@throws \ReflectionException | [
"Init",
"translations"
] | train | https://github.com/simialbi/yii2-simialbi-base/blob/f68d3ee64f52c6dfb0aa31ffc14f5ced5aabdbb7/i18n/TranslationTrait.php#L24-L41 |
WellCommerce/StandardEditionBundle | DataFixtures/ORM/LoadOrderStatusData.php | LoadOrderStatusData.load | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
foreach ($this->getStatuses() as $key => $sample) {
$status = new OrderStatus();
$status->setEnabled(1);
$status->setOrderStatusGroup($this->getReferen... | php | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
foreach ($this->getStatuses() as $key => $sample) {
$status = new OrderStatus();
$status->setEnabled(1);
$status->setOrderStatusGroup($this->getReferen... | [
"public",
"function",
"load",
"(",
"ObjectManager",
"$",
"manager",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"getStatuses",
"(",
")",
"as",
"$",
"key",
"=>"... | {@inheritDoc} | [
"{"
] | train | https://github.com/WellCommerce/StandardEditionBundle/blob/6367bd20bbb6bde37c710a6ba87ae72b5f05f61e/DataFixtures/ORM/LoadOrderStatusData.php#L30-L51 |
odiaseo/pagebuilder | src/PageBuilder/Util/Widget.php | Widget.init | public function init()
{
if ($this->isCacheEnabled() and file_exists(self::CACHE_LOCATION)) {
$store = include self::CACHE_LOCATION;
} else {
$store = [];
$finalList = [];
$config = $this->serviceManager->get('config');
... | php | public function init()
{
if ($this->isCacheEnabled() and file_exists(self::CACHE_LOCATION)) {
$store = include self::CACHE_LOCATION;
} else {
$store = [];
$finalList = [];
$config = $this->serviceManager->get('config');
... | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCacheEnabled",
"(",
")",
"and",
"file_exists",
"(",
"self",
"::",
"CACHE_LOCATION",
")",
")",
"{",
"$",
"store",
"=",
"include",
"self",
"::",
"CACHE_LOCATION",
";",
"}",
"el... | Gets lists of available widgets
@return array | [
"Gets",
"lists",
"of",
"available",
"widgets"
] | train | https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Util/Widget.php#L48-L134 |
odiaseo/pagebuilder | src/PageBuilder/Util/Widget.php | Widget.widgetExist | public function widgetExist($name)
{
$name = strtolower($name);
return isset($this->dataStore[0][$name]) ? $this->dataStore[0][$name] : false;
} | php | public function widgetExist($name)
{
$name = strtolower($name);
return isset($this->dataStore[0][$name]) ? $this->dataStore[0][$name] : false;
} | [
"public",
"function",
"widgetExist",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"dataStore",
"[",
"0",
"]",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->"... | Checks if a widget exists
@param $name
@return bool | [
"Checks",
"if",
"a",
"widget",
"exists"
] | train | https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Util/Widget.php#L143-L148 |
webdevvie/pheanstalk-task-queue-bundle | Command/Example/ExampleWorkerCommand.php | ExampleWorkerCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$message = $input->getOption('message');
$output->write("I HAVE A MESSAGE FOR YOU!");
$wait = intval($input->getArgument('wait'));
for ($counter = 0; $counter < $wait; $counter++) {
$output->writ... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$message = $input->getOption('message');
$output->write("I HAVE A MESSAGE FOR YOU!");
$wait = intval($input->getArgument('wait'));
for ($counter = 0; $counter < $wait; $counter++) {
$output->writ... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"message",
"=",
"$",
"input",
"->",
"getOption",
"(",
"'message'",
")",
";",
"$",
"output",
"->",
"write",
"(",
"\"I HAVE A MESSAGE... | {@inheritDoc}
@param InputInterface $input
@param OutputInterface $output
@return void | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Command/Example/ExampleWorkerCommand.php#L40-L50 |
inhere/php-librarys | src/Helpers/PhpError.php | PhpError.toArray | public static function toArray(array $lastError, $catcher = null)
{
$digest = 'Fatal Error (' . self::codeToString($lastError['type']) . '): ' . $lastError['message'];
$data = [
'code' => $lastError['type'],
'message' => $lastError['message'],
'file' => $lastError... | php | public static function toArray(array $lastError, $catcher = null)
{
$digest = 'Fatal Error (' . self::codeToString($lastError['type']) . '): ' . $lastError['message'];
$data = [
'code' => $lastError['type'],
'message' => $lastError['message'],
'file' => $lastError... | [
"public",
"static",
"function",
"toArray",
"(",
"array",
"$",
"lastError",
",",
"$",
"catcher",
"=",
"null",
")",
"{",
"$",
"digest",
"=",
"'Fatal Error ('",
".",
"self",
"::",
"codeToString",
"(",
"$",
"lastError",
"[",
"'type'",
"]",
")",
".",
"'): '",... | $lastError = error_get_last();
@param array $lastError
@param null|string $catcher
@return array | [
"$lastError",
"=",
"error_get_last",
"()",
";"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/PhpError.php#L26-L42 |
ezsystems/ezcomments-ls-extension | classes/ezcomnotifcationmanager.php | ezcomNotificationManager.sendNotificationInMany | public function sendNotificationInMany( $subscriber, $contentObject, $comment, $tpl = null )
{
if ( is_null( $tpl ) )
{
$tpl = eZTemplate::factory();
}
$tpl->setVariable( 'subscriber', $subscriber );
$tpl->setVariable( 'contentobject', $contentObject );
... | php | public function sendNotificationInMany( $subscriber, $contentObject, $comment, $tpl = null )
{
if ( is_null( $tpl ) )
{
$tpl = eZTemplate::factory();
}
$tpl->setVariable( 'subscriber', $subscriber );
$tpl->setVariable( 'contentobject', $contentObject );
... | [
"public",
"function",
"sendNotificationInMany",
"(",
"$",
"subscriber",
",",
"$",
"contentObject",
",",
"$",
"comment",
",",
"$",
"tpl",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"tpl",
")",
")",
"{",
"$",
"tpl",
"=",
"eZTemplate",
"::",
... | send one notification with one comment by one comment
Exception if error happens
@param $subscriber
@param $contentObject
@param $comment
@param $tpl
@return void | [
"send",
"one",
"notification",
"with",
"one",
"comment",
"by",
"one",
"comment",
"Exception",
"if",
"error",
"happens"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomnotifcationmanager.php#L41-L54 |
ezsystems/ezcomments-ls-extension | classes/ezcomnotifcationmanager.php | ezcomNotificationManager.sendNotificationInOne | public function sendNotificationInOne( $subscriber, $contentObject, $commentList = null, $tpl = null )
{
if ( is_null( $tpl ) )
{
$tpl = eZTemplate::factory();
}
$tpl->setVariable( 'subscriber', $subscriber );
$tpl->setVariable( 'contentobject', $contentObje... | php | public function sendNotificationInOne( $subscriber, $contentObject, $commentList = null, $tpl = null )
{
if ( is_null( $tpl ) )
{
$tpl = eZTemplate::factory();
}
$tpl->setVariable( 'subscriber', $subscriber );
$tpl->setVariable( 'contentobject', $contentObje... | [
"public",
"function",
"sendNotificationInOne",
"(",
"$",
"subscriber",
",",
"$",
"contentObject",
",",
"$",
"commentList",
"=",
"null",
",",
"$",
"tpl",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"tpl",
")",
")",
"{",
"$",
"tpl",
"=",
"eZ... | send notification with all comment in one notification
Exception if error happens
@param $subscriber
@param $contentObject
@param $commentList comment list to the subscriber, which can be null.
@param $tpl
@return void | [
"send",
"notification",
"with",
"all",
"comment",
"in",
"one",
"notification",
"Exception",
"if",
"error",
"happens"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomnotifcationmanager.php#L65-L80 |
ezsystems/ezcomments-ls-extension | classes/ezcomnotifcationmanager.php | ezcomNotificationManager.instance | public static function instance( $className = null )
{
if ( is_null( $className ) )
{
$ini = eZINI::instance( 'ezcomments.ini' );
$className = $ini->variable( 'NotificationSettings', 'NotificationManagerClass' );
}
if ( !isset( self::$instance ) )
{
... | php | public static function instance( $className = null )
{
if ( is_null( $className ) )
{
$ini = eZINI::instance( 'ezcomments.ini' );
$className = $ini->variable( 'NotificationSettings', 'NotificationManagerClass' );
}
if ( !isset( self::$instance ) )
{
... | [
"public",
"static",
"function",
"instance",
"(",
"$",
"className",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"className",
")",
")",
"{",
"$",
"ini",
"=",
"eZINI",
"::",
"instance",
"(",
"'ezcomments.ini'",
")",
";",
"$",
"className",
"=",
... | create instance of the object
@param string $className
@return ezcomNotificationManager | [
"create",
"instance",
"of",
"the",
"object"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomnotifcationmanager.php#L87-L99 |
ezsystems/ezcomments-ls-extension | classes/ezcomnotifcationmanager.php | ezcomNotificationManager.create | public static function create( $className = null )
{
if ( is_null( $className ) )
{
$ini = eZINI::instance( 'ezcomments.ini' );
$className = $ini->variable( 'NotificationSettings', 'NotificationManagerClass' );
}
return new $className();
} | php | public static function create( $className = null )
{
if ( is_null( $className ) )
{
$ini = eZINI::instance( 'ezcomments.ini' );
$className = $ini->variable( 'NotificationSettings', 'NotificationManagerClass' );
}
return new $className();
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"className",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"className",
")",
")",
"{",
"$",
"ini",
"=",
"eZINI",
"::",
"instance",
"(",
"'ezcomments.ini'",
")",
";",
"$",
"className",
"=",
... | create instance of the object without using singleton
@param string $className
@return ezcomNotificationManager | [
"create",
"instance",
"of",
"the",
"object",
"without",
"using",
"singleton"
] | train | https://github.com/ezsystems/ezcomments-ls-extension/blob/2b4cd8c34d4a77813e4d6a9c5a0d317a274c63c5/classes/ezcomnotifcationmanager.php#L106-L114 |
DomAndTom/dnt_laravel-swagger-alpha_framework | src/controllers/BaseController.php | BaseController.resources | public function resources()
{
$options = Config::get('laravel-swagger::getResourceListOptions');
$excludedPath = Config::get('laravel-swagger::excludedPath');
$swagger = new Swagger($this->getPaths(), $excludedPath);
if (Config::get('laravel-swagger::cache')) {
$reso... | php | public function resources()
{
$options = Config::get('laravel-swagger::getResourceListOptions');
$excludedPath = Config::get('laravel-swagger::excludedPath');
$swagger = new Swagger($this->getPaths(), $excludedPath);
if (Config::get('laravel-swagger::cache')) {
$reso... | [
"public",
"function",
"resources",
"(",
")",
"{",
"$",
"options",
"=",
"Config",
"::",
"get",
"(",
"'laravel-swagger::getResourceListOptions'",
")",
";",
"$",
"excludedPath",
"=",
"Config",
"::",
"get",
"(",
"'laravel-swagger::excludedPath'",
")",
";",
"$",
"swa... | Show all available Resources | [
"Show",
"all",
"available",
"Resources"
] | train | https://github.com/DomAndTom/dnt_laravel-swagger-alpha_framework/blob/489fc5398583682b8372bdadd6631a4cbff6099f/src/controllers/BaseController.php#L29-L46 |
DomAndTom/dnt_laravel-swagger-alpha_framework | src/controllers/BaseController.php | BaseController.showResource | public function showResource($name)
{
$options = Config::get('laravel-swagger::getResourceOptions');
$resourceName = "/" . str_replace("-", "/", $name);
$excludedPath = Config::get('laravel-swagger::excludedPath');
$swagger = new Swagger($this->getPaths(), $excludedPath);
i... | php | public function showResource($name)
{
$options = Config::get('laravel-swagger::getResourceOptions');
$resourceName = "/" . str_replace("-", "/", $name);
$excludedPath = Config::get('laravel-swagger::excludedPath');
$swagger = new Swagger($this->getPaths(), $excludedPath);
i... | [
"public",
"function",
"showResource",
"(",
"$",
"name",
")",
"{",
"$",
"options",
"=",
"Config",
"::",
"get",
"(",
"'laravel-swagger::getResourceOptions'",
")",
";",
"$",
"resourceName",
"=",
"\"/\"",
".",
"str_replace",
"(",
"\"-\"",
",",
"\"/\"",
",",
"$",... | Show an specific Resource | [
"Show",
"an",
"specific",
"Resource"
] | train | https://github.com/DomAndTom/dnt_laravel-swagger-alpha_framework/blob/489fc5398583682b8372bdadd6631a4cbff6099f/src/controllers/BaseController.php#L51-L79 |
DomAndTom/dnt_laravel-swagger-alpha_framework | src/controllers/BaseController.php | BaseController.getPaths | private function getPaths()
{
$paths = Config::get('laravel-swagger::paths');
if (Config::get('laravel-swagger::showDemo') ) {
$paths[] = __DIR__.'/demo';
$paths[] = __DIR__.'/../models';
}
return $paths;
} | php | private function getPaths()
{
$paths = Config::get('laravel-swagger::paths');
if (Config::get('laravel-swagger::showDemo') ) {
$paths[] = __DIR__.'/demo';
$paths[] = __DIR__.'/../models';
}
return $paths;
} | [
"private",
"function",
"getPaths",
"(",
")",
"{",
"$",
"paths",
"=",
"Config",
"::",
"get",
"(",
"'laravel-swagger::paths'",
")",
";",
"if",
"(",
"Config",
"::",
"get",
"(",
"'laravel-swagger::showDemo'",
")",
")",
"{",
"$",
"paths",
"[",
"]",
"=",
"__DI... | Get Paths | [
"Get",
"Paths"
] | train | https://github.com/DomAndTom/dnt_laravel-swagger-alpha_framework/blob/489fc5398583682b8372bdadd6631a4cbff6099f/src/controllers/BaseController.php#L84-L94 |
eghojansu/moe | src/tools/Image.php | Image.resize | function resize($width,$height,$crop=TRUE,$enlarge=TRUE) {
// Adjust dimensions; retain aspect ratio
$ratio=($origw=imagesx($this->data))/($origh=imagesy($this->data));
if (!$crop) {
if ($width/$ratio<=$height)
$height=$width/$ratio;
else
$width=$height*$ratio;
}
if (!$enlarge) {
$width=min($... | php | function resize($width,$height,$crop=TRUE,$enlarge=TRUE) {
// Adjust dimensions; retain aspect ratio
$ratio=($origw=imagesx($this->data))/($origh=imagesy($this->data));
if (!$crop) {
if ($width/$ratio<=$height)
$height=$width/$ratio;
else
$width=$height*$ratio;
}
if (!$enlarge) {
$width=min($... | [
"function",
"resize",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"crop",
"=",
"TRUE",
",",
"$",
"enlarge",
"=",
"TRUE",
")",
"{",
"// Adjust dimensions; retain aspect ratio",
"$",
"ratio",
"=",
"(",
"$",
"origw",
"=",
"imagesx",
"(",
"$",
"this",
... | Resize image (Maintain aspect ratio); Crop relative to center
if flag is enabled; Enlargement allowed if flag is enabled
@return object
@param $width int
@param $height int
@param $crop bool
@param $enlarge bool | [
"Resize",
"image",
"(",
"Maintain",
"aspect",
"ratio",
")",
";",
"Crop",
"relative",
"to",
"center",
"if",
"flag",
"is",
"enabled",
";",
"Enlargement",
"allowed",
"if",
"flag",
"is",
"enabled"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Image.php#L212-L248 |
eghojansu/moe | src/tools/Image.php | Image.save | function save() {
$fw=Base::instance();
if ($this->flag) {
if (!is_dir($dir=$fw->get('TEMP')))
mkdir($dir,Base::MODE,TRUE);
$this->count++;
$fw->write($dir.'/'.
$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
$fw->hash($this->file).'-'.$this->count.'.png',
$this->dump());
}
return $th... | php | function save() {
$fw=Base::instance();
if ($this->flag) {
if (!is_dir($dir=$fw->get('TEMP')))
mkdir($dir,Base::MODE,TRUE);
$this->count++;
$fw->write($dir.'/'.
$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
$fw->hash($this->file).'-'.$this->count.'.png',
$this->dump());
}
return $th... | [
"function",
"save",
"(",
")",
"{",
"$",
"fw",
"=",
"Base",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"flag",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dir",
"=",
"$",
"fw",
"->",
"get",
"(",
"'TEMP'",
")",
")",
")"... | Save current state
@return object | [
"Save",
"current",
"state"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Image.php#L480-L492 |
eghojansu/moe | src/tools/Image.php | Image.restore | function restore($state=1) {
$fw=Base::instance();
if ($this->flag && is_file($file=($path=$fw->get('TEMP').
$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
$fw->hash($this->file).'-').$state.'.png')) {
if (is_resource($this->data))
imagedestroy($this->data);
$this->data=imagecreatefromstring($fw-... | php | function restore($state=1) {
$fw=Base::instance();
if ($this->flag && is_file($file=($path=$fw->get('TEMP').
$fw->hash($fw->get('ROOT').$fw->get('BASE')).'.'.
$fw->hash($this->file).'-').$state.'.png')) {
if (is_resource($this->data))
imagedestroy($this->data);
$this->data=imagecreatefromstring($fw-... | [
"function",
"restore",
"(",
"$",
"state",
"=",
"1",
")",
"{",
"$",
"fw",
"=",
"Base",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"flag",
"&&",
"is_file",
"(",
"$",
"file",
"=",
"(",
"$",
"path",
"=",
"$",
"fw",
"->",
"get"... | Revert to specified state
@return object
@param $state int | [
"Revert",
"to",
"specified",
"state"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Image.php#L499-L515 |
eghojansu/moe | src/tools/Image.php | Image.load | function load($str) {
$this->data=imagecreatefromstring($str);
imagesavealpha($this->data,TRUE);
$this->save();
return $this;
} | php | function load($str) {
$this->data=imagecreatefromstring($str);
imagesavealpha($this->data,TRUE);
$this->save();
return $this;
} | [
"function",
"load",
"(",
"$",
"str",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"imagecreatefromstring",
"(",
"$",
"str",
")",
";",
"imagesavealpha",
"(",
"$",
"this",
"->",
"data",
",",
"TRUE",
")",
";",
"$",
"this",
"->",
"save",
"(",
")",
";",
... | Load string
@return object
@param $str string | [
"Load",
"string"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/Image.php#L535-L540 |
ericomgroup/PusheNotification | src/PushNotification.php | PushNotification.execute | private function execute($content)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token '.$this->token, 'Content-Type: application/json', 'Accept: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode((object) $content));
... | php | private function execute($content)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Token '.$this->token, 'Content-Type: application/json', 'Accept: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode((object) $content));
... | [
"private",
"function",
"execute",
"(",
"$",
"content",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"$",
"this",
"->",
"url",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_HTTP... | @param $content
@return mixed|string | [
"@param",
"$content"
] | train | https://github.com/ericomgroup/PusheNotification/blob/65e39fbb77f9bad5c5912f50b81e7d76de4b2b76/src/PushNotification.php#L124-L142 |
thupan/framework | src/Service/Redirect.php | Redirect.to | public static function to($location, $data = null)
{
$location = ($location === '/') ? URL : URL . $location;
$c = ($data) ? '?twigformfields='.base64_encode(json_encode($data)) : null;
header('Location: ' . $location . $c);
exit;
} | php | public static function to($location, $data = null)
{
$location = ($location === '/') ? URL : URL . $location;
$c = ($data) ? '?twigformfields='.base64_encode(json_encode($data)) : null;
header('Location: ' . $location . $c);
exit;
} | [
"public",
"static",
"function",
"to",
"(",
"$",
"location",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"location",
"=",
"(",
"$",
"location",
"===",
"'/'",
")",
"?",
"URL",
":",
"URL",
".",
"$",
"location",
";",
"$",
"c",
"=",
"(",
"$",
"dat... | Método público para redirecionar uma página.
@method to()
@param string
@return none | [
"Método",
"público",
"para",
"redirecionar",
"uma",
"página",
"."
] | train | https://github.com/thupan/framework/blob/43193c67e87942930fb0cbc53aa069b60b27e749/src/Service/Redirect.php#L21-L28 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.beforeDelete | public function beforeDelete($cascade = true) {
if ($this->id) {
WsPaxaposConnect::sendMesa((int)$this->id, "mesa:delete");
}
return parent::beforeDelete($cascade);
} | php | public function beforeDelete($cascade = true) {
if ($this->id) {
WsPaxaposConnect::sendMesa((int)$this->id, "mesa:delete");
}
return parent::beforeDelete($cascade);
} | [
"public",
"function",
"beforeDelete",
"(",
"$",
"cascade",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"{",
"WsPaxaposConnect",
"::",
"sendMesa",
"(",
"(",
"int",
")",
"$",
"this",
"->",
"id",
",",
"\"mesa:delete\"",
")",
";",
"}"... | Called before every deletion operation.
@return void
@link http://book.cakephp.org/2.0/en/models/callback-methods.html#afterdelete | [
"Called",
"before",
"every",
"deletion",
"operation",
"."
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L255-L261 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.__processStateChanges | private function __processStateChanges ( $evName = 'Before') {
$this->changedState = false;
$this->changedNewState = false;
$estadoAnterior = $this->field('estado_id');
if ( empty($this->data['Mesa']['estado_id']) ) {
return false;
}
$nuevoEstado = $this->data['Mesa']['estado_id'];
if ( $estadoAnte... | php | private function __processStateChanges ( $evName = 'Before') {
$this->changedState = false;
$this->changedNewState = false;
$estadoAnterior = $this->field('estado_id');
if ( empty($this->data['Mesa']['estado_id']) ) {
return false;
}
$nuevoEstado = $this->data['Mesa']['estado_id'];
if ( $estadoAnte... | [
"private",
"function",
"__processStateChanges",
"(",
"$",
"evName",
"=",
"'Before'",
")",
"{",
"$",
"this",
"->",
"changedState",
"=",
"false",
";",
"$",
"this",
"->",
"changedNewState",
"=",
"false",
";",
"$",
"estadoAnterior",
"=",
"$",
"this",
"->",
"fi... | Procesa el Cambio de estado llenando el atributo $this->changedState
con el nuevo ID del estado que fue moficiado
Si el estado no fue modificado la funcion devuelve FALSE, al igual que
$this->changedState permanecera en FALSE
@param String $evName Nombre prefixo del evento, generalemnte voy a usar "Before" y "After"
@... | [
"Procesa",
"el",
"Cambio",
"de",
"estado",
"llenando",
"el",
"atributo",
"$this",
"-",
">",
"changedState",
"con",
"el",
"nuevo",
"ID",
"del",
"estado",
"que",
"fue",
"moficiado",
"Si",
"el",
"estado",
"no",
"fue",
"modificado",
"la",
"funcion",
"devuelve",
... | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L346-L363 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.cerrar_mesa | function cerrar_mesa( $mesa_id = null, $save = true, $silent = false )
{
if ( !empty( $this->data['Mesa']['id'] ) ) {
$this->id = $this->data['Mesa']['id'];
}
$this->id = ( $mesa_id == null ) ? $this->id : $mesa_id;
if ( !$this->exists( $this->id ) ) {
throw new NotFoundException(__('La Mesa ID# no ex... | php | function cerrar_mesa( $mesa_id = null, $save = true, $silent = false )
{
if ( !empty( $this->data['Mesa']['id'] ) ) {
$this->id = $this->data['Mesa']['id'];
}
$this->id = ( $mesa_id == null ) ? $this->id : $mesa_id;
if ( !$this->exists( $this->id ) ) {
throw new NotFoundException(__('La Mesa ID# no ex... | [
"function",
"cerrar_mesa",
"(",
"$",
"mesa_id",
"=",
"null",
",",
"$",
"save",
"=",
"true",
",",
"$",
"silent",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
"[",
"'Mesa'",
"]",
"[",
"'id'",
"]",
")",
")",
"{"... | } | [
"}"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L449-L474 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.calcular_valor_cubierto | function calcular_valor_cubierto ( $mesaId = null ) {
if (!empty($mesaId)) {
$this->id = $mesaId;
}
$cant_comensales = $this->field('cant_comensales');
$precioCubierto = Configure::read('Restaurante.valorCubierto');
$valor_cubierto = 0;
if ($precioCubierto > 0) {
$valor_cubierto = $precioCubierto * $cant... | php | function calcular_valor_cubierto ( $mesaId = null ) {
if (!empty($mesaId)) {
$this->id = $mesaId;
}
$cant_comensales = $this->field('cant_comensales');
$precioCubierto = Configure::read('Restaurante.valorCubierto');
$valor_cubierto = 0;
if ($precioCubierto > 0) {
$valor_cubierto = $precioCubierto * $cant... | [
"function",
"calcular_valor_cubierto",
"(",
"$",
"mesaId",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"mesaId",
")",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"mesaId",
";",
"}",
"$",
"cant_comensales",
"=",
"$",
"this",
"->",
"fi... | Funcion que calcula el precio del cubierto
@param Integer $mesaId default NULL
@return Float precio del cubierto | [
"Funcion",
"que",
"calcula",
"el",
"precio",
"del",
"cubierto"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L559-L572 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.calcular_total | function calcular_total($id = null){
if (!empty($id)) $this->id = $id;
$subtotal = $this->calcular_subtotal();
$totalPorcentajeDescuento = $this->calcular_descuentos();
$conversionDescuento = 1-($totalPorcentajeDescuento/100);
$total = cqs_round( $subtotal * $conversionDescuento );
return $total;
} | php | function calcular_total($id = null){
if (!empty($id)) $this->id = $id;
$subtotal = $this->calcular_subtotal();
$totalPorcentajeDescuento = $this->calcular_descuentos();
$conversionDescuento = 1-($totalPorcentajeDescuento/100);
$total = cqs_round( $subtotal * $conversionDescuento );
return $total;
} | [
"function",
"calcular_total",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id",
")",
")",
"$",
"this",
"->",
"id",
"=",
"$",
"id",
";",
"$",
"subtotal",
"=",
"$",
"this",
"->",
"calcular_subtotal",
"(",
")",
";",
"... | Calcula el total de la mesa cuyo id fue seteado en $this->Mesa->id
return @total el valor | [
"Calcula",
"el",
"total",
"de",
"la",
"mesa",
"cuyo",
"id",
"fue",
"seteado",
"en",
"$this",
"-",
">",
"Mesa",
"-",
">",
"id",
"return"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L580-L591 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.ultimasCobradas | function ultimasCobradas($limit = 20){
$conditions = array("Mesa.estado_id >=" => MESA_COBRADA);
$mesas = $this->find('all', array(
'conditions'=>$conditions,
'limit' => $limit,
));
return $mesas;
} | php | function ultimasCobradas($limit = 20){
$conditions = array("Mesa.estado_id >=" => MESA_COBRADA);
$mesas = $this->find('all', array(
'conditions'=>$conditions,
'limit' => $limit,
));
return $mesas;
} | [
"function",
"ultimasCobradas",
"(",
"$",
"limit",
"=",
"20",
")",
"{",
"$",
"conditions",
"=",
"array",
"(",
"\"Mesa.estado_id >=\"",
"=>",
"MESA_COBRADA",
")",
";",
"$",
"mesas",
"=",
"$",
"this",
"->",
"find",
"(",
"'all'",
",",
"array",
"(",
"'conditi... | } | [
"}"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L616-L626 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.estaCobrada | function estaCobrada($id = null, $force_db = false){
$ret = false;
if (!empty($id)){
$this->id = $id;
}
if ( !empty($this->data[$this->name]['estado_id']) ){
$ret = $this->data[$this->name]['estado_id'] == MESA_COBRADA;
}
if ( $force_db) {
// lo busco en BBDD
$ret = $t... | php | function estaCobrada($id = null, $force_db = false){
$ret = false;
if (!empty($id)){
$this->id = $id;
}
if ( !empty($this->data[$this->name]['estado_id']) ){
$ret = $this->data[$this->name]['estado_id'] == MESA_COBRADA;
}
if ( $force_db) {
// lo busco en BBDD
$ret = $t... | [
"function",
"estaCobrada",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"force_db",
"=",
"false",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"id",
";",
"}",
... | Dice si una mesa esta cobrada o no
@param integer $id
@param boolean $force_db indica si quiero forzar para que busque en la BBDD
@return boolean | [
"Dice",
"si",
"una",
"mesa",
"esta",
"cobrada",
"o",
"no"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L746-L768 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.estaAbierta | function estaAbierta($id = null){
if (!empty($id)){
$this->id = $id;
}
// lo busco en BBDD
$ret = $this->find('count', array(
'conditions' => array(
'Mesa.estado_id' => MESA_ABIERTA,
'Mesa.id' => $this->id,
)
... | php | function estaAbierta($id = null){
if (!empty($id)){
$this->id = $id;
}
// lo busco en BBDD
$ret = $this->find('count', array(
'conditions' => array(
'Mesa.estado_id' => MESA_ABIERTA,
'Mesa.id' => $this->id,
)
... | [
"function",
"estaAbierta",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"$",
"id",
";",
"}",
"// lo busco en BBDD ",
"$",
"ret",
"=",
"$",
"this",
"->",
"find"... | Dice si una mesa esta abierta o no
@param integer $id
@return boolean | [
"Dice",
"si",
"una",
"mesa",
"esta",
"abierta",
"o",
"no"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L780-L793 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.totalesDeMesasEntre | function totalesDeMesasEntre($fechaDesde = '', $fechaHasta = '', $conds = array()){
$horarioCorte = Configure::read('Horario.corte_del_dia');
if ( $horarioCorte < 10 ) {
$horarioCorte = "0$horarioCorte";
}
$sqlHorarioDeCorte = "DATE(SUBTIME(Mesa.checkin, '$horarioCorte:00:00'))";
$desde = empty($fech... | php | function totalesDeMesasEntre($fechaDesde = '', $fechaHasta = '', $conds = array()){
$horarioCorte = Configure::read('Horario.corte_del_dia');
if ( $horarioCorte < 10 ) {
$horarioCorte = "0$horarioCorte";
}
$sqlHorarioDeCorte = "DATE(SUBTIME(Mesa.checkin, '$horarioCorte:00:00'))";
$desde = empty($fech... | [
"function",
"totalesDeMesasEntre",
"(",
"$",
"fechaDesde",
"=",
"''",
",",
"$",
"fechaHasta",
"=",
"''",
",",
"$",
"conds",
"=",
"array",
"(",
")",
")",
"{",
"$",
"horarioCorte",
"=",
"Configure",
"::",
"read",
"(",
"'Horario.corte_del_dia'",
")",
";",
"... | Me devuelve un listado agrupado por dia de mesas. Util para estadistica y contabilidad
@param type $fechaDesde string formato de fecha debe ser del tip AÑO-mes-dia Y-m-d
@param type $fechaHasta string formato de fecha debe ser del tip AÑO-mes-dia Y-m-d
@param type $conds array de condiciones extra | [
"Me",
"devuelve",
"un",
"listado",
"agrupado",
"por",
"dia",
"de",
"mesas",
".",
"Util",
"para",
"estadistica",
"y",
"contabilidad"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L826-L868 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.getMesasForRoom | public function getMesasForRoom($nombre_mesa_id, $left, $right) {
$this->recursive = 0;
$options = array('conditions' => array(
'Mesa.checkin <=' => $right . ' 00:00:00',
'Mesa.checkout >=' => $left . ' 23:59:59',
'Mesa.nombre_mesa_id' => $nombre_mesa_id
));
// print_r($this->find('all', $options... | php | public function getMesasForRoom($nombre_mesa_id, $left, $right) {
$this->recursive = 0;
$options = array('conditions' => array(
'Mesa.checkin <=' => $right . ' 00:00:00',
'Mesa.checkout >=' => $left . ' 23:59:59',
'Mesa.nombre_mesa_id' => $nombre_mesa_id
));
// print_r($this->find('all', $options... | [
"public",
"function",
"getMesasForRoom",
"(",
"$",
"nombre_mesa_id",
",",
"$",
"left",
",",
"$",
"right",
")",
"{",
"$",
"this",
"->",
"recursive",
"=",
"0",
";",
"$",
"options",
"=",
"array",
"(",
"'conditions'",
"=>",
"array",
"(",
"'Mesa.checkin <='",
... | Description
@param type $nombre_mesa_id
@param type $left
@param type $right
@return type | [
"Description"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L897-L906 |
alevilar/ristorantino-vendor | Mesa/Model/Mesa.php | Mesa.changeRoomStateIfTodayInPeriod | public function changeRoomStateIfTodayInPeriod($room, $checkin, $checkout) {
if (!is_array($room) && (is_string($room) || is_int($room))) {
$room = $this->Room->findById($room);
}
$today = date('Y-m-d');
if ($this->hasRoomMesaInDate($room, $today)) {
return $this->Room->changeRoomState($room, 2); // 2 = O... | php | public function changeRoomStateIfTodayInPeriod($room, $checkin, $checkout) {
if (!is_array($room) && (is_string($room) || is_int($room))) {
$room = $this->Room->findById($room);
}
$today = date('Y-m-d');
if ($this->hasRoomMesaInDate($room, $today)) {
return $this->Room->changeRoomState($room, 2); // 2 = O... | [
"public",
"function",
"changeRoomStateIfTodayInPeriod",
"(",
"$",
"room",
",",
"$",
"checkin",
",",
"$",
"checkout",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"room",
")",
"&&",
"(",
"is_string",
"(",
"$",
"room",
")",
"||",
"is_int",
"(",
"$",
... | change the room state if today is between period of Mesa for a given nombre_mesa_id or room object
@param int|array $room
@param string $checkin
@param string $checkout
@return void | [
"change",
"the",
"room",
"state",
"if",
"today",
"is",
"between",
"period",
"of",
"Mesa",
"for",
"a",
"given",
"nombre_mesa_id",
"or",
"room",
"object"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Mesa/Model/Mesa.php#L945-L957 |
ouropencode/dachi | src/Console/Application.php | Application.create | public static function create() {
$app = new CLIApplication('Dachi', Kernel::getVersion(true));
$commands = array(
new \Dachi\Core\Console\Command\TestCommand(),
new \Dachi\Core\Console\Command\CreateCommand(),
new \Dachi\Core\Console\Command\DocumentCommand(),
/** run under 'dachi:all' **/
new \... | php | public static function create() {
$app = new CLIApplication('Dachi', Kernel::getVersion(true));
$commands = array(
new \Dachi\Core\Console\Command\TestCommand(),
new \Dachi\Core\Console\Command\CreateCommand(),
new \Dachi\Core\Console\Command\DocumentCommand(),
/** run under 'dachi:all' **/
new \... | [
"public",
"static",
"function",
"create",
"(",
")",
"{",
"$",
"app",
"=",
"new",
"CLIApplication",
"(",
"'Dachi'",
",",
"Kernel",
"::",
"getVersion",
"(",
"true",
")",
")",
";",
"$",
"commands",
"=",
"array",
"(",
"new",
"\\",
"Dachi",
"\\",
"Core",
... | Create the CLI application
@return null | [
"Create",
"the",
"CLI",
"application"
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Console/Application.php#L21-L43 |
heidelpay/PhpDoc | src/phpDocumentor/Parser/ServiceProvider.php | ServiceProvider.register | public function register(Application $app)
{
if (!isset($app['descriptor.builder'])) {
throw new Exception\MissingDependencyException(
'The builder object that is used to construct the ProjectDescriptor is missing'
);
}
$app['parser'] = $app->share(
... | php | public function register(Application $app)
{
if (!isset($app['descriptor.builder'])) {
throw new Exception\MissingDependencyException(
'The builder object that is used to construct the ProjectDescriptor is missing'
);
}
$app['parser'] = $app->share(
... | [
"public",
"function",
"register",
"(",
"Application",
"$",
"app",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"app",
"[",
"'descriptor.builder'",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"MissingDependencyException",
"(",
"'The builder object th... | Registers services on the given app.
@param Application $app An Application instance
@throws Exception\MissingDependencyException if the Descriptor Builder is not present.
@return void | [
"Registers",
"services",
"on",
"the",
"given",
"app",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Parser/ServiceProvider.php#L36-L66 |
heidelpay/PhpDoc | src/phpDocumentor/Parser/ServiceProvider.php | ServiceProvider.validateDocBlocks | public function validateDocBlocks($data)
{
/** @var \phpDocumentor\Reflection\BaseReflector $element */
$element = $data->getSubject();
/** @var \phpDocumentor\Reflection\DocBlock $docblock */
$docblock = $data->getDocblock();
// get the type of element
$type = subs... | php | public function validateDocBlocks($data)
{
/** @var \phpDocumentor\Reflection\BaseReflector $element */
$element = $data->getSubject();
/** @var \phpDocumentor\Reflection\DocBlock $docblock */
$docblock = $data->getDocblock();
// get the type of element
$type = subs... | [
"public",
"function",
"validateDocBlocks",
"(",
"$",
"data",
")",
"{",
"/** @var \\phpDocumentor\\Reflection\\BaseReflector $element */",
"$",
"element",
"=",
"$",
"data",
"->",
"getSubject",
"(",
")",
";",
"/** @var \\phpDocumentor\\Reflection\\DocBlock $docblock */",
"$",
... | Checks all phpDocumentor whether they match the given rules.
@param PostDocBlockExtractionEvent $data Event object containing the parameters.
@todo convert this method to the new style validators; this method is not invoked anymore
@return void | [
"Checks",
"all",
"phpDocumentor",
"whether",
"they",
"match",
"the",
"given",
"rules",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Parser/ServiceProvider.php#L77-L110 |
heidelpay/PhpDoc | src/phpDocumentor/Parser/ServiceProvider.php | ServiceProvider.loadConfigurationByElement | protected function loadConfigurationByElement($configOptions, $configType)
{
$validatorOptions = array();
if (isset($configOptions[$configType]->tag)) {
foreach ($configOptions[$configType]->tag as $tag) {
$tagName = (string) $tag['name'];
if (isset($ta... | php | protected function loadConfigurationByElement($configOptions, $configType)
{
$validatorOptions = array();
if (isset($configOptions[$configType]->tag)) {
foreach ($configOptions[$configType]->tag as $tag) {
$tagName = (string) $tag['name'];
if (isset($ta... | [
"protected",
"function",
"loadConfigurationByElement",
"(",
"$",
"configOptions",
",",
"$",
"configType",
")",
"{",
"$",
"validatorOptions",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"configOptions",
"[",
"$",
"configType",
"]",
"->",
"tag",... | Load the configuration for given element (deprecated/required)
@param array $configOptions The configuration from the plugin.xml file
@param string $configType Required/Deprecated for the time being
@return array | [
"Load",
"the",
"configuration",
"for",
"given",
"element",
"(",
"deprecated",
"/",
"required",
")"
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Parser/ServiceProvider.php#L139-L160 |
neat-php/database | classes/Connection.php | Connection.pdo | public function pdo(PDO $pdo = null)
{
if ($pdo) {
$this->pdo = $pdo;
}
return $this->pdo;
} | php | public function pdo(PDO $pdo = null)
{
if ($pdo) {
$this->pdo = $pdo;
}
return $this->pdo;
} | [
"public",
"function",
"pdo",
"(",
"PDO",
"$",
"pdo",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"pdo",
")",
"{",
"$",
"this",
"->",
"pdo",
"=",
"$",
"pdo",
";",
"}",
"return",
"$",
"this",
"->",
"pdo",
";",
"}"
] | Get or set PDO instance
@param PDO $pdo (optional)
@return PDO | [
"Get",
"or",
"set",
"PDO",
"instance"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L64-L71 |
neat-php/database | classes/Connection.php | Connection.quote | public function quote($value)
{
if ($value === null) {
return 'NULL';
}
if ($value instanceof DateTimeInterface) {
return $this->pdo->quote($value->format('Y-m-d H:i:s'));
}
if (is_array($value)) {
return implode(',', array_map([$this, 'quo... | php | public function quote($value)
{
if ($value === null) {
return 'NULL';
}
if ($value instanceof DateTimeInterface) {
return $this->pdo->quote($value->format('Y-m-d H:i:s'));
}
if (is_array($value)) {
return implode(',', array_map([$this, 'quo... | [
"public",
"function",
"quote",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"'NULL'",
";",
"}",
"if",
"(",
"$",
"value",
"instanceof",
"DateTimeInterface",
")",
"{",
"return",
"$",
"this",
"->",
"pdo",
"->"... | Quote a value (protecting against SQL injection)
@param string|null|DateTimeInterface|array|bool $value
@return string | [
"Quote",
"a",
"value",
"(",
"protecting",
"against",
"SQL",
"injection",
")"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L79-L95 |
neat-php/database | classes/Connection.php | Connection.quoteIdentifier | public function quoteIdentifier($identifier)
{
$parts = explode(".", $identifier);
if (count($parts) > 1) {
return $this->quoteIdentifier($parts[0]) . '.' . $this->quoteIdentifier($parts[1]);
}
return '`' . str_replace('`', '``', $identifier) . '`';
} | php | public function quoteIdentifier($identifier)
{
$parts = explode(".", $identifier);
if (count($parts) > 1) {
return $this->quoteIdentifier($parts[0]) . '.' . $this->quoteIdentifier($parts[1]);
}
return '`' . str_replace('`', '``', $identifier) . '`';
} | [
"public",
"function",
"quoteIdentifier",
"(",
"$",
"identifier",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"\".\"",
",",
"$",
"identifier",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
">",
"1",
")",
"{",
"return",
"$",
"this",
"->",
"q... | Quote an identifier for MySQL query usage
@param string $identifier
@return string | [
"Quote",
"an",
"identifier",
"for",
"MySQL",
"query",
"usage"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L103-L111 |
neat-php/database | classes/Connection.php | Connection.merge | public function merge($query, array $data)
{
$expression = "/(\\?)(?=(?:[^']|'[^']*')*$)/";
$callback = function () use (&$data) {
if (!$data) {
return '?';
}
return $this->quote(array_shift($data));
};
return preg_replace_callb... | php | public function merge($query, array $data)
{
$expression = "/(\\?)(?=(?:[^']|'[^']*')*$)/";
$callback = function () use (&$data) {
if (!$data) {
return '?';
}
return $this->quote(array_shift($data));
};
return preg_replace_callb... | [
"public",
"function",
"merge",
"(",
"$",
"query",
",",
"array",
"$",
"data",
")",
"{",
"$",
"expression",
"=",
"\"/(\\\\?)(?=(?:[^']|'[^']*')*$)/\"",
";",
"$",
"callback",
"=",
"function",
"(",
")",
"use",
"(",
"&",
"$",
"data",
")",
"{",
"if",
"(",
"!... | Merge data into an SQL query with placeholders
@param string $query
@param array $data
@return string | [
"Merge",
"data",
"into",
"an",
"SQL",
"query",
"with",
"placeholders"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L120-L132 |
neat-php/database | classes/Connection.php | Connection.query | public function query($query, ...$data)
{
if ($data) {
$query = $this->merge($query, $data);
}
try {
$statement = $this->pdo->query($query);
return new Result($statement);
} catch (PDOException $exception) {
throw new QueryException($... | php | public function query($query, ...$data)
{
if ($data) {
$query = $this->merge($query, $data);
}
try {
$statement = $this->pdo->query($query);
return new Result($statement);
} catch (PDOException $exception) {
throw new QueryException($... | [
"public",
"function",
"query",
"(",
"$",
"query",
",",
"...",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"merge",
"(",
"$",
"query",
",",
"$",
"data",
")",
";",
"}",
"try",
"{",
"$",
"statem... | Run a query and return the result
The result can be interactively fetched, but only once due to the
forward-only cursor being used to fetch the results.
@param string $query
@param mixed ...$data
@return Result
@throws QueryException | [
"Run",
"a",
"query",
"and",
"return",
"the",
"result"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L145-L158 |
neat-php/database | classes/Connection.php | Connection.fetch | public function fetch($query, ...$data)
{
if ($data) {
$query = $this->merge($query, $data);
}
try {
$statement = $this->pdo->query($query);
return new FetchedResult($statement->fetchAll(PDO::FETCH_ASSOC));
} catch (PDOException $exception) {
... | php | public function fetch($query, ...$data)
{
if ($data) {
$query = $this->merge($query, $data);
}
try {
$statement = $this->pdo->query($query);
return new FetchedResult($statement->fetchAll(PDO::FETCH_ASSOC));
} catch (PDOException $exception) {
... | [
"public",
"function",
"fetch",
"(",
"$",
"query",
",",
"...",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"merge",
"(",
"$",
"query",
",",
"$",
"data",
")",
";",
"}",
"try",
"{",
"$",
"statem... | Run a query and eagerly fetch the result into memory
Allows the result to be used more than once, for example when you
want to count the result and then iterate over it. Normally the
result would be entirely consumed after counting its rows.
@param string $query
@param mixed ...$data
@return FetchedResult
@throws Qu... | [
"Run",
"a",
"query",
"and",
"eagerly",
"fetch",
"the",
"result",
"into",
"memory"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L172-L185 |
neat-php/database | classes/Connection.php | Connection.execute | public function execute($query, ...$data)
{
if ($data) {
$query = $this->merge($query, $data);
}
try {
return $this->pdo->exec($query);
} catch (PDOException $exception) {
throw new QueryException($exception, $query);
}
} | php | public function execute($query, ...$data)
{
if ($data) {
$query = $this->merge($query, $data);
}
try {
return $this->pdo->exec($query);
} catch (PDOException $exception) {
throw new QueryException($exception, $query);
}
} | [
"public",
"function",
"execute",
"(",
"$",
"query",
",",
"...",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"data",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"merge",
"(",
"$",
"query",
",",
"$",
"data",
")",
";",
"}",
"try",
"{",
"return",
... | Execute a query and return the number of rows affected
@param string $query
@param mixed ...$data
@return int
@throws QueryException | [
"Execute",
"a",
"query",
"and",
"return",
"the",
"number",
"of",
"rows",
"affected"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L195-L206 |
neat-php/database | classes/Connection.php | Connection.insert | public function insert($table, array $data = null)
{
$insert = $this->build()->insert($table);
if ($data) {
return $insert->values($data)->execute();
}
return $insert;
} | php | public function insert($table, array $data = null)
{
$insert = $this->build()->insert($table);
if ($data) {
return $insert->values($data)->execute();
}
return $insert;
} | [
"public",
"function",
"insert",
"(",
"$",
"table",
",",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"insert",
"=",
"$",
"this",
"->",
"build",
"(",
")",
"->",
"insert",
"(",
"$",
"table",
")",
";",
"if",
"(",
"$",
"data",
")",
"{",
"retur... | Insert data into a table
When all parameters are specified, the insert query is immediately
executed and the number of rows affected will be returned. Otherwise
the query builder is returned so you can extend the query further.
@param string $table
@param array $data (optional)
@return Query|int
@throws QueryExcepti... | [
"Insert",
"data",
"into",
"a",
"table"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L251-L259 |
neat-php/database | classes/Connection.php | Connection.update | public function update($table, array $data = null, $where = null)
{
$update = $this->build()->update($table);
if ($data) {
$update->set($data);
}
if ($where) {
$update->where($where);
}
if ($data && $where) {
return $update->execute... | php | public function update($table, array $data = null, $where = null)
{
$update = $this->build()->update($table);
if ($data) {
$update->set($data);
}
if ($where) {
$update->where($where);
}
if ($data && $where) {
return $update->execute... | [
"public",
"function",
"update",
"(",
"$",
"table",
",",
"array",
"$",
"data",
"=",
"null",
",",
"$",
"where",
"=",
"null",
")",
"{",
"$",
"update",
"=",
"$",
"this",
"->",
"build",
"(",
")",
"->",
"update",
"(",
"$",
"table",
")",
";",
"if",
"(... | Update data in a table
When all parameters are specified, the update query is immediately
executed and the number of rows affected will be returned. Otherwise
the query builder is returned so you can extend the query further.
@param string $table
@param array $data (optional)
@param array|string $where ... | [
"Update",
"data",
"in",
"a",
"table"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L274-L288 |
neat-php/database | classes/Connection.php | Connection.delete | public function delete($table, $where = null)
{
$delete = $this->build()->delete($table);
if ($where) {
return $delete->where($where)->execute();
}
return $delete;
} | php | public function delete($table, $where = null)
{
$delete = $this->build()->delete($table);
if ($where) {
return $delete->where($where)->execute();
}
return $delete;
} | [
"public",
"function",
"delete",
"(",
"$",
"table",
",",
"$",
"where",
"=",
"null",
")",
"{",
"$",
"delete",
"=",
"$",
"this",
"->",
"build",
"(",
")",
"->",
"delete",
"(",
"$",
"table",
")",
";",
"if",
"(",
"$",
"where",
")",
"{",
"return",
"$"... | Delete from a table
When all parameters are specified, the delete query is immediately
executed and the number of rows affected will be returned. Otherwise
the query builder is returned so you can extend the query further.
@param string $table
@param array|string $where (optional)
@return Query|int
@throws Quer... | [
"Delete",
"from",
"a",
"table"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L302-L310 |
neat-php/database | classes/Connection.php | Connection.start | public function start()
{
if ($this->started) {
throw new \RuntimeException('Cannot start nested transaction');
}
if (!$this->pdo->beginTransaction()) {
throw new \RuntimeException('Failed to start transaction');
}
$this->started = true;
} | php | public function start()
{
if ($this->started) {
throw new \RuntimeException('Cannot start nested transaction');
}
if (!$this->pdo->beginTransaction()) {
throw new \RuntimeException('Failed to start transaction');
}
$this->started = true;
} | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"started",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Cannot start nested transaction'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"pdo",
"->",
"beginTran... | Start transaction | [
"Start",
"transaction"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L315-L325 |
neat-php/database | classes/Connection.php | Connection.commit | public function commit()
{
if (!$this->started) {
throw new \RuntimeException('Cannot commit transaction before start');
}
if (!$this->pdo->commit()) {
throw new \RuntimeException('Failed to commit transaction');
}
$this->started = false;
} | php | public function commit()
{
if (!$this->started) {
throw new \RuntimeException('Cannot commit transaction before start');
}
if (!$this->pdo->commit()) {
throw new \RuntimeException('Failed to commit transaction');
}
$this->started = false;
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"started",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Cannot commit transaction before start'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"pdo",
"->... | Commit transaction | [
"Commit",
"transaction"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L330-L340 |
neat-php/database | classes/Connection.php | Connection.rollback | public function rollback()
{
if (!$this->started) {
throw new \RuntimeException('Cannot rollback transaction before start');
}
if (!$this->pdo->rollBack()) {
throw new \RuntimeException('Failed to rollback transaction');
}
$this->started = false;
... | php | public function rollback()
{
if (!$this->started) {
throw new \RuntimeException('Cannot rollback transaction before start');
}
if (!$this->pdo->rollBack()) {
throw new \RuntimeException('Failed to rollback transaction');
}
$this->started = false;
... | [
"public",
"function",
"rollback",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"started",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Cannot rollback transaction before start'",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"pdo",
... | Rollback transaction | [
"Rollback",
"transaction"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L345-L355 |
neat-php/database | classes/Connection.php | Connection.transaction | public function transaction(callable $closure)
{
$this->start();
try {
$result = $closure();
} catch (\Throwable $e) {
$this->rollback();
throw $e;
}
$this->commit();
return $result;
} | php | public function transaction(callable $closure)
{
$this->start();
try {
$result = $closure();
} catch (\Throwable $e) {
$this->rollback();
throw $e;
}
$this->commit();
return $result;
} | [
"public",
"function",
"transaction",
"(",
"callable",
"$",
"closure",
")",
"{",
"$",
"this",
"->",
"start",
"(",
")",
";",
"try",
"{",
"$",
"result",
"=",
"$",
"closure",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"$... | Run a closure inside a transaction
Begins a transaction before running the closure and commits the
transaction afterwards. When the closure emits an exception or
throwable error, the transaction will be rolled back.
@param callable $closure Closure without required parameters
@return mixed Closure return value
@throw... | [
"Run",
"a",
"closure",
"inside",
"a",
"transaction"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Connection.php#L368-L380 |
surebert/surebert-framework | src/sb/Encryption/ForTransmission.php | ForTransmission.encrypt | public function encrypt($string)
{
$td = mcrypt_module_open($this->cypher, '', $this->mode, '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), mcrypt_RAND);
mcrypt_generic_init($td, $this->key, $iv);
$encrypted = mcrypt_generic($td, $string);
mcrypt_generic_deinit($td);... | php | public function encrypt($string)
{
$td = mcrypt_module_open($this->cypher, '', $this->mode, '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), mcrypt_RAND);
mcrypt_generic_init($td, $this->key, $iv);
$encrypted = mcrypt_generic($td, $string);
mcrypt_generic_deinit($td);... | [
"public",
"function",
"encrypt",
"(",
"$",
"string",
")",
"{",
"$",
"td",
"=",
"mcrypt_module_open",
"(",
"$",
"this",
"->",
"cypher",
",",
"''",
",",
"$",
"this",
"->",
"mode",
",",
"''",
")",
";",
"$",
"iv",
"=",
"mcrypt_create_iv",
"(",
"mcrypt_en... | Encrypts a string
@param $string The string of data to encrypt | [
"Encrypts",
"a",
"string"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Encryption/ForTransmission.php#L43-L52 |
surebert/surebert-framework | src/sb/Encryption/ForTransmission.php | ForTransmission.decrypt | public function decrypt($string)
{
$decrypted = "";
$td = mcrypt_module_open($this->cypher, '', $this->mode, '');
$ivsize = mcrypt_enc_get_iv_size($td);
$iv = substr($string, 0, $ivsize);
$string = substr($string, $ivsize);
if ($iv) {
mcrypt_generic_init(... | php | public function decrypt($string)
{
$decrypted = "";
$td = mcrypt_module_open($this->cypher, '', $this->mode, '');
$ivsize = mcrypt_enc_get_iv_size($td);
$iv = substr($string, 0, $ivsize);
$string = substr($string, $ivsize);
if ($iv) {
mcrypt_generic_init(... | [
"public",
"function",
"decrypt",
"(",
"$",
"string",
")",
"{",
"$",
"decrypted",
"=",
"\"\"",
";",
"$",
"td",
"=",
"mcrypt_module_open",
"(",
"$",
"this",
"->",
"cypher",
",",
"''",
",",
"$",
"this",
"->",
"mode",
",",
"''",
")",
";",
"$",
"ivsize"... | Decrypts a string
@param $string The data to decrypt | [
"Decrypts",
"a",
"string"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Encryption/ForTransmission.php#L58-L72 |
alevilar/ristorantino-vendor | Printers/Utility/ReceiptPrint.php | ReceiptPrint.comanda | public static function comanda ( Comanda $Comanda )
{
$comanda_id = $Comanda->id;
$productos_x_comanda = array();
// se supone que en una comanda yo no voy a tener productos que se impriman en comanderas distitas
// (esto es separado desde el mismo controlador y se manda aimprimir a comandas difere... | php | public static function comanda ( Comanda $Comanda )
{
$comanda_id = $Comanda->id;
$productos_x_comanda = array();
// se supone que en una comanda yo no voy a tener productos que se impriman en comanderas distitas
// (esto es separado desde el mismo controlador y se manda aimprimir a comandas difere... | [
"public",
"static",
"function",
"comanda",
"(",
"Comanda",
"$",
"Comanda",
")",
"{",
"$",
"comanda_id",
"=",
"$",
"Comanda",
"->",
"id",
";",
"$",
"productos_x_comanda",
"=",
"array",
"(",
")",
";",
"// se supone que en una comanda yo no voy a tener productos que se... | Imprime una comanda en particular
@param id $comanda_id
@return null | [
"Imprime",
"una",
"comanda",
"en",
"particular"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Printers/Utility/ReceiptPrint.php#L21-L46 |
gregorybesson/PlaygroundCms | src/Entity/Dynablock.php | Dynablock.populate | public function populate($data = array())
{
$this->title = (isset($data['title'])) ? $data['title'] : null;
$this->dynarea = (isset($data['dynarea'])) ? $data['dynarea'] : null;
if (isset($data['is_active']) && $data['is_active'] != null) {
$this->is_active = $data['is_active'];
... | php | public function populate($data = array())
{
$this->title = (isset($data['title'])) ? $data['title'] : null;
$this->dynarea = (isset($data['dynarea'])) ? $data['dynarea'] : null;
if (isset($data['is_active']) && $data['is_active'] != null) {
$this->is_active = $data['is_active'];
... | [
"public",
"function",
"populate",
"(",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"title",
"=",
"(",
"isset",
"(",
"$",
"data",
"[",
"'title'",
"]",
")",
")",
"?",
"$",
"data",
"[",
"'title'",
"]",
":",
"null",
";",
"$",
... | Populate from an array.
@param array $data | [
"Populate",
"from",
"an",
"array",
"."
] | train | https://github.com/gregorybesson/PlaygroundCms/blob/e929a283f2a6e82d4f248c930f7aa454ce20cbc3/src/Entity/Dynablock.php#L264-L276 |
sinri/Ark-Core | src/ArkLogger.php | ArkLogger.generateLog | protected function generateLog($level, $message, $object = '', $enforceEndOfLine = true)
{
$now = date('Y-m-d H:i:s');
$level_string = "[{$level}]";
$log = "{$now} {$level_string} ";
if ($this->showProcessID) {
$log .= "PID: " . getmypid() . " ";
}
$log .... | php | protected function generateLog($level, $message, $object = '', $enforceEndOfLine = true)
{
$now = date('Y-m-d H:i:s');
$level_string = "[{$level}]";
$log = "{$now} {$level_string} ";
if ($this->showProcessID) {
$log .= "PID: " . getmypid() . " ";
}
$log .... | [
"protected",
"function",
"generateLog",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"object",
"=",
"''",
",",
"$",
"enforceEndOfLine",
"=",
"true",
")",
"{",
"$",
"now",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"level_string",
"=",
"\"[{... | Return the string format log content
@param $level
@param $message
@param string|array $object
@param bool $enforceEndOfLine @since 2.1
@return string | [
"Return",
"the",
"string",
"format",
"log",
"content"
] | train | https://github.com/sinri/Ark-Core/blob/fb5715e72b500ddc08dd52d9701d713fe49f48c6/src/ArkLogger.php#L156-L170 |
sinri/Ark-Core | src/ArkLogger.php | ArkLogger.decideTargetFile | protected function decideTargetFile()
{
if (empty($this->targetLogDir)) {
return false;
}
if (!file_exists($this->targetLogDir)) {
@mkdir($this->targetLogDir, 0777, true);
}
return $this->getCurrentLogFilePath();
} | php | protected function decideTargetFile()
{
if (empty($this->targetLogDir)) {
return false;
}
if (!file_exists($this->targetLogDir)) {
@mkdir($this->targetLogDir, 0777, true);
}
return $this->getCurrentLogFilePath();
} | [
"protected",
"function",
"decideTargetFile",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"targetLogDir",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"targetLogDir",
")",
")",
"{",
... | Return the target file path which log would be written into.
If target log directory not set, return false.
@return bool|string | [
"Return",
"the",
"target",
"file",
"path",
"which",
"log",
"would",
"be",
"written",
"into",
".",
"If",
"target",
"log",
"directory",
"not",
"set",
"return",
"false",
"."
] | train | https://github.com/sinri/Ark-Core/blob/fb5715e72b500ddc08dd52d9701d713fe49f48c6/src/ArkLogger.php#L177-L187 |
sinri/Ark-Core | src/ArkLogger.php | ArkLogger.getCurrentLogFilePath | public function getCurrentLogFilePath()
{
$rotateTimeMark = "";
if ($this->rotateTimeFormat !== null) {
$rotateTimeMark .= "-" . date($this->rotateTimeFormat);
}
if (is_callable($this->prefix)) {
$prefix = call_user_func_array($this->prefix, []);
... | php | public function getCurrentLogFilePath()
{
$rotateTimeMark = "";
if ($this->rotateTimeFormat !== null) {
$rotateTimeMark .= "-" . date($this->rotateTimeFormat);
}
if (is_callable($this->prefix)) {
$prefix = call_user_func_array($this->prefix, []);
... | [
"public",
"function",
"getCurrentLogFilePath",
"(",
")",
"{",
"$",
"rotateTimeMark",
"=",
"\"\"",
";",
"if",
"(",
"$",
"this",
"->",
"rotateTimeFormat",
"!==",
"null",
")",
"{",
"$",
"rotateTimeMark",
".=",
"\"-\"",
".",
"date",
"(",
"$",
"this",
"->",
"... | Sometime you may need to know where the log file is
@return string
@since 2.2 | [
"Sometime",
"you",
"may",
"need",
"to",
"know",
"where",
"the",
"log",
"file",
"is"
] | train | https://github.com/sinri/Ark-Core/blob/fb5715e72b500ddc08dd52d9701d713fe49f48c6/src/ArkLogger.php#L194-L208 |
sinri/Ark-Core | src/ArkLogger.php | ArkLogger.print | public function print($level, $message, array $context = array(), $enforceEndOfLine = true)
{
if ($this->shouldIgnoreThisLog($level)) {
return;
}
$msg = $this->generateLog($level, $message, $context, $enforceEndOfLine);
echo $msg;
} | php | public function print($level, $message, array $context = array(), $enforceEndOfLine = true)
{
if ($this->shouldIgnoreThisLog($level)) {
return;
}
$msg = $this->generateLog($level, $message, $context, $enforceEndOfLine);
echo $msg;
} | [
"public",
"function",
"print",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
",",
"$",
"enforceEndOfLine",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldIgnoreThisLog",
"(",
"$",
"level",
... | If you want to output log directly to STDOUT, use this.
@since 2.0 renamed from echo to print
@param $level
@param $message
@param array $context
@param bool $enforceEndOfLine @since 2.1 | [
"If",
"you",
"want",
"to",
"output",
"log",
"directly",
"to",
"STDOUT",
"use",
"this",
"."
] | train | https://github.com/sinri/Ark-Core/blob/fb5715e72b500ddc08dd52d9701d713fe49f48c6/src/ArkLogger.php#L234-L241 |
beberlei/WhitewashingLogglyBundle | Monolog/Handler/LogglyHandler.php | LogglyHandler.send | protected function send($message, array $records)
{
$fp = fsockopen($this->getTransport(), $this->port, $errno, $errstr, 30);
if (!$fp) {
return false;
}
$request = "POST /inputs/".$this->key." HTTP/1.1\r\n";
$request.= "Host: ".$this->host."\r\n";
$reque... | php | protected function send($message, array $records)
{
$fp = fsockopen($this->getTransport(), $this->port, $errno, $errstr, 30);
if (!$fp) {
return false;
}
$request = "POST /inputs/".$this->key." HTTP/1.1\r\n";
$request.= "Host: ".$this->host."\r\n";
$reque... | [
"protected",
"function",
"send",
"(",
"$",
"message",
",",
"array",
"$",
"records",
")",
"{",
"$",
"fp",
"=",
"fsockopen",
"(",
"$",
"this",
"->",
"getTransport",
"(",
")",
",",
"$",
"this",
"->",
"port",
",",
"$",
"errno",
",",
"$",
"errstr",
",",... | {@inheritDoc} | [
"{"
] | train | https://github.com/beberlei/WhitewashingLogglyBundle/blob/9e5992547cd9fec460421e6516c44dafa92c0b91/Monolog/Handler/LogglyHandler.php#L81-L100 |
songshenzong/log | src/DataCollector/MultiAuthCollector.php | MultiAuthCollector.resolveUser | private function resolveUser(Guard $guard)
{
// if we're logging in using remember token
// then we must resolve user „manually”
// to prevent csrf token regeneration
$usingSession = $guard instanceof SessionGuard;
$recaller = $usingSession ? $guard->getRequest()->cookie... | php | private function resolveUser(Guard $guard)
{
// if we're logging in using remember token
// then we must resolve user „manually”
// to prevent csrf token regeneration
$usingSession = $guard instanceof SessionGuard;
$recaller = $usingSession ? $guard->getRequest()->cookie... | [
"private",
"function",
"resolveUser",
"(",
"Guard",
"$",
"guard",
")",
"{",
"// if we're logging in using remember token",
"// then we must resolve user „manually”",
"// to prevent csrf token regeneration",
"$",
"usingSession",
"=",
"$",
"guard",
"instanceof",
"SessionGuard",
"... | @param Guard $guard
@return mixed | [
"@param",
"Guard",
"$guard"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/DataCollector/MultiAuthCollector.php#L61-L76 |
nabab/bbn | src/bbn/appui/history.php | history._get_db | private static function _get_db(): ?bbn\db
{
if ( self::$db && self::$db->check() ){
return self::$db;
}
return null;
} | php | private static function _get_db(): ?bbn\db
{
if ( self::$db && self::$db->check() ){
return self::$db;
}
return null;
} | [
"private",
"static",
"function",
"_get_db",
"(",
")",
":",
"?",
"bbn",
"\\",
"db",
"{",
"if",
"(",
"self",
"::",
"$",
"db",
"&&",
"self",
"::",
"$",
"db",
"->",
"check",
"(",
")",
")",
"{",
"return",
"self",
"::",
"$",
"db",
";",
"}",
"return",... | Returns the database connection object.
@return bbn\db | [
"Returns",
"the",
"database",
"connection",
"object",
"."
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L49-L55 |
nabab/bbn | src/bbn/appui/history.php | history._get_databases | private static function _get_databases(): ?databases
{
if ( self::check() ){
if ( !self::$databases_obj && ($db = self::_get_db()) ){
self::$databases_obj = new databases($db);
}
return self::$databases_obj;
}
return null;
} | php | private static function _get_databases(): ?databases
{
if ( self::check() ){
if ( !self::$databases_obj && ($db = self::_get_db()) ){
self::$databases_obj = new databases($db);
}
return self::$databases_obj;
}
return null;
} | [
"private",
"static",
"function",
"_get_databases",
"(",
")",
":",
"?",
"databases",
"{",
"if",
"(",
"self",
"::",
"check",
"(",
")",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"databases_obj",
"&&",
"(",
"$",
"db",
"=",
"self",
"::",
"_get_db",
"... | Returns an instance of the appui\database class.
@return databases | [
"Returns",
"an",
"instance",
"of",
"the",
"appui",
"\\",
"database",
"class",
"."
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L62-L71 |
nabab/bbn | src/bbn/appui/history.php | history._insert | private static function _insert(array $cfg): int
{
if (
isset($cfg['column'], $cfg['line'], $cfg['chrono']) &&
self::check() &&
($db = self::_get_db())
){
// Recording the last ID
$id = $db->last_id();
$last = self::$db->last();
$last_params = self::$db->last_params;
... | php | private static function _insert(array $cfg): int
{
if (
isset($cfg['column'], $cfg['line'], $cfg['chrono']) &&
self::check() &&
($db = self::_get_db())
){
// Recording the last ID
$id = $db->last_id();
$last = self::$db->last();
$last_params = self::$db->last_params;
... | [
"private",
"static",
"function",
"_insert",
"(",
"array",
"$",
"cfg",
")",
":",
"int",
"{",
"if",
"(",
"isset",
"(",
"$",
"cfg",
"[",
"'column'",
"]",
",",
"$",
"cfg",
"[",
"'line'",
"]",
",",
"$",
"cfg",
"[",
"'chrono'",
"]",
")",
"&&",
"self",
... | Adds a row in the history table
@param array $cfg
@return int | [
"Adds",
"a",
"row",
"in",
"the",
"history",
"table"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L79-L125 |
nabab/bbn | src/bbn/appui/history.php | history._get_table_where | private static function _get_table_where(string $table): ?string
{
if (
bbn\str::check_name($table) &&
($db = self::_get_db()) &&
($databases_obj = self::_get_databases()) &&
($model = $databases_obj->modelize($table))
){
$col = $db->escape('col');
$where_ar = [];
for... | php | private static function _get_table_where(string $table): ?string
{
if (
bbn\str::check_name($table) &&
($db = self::_get_db()) &&
($databases_obj = self::_get_databases()) &&
($model = $databases_obj->modelize($table))
){
$col = $db->escape('col');
$where_ar = [];
for... | [
"private",
"static",
"function",
"_get_table_where",
"(",
"string",
"$",
"table",
")",
":",
"?",
"string",
"{",
"if",
"(",
"bbn",
"\\",
"str",
"::",
"check_name",
"(",
"$",
"table",
")",
"&&",
"(",
"$",
"db",
"=",
"self",
"::",
"_get_db",
"(",
")",
... | Get a string for the WHERE in the query with all the columns selection
@param string $table
@return string|null | [
"Get",
"a",
"string",
"for",
"the",
"WHERE",
"in",
"the",
"query",
"with",
"all",
"the",
"columns",
"selection"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L132-L152 |
nabab/bbn | src/bbn/appui/history.php | history.get_id_column | public static function get_id_column(string $column, string $table): ?string
{
if (
($db = self::_get_db()) &&
($full_table = $db->tfn($table)) &&
($databases_obj = self::_get_databases())
){
[$database, $table] = explode('.', $full_table);
return $databases_obj->column_id($colum... | php | public static function get_id_column(string $column, string $table): ?string
{
if (
($db = self::_get_db()) &&
($full_table = $db->tfn($table)) &&
($databases_obj = self::_get_databases())
){
[$database, $table] = explode('.', $full_table);
return $databases_obj->column_id($colum... | [
"public",
"static",
"function",
"get_id_column",
"(",
"string",
"$",
"column",
",",
"string",
"$",
"table",
")",
":",
"?",
"string",
"{",
"if",
"(",
"(",
"$",
"db",
"=",
"self",
"::",
"_get_db",
"(",
")",
")",
"&&",
"(",
"$",
"full_table",
"=",
"$"... | Returns the column's corresponding option's ID
@param $column string
@param $table string
@return null|string | [
"Returns",
"the",
"column",
"s",
"corresponding",
"option",
"s",
"ID"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L160-L171 |
nabab/bbn | src/bbn/appui/history.php | history.init | public static function init(bbn\db $db, array $cfg = []): void
{
/** @var string $hash Unique hash for this DB connection (so we don't init twice a same connection) */
$hash = $db->get_hash();
if ( !\in_array($hash, self::$dbs, true) && $db->check() ){
// Adding the connection to the list of connect... | php | public static function init(bbn\db $db, array $cfg = []): void
{
/** @var string $hash Unique hash for this DB connection (so we don't init twice a same connection) */
$hash = $db->get_hash();
if ( !\in_array($hash, self::$dbs, true) && $db->check() ){
// Adding the connection to the list of connect... | [
"public",
"static",
"function",
"init",
"(",
"bbn",
"\\",
"db",
"$",
"db",
",",
"array",
"$",
"cfg",
"=",
"[",
"]",
")",
":",
"void",
"{",
"/** @var string $hash Unique hash for this DB connection (so we don't init twice a same connection) */",
"$",
"hash",
"=",
"$"... | Initializes
@param bbn\db $db
@param array $cfg
@return void | [
"Initializes"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L179-L204 |
nabab/bbn | src/bbn/appui/history.php | history.check | public static function check(): bool
{
return
isset(self::$user, self::$table, self::$db) &&
self::is_init() &&
self::_get_db();
} | php | public static function check(): bool
{
return
isset(self::$user, self::$table, self::$db) &&
self::is_init() &&
self::_get_db();
} | [
"public",
"static",
"function",
"check",
"(",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"user",
",",
"self",
"::",
"$",
"table",
",",
"self",
"::",
"$",
"db",
")",
"&&",
"self",
"::",
"is_init",
"(",
")",
"&&",
"self",
"::... | Checks if all history parameters are set in order to read and write into history
@return bool | [
"Checks",
"if",
"all",
"history",
"parameters",
"are",
"set",
"in",
"order",
"to",
"read",
"and",
"write",
"into",
"history"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L257-L263 |
nabab/bbn | src/bbn/appui/history.php | history.has_history | public static function has_history(bbn\db $db): bool
{
$hash = $db->get_hash();
return \in_array($hash, self::$dbs, true);
} | php | public static function has_history(bbn\db $db): bool
{
$hash = $db->get_hash();
return \in_array($hash, self::$dbs, true);
} | [
"public",
"static",
"function",
"has_history",
"(",
"bbn",
"\\",
"db",
"$",
"db",
")",
":",
"bool",
"{",
"$",
"hash",
"=",
"$",
"db",
"->",
"get_hash",
"(",
")",
";",
"return",
"\\",
"in_array",
"(",
"$",
"hash",
",",
"self",
"::",
"$",
"dbs",
",... | Returns true if the given DB connection is configured for history
@param bbn\db $db
@return bool | [
"Returns",
"true",
"if",
"the",
"given",
"DB",
"connection",
"is",
"configured",
"for",
"history"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L271-L275 |
nabab/bbn | src/bbn/appui/history.php | history.delete | public static function delete(string $id): bool
{
if ( $id && ($db = self::_get_db()) ){
return $db->delete(self::$table_uids, ['bbn_uid' => $id]);
}
return false;
} | php | public static function delete(string $id): bool
{
if ( $id && ($db = self::_get_db()) ){
return $db->delete(self::$table_uids, ['bbn_uid' => $id]);
}
return false;
} | [
"public",
"static",
"function",
"delete",
"(",
"string",
"$",
"id",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"id",
"&&",
"(",
"$",
"db",
"=",
"self",
"::",
"_get_db",
"(",
")",
")",
")",
"{",
"return",
"$",
"db",
"->",
"delete",
"(",
"self",
"::"... | Effectively deletes a row (deletes the row, the history row and the ID row)
@param string $id
@return bool | [
"Effectively",
"deletes",
"a",
"row",
"(",
"deletes",
"the",
"row",
"the",
"history",
"row",
"and",
"the",
"ID",
"row",
")"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L283-L289 |
nabab/bbn | src/bbn/appui/history.php | history.set_column | public static function set_column(string $column): void
{
if ( bbn\str::check_name($column) ){
self::$column = $column;
}
} | php | public static function set_column(string $column): void
{
if ( bbn\str::check_name($column) ){
self::$column = $column;
}
} | [
"public",
"static",
"function",
"set_column",
"(",
"string",
"$",
"column",
")",
":",
"void",
"{",
"if",
"(",
"bbn",
"\\",
"str",
"::",
"check_name",
"(",
"$",
"column",
")",
")",
"{",
"self",
"::",
"$",
"column",
"=",
"$",
"column",
";",
"}",
"}"
... | Sets the "active" column name
@param string $column
@return void | [
"Sets",
"the",
"active",
"column",
"name"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L297-L302 |
nabab/bbn | src/bbn/appui/history.php | history.set_admin_db | public static function set_admin_db(string $db_name): void
{
// Sets the history table name
if ( bbn\str::check_name($db_name) ){
self::$admin_db = $db_name;
self::$table = self::$admin_db.'.'.self::$prefix.'history';
}
} | php | public static function set_admin_db(string $db_name): void
{
// Sets the history table name
if ( bbn\str::check_name($db_name) ){
self::$admin_db = $db_name;
self::$table = self::$admin_db.'.'.self::$prefix.'history';
}
} | [
"public",
"static",
"function",
"set_admin_db",
"(",
"string",
"$",
"db_name",
")",
":",
"void",
"{",
"// Sets the history table name",
"if",
"(",
"bbn",
"\\",
"str",
"::",
"check_name",
"(",
"$",
"db_name",
")",
")",
"{",
"self",
"::",
"$",
"admin_db",
"=... | Sets the history table name
@param string $db_name
@return void | [
"Sets",
"the",
"history",
"table",
"name"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L353-L360 |
nabab/bbn | src/bbn/appui/history.php | history.set_user | public static function set_user($user): void
{
// Sets the history table name
if ( bbn\str::is_uid($user) ){
self::$user = $user;
}
} | php | public static function set_user($user): void
{
// Sets the history table name
if ( bbn\str::is_uid($user) ){
self::$user = $user;
}
} | [
"public",
"static",
"function",
"set_user",
"(",
"$",
"user",
")",
":",
"void",
"{",
"// Sets the history table name",
"if",
"(",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"user",
")",
")",
"{",
"self",
"::",
"$",
"user",
"=",
"$",
"user",
";",
"... | Sets the user ID that will be used to fill the user_id field
@param $user
@return void | [
"Sets",
"the",
"user",
"ID",
"that",
"will",
"be",
"used",
"to",
"fill",
"the",
"user_id",
"field"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L367-L373 |
nabab/bbn | src/bbn/appui/history.php | history.get_table_cfg | public static function get_table_cfg(string $table, bool $force = false): ?array
{
// Check history is enabled and table's name correct
if (
($db = self::_get_db()) &&
($dbc = self::_get_databases()) &&
($table = $db->tfn($table))
){
if ( $force || !isset(self::$structures[$table])... | php | public static function get_table_cfg(string $table, bool $force = false): ?array
{
// Check history is enabled and table's name correct
if (
($db = self::_get_db()) &&
($dbc = self::_get_databases()) &&
($table = $db->tfn($table))
){
if ( $force || !isset(self::$structures[$table])... | [
"public",
"static",
"function",
"get_table_cfg",
"(",
"string",
"$",
"table",
",",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"?",
"array",
"{",
"// Check history is enabled and table's name correct",
"if",
"(",
"(",
"$",
"db",
"=",
"self",
"::",
"_get_db",... | Gets all information about a given table
@param string $table
@param bool $force
@return null|array Table's full name | [
"Gets",
"all",
"information",
"about",
"a",
"given",
"table"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L888-L932 |
nabab/bbn | src/bbn/appui/history.php | history.trigger | public static function trigger(array $cfg): array
{
if ( !self::is_enabled() || !($db = self::_get_db()) ){
return $cfg;
}
$tables = $cfg['tables'] ?? (array)$cfg['table'];
// Will return false if disabled, the table doesn't exist, or doesn't have history
if (
($cfg['kind'] === 'SELECT... | php | public static function trigger(array $cfg): array
{
if ( !self::is_enabled() || !($db = self::_get_db()) ){
return $cfg;
}
$tables = $cfg['tables'] ?? (array)$cfg['table'];
// Will return false if disabled, the table doesn't exist, or doesn't have history
if (
($cfg['kind'] === 'SELECT... | [
"public",
"static",
"function",
"trigger",
"(",
"array",
"$",
"cfg",
")",
":",
"array",
"{",
"if",
"(",
"!",
"self",
"::",
"is_enabled",
"(",
")",
"||",
"!",
"(",
"$",
"db",
"=",
"self",
"::",
"_get_db",
"(",
")",
")",
")",
"{",
"return",
"$",
... | The function used by the db trigger
This will basically execute the history query if it's configured for.
@param array $cfg
@internal param string "table" The table for which the history is called
@internal param string "kind" The type of action: select|update|insert|delete
@internal param string "moment" The moment a... | [
"The",
"function",
"used",
"by",
"the",
"db",
"trigger",
"This",
"will",
"basically",
"execute",
"the",
"history",
"query",
"if",
"it",
"s",
"configured",
"for",
"."
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/history.php#L958-L1367 |
hametuha/wpametu | src/WPametu/File/Mime.php | Mime.is_image | public function is_image($path){
if( !file_exists($path) || !($info = getimagesize($path)) ){
return false;
}
return (bool) preg_match("/^image\/(jpeg|png|gif)$/", $info['mime']);
} | php | public function is_image($path){
if( !file_exists($path) || !($info = getimagesize($path)) ){
return false;
}
return (bool) preg_match("/^image\/(jpeg|png|gif)$/", $info['mime']);
} | [
"public",
"function",
"is_image",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
"||",
"!",
"(",
"$",
"info",
"=",
"getimagesize",
"(",
"$",
"path",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"("... | Detect if specified file is image
@param string $path
@return bool | [
"Detect",
"if",
"specified",
"file",
"is",
"image"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Mime.php#L22-L27 |
hametuha/wpametu | src/WPametu/File/Mime.php | Mime.get_mime | public function get_mime($file){
$type = $this->get_content_type($file);
if( $type ){
$type = array_map('trim', explode(';', $type));
return $type[0];
}else{
return '';
}
} | php | public function get_mime($file){
$type = $this->get_content_type($file);
if( $type ){
$type = array_map('trim', explode(';', $type));
return $type[0];
}else{
return '';
}
} | [
"public",
"function",
"get_mime",
"(",
"$",
"file",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"get_content_type",
"(",
"$",
"file",
")",
";",
"if",
"(",
"$",
"type",
")",
"{",
"$",
"type",
"=",
"array_map",
"(",
"'trim'",
",",
"explode",
"(",
... | Return mime type
@param string $file
@return string | [
"Return",
"mime",
"type"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Mime.php#L35-L43 |
hametuha/wpametu | src/WPametu/File/Mime.php | Mime.get_content_type | public function get_content_type($path){
if( file_exists($path) ){
$info = finfo_open(FILEINFO_MIME);
$type = finfo_file($info, $path) ;
finfo_close($info);
return $type ?: '' ;
}else{
return '';
}
} | php | public function get_content_type($path){
if( file_exists($path) ){
$info = finfo_open(FILEINFO_MIME);
$type = finfo_file($info, $path) ;
finfo_close($info);
return $type ?: '' ;
}else{
return '';
}
} | [
"public",
"function",
"get_content_type",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"info",
"=",
"finfo_open",
"(",
"FILEINFO_MIME",
")",
";",
"$",
"type",
"=",
"finfo_file",
"(",
"$",
"info",
",",
"$... | Get content type
@param string $path
@return string | [
"Get",
"content",
"type"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Mime.php#L51-L60 |
hametuha/wpametu | src/WPametu/File/Mime.php | Mime.get_extension | public function get_extension($path){
$type = $this->get_mime($path);
$match = [];
$ext = '';
if( $type ){
foreach( wp_get_mime_types() as $extensions => $content_type ){
if( $content_type == $type ){
$ext = explode('|', $extensions)[0];
... | php | public function get_extension($path){
$type = $this->get_mime($path);
$match = [];
$ext = '';
if( $type ){
foreach( wp_get_mime_types() as $extensions => $content_type ){
if( $content_type == $type ){
$ext = explode('|', $extensions)[0];
... | [
"public",
"function",
"get_extension",
"(",
"$",
"path",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"get_mime",
"(",
"$",
"path",
")",
";",
"$",
"match",
"=",
"[",
"]",
";",
"$",
"ext",
"=",
"''",
";",
"if",
"(",
"$",
"type",
")",
"{",
"f... | Get extension
@param string $path
@return string | [
"Get",
"extension"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Mime.php#L68-L81 |
digipolisgent/robo-digipolis-package-drupal8 | src/PackageDrupal8.php | PackageDrupal8.prepareMirrorDir | protected function prepareMirrorDir()
{
$this->printTaskInfo(sprintf('Preparing directory %s.', $this->tmpDir));
// Only keep web, vendor and config folder.
$folders = new Finder();
$folders->in($this->tmpDir);
$folders->depth(0);
$folders->notPath('/^(' . implode('|'... | php | protected function prepareMirrorDir()
{
$this->printTaskInfo(sprintf('Preparing directory %s.', $this->tmpDir));
// Only keep web, vendor and config folder.
$folders = new Finder();
$folders->in($this->tmpDir);
$folders->depth(0);
$folders->notPath('/^(' . implode('|'... | [
"protected",
"function",
"prepareMirrorDir",
"(",
")",
"{",
"$",
"this",
"->",
"printTaskInfo",
"(",
"sprintf",
"(",
"'Preparing directory %s.'",
",",
"$",
"this",
"->",
"tmpDir",
")",
")",
";",
"// Only keep web, vendor and config folder.",
"$",
"folders",
"=",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/digipolisgent/robo-digipolis-package-drupal8/blob/dc03ae0f68d56a027291e9574ff7aa433c27690a/src/PackageDrupal8.php#L86-L117 |
andromeda-framework/doctrine | src/Doctrine/Console/Commands/MetadataMerger.php | MetadataMerger.merge | public function merge(array $metadata): array
{
$tables = [];
foreach ($metadata as $entity) {
$tables[$entity->getTableName()][] = $entity;
}
$merged = [];
foreach ($tables as $table => $metadata) {
if (count($metadata) === 1) {
$merged[] = array_shift($metadata);
continue;
}
$primary... | php | public function merge(array $metadata): array
{
$tables = [];
foreach ($metadata as $entity) {
$tables[$entity->getTableName()][] = $entity;
}
$merged = [];
foreach ($tables as $table => $metadata) {
if (count($metadata) === 1) {
$merged[] = array_shift($metadata);
continue;
}
$primary... | [
"public",
"function",
"merge",
"(",
"array",
"$",
"metadata",
")",
":",
"array",
"{",
"$",
"tables",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"metadata",
"as",
"$",
"entity",
")",
"{",
"$",
"tables",
"[",
"$",
"entity",
"->",
"getTableName",
"(",
"... | Merges metadata of multiple doctrine entities.
Input metadata can contain duplicit tables. If so, metadata for
the same table will be merged into one.
@param ClassMetadata[] $metadata
@return ClassMetadata[] | [
"Merges",
"metadata",
"of",
"multiple",
"doctrine",
"entities",
"."
] | train | https://github.com/andromeda-framework/doctrine/blob/46924d91c09e0b9fbe5764518cbad70e467ffad4/src/Doctrine/Console/Commands/MetadataMerger.php#L40-L66 |
mothership-ec/composer | src/Composer/Command/DiagnoseCommand.php | DiagnoseCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer(false);
if ($composer) {
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
$composer->getEventDispatcher()->dispatch($commandEvent-... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer(false);
if ($composer) {
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
$composer->getEventDispatcher()->dispatch($commandEvent-... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"composer",
"=",
"$",
"this",
"->",
"getComposer",
"(",
"false",
")",
";",
"if",
"(",
"$",
"composer",
")",
"{",
"$",
"commandE... | {@inheritdoc} | [
"{"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Command/DiagnoseCommand.php#L57-L135 |
comodojo/daemon | src/Comodojo/Daemon/Daemon.php | Daemon.init | public function init() {
$args = $this->console->arguments;
$args->parse();
if ( $args->defined('hardstart') ) {
$this->hardstart();
}
if ( $args->defined('daemon') ) {
$this->daemonize();
} else if ( $args->defined('foreground') ) {
... | php | public function init() {
$args = $this->console->arguments;
$args->parse();
if ( $args->defined('hardstart') ) {
$this->hardstart();
}
if ( $args->defined('daemon') ) {
$this->daemonize();
} else if ( $args->defined('foreground') ) {
... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"console",
"->",
"arguments",
";",
"$",
"args",
"->",
"parse",
"(",
")",
";",
"if",
"(",
"$",
"args",
"->",
"defined",
"(",
"'hardstart'",
")",
")",
"{",
"$",
"this... | Parse console arguments and init the daemon | [
"Parse",
"console",
"arguments",
"and",
"init",
"the",
"daemon"
] | train | https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Daemon.php#L133-L164 |
comodojo/daemon | src/Comodojo/Daemon/Daemon.php | Daemon.daemonize | public function daemonize() {
// fork script
$pid = $this->fork();
// detach from current terminal (if any)
$this->detach();
// update pid reference (we have a new daemon)
$this->pid = $pid;
// start process daemon
$this->start();
} | php | public function daemonize() {
// fork script
$pid = $this->fork();
// detach from current terminal (if any)
$this->detach();
// update pid reference (we have a new daemon)
$this->pid = $pid;
// start process daemon
$this->start();
} | [
"public",
"function",
"daemonize",
"(",
")",
"{",
"// fork script",
"$",
"pid",
"=",
"$",
"this",
"->",
"fork",
"(",
")",
";",
"// detach from current terminal (if any)",
"$",
"this",
"->",
"detach",
"(",
")",
";",
"// update pid reference (we have a new daemon)",
... | Start as a daemon, forking main process and detaching it from terminal | [
"Start",
"as",
"a",
"daemon",
"forking",
"main",
"process",
"and",
"detaching",
"it",
"from",
"terminal"
] | train | https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Daemon.php#L170-L184 |
comodojo/daemon | src/Comodojo/Daemon/Daemon.php | Daemon.start | public function start() {
// we're activating!
$this->is_active = true;
$this->setup();
foreach ( $this->workers as $name => $worker ) {
$this->workers->start($name);
}
$this->becomeSupervisor();
// start listening on socket
try {
... | php | public function start() {
// we're activating!
$this->is_active = true;
$this->setup();
foreach ( $this->workers as $name => $worker ) {
$this->workers->start($name);
}
$this->becomeSupervisor();
// start listening on socket
try {
... | [
"public",
"function",
"start",
"(",
")",
"{",
"// we're activating!",
"$",
"this",
"->",
"is_active",
"=",
"true",
";",
"$",
"this",
"->",
"setup",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"workers",
"as",
"$",
"name",
"=>",
"$",
"worker",
"... | Start the process, creating socket and spinning up workers (if any) | [
"Start",
"the",
"process",
"creating",
"socket",
"and",
"spinning",
"up",
"workers",
"(",
"if",
"any",
")"
] | train | https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Daemon.php#L190-L225 |
comodojo/daemon | src/Comodojo/Daemon/Daemon.php | Daemon.stop | public function stop() {
$this->logger->notice("Stopping daemon...");
$this->events->removeAllListeners('daemon.posix.'.SIGCHLD);
$this->socket->close();
$this->workers->stop();
$this->pidlock->release();
$this->is_active = false;
} | php | public function stop() {
$this->logger->notice("Stopping daemon...");
$this->events->removeAllListeners('daemon.posix.'.SIGCHLD);
$this->socket->close();
$this->workers->stop();
$this->pidlock->release();
$this->is_active = false;
} | [
"public",
"function",
"stop",
"(",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"notice",
"(",
"\"Stopping daemon...\"",
")",
";",
"$",
"this",
"->",
"events",
"->",
"removeAllListeners",
"(",
"'daemon.posix.'",
".",
"SIGCHLD",
")",
";",
"$",
"this",
"->",... | Stop the daemon, closing the socket and stopping all the workers (if any) | [
"Stop",
"the",
"daemon",
"closing",
"the",
"socket",
"and",
"stopping",
"all",
"the",
"workers",
"(",
"if",
"any",
")"
] | train | https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Daemon.php#L231-L245 |
comodojo/daemon | src/Comodojo/Daemon/Daemon.php | Daemon.declass | public function declass() {
// remove supervisor flag
$this->is_supervisor = false;
// Unsubscribe supervisor default events (if any)
$this->events->removeAllListeners('daemon.posix.'.SIGTERM);
$this->events->removeAllListeners('daemon.posix.'.SIGINT);
$this->events->re... | php | public function declass() {
// remove supervisor flag
$this->is_supervisor = false;
// Unsubscribe supervisor default events (if any)
$this->events->removeAllListeners('daemon.posix.'.SIGTERM);
$this->events->removeAllListeners('daemon.posix.'.SIGINT);
$this->events->re... | [
"public",
"function",
"declass",
"(",
")",
"{",
"// remove supervisor flag",
"$",
"this",
"->",
"is_supervisor",
"=",
"false",
";",
"// Unsubscribe supervisor default events (if any)",
"$",
"this",
"->",
"events",
"->",
"removeAllListeners",
"(",
"'daemon.posix.'",
".",... | Declass the daemon to a normal supervised process (daemon to worker transition) | [
"Declass",
"the",
"daemon",
"to",
"a",
"normal",
"supervised",
"process",
"(",
"daemon",
"to",
"worker",
"transition",
")"
] | train | https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Daemon.php#L286-L302 |
digipolisgent/robo-digipolis-general | src/DetermineProjectRoot.php | DetermineProjectRoot.run | public function run()
{
$finder = clone $this->finder;
$finder->in([$this->dir])->exclude($this->exclude)->depth('<=' . $this->depth)->files();
$rootCandidates = [];
foreach ($this->searchFiles as $searchFile) {
$fileFinder = clone $finder;
$fileFinder->name($... | php | public function run()
{
$finder = clone $this->finder;
$finder->in([$this->dir])->exclude($this->exclude)->depth('<=' . $this->depth)->files();
$rootCandidates = [];
foreach ($this->searchFiles as $searchFile) {
$fileFinder = clone $finder;
$fileFinder->name($... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"finder",
"=",
"clone",
"$",
"this",
"->",
"finder",
";",
"$",
"finder",
"->",
"in",
"(",
"[",
"$",
"this",
"->",
"dir",
"]",
")",
"->",
"exclude",
"(",
"$",
"this",
"->",
"exclude",
")",
"->",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/digipolisgent/robo-digipolis-general/blob/66f0806c9ed7bd4e5aaf3f57ae1363f6aaae7cd9/src/DetermineProjectRoot.php#L149-L175 |
dreamfactorysoftware/df-cache | src/Services/Redis.php | Redis.setStore | protected function setStore($config)
{
Session::replaceLookups($config, true);
$host = array_get($config, 'host');
$port = array_get($config, 'port', static::PORT);
$databaseIndex = array_get($config, 'database_index', 0);
$password = array_get($config, 'password');
$... | php | protected function setStore($config)
{
Session::replaceLookups($config, true);
$host = array_get($config, 'host');
$port = array_get($config, 'port', static::PORT);
$databaseIndex = array_get($config, 'database_index', 0);
$password = array_get($config, 'password');
$... | [
"protected",
"function",
"setStore",
"(",
"$",
"config",
")",
"{",
"Session",
"::",
"replaceLookups",
"(",
"$",
"config",
",",
"true",
")",
";",
"$",
"host",
"=",
"array_get",
"(",
"$",
"config",
",",
"'host'",
")",
";",
"$",
"port",
"=",
"array_get",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Services/Redis.php#L14-L40 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/reader.php | ezcDbSchemaPhpArrayReader.loadFromFile | public function loadFromFile( $file )
{
if ( !file_exists( $file ) )
{
throw new ezcBaseFileNotFoundException( $file, 'schema' );
}
$schema = include $file;
if ( !is_array( $schema ) || count( $schema ) != 2 )
{
throw new ezcDbSchemaInvalidSch... | php | public function loadFromFile( $file )
{
if ( !file_exists( $file ) )
{
throw new ezcBaseFileNotFoundException( $file, 'schema' );
}
$schema = include $file;
if ( !is_array( $schema ) || count( $schema ) != 2 )
{
throw new ezcDbSchemaInvalidSch... | [
"public",
"function",
"loadFromFile",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"ezcBaseFileNotFoundException",
"(",
"$",
"file",
",",
"'schema'",
")",
";",
"}",
"$",
"schema",
"=",
"inc... | Returns the database schema stored in the file $file
@throws ezcBaseFileNotFoundException if the file $file could not be
found.
@throws ezcDbSchemaInvalidSchemaException if the data in the $file is
corrupt or when the file could not be opened.
@param string $file
@return ezcDbSchema | [
"Returns",
"the",
"database",
"schema",
"stored",
"in",
"the",
"file",
"$file"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/reader.php#L54-L69 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/reader.php | ezcDbSchemaPhpArrayReader.loadDiffFromFile | public function loadDiffFromFile( $file )
{
if ( !file_exists( $file ) )
{
throw new ezcBaseFileNotFoundException( $file, 'differences schema' );
}
$schema = include $file;
if ( !is_object( $schema ) || get_class( $schema ) != 'ezcDbSchemaDiff' )
{
... | php | public function loadDiffFromFile( $file )
{
if ( !file_exists( $file ) )
{
throw new ezcBaseFileNotFoundException( $file, 'differences schema' );
}
$schema = include $file;
if ( !is_object( $schema ) || get_class( $schema ) != 'ezcDbSchemaDiff' )
{
... | [
"public",
"function",
"loadDiffFromFile",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"ezcBaseFileNotFoundException",
"(",
"$",
"file",
",",
"'differences schema'",
")",
";",
"}",
"$",
"schema... | Returns the database differences stored in the file $file
@throws ezcBaseFileNotFoundException if the file $file could not be
found.
@throws ezcDbSchemaInvalidSchemaException if the data in the $file is
corrupt or when the file could not be opened.
@param string $file
@return ezcDbSchemaDiff | [
"Returns",
"the",
"database",
"differences",
"stored",
"in",
"the",
"file",
"$file"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/DatabaseSchema/src/handlers/php_array/reader.php#L82-L96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.