repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
vanilla/garden-daemon | src/Daemon.php | Daemon.attachPayloadErrorHandler | protected function attachPayloadErrorHandler() {
$this->getPayloadInstance();
if (method_exists($this->instance, 'errorHandler')) {
$this->di->get(ErrorHandler::class)->addHandler([$this->instance, 'errorHandler']);
}
} | php | protected function attachPayloadErrorHandler() {
$this->getPayloadInstance();
if (method_exists($this->instance, 'errorHandler')) {
$this->di->get(ErrorHandler::class)->addHandler([$this->instance, 'errorHandler']);
}
} | [
"protected",
"function",
"attachPayloadErrorHandler",
"(",
")",
"{",
"$",
"this",
"->",
"getPayloadInstance",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"instance",
",",
"'errorHandler'",
")",
")",
"{",
"$",
"this",
"->",
"di",
"->"... | Attach payload error handler | [
"Attach",
"payload",
"error",
"handler"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L525-L530 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.launchWorker | protected function launchWorker(): bool {
$this->log(LogLevel::DEBUG, "[{pid}] launching fleet worker");
// Prepare current state prior to forking
$workerConfig = $this->payloadExec('getWorkerConfig');
if ($workerConfig === false) {
$this->log(LogLevel::DEBUG, "[{pid}] ... | php | protected function launchWorker(): bool {
$this->log(LogLevel::DEBUG, "[{pid}] launching fleet worker");
// Prepare current state prior to forking
$workerConfig = $this->payloadExec('getWorkerConfig');
if ($workerConfig === false) {
$this->log(LogLevel::DEBUG, "[{pid}] ... | [
"protected",
"function",
"launchWorker",
"(",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"DEBUG",
",",
"\"[{pid}] launching fleet worker\"",
")",
";",
"// Prepare current state prior to forking",
"$",
"workerConfig",
"=",
"$",
"this",
... | Launch a fleet worker
@return bool | [
"Launch",
"a",
"fleet",
"worker"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L682-L717 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.runPayloadApplication | protected function runPayloadApplication($workerConfig = null): int {
$this->getPayloadInstance();
try {
$runSuccess = $this->instance->run($workerConfig);
unset($this->instance);
} catch (Exception $ex) {
$exitMessage = $ex->getMessage();
$exitFi... | php | protected function runPayloadApplication($workerConfig = null): int {
$this->getPayloadInstance();
try {
$runSuccess = $this->instance->run($workerConfig);
unset($this->instance);
} catch (Exception $ex) {
$exitMessage = $ex->getMessage();
$exitFi... | [
"protected",
"function",
"runPayloadApplication",
"(",
"$",
"workerConfig",
"=",
"null",
")",
":",
"int",
"{",
"$",
"this",
"->",
"getPayloadInstance",
"(",
")",
";",
"try",
"{",
"$",
"runSuccess",
"=",
"$",
"this",
"->",
"instance",
"->",
"run",
"(",
"$... | Run application worker
@internal POST FORK, POST FLEET
@param mixed $workerConfig
@return int | [
"Run",
"application",
"worker"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L726-L766 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.sendSignal | public function sendSignal(int $signal) {
$runningPid = $this->lock->getRunningPID();
if (!$runningPid) {
return false;
}
// Send signal
return posix_kill($runningPid, $signal);
} | php | public function sendSignal(int $signal) {
$runningPid = $this->lock->getRunningPID();
if (!$runningPid) {
return false;
}
// Send signal
return posix_kill($runningPid, $signal);
} | [
"public",
"function",
"sendSignal",
"(",
"int",
"$",
"signal",
")",
"{",
"$",
"runningPid",
"=",
"$",
"this",
"->",
"lock",
"->",
"getRunningPID",
"(",
")",
";",
"if",
"(",
"!",
"$",
"runningPid",
")",
"{",
"return",
"false",
";",
"}",
"// Send signal"... | Send a signal to the running daemon
@param int $signal
@return bool | [
"Send",
"a",
"signal",
"to",
"the",
"running",
"daemon"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L897-L905 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.workerSignal | public function workerSignal(int $signal) {
$this->log(LogLevel::DEBUG, "[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler");
switch ($signal) {
// Daemon was asked to hang up
case SIGHUP:
$this->payloadExec('signal', [$signal... | php | public function workerSignal(int $signal) {
$this->log(LogLevel::DEBUG, "[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler");
switch ($signal) {
// Daemon was asked to hang up
case SIGHUP:
$this->payloadExec('signal', [$signal... | [
"public",
"function",
"workerSignal",
"(",
"int",
"$",
"signal",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"DEBUG",
",",
"\"[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler\"",
")",
";",
"switch",
"(",
"$",
"signal... | Worker signal handler
@param int $signal
@throws Exception | [
"Worker",
"signal",
"handler"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L978-L998 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.reapChild | protected function reapChild(int $pid, int $status = null) {
// One of ours?
if (array_key_exists($pid, $this->children)) {
$exited = pcntl_wexitstatus($status);
if ($this->exitMode == 'worst-case') {
if (abs($exited) > abs($this->exit)) {
$th... | php | protected function reapChild(int $pid, int $status = null) {
// One of ours?
if (array_key_exists($pid, $this->children)) {
$exited = pcntl_wexitstatus($status);
if ($this->exitMode == 'worst-case') {
if (abs($exited) > abs($this->exit)) {
$th... | [
"protected",
"function",
"reapChild",
"(",
"int",
"$",
"pid",
",",
"int",
"$",
"status",
"=",
"null",
")",
"{",
"// One of ours?",
"if",
"(",
"array_key_exists",
"(",
"$",
"pid",
",",
"$",
"this",
"->",
"children",
")",
")",
"{",
"$",
"exited",
"=",
... | Reap a fleet worker
@param int $pid
@param int $status | [
"Reap",
"a",
"fleet",
"worker"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1006-L1026 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.reapZombies | public function reapZombies() {
$reaped = 0;
// Clean up any exited children
do {
$status = null;
$pid = pcntl_wait($status, WNOHANG);
if ($pid > 0) {
$this->reapChild($pid, $status);
$reaped++;
}
} while ($p... | php | public function reapZombies() {
$reaped = 0;
// Clean up any exited children
do {
$status = null;
$pid = pcntl_wait($status, WNOHANG);
if ($pid > 0) {
$this->reapChild($pid, $status);
$reaped++;
}
} while ($p... | [
"public",
"function",
"reapZombies",
"(",
")",
"{",
"$",
"reaped",
"=",
"0",
";",
"// Clean up any exited children",
"do",
"{",
"$",
"status",
"=",
"null",
";",
"$",
"pid",
"=",
"pcntl_wait",
"(",
"$",
"status",
",",
"WNOHANG",
")",
";",
"if",
"(",
"$"... | Reap any available exited children
@return int | [
"Reap",
"any",
"available",
"exited",
"children"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1033-L1045 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.reapAllChildren | protected function reapAllChildren(): bool {
static $killing = false;
if (!$killing) {
$this->log(LogLevel::DEBUG, "[{pid}] Shutting down fleet operations...");
$killing = true;
foreach ($this->children as $childpid => $childtype) {
posix_kill($childpi... | php | protected function reapAllChildren(): bool {
static $killing = false;
if (!$killing) {
$this->log(LogLevel::DEBUG, "[{pid}] Shutting down fleet operations...");
$killing = true;
foreach ($this->children as $childpid => $childtype) {
posix_kill($childpi... | [
"protected",
"function",
"reapAllChildren",
"(",
")",
":",
"bool",
"{",
"static",
"$",
"killing",
"=",
"false",
";",
"if",
"(",
"!",
"$",
"killing",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"DEBUG",
",",
"\"[{pid}] Shutting down fleet ope... | Force-reap all children and return
@return bool | [
"Force",
"-",
"reap",
"all",
"children",
"and",
"return"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1052-L1078 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.time | public static function time(string $time = 'now', string $format = null): \DateTimeInterface {
$timezone = new \DateTimeZone('utc');
if (is_null($format)) {
$date = new \DateTime($time, $timezone);
} else {
$date = \DateTime::createFromFormat($format, $time, $timezone);
... | php | public static function time(string $time = 'now', string $format = null): \DateTimeInterface {
$timezone = new \DateTimeZone('utc');
if (is_null($format)) {
$date = new \DateTime($time, $timezone);
} else {
$date = \DateTime::createFromFormat($format, $time, $timezone);
... | [
"public",
"static",
"function",
"time",
"(",
"string",
"$",
"time",
"=",
"'now'",
",",
"string",
"$",
"format",
"=",
"null",
")",
":",
"\\",
"DateTimeInterface",
"{",
"$",
"timezone",
"=",
"new",
"\\",
"DateTimeZone",
"(",
"'utc'",
")",
";",
"if",
"(",... | Get the time
@param string $time
@param string $format
@return \DateTimeInterface | [
"Get",
"the",
"time"
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1087-L1097 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.levelPriority | public function levelPriority(string $level): int {
static $priorities = [
LogLevel::DEBUG => LOG_DEBUG,
LogLevel::INFO => LOG_INFO,
LogLevel::NOTICE => LOG_NOTICE,
LogLevel::WARNING => LOG_WARNING,
LogLevel::ERROR => LOG_ERR,
... | php | public function levelPriority(string $level): int {
static $priorities = [
LogLevel::DEBUG => LOG_DEBUG,
LogLevel::INFO => LOG_INFO,
LogLevel::NOTICE => LOG_NOTICE,
LogLevel::WARNING => LOG_WARNING,
LogLevel::ERROR => LOG_ERR,
... | [
"public",
"function",
"levelPriority",
"(",
"string",
"$",
"level",
")",
":",
"int",
"{",
"static",
"$",
"priorities",
"=",
"[",
"LogLevel",
"::",
"DEBUG",
"=>",
"LOG_DEBUG",
",",
"LogLevel",
"::",
"INFO",
"=>",
"LOG_INFO",
",",
"LogLevel",
"::",
"NOTICE",... | Get the numeric priority for a log level.
The priorities are set to the LOG_* constants from the {@link syslog()} function.
A lower number is more severe.
@param string|int $level The string log level or an actual priority.
@return int Returns the numeric log level or `8` if the level is invalid. | [
"Get",
"the",
"numeric",
"priority",
"for",
"a",
"log",
"level",
"."
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1155-L1172 | train |
vanilla/garden-daemon | src/Daemon.php | Daemon.interpolateContext | protected function interpolateContext(string $format, array $context = []): string {
$final = preg_replace_callback('/{([^\s][^}]+[^\s]?)}/', function ($matches) use ($context) {
$field = trim($matches[1], '{}');
if (array_key_exists($field, $context)) {
return $context[$... | php | protected function interpolateContext(string $format, array $context = []): string {
$final = preg_replace_callback('/{([^\s][^}]+[^\s]?)}/', function ($matches) use ($context) {
$field = trim($matches[1], '{}');
if (array_key_exists($field, $context)) {
return $context[$... | [
"protected",
"function",
"interpolateContext",
"(",
"string",
"$",
"format",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
":",
"string",
"{",
"$",
"final",
"=",
"preg_replace_callback",
"(",
"'/{([^\\s][^}]+[^\\s]?)}/'",
",",
"function",
"(",
"$",
"matche... | Interpolate contexts into messages containing bracket-wrapped format strings.
@param string $format
@param array $context optional. array of key-value pairs to replace into the format.
@return string | [
"Interpolate",
"contexts",
"into",
"messages",
"containing",
"bracket",
"-",
"wrapped",
"format",
"strings",
"."
] | 13a5cbbac08ab6473e4b11bf00179fe1e26235a6 | https://github.com/vanilla/garden-daemon/blob/13a5cbbac08ab6473e4b11bf00179fe1e26235a6/src/Daemon.php#L1181-L1191 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/C2M.php | C2M.setCategory | public function setCategory(ChildCategory $v = null)
{
if ($v === null) {
$this->setCategoryId(NULL);
} else {
$this->setCategoryId($v->getId());
}
$this->aCategory = $v;
// Add binding for other direction of this n:n relationship.
// If this... | php | public function setCategory(ChildCategory $v = null)
{
if ($v === null) {
$this->setCategoryId(NULL);
} else {
$this->setCategoryId($v->getId());
}
$this->aCategory = $v;
// Add binding for other direction of this n:n relationship.
// If this... | [
"public",
"function",
"setCategory",
"(",
"ChildCategory",
"$",
"v",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"v",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setCategoryId",
"(",
"NULL",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"setCategoryId",... | Declares an association between this object and a ChildCategory object.
@param ChildCategory $v
@return $this|\Attogram\SharedMedia\Orm\C2M The current object (for fluent API support)
@throws PropelException | [
"Declares",
"an",
"association",
"between",
"this",
"object",
"and",
"a",
"ChildCategory",
"object",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2M.php#L1080-L1098 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/C2M.php | C2M.getCategory | public function getCategory(ConnectionInterface $con = null)
{
if ($this->aCategory === null && ($this->category_id != 0)) {
$this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con);
/* The following can be used additionally to
guarantee the r... | php | public function getCategory(ConnectionInterface $con = null)
{
if ($this->aCategory === null && ($this->category_id != 0)) {
$this->aCategory = ChildCategoryQuery::create()->findPk($this->category_id, $con);
/* The following can be used additionally to
guarantee the r... | [
"public",
"function",
"getCategory",
"(",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aCategory",
"===",
"null",
"&&",
"(",
"$",
"this",
"->",
"category_id",
"!=",
"0",
")",
")",
"{",
"$",
"this",
"->",
"a... | Get the associated ChildCategory object
@param ConnectionInterface $con Optional Connection object.
@return ChildCategory The associated ChildCategory object.
@throws PropelException | [
"Get",
"the",
"associated",
"ChildCategory",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2M.php#L1108-L1122 | train |
CodeBlastr/queue | src/Model/Table/QueuesTable.php | QueuesTable.createJob | public function createJob($jobName, $data = null, $notBefore = null, $reference = null)
{
$data = [
'type' => $jobName,
'data' => $data,
'reference' => $reference,
];
if ($notBefore !== null) {
$data['notbefore'] = new Time($notBefore);
... | php | public function createJob($jobName, $data = null, $notBefore = null, $reference = null)
{
$data = [
'type' => $jobName,
'data' => $data,
'reference' => $reference,
];
if ($notBefore !== null) {
$data['notbefore'] = new Time($notBefore);
... | [
"public",
"function",
"createJob",
"(",
"$",
"jobName",
",",
"$",
"data",
"=",
"null",
",",
"$",
"notBefore",
"=",
"null",
",",
"$",
"reference",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"[",
"'type'",
"=>",
"$",
"jobName",
",",
"'data'",
"=>",
"$"... | Add a new Job to the Queue.
@param string $jobName QueueTask name
@param array|null $data any array
@param array|null $notBefore optional date which must not be preceded
@param string|null $reference An optional reference string.
@return \Cake\ORM\Entity Saved job entity
@throws \Exception | [
"Add",
"a",
"new",
"Job",
"to",
"the",
"Queue",
"."
] | 8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435 | https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L58-L73 | train |
CodeBlastr/queue | src/Model/Table/QueuesTable.php | QueuesTable.requestJob | public function requestJob()
{
$findCond = [
'conditions' => [
'completed' => 0
],
'order' => [
'created ASC',
'id ASC',
],
'limit' => 3,
];
$jobs = $this->find('all', $findCond)->all... | php | public function requestJob()
{
$findCond = [
'conditions' => [
'completed' => 0
],
'order' => [
'created ASC',
'id ASC',
],
'limit' => 3,
];
$jobs = $this->find('all', $findCond)->all... | [
"public",
"function",
"requestJob",
"(",
")",
"{",
"$",
"findCond",
"=",
"[",
"'conditions'",
"=>",
"[",
"'completed'",
"=>",
"0",
"]",
",",
"'order'",
"=>",
"[",
"'created ASC'",
",",
"'id ASC'",
",",
"]",
",",
"'limit'",
"=>",
"3",
",",
"]",
";",
"... | Find a job to do.
@return array | [
"Find",
"a",
"job",
"to",
"do",
"."
] | 8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435 | https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L80-L100 | train |
CodeBlastr/queue | src/Model/Table/QueuesTable.php | QueuesTable.markJobDone | public function markJobDone($id)
{
$entity = $this->get($id);
$data = ['completed' => true, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . 'Success!' . PHP_EOL]];
$this->patchEntity($entity, $data, ['valid... | php | public function markJobDone($id)
{
$entity = $this->get($id);
$data = ['completed' => true, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . 'Success!' . PHP_EOL]];
$this->patchEntity($entity, $data, ['valid... | [
"public",
"function",
"markJobDone",
"(",
"$",
"id",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"id",
")",
";",
"$",
"data",
"=",
"[",
"'completed'",
"=>",
"true",
",",
"'stats'",
"=>",
"[",
"'tries'",
"=>",
"(",
"$",
"enti... | Mark job done and add some stats
@param $id
@return bool|\Cake\Datasource\EntityInterface|mixed | [
"Mark",
"job",
"done",
"and",
"add",
"some",
"stats"
] | 8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435 | https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L108-L114 | train |
CodeBlastr/queue | src/Model/Table/QueuesTable.php | QueuesTable.markJobFailed | public function markJobFailed($id, $message = null)
{
$entity = $this->get($id);
$data = ['completed' => false, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . $message . PHP_EOL]];
$this->patchEntity($enti... | php | public function markJobFailed($id, $message = null)
{
$entity = $this->get($id);
$data = ['completed' => false, 'stats' => ['tries' => ($entity->stats['tries'] + 1), 'message' => $entity->stats['message'] . ($entity->stats['tries'] + 1) . '. ' . $message . PHP_EOL]];
$this->patchEntity($enti... | [
"public",
"function",
"markJobFailed",
"(",
"$",
"id",
",",
"$",
"message",
"=",
"null",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"id",
")",
";",
"$",
"data",
"=",
"[",
"'completed'",
"=>",
"false",
",",
"'stats'",
"=>",
... | Job did not complete, save a few stats so we can see what went wrong.
@param $id
@param null $message
@return bool|\Cake\Datasource\EntityInterface|mixed | [
"Job",
"did",
"not",
"complete",
"save",
"a",
"few",
"stats",
"so",
"we",
"can",
"see",
"what",
"went",
"wrong",
"."
] | 8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435 | https://github.com/CodeBlastr/queue/blob/8bc37c429406cce1b99c2c9e9dc1a83ad2b0b435/src/Model/Table/QueuesTable.php#L123-L129 | train |
praxigento/mobi_mod_pv | Service/Batch/Transfer/Save/A/ProcessItems.php | ProcessItems.cleanBatches | private function cleanBatches($userId)
{
$where = EBatch::A_USER_REF . '=' . (int)$userId;
$result = $this->daoBatch->delete($where);
return $result;
} | php | private function cleanBatches($userId)
{
$where = EBatch::A_USER_REF . '=' . (int)$userId;
$result = $this->daoBatch->delete($where);
return $result;
} | [
"private",
"function",
"cleanBatches",
"(",
"$",
"userId",
")",
"{",
"$",
"where",
"=",
"EBatch",
"::",
"A_USER_REF",
".",
"'='",
".",
"(",
"int",
")",
"$",
"userId",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"daoBatch",
"->",
"delete",
"(",
"$",
... | Remove all existing batches for currently logged in admin user.
@return int
@throws \Exception | [
"Remove",
"all",
"existing",
"batches",
"for",
"currently",
"logged",
"in",
"admin",
"user",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Service/Batch/Transfer/Save/A/ProcessItems.php#L54-L59 | train |
praxigento/mobi_mod_pv | Service/Batch/Transfer/Save/A/ProcessItems.php | ProcessItems.createBatch | private function createBatch($userId)
{
$entity = new EBatch();
$entity->setUserRef($userId);
$result = $this->daoBatch->create($entity);
return $result;
} | php | private function createBatch($userId)
{
$entity = new EBatch();
$entity->setUserRef($userId);
$result = $this->daoBatch->create($entity);
return $result;
} | [
"private",
"function",
"createBatch",
"(",
"$",
"userId",
")",
"{",
"$",
"entity",
"=",
"new",
"EBatch",
"(",
")",
";",
"$",
"entity",
"->",
"setUserRef",
"(",
"$",
"userId",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"daoBatch",
"->",
"create"... | Register new batch for currently logged in admin user.
@return int
@throws \Exception | [
"Register",
"new",
"batch",
"for",
"currently",
"logged",
"in",
"admin",
"user",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Service/Batch/Transfer/Save/A/ProcessItems.php#L67-L73 | train |
lasallecms/lasallecms-l5-lasallecmsadmin-pkg | src/FormProcessing/Postupdates/CreatePostupdateFormProcessing.php | CreatePostupdateFormProcessing.quarterback | public function quarterback($createCommand) {
// Convert the command bus object into an array
$data = (array) $createCommand;
// Sanitize
$data = $this->sanitize($data, $this->type);
// Validate
if ($this->validate($data, $this->type) != "passed")
{
... | php | public function quarterback($createCommand) {
// Convert the command bus object into an array
$data = (array) $createCommand;
// Sanitize
$data = $this->sanitize($data, $this->type);
// Validate
if ($this->validate($data, $this->type) != "passed")
{
... | [
"public",
"function",
"quarterback",
"(",
"$",
"createCommand",
")",
"{",
"// Convert the command bus object into an array",
"$",
"data",
"=",
"(",
"array",
")",
"$",
"createCommand",
";",
"// Sanitize",
"$",
"data",
"=",
"$",
"this",
"->",
"sanitize",
"(",
"$",... | The form processing steps.
@param object $createCommand The command bus object
@return array The custom response array | [
"The",
"form",
"processing",
"steps",
"."
] | 5a4b3375e449273a98e84a566bcf60fd2172cb2d | https://github.com/lasallecms/lasallecms-l5-lasallecmsadmin-pkg/blob/5a4b3375e449273a98e84a566bcf60fd2172cb2d/src/FormProcessing/Postupdates/CreatePostupdateFormProcessing.php#L119-L163 | train |
ZFrapid/zfrapid-core | src/Command/AbstractCommand.php | AbstractCommand.processTasks | public function processTasks()
{
/** @var TaskInterface $task */
foreach ($this->tasks as $task) {
$callable = new $task();
$result = call_user_func(
$callable, $this->route, $this->console, $this->params
);
if (1 === $result) {
... | php | public function processTasks()
{
/** @var TaskInterface $task */
foreach ($this->tasks as $task) {
$callable = new $task();
$result = call_user_func(
$callable, $this->route, $this->console, $this->params
);
if (1 === $result) {
... | [
"public",
"function",
"processTasks",
"(",
")",
"{",
"/** @var TaskInterface $task */",
"foreach",
"(",
"$",
"this",
"->",
"tasks",
"as",
"$",
"task",
")",
"{",
"$",
"callable",
"=",
"new",
"$",
"task",
"(",
")",
";",
"$",
"result",
"=",
"call_user_func",
... | Process command tasks | [
"Process",
"command",
"tasks"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Command/AbstractCommand.php#L71-L87 | train |
johnkrovitch/Sam | Task/TaskBuilder.php | TaskBuilder.build | public function build(array $taskConfigurations)
{
$resolver = new OptionsResolver();
$tasks = [];
foreach ($taskConfigurations as $taskName => $taskConfiguration) {
$resolver->clear();
// debug mode
if ($this->debug === true) {
$... | php | public function build(array $taskConfigurations)
{
$resolver = new OptionsResolver();
$tasks = [];
foreach ($taskConfigurations as $taskName => $taskConfiguration) {
$resolver->clear();
// debug mode
if ($this->debug === true) {
$... | [
"public",
"function",
"build",
"(",
"array",
"$",
"taskConfigurations",
")",
"{",
"$",
"resolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"$",
"tasks",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"taskConfigurations",
"as",
"$",
"taskName",
"=>",
"$"... | Build and return an array of Task.
@param array $taskConfigurations
@return Task[] | [
"Build",
"and",
"return",
"an",
"array",
"of",
"Task",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Task/TaskBuilder.php#L31-L57 | train |
loevgaard/dandomain-foundation-entities | src/Repository/AbstractRepository.php | AbstractRepository.removeByIds | public function removeByIds(array $in = [], array $notIn = [])
{
if (!count($in) && !count($notIn)) {
return;
}
$qb = $this->createQueryBuilder('e');
if ($this->getClassMetadata()->hasField('deletedAt')) {
$qb->update()
->set('e.deletedAt', '... | php | public function removeByIds(array $in = [], array $notIn = [])
{
if (!count($in) && !count($notIn)) {
return;
}
$qb = $this->createQueryBuilder('e');
if ($this->getClassMetadata()->hasField('deletedAt')) {
$qb->update()
->set('e.deletedAt', '... | [
"public",
"function",
"removeByIds",
"(",
"array",
"$",
"in",
"=",
"[",
"]",
",",
"array",
"$",
"notIn",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"in",
")",
"&&",
"!",
"count",
"(",
"$",
"notIn",
")",
")",
"{",
"return",
";... | Will remove entities based on the ids you input.
@param int[] $in
@param int[] $notIn | [
"Will",
"remove",
"entities",
"based",
"on",
"the",
"ids",
"you",
"input",
"."
] | 256f7aa8b40d2bd9488046c3c2b1e04e982d78ad | https://github.com/loevgaard/dandomain-foundation-entities/blob/256f7aa8b40d2bd9488046c3c2b1e04e982d78ad/src/Repository/AbstractRepository.php#L79-L107 | train |
Ydle/HubBundle | Controller/ConfigController.php | ConfigController.typeroomAction | public function typeroomAction(Request $request)
{
$roomType = new RoomType();
$form = $this->createForm("room_types", $roomType);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($roomType);
... | php | public function typeroomAction(Request $request)
{
$roomType = new RoomType();
$form = $this->createForm("room_types", $roomType);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($roomType);
... | [
"public",
"function",
"typeroomAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"roomType",
"=",
"new",
"RoomType",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"\"room_types\"",
",",
"$",
"roomType",
")",
";",
"$",
"fo... | Homepage for type room, listing and editing types
@param \Symfony\Component\HttpFoundation\Request $request
@return type | [
"Homepage",
"for",
"type",
"room",
"listing",
"and",
"editing",
"types"
] | 7fa423241246bcfd115f2ed3ad3997b4b63adb01 | https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Controller/ConfigController.php#L26-L55 | train |
native5/native5-sdk-client-php | src/Native5/Identity/DefaultSecurityManager.php | DefaultSecurityManager.login | public function login(&$subject, $token)
{
global $logger;
global $app;
try {
if($app->getConfiguration()->isPreventMultipleLogins()) {
list($authInfo, $roles, $tokens,$hashedSessionId) = $this->authenticate($token, true);
$app->getSessionManager()... | php | public function login(&$subject, $token)
{
global $logger;
global $app;
try {
if($app->getConfiguration()->isPreventMultipleLogins()) {
list($authInfo, $roles, $tokens,$hashedSessionId) = $this->authenticate($token, true);
$app->getSessionManager()... | [
"public",
"function",
"login",
"(",
"&",
"$",
"subject",
",",
"$",
"token",
")",
"{",
"global",
"$",
"logger",
";",
"global",
"$",
"app",
";",
"try",
"{",
"if",
"(",
"$",
"app",
"->",
"getConfiguration",
"(",
")",
"->",
"isPreventMultipleLogins",
"(",
... | login Logs in the subject.
@param mixed $subject Subject to authenticate
@param mixed $token Token to be used for authentication.
@access public
@return void
@throws AuthenticationException | [
"login",
"Logs",
"in",
"the",
"subject",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L86-L119 | train |
native5/native5-sdk-client-php | src/Native5/Identity/DefaultSecurityManager.php | DefaultSecurityManager._generateCSRFToken | private function _generateCSRFToken($length=32)
{
$randUtils = new RandomUtils();
$randToken = $randUtils->getBytes($length, true);
return base64_encode($randToken);
} | php | private function _generateCSRFToken($length=32)
{
$randUtils = new RandomUtils();
$randToken = $randUtils->getBytes($length, true);
return base64_encode($randToken);
} | [
"private",
"function",
"_generateCSRFToken",
"(",
"$",
"length",
"=",
"32",
")",
"{",
"$",
"randUtils",
"=",
"new",
"RandomUtils",
"(",
")",
";",
"$",
"randToken",
"=",
"$",
"randUtils",
"->",
"getBytes",
"(",
"$",
"length",
",",
"true",
")",
";",
"ret... | Generate CSRF Token of given length.
@param mixed $length
@access private
@return void | [
"Generate",
"CSRF",
"Token",
"of",
"given",
"length",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L129-L134 | train |
native5/native5-sdk-client-php | src/Native5/Identity/DefaultSecurityManager.php | DefaultSecurityManager._logAnalytics | private function _logAnalytics($app, $subject)
{
if($app->getConfiguration()->logAnalytics() == true) {
$clientIP = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$ana... | php | private function _logAnalytics($app, $subject)
{
if($app->getConfiguration()->logAnalytics() == true) {
$clientIP = (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$ana... | [
"private",
"function",
"_logAnalytics",
"(",
"$",
"app",
",",
"$",
"subject",
")",
"{",
"if",
"(",
"$",
"app",
"->",
"getConfiguration",
"(",
")",
"->",
"logAnalytics",
"(",
")",
"==",
"true",
")",
"{",
"$",
"clientIP",
"=",
"(",
"isset",
"(",
"$",
... | Log Analytics using the route logger
@param mixed $app
@access private
@return void | [
"Log",
"Analytics",
"using",
"the",
"route",
"logger"
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L144-L160 | train |
native5/native5-sdk-client-php | src/Native5/Identity/DefaultSecurityManager.php | DefaultSecurityManager.createSubject | public function createSubject($context)
{
global $logger;
//$copyContext = $this->copy($context);
//$copyContext = $this->_ensureSecurityMgr($copyContext);
//$copyContext = $this->_resolveSession($copyContext);
//$copyContext = $this->_resolvePrincipals($copyContext);
... | php | public function createSubject($context)
{
global $logger;
//$copyContext = $this->copy($context);
//$copyContext = $this->_ensureSecurityMgr($copyContext);
//$copyContext = $this->_resolveSession($copyContext);
//$copyContext = $this->_resolvePrincipals($copyContext);
... | [
"public",
"function",
"createSubject",
"(",
"$",
"context",
")",
"{",
"global",
"$",
"logger",
";",
"//$copyContext = $this->copy($context);",
"//$copyContext = $this->_ensureSecurityMgr($copyContext);",
"//$copyContext = $this->_resolveSession($copyContext);",
"//$copyContext = $this-... | createSubject Creating the subject using the given context.
@param mixed $context The context used to create the subject.
@access public
@return void | [
"createSubject",
"Creating",
"the",
"subject",
"using",
"the",
"given",
"context",
"."
] | e1f598cf27654d81bb5facace1990b737242a2f9 | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/Identity/DefaultSecurityManager.php#L191-L203 | train |
kaiohken1982/NeobazaarMailerModule | src/Mailer/Mvc/UserActivationListener.php | UserActivationListener.onUserActivationPost | public function onUserActivationPost(UserActivationEvent $e)
{
$password = $e->getParam('password');
$email = $e->getParam('to');
$siteUrl = $e->getParam('siteurl');
$loginUri = $this->getModuleOptions()->getLoginUri();
// something got really wrong if we get here...
... | php | public function onUserActivationPost(UserActivationEvent $e)
{
$password = $e->getParam('password');
$email = $e->getParam('to');
$siteUrl = $e->getParam('siteurl');
$loginUri = $this->getModuleOptions()->getLoginUri();
// something got really wrong if we get here...
... | [
"public",
"function",
"onUserActivationPost",
"(",
"UserActivationEvent",
"$",
"e",
")",
"{",
"$",
"password",
"=",
"$",
"e",
"->",
"getParam",
"(",
"'password'",
")",
";",
"$",
"email",
"=",
"$",
"e",
"->",
"getParam",
"(",
"'to'",
")",
";",
"$",
"sit... | User Activation mail
@param EventManagerInterface $events
@return PrerenderListener | [
"User",
"Activation",
"mail"
] | 0afc66196a0a392ecb4f052f483f2b5ff606bd8f | https://github.com/kaiohken1982/NeobazaarMailerModule/blob/0afc66196a0a392ecb4f052f483f2b5ff606bd8f/src/Mailer/Mvc/UserActivationListener.php#L124-L147 | train |
zhaoxianfang/tools | src/Symfony/Component/Config/Definition/PrototypedArrayNode.php | PrototypedArrayNode.setDefaultValue | public function setDefaultValue($value)
{
if (!is_array($value)) {
throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.');
}
$this->defaultValue = $value;
} | php | public function setDefaultValue($value)
{
if (!is_array($value)) {
throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.');
}
$this->defaultValue = $value;
} | [
"public",
"function",
"setDefaultValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
".",
"': the default value of... | Sets the default value of this node.
@param string $value
@throws \InvalidArgumentException if the default value is not an array | [
"Sets",
"the",
"default",
"value",
"of",
"this",
"node",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php#L95-L102 | train |
zhaoxianfang/tools | src/Symfony/Component/Config/Definition/PrototypedArrayNode.php | PrototypedArrayNode.setAddChildrenIfNoneSet | public function setAddChildrenIfNoneSet($children = array('defaults'))
{
if (null === $children) {
$this->defaultChildren = array('defaults');
} else {
$this->defaultChildren = is_int($children) && $children > 0 ? range(1, $children) : (array) $children;
}
} | php | public function setAddChildrenIfNoneSet($children = array('defaults'))
{
if (null === $children) {
$this->defaultChildren = array('defaults');
} else {
$this->defaultChildren = is_int($children) && $children > 0 ? range(1, $children) : (array) $children;
}
} | [
"public",
"function",
"setAddChildrenIfNoneSet",
"(",
"$",
"children",
"=",
"array",
"(",
"'defaults'",
")",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"children",
")",
"{",
"$",
"this",
"->",
"defaultChildren",
"=",
"array",
"(",
"'defaults'",
")",
";",
"... | Adds default children when none are set.
@param int|string|array|null $children The number of children|The child name|The children names to be added | [
"Adds",
"default",
"children",
"when",
"none",
"are",
"set",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php#L117-L124 | train |
eureka-framework/component-cache | src/Cache/CacheWrapperAbstract.php | CacheWrapperAbstract.prefix | public function prefix($prefix = null)
{
if (null !== $prefix) {
$this->prefix = substr(md5($prefix), 0, 10) . '_';
}
return $this->prefix;
} | php | public function prefix($prefix = null)
{
if (null !== $prefix) {
$this->prefix = substr(md5($prefix), 0, 10) . '_';
}
return $this->prefix;
} | [
"public",
"function",
"prefix",
"(",
"$",
"prefix",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"prefix",
")",
"{",
"$",
"this",
"->",
"prefix",
"=",
"substr",
"(",
"md5",
"(",
"$",
"prefix",
")",
",",
"0",
",",
"10",
")",
".",
"'_'",... | Define prefix for Cache Application and return it.
@param string $prefix Base prefix (Cache Application)
@return string Return base prefix. | [
"Define",
"prefix",
"for",
"Cache",
"Application",
"and",
"return",
"it",
"."
] | c110441ac7bb20edd2ecd8162f4302596d875785 | https://github.com/eureka-framework/component-cache/blob/c110441ac7bb20edd2ecd8162f4302596d875785/src/Cache/CacheWrapperAbstract.php#L144-L151 | train |
MinyFramework/Miny-Core | src/HTTP/Session.php | Session.destroy | public function destroy($reopen = false)
{
if ($this->isOpen) {
$params = session_get_cookie_params();
setcookie(
session_name(),
'',
time() - 42000,
$params['path'],
$params['domain'],
$p... | php | public function destroy($reopen = false)
{
if ($this->isOpen) {
$params = session_get_cookie_params();
setcookie(
session_name(),
'',
time() - 42000,
$params['path'],
$params['domain'],
$p... | [
"public",
"function",
"destroy",
"(",
"$",
"reopen",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isOpen",
")",
"{",
"$",
"params",
"=",
"session_get_cookie_params",
"(",
")",
";",
"setcookie",
"(",
"session_name",
"(",
")",
",",
"''",
",",
... | Destroys the current session and its data. | [
"Destroys",
"the",
"current",
"session",
"and",
"its",
"data",
"."
] | a1bfe801a44a49cf01f16411cb4663473e9c827c | https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L57-L76 | train |
MinyFramework/Miny-Core | src/HTTP/Session.php | Session.open | public function open($data = null)
{
if (!session_start()) {
throw new \RuntimeException('Could not open session.');
}
session_regenerate_id(true);
$this->isOpen = true;
if ($data === null) {
if ($this->data === null) {
$data =& $_SESS... | php | public function open($data = null)
{
if (!session_start()) {
throw new \RuntimeException('Could not open session.');
}
session_regenerate_id(true);
$this->isOpen = true;
if ($data === null) {
if ($this->data === null) {
$data =& $_SESS... | [
"public",
"function",
"open",
"(",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"session_start",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Could not open session.'",
")",
";",
"}",
"session_regenerate_id",
"(",
"true",
")"... | Starts the session. Regenerates the session ID each request
for security reasons and updates flash variables.
@param mixed $data The data to use as session data. Pass null to use the previous data, if any.
@throws \RuntimeException When the session can not be opened. | [
"Starts",
"the",
"session",
".",
"Regenerates",
"the",
"session",
"ID",
"each",
"request",
"for",
"security",
"reasons",
"and",
"updates",
"flash",
"variables",
"."
] | a1bfe801a44a49cf01f16411cb4663473e9c827c | https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L86-L113 | train |
MinyFramework/Miny-Core | src/HTTP/Session.php | Session.sessionName | public function sessionName($name = null)
{
if ($name === null) {
return session_name();
}
if ($this->isOpen) {
throw new \InvalidArgumentException('The session has already been opened.');
}
if (!is_string($name)) {
throw new \InvalidArgume... | php | public function sessionName($name = null)
{
if ($name === null) {
return session_name();
}
if ($this->isOpen) {
throw new \InvalidArgumentException('The session has already been opened.');
}
if (!is_string($name)) {
throw new \InvalidArgume... | [
"public",
"function",
"sessionName",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"return",
"session_name",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isOpen",
")",
"{",
"throw",
"new",
"\\",
"... | Sets or gets the session name.
@param string $name the session name for the current session
@throws \InvalidArgumentException
@return string the current session name | [
"Sets",
"or",
"gets",
"the",
"session",
"name",
"."
] | a1bfe801a44a49cf01f16411cb4663473e9c827c | https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L134-L146 | train |
MinyFramework/Miny-Core | src/HTTP/Session.php | Session.savePath | public function savePath($path = null)
{
if ($path === null) {
return session_save_path();
}
if ($this->isOpen) {
throw new \InvalidArgumentException('The session has already been opened.');
}
if (!is_string($path)) {
throw new \InvalidArgu... | php | public function savePath($path = null)
{
if ($path === null) {
return session_save_path();
}
if ($this->isOpen) {
throw new \InvalidArgumentException('The session has already been opened.');
}
if (!is_string($path)) {
throw new \InvalidArgu... | [
"public",
"function",
"savePath",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"path",
"===",
"null",
")",
"{",
"return",
"session_save_path",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isOpen",
")",
"{",
"throw",
"new",
"\\",
... | Sets or gets the current session save path.
@param string|null $path
@throws \InvalidArgumentException
@return string the current session save path. | [
"Sets",
"or",
"gets",
"the",
"current",
"session",
"save",
"path",
"."
] | a1bfe801a44a49cf01f16411cb4663473e9c827c | https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/HTTP/Session.php#L156-L171 | train |
wb-crowdfusion/crowdfusion | system/context/Events.php | Events.trigger | public function trigger($eventName, $arg1 = 'NULLPARAMETER')
{
$this->Logger->debug('Triggering event ['.$eventName.']');
if(($event = $this->ApplicationContext->getEvent($eventName)) == false)
return;
$args = array();
$stack = null;
if($arg1 !== 'NULLPARAMETER')... | php | public function trigger($eventName, $arg1 = 'NULLPARAMETER')
{
$this->Logger->debug('Triggering event ['.$eventName.']');
if(($event = $this->ApplicationContext->getEvent($eventName)) == false)
return;
$args = array();
$stack = null;
if($arg1 !== 'NULLPARAMETER')... | [
"public",
"function",
"trigger",
"(",
"$",
"eventName",
",",
"$",
"arg1",
"=",
"'NULLPARAMETER'",
")",
"{",
"$",
"this",
"->",
"Logger",
"->",
"debug",
"(",
"'Triggering event ['",
".",
"$",
"eventName",
".",
"']'",
")",
";",
"if",
"(",
"(",
"$",
"even... | Trigger the event, passing parameters to callbacks
All additional parameters beyond the first parameter {@link $eventName}
will be passed through to the callback function as parameters.
Executes all bound callbacks in ascending priority order. If two callbacks
are bound with the same priority, they are executed in t... | [
"Trigger",
"the",
"event",
"passing",
"parameters",
"to",
"callbacks"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/context/Events.php#L87-L136 | train |
RudyMas/filemanager | src/FileManager/FileManager.php | FileManager.createFolder | public function createFolder($folder, $allFolders = FALSE)
{
if (substr($folder, -1) != '/') $folder = $folder . '/';
if (!is_dir($folder)) {
@mkdir($folder, 0777, $allFolders) or die ("Error creating folder '{$folder}'.");
}
} | php | public function createFolder($folder, $allFolders = FALSE)
{
if (substr($folder, -1) != '/') $folder = $folder . '/';
if (!is_dir($folder)) {
@mkdir($folder, 0777, $allFolders) or die ("Error creating folder '{$folder}'.");
}
} | [
"public",
"function",
"createFolder",
"(",
"$",
"folder",
",",
"$",
"allFolders",
"=",
"FALSE",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"folder",
",",
"-",
"1",
")",
"!=",
"'/'",
")",
"$",
"folder",
"=",
"$",
"folder",
".",
"'/'",
";",
"if",
"("... | To create a new folder
@param string $folder The folder to create
@param bool $allFolders Allows the creation of nested directories specified in the pathname. (Default: FALSE) | [
"To",
"create",
"a",
"new",
"folder"
] | f47f0f07922221fd879fbbc66559c8cd89cdfe0d | https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L27-L33 | train |
RudyMas/filemanager | src/FileManager/FileManager.php | FileManager.moveFile | public function moveFile($file, $originalFolder, $newFolder)
{
if (substr($originalFolder, -1) != '/') $originalFolder = $originalFolder . '/';
if (substr($newFolder, -1) != '/') $newFolder = $newFolder . '/';
$this->copyFile($originalFolder . $file, $newFolder . $file);
$this->delet... | php | public function moveFile($file, $originalFolder, $newFolder)
{
if (substr($originalFolder, -1) != '/') $originalFolder = $originalFolder . '/';
if (substr($newFolder, -1) != '/') $newFolder = $newFolder . '/';
$this->copyFile($originalFolder . $file, $newFolder . $file);
$this->delet... | [
"public",
"function",
"moveFile",
"(",
"$",
"file",
",",
"$",
"originalFolder",
",",
"$",
"newFolder",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"originalFolder",
",",
"-",
"1",
")",
"!=",
"'/'",
")",
"$",
"originalFolder",
"=",
"$",
"originalFolder",
"... | To move a file
@param string $file The file to move
@param string $originalFolder The original folder where the file is
@param string $newFolder The folder where the file has to go | [
"To",
"move",
"a",
"file"
] | f47f0f07922221fd879fbbc66559c8cd89cdfe0d | https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L53-L59 | train |
RudyMas/filemanager | src/FileManager/FileManager.php | FileManager.copyFile | public function copyFile($originalFile, $newFile)
{
if (is_file($originalFile)) {
@copy($originalFile, $newFile) or die("File '{$originalFile}' can't be copied to '{$newFile}'.");
} else {
die("File '{$originalFile}' doesn't exist.");
}
} | php | public function copyFile($originalFile, $newFile)
{
if (is_file($originalFile)) {
@copy($originalFile, $newFile) or die("File '{$originalFile}' can't be copied to '{$newFile}'.");
} else {
die("File '{$originalFile}' doesn't exist.");
}
} | [
"public",
"function",
"copyFile",
"(",
"$",
"originalFile",
",",
"$",
"newFile",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"originalFile",
")",
")",
"{",
"@",
"copy",
"(",
"$",
"originalFile",
",",
"$",
"newFile",
")",
"or",
"die",
"(",
"\"File '{$orig... | To copy a file
@param string $originalFile Original file to copy
@param string $newFile The copy of the original file | [
"To",
"copy",
"a",
"file"
] | f47f0f07922221fd879fbbc66559c8cd89cdfe0d | https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L67-L74 | train |
RudyMas/filemanager | src/FileManager/FileManager.php | FileManager.readFolder | public function readFolder($folder, $sort = 0)
{
if (substr($folder, -1) != '/') $folder = $folder . '/';
$this->data = @scandir($folder, $sort) or die("Error reading folder: '{$folder}'.");
$this->numberOfFiles = count($this->data);
} | php | public function readFolder($folder, $sort = 0)
{
if (substr($folder, -1) != '/') $folder = $folder . '/';
$this->data = @scandir($folder, $sort) or die("Error reading folder: '{$folder}'.");
$this->numberOfFiles = count($this->data);
} | [
"public",
"function",
"readFolder",
"(",
"$",
"folder",
",",
"$",
"sort",
"=",
"0",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"folder",
",",
"-",
"1",
")",
"!=",
"'/'",
")",
"$",
"folder",
"=",
"$",
"folder",
".",
"'/'",
";",
"$",
"this",
"->",
... | Reading the files and folders of a certain folder
@param string $folder The folder to read
@param int $sort How the data has to be sorted (Default: ascending)
- SCANDIR_SORT_DESCENDING: Sort descending (z -> a)
- SCANDIR_SORT_NONE: No sorting done
$this->data An array with all the information of the fold... | [
"Reading",
"the",
"files",
"and",
"folders",
"of",
"a",
"certain",
"folder"
] | f47f0f07922221fd879fbbc66559c8cd89cdfe0d | https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L92-L97 | train |
RudyMas/filemanager | src/FileManager/FileManager.php | FileManager.processUploadedFile | public function processUploadedFile($originalFile, $newFile, $folder)
{
if (substr($folder, -1) != '/') $folder = $folder . '/';
@move_uploaded_file($originalFile, $folder . $newFile) or die("File: '{$originalFile}' couldn't be moved '{$folder}'.");
@chmod($folder . $newFile, 0777) or die("E... | php | public function processUploadedFile($originalFile, $newFile, $folder)
{
if (substr($folder, -1) != '/') $folder = $folder . '/';
@move_uploaded_file($originalFile, $folder . $newFile) or die("File: '{$originalFile}' couldn't be moved '{$folder}'.");
@chmod($folder . $newFile, 0777) or die("E... | [
"public",
"function",
"processUploadedFile",
"(",
"$",
"originalFile",
",",
"$",
"newFile",
",",
"$",
"folder",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"folder",
",",
"-",
"1",
")",
"!=",
"'/'",
")",
"$",
"folder",
"=",
"$",
"folder",
".",
"'/'",
... | Process an uploaded file and moved to a folder on the server
@param string $originalFile The original file inside the temporary folder
@param string $newFile The new name for the file
@param string $folder The folder where the file has to go | [
"Process",
"an",
"uploaded",
"file",
"and",
"moved",
"to",
"a",
"folder",
"on",
"the",
"server"
] | f47f0f07922221fd879fbbc66559c8cd89cdfe0d | https://github.com/RudyMas/filemanager/blob/f47f0f07922221fd879fbbc66559c8cd89cdfe0d/src/FileManager/FileManager.php#L131-L136 | train |
PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.findOrNew | public function findOrNew($id, $columns = ['*'])
{
if (is_null($instance = $this->find($id, $columns))) {
$instance = $this->related->newInstance();
$instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey());
}
return $instance;
} | php | public function findOrNew($id, $columns = ['*'])
{
if (is_null($instance = $this->find($id, $columns))) {
$instance = $this->related->newInstance();
$instance->setAttribute($this->getPlainForeignKey(), $this->getParentKey());
}
return $instance;
} | [
"public",
"function",
"findOrNew",
"(",
"$",
"id",
",",
"$",
"columns",
"=",
"[",
"'*'",
"]",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"instance",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"id",
",",
"$",
"columns",
")",
")",
")",
"{",
"$",
... | Find a model by its primary key or return new instance of the related model.
@param mixed $id
@param array $columns
@return Model | [
"Find",
"a",
"model",
"by",
"its",
"primary",
"key",
"or",
"return",
"new",
"instance",
"of",
"the",
"related",
"model",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Relations/HasOneOrMany.php#L248-L257 | train |
djmattyg007/Handlebars | src/Tokenizer.php | Tokenizer.tokenize | public function tokenize($callback = null)
{
$this->reset();
if (!is_callable($callback)) {
$callback = function() {};
}
for ($line = 1, $i = 0; $i < $this->strlen; $i++) {
if (mb_substr($this->source, $i, 1) === "\n") {
$line++;
}... | php | public function tokenize($callback = null)
{
$this->reset();
if (!is_callable($callback)) {
$callback = function() {};
}
for ($line = 1, $i = 0; $i < $this->strlen; $i++) {
if (mb_substr($this->source, $i, 1) === "\n") {
$line++;
}... | [
"public",
"function",
"tokenize",
"(",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"$",
"callback",
"=",
"function",
"(",
")",
"{",
"}",
";... | Main rendering function that passes tokens to the
supplied callback.
@param callable|null $callback
@return Tokenizer | [
"Main",
"rendering",
"function",
"that",
"passes",
"tokens",
"to",
"the",
"supplied",
"callback",
"."
] | 3f5b36ec22194cdc5d937a77aa71d500a760ebed | https://github.com/djmattyg007/Handlebars/blob/3f5b36ec22194cdc5d937a77aa71d500a760ebed/src/Tokenizer.php#L71-L115 | train |
djmattyg007/Handlebars | src/Tokenizer.php | Tokenizer.addNode | protected function addNode(int $start, string $type, int $line, int $offset1, int $offset2, $callback)
{
$this->flushText($start, $callback);
switch ($type) {
case self::TYPE_VARIABLE_ESCAPE:
$end = $this->findVariable($start, true);
break;
ca... | php | protected function addNode(int $start, string $type, int $line, int $offset1, int $offset2, $callback)
{
$this->flushText($start, $callback);
switch ($type) {
case self::TYPE_VARIABLE_ESCAPE:
$end = $this->findVariable($start, true);
break;
ca... | [
"protected",
"function",
"addNode",
"(",
"int",
"$",
"start",
",",
"string",
"$",
"type",
",",
"int",
"$",
"line",
",",
"int",
"$",
"offset1",
",",
"int",
"$",
"offset2",
",",
"$",
"callback",
")",
"{",
"$",
"this",
"->",
"flushText",
"(",
"$",
"st... | Forms the node and passes to the callback
@param int $start
@param string $type
@param int $line
@param int $offset1
@param int $offset2
@param callable $callback
@return Tokenizer | [
"Forms",
"the",
"node",
"and",
"passes",
"to",
"the",
"callback"
] | 3f5b36ec22194cdc5d937a77aa71d500a760ebed | https://github.com/djmattyg007/Handlebars/blob/3f5b36ec22194cdc5d937a77aa71d500a760ebed/src/Tokenizer.php#L128-L163 | train |
djmattyg007/Handlebars | src/Tokenizer.php | Tokenizer.findVariable | protected function findVariable(int $i, bool $escape): int
{
$close = ($escape === true ? '}}}' : '}}');
for (; mb_substr($this->source, $i, mb_strlen($close)) !== $close; $i++) {
}
return $i + mb_strlen($close);
} | php | protected function findVariable(int $i, bool $escape): int
{
$close = ($escape === true ? '}}}' : '}}');
for (; mb_substr($this->source, $i, mb_strlen($close)) !== $close; $i++) {
}
return $i + mb_strlen($close);
} | [
"protected",
"function",
"findVariable",
"(",
"int",
"$",
"i",
",",
"bool",
"$",
"escape",
")",
":",
"int",
"{",
"$",
"close",
"=",
"(",
"$",
"escape",
"===",
"true",
"?",
"'}}}'",
":",
"'}}'",
")",
";",
"for",
"(",
";",
"mb_substr",
"(",
"$",
"t... | Since we know where the start is,
we need to find the end in the source.
@param int $i
@param bool $escape
@return int | [
"Since",
"we",
"know",
"where",
"the",
"start",
"is",
"we",
"need",
"to",
"find",
"the",
"end",
"in",
"the",
"source",
"."
] | 3f5b36ec22194cdc5d937a77aa71d500a760ebed | https://github.com/djmattyg007/Handlebars/blob/3f5b36ec22194cdc5d937a77aa71d500a760ebed/src/Tokenizer.php#L202-L210 | train |
Facebook-Anonymous-Publisher/shortener | src/Drivers/Base.php | Base.save | protected function save($origin, $short = null)
{
$shortener = Shortener::updateOrCreate(
['hash' => hash('sha512', $origin)],
['url' => $origin, 'short' => $short]
);
return $shortener->exists ? $shortener->getKey() : false;
} | php | protected function save($origin, $short = null)
{
$shortener = Shortener::updateOrCreate(
['hash' => hash('sha512', $origin)],
['url' => $origin, 'short' => $short]
);
return $shortener->exists ? $shortener->getKey() : false;
} | [
"protected",
"function",
"save",
"(",
"$",
"origin",
",",
"$",
"short",
"=",
"null",
")",
"{",
"$",
"shortener",
"=",
"Shortener",
"::",
"updateOrCreate",
"(",
"[",
"'hash'",
"=>",
"hash",
"(",
"'sha512'",
",",
"$",
"origin",
")",
"]",
",",
"[",
"'ur... | Save record to database.
@param string $origin
@param string|null $short
@return mixed | [
"Save",
"record",
"to",
"database",
"."
] | 3b2e49d9cdd96758d35cf57a7a27659d2b6682aa | https://github.com/Facebook-Anonymous-Publisher/shortener/blob/3b2e49d9cdd96758d35cf57a7a27659d2b6682aa/src/Drivers/Base.php#L17-L25 | train |
fridge-project/dbal | src/Fridge/DBAL/Schema/Index.php | Index.addColumnName | public function addColumnName($columnName)
{
if (!is_string($columnName) || (strlen($columnName) <= 0)) {
throw SchemaException::invalidIndexColumnName($this->getName());
}
$this->columnNames[] = $columnName;
} | php | public function addColumnName($columnName)
{
if (!is_string($columnName) || (strlen($columnName) <= 0)) {
throw SchemaException::invalidIndexColumnName($this->getName());
}
$this->columnNames[] = $columnName;
} | [
"public",
"function",
"addColumnName",
"(",
"$",
"columnName",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"columnName",
")",
"||",
"(",
"strlen",
"(",
"$",
"columnName",
")",
"<=",
"0",
")",
")",
"{",
"throw",
"SchemaException",
"::",
"invalidIndex... | Adds a column name to the index.
@param string $columnName The column name to add.
@throws \Fridge\DBAL\Exception\SchemaException If the column name is not a valid string. | [
"Adds",
"a",
"column",
"name",
"to",
"the",
"index",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Index.php#L77-L84 | train |
fridge-project/dbal | src/Fridge/DBAL/Schema/Index.php | Index.setUnique | public function setUnique($unique)
{
if (!is_bool($unique)) {
throw SchemaException::invalidIndexUniqueFlag($this->getName());
}
$this->unique = $unique;
} | php | public function setUnique($unique)
{
if (!is_bool($unique)) {
throw SchemaException::invalidIndexUniqueFlag($this->getName());
}
$this->unique = $unique;
} | [
"public",
"function",
"setUnique",
"(",
"$",
"unique",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"unique",
")",
")",
"{",
"throw",
"SchemaException",
"::",
"invalidIndexUniqueFlag",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
")",
";",
"}",
"$",
... | Sets the unique index flag.
@param boolean $unique TRUE if the index is unique else FALSE.
@throws \Fridge\DBAL\Exception\SchemaException If the unique flag is not a boolean. | [
"Sets",
"the",
"unique",
"index",
"flag",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Index.php#L103-L110 | train |
fridge-project/dbal | src/Fridge/DBAL/Schema/Index.php | Index.isBetterThan | public function isBetterThan(Index $index)
{
if ($this->hasSameColumnNames($index->getColumnNames()) && $this->isUnique() && !$index->isUnique()) {
return true;
}
return false;
} | php | public function isBetterThan(Index $index)
{
if ($this->hasSameColumnNames($index->getColumnNames()) && $this->isUnique() && !$index->isUnique()) {
return true;
}
return false;
} | [
"public",
"function",
"isBetterThan",
"(",
"Index",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasSameColumnNames",
"(",
"$",
"index",
"->",
"getColumnNames",
"(",
")",
")",
"&&",
"$",
"this",
"->",
"isUnique",
"(",
")",
"&&",
"!",
"$",
"... | Checks if the index is better than the given index.
Better means the index can replace the given.
@param Fridge\DBAL\Schema\Index $index The candidate index.
@return boolean TRUE if the index is better than the given else FALSE. | [
"Checks",
"if",
"the",
"index",
"is",
"better",
"than",
"the",
"given",
"index",
".",
"Better",
"means",
"the",
"index",
"can",
"replace",
"the",
"given",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Index.php#L142-L149 | train |
ciims/ciims-modules-api | controllers/UserController.php | UserController.createUser | private function createUser($sendEmail = true)
{
$model = new RegisterForm;
if (!empty($_POST))
{
$model->attributes = $_POST;
// Save the user's information
if ($model->save($sendEmail))
return Users::model()->findByAttributes(array('email' => $_POST['email']))->getAPIAttributes(array('... | php | private function createUser($sendEmail = true)
{
$model = new RegisterForm;
if (!empty($_POST))
{
$model->attributes = $_POST;
// Save the user's information
if ($model->save($sendEmail))
return Users::model()->findByAttributes(array('email' => $_POST['email']))->getAPIAttributes(array('... | [
"private",
"function",
"createUser",
"(",
"$",
"sendEmail",
"=",
"true",
")",
"{",
"$",
"model",
"=",
"new",
"RegisterForm",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"_POST",
")",
")",
"{",
"$",
"model",
"->",
"attributes",
"=",
"$",
"_POST",
";",
"... | Utilizes the registration form to create a new user
@return array | [
"Utilizes",
"the",
"registration",
"form",
"to",
"create",
"a",
"new",
"user"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/UserController.php#L222-L238 | train |
Vectrex/vxPHP | src/Debug/ErrorHandler.php | ErrorHandler.handle | public function handle($errorLevel, $message, $file, $line, $context) {
if ($this->errorLevel === 0) {
return FALSE;
}
if (
$this->displayErrors &&
error_reporting() & $errorLevel &&
$this->errorLevel & $errorLevel
) {
throw new \ErrorException(sprintf(
'%s: %s in %s line %d',
isset($th... | php | public function handle($errorLevel, $message, $file, $line, $context) {
if ($this->errorLevel === 0) {
return FALSE;
}
if (
$this->displayErrors &&
error_reporting() & $errorLevel &&
$this->errorLevel & $errorLevel
) {
throw new \ErrorException(sprintf(
'%s: %s in %s line %d',
isset($th... | [
"public",
"function",
"handle",
"(",
"$",
"errorLevel",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
",",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"errorLevel",
"===",
"0",
")",
"{",
"return",
"FALSE",
";",
"}",
"if",
"... | handle error and throw exception when error level limits are met
@param integer $errorLevel
@param string $message
@param string $file
@param string $line
@param string $context
@throws \ErrorException
@return boolean | [
"handle",
"error",
"and",
"throw",
"exception",
"when",
"error",
"level",
"limits",
"are",
"met"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Debug/ErrorHandler.php#L133-L154 | train |
rougin/blueprint | src/Blueprint.php | Blueprint.setTemplatePath | public function setTemplatePath($path, \Twig_Environment $twig = null, $extensions = [])
{
$this->paths['templates'] = $path;
if (is_null($twig) === true) {
$loader = new \Twig_Loader_Filesystem($path);
$twig = new \Twig_Environment($loader);
}
$twig->setEx... | php | public function setTemplatePath($path, \Twig_Environment $twig = null, $extensions = [])
{
$this->paths['templates'] = $path;
if (is_null($twig) === true) {
$loader = new \Twig_Loader_Filesystem($path);
$twig = new \Twig_Environment($loader);
}
$twig->setEx... | [
"public",
"function",
"setTemplatePath",
"(",
"$",
"path",
",",
"\\",
"Twig_Environment",
"$",
"twig",
"=",
"null",
",",
"$",
"extensions",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"paths",
"[",
"'templates'",
"]",
"=",
"$",
"path",
";",
"if",
"("... | Sets the templates path.
@param string $path
@param \Twig_Environment|null $twig
@param array $extensions
@return self | [
"Sets",
"the",
"templates",
"path",
"."
] | 02dab857b0fab60e060632f11f73e24467483e5b | https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Blueprint.php#L70-L85 | train |
rougin/blueprint | src/Blueprint.php | Blueprint.run | public function run($console = false)
{
$instance = $this->console();
return $console ? $instance : $instance->run();
} | php | public function run($console = false)
{
$instance = $this->console();
return $console ? $instance : $instance->run();
} | [
"public",
"function",
"run",
"(",
"$",
"console",
"=",
"false",
")",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"console",
"(",
")",
";",
"return",
"$",
"console",
"?",
"$",
"instance",
":",
"$",
"instance",
"->",
"run",
"(",
")",
";",
"}"
] | Runs the current console.
@param boolean $console
@return \Symfony\Component\Console\Application|boolean | [
"Runs",
"the",
"current",
"console",
"."
] | 02dab857b0fab60e060632f11f73e24467483e5b | https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Blueprint.php#L139-L144 | train |
rougin/blueprint | src/Blueprint.php | Blueprint.console | protected function console()
{
$files = glob($this->getCommandPath() . '/*.php');
$path = strlen($this->getCommandPath() . DIRECTORY_SEPARATOR);
$pattern = '/\\.[^.\\s]{3,4}$/';
foreach ((array) $files as $file) {
$class = preg_replace($pattern, '', substr($file, $path... | php | protected function console()
{
$files = glob($this->getCommandPath() . '/*.php');
$path = strlen($this->getCommandPath() . DIRECTORY_SEPARATOR);
$pattern = '/\\.[^.\\s]{3,4}$/';
foreach ((array) $files as $file) {
$class = preg_replace($pattern, '', substr($file, $path... | [
"protected",
"function",
"console",
"(",
")",
"{",
"$",
"files",
"=",
"glob",
"(",
"$",
"this",
"->",
"getCommandPath",
"(",
")",
".",
"'/*.php'",
")",
";",
"$",
"path",
"=",
"strlen",
"(",
"$",
"this",
"->",
"getCommandPath",
"(",
")",
".",
"DIRECTO... | Sets up Twig and gets all commands from the specified path.
@return \Symfony\Component\Console\Application | [
"Sets",
"up",
"Twig",
"and",
"gets",
"all",
"commands",
"from",
"the",
"specified",
"path",
"."
] | 02dab857b0fab60e060632f11f73e24467483e5b | https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Blueprint.php#L151-L172 | train |
story75/FileToClassMapper | src/Mapper.php | Mapper.createMap | public function createMap(...$paths)
{
$classes = [];
$this->finder->files()
->ignoreUnreadableDirs()
->in($paths);
foreach($this->excludePathPatterns as $exclude)
{
$this->finder->notPath($exclude);
}
foreach($this->inPathPatter... | php | public function createMap(...$paths)
{
$classes = [];
$this->finder->files()
->ignoreUnreadableDirs()
->in($paths);
foreach($this->excludePathPatterns as $exclude)
{
$this->finder->notPath($exclude);
}
foreach($this->inPathPatter... | [
"public",
"function",
"createMap",
"(",
"...",
"$",
"paths",
")",
"{",
"$",
"classes",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"finder",
"->",
"files",
"(",
")",
"->",
"ignoreUnreadableDirs",
"(",
")",
"->",
"in",
"(",
"$",
"paths",
")",
";",
"forea... | Create a map for a given path
@param array $paths
@return array | [
"Create",
"a",
"map",
"for",
"a",
"given",
"path"
] | c28328fb0df67171e4c5a40c96aca9ed74533d12 | https://github.com/story75/FileToClassMapper/blob/c28328fb0df67171e4c5a40c96aca9ed74533d12/src/Mapper.php#L77-L125 | train |
fridge-project/dbal | src/Fridge/DBAL/Schema/Comparator/ColumnComparator.php | ColumnComparator.compare | public function compare(Column $oldColumn, Column $newColumn)
{
$differences = array();
if ($oldColumn->getType() !== $newColumn->getType()) {
$differences[] = 'type';
}
if ($oldColumn->getLength() !== $newColumn->getLength()) {
$differences[] = 'length';
... | php | public function compare(Column $oldColumn, Column $newColumn)
{
$differences = array();
if ($oldColumn->getType() !== $newColumn->getType()) {
$differences[] = 'type';
}
if ($oldColumn->getLength() !== $newColumn->getLength()) {
$differences[] = 'length';
... | [
"public",
"function",
"compare",
"(",
"Column",
"$",
"oldColumn",
",",
"Column",
"$",
"newColumn",
")",
"{",
"$",
"differences",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"oldColumn",
"->",
"getType",
"(",
")",
"!==",
"$",
"newColumn",
"->",
"getTyp... | Compares two columns.
@param \Fridge\DBAL\Schema\Column $oldColumn The old column.
@param \Fridge\DBAL\Schema\Column $newColumn The new column.
@return \Fridge\DBAL\Schema\Diff\ColumnDiff The difference between the two columns. | [
"Compares",
"two",
"columns",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Comparator/ColumnComparator.php#L32-L77 | train |
ARCANESOFT/Blog | src/Models/Post.php | Post.scopePublishedAt | public function scopePublishedAt(Builder $query, $year)
{
return $this->scopePublished($query)
->where(DB::raw('YEAR(published_at)'), $year);
} | php | public function scopePublishedAt(Builder $query, $year)
{
return $this->scopePublished($query)
->where(DB::raw('YEAR(published_at)'), $year);
} | [
"public",
"function",
"scopePublishedAt",
"(",
"Builder",
"$",
"query",
",",
"$",
"year",
")",
"{",
"return",
"$",
"this",
"->",
"scopePublished",
"(",
"$",
"query",
")",
"->",
"where",
"(",
"DB",
"::",
"raw",
"(",
"'YEAR(published_at)'",
")",
",",
"$",
... | Scope only published posts.
@param \Illuminate\Database\Eloquent\Builder $query
@param int $year
@return \Illuminate\Database\Eloquent\Builder | [
"Scope",
"only",
"published",
"posts",
"."
] | 2078fdfdcbccda161c02899b9e1f344f011b2859 | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Models/Post.php#L136-L140 | train |
ARCANESOFT/Blog | src/Models/Post.php | Post.extractSeoAttributes | protected static function extractSeoAttributes(array $inputs)
{
return [
'title' => Arr::get($inputs, 'seo_title'),
'description' => Arr::get($inputs, 'seo_description'),
'keywords' => Arr::get($inputs, 'seo_keywords'),
'metas' => Arr::get($inpu... | php | protected static function extractSeoAttributes(array $inputs)
{
return [
'title' => Arr::get($inputs, 'seo_title'),
'description' => Arr::get($inputs, 'seo_description'),
'keywords' => Arr::get($inputs, 'seo_keywords'),
'metas' => Arr::get($inpu... | [
"protected",
"static",
"function",
"extractSeoAttributes",
"(",
"array",
"$",
"inputs",
")",
"{",
"return",
"[",
"'title'",
"=>",
"Arr",
"::",
"get",
"(",
"$",
"inputs",
",",
"'seo_title'",
")",
",",
"'description'",
"=>",
"Arr",
"::",
"get",
"(",
"$",
"... | Extract the seo attributes.
@param array $inputs
@return array | [
"Extract",
"the",
"seo",
"attributes",
"."
] | 2078fdfdcbccda161c02899b9e1f344f011b2859 | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Models/Post.php#L321-L329 | train |
BenjaminMedia/video-helper | src/VideoHelper.php | VideoHelper.identify_service | public static function identify_service($url)
{
if (preg_match('%youtube|youtu\.be%i', $url)) {
return self::YOUTUBE;
} elseif (preg_match('%vimeo%i', $url)) {
return self::VIMEO;
} elseif (preg_match('%23video%', $url)) {
return self::TWENTYTHREE;
... | php | public static function identify_service($url)
{
if (preg_match('%youtube|youtu\.be%i', $url)) {
return self::YOUTUBE;
} elseif (preg_match('%vimeo%i', $url)) {
return self::VIMEO;
} elseif (preg_match('%23video%', $url)) {
return self::TWENTYTHREE;
... | [
"public",
"static",
"function",
"identify_service",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'%youtube|youtu\\.be%i'",
",",
"$",
"url",
")",
")",
"{",
"return",
"self",
"::",
"YOUTUBE",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'%vimeo%... | Determines which cloud video provider is being used based on the passed url.
@param string $url The url
@return null|string Null on failure to match, the service's name on success | [
"Determines",
"which",
"cloud",
"video",
"provider",
"is",
"being",
"used",
"based",
"on",
"the",
"passed",
"url",
"."
] | 0ab5e775899d56ee9dc23314ca842c6275817487 | https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L24-L34 | train |
BenjaminMedia/video-helper | src/VideoHelper.php | VideoHelper.get_url_id | public static function get_url_id($url)
{
$service = self::identify_service($url);
//TODO use a function for this, it is duplicated
if ($service == self::YOUTUBE) {
return self::get_youtube_id($url);
} elseif ($service == self::VIMEO) {
return self::get_vimeo_... | php | public static function get_url_id($url)
{
$service = self::identify_service($url);
//TODO use a function for this, it is duplicated
if ($service == self::YOUTUBE) {
return self::get_youtube_id($url);
} elseif ($service == self::VIMEO) {
return self::get_vimeo_... | [
"public",
"static",
"function",
"get_url_id",
"(",
"$",
"url",
")",
"{",
"$",
"service",
"=",
"self",
"::",
"identify_service",
"(",
"$",
"url",
")",
";",
"//TODO use a function for this, it is duplicated",
"if",
"(",
"$",
"service",
"==",
"self",
"::",
"YOUTU... | Determines which cloud video provider is being used based on the passed url,
and extracts the video id from the url.
@param string $url The url
@return null|string Null on failure, the video's id on success | [
"Determines",
"which",
"cloud",
"video",
"provider",
"is",
"being",
"used",
"based",
"on",
"the",
"passed",
"url",
"and",
"extracts",
"the",
"video",
"id",
"from",
"the",
"url",
"."
] | 0ab5e775899d56ee9dc23314ca842c6275817487 | https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L43-L55 | train |
BenjaminMedia/video-helper | src/VideoHelper.php | VideoHelper.get_url_embed | public static function get_url_embed($url)
{
$service = self::identify_service($url);
$id = self::get_url_id($url);
if ($service == self::YOUTUBE) {
return self::get_youtube_embed($id);
} elseif ($service == self::VIMEO) {
return self::get_vimeo_embed($id);
... | php | public static function get_url_embed($url)
{
$service = self::identify_service($url);
$id = self::get_url_id($url);
if ($service == self::YOUTUBE) {
return self::get_youtube_embed($id);
} elseif ($service == self::VIMEO) {
return self::get_vimeo_embed($id);
... | [
"public",
"static",
"function",
"get_url_embed",
"(",
"$",
"url",
")",
"{",
"$",
"service",
"=",
"self",
"::",
"identify_service",
"(",
"$",
"url",
")",
";",
"$",
"id",
"=",
"self",
"::",
"get_url_id",
"(",
"$",
"url",
")",
";",
"if",
"(",
"$",
"se... | Determines which cloud video provider is being used based on the passed url,
extracts the video id from the url, and builds an embed url.
@param string $url The url
@return null|string Null on failure, the video's embed url on success | [
"Determines",
"which",
"cloud",
"video",
"provider",
"is",
"being",
"used",
"based",
"on",
"the",
"passed",
"url",
"extracts",
"the",
"video",
"id",
"from",
"the",
"url",
"and",
"builds",
"an",
"embed",
"url",
"."
] | 0ab5e775899d56ee9dc23314ca842c6275817487 | https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L64-L78 | train |
BenjaminMedia/video-helper | src/VideoHelper.php | VideoHelper.get_youtube_id | public static function get_youtube_id($input)
{
// match: <iframe width="560" height="315" src="https://www.youtube.com/embed/dXxEIZTkqMg" ...
// match: https://www.youtube.com/embed/dXxEIZTkqMg
if (preg_match('#/embed/([^\?&"]+)#', $input, $matches)) {
return $matches[1];
... | php | public static function get_youtube_id($input)
{
// match: <iframe width="560" height="315" src="https://www.youtube.com/embed/dXxEIZTkqMg" ...
// match: https://www.youtube.com/embed/dXxEIZTkqMg
if (preg_match('#/embed/([^\?&"]+)#', $input, $matches)) {
return $matches[1];
... | [
"public",
"static",
"function",
"get_youtube_id",
"(",
"$",
"input",
")",
"{",
"// match: <iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/dXxEIZTkqMg\" ...",
"// match: https://www.youtube.com/embed/dXxEIZTkqMg",
"if",
"(",
"preg_match",
"(",
"'#/embed/([^\\?&\... | Parses various youtube urls and returns video identifier.
@param string $input The url or the embed code
@return string the url's id | [
"Parses",
"various",
"youtube",
"urls",
"and",
"returns",
"video",
"identifier",
"."
] | 0ab5e775899d56ee9dc23314ca842c6275817487 | https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L87-L107 | train |
BenjaminMedia/video-helper | src/VideoHelper.php | VideoHelper.get_vimeo_id | public static function get_vimeo_id($input)
{
// match: https://vimeo.com/39502360
if (preg_match('#/vimeo.com/(\d+)#', $input, $matches)) {
return $matches[1];
}
// match: <iframe src="https://player.vimeo.com/video/39502360" width="640" height="480" frameborder="0" ...... | php | public static function get_vimeo_id($input)
{
// match: https://vimeo.com/39502360
if (preg_match('#/vimeo.com/(\d+)#', $input, $matches)) {
return $matches[1];
}
// match: <iframe src="https://player.vimeo.com/video/39502360" width="640" height="480" frameborder="0" ...... | [
"public",
"static",
"function",
"get_vimeo_id",
"(",
"$",
"input",
")",
"{",
"// match: https://vimeo.com/39502360",
"if",
"(",
"preg_match",
"(",
"'#/vimeo.com/(\\d+)#'",
",",
"$",
"input",
",",
"$",
"matches",
")",
")",
"{",
"return",
"$",
"matches",
"[",
"1... | Parses various vimeo urls and returns video identifier.
@param string $input The url or the embed code
@return string The url's id | [
"Parses",
"various",
"vimeo",
"urls",
"and",
"returns",
"video",
"identifier",
"."
] | 0ab5e775899d56ee9dc23314ca842c6275817487 | https://github.com/BenjaminMedia/video-helper/blob/0ab5e775899d56ee9dc23314ca842c6275817487/src/VideoHelper.php#L129-L142 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/elements/ElementService.php | ElementService.findAllWithAspect | public function findAllWithAspect($aspectName, $restrictSiteSlug = null)
{
// if (!$this->AspectService->getBySlug($aspectName))
// throw new Exception('Cannot find Elements with Aspect ['.$aspectName.'], Aspect does not exist');
$dto = new DTO();
$dto->setParameter("IncludesAspe... | php | public function findAllWithAspect($aspectName, $restrictSiteSlug = null)
{
// if (!$this->AspectService->getBySlug($aspectName))
// throw new Exception('Cannot find Elements with Aspect ['.$aspectName.'], Aspect does not exist');
$dto = new DTO();
$dto->setParameter("IncludesAspe... | [
"public",
"function",
"findAllWithAspect",
"(",
"$",
"aspectName",
",",
"$",
"restrictSiteSlug",
"=",
"null",
")",
"{",
"// if (!$this->AspectService->getBySlug($aspectName))",
"// throw new Exception('Cannot find Elements with Aspect ['.$aspectName.'], Aspect does not ... | Returns all elements that have the specified aspect
@param string $aspectName The name of the desired aspect
@return array An array of the results | [
"Returns",
"all",
"elements",
"that",
"have",
"the",
"specified",
"aspect"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/elements/ElementService.php#L52-L66 | train |
wb-crowdfusion/crowdfusion | system/core/classes/systemdb/elements/ElementService.php | ElementService.findAllFromString | public function findAllFromString($aspectsOrElements)
{
$results = array();
foreach (explode(',', $aspectsOrElements) as $aspectOrElement) {
$aspectOrElement = trim($aspectOrElement);
if (substr($aspectOrElement, 0, 1) == '@') {
$els = $this->findAllWithAspect... | php | public function findAllFromString($aspectsOrElements)
{
$results = array();
foreach (explode(',', $aspectsOrElements) as $aspectOrElement) {
$aspectOrElement = trim($aspectOrElement);
if (substr($aspectOrElement, 0, 1) == '@') {
$els = $this->findAllWithAspect... | [
"public",
"function",
"findAllFromString",
"(",
"$",
"aspectsOrElements",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"aspectsOrElements",
")",
"as",
"$",
"aspectOrElement",
")",
"{",
"$",
"aspect... | Returns all elements for given aspect names and element slugs
@param string $aspectOrElement Comma separated list of aspects names
and/or elements slugs
@return array An array of Element keyed by the elements' ids | [
"Returns",
"all",
"elements",
"for",
"given",
"aspect",
"names",
"and",
"element",
"slugs"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/systemdb/elements/ElementService.php#L76-L93 | train |
EXSyst/IO | StringReader.php | StringReader.read | public function read($byteCount, $allowIncomplete = false)
{
$maxByteCount = $this->getRemainingByteCount();
if (!$allowIncomplete && $maxByteCount < $byteCount) {
throw new Exception\UnderflowException('The source doesn\'t have enough remaining data to fulfill the request');
}
... | php | public function read($byteCount, $allowIncomplete = false)
{
$maxByteCount = $this->getRemainingByteCount();
if (!$allowIncomplete && $maxByteCount < $byteCount) {
throw new Exception\UnderflowException('The source doesn\'t have enough remaining data to fulfill the request');
}
... | [
"public",
"function",
"read",
"(",
"$",
"byteCount",
",",
"$",
"allowIncomplete",
"=",
"false",
")",
"{",
"$",
"maxByteCount",
"=",
"$",
"this",
"->",
"getRemainingByteCount",
"(",
")",
";",
"if",
"(",
"!",
"$",
"allowIncomplete",
"&&",
"$",
"maxByteCount"... | Reads and consumes data from the source.
@param int $byteCount Number of bytes to read
@param bool $allowIncomplete true to accept any amount of data smaller than or equal to the requested amount, false (default) to throw an exception if the exact requested amount cannot be read
@throws Exception\UnderflowExce... | [
"Reads",
"and",
"consumes",
"data",
"from",
"the",
"source",
"."
] | 4c30ba79b09d2cc41d0a7cd340255a87cac54326 | https://github.com/EXSyst/IO/blob/4c30ba79b09d2cc41d0a7cd340255a87cac54326/StringReader.php#L178-L190 | train |
jabernardo/lollipop-php | Library/Config.php | Config.set | static public function set($key, $value) {
$config = &self::$_config;
Utils::arraySet($config, $key, $value);
} | php | static public function set($key, $value) {
$config = &self::$_config;
Utils::arraySet($config, $key, $value);
} | [
"static",
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"config",
"=",
"&",
"self",
"::",
"$",
"_config",
";",
"Utils",
"::",
"arraySet",
"(",
"$",
"config",
",",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"
] | Add or set configuration key
@access public
@param string $key Configuration key
@param string $value Configuration value
@return void | [
"Add",
"or",
"set",
"configuration",
"key"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Config.php#L59-L63 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddTitleField | private function AddTitleField()
{
$name = 'Title';
$this->AddField(Input::Text($name, $this->page->GetTitle()));
} | php | private function AddTitleField()
{
$name = 'Title';
$this->AddField(Input::Text($name, $this->page->GetTitle()));
} | [
"private",
"function",
"AddTitleField",
"(",
")",
"{",
"$",
"name",
"=",
"'Title'",
";",
"$",
"this",
"->",
"AddField",
"(",
"Input",
"::",
"Text",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"page",
"->",
"GetTitle",
"(",
")",
")",
")",
";",
"}"
] | Adds the title field to the form | [
"Adds",
"the",
"title",
"field",
"to",
"the",
"form"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L251-L255 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddDescriptionField | private function AddDescriptionField()
{
$name = 'Description';
$this->AddField(Input::Text($name, $this->page->GetDescription()));
} | php | private function AddDescriptionField()
{
$name = 'Description';
$this->AddField(Input::Text($name, $this->page->GetDescription()));
} | [
"private",
"function",
"AddDescriptionField",
"(",
")",
"{",
"$",
"name",
"=",
"'Description'",
";",
"$",
"this",
"->",
"AddField",
"(",
"Input",
"::",
"Text",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"page",
"->",
"GetDescription",
"(",
")",
")",
")"... | Adds the description field to the form | [
"Adds",
"the",
"description",
"field",
"to",
"the",
"form"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L260-L264 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddKeywordsField | private function AddKeywordsField()
{
$name = 'Keywords';
$this->AddField(Input::Text($name, $this->page->GetKeywords()));
} | php | private function AddKeywordsField()
{
$name = 'Keywords';
$this->AddField(Input::Text($name, $this->page->GetKeywords()));
} | [
"private",
"function",
"AddKeywordsField",
"(",
")",
"{",
"$",
"name",
"=",
"'Keywords'",
";",
"$",
"this",
"->",
"AddField",
"(",
"Input",
"::",
"Text",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"page",
"->",
"GetKeywords",
"(",
")",
")",
")",
";",
... | Adds the keywords field to the form | [
"Adds",
"the",
"keywords",
"field",
"to",
"the",
"form"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L269-L273 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddLayoutField | private function AddLayoutField()
{
$name = 'Layout';
$select = new Select($name);
if ($this->page->Exists())
{
$select->SetValue($this->page->GetLayout()->GetID());
}
$select->AddOption('', Trans('Core.PleaseSelect'));
$sql = Access::SqlB... | php | private function AddLayoutField()
{
$name = 'Layout';
$select = new Select($name);
if ($this->page->Exists())
{
$select->SetValue($this->page->GetLayout()->GetID());
}
$select->AddOption('', Trans('Core.PleaseSelect'));
$sql = Access::SqlB... | [
"private",
"function",
"AddLayoutField",
"(",
")",
"{",
"$",
"name",
"=",
"'Layout'",
";",
"$",
"select",
"=",
"new",
"Select",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"this",
"->",
"page",
"->",
"Exists",
"(",
")",
")",
"{",
"$",
"select",
"... | Adds the layout field to the form | [
"Adds",
"the",
"layout",
"field",
"to",
"the",
"form"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L278-L299 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddMenuAccessField | private function AddMenuAccessField()
{
$name = 'MenuAccess';
$value = $this->page->Exists() ? $this->page->GetMenuAccess() : (string)MenuAccess::Authorized();
$select = new Select($name, $value);
foreach (MenuAccess::AllowedValues() as $access)
{
$select->AddOpti... | php | private function AddMenuAccessField()
{
$name = 'MenuAccess';
$value = $this->page->Exists() ? $this->page->GetMenuAccess() : (string)MenuAccess::Authorized();
$select = new Select($name, $value);
foreach (MenuAccess::AllowedValues() as $access)
{
$select->AddOpti... | [
"private",
"function",
"AddMenuAccessField",
"(",
")",
"{",
"$",
"name",
"=",
"'MenuAccess'",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"page",
"->",
"Exists",
"(",
")",
"?",
"$",
"this",
"->",
"page",
"->",
"GetMenuAccess",
"(",
")",
":",
"(",
"str... | Adds the menu access select | [
"Adds",
"the",
"menu",
"access",
"select"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L305-L316 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddPublishToHourField | private function AddPublishToHourField()
{
$name = 'PublishToHour';
$to = $this->page->GetPublishTo();
$field = Input::Text($name, $to ? $to->ToString('H') : '');
$field->SetHtmlAttribute('data-type', 'hour');
$this->AddField($field);
} | php | private function AddPublishToHourField()
{
$name = 'PublishToHour';
$to = $this->page->GetPublishTo();
$field = Input::Text($name, $to ? $to->ToString('H') : '');
$field->SetHtmlAttribute('data-type', 'hour');
$this->AddField($field);
} | [
"private",
"function",
"AddPublishToHourField",
"(",
")",
"{",
"$",
"name",
"=",
"'PublishToHour'",
";",
"$",
"to",
"=",
"$",
"this",
"->",
"page",
"->",
"GetPublishTo",
"(",
")",
";",
"$",
"field",
"=",
"Input",
"::",
"Text",
"(",
"$",
"name",
",",
... | Adds the publish to hour field | [
"Adds",
"the",
"publish",
"to",
"hour",
"field"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L382-L389 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddSitemapRelevanceField | private function AddSitemapRelevanceField()
{
$name = 'SitemapRelevance';
$value = $this->page->Exists() ? 10* $this->page->GetSitemapRelevance() : 7;
$field = new Select($name, $value);
for ($val = 0; $val <= 10; ++$val)
{
$decSep = Trans('Core.DecimalSeparator')... | php | private function AddSitemapRelevanceField()
{
$name = 'SitemapRelevance';
$value = $this->page->Exists() ? 10* $this->page->GetSitemapRelevance() : 7;
$field = new Select($name, $value);
for ($val = 0; $val <= 10; ++$val)
{
$decSep = Trans('Core.DecimalSeparator')... | [
"private",
"function",
"AddSitemapRelevanceField",
"(",
")",
"{",
"$",
"name",
"=",
"'SitemapRelevance'",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"page",
"->",
"Exists",
"(",
")",
"?",
"10",
"*",
"$",
"this",
"->",
"page",
"->",
"GetSitemapRelevance",
... | Adds the sitemap relevance field | [
"Adds",
"the",
"sitemap",
"relevance",
"field"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L404-L417 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AddSitemapChangeFrequencyField | private function AddSitemapChangeFrequencyField()
{
$name = 'SitemapChangeFrequency';
$value = $this->page->Exists() ? $this->page->GetSitemapChangeFrequency() :
(string)ChangeFrequency::Weekly();
$field = new Select($name, $value);
$values = ChangeFrequency::All... | php | private function AddSitemapChangeFrequencyField()
{
$name = 'SitemapChangeFrequency';
$value = $this->page->Exists() ? $this->page->GetSitemapChangeFrequency() :
(string)ChangeFrequency::Weekly();
$field = new Select($name, $value);
$values = ChangeFrequency::All... | [
"private",
"function",
"AddSitemapChangeFrequencyField",
"(",
")",
"{",
"$",
"name",
"=",
"'SitemapChangeFrequency'",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"page",
"->",
"Exists",
"(",
")",
"?",
"$",
"this",
"->",
"page",
"->",
"GetSitemapChangeFrequency"... | Adds the sitemap change frequency field | [
"Adds",
"the",
"sitemap",
"change",
"frequency",
"field"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L422-L435 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.OnSuccess | protected function OnSuccess()
{
$prevLayout = $this->page->GetLayout();
$this->page->SetName($this->Value('Name'));
$this->page->SetUrl($this->Value('Url'));
$this->page->SetSite($this->site);
$this->page->SetTitle($this->Value('Title'));
$this->page->SetDes... | php | protected function OnSuccess()
{
$prevLayout = $this->page->GetLayout();
$this->page->SetName($this->Value('Name'));
$this->page->SetUrl($this->Value('Url'));
$this->page->SetSite($this->site);
$this->page->SetTitle($this->Value('Title'));
$this->page->SetDes... | [
"protected",
"function",
"OnSuccess",
"(",
")",
"{",
"$",
"prevLayout",
"=",
"$",
"this",
"->",
"page",
"->",
"GetLayout",
"(",
")",
";",
"$",
"this",
"->",
"page",
"->",
"SetName",
"(",
"$",
"this",
"->",
"Value",
"(",
"'Name'",
")",
")",
";",
"$"... | Saves the page | [
"Saves",
"the",
"page"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L473-L514 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.ReassignContents | private function ReassignContents(Layout $prevLayout, Layout $newLayout)
{
if ($prevLayout->Equals($newLayout)) {
return;
}
$oldAreas = Area::Schema()->FetchByLayout(false, $prevLayout);
foreach ($oldAreas as $oldArea)
{
$newArea = $this->Find... | php | private function ReassignContents(Layout $prevLayout, Layout $newLayout)
{
if ($prevLayout->Equals($newLayout)) {
return;
}
$oldAreas = Area::Schema()->FetchByLayout(false, $prevLayout);
foreach ($oldAreas as $oldArea)
{
$newArea = $this->Find... | [
"private",
"function",
"ReassignContents",
"(",
"Layout",
"$",
"prevLayout",
",",
"Layout",
"$",
"newLayout",
")",
"{",
"if",
"(",
"$",
"prevLayout",
"->",
"Equals",
"(",
"$",
"newLayout",
")",
")",
"{",
"return",
";",
"}",
"$",
"oldAreas",
"=",
"Area",
... | Reassigns contents by area names if layout was changed
@param Layout $prevLayout The old layout
@param Layout $newLayout The new layout | [
"Reassigns",
"contents",
"by",
"area",
"names",
"if",
"layout",
"was",
"changed"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L521-L538 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.SaveRights | private function SaveRights()
{
$groupID = $this->Value('UserGroup');
$userGroup = Usergroup::Schema()->ByID($groupID);
$this->page->SetUserGroup($userGroup);
if (!$userGroup)
{
$oldRights = $this->page->GetUserGroupRights();
if ($oldRights)
... | php | private function SaveRights()
{
$groupID = $this->Value('UserGroup');
$userGroup = Usergroup::Schema()->ByID($groupID);
$this->page->SetUserGroup($userGroup);
if (!$userGroup)
{
$oldRights = $this->page->GetUserGroupRights();
if ($oldRights)
... | [
"private",
"function",
"SaveRights",
"(",
")",
"{",
"$",
"groupID",
"=",
"$",
"this",
"->",
"Value",
"(",
"'UserGroup'",
")",
";",
"$",
"userGroup",
"=",
"Usergroup",
"::",
"Schema",
"(",
")",
"->",
"ByID",
"(",
"$",
"groupID",
")",
";",
"$",
"this",... | Saves the group and right settings | [
"Saves",
"the",
"group",
"and",
"right",
"settings"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L621-L641 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.SaveMemberGroups | private function SaveMemberGroups()
{
$selectedIDs = Request::PostArray('MemberGroup');
if ($this->page->GetGuestsOnly())
{
$selectedIDs = array();
}
$exIDs = Membergroup::GetKeyList(MembergroupUtil::PageMembergroups($this->page));
$this->DeleteOldMemberGr... | php | private function SaveMemberGroups()
{
$selectedIDs = Request::PostArray('MemberGroup');
if ($this->page->GetGuestsOnly())
{
$selectedIDs = array();
}
$exIDs = Membergroup::GetKeyList(MembergroupUtil::PageMembergroups($this->page));
$this->DeleteOldMemberGr... | [
"private",
"function",
"SaveMemberGroups",
"(",
")",
"{",
"$",
"selectedIDs",
"=",
"Request",
"::",
"PostArray",
"(",
"'MemberGroup'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"page",
"->",
"GetGuestsOnly",
"(",
")",
")",
"{",
"$",
"selectedIDs",
"=",
"ar... | Saves the member groups | [
"Saves",
"the",
"member",
"groups"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L646-L656 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.DeleteOldMemberGroups | private function DeleteOldMemberGroups(array $selectedIDs)
{
$sql = Access::SqlBuilder();
$tblPgGrp = PageMembergroup::Schema()->Table();
$where = $sql->Equals($tblPgGrp->Field('Page'), $sql->Value($this->page->GetID()));
if (count($selectedIDs))
{
$inSelected = $... | php | private function DeleteOldMemberGroups(array $selectedIDs)
{
$sql = Access::SqlBuilder();
$tblPgGrp = PageMembergroup::Schema()->Table();
$where = $sql->Equals($tblPgGrp->Field('Page'), $sql->Value($this->page->GetID()));
if (count($selectedIDs))
{
$inSelected = $... | [
"private",
"function",
"DeleteOldMemberGroups",
"(",
"array",
"$",
"selectedIDs",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tblPgGrp",
"=",
"PageMembergroup",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$"... | Deletes the old member groups
@param array $selectedIDs The selected member ids | [
"Deletes",
"the",
"old",
"member",
"groups"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L662-L673 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.SaveNewMemberGroups | private function SaveNewMemberGroups(array $selectedIDs, array $exIDs)
{
foreach ($selectedIDs as $selID)
{
if (!in_array($selID, $exIDs))
{
$pgGrp = new PageMembergroup();
$pgGrp->SetPage($this->page);
$pgGrp->SetMemberGroup(ne... | php | private function SaveNewMemberGroups(array $selectedIDs, array $exIDs)
{
foreach ($selectedIDs as $selID)
{
if (!in_array($selID, $exIDs))
{
$pgGrp = new PageMembergroup();
$pgGrp->SetPage($this->page);
$pgGrp->SetMemberGroup(ne... | [
"private",
"function",
"SaveNewMemberGroups",
"(",
"array",
"$",
"selectedIDs",
",",
"array",
"$",
"exIDs",
")",
"{",
"foreach",
"(",
"$",
"selectedIDs",
"as",
"$",
"selID",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"selID",
",",
"$",
"exIDs",
")... | Saves page member groups not already assigned
@param array $selectedIDs The selected member group ids
@param array $exIDs The already assigned membergroup ids | [
"Saves",
"page",
"member",
"groups",
"not",
"already",
"assigned"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L680-L693 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.SaveNew | private function SaveNew()
{
$treeBuilder = new TreeBuilder(new PageTreeProvider($this->site));
$treeBuilder->Insert($this->page, $this->parent, $this->previous);
} | php | private function SaveNew()
{
$treeBuilder = new TreeBuilder(new PageTreeProvider($this->site));
$treeBuilder->Insert($this->page, $this->parent, $this->previous);
} | [
"private",
"function",
"SaveNew",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"new",
"PageTreeProvider",
"(",
"$",
"this",
"->",
"site",
")",
")",
";",
"$",
"treeBuilder",
"->",
"Insert",
"(",
"$",
"this",
"->",
"page",
",",
"$",... | Takes care of page tree insertion important for a fresh page | [
"Takes",
"care",
"of",
"page",
"tree",
"insertion",
"important",
"for",
"a",
"fresh",
"page"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L698-L702 | train |
agentmedia/phine-core | src/Core/Modules/Backend/PageForm.php | PageForm.AdjustHtaccess | private function AdjustHtaccess()
{
$file = Path::Combine(PHINE_PATH, 'Public/.htaccess');
if (!File::Exists($file))
{
throw new \Exception('HTACCESS FILE $file NOT FOUND');
}
$writer = new Writer();
$rewriter = new Rewriter($writer);
$text = File:... | php | private function AdjustHtaccess()
{
$file = Path::Combine(PHINE_PATH, 'Public/.htaccess');
if (!File::Exists($file))
{
throw new \Exception('HTACCESS FILE $file NOT FOUND');
}
$writer = new Writer();
$rewriter = new Rewriter($writer);
$text = File:... | [
"private",
"function",
"AdjustHtaccess",
"(",
")",
"{",
"$",
"file",
"=",
"Path",
"::",
"Combine",
"(",
"PHINE_PATH",
",",
"'Public/.htaccess'",
")",
";",
"if",
"(",
"!",
"File",
"::",
"Exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"\\",
... | Adds necessary rewrite commands | [
"Adds",
"necessary",
"rewrite",
"commands"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/PageForm.php#L707-L741 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Service/Classified.php | Classified.get | public function get($idOrDocument)
{
$modelFetcher = $this->getServiceLocator()->get('document.model.fetcher');
$this->getEventManager()->trigger(__FUNCTION__, $this, array('document' => $idOrDocument));
$classifiedModel = $modelFetcher->get($idOrDocument);
$this->getEventManager()->trigger(__FUNCTION__ . ... | php | public function get($idOrDocument)
{
$modelFetcher = $this->getServiceLocator()->get('document.model.fetcher');
$this->getEventManager()->trigger(__FUNCTION__, $this, array('document' => $idOrDocument));
$classifiedModel = $modelFetcher->get($idOrDocument);
$this->getEventManager()->trigger(__FUNCTION__ . ... | [
"public",
"function",
"get",
"(",
"$",
"idOrDocument",
")",
"{",
"$",
"modelFetcher",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'document.model.fetcher'",
")",
";",
"$",
"this",
"->",
"getEventManager",
"(",
")",
"->",
"trig... | Get a classified model
@param unknown $idOrDocument
@return Document\Model\Classified | [
"Get",
"a",
"classified",
"model"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Service/Classified.php#L82-L90 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Service/Classified.php | Classified.expired | public function expired($limit = 10)
{
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$em = $main->getEntityManager();
$cache = $this->getServiceLocator()->get('ClassifiedCache');
$documentRepository = $main->getDocumentEntityRepository();
$documents = $documentRepository->getExpiredE... | php | public function expired($limit = 10)
{
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$em = $main->getEntityManager();
$cache = $this->getServiceLocator()->get('ClassifiedCache');
$documentRepository = $main->getDocumentEntityRepository();
$documents = $documentRepository->getExpiredE... | [
"public",
"function",
"expired",
"(",
"$",
"limit",
"=",
"10",
")",
"{",
"$",
"main",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'neobazaar.service.main'",
")",
";",
"$",
"em",
"=",
"$",
"main",
"->",
"getEntityManager",
... | This service will trigger event with expired classifieds.
anything binded with these events will run
@param int $limit
@return array with document ids | [
"This",
"service",
"will",
"trigger",
"event",
"with",
"expired",
"classifieds",
".",
"anything",
"binded",
"with",
"these",
"events",
"will",
"run"
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Service/Classified.php#L99-L138 | train |
kaiohken1982/NeobazaarDocumentModule | src/Document/Service/Classified.php | Classified.activationEmailResend | public function activationEmailResend($limit = 10)
{
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$em = $main->getEntityManager();
$cache = $this->getServiceLocator()->get('ClassifiedCache');
$documentRepository = $main->getDocumentEntityRepository();
$documents = $documentRepositor... | php | public function activationEmailResend($limit = 10)
{
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$em = $main->getEntityManager();
$cache = $this->getServiceLocator()->get('ClassifiedCache');
$documentRepository = $main->getDocumentEntityRepository();
$documents = $documentRepositor... | [
"public",
"function",
"activationEmailResend",
"(",
"$",
"limit",
"=",
"10",
")",
"{",
"$",
"main",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'neobazaar.service.main'",
")",
";",
"$",
"em",
"=",
"$",
"main",
"->",
"getEnti... | This service will trigger event with classifieds that needs activetion email to be resent.
@param int $limit
@return array with document ids | [
"This",
"service",
"will",
"trigger",
"event",
"with",
"classifieds",
"that",
"needs",
"activetion",
"email",
"to",
"be",
"resent",
"."
] | edb0223878fe02e791d2a0266c5a7c0f2029e3fe | https://github.com/kaiohken1982/NeobazaarDocumentModule/blob/edb0223878fe02e791d2a0266c5a7c0f2029e3fe/src/Document/Service/Classified.php#L146-L182 | train |
PenoaksDev/Milky-Framework | src/Milky/Helpers/Str.php | Str.indent | public static function indent( $lines, $cnt = 1 )
{
$new = [];
$lines = str_contains( $lines, '\r\n' ) ? explode( "\r\n", $lines ) : explode( "\n", $lines );
foreach ( $lines as $line )
$new[] = str_repeat( "\t", $cnt ) . $line;
return implode( "\n", $new );
} | php | public static function indent( $lines, $cnt = 1 )
{
$new = [];
$lines = str_contains( $lines, '\r\n' ) ? explode( "\r\n", $lines ) : explode( "\n", $lines );
foreach ( $lines as $line )
$new[] = str_repeat( "\t", $cnt ) . $line;
return implode( "\n", $new );
} | [
"public",
"static",
"function",
"indent",
"(",
"$",
"lines",
",",
"$",
"cnt",
"=",
"1",
")",
"{",
"$",
"new",
"=",
"[",
"]",
";",
"$",
"lines",
"=",
"str_contains",
"(",
"$",
"lines",
",",
"'\\r\\n'",
")",
"?",
"explode",
"(",
"\"\\r\\n\"",
",",
... | Indents each line
@param string $lines
@param int $cnt
@return string | [
"Indents",
"each",
"line"
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Helpers/Str.php#L1053-L1062 | train |
PenoaksDev/Milky-Framework | src/Milky/Helpers/Str.php | Str.prependLines | public static function prependLines( $lines, $prepend, $prependFirstLine = false )
{
$new = [];
$lines = str_contains( $lines, '\r\n' ) ? explode( "\r\n", $lines ) : explode( "\n", $lines );
if ( !$prependFirstLine )
$new[] = $lines[0];
for ( $i = $prependFirstLine ? 0 : 1; $i < count( $lines ); $i++ )
... | php | public static function prependLines( $lines, $prepend, $prependFirstLine = false )
{
$new = [];
$lines = str_contains( $lines, '\r\n' ) ? explode( "\r\n", $lines ) : explode( "\n", $lines );
if ( !$prependFirstLine )
$new[] = $lines[0];
for ( $i = $prependFirstLine ? 0 : 1; $i < count( $lines ); $i++ )
... | [
"public",
"static",
"function",
"prependLines",
"(",
"$",
"lines",
",",
"$",
"prepend",
",",
"$",
"prependFirstLine",
"=",
"false",
")",
"{",
"$",
"new",
"=",
"[",
"]",
";",
"$",
"lines",
"=",
"str_contains",
"(",
"$",
"lines",
",",
"'\\r\\n'",
")",
... | Prepends each line
@param string $lines
@param string $prepend
$param bool $prependFirstLine
@return string | [
"Prepends",
"each",
"line"
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Helpers/Str.php#L1073-L1085 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/Country.php | KlarnaCountry.getCode | public static function getCode($val, $alpha3 = false)
{
if (self::$_countryFlip === array()) {
self::$_countryFlip = array_flip(self::$_countries);
}
if (!array_key_exists($val, self::$_countryFlip)) {
return null;
}
$result = self::$_countryFlip[$val]... | php | public static function getCode($val, $alpha3 = false)
{
if (self::$_countryFlip === array()) {
self::$_countryFlip = array_flip(self::$_countries);
}
if (!array_key_exists($val, self::$_countryFlip)) {
return null;
}
$result = self::$_countryFlip[$val]... | [
"public",
"static",
"function",
"getCode",
"(",
"$",
"val",
",",
"$",
"alpha3",
"=",
"false",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_countryFlip",
"===",
"array",
"(",
")",
")",
"{",
"self",
"::",
"$",
"_countryFlip",
"=",
"array_flip",
"(",
"self... | Converts a KlarnaCountry constant to the respective country code.
@param int $val KlarnaCountry constant
@param bool $alpha3 Whether to return a ISO-3166-1 alpha-3 code
@return string|null | [
"Converts",
"a",
"KlarnaCountry",
"constant",
"to",
"the",
"respective",
"country",
"code",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Country.php#L117-L130 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/Country.php | KlarnaCountry.checkLanguage | public static function checkLanguage($country, $language)
{
switch($country) {
case KlarnaCountry::AT:
case KlarnaCountry::DE:
return ($language === KlarnaLanguage::DE);
case KlarnaCountry::NL:
return ($language === KlarnaLanguage::NL);
case KlarnaCoun... | php | public static function checkLanguage($country, $language)
{
switch($country) {
case KlarnaCountry::AT:
case KlarnaCountry::DE:
return ($language === KlarnaLanguage::DE);
case KlarnaCountry::NL:
return ($language === KlarnaLanguage::NL);
case KlarnaCoun... | [
"public",
"static",
"function",
"checkLanguage",
"(",
"$",
"country",
",",
"$",
"language",
")",
"{",
"switch",
"(",
"$",
"country",
")",
"{",
"case",
"KlarnaCountry",
"::",
"AT",
":",
"case",
"KlarnaCountry",
"::",
"DE",
":",
"return",
"(",
"$",
"langua... | Checks country against currency and returns true if they match.
@param int $country {@link KlarnaCountry}
@param int $language {@link KlarnaLanguage}
@deprecated Do not use.
@return bool | [
"Checks",
"country",
"against",
"currency",
"and",
"returns",
"true",
"if",
"they",
"match",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Country.php#L142-L162 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/Country.php | KlarnaCountry.checkCurrency | public static function checkCurrency($country, $currency)
{
switch($country) {
case KlarnaCountry::AT:
case KlarnaCountry::DE:
case KlarnaCountry::NL:
case KlarnaCountry::FI:
return ($currency === KlarnaCurrency::EUR);
case KlarnaCountry::DK:
r... | php | public static function checkCurrency($country, $currency)
{
switch($country) {
case KlarnaCountry::AT:
case KlarnaCountry::DE:
case KlarnaCountry::NL:
case KlarnaCountry::FI:
return ($currency === KlarnaCurrency::EUR);
case KlarnaCountry::DK:
r... | [
"public",
"static",
"function",
"checkCurrency",
"(",
"$",
"country",
",",
"$",
"currency",
")",
"{",
"switch",
"(",
"$",
"country",
")",
"{",
"case",
"KlarnaCountry",
"::",
"AT",
":",
"case",
"KlarnaCountry",
"::",
"DE",
":",
"case",
"KlarnaCountry",
"::"... | Checks country against language and returns true if they match.
@param int $country {@link KlarnaCountry}
@param int $currency {@link KlarnaCurrency}
@deprecated Do not use.
@return bool | [
"Checks",
"country",
"against",
"language",
"and",
"returns",
"true",
"if",
"they",
"match",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Country.php#L173-L191 | train |
Subscribo/klarna-invoice-sdk-wrapped | src/Country.php | KlarnaCountry.getLanguage | public static function getLanguage($country)
{
switch($country) {
case KlarnaCountry::AT:
case KlarnaCountry::DE:
return KlarnaLanguage::DE;
case KlarnaCountry::NL:
return KlarnaLanguage::NL;
case KlarnaCountry::FI:
return KlarnaLanguage::F... | php | public static function getLanguage($country)
{
switch($country) {
case KlarnaCountry::AT:
case KlarnaCountry::DE:
return KlarnaLanguage::DE;
case KlarnaCountry::NL:
return KlarnaLanguage::NL;
case KlarnaCountry::FI:
return KlarnaLanguage::F... | [
"public",
"static",
"function",
"getLanguage",
"(",
"$",
"country",
")",
"{",
"switch",
"(",
"$",
"country",
")",
"{",
"case",
"KlarnaCountry",
"::",
"AT",
":",
"case",
"KlarnaCountry",
"::",
"DE",
":",
"return",
"KlarnaLanguage",
"::",
"DE",
";",
"case",
... | Get language for supplied country. Defaults to English.
@param int $country KlarnaCountry constant
@deprecated Do not use.
@return int | [
"Get",
"language",
"for",
"supplied",
"country",
".",
"Defaults",
"to",
"English",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/Country.php#L201-L220 | train |
ptlis/grep-db | src/Metadata/MySQL/ColumnMetadata.php | ColumnMetadata.isStringType | public function isStringType()
{
$stringTypeList = [
'char',
'varchar',
'tinyblob',
'blob',
'mediumblob',
'longblob',
'tinytext',
'text',
'mediumtext',
'longtext'
];
$isStr... | php | public function isStringType()
{
$stringTypeList = [
'char',
'varchar',
'tinyblob',
'blob',
'mediumblob',
'longblob',
'tinytext',
'text',
'mediumtext',
'longtext'
];
$isStr... | [
"public",
"function",
"isStringType",
"(",
")",
"{",
"$",
"stringTypeList",
"=",
"[",
"'char'",
",",
"'varchar'",
",",
"'tinyblob'",
",",
"'blob'",
",",
"'mediumblob'",
",",
"'longblob'",
",",
"'tinytext'",
",",
"'text'",
",",
"'mediumtext'",
",",
"'longtext'"... | Returns true if the column is a string type.
List validated against https://dev.mysql.com/doc/refman/5.7/en/string-types.html | [
"Returns",
"true",
"if",
"the",
"column",
"is",
"a",
"string",
"type",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/ColumnMetadata.php#L106-L129 | train |
Dhii/exception-helper-base | src/CreateInvalidArgumentExceptionCapableTrait.php | CreateInvalidArgumentExceptionCapableTrait._createInvalidArgumentException | protected function _createInvalidArgumentException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new InvalidArgumentException($message, $code, $previous, $argument);
} | php | protected function _createInvalidArgumentException(
$message = null,
$code = null,
RootException $previous = null,
$argument = null
) {
return new InvalidArgumentException($message, $code, $previous, $argument);
} | [
"protected",
"function",
"_createInvalidArgumentException",
"(",
"$",
"message",
"=",
"null",
",",
"$",
"code",
"=",
"null",
",",
"RootException",
"$",
"previous",
"=",
"null",
",",
"$",
"argument",
"=",
"null",
")",
"{",
"return",
"new",
"InvalidArgumentExcep... | Creates a new Dhii invalid argument exception.
@since [*next-version*]
@param string|Stringable|int|float|bool|null $message The message, if any.
@param int|float|string|Stringable|null $code The numeric error code, if any.
@param RootException|null $previous The inner exception, if any.
... | [
"Creates",
"a",
"new",
"Dhii",
"invalid",
"argument",
"exception",
"."
] | e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5 | https://github.com/Dhii/exception-helper-base/blob/e97bfa6c0f79ea079e36b2f1d8f84d7566a3ccf5/src/CreateInvalidArgumentExceptionCapableTrait.php#L27-L34 | train |
fulgurio/LightCMSBundle | Controller/AdminPageController.php | AdminPageController.createPage | private function createPage($page, $options, $models)
{
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$data = $request->get('page');
$page->setModel($data['model']);
}
$formClassName = isset($models[$page->getModel()]['back']['... | php | private function createPage($page, $options, $models)
{
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$data = $request->get('page');
$page->setModel($data['model']);
}
$formClassName = isset($models[$page->getModel()]['back']['... | [
"private",
"function",
"createPage",
"(",
"$",
"page",
",",
"$",
"options",
",",
"$",
"models",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
"==",
"'POST'",
"... | Create form for page entity, use for edit or add page
@param Page $page
@param array $options
@param array $models
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response | [
"Create",
"form",
"for",
"page",
"entity",
"use",
"for",
"edit",
"or",
"add",
"page"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Controller/AdminPageController.php#L131-L177 | train |
fulgurio/LightCMSBundle | Controller/AdminPageController.php | AdminPageController.removeAction | public function removeAction($pageId)
{
$page = $this->getPage($pageId);
if ($page->getSlug() == '')
{
throw new AccessDeniedException();
}
$request = $this->getRequest();
if ($request->request->get('confirm') === 'yes')
{
if ($this->co... | php | public function removeAction($pageId)
{
$page = $this->getPage($pageId);
if ($page->getSlug() == '')
{
throw new AccessDeniedException();
}
$request = $this->getRequest();
if ($request->request->get('confirm') === 'yes')
{
if ($this->co... | [
"public",
"function",
"removeAction",
"(",
"$",
"pageId",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"getPage",
"(",
"$",
"pageId",
")",
";",
"if",
"(",
"$",
"page",
"->",
"getSlug",
"(",
")",
"==",
"''",
")",
"{",
"throw",
"new",
"AccessDenied... | Remove page, with confirm form
@param number $pageId | [
"Remove",
"page",
"with",
"confirm",
"form"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Controller/AdminPageController.php#L184-L226 | train |
fulgurio/LightCMSBundle | Controller/AdminPageController.php | AdminPageController.copyAction | public function copyAction($sourceId, $targetId, $lang)
{
$em = $this->getDoctrine()->getManager();
$source = $this->getPage($sourceId);
$target = $this->getPage($targetId);
$newPage = clone($source);
$newPage->setParent($target);
// Children page
if ($target-... | php | public function copyAction($sourceId, $targetId, $lang)
{
$em = $this->getDoctrine()->getManager();
$source = $this->getPage($sourceId);
$target = $this->getPage($targetId);
$newPage = clone($source);
$newPage->setParent($target);
// Children page
if ($target-... | [
"public",
"function",
"copyAction",
"(",
"$",
"sourceId",
",",
"$",
"targetId",
",",
"$",
"lang",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"source",
"=",
"$",
"this",
"->",
"getPa... | Page copy, use for multilang site
@param number $sourceId
@param number $targetId
@param string $lang
@return \Symfony\Component\HttpFoundation\Response> | [
"Page",
"copy",
"use",
"for",
"multilang",
"site"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Controller/AdminPageController.php#L236-L257 | train |
fulgurio/LightCMSBundle | Controller/AdminPageController.php | AdminPageController.changePositionAction | public function changePositionAction()
{
$request = $this->getRequest();
if ($request->isXmlHttpRequest())
{
$em = $this->getDoctrine()->getManager();
$pageRepository = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:Page');
$page = $this->getP... | php | public function changePositionAction()
{
$request = $this->getRequest();
if ($request->isXmlHttpRequest())
{
$em = $this->getDoctrine()->getManager();
$pageRepository = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:Page');
$page = $this->getP... | [
"public",
"function",
"changePositionAction",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",... | Change page position using ajax tree
@return type
@throws AccessDeniedException | [
"Change",
"page",
"position",
"using",
"ajax",
"tree"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Controller/AdminPageController.php#L265-L308 | train |
fulgurio/LightCMSBundle | Controller/AdminPageController.php | AdminPageController.getPageMetas | private function getPageMetas($pageId)
{
$pageMetas = array();
$metas = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:PageMeta')->findByPage($pageId);
foreach ($metas as $meta)
{
$pageMetas[$meta->getMetaKey()] = $meta;
}
return $pageMetas;
... | php | private function getPageMetas($pageId)
{
$pageMetas = array();
$metas = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:PageMeta')->findByPage($pageId);
foreach ($metas as $meta)
{
$pageMetas[$meta->getMetaKey()] = $meta;
}
return $pageMetas;
... | [
"private",
"function",
"getPageMetas",
"(",
"$",
"pageId",
")",
"{",
"$",
"pageMetas",
"=",
"array",
"(",
")",
";",
"$",
"metas",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getRepository",
"(",
"'FulgurioLightCMSBundle:PageMeta'",
")",
"->",
"... | Get meta data from given ID page
@param number $pageId
@return array | [
"Get",
"meta",
"data",
"from",
"given",
"ID",
"page"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Controller/AdminPageController.php#L333-L342 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.