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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.getListenerEvents | protected function getListenerEvents(
$listener,
/*# string */ $eventName = ''
)/*# : array */ {
// check listener
if (!$this->isListener($listener)) {
throw new Exception\InvalidArgumentException(
Message::get(
Message::INVALID_EVENT_L... | php | protected function getListenerEvents(
$listener,
/*# string */ $eventName = ''
)/*# : array */ {
// check listener
if (!$this->isListener($listener)) {
throw new Exception\InvalidArgumentException(
Message::get(
Message::INVALID_EVENT_L... | [
"protected",
"function",
"getListenerEvents",
"(",
"$",
"listener",
",",
"/*# string */",
"$",
"eventName",
"=",
"''",
")",
"/*# : array */",
"{",
"// check listener",
"if",
"(",
"!",
"$",
"this",
"->",
"isListener",
"(",
"$",
"listener",
")",
")",
"{",
"thr... | Get listener events array
@param EventListenerInterface|string $listener object/static class name
@param string $eventName event name or '' for all events
@return array
@throws Exception\InvalidArgumentException
if $listener not a valid listener
@access protected | [
"Get",
"listener",
"events",
"array"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L277-L312 | train |
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.makeCallables | protected function makeCallables(
$listener,
$callable,
/*# int */ $priority
)/*# : array */ {
$result = [];
if (is_array($callable)) {
if (isset($callable[1]) && is_int($callable[1])) {
$priority = $callable[1];
$xc = $callable[0];... | php | protected function makeCallables(
$listener,
$callable,
/*# int */ $priority
)/*# : array */ {
$result = [];
if (is_array($callable)) {
if (isset($callable[1]) && is_int($callable[1])) {
$priority = $callable[1];
$xc = $callable[0];... | [
"protected",
"function",
"makeCallables",
"(",
"$",
"listener",
",",
"$",
"callable",
",",
"/*# int */",
"$",
"priority",
")",
"/*# : array */",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"callable",
")",
")",
"{",
"if",
"... | Returns an array of callables
@param EventListenerInterface|string $listener object/static class name
@param mixed $callable user defined callables
@param int $priority priority
@return array
@access protected | [
"Returns",
"an",
"array",
"of",
"callables"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L323-L355 | train |
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.attachIt | protected function attachIt(
/*# string */ $eventName,
$listener,
$callable,
/*# int */ $priority
) {
// get named event queue
if ($this->hasEventQueue($eventName)) {
$q = $this->getEventQueue($eventName);
} else {
$q = new EventQueue()... | php | protected function attachIt(
/*# string */ $eventName,
$listener,
$callable,
/*# int */ $priority
) {
// get named event queue
if ($this->hasEventQueue($eventName)) {
$q = $this->getEventQueue($eventName);
} else {
$q = new EventQueue()... | [
"protected",
"function",
"attachIt",
"(",
"/*# string */",
"$",
"eventName",
",",
"$",
"listener",
",",
"$",
"callable",
",",
"/*# int */",
"$",
"priority",
")",
"{",
"// get named event queue",
"if",
"(",
"$",
"this",
"->",
"hasEventQueue",
"(",
"$",
"eventNa... | Attach callable to event queque
@param string $eventName event name
@param EventListenerInterface|string|null $listener
object/static class name or a callable
@param mixed $callable string | array
@param int $priority priority integer
@return void
@throws Exception\InvalidArgumentException
if callable is the wrong... | [
"Attach",
"callable",
"to",
"event",
"queque"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L370-L411 | train |
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.detachIt | protected function detachIt(
/*# string */ $eventName,
$listener,
$callable
) {
// queue not found
if ($eventName != '' && !$this->hasEventQueue($eventName)) {
return;
}
// detach callable directly
if (is_null($listener)) {
$xc... | php | protected function detachIt(
/*# string */ $eventName,
$listener,
$callable
) {
// queue not found
if ($eventName != '' && !$this->hasEventQueue($eventName)) {
return;
}
// detach callable directly
if (is_null($listener)) {
$xc... | [
"protected",
"function",
"detachIt",
"(",
"/*# string */",
"$",
"eventName",
",",
"$",
"listener",
",",
"$",
"callable",
")",
"{",
"// queue not found",
"if",
"(",
"$",
"eventName",
"!=",
"''",
"&&",
"!",
"$",
"this",
"->",
"hasEventQueue",
"(",
"$",
"even... | Detach callable to event queque
@param string $eventName event name
@param EventListenerInterface|string|null $listener
object/static class name or a callable
@param mixed $callable string | array
@return void
@throws Exception\InvalidArgumentException
if callable is the wrong format
@access protected | [
"Detach",
"callable",
"to",
"event",
"queque"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L425-L472 | train |
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.matchEventQueue | protected function matchEventQueue(
/*# string */ $eventName,
EventManagerInterface $manager
)/*# : EventQueueInterface */ {
$names = $this->globNames($eventName, $manager->getEventNames());
// combine all globbing queue
$queue = new EventQueue();
foreach ($names as ... | php | protected function matchEventQueue(
/*# string */ $eventName,
EventManagerInterface $manager
)/*# : EventQueueInterface */ {
$names = $this->globNames($eventName, $manager->getEventNames());
// combine all globbing queue
$queue = new EventQueue();
foreach ($names as ... | [
"protected",
"function",
"matchEventQueue",
"(",
"/*# string */",
"$",
"eventName",
",",
"EventManagerInterface",
"$",
"manager",
")",
"/*# : EventQueueInterface */",
"{",
"$",
"names",
"=",
"$",
"this",
"->",
"globNames",
"(",
"$",
"eventName",
",",
"$",
"manager... | Match proper event queue with globbing support
Including queues with globbing event names
@param string $eventName event name to match
@param EventManagerInterface $manager which manager to look at
@return EventQueueInterface
@access protected | [
"Match",
"proper",
"event",
"queue",
"with",
"globbing",
"support"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L484-L499 | train |
phossa/phossa-event | src/Phossa/Event/Interfaces/EventManagerTrait.php | EventManagerTrait.globNames | protected function globNames(
/*# string */ $eventName,
array $names
)/*# : array */ {
$result = [];
foreach ($names as $n) {
if ($n === '*' || $n === $eventName || $eventName === '') {
$result[] = $n;
} elseif (strpos($n, '*') !== false) {
... | php | protected function globNames(
/*# string */ $eventName,
array $names
)/*# : array */ {
$result = [];
foreach ($names as $n) {
if ($n === '*' || $n === $eventName || $eventName === '') {
$result[] = $n;
} elseif (strpos($n, '*') !== false) {
... | [
"protected",
"function",
"globNames",
"(",
"/*# string */",
"$",
"eventName",
",",
"array",
"$",
"names",
")",
"/*# : array */",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"n",
"===... | Return those globbing event names based on the given one
e.g.
Matching specific name 'login.MobileFail' with those '*',
'login.*', 'login.*Fail'
@param string $eventName specific event name
@param string[] $names name array to search thru
@return string[]
@access protected | [
"Return",
"those",
"globbing",
"event",
"names",
"based",
"on",
"the",
"given",
"one"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Interfaces/EventManagerTrait.php#L513-L529 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.from | public function from($table, string $alias = null): self
{
return $this->table($table, $alias);
} | php | public function from($table, string $alias = null): self
{
return $this->table($table, $alias);
} | [
"public",
"function",
"from",
"(",
"$",
"table",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"table",
"(",
"$",
"table",
",",
"$",
"alias",
")",
";",
"}"
] | Table method alias
@see Query::table For reference
@param string|\Closure|Query|StatementInterface $table
@param string|null $alias
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Table",
"method",
"alias"
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L34-L37 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.addSelect | public function addSelect($columns, string $alias = null): self
{
if (!is_array($columns)) {
if ($alias === null) {
$columns = [$columns];
} else {
$columns = [$alias => $columns];
}
}
foreach ($columns as $alias => $column... | php | public function addSelect($columns, string $alias = null): self
{
if (!is_array($columns)) {
if ($alias === null) {
$columns = [$columns];
} else {
$columns = [$alias => $columns];
}
}
foreach ($columns as $alias => $column... | [
"public",
"function",
"addSelect",
"(",
"$",
"columns",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"columns",
")",
")",
"{",
"if",
"(",
"$",
"alias",
"===",
"null",
")",
"{",
"$",
"colum... | Adds column or columns to the SELECT section.
@param string|\Closure|Query|StatementInterface|string[]|\Closure[]|Query[]|StatementInterface[] $columns Columns
to add. If string or raw, one column is added. If array, many columns are added and string indexes are
treated as aliases.
@param string|null $alias Column ali... | [
"Adds",
"column",
"or",
"columns",
"to",
"the",
"SELECT",
"section",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L50-L71 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.addCount | public function addCount($column = '*', string $alias = null): self
{
return $this->addAggregate('COUNT', $column, $alias);
} | php | public function addCount($column = '*', string $alias = null): self
{
return $this->addAggregate('COUNT', $column, $alias);
} | [
"public",
"function",
"addCount",
"(",
"$",
"column",
"=",
"'*'",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"addAggregate",
"(",
"'COUNT'",
",",
"$",
"column",
",",
"$",
"alias",
")",
";",
"}"
] | Adds a COUNT aggregate to the SELECT section.
@param string|\Closure|Query|StatementInterface $column Column to count
@param string|null $alias Aggregate alias name
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"COUNT",
"aggregate",
"to",
"the",
"SELECT",
"section",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L82-L85 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.addAvg | public function addAvg($column, string $alias = null): self
{
return $this->addAggregate('AVG', $column, $alias);
} | php | public function addAvg($column, string $alias = null): self
{
return $this->addAggregate('AVG', $column, $alias);
} | [
"public",
"function",
"addAvg",
"(",
"$",
"column",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"addAggregate",
"(",
"'AVG'",
",",
"$",
"column",
",",
"$",
"alias",
")",
";",
"}"
] | Adds a AVG aggregate to the SELECT section.
@param string|\Closure|Query|StatementInterface $column Column to get average
@param string|null $alias Aggregate alias name
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"AVG",
"aggregate",
"to",
"the",
"SELECT",
"section",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L96-L99 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.addSum | public function addSum($column, string $alias = null): self
{
return $this->addAggregate('SUM', $column, $alias);
} | php | public function addSum($column, string $alias = null): self
{
return $this->addAggregate('SUM', $column, $alias);
} | [
"public",
"function",
"addSum",
"(",
"$",
"column",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"addAggregate",
"(",
"'SUM'",
",",
"$",
"column",
",",
"$",
"alias",
")",
";",
"}"
] | Adds a SUM aggregate to the SELECT section.
@param string|\Closure|Query|StatementInterface $column Column to get sum
@param string|null $alias Aggregate alias name
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"SUM",
"aggregate",
"to",
"the",
"SELECT",
"section",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L110-L113 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.addMin | public function addMin($column, string $alias = null): self
{
return $this->addAggregate('MIN', $column, $alias);
} | php | public function addMin($column, string $alias = null): self
{
return $this->addAggregate('MIN', $column, $alias);
} | [
"public",
"function",
"addMin",
"(",
"$",
"column",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"addAggregate",
"(",
"'MIN'",
",",
"$",
"column",
",",
"$",
"alias",
")",
";",
"}"
] | Adds a MIN aggregate to the SELECT section.
@param string|\Closure|Query|StatementInterface $column Column to get min
@param string|null $alias Aggregate alias name
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"MIN",
"aggregate",
"to",
"the",
"SELECT",
"section",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L124-L127 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.addMax | public function addMax($column, string $alias = null): self
{
return $this->addAggregate('MAX', $column, $alias);
} | php | public function addMax($column, string $alias = null): self
{
return $this->addAggregate('MAX', $column, $alias);
} | [
"public",
"function",
"addMax",
"(",
"$",
"column",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"return",
"$",
"this",
"->",
"addAggregate",
"(",
"'MAX'",
",",
"$",
"column",
",",
"$",
"alias",
")",
";",
"}"
] | Adds a MAX aggregate to the SELECT section.
@param string|\Closure|Query|StatementInterface $column Column to get max
@param string|null $alias Aggregate alias name
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"MAX",
"aggregate",
"to",
"the",
"SELECT",
"section",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L138-L141 | train |
Finesse/QueryScribe | src/QueryBricks/SelectTrait.php | SelectTrait.addAggregate | protected function addAggregate(string $function, $column, string $alias = null): self
{
$column = $this->checkStringValue('Argument $column', $column);
$aggregate = new Aggregate($function, $column);
if ($alias === null) {
$this->select[] = $aggregate;
} else {
... | php | protected function addAggregate(string $function, $column, string $alias = null): self
{
$column = $this->checkStringValue('Argument $column', $column);
$aggregate = new Aggregate($function, $column);
if ($alias === null) {
$this->select[] = $aggregate;
} else {
... | [
"protected",
"function",
"addAggregate",
"(",
"string",
"$",
"function",
",",
"$",
"column",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"checkStringValue",
"(",
"'Argument $column'",
",",
"$",
... | Adds an arbitrary aggregate to the SELECT section.
@param string $function Aggregate function name
@param string|\Closure|Query|StatementInterface $column Column to count (not prefixed)
@param string|null $alias Aggregate alias name
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"an",
"arbitrary",
"aggregate",
"to",
"the",
"SELECT",
"section",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/SelectTrait.php#L153-L165 | train |
itkg/core | src/Itkg/Core/Command/DatabaseUpdate/Runner.php | Runner.run | public function run(Migration $migration, $executeQueries = false, $forcedRollback = false)
{
$this->migration = $migration;
try {
$this->playQueries($executeQueries);
if ($forcedRollback) {
$this->playRollbackQueries($executeQueries);
}
}... | php | public function run(Migration $migration, $executeQueries = false, $forcedRollback = false)
{
$this->migration = $migration;
try {
$this->playQueries($executeQueries);
if ($forcedRollback) {
$this->playRollbackQueries($executeQueries);
}
}... | [
"public",
"function",
"run",
"(",
"Migration",
"$",
"migration",
",",
"$",
"executeQueries",
"=",
"false",
",",
"$",
"forcedRollback",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"migration",
"=",
"$",
"migration",
";",
"try",
"{",
"$",
"this",
"->",
"p... | Run a migration
@param Migration $migration
@param bool $executeQueries
@param bool $forcedRollback
@throws \Exception
@throws Migration\Exception
@return void | [
"Run",
"a",
"migration"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/Runner.php#L65-L79 | train |
itkg/core | src/Itkg/Core/Command/DatabaseUpdate/Runner.php | Runner.playQueries | private function playQueries($executeQueries = false)
{
foreach ($this->migration->getQueries() as $idx => $query) {
try {
$this->runQuery($query, $executeQueries);
} catch (\Exception $e) {
// Only throw if more than one query is played
... | php | private function playQueries($executeQueries = false)
{
foreach ($this->migration->getQueries() as $idx => $query) {
try {
$this->runQuery($query, $executeQueries);
} catch (\Exception $e) {
// Only throw if more than one query is played
... | [
"private",
"function",
"playQueries",
"(",
"$",
"executeQueries",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"migration",
"->",
"getQueries",
"(",
")",
"as",
"$",
"idx",
"=>",
"$",
"query",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"ru... | Play Script queries
@param bool $executeQueries
@throws Migration\Exception
@throws \Exception
@return void | [
"Play",
"Script",
"queries"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/Runner.php#L89-L103 | train |
itkg/core | src/Itkg/Core/Command/DatabaseUpdate/Runner.php | Runner.playRollbackQueries | private function playRollbackQueries($executeQueries = false)
{
foreach ($this->migration->getRollbackQueries() as $query) {
$this->runQuery($query, $executeQueries);
}
} | php | private function playRollbackQueries($executeQueries = false)
{
foreach ($this->migration->getRollbackQueries() as $query) {
$this->runQuery($query, $executeQueries);
}
} | [
"private",
"function",
"playRollbackQueries",
"(",
"$",
"executeQueries",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"migration",
"->",
"getRollbackQueries",
"(",
")",
"as",
"$",
"query",
")",
"{",
"$",
"this",
"->",
"runQuery",
"(",
"$",
... | Play rollback queries
@param bool $executeQueries
@return void | [
"Play",
"rollback",
"queries"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/Runner.php#L111-L116 | train |
itkg/core | src/Itkg/Core/Command/DatabaseUpdate/Runner.php | Runner.runQuery | private function runQuery(Query $query, $executeQueries = false)
{
$this->playedQueries[] = $query;
if ($executeQueries) {
$this->connection->executeQuery((string)$query);
}
} | php | private function runQuery(Query $query, $executeQueries = false)
{
$this->playedQueries[] = $query;
if ($executeQueries) {
$this->connection->executeQuery((string)$query);
}
} | [
"private",
"function",
"runQuery",
"(",
"Query",
"$",
"query",
",",
"$",
"executeQueries",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"playedQueries",
"[",
"]",
"=",
"$",
"query",
";",
"if",
"(",
"$",
"executeQueries",
")",
"{",
"$",
"this",
"->",
"c... | Run a query if execute query is true
else simply add query to played queries stack
@param Query $query
@param bool $executeQueries | [
"Run",
"a",
"query",
"if",
"execute",
"query",
"is",
"true",
"else",
"simply",
"add",
"query",
"to",
"played",
"queries",
"stack"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/DatabaseUpdate/Runner.php#L125-L131 | train |
Wedeto/IO | src/DirReader.php | DirReader.rewind | public function rewind()
{
$this->dir->rewind();
$this->iter = 0;
$this->hasNext();
$this->cur_entry = $this->next_entry;
$this->next_entry = null;
} | php | public function rewind()
{
$this->dir->rewind();
$this->iter = 0;
$this->hasNext();
$this->cur_entry = $this->next_entry;
$this->next_entry = null;
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"$",
"this",
"->",
"dir",
"->",
"rewind",
"(",
")",
";",
"$",
"this",
"->",
"iter",
"=",
"0",
";",
"$",
"this",
"->",
"hasNext",
"(",
")",
";",
"$",
"this",
"->",
"cur_entry",
"=",
"$",
"this",
"->... | Rewind the directory reader to the start | [
"Rewind",
"the",
"directory",
"reader",
"to",
"the",
"start"
] | 4cfeaedd1bd9bda3097d18cb12233a4afecb2e85 | https://github.com/Wedeto/IO/blob/4cfeaedd1bd9bda3097d18cb12233a4afecb2e85/src/DirReader.php#L106-L113 | train |
ZhukV/AppleModel | src/Apple/Model/Software.php | Software.setPlatform | public function setPlatform($platform)
{
if (!in_array($platform, array(Software::PLATFORM_MAC, Software::PLATFORM_IOS), true)) {
throw new \InvalidArgumentException(sprintf('Undefined software platform "%s".', $platform));
}
$this->platform = $platform;
return $this;
... | php | public function setPlatform($platform)
{
if (!in_array($platform, array(Software::PLATFORM_MAC, Software::PLATFORM_IOS), true)) {
throw new \InvalidArgumentException(sprintf('Undefined software platform "%s".', $platform));
}
$this->platform = $platform;
return $this;
... | [
"public",
"function",
"setPlatform",
"(",
"$",
"platform",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"platform",
",",
"array",
"(",
"Software",
"::",
"PLATFORM_MAC",
",",
"Software",
"::",
"PLATFORM_IOS",
")",
",",
"true",
")",
")",
"{",
"throw",
... | Set software platform
@param integer $platform
@return Software
@throws \InvalidArgumentException | [
"Set",
"software",
"platform"
] | 3ab06d560b7c442b8ebafdd95d1d2523b40ef903 | https://github.com/ZhukV/AppleModel/blob/3ab06d560b7c442b8ebafdd95d1d2523b40ef903/src/Apple/Model/Software.php#L235-L244 | train |
ZhukV/AppleModel | src/Apple/Model/Software.php | Software.setUserRatingCount | public function setUserRatingCount($userRatingCount)
{
$userRatingCount = (int) $userRatingCount;
if ($userRatingCount < 0) {
throw new \InvalidArgumentException(sprintf(
'User rating can\'t be less than "0", "%s" given.',
$userRatingCount
));... | php | public function setUserRatingCount($userRatingCount)
{
$userRatingCount = (int) $userRatingCount;
if ($userRatingCount < 0) {
throw new \InvalidArgumentException(sprintf(
'User rating can\'t be less than "0", "%s" given.',
$userRatingCount
));... | [
"public",
"function",
"setUserRatingCount",
"(",
"$",
"userRatingCount",
")",
"{",
"$",
"userRatingCount",
"=",
"(",
"int",
")",
"$",
"userRatingCount",
";",
"if",
"(",
"$",
"userRatingCount",
"<",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException... | Set user rating count
@param integer $userRatingCount
@return Software
@throws \InvalidArgumentException | [
"Set",
"user",
"rating",
"count"
] | 3ab06d560b7c442b8ebafdd95d1d2523b40ef903 | https://github.com/ZhukV/AppleModel/blob/3ab06d560b7c442b8ebafdd95d1d2523b40ef903/src/Apple/Model/Software.php#L712-L726 | train |
ZhukV/AppleModel | src/Apple/Model/Software.php | Software.setAverageUserRating | public function setAverageUserRating($averageUserRating)
{
$averageUserRating = (float) $averageUserRating;
if ($averageUserRating < 0 || $averageUserRating > 5) {
throw new \InvalidArgumentException(sprintf(
'Average user rating must be between 0 and 5, "%s" given.',
... | php | public function setAverageUserRating($averageUserRating)
{
$averageUserRating = (float) $averageUserRating;
if ($averageUserRating < 0 || $averageUserRating > 5) {
throw new \InvalidArgumentException(sprintf(
'Average user rating must be between 0 and 5, "%s" given.',
... | [
"public",
"function",
"setAverageUserRating",
"(",
"$",
"averageUserRating",
")",
"{",
"$",
"averageUserRating",
"=",
"(",
"float",
")",
"$",
"averageUserRating",
";",
"if",
"(",
"$",
"averageUserRating",
"<",
"0",
"||",
"$",
"averageUserRating",
">",
"5",
")"... | Set user average rating
@param float $averageUserRating
@return Software
@throws \InvalidArgumentException | [
"Set",
"user",
"average",
"rating"
] | 3ab06d560b7c442b8ebafdd95d1d2523b40ef903 | https://github.com/ZhukV/AppleModel/blob/3ab06d560b7c442b8ebafdd95d1d2523b40ef903/src/Apple/Model/Software.php#L747-L768 | train |
ZhukV/AppleModel | src/Apple/Model/Software.php | Software.setUserRatingCountCurrent | public function setUserRatingCountCurrent($userRatingCountCurrent)
{
$userRatingCountCurrent = (int) $userRatingCountCurrent;
if ($userRatingCountCurrent < 0) {
throw new \InvalidArgumentException(sprintf(
'User rating can\'t be less than "0", "%s" given.',
... | php | public function setUserRatingCountCurrent($userRatingCountCurrent)
{
$userRatingCountCurrent = (int) $userRatingCountCurrent;
if ($userRatingCountCurrent < 0) {
throw new \InvalidArgumentException(sprintf(
'User rating can\'t be less than "0", "%s" given.',
... | [
"public",
"function",
"setUserRatingCountCurrent",
"(",
"$",
"userRatingCountCurrent",
")",
"{",
"$",
"userRatingCountCurrent",
"=",
"(",
"int",
")",
"$",
"userRatingCountCurrent",
";",
"if",
"(",
"$",
"userRatingCountCurrent",
"<",
"0",
")",
"{",
"throw",
"new",
... | Set user rating count for current version
@param integer $userRatingCountCurrent
@return Software
@throws \InvalidArgumentException | [
"Set",
"user",
"rating",
"count",
"for",
"current",
"version"
] | 3ab06d560b7c442b8ebafdd95d1d2523b40ef903 | https://github.com/ZhukV/AppleModel/blob/3ab06d560b7c442b8ebafdd95d1d2523b40ef903/src/Apple/Model/Software.php#L789-L803 | train |
ZhukV/AppleModel | src/Apple/Model/Software.php | Software.setAverageUserRatingCurrent | public function setAverageUserRatingCurrent($averageUserRatingCurrent)
{
$averageUserRatingCurrent = (float) $averageUserRatingCurrent;
if ($averageUserRatingCurrent < 0 || $averageUserRatingCurrent > 5) {
throw new \InvalidArgumentException(sprintf(
'Average user rating... | php | public function setAverageUserRatingCurrent($averageUserRatingCurrent)
{
$averageUserRatingCurrent = (float) $averageUserRatingCurrent;
if ($averageUserRatingCurrent < 0 || $averageUserRatingCurrent > 5) {
throw new \InvalidArgumentException(sprintf(
'Average user rating... | [
"public",
"function",
"setAverageUserRatingCurrent",
"(",
"$",
"averageUserRatingCurrent",
")",
"{",
"$",
"averageUserRatingCurrent",
"=",
"(",
"float",
")",
"$",
"averageUserRatingCurrent",
";",
"if",
"(",
"$",
"averageUserRatingCurrent",
"<",
"0",
"||",
"$",
"aver... | Set average user rating for current version
@param float $averageUserRatingCurrent
@return Software
@throws \InvalidArgumentException | [
"Set",
"average",
"user",
"rating",
"for",
"current",
"version"
] | 3ab06d560b7c442b8ebafdd95d1d2523b40ef903 | https://github.com/ZhukV/AppleModel/blob/3ab06d560b7c442b8ebafdd95d1d2523b40ef903/src/Apple/Model/Software.php#L824-L845 | train |
ciims/ciims-modules-api | controllers/EventController.php | EventController.actionIndex | public function actionIndex()
{
$model = new Events('search');
$model->unsetAttributes();
if (isset($_GET['Event']))
$model->attributes = $_GET['Event'];
$dataProvider = $model->search();
$dataProvider->pagination = array(
'pageVar' => 'page'
);
// Throw a 404 if we exceed the numbe... | php | public function actionIndex()
{
$model = new Events('search');
$model->unsetAttributes();
if (isset($_GET['Event']))
$model->attributes = $_GET['Event'];
$dataProvider = $model->search();
$dataProvider->pagination = array(
'pageVar' => 'page'
);
// Throw a 404 if we exceed the numbe... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"Events",
"(",
"'search'",
")",
";",
"$",
"model",
"->",
"unsetAttributes",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"'Event'",
"]",
")",
")",
"$",
"mode... | Provides functionality to search through events | [
"Provides",
"functionality",
"to",
"search",
"through",
"events"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/EventController.php#L25-L51 | train |
ciims/ciims-modules-api | controllers/EventController.php | EventController.actionPageviews | public function actionPageviews()
{
$models = Events::model()->groupByUrl()->findAll();
$response = array();
foreach ($models as $model)
$response[] = array(
'uri' => $model->uri,
'count' => $model->id
);
return $response;
} | php | public function actionPageviews()
{
$models = Events::model()->groupByUrl()->findAll();
$response = array();
foreach ($models as $model)
$response[] = array(
'uri' => $model->uri,
'count' => $model->id
);
return $response;
} | [
"public",
"function",
"actionPageviews",
"(",
")",
"{",
"$",
"models",
"=",
"Events",
"::",
"model",
"(",
")",
"->",
"groupByUrl",
"(",
")",
"->",
"findAll",
"(",
")",
";",
"$",
"response",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"models",
... | Shows pageview results
@return array | [
"Shows",
"pageview",
"results"
] | 4351855328da0b112ac27bde7e7e07e212be8689 | https://github.com/ciims/ciims-modules-api/blob/4351855328da0b112ac27bde7e7e07e212be8689/controllers/EventController.php#L57-L69 | train |
fridge-project/dbal | src/Fridge/DBAL/Schema/PrimaryKey.php | PrimaryKey.setColumnNames | public function setColumnNames(array $columnNames)
{
$this->columnNames = array();
foreach ($columnNames as $columnName) {
$this->addColumnName($columnName);
}
} | php | public function setColumnNames(array $columnNames)
{
$this->columnNames = array();
foreach ($columnNames as $columnName) {
$this->addColumnName($columnName);
}
} | [
"public",
"function",
"setColumnNames",
"(",
"array",
"$",
"columnNames",
")",
"{",
"$",
"this",
"->",
"columnNames",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"columnNames",
"as",
"$",
"columnName",
")",
"{",
"$",
"this",
"->",
"addColumnName",
... | Sets the column names.
@param array $columnNames The column names. | [
"Sets",
"the",
"column",
"names",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/PrimaryKey.php#L56-L63 | train |
black-lamp/blcms-cart | frontend/controllers/OrderController.php | OrderController.actionShowOrderList | public function actionShowOrderList() {
if (!\Yii::$app->user->isGuest) {
$userOrders = \Yii::$app->cart->getAllUserOrders();
$filterModel = new OrderSearch();
$dataProvider = $filterModel->search(Yii::$app->request->get());
return $this->render('order-list', [
... | php | public function actionShowOrderList() {
if (!\Yii::$app->user->isGuest) {
$userOrders = \Yii::$app->cart->getAllUserOrders();
$filterModel = new OrderSearch();
$dataProvider = $filterModel->search(Yii::$app->request->get());
return $this->render('order-list', [
... | [
"public",
"function",
"actionShowOrderList",
"(",
")",
"{",
"if",
"(",
"!",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"isGuest",
")",
"{",
"$",
"userOrders",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"cart",
"->",
"getAllUserOrders",
"(",
")... | Return list of user orders.
@return array Order
@throws NotFoundHttpException | [
"Return",
"list",
"of",
"user",
"orders",
"."
] | 314796eecae3ca4ed5fecfdc0231a738af50eba7 | https://github.com/black-lamp/blcms-cart/blob/314796eecae3ca4ed5fecfdc0231a738af50eba7/frontend/controllers/OrderController.php#L24-L37 | train |
wobblecode/WobbleCodeUserBundle | Manager/RoleManager.php | RoleManager.switchOrganization | public function switchOrganization(User $user, OrganizationInterface $organization)
{
$role = $this->getOrganizationRole($user, $organization);
if ($role == false && !$this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) {
throw new NotFoundHttpException('Roles in organization not... | php | public function switchOrganization(User $user, OrganizationInterface $organization)
{
$role = $this->getOrganizationRole($user, $organization);
if ($role == false && !$this->authorizationChecker->isGranted('ROLE_SUPER_ADMIN')) {
throw new NotFoundHttpException('Roles in organization not... | [
"public",
"function",
"switchOrganization",
"(",
"User",
"$",
"user",
",",
"OrganizationInterface",
"$",
"organization",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"getOrganizationRole",
"(",
"$",
"user",
",",
"$",
"organization",
")",
";",
"if",
"(",
... | Switch the working organization of logged user
@todo update security context calls. Deprecated since version 2.6, to be
removed in 3.0. Use AuthorizationCheckerInterface::isGranted() instead.
http://symfony.com/blog/new-in-symfony-2-6-security-component-improvements
@param User $user
@param OrganizationInterf... | [
"Switch",
"the",
"working",
"organization",
"of",
"logged",
"user"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/RoleManager.php#L89-L115 | train |
wobblecode/WobbleCodeUserBundle | Manager/RoleManager.php | RoleManager.getOrganizationRole | public function getOrganizationRole($user, $organization)
{
return $this->dm->getRepository('WobbleCodeUserBundle:Role')->findOneBy(
[
'organization.$id' => new \MongoId($organization->getId()),
'user.$id' => new \MongoId($user->getId())
]
);
... | php | public function getOrganizationRole($user, $organization)
{
return $this->dm->getRepository('WobbleCodeUserBundle:Role')->findOneBy(
[
'organization.$id' => new \MongoId($organization->getId()),
'user.$id' => new \MongoId($user->getId())
]
);
... | [
"public",
"function",
"getOrganizationRole",
"(",
"$",
"user",
",",
"$",
"organization",
")",
"{",
"return",
"$",
"this",
"->",
"dm",
"->",
"getRepository",
"(",
"'WobbleCodeUserBundle:Role'",
")",
"->",
"findOneBy",
"(",
"[",
"'organization.$id'",
"=>",
"new",
... | Get user role definition within an organization
@param User $user
@param OrganizationInterface $organizatgion
@return (Role|false) | [
"Get",
"user",
"role",
"definition",
"within",
"an",
"organization"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/RoleManager.php#L141-L149 | train |
Dhii/config | src/DereferencingConfigMapFactory.php | DereferencingConfigMapFactory._createProduct | protected function _createProduct($config, $data)
{
$className = static::PRODUCT_CLASS_NAME;
$referenceContainer = $this->_getReferenceContainer($config);
return new $className($data, $referenceContainer);
} | php | protected function _createProduct($config, $data)
{
$className = static::PRODUCT_CLASS_NAME;
$referenceContainer = $this->_getReferenceContainer($config);
return new $className($data, $referenceContainer);
} | [
"protected",
"function",
"_createProduct",
"(",
"$",
"config",
",",
"$",
"data",
")",
"{",
"$",
"className",
"=",
"static",
"::",
"PRODUCT_CLASS_NAME",
";",
"$",
"referenceContainer",
"=",
"$",
"this",
"->",
"_getReferenceContainer",
"(",
"$",
"config",
")",
... | Creates a new factory product.
@since [*next-version*]
@param array|ArrayAccess|BaseContainerInterface|stdClass|null $config The data for the new product instance.
@param array|stdClass|ArrayObject $data The data for the new product instance.
@throws InvalidArgumentException If the data... | [
"Creates",
"a",
"new",
"factory",
"product",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/DereferencingConfigMapFactory.php#L124-L130 | train |
Dhii/config | src/DereferencingConfigMapFactory.php | DereferencingConfigMapFactory._getReferenceContainer | protected function _getReferenceContainer($config)
{
try {
$container = $this->_containerHas($config, static::K_REFERENCE_CONTAINER)
? $this->_containerGet($config, static::K_REFERENCE_CONTAINER)
: $this->_getContainer();
} catch (RootException $e) {
... | php | protected function _getReferenceContainer($config)
{
try {
$container = $this->_containerHas($config, static::K_REFERENCE_CONTAINER)
? $this->_containerGet($config, static::K_REFERENCE_CONTAINER)
: $this->_getContainer();
} catch (RootException $e) {
... | [
"protected",
"function",
"_getReferenceContainer",
"(",
"$",
"config",
")",
"{",
"try",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"_containerHas",
"(",
"$",
"config",
",",
"static",
"::",
"K_REFERENCE_CONTAINER",
")",
"?",
"$",
"this",
"->",
"_container... | Retrieves the reference container to create the child with.
@since [*next-version*]
@param array|ArrayAccess|BaseContainerInterface|stdClass|null $config The config of the product, the child of which to get the container for.
@throws RuntimeException If the reference container could not be retrieved.
@return BaseCo... | [
"Retrieves",
"the",
"reference",
"container",
"to",
"create",
"the",
"child",
"with",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/DereferencingConfigMapFactory.php#L153-L164 | train |
bytic/orm | src/Traits/ActiveRecord/ActiveRecordsTrait.php | ActiveRecordsTrait.insert | public function insert($model, $onDuplicate = false)
{
$query = $this->insertQuery($model, $onDuplicate);
$query->execute();
return $this->getDB()->lastInsertID();
} | php | public function insert($model, $onDuplicate = false)
{
$query = $this->insertQuery($model, $onDuplicate);
$query->execute();
return $this->getDB()->lastInsertID();
} | [
"public",
"function",
"insert",
"(",
"$",
"model",
",",
"$",
"onDuplicate",
"=",
"false",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"insertQuery",
"(",
"$",
"model",
",",
"$",
"onDuplicate",
")",
";",
"$",
"query",
"->",
"execute",
"(",
")",
... | Inserts a Record into the database
@param Record $model
@param array|bool $onDuplicate
@return integer | [
"Inserts",
"a",
"Record",
"into",
"the",
"database"
] | 8d9a79b47761af0bfd9b8d1d28c83221dcac0de0 | https://github.com/bytic/orm/blob/8d9a79b47761af0bfd9b8d1d28c83221dcac0de0/src/Traits/ActiveRecord/ActiveRecordsTrait.php#L110-L116 | train |
bytic/orm | src/Traits/ActiveRecord/ActiveRecordsTrait.php | ActiveRecordsTrait.update | public function update(Record $model)
{
$query = $this->updateQuery($model);
if ($query) {
return $query->execute();
}
return false;
} | php | public function update(Record $model)
{
$query = $this->updateQuery($model);
if ($query) {
return $query->execute();
}
return false;
} | [
"public",
"function",
"update",
"(",
"Record",
"$",
"model",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"updateQuery",
"(",
"$",
"model",
")",
";",
"if",
"(",
"$",
"query",
")",
"{",
"return",
"$",
"query",
"->",
"execute",
"(",
")",
";",
"}... | Updates a Record's database entry
@param Record $model
@return bool|Result | [
"Updates",
"a",
"Record",
"s",
"database",
"entry"
] | 8d9a79b47761af0bfd9b8d1d28c83221dcac0de0 | https://github.com/bytic/orm/blob/8d9a79b47761af0bfd9b8d1d28c83221dcac0de0/src/Traits/ActiveRecord/ActiveRecordsTrait.php#L150-L159 | train |
bytic/orm | src/Traits/ActiveRecord/ActiveRecordsTrait.php | ActiveRecordsTrait.save | public function save(Record $model)
{
$pk = $this->getPrimaryKey();
if (isset($model->{$pk})) {
$model->update();
return $model->{$pk};
} else {
/** @var Record $previous */
$previous = $model->exists();
if ($previous) {
... | php | public function save(Record $model)
{
$pk = $this->getPrimaryKey();
if (isset($model->{$pk})) {
$model->update();
return $model->{$pk};
} else {
/** @var Record $previous */
$previous = $model->exists();
if ($previous) {
... | [
"public",
"function",
"save",
"(",
"Record",
"$",
"model",
")",
"{",
"$",
"pk",
"=",
"$",
"this",
"->",
"getPrimaryKey",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"model",
"->",
"{",
"$",
"pk",
"}",
")",
")",
"{",
"$",
"model",
"->",
"update... | Saves a Record's database entry
@param Record $model
@return mixed | [
"Saves",
"a",
"Record",
"s",
"database",
"entry"
] | 8d9a79b47761af0bfd9b8d1d28c83221dcac0de0 | https://github.com/bytic/orm/blob/8d9a79b47761af0bfd9b8d1d28c83221dcac0de0/src/Traits/ActiveRecord/ActiveRecordsTrait.php#L203-L232 | train |
sil-project/SeedBatchBundle | src/Entity/OuterExtension/HasSeedBatches.php | HasSeedBatches.addSeedBatch | public function addSeedBatch($seedBatch)
{
$this->seedBatches[] = $seedBatch;
if (method_exists(get_class($this), 'setProducer')) {
$seedBatch->setProducer($this);
}
return $this;
} | php | public function addSeedBatch($seedBatch)
{
$this->seedBatches[] = $seedBatch;
if (method_exists(get_class($this), 'setProducer')) {
$seedBatch->setProducer($this);
}
return $this;
} | [
"public",
"function",
"addSeedBatch",
"(",
"$",
"seedBatch",
")",
"{",
"$",
"this",
"->",
"seedBatches",
"[",
"]",
"=",
"$",
"seedBatch",
";",
"if",
"(",
"method_exists",
"(",
"get_class",
"(",
"$",
"this",
")",
",",
"'setProducer'",
")",
")",
"{",
"$"... | Add seed batch.
@param SeedBatch $seedBatch
@return self | [
"Add",
"seed",
"batch",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/OuterExtension/HasSeedBatches.php#L32-L41 | train |
itkg/core | src/Itkg/Core/Cache/Listener/CacheListener.php | CacheListener.fetchEntityFromCache | public function fetchEntityFromCache(EntityLoadEvent $event)
{
$entity = $event->getEntity();
// Check cache
if (false !== $data = $this->cache->get($entity)) {
// Set data from cache to entity object
$entity->setDataFromCache($data);
$entity->setIsLoaded... | php | public function fetchEntityFromCache(EntityLoadEvent $event)
{
$entity = $event->getEntity();
// Check cache
if (false !== $data = $this->cache->get($entity)) {
// Set data from cache to entity object
$entity->setDataFromCache($data);
$entity->setIsLoaded... | [
"public",
"function",
"fetchEntityFromCache",
"(",
"EntityLoadEvent",
"$",
"event",
")",
"{",
"$",
"entity",
"=",
"$",
"event",
"->",
"getEntity",
"(",
")",
";",
"// Check cache",
"if",
"(",
"false",
"!==",
"$",
"data",
"=",
"$",
"this",
"->",
"cache",
"... | Load data from cache
@param EntityLoadEvent $event
@return void | [
"Load",
"data",
"from",
"cache"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Cache/Listener/CacheListener.php#L52-L64 | train |
guni12/comment | src/Comments/HTMLForm/UpdateCommForm.php | UpdateCommForm.decode | public function decode($fromjson)
{
$textfilter = $this->di->get("textfilter");
$toparse = json_decode($fromjson);
$comt = $textfilter->parse($toparse->text, ["yamlfrontmatter", "shortcode", "markdown", "titlefromheader"]);
$comt = strip_tags($comt->text);
return $comt;
} | php | public function decode($fromjson)
{
$textfilter = $this->di->get("textfilter");
$toparse = json_decode($fromjson);
$comt = $textfilter->parse($toparse->text, ["yamlfrontmatter", "shortcode", "markdown", "titlefromheader"]);
$comt = strip_tags($comt->text);
return $comt;
} | [
"public",
"function",
"decode",
"(",
"$",
"fromjson",
")",
"{",
"$",
"textfilter",
"=",
"$",
"this",
"->",
"di",
"->",
"get",
"(",
"\"textfilter\"",
")",
";",
"$",
"toparse",
"=",
"json_decode",
"(",
"$",
"fromjson",
")",
";",
"$",
"comt",
"=",
"$",
... | Converts json-string back to variables
@param string $fromjson the jsoncode
@return the extracted comment-text | [
"Converts",
"json",
"-",
"string",
"back",
"to",
"variables"
] | f9c2f3e2093fea414867f548c5f5e07f96c55bfd | https://github.com/guni12/comment/blob/f9c2f3e2093fea414867f548c5f5e07f96c55bfd/src/Comments/HTMLForm/UpdateCommForm.php#L36-L43 | train |
Wedeto/HTTP | src/Forms/Form.php | Form.isSubmitted | public function isSubmitted(Request $request)
{
$arguments = $this->method === "GET" ? $request->get : $request->post;
// Check if the form has been submitted at all
return $this->method === $request->method && $arguments['_form_name'] === $this->name;
} | php | public function isSubmitted(Request $request)
{
$arguments = $this->method === "GET" ? $request->get : $request->post;
// Check if the form has been submitted at all
return $this->method === $request->method && $arguments['_form_name'] === $this->name;
} | [
"public",
"function",
"isSubmitted",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"method",
"===",
"\"GET\"",
"?",
"$",
"request",
"->",
"get",
":",
"$",
"request",
"->",
"post",
";",
"// Check if the form has been subm... | Check if the form has been submitted
@return bool True if the form was submitted, false if not | [
"Check",
"if",
"the",
"form",
"has",
"been",
"submitted"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/Form.php#L203-L209 | train |
Wedeto/HTTP | src/Forms/Form.php | Form.isValid | public function isValid(Request $request)
{
$arguments = $this->method === "GET" ? $request->get : $request->post;
$files = $request->files;
if (!$this->validate($arguments, $files))
return false;
$params = ['form' => $this, 'request' => $request, 'valid' => true, 'argu... | php | public function isValid(Request $request)
{
$arguments = $this->method === "GET" ? $request->get : $request->post;
$files = $request->files;
if (!$this->validate($arguments, $files))
return false;
$params = ['form' => $this, 'request' => $request, 'valid' => true, 'argu... | [
"public",
"function",
"isValid",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"method",
"===",
"\"GET\"",
"?",
"$",
"request",
"->",
"get",
":",
"$",
"request",
"->",
"post",
";",
"$",
"files",
"=",
"$",
"reques... | Check if the form submission is valid
@param Request $request The request containing the submitted data
@return bool True when the submission is valid, false otherwise | [
"Check",
"if",
"the",
"form",
"submission",
"is",
"valid"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/Form.php#L216-L243 | train |
Wedeto/HTTP | src/Forms/Form.php | Form.validate | public function validate(Dictionary $arguments, Dictionary $files)
{
// Check all submitted values
$complete = true;
$this->errors = [];
$this->value = [];
foreach ($this->form_elements as $name => $element)
{
if ($element instanceof Form)
{
... | php | public function validate(Dictionary $arguments, Dictionary $files)
{
// Check all submitted values
$complete = true;
$this->errors = [];
$this->value = [];
foreach ($this->form_elements as $name => $element)
{
if ($element instanceof Form)
{
... | [
"public",
"function",
"validate",
"(",
"Dictionary",
"$",
"arguments",
",",
"Dictionary",
"$",
"files",
")",
"{",
"// Check all submitted values",
"$",
"complete",
"=",
"true",
";",
"$",
"this",
"->",
"errors",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"value... | Make sure the form was submitted correctly. When errors occur,
these can be obtained using getErrors.
@param Dictionary $arguments The submitted arguments
@param Dictionary $files The submitted files
@return bool True if all fields validate, false if not. | [
"Make",
"sure",
"the",
"form",
"was",
"submitted",
"correctly",
".",
"When",
"errors",
"occur",
"these",
"can",
"be",
"obtained",
"using",
"getErrors",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/Form.php#L291-L328 | train |
Wedeto/HTTP | src/Forms/Form.php | Form.validateAsSubForm | public function validateAsSubForm(Dictionary $arguments, Dictionary $files)
{
$name = $this->name;
if (!$arguments->has($name, Type::ARRAY))
{
$this->errors = [];
if ($this->isRequired())
{
$this->errors = ['' => ['msg' => "{name} is requir... | php | public function validateAsSubForm(Dictionary $arguments, Dictionary $files)
{
$name = $this->name;
if (!$arguments->has($name, Type::ARRAY))
{
$this->errors = [];
if ($this->isRequired())
{
$this->errors = ['' => ['msg' => "{name} is requir... | [
"public",
"function",
"validateAsSubForm",
"(",
"Dictionary",
"$",
"arguments",
",",
"Dictionary",
"$",
"files",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"name",
";",
"if",
"(",
"!",
"$",
"arguments",
"->",
"has",
"(",
"$",
"name",
",",
"Type",
... | Validate the form as a sub form
@param Dictionary $arguments The submitted data
@param Dictionary $files The submitted files
@return True if the form valides, false if not. | [
"Validate",
"the",
"form",
"as",
"a",
"sub",
"form"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/Form.php#L345-L396 | train |
Wedeto/HTTP | src/Forms/Form.php | Form.prepare | public function prepare(Session $session = null, bool $is_root_form = true)
{
foreach ($this->form_elements as $field)
{
if ($field instanceof Form)
$field->prepare(null, false);
}
$params = ['form' => $this, 'session' => $session, 'is_root_form' => $is_r... | php | public function prepare(Session $session = null, bool $is_root_form = true)
{
foreach ($this->form_elements as $field)
{
if ($field instanceof Form)
$field->prepare(null, false);
}
$params = ['form' => $this, 'session' => $session, 'is_root_form' => $is_r... | [
"public",
"function",
"prepare",
"(",
"Session",
"$",
"session",
"=",
"null",
",",
"bool",
"$",
"is_root_form",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"form_elements",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"instanceo... | Prepare the form for rendering. This will generate the nonce and add the form name
@param Session $session The session used to generate the nonce. Omit to skip adding a nonce
@param bool $is_root_form Whether this is the root form or not. When
false, the _form_name element is not added
@return Form Provides fluent inte... | [
"Prepare",
"the",
"form",
"for",
"rendering",
".",
"This",
"will",
"generate",
"the",
"nonce",
"and",
"add",
"the",
"form",
"name"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/Form.php#L405-L421 | train |
Wedeto/HTTP | src/Forms/Form.php | Form.offsetSet | public function offsetSet($offset, $value)
{
if (!($value instanceof FormField))
throw new InvalidArgumentException("Value must be a FormField");
$this->form_elements[$offset] = $value;
} | php | public function offsetSet($offset, $value)
{
if (!($value instanceof FormField))
throw new InvalidArgumentException("Value must be a FormField");
$this->form_elements[$offset] = $value;
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"value",
"instanceof",
"FormField",
")",
")",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Value must be a FormField\"",
")",
";",
"$",
"this... | Add or replace a form element
@param string $offset The name of the element
@param FormElement $element The element to set | [
"Add",
"or",
"replace",
"a",
"form",
"element"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Forms/Form.php#L493-L499 | train |
shrink0r/php-schema | src/Factory.php | Factory.verifyClassMap | protected function verifyClassMap(array $classMap)
{
foreach ($classMap as $type => $class) {
if (!class_exists($class)) {
throw new Exception("Class '$class' that has been registered for type '$type' does not exist");
}
if (!in_array(PropertyInterface::cl... | php | protected function verifyClassMap(array $classMap)
{
foreach ($classMap as $type => $class) {
if (!class_exists($class)) {
throw new Exception("Class '$class' that has been registered for type '$type' does not exist");
}
if (!in_array(PropertyInterface::cl... | [
"protected",
"function",
"verifyClassMap",
"(",
"array",
"$",
"classMap",
")",
"{",
"foreach",
"(",
"$",
"classMap",
"as",
"$",
"type",
"=>",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"throw",
"new",
"E... | Ensures that the given class map contains valid values.
@param string[] $classMap
@return string[] Returns the verified class map. | [
"Ensures",
"that",
"the",
"given",
"class",
"map",
"contains",
"valid",
"values",
"."
] | 94293fe897af376dd9d05962e2c516079409dd29 | https://github.com/shrink0r/php-schema/blob/94293fe897af376dd9d05962e2c516079409dd29/src/Factory.php#L99-L111 | train |
erenmustafaozdal/laravel-modules-base | src/Controllers/BaseNodeController.php | BaseNodeController.setRelation | protected function setRelation($request)
{
$this->changeRelationModel();
$relation = [];
if ($request->has('group-thumbnail')) {
$this->relations['thumbnails']['datas'] = collect($request->get('group-thumbnail'))->reject(function($item)
{
return ! $ite... | php | protected function setRelation($request)
{
$this->changeRelationModel();
$relation = [];
if ($request->has('group-thumbnail')) {
$this->relations['thumbnails']['datas'] = collect($request->get('group-thumbnail'))->reject(function($item)
{
return ! $ite... | [
"protected",
"function",
"setRelation",
"(",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"changeRelationModel",
"(",
")",
";",
"$",
"relation",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"request",
"->",
"has",
"(",
"'group-thumbnail'",
")",
")",
"{",
"$",
... | set the relations
@param $request
@return void | [
"set",
"the",
"relations"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/BaseNodeController.php#L37-L72 | train |
erenmustafaozdal/laravel-modules-base | src/Controllers/BaseNodeController.php | BaseNodeController.setRelationDefine | protected function setRelationDefine($parent)
{
$this->changeRelationModel();
$this->setDefineValues($this->defineValues);
$this->relations['thumbnails']['datas'] = $parent->thumbnails()->get(['slug','photo_width','photo_height'])->toArray();
$this->relations['extras']['datas'] = $pa... | php | protected function setRelationDefine($parent)
{
$this->changeRelationModel();
$this->setDefineValues($this->defineValues);
$this->relations['thumbnails']['datas'] = $parent->thumbnails()->get(['slug','photo_width','photo_height'])->toArray();
$this->relations['extras']['datas'] = $pa... | [
"protected",
"function",
"setRelationDefine",
"(",
"$",
"parent",
")",
"{",
"$",
"this",
"->",
"changeRelationModel",
"(",
")",
";",
"$",
"this",
"->",
"setDefineValues",
"(",
"$",
"this",
"->",
"defineValues",
")",
";",
"$",
"this",
"->",
"relations",
"["... | set relation define datas
@param $parent
@return void | [
"set",
"relation",
"define",
"datas"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/BaseNodeController.php#L80-L87 | train |
erenmustafaozdal/laravel-modules-base | src/Controllers/BaseNodeController.php | BaseNodeController.changeRelationModel | protected function changeRelationModel()
{
$module = getModule(get_called_class());
$module = explode('-',$module);
$module = ucfirst_tr($module[1]);
$this->relations['thumbnails']['relation_model'] = "\\App\\{$module}Thumbnail";
$this->relations['extras']['relation_model'] =... | php | protected function changeRelationModel()
{
$module = getModule(get_called_class());
$module = explode('-',$module);
$module = ucfirst_tr($module[1]);
$this->relations['thumbnails']['relation_model'] = "\\App\\{$module}Thumbnail";
$this->relations['extras']['relation_model'] =... | [
"protected",
"function",
"changeRelationModel",
"(",
")",
"{",
"$",
"module",
"=",
"getModule",
"(",
"get_called_class",
"(",
")",
")",
";",
"$",
"module",
"=",
"explode",
"(",
"'-'",
",",
"$",
"module",
")",
";",
"$",
"module",
"=",
"ucfirst_tr",
"(",
... | change relation model | [
"change",
"relation",
"model"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/BaseNodeController.php#L92-L99 | train |
XetaIO/Xetaravel-IpTraceable | src/Traits/IpTraceable.php | IpTraceable.updateFields | public function updateFields(Guard $auth, $ip = null): bool
{
$ip = $this->setIpValue($ip);
$user = $auth->user();
if (!$user instanceof Model) {
return false;
}
$user->last_login_ip = $ip;
$lastLoginDate = config('iptraceable.fields.last_login_date');
... | php | public function updateFields(Guard $auth, $ip = null): bool
{
$ip = $this->setIpValue($ip);
$user = $auth->user();
if (!$user instanceof Model) {
return false;
}
$user->last_login_ip = $ip;
$lastLoginDate = config('iptraceable.fields.last_login_date');
... | [
"public",
"function",
"updateFields",
"(",
"Guard",
"$",
"auth",
",",
"$",
"ip",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"setIpValue",
"(",
"$",
"ip",
")",
";",
"$",
"user",
"=",
"$",
"auth",
"->",
"user",
"(",
")... | Update the fields for the user.
@param \Illuminate\Contracts\Auth\Guard $auth
@param null|string $ip The IP to set.
@return bool | [
"Update",
"the",
"fields",
"for",
"the",
"user",
"."
] | e1c57592d45f240c55e827fd6b756e5143c892b5 | https://github.com/XetaIO/Xetaravel-IpTraceable/blob/e1c57592d45f240c55e827fd6b756e5143c892b5/src/Traits/IpTraceable.php#L19-L37 | train |
squareproton/Bond | src/Bond/Entity/Types/DateRange.php | DateRange.contains | public function contains( DateTime $datetime )
{
$lower = $this->lower->toUnixTimestamp();
$upper = $this->upper->toUnixTimestamp();
$working = $datetime->toUnixTimestamp();
$lowerCompare = bccomp( $lower, $working );
$upperCompare = bccomp( $upper, $working );
// e... | php | public function contains( DateTime $datetime )
{
$lower = $this->lower->toUnixTimestamp();
$upper = $this->upper->toUnixTimestamp();
$working = $datetime->toUnixTimestamp();
$lowerCompare = bccomp( $lower, $working );
$upperCompare = bccomp( $upper, $working );
// e... | [
"public",
"function",
"contains",
"(",
"DateTime",
"$",
"datetime",
")",
"{",
"$",
"lower",
"=",
"$",
"this",
"->",
"lower",
"->",
"toUnixTimestamp",
"(",
")",
";",
"$",
"upper",
"=",
"$",
"this",
"->",
"upper",
"->",
"toUnixTimestamp",
"(",
")",
";",
... | Does this interval contain our time
@return Bond\Entity\T | [
"Does",
"this",
"interval",
"contain",
"our",
"time"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/DateRange.php#L87-L110 | train |
danielgp/common-lib | source/MySQLiAdvancedOutput.php | MySQLiAdvancedOutput.getFieldOutputEnumSet | private function getFieldOutputEnumSet($tblSrc, $fldType, $val, $iar = [])
{
$adnlThings = $this->establishDefaultEnumSet($fldType);
if (array_key_exists('readonly', $val)) {
return $this->getFieldOutputEnumSetReadOnly($val, $adnlThings);
}
$inAdtnl = $adnlThings['additio... | php | private function getFieldOutputEnumSet($tblSrc, $fldType, $val, $iar = [])
{
$adnlThings = $this->establishDefaultEnumSet($fldType);
if (array_key_exists('readonly', $val)) {
return $this->getFieldOutputEnumSetReadOnly($val, $adnlThings);
}
$inAdtnl = $adnlThings['additio... | [
"private",
"function",
"getFieldOutputEnumSet",
"(",
"$",
"tblSrc",
",",
"$",
"fldType",
",",
"$",
"val",
",",
"$",
"iar",
"=",
"[",
"]",
")",
"{",
"$",
"adnlThings",
"=",
"$",
"this",
"->",
"establishDefaultEnumSet",
"(",
"$",
"fldType",
")",
";",
"if... | Returns a Enum or Set field to use in form
@param string $tblSrc
@param string $fldType
@param array $val
@param array $iar
@return string | [
"Returns",
"a",
"Enum",
"or",
"Set",
"field",
"to",
"use",
"in",
"form"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiAdvancedOutput.php#L50-L63 | train |
danielgp/common-lib | source/MySQLiAdvancedOutput.php | MySQLiAdvancedOutput.getFieldOutputText | private function getFieldOutputText($tbl, $fieldType, $value, $iar = [])
{
if (!in_array($fieldType, ['char', 'tinytext', 'varchar'])) {
return '';
}
$foreignKeysArray = $this->getFieldOutputTextPrerequisites($tbl, $value);
if ($foreignKeysArray !== []) {
retu... | php | private function getFieldOutputText($tbl, $fieldType, $value, $iar = [])
{
if (!in_array($fieldType, ['char', 'tinytext', 'varchar'])) {
return '';
}
$foreignKeysArray = $this->getFieldOutputTextPrerequisites($tbl, $value);
if ($foreignKeysArray !== []) {
retu... | [
"private",
"function",
"getFieldOutputText",
"(",
"$",
"tbl",
",",
"$",
"fieldType",
",",
"$",
"value",
",",
"$",
"iar",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"fieldType",
",",
"[",
"'char'",
",",
"'tinytext'",
",",
"'varchar... | Returns a Char field 2 use in a form
@param string $tbl
@param string $fieldType
@param array $value
@param array $iar
@return string | [
"Returns",
"a",
"Char",
"field",
"2",
"use",
"in",
"a",
"form"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiAdvancedOutput.php#L74-L84 | train |
danielgp/common-lib | source/MySQLiAdvancedOutput.php | MySQLiAdvancedOutput.getFieldOutputTextLarge | protected function getFieldOutputTextLarge($fieldType, $value, $iar = [])
{
if (!in_array($fieldType, ['blob', 'text'])) {
return '';
}
$inAdtnl = [
'name' => $value['COLUMN_NAME'],
'id' => $value['COLUMN_NAME'],
'rows' => 4,
'col... | php | protected function getFieldOutputTextLarge($fieldType, $value, $iar = [])
{
if (!in_array($fieldType, ['blob', 'text'])) {
return '';
}
$inAdtnl = [
'name' => $value['COLUMN_NAME'],
'id' => $value['COLUMN_NAME'],
'rows' => 4,
'col... | [
"protected",
"function",
"getFieldOutputTextLarge",
"(",
"$",
"fieldType",
",",
"$",
"value",
",",
"$",
"iar",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"fieldType",
",",
"[",
"'blob'",
",",
"'text'",
"]",
")",
")",
"{",
"return"... | Returns a Text field 2 use in a form
@param string $fieldType
@param array $value
@param array $iar
@return string | [
"Returns",
"a",
"Text",
"field",
"2",
"use",
"in",
"a",
"form"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiAdvancedOutput.php#L94-L109 | train |
danielgp/common-lib | source/MySQLiAdvancedOutput.php | MySQLiAdvancedOutput.getFieldOutputTimestamp | private function getFieldOutputTimestamp($dtl, $iar = [])
{
if (($dtl['COLUMN_DEFAULT'] == 'CURRENT_TIMESTAMP') || ($dtl['EXTRA'] == 'on update CURRENT_TIMESTAMP')) {
return $this->getTimestamping($dtl)['input'];
}
$input = $this->getFieldOutputTT($dtl, 19, $iar);
if (!ar... | php | private function getFieldOutputTimestamp($dtl, $iar = [])
{
if (($dtl['COLUMN_DEFAULT'] == 'CURRENT_TIMESTAMP') || ($dtl['EXTRA'] == 'on update CURRENT_TIMESTAMP')) {
return $this->getTimestamping($dtl)['input'];
}
$input = $this->getFieldOutputTT($dtl, 19, $iar);
if (!ar... | [
"private",
"function",
"getFieldOutputTimestamp",
"(",
"$",
"dtl",
",",
"$",
"iar",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"(",
"$",
"dtl",
"[",
"'COLUMN_DEFAULT'",
"]",
"==",
"'CURRENT_TIMESTAMP'",
")",
"||",
"(",
"$",
"dtl",
"[",
"'EXTRA'",
"]",
"==",
... | Returns a Timestamp field 2 use in a form
@param array $dtl
@param array $iar
@return string | [
"Returns",
"a",
"Timestamp",
"field",
"2",
"use",
"in",
"a",
"form"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiAdvancedOutput.php#L118-L128 | train |
danielgp/common-lib | source/MySQLiAdvancedOutput.php | MySQLiAdvancedOutput.getFieldOutputYear | private function getFieldOutputYear($tblName, $details, $iar)
{
$listOfValues = [];
for ($cntr = 1901; $cntr <= 2155; $cntr++) {
$listOfValues[$cntr] = $cntr;
}
if ($iar == []) {
$slDflt = $this->getFieldValue($details);
return $this->setArrayToSel... | php | private function getFieldOutputYear($tblName, $details, $iar)
{
$listOfValues = [];
for ($cntr = 1901; $cntr <= 2155; $cntr++) {
$listOfValues[$cntr] = $cntr;
}
if ($iar == []) {
$slDflt = $this->getFieldValue($details);
return $this->setArrayToSel... | [
"private",
"function",
"getFieldOutputYear",
"(",
"$",
"tblName",
",",
"$",
"details",
",",
"$",
"iar",
")",
"{",
"$",
"listOfValues",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"cntr",
"=",
"1901",
";",
"$",
"cntr",
"<=",
"2155",
";",
"$",
"cntr",
"++",... | Returns a Year field 2 use in a form
@param array $details
@param array $iar
@return string | [
"Returns",
"a",
"Year",
"field",
"2",
"use",
"in",
"a",
"form"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiAdvancedOutput.php#L137-L148 | train |
danielgp/common-lib | source/MySQLiAdvancedOutput.php | MySQLiAdvancedOutput.getSetOrEnum2Array | protected function getSetOrEnum2Array($refTbl, $refCol)
{
$dat = $this->establishDatabaseAndTable($refTbl);
foreach ($this->advCache['tableStructureCache'][$dat[0]][$dat[1]] as $vle) {
if ($vle['COLUMN_NAME'] == $refCol) {
$kVl = explode('\',\'', substr($vle['COLUMN_TYPE'... | php | protected function getSetOrEnum2Array($refTbl, $refCol)
{
$dat = $this->establishDatabaseAndTable($refTbl);
foreach ($this->advCache['tableStructureCache'][$dat[0]][$dat[1]] as $vle) {
if ($vle['COLUMN_NAME'] == $refCol) {
$kVl = explode('\',\'', substr($vle['COLUMN_TYPE'... | [
"protected",
"function",
"getSetOrEnum2Array",
"(",
"$",
"refTbl",
",",
"$",
"refCol",
")",
"{",
"$",
"dat",
"=",
"$",
"this",
"->",
"establishDatabaseAndTable",
"(",
"$",
"refTbl",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"advCache",
"[",
"'tableStruc... | Returns an array with possible values of a SET or ENUM column
@param string $refTbl
@param string $refCol
@return array | [
"Returns",
"an",
"array",
"with",
"possible",
"values",
"of",
"a",
"SET",
"or",
"ENUM",
"column"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiAdvancedOutput.php#L157-L171 | train |
danielgp/common-lib | source/MySQLiAdvancedOutput.php | MySQLiAdvancedOutput.getTimestamping | private function getTimestamping($dtl)
{
$fieldValue = $this->getFieldValue($dtl);
$inM = $this->setStringIntoTag($fieldValue, 'span');
if (in_array($fieldValue, ['', 'CURRENT_TIMESTAMP', 'NULL'])) {
$mCN = [
'InsertDateTime' => 'data/timpul ad. info... | php | private function getTimestamping($dtl)
{
$fieldValue = $this->getFieldValue($dtl);
$inM = $this->setStringIntoTag($fieldValue, 'span');
if (in_array($fieldValue, ['', 'CURRENT_TIMESTAMP', 'NULL'])) {
$mCN = [
'InsertDateTime' => 'data/timpul ad. info... | [
"private",
"function",
"getTimestamping",
"(",
"$",
"dtl",
")",
"{",
"$",
"fieldValue",
"=",
"$",
"this",
"->",
"getFieldValue",
"(",
"$",
"dtl",
")",
";",
"$",
"inM",
"=",
"$",
"this",
"->",
"setStringIntoTag",
"(",
"$",
"fieldValue",
",",
"'span'",
"... | Returns a timestamp field value
@param array $dtl
@return array | [
"Returns",
"a",
"timestamp",
"field",
"value"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiAdvancedOutput.php#L179-L195 | train |
anime-db/catalog-bundle | src/Controller/NoticeController.php | NoticeController.indexAction | public function indexAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse('AnimeDbAppBundle:Notice');
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$rep = $this->getRepositor... | php | public function indexAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse('AnimeDbAppBundle:Notice');
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$rep = $this->getRepositor... | [
"public",
"function",
"indexAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
"'AnimeDbAppBundle:Notice'",
")",
";",
"// response was not modified for this request",
... | Edit list notices.
@param Request $request
@return Response | [
"Edit",
"list",
"notices",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/NoticeController.php#L39-L67 | train |
anime-db/catalog-bundle | src/Controller/NoticeController.php | NoticeController.listAction | public function listAction(Request $request)
{
$current_page = $request->get('page', 1);
$current_page = $current_page > 1 ? $current_page : 1;
$rep = $this->getRepository();
// filter list notice
$filter = $this->createForm('notices_filter')->handleRequest($request);
... | php | public function listAction(Request $request)
{
$current_page = $request->get('page', 1);
$current_page = $current_page > 1 ? $current_page : 1;
$rep = $this->getRepository();
// filter list notice
$filter = $this->createForm('notices_filter')->handleRequest($request);
... | [
"public",
"function",
"listAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"current_page",
"=",
"$",
"request",
"->",
"get",
"(",
"'page'",
",",
"1",
")",
";",
"$",
"current_page",
"=",
"$",
"current_page",
">",
"1",
"?",
"$",
"current_page",
"... | Get notice list.
@param Request $request
@return Response | [
"Get",
"notice",
"list",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/NoticeController.php#L76-L120 | train |
WellBloud/sovacore-core | src/model/CoreFacade.php | CoreFacade.getAllPublished | public function getAllPublished(
$orderBy = null,
$limit = null
)
{
return $this->repository->findAllPublished($orderBy, $limit);
} | php | public function getAllPublished(
$orderBy = null,
$limit = null
)
{
return $this->repository->findAllPublished($orderBy, $limit);
} | [
"public",
"function",
"getAllPublished",
"(",
"$",
"orderBy",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"repository",
"->",
"findAllPublished",
"(",
"$",
"orderBy",
",",
"$",
"limit",
")",
";",
"}"
] | Method which finds all published items in the repository
@param array $orderBy
@param int $limit
@return array | [
"Method",
"which",
"finds",
"all",
"published",
"items",
"in",
"the",
"repository"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/CoreFacade.php#L35-L41 | train |
WellBloud/sovacore-core | src/model/CoreFacade.php | CoreFacade.getById | public function getById($id = null)
{
if ($id === null) {
throw new ItemNotSelectedException;
}
$entity = $this->repository->findById($id);
if (!$entity) {
throw new NonexistingItemException;
}
return $entity;
} | php | public function getById($id = null)
{
if ($id === null) {
throw new ItemNotSelectedException;
}
$entity = $this->repository->findById($id);
if (!$entity) {
throw new NonexistingItemException;
}
return $entity;
} | [
"public",
"function",
"getById",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"null",
")",
"{",
"throw",
"new",
"ItemNotSelectedException",
";",
"}",
"$",
"entity",
"=",
"$",
"this",
"->",
"repository",
"->",
"findById",
"(",
"... | Method which finds one item in the repository
@param type $id
@return type entity
@throws ItemNotSelectedException | [
"Method",
"which",
"finds",
"one",
"item",
"in",
"the",
"repository"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/CoreFacade.php#L68-L78 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Message/AbstractMessage.php | AbstractMessage.parseHeader | public static function parseHeader(MessageInterface $message, $header)
{
static $trimmed = "\"' \n\t\r";
$params = $matches = [];
foreach (self::normalizeHeader($message, $header) as $val) {
$part = [];
foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $k... | php | public static function parseHeader(MessageInterface $message, $header)
{
static $trimmed = "\"' \n\t\r";
$params = $matches = [];
foreach (self::normalizeHeader($message, $header) as $val) {
$part = [];
foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $k... | [
"public",
"static",
"function",
"parseHeader",
"(",
"MessageInterface",
"$",
"message",
",",
"$",
"header",
")",
"{",
"static",
"$",
"trimmed",
"=",
"\"\\\"' \\n\\t\\r\"",
";",
"$",
"params",
"=",
"$",
"matches",
"=",
"[",
"]",
";",
"foreach",
"(",
"self"... | Parse an array of header values containing ";" separated data into an
array of associative arrays representing the header key value pair
data of the header. When a parameter does not contain a value, but just
contains a key, this function will inject a key with a '' string value.
@param MessageInterface $message That ... | [
"Parse",
"an",
"array",
"of",
"header",
"values",
"containing",
";",
"separated",
"data",
"into",
"an",
"array",
"of",
"associative",
"arrays",
"representing",
"the",
"header",
"key",
"value",
"pair",
"data",
"of",
"the",
"header",
".",
"When",
"a",
"paramet... | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Message/AbstractMessage.php#L161-L184 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Message/AbstractMessage.php | AbstractMessage.getHeadersAsString | public static function getHeadersAsString(MessageInterface $message)
{
$result = '';
foreach ($message->getHeaders() as $name => $values) {
$result .= "\r\n{$name}: " . implode(', ', $values);
}
return $result;
} | php | public static function getHeadersAsString(MessageInterface $message)
{
$result = '';
foreach ($message->getHeaders() as $name => $values) {
$result .= "\r\n{$name}: " . implode(', ', $values);
}
return $result;
} | [
"public",
"static",
"function",
"getHeadersAsString",
"(",
"MessageInterface",
"$",
"message",
")",
"{",
"$",
"result",
"=",
"''",
";",
"foreach",
"(",
"$",
"message",
"->",
"getHeaders",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"values",
")",
"{",
"$",
... | Gets the headers of a message as a string
@param MessageInterface $message
@return string | [
"Gets",
"the",
"headers",
"of",
"a",
"message",
"as",
"a",
"string"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Message/AbstractMessage.php#L231-L239 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Message/AbstractMessage.php | AbstractMessage.getStartLine | public static function getStartLine(MessageInterface $message)
{
if ($message instanceof RequestInterface) {
return trim($message->getMethod() . ' '
. $message->getResource())
. ' HTTP/' . $message->getProtocolVersion();
} elseif ($message instanceof Respo... | php | public static function getStartLine(MessageInterface $message)
{
if ($message instanceof RequestInterface) {
return trim($message->getMethod() . ' '
. $message->getResource())
. ' HTTP/' . $message->getProtocolVersion();
} elseif ($message instanceof Respo... | [
"public",
"static",
"function",
"getStartLine",
"(",
"MessageInterface",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"message",
"instanceof",
"RequestInterface",
")",
"{",
"return",
"trim",
"(",
"$",
"message",
"->",
"getMethod",
"(",
")",
".",
"' '",
".",
"... | Gets the start line of a message
@param MessageInterface $message
@return string
@throws \InvalidArgumentException | [
"Gets",
"the",
"start",
"line",
"of",
"a",
"message"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Message/AbstractMessage.php#L249-L262 | train |
DeimosProject/Request | src/Request/URL.php | URL.url | public function url($withParams = false)
{
$url = $this->scheme() . '://';
$url .= $this->domain();
return $url . $this->urlPath($withParams);
} | php | public function url($withParams = false)
{
$url = $this->scheme() . '://';
$url .= $this->domain();
return $url . $this->urlPath($withParams);
} | [
"public",
"function",
"url",
"(",
"$",
"withParams",
"=",
"false",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"scheme",
"(",
")",
".",
"'://'",
";",
"$",
"url",
".=",
"$",
"this",
"->",
"domain",
"(",
")",
";",
"return",
"$",
"url",
".",
"$"... | Gets request URL
@param bool $withParams Whether to preserve URL parameters
@return string URL of this request | [
"Gets",
"request",
"URL"
] | 3e45af0fdbfc3c47c27de27a98e8980ba42c3737 | https://github.com/DeimosProject/Request/blob/3e45af0fdbfc3c47c27de27a98e8980ba42c3737/src/Request/URL.php#L74-L80 | train |
DeimosProject/Request | src/Request/URL.php | URL.urlPath | public function urlPath($withParams = false)
{
$path = $this->server('request_uri');
if (!$withParams)
{
$position = mb_strpos($path, '?');
if ($position !== false)
{
$path = mb_substr($path, 0, $position);
}
}
... | php | public function urlPath($withParams = false)
{
$path = $this->server('request_uri');
if (!$withParams)
{
$position = mb_strpos($path, '?');
if ($position !== false)
{
$path = mb_substr($path, 0, $position);
}
}
... | [
"public",
"function",
"urlPath",
"(",
"$",
"withParams",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"server",
"(",
"'request_uri'",
")",
";",
"if",
"(",
"!",
"$",
"withParams",
")",
"{",
"$",
"position",
"=",
"mb_strpos",
"(",
"$",
... | without host & schema
@param bool $withParams
@return string | [
"without",
"host",
"&",
"schema"
] | 3e45af0fdbfc3c47c27de27a98e8980ba42c3737 | https://github.com/DeimosProject/Request/blob/3e45af0fdbfc3c47c27de27a98e8980ba42c3737/src/Request/URL.php#L89-L103 | train |
offworks/laraquent | src/Blueprint.php | Blueprint.addColumn | public function addColumn($type, $column, array $parameters = array())
{
// check against existing
if(!$this->builder->hasColumn($this->table, $column))
return parent::addColumn($type, $column, $parameters);
// else probably compare and do some alteration
} | php | public function addColumn($type, $column, array $parameters = array())
{
// check against existing
if(!$this->builder->hasColumn($this->table, $column))
return parent::addColumn($type, $column, $parameters);
// else probably compare and do some alteration
} | [
"public",
"function",
"addColumn",
"(",
"$",
"type",
",",
"$",
"column",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"// check against existing",
"if",
"(",
"!",
"$",
"this",
"->",
"builder",
"->",
"hasColumn",
"(",
"$",
"this",
... | Add column only if there isn't one.
So it will not throw if there already exists. | [
"Add",
"column",
"only",
"if",
"there",
"isn",
"t",
"one",
".",
"So",
"it",
"will",
"not",
"throw",
"if",
"there",
"already",
"exists",
"."
] | 74cbc6258acfda8f7213c701887a7b223aff954f | https://github.com/offworks/laraquent/blob/74cbc6258acfda8f7213c701887a7b223aff954f/src/Blueprint.php#L19-L26 | train |
ARCANESOFT/Auth | src/Providers/PackagesServiceProvider.php | PackagesServiceProvider.configLaravelAuthPackage | private function configLaravelAuthPackage()
{
$config = $this->config();
$config->set(
'laravel-auth',
Arr::only($config->get('arcanesoft.auth'), [
'database', 'users', 'roles', 'role-user', 'permissions-groups', 'permissions', 'permission-role',
... | php | private function configLaravelAuthPackage()
{
$config = $this->config();
$config->set(
'laravel-auth',
Arr::only($config->get('arcanesoft.auth'), [
'database', 'users', 'roles', 'role-user', 'permissions-groups', 'permissions', 'permission-role',
... | [
"private",
"function",
"configLaravelAuthPackage",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"(",
")",
";",
"$",
"config",
"->",
"set",
"(",
"'laravel-auth'",
",",
"Arr",
"::",
"only",
"(",
"$",
"config",
"->",
"get",
"(",
"'arcan... | Config the Laravel Auth package. | [
"Config",
"the",
"Laravel",
"Auth",
"package",
"."
] | b33ca82597a76b1e395071f71ae3e51f1ec67e62 | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Providers/PackagesServiceProvider.php#L86-L100 | train |
ARCANESOFT/Auth | src/Providers/PackagesServiceProvider.php | PackagesServiceProvider.rebindModels | private function rebindModels()
{
$config = $this->config();
$bindings = [
[
'abstract' => \Arcanesoft\Contracts\Auth\Models\User::class,
'concrete' => $config->get('arcanesoft.auth.users.model'),
],[
'abstract' => \Arcanesoft... | php | private function rebindModels()
{
$config = $this->config();
$bindings = [
[
'abstract' => \Arcanesoft\Contracts\Auth\Models\User::class,
'concrete' => $config->get('arcanesoft.auth.users.model'),
],[
'abstract' => \Arcanesoft... | [
"private",
"function",
"rebindModels",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"(",
")",
";",
"$",
"bindings",
"=",
"[",
"[",
"'abstract'",
"=>",
"\\",
"Arcanesoft",
"\\",
"Contracts",
"\\",
"Auth",
"\\",
"Models",
"\\",
"User",... | Rebind the auth models. | [
"Rebind",
"the",
"auth",
"models",
"."
] | b33ca82597a76b1e395071f71ae3e51f1ec67e62 | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/Providers/PackagesServiceProvider.php#L115-L137 | train |
hiqdev/hidev-phpunit | src/console/PhpunitController.php | PhpunitController.actionGenfake | public function actionGenfake($file)
{
$path = $this->buildFakePath($file);
if (!$this->force && file_exists($path)) {
Yii::warning("already exists: $path");
return 1;
}
return $this->genFake($file, $path);
} | php | public function actionGenfake($file)
{
$path = $this->buildFakePath($file);
if (!$this->force && file_exists($path)) {
Yii::warning("already exists: $path");
return 1;
}
return $this->genFake($file, $path);
} | [
"public",
"function",
"actionGenfake",
"(",
"$",
"file",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"buildFakePath",
"(",
"$",
"file",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"force",
"&&",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
... | Generates skeleton class for fake. | [
"Generates",
"skeleton",
"class",
"for",
"fake",
"."
] | 53f3567490b20c720b911e4486a010585db13d28 | https://github.com/hiqdev/hidev-phpunit/blob/53f3567490b20c720b911e4486a010585db13d28/src/console/PhpunitController.php#L50-L60 | train |
Wedeto/DB | src/Query/GetClause.php | GetClause.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
$alias = $this->alias;
$drv = $params->getDriver();
$sql = $drv->toSQL($params, $this->expression, true);
if (empty($this->alias))
$this->alias = $params->generateAlias($this->expression);
if (!emp... | php | public function toSQL(Parameters $params, bool $inner_clause)
{
$alias = $this->alias;
$drv = $params->getDriver();
$sql = $drv->toSQL($params, $this->expression, true);
if (empty($this->alias))
$this->alias = $params->generateAlias($this->expression);
if (!emp... | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"$",
"alias",
"=",
"$",
"this",
"->",
"alias",
";",
"$",
"drv",
"=",
"$",
"params",
"->",
"getDriver",
"(",
")",
";",
"$",
"sql",
"=",
"$",... | Write a select return clause as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@return string The generated SQL | [
"Write",
"a",
"select",
"return",
"clause",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/GetClause.php#L56-L70 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/xml/SimpleXMLParser.php | SimpleXMLParser.parseXMLString | public function parseXMLString($xmlString, $simpleXMLClass = 'SimpleXMLExtended')
{
libxml_use_internal_errors(true);
$doc = simplexml_load_string($xmlString, $simpleXMLClass);
if (false === $doc) {
$xml = explode("\n", $xmlString);
$errors = libxml_get_errors();
... | php | public function parseXMLString($xmlString, $simpleXMLClass = 'SimpleXMLExtended')
{
libxml_use_internal_errors(true);
$doc = simplexml_load_string($xmlString, $simpleXMLClass);
if (false === $doc) {
$xml = explode("\n", $xmlString);
$errors = libxml_get_errors();
... | [
"public",
"function",
"parseXMLString",
"(",
"$",
"xmlString",
",",
"$",
"simpleXMLClass",
"=",
"'SimpleXMLExtended'",
")",
"{",
"libxml_use_internal_errors",
"(",
"true",
")",
";",
"$",
"doc",
"=",
"simplexml_load_string",
"(",
"$",
"xmlString",
",",
"$",
"simp... | Converts an XML string into a SimpleXMLElement object
@param string $xmlString String of well-formed XML
@param string $simpleXMLClass Optional parameter to specify classname of
the return object. That class should extend the SimpleXMLElement class.
@return SimpleXMLElement Object of specified class
@throws Simp... | [
"Converts",
"an",
"XML",
"string",
"into",
"a",
"SimpleXMLElement",
"object"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/xml/SimpleXMLParser.php#L46-L68 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/xml/SimpleXMLParser.php | SimpleXMLParser.loadIncludes | protected function loadIncludes($xmlPath, $xmlString)
{
$m = null;
if (preg_match_all("/\<include\s*href\=\"([^\"]+)\".*?\/\>/si", $xmlString, $m, PREG_SET_ORDER) !== false) {
foreach ($m as $match) {
$includeFile = rtrim($xmlPath, '/').'/'.$match[1];
if (... | php | protected function loadIncludes($xmlPath, $xmlString)
{
$m = null;
if (preg_match_all("/\<include\s*href\=\"([^\"]+)\".*?\/\>/si", $xmlString, $m, PREG_SET_ORDER) !== false) {
foreach ($m as $match) {
$includeFile = rtrim($xmlPath, '/').'/'.$match[1];
if (... | [
"protected",
"function",
"loadIncludes",
"(",
"$",
"xmlPath",
",",
"$",
"xmlString",
")",
"{",
"$",
"m",
"=",
"null",
";",
"if",
"(",
"preg_match_all",
"(",
"\"/\\<include\\s*href\\=\\\"([^\\\"]+)\\\".*?\\/\\>/si\"",
",",
"$",
"xmlString",
",",
"$",
"m",
",",
... | Loads all the includes into the xml string.
@param string $xmlPath The absolute path to the directory where the include files are located
@param string $xmlString The full XML string (usually file contents from an xml doc)
@return string the full xml string with any includes replaced by the included content | [
"Loads",
"all",
"the",
"includes",
"into",
"the",
"xml",
"string",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/xml/SimpleXMLParser.php#L177-L194 | train |
liip/DataAggregator | src/Liip/DataAggregator/Subjects/SubjectDispatcher.php | SubjectDispatcher.attachSubject | public function attachSubject($event, \SplSubject $subject)
{
$key = $this->getUniqueKey($event);
if (!array_key_exists($event, $this->subjects)) {
$this->subjects[$event] = array();
}
$this->subjects[$event][$key] = $subject;
return $key;
} | php | public function attachSubject($event, \SplSubject $subject)
{
$key = $this->getUniqueKey($event);
if (!array_key_exists($event, $this->subjects)) {
$this->subjects[$event] = array();
}
$this->subjects[$event][$key] = $subject;
return $key;
} | [
"public",
"function",
"attachSubject",
"(",
"$",
"event",
",",
"\\",
"SplSubject",
"$",
"subject",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getUniqueKey",
"(",
"$",
"event",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"event",
",",
... | Registers a subject to be called an a specific event.
@param string $event
@param \SplSubject $subject
@return string | [
"Registers",
"a",
"subject",
"to",
"be",
"called",
"an",
"a",
"specific",
"event",
"."
] | 53da08ed3f5f24597be9f40ecf8ec44da7765e47 | https://github.com/liip/DataAggregator/blob/53da08ed3f5f24597be9f40ecf8ec44da7765e47/src/Liip/DataAggregator/Subjects/SubjectDispatcher.php#L23-L34 | train |
liip/DataAggregator | src/Liip/DataAggregator/Subjects/SubjectDispatcher.php | SubjectDispatcher.detachSubject | public function detachSubject($event, $key)
{
Assertion::notEmptyKey($this->subjects, $event, 'Provided event does not exist.');
Assertion::notEmptyKey($this->subjects[$event], $key, 'Subject to be detached does not exist.');
unset($this->subjects[$event][$key]);
} | php | public function detachSubject($event, $key)
{
Assertion::notEmptyKey($this->subjects, $event, 'Provided event does not exist.');
Assertion::notEmptyKey($this->subjects[$event], $key, 'Subject to be detached does not exist.');
unset($this->subjects[$event][$key]);
} | [
"public",
"function",
"detachSubject",
"(",
"$",
"event",
",",
"$",
"key",
")",
"{",
"Assertion",
"::",
"notEmptyKey",
"(",
"$",
"this",
"->",
"subjects",
",",
"$",
"event",
",",
"'Provided event does not exist.'",
")",
";",
"Assertion",
"::",
"notEmptyKey",
... | Unregisters a subject from a specific event.
@param string $event
@param string $key | [
"Unregisters",
"a",
"subject",
"from",
"a",
"specific",
"event",
"."
] | 53da08ed3f5f24597be9f40ecf8ec44da7765e47 | https://github.com/liip/DataAggregator/blob/53da08ed3f5f24597be9f40ecf8ec44da7765e47/src/Liip/DataAggregator/Subjects/SubjectDispatcher.php#L42-L48 | train |
liip/DataAggregator | src/Liip/DataAggregator/Subjects/SubjectDispatcher.php | SubjectDispatcher.emit | public function emit($event)
{
if (!empty($this->subjects[$event])) {
/** @var \SplSubject $subject */
foreach($this->subjects[$event] as $subject) {
$subject->notify();
}
}
} | php | public function emit($event)
{
if (!empty($this->subjects[$event])) {
/** @var \SplSubject $subject */
foreach($this->subjects[$event] as $subject) {
$subject->notify();
}
}
} | [
"public",
"function",
"emit",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"subjects",
"[",
"$",
"event",
"]",
")",
")",
"{",
"/** @var \\SplSubject $subject */",
"foreach",
"(",
"$",
"this",
"->",
"subjects",
"[",
"$",... | Triggers every subject attached to an event.
@param string $event | [
"Triggers",
"every",
"subject",
"attached",
"to",
"an",
"event",
"."
] | 53da08ed3f5f24597be9f40ecf8ec44da7765e47 | https://github.com/liip/DataAggregator/blob/53da08ed3f5f24597be9f40ecf8ec44da7765e47/src/Liip/DataAggregator/Subjects/SubjectDispatcher.php#L56-L65 | train |
koolkode/stream | src/ErrorHandlerTrait.php | ErrorHandlerTrait.handleError | protected static function handleError()
{
if(self::$errorHandler === NULL)
{
self::$errorHandler = function ($type, $message, $file, $line) {
throw new \RuntimeException($message);
};
}
return self::$errorHandler;
} | php | protected static function handleError()
{
if(self::$errorHandler === NULL)
{
self::$errorHandler = function ($type, $message, $file, $line) {
throw new \RuntimeException($message);
};
}
return self::$errorHandler;
} | [
"protected",
"static",
"function",
"handleError",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"errorHandler",
"===",
"NULL",
")",
"{",
"self",
"::",
"$",
"errorHandler",
"=",
"function",
"(",
"$",
"type",
",",
"$",
"message",
",",
"$",
"file",
",",
... | Initialize and return the error handler callback.
@return callable | [
"Initialize",
"and",
"return",
"the",
"error",
"handler",
"callback",
"."
] | 05e83efd76e1cb9e40a972711986b4a7e38bc141 | https://github.com/koolkode/stream/blob/05e83efd76e1cb9e40a972711986b4a7e38bc141/src/ErrorHandlerTrait.php#L33-L43 | train |
Facebook-Anonymous-Publisher/firewall | src/Firewall.php | Firewall.isAllowCountry | public function isAllowCountry(array $codes = ['*'])
{
try {
return in_array('*', $codes, true)
|| in_array(Utility::isoCode($this->ip()), $codes, true);
} catch (\Exception $e) {
return true;
}
} | php | public function isAllowCountry(array $codes = ['*'])
{
try {
return in_array('*', $codes, true)
|| in_array(Utility::isoCode($this->ip()), $codes, true);
} catch (\Exception $e) {
return true;
}
} | [
"public",
"function",
"isAllowCountry",
"(",
"array",
"$",
"codes",
"=",
"[",
"'*'",
"]",
")",
"{",
"try",
"{",
"return",
"in_array",
"(",
"'*'",
",",
"$",
"codes",
",",
"true",
")",
"||",
"in_array",
"(",
"Utility",
"::",
"isoCode",
"(",
"$",
"this"... | Determine the request ip address is in allow countries.
@param array $codes
@return bool | [
"Determine",
"the",
"request",
"ip",
"address",
"is",
"in",
"allow",
"countries",
"."
] | 3d78855cc828a1ebda37ac73c41fd64dc8dd0583 | https://github.com/Facebook-Anonymous-Publisher/firewall/blob/3d78855cc828a1ebda37ac73c41fd64dc8dd0583/src/Firewall.php#L79-L87 | train |
Facebook-Anonymous-Publisher/firewall | src/Firewall.php | Firewall.ban | public function ban($ip = null, $type = 'regular')
{
$this->validateType($type);
if (! is_null($ip)) {
if ('segment' === $type) {
$ip = Utility::cidr($ip);
}
} else {
$ip = $this->ip();
session(['isBan' => $type]);
}
... | php | public function ban($ip = null, $type = 'regular')
{
$this->validateType($type);
if (! is_null($ip)) {
if ('segment' === $type) {
$ip = Utility::cidr($ip);
}
} else {
$ip = $this->ip();
session(['isBan' => $type]);
}
... | [
"public",
"function",
"ban",
"(",
"$",
"ip",
"=",
"null",
",",
"$",
"type",
"=",
"'regular'",
")",
"{",
"$",
"this",
"->",
"validateType",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"ip",
")",
")",
"{",
"if",
"(",
"'segmen... | Ban ip address.
@param string|null $ip
@param string $type
@return Models\Firewall | [
"Ban",
"ip",
"address",
"."
] | 3d78855cc828a1ebda37ac73c41fd64dc8dd0583 | https://github.com/Facebook-Anonymous-Publisher/firewall/blob/3d78855cc828a1ebda37ac73c41fd64dc8dd0583/src/Firewall.php#L97-L112 | train |
Facebook-Anonymous-Publisher/firewall | src/Firewall.php | Firewall.unban | public function unban($ip = null)
{
if (is_null($ip)) {
$ip = $this->ip();
session()->forget('isBan');
}
return $this->model->destroy($ip);
} | php | public function unban($ip = null)
{
if (is_null($ip)) {
$ip = $this->ip();
session()->forget('isBan');
}
return $this->model->destroy($ip);
} | [
"public",
"function",
"unban",
"(",
"$",
"ip",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"ip",
")",
")",
"{",
"$",
"ip",
"=",
"$",
"this",
"->",
"ip",
"(",
")",
";",
"session",
"(",
")",
"->",
"forget",
"(",
"'isBan'",
")",
";",
... | Unban ip address.
@param string|null $ip
@return int | [
"Unban",
"ip",
"address",
"."
] | 3d78855cc828a1ebda37ac73c41fd64dc8dd0583 | https://github.com/Facebook-Anonymous-Publisher/firewall/blob/3d78855cc828a1ebda37ac73c41fd64dc8dd0583/src/Firewall.php#L133-L142 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/storagefacility/LocalStorageFacility.php | LocalStorageFacility.fileExists | public function fileExists(StorageFacilityParams $params, $fileid)
{
$this->validateFileID($fileid);
return file_exists($this->generateStoragePath($params, $fileid));
} | php | public function fileExists(StorageFacilityParams $params, $fileid)
{
$this->validateFileID($fileid);
return file_exists($this->generateStoragePath($params, $fileid));
} | [
"public",
"function",
"fileExists",
"(",
"StorageFacilityParams",
"$",
"params",
",",
"$",
"fileid",
")",
"{",
"$",
"this",
"->",
"validateFileID",
"(",
"$",
"fileid",
")",
";",
"return",
"file_exists",
"(",
"$",
"this",
"->",
"generateStoragePath",
"(",
"$"... | Returns true if the file exists in the storage facility or
false if it doesn't exist. Throws an exception is the operation failed.
@param Site $site Site used to determine storage location
@param string $fileid File identifier of stored file, ex. /path/to/file.jpg
@return boolean
@throws StorageFacilityException ... | [
"Returns",
"true",
"if",
"the",
"file",
"exists",
"in",
"the",
"storage",
"facility",
"or",
"false",
"if",
"it",
"doesn",
"t",
"exist",
".",
"Throws",
"an",
"exception",
"is",
"the",
"operation",
"failed",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/storagefacility/LocalStorageFacility.php#L124-L128 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/storagefacility/LocalStorageFacility.php | LocalStorageFacility.deleteFile | public function deleteFile(StorageFacilityParams $params, $fileid)
{
$this->validateFileID($fileid);
$storagePath = $this->generateStoragePath($params, $fileid);
if (is_file($storagePath)) {
if (!@unlink($storagePath)) {
throw new StorageFacilityException("Canno... | php | public function deleteFile(StorageFacilityParams $params, $fileid)
{
$this->validateFileID($fileid);
$storagePath = $this->generateStoragePath($params, $fileid);
if (is_file($storagePath)) {
if (!@unlink($storagePath)) {
throw new StorageFacilityException("Canno... | [
"public",
"function",
"deleteFile",
"(",
"StorageFacilityParams",
"$",
"params",
",",
"$",
"fileid",
")",
"{",
"$",
"this",
"->",
"validateFileID",
"(",
"$",
"fileid",
")",
";",
"$",
"storagePath",
"=",
"$",
"this",
"->",
"generateStoragePath",
"(",
"$",
"... | Deletes a file in the storage facility.
@param Site $site Site used to determine storage location
@param string $fileid File identifier of stored file, ex. /path/to/file.jpg
@return boolean True upon success
@throws StorageFacilityException if operation fails | [
"Deletes",
"a",
"file",
"in",
"the",
"storage",
"facility",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/storagefacility/LocalStorageFacility.php#L139-L152 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/storagefacility/LocalStorageFacility.php | LocalStorageFacility.renameFile | public function renameFile(StorageFacilityParams $params, StorageFacilityFile &$file, $newfileid)
{
$this->validateFileID($newfileid);
if ($file->getId() == null)
throw new StorageFacilityException("Invalid fileid '".$file->getId()."'");
if ($this->fileExists($params, $newfilei... | php | public function renameFile(StorageFacilityParams $params, StorageFacilityFile &$file, $newfileid)
{
$this->validateFileID($newfileid);
if ($file->getId() == null)
throw new StorageFacilityException("Invalid fileid '".$file->getId()."'");
if ($this->fileExists($params, $newfilei... | [
"public",
"function",
"renameFile",
"(",
"StorageFacilityParams",
"$",
"params",
",",
"StorageFacilityFile",
"&",
"$",
"file",
",",
"$",
"newfileid",
")",
"{",
"$",
"this",
"->",
"validateFileID",
"(",
"$",
"newfileid",
")",
";",
"if",
"(",
"$",
"file",
"-... | Renames a StorageFacilityFile in the storage facility.
@param Site $site Site used to determine storage location
@param string &$file File identifier of stored file, ex. /path/to/file.ext
@param string $newfileid File identifier to rename to
@return StorageFacilityFile Fully-resolved and stored file, has U... | [
"Renames",
"a",
"StorageFacilityFile",
"in",
"the",
"storage",
"facility",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/storagefacility/LocalStorageFacility.php#L165-L184 | train |
gplcart/cli | controllers/commands/Country.php | Country.cmdGetCountry | public function cmdGetCountry()
{
$result = $this->getListCountry();
$this->outputFormat($result);
$this->outputFormatTableCountry($result);
$this->output();
} | php | public function cmdGetCountry()
{
$result = $this->getListCountry();
$this->outputFormat($result);
$this->outputFormatTableCountry($result);
$this->output();
} | [
"public",
"function",
"cmdGetCountry",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListCountry",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableCountry",
"(",
"$",
"resul... | Callback for "country-get" command | [
"Callback",
"for",
"country",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Country.php#L40-L46 | train |
gplcart/cli | controllers/commands/Country.php | Country.cmdUpdateCountry | public function cmdUpdateCountry()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
$this->setSubmitted(null, $params);
$this->setSubmitted('update', $params[0]);
$this->... | php | public function cmdUpdateCountry()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
$this->setSubmitted(null, $params);
$this->setSubmitted('update', $params[0]);
$this->... | [
"public",
"function",
"cmdUpdateCountry",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
"... | Callback for "country-update" command | [
"Callback",
"for",
"country",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Country.php#L65-L80 | train |
gplcart/cli | controllers/commands/Country.php | Country.cmdDeleteCountry | public function cmdDeleteCountry()
{
$code = $this->getParam(0);
$all = $this->getParam('all');
if (empty($code) && empty($all)) {
$this->errorAndExit($this->text('Invalid command'));
}
$result = null;
if (!empty($code)) {
$result = $this->c... | php | public function cmdDeleteCountry()
{
$code = $this->getParam(0);
$all = $this->getParam('all');
if (empty($code) && empty($all)) {
$this->errorAndExit($this->text('Invalid command'));
}
$result = null;
if (!empty($code)) {
$result = $this->c... | [
"public",
"function",
"cmdDeleteCountry",
"(",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"$",
"all",
"=",
"$",
"this",
"->",
"getParam",
"(",
"'all'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"code",
")",
"&&",... | Callback for "country-delete" command | [
"Callback",
"for",
"country",
"-",
"delete",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Country.php#L85-L114 | train |
gplcart/cli | controllers/commands/Country.php | Country.addCountry | protected function addCountry()
{
if (!$this->isError() && !$this->country->add($this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | php | protected function addCountry()
{
if (!$this->isError() && !$this->country->add($this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | [
"protected",
"function",
"addCountry",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"country",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
")",
"{",
"$",
"this",
"->"... | Add a new country | [
"Add",
"a",
"new",
"country"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Country.php#L169-L174 | train |
gplcart/cli | controllers/commands/Country.php | Country.updateCountry | protected function updateCountry($code)
{
if (!$this->isError() && !$this->country->update($code, $this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | php | protected function updateCountry($code)
{
if (!$this->isError() && !$this->country->update($code, $this->getSubmitted())) {
$this->errorAndExit($this->text('Unexpected result'));
}
} | [
"protected",
"function",
"updateCountry",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"country",
"->",
"update",
"(",
"$",
"code",
",",
"$",
"this",
"->",
"getSubmitted",
"(",
")... | Updates an country
@param string $code | [
"Updates",
"an",
"country"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Country.php#L180-L185 | train |
gplcart/cli | controllers/commands/Country.php | Country.submitAddCountry | protected function submitAddCountry()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmittedJson('format');
$this->validateComponent('country');
$this->addCountry();
} | php | protected function submitAddCountry()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmittedJson('format');
$this->validateComponent('country');
$this->addCountry();
} | [
"protected",
"function",
"submitAddCountry",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"setSubmittedJson",
"(",
"'format'",
")",
";",
"$",
"this",
"->",
"va... | Add a new country at once | [
"Add",
"a",
"new",
"country",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Country.php#L190-L196 | train |
gplcart/cli | controllers/commands/Country.php | Country.wizardAddCountry | protected function wizardAddCountry()
{
$this->validatePrompt('code', $this->text('Code'), 'country');
$this->validatePrompt('name', $this->text('Name'), 'country', '');
$this->validatePrompt('native_name', $this->text('Native name'), 'country', '');
$this->validatePrompt('zone_id', ... | php | protected function wizardAddCountry()
{
$this->validatePrompt('code', $this->text('Code'), 'country');
$this->validatePrompt('name', $this->text('Name'), 'country', '');
$this->validatePrompt('native_name', $this->text('Native name'), 'country', '');
$this->validatePrompt('zone_id', ... | [
"protected",
"function",
"wizardAddCountry",
"(",
")",
"{",
"$",
"this",
"->",
"validatePrompt",
"(",
"'code'",
",",
"$",
"this",
"->",
"text",
"(",
"'Code'",
")",
",",
"'country'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'name'",
",",
"$",
... | Add a new country step by step | [
"Add",
"a",
"new",
"country",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Country.php#L201-L212 | train |
DaGhostman/codewave | src/Application/Router.php | Router.get | public function get($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('get', $pattern, $callback, $middleware, $name);
return $this;
} | php | public function get($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('get', $pattern, $callback, $middleware, $name);
return $this;
} | [
"public",
"function",
"get",
"(",
"$",
"pattern",
",",
"$",
"callback",
",",
"array",
"$",
"middleware",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addRoute",
"(",
"'get'",
",",
"$",
"pattern",
",",
"$",
"callback",
"... | Defines a route which will respond to GET and HEAD requests
@param string $pattern The route pattern for the URL
@param callable $callback The callback which should be handle the response
@param callable[] $middleware List of the middleware for the route
@param string $name (Optional) Route name. Used for reverse rout... | [
"Defines",
"a",
"route",
"which",
"will",
"respond",
"to",
"GET",
"and",
"HEAD",
"requests"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L147-L152 | train |
DaGhostman/codewave | src/Application/Router.php | Router.addRoute | protected function addRoute($method, $pattern, $callback, array $middleware = null, $name = null)
{
$concatenatedPattern = (!is_null($this->prefix) ? '/' . $this->prefix : '') .
$pattern;
$this->collector->addRoute(strtoupper($method), $concatenatedPattern, new Route($callback, $middlew... | php | protected function addRoute($method, $pattern, $callback, array $middleware = null, $name = null)
{
$concatenatedPattern = (!is_null($this->prefix) ? '/' . $this->prefix : '') .
$pattern;
$this->collector->addRoute(strtoupper($method), $concatenatedPattern, new Route($callback, $middlew... | [
"protected",
"function",
"addRoute",
"(",
"$",
"method",
",",
"$",
"pattern",
",",
"$",
"callback",
",",
"array",
"$",
"middleware",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"concatenatedPattern",
"=",
"(",
"!",
"is_null",
"(",
"$",
... | Proxies the route definition with the backend routing library
@param string $method
@param string $pattern
@param callable $callback
@param array $middleware
@param null $name | [
"Proxies",
"the",
"route",
"definition",
"with",
"the",
"backend",
"routing",
"library"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L163-L173 | train |
DaGhostman/codewave | src/Application/Router.php | Router.post | public function post($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('post', $pattern, $callback, $middleware, $name);
return $this;
} | php | public function post($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('post', $pattern, $callback, $middleware, $name);
return $this;
} | [
"public",
"function",
"post",
"(",
"$",
"pattern",
",",
"$",
"callback",
",",
"array",
"$",
"middleware",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addRoute",
"(",
"'post'",
",",
"$",
"pattern",
",",
"$",
"callback",
... | Defines a route which will respond to POST requests
@param string $pattern The route pattern for the URL
@param callable $callback The callback which should be handle the response
@param callable[] $middleware List of the middleware for the route
@param string $name (Optional) Route name. Used for reverse routing.
@r... | [
"Defines",
"a",
"route",
"which",
"will",
"respond",
"to",
"POST",
"requests"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L185-L190 | train |
DaGhostman/codewave | src/Application/Router.php | Router.put | public function put($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('put', $pattern, $callback, $middleware, $name);
return $this;
} | php | public function put($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('put', $pattern, $callback, $middleware, $name);
return $this;
} | [
"public",
"function",
"put",
"(",
"$",
"pattern",
",",
"$",
"callback",
",",
"array",
"$",
"middleware",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addRoute",
"(",
"'put'",
",",
"$",
"pattern",
",",
"$",
"callback",
"... | Defines a route which will respond to PUT requests
@param string $pattern The route pattern for the URL
@param callable $callback The callback which should be handle the response
@param callable[] $middleware List of the middleware for the route
@param string $name (Optional) Route name. Used for reverse routing.
@re... | [
"Defines",
"a",
"route",
"which",
"will",
"respond",
"to",
"PUT",
"requests"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L202-L207 | train |
DaGhostman/codewave | src/Application/Router.php | Router.patch | public function patch($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('patch', $pattern, $callback, $middleware, $name);
return $this;
} | php | public function patch($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('patch', $pattern, $callback, $middleware, $name);
return $this;
} | [
"public",
"function",
"patch",
"(",
"$",
"pattern",
",",
"$",
"callback",
",",
"array",
"$",
"middleware",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addRoute",
"(",
"'patch'",
",",
"$",
"pattern",
",",
"$",
"callback",... | Defines a route which will respond to PATCH requests
@param string $pattern The route pattern for the URL
@param callable $callback The callback which should be handle the response
@param callable[] $middleware List of the middleware for the route
@param string $name (Optional) Route name. Used for reverse routing.
@... | [
"Defines",
"a",
"route",
"which",
"will",
"respond",
"to",
"PATCH",
"requests"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L219-L224 | train |
DaGhostman/codewave | src/Application/Router.php | Router.delete | public function delete($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('delete', $pattern, $callback, $middleware, $name);
return $this;
} | php | public function delete($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('delete', $pattern, $callback, $middleware, $name);
return $this;
} | [
"public",
"function",
"delete",
"(",
"$",
"pattern",
",",
"$",
"callback",
",",
"array",
"$",
"middleware",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addRoute",
"(",
"'delete'",
",",
"$",
"pattern",
",",
"$",
"callback... | Defines a route which will respond to DELETE requests
@param string $pattern The route pattern for the URL
@param callable $callback The callback which should be handle the response
@param callable[] $middleware List of the middleware for the route
@param string $name (Optional) Route name. Used for reverse routing.
... | [
"Defines",
"a",
"route",
"which",
"will",
"respond",
"to",
"DELETE",
"requests"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L236-L241 | train |
DaGhostman/codewave | src/Application/Router.php | Router.options | public function options($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('options', $pattern, $callback, $middleware, $name);
return $this;
} | php | public function options($pattern, $callback, array $middleware = null, $name = null)
{
$this->addRoute('options', $pattern, $callback, $middleware, $name);
return $this;
} | [
"public",
"function",
"options",
"(",
"$",
"pattern",
",",
"$",
"callback",
",",
"array",
"$",
"middleware",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"addRoute",
"(",
"'options'",
",",
"$",
"pattern",
",",
"$",
"callba... | Defines a route which will respond to OPTIONS requests
@param string $pattern The route pattern for the URL
@param callable $callback The callback which should be handle the response
@param callable[] $middleware List of the middleware for the route
@param string $name (Optional) Route name. Used for reverse routing.
... | [
"Defines",
"a",
"route",
"which",
"will",
"respond",
"to",
"OPTIONS",
"requests"
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L253-L258 | train |
DaGhostman/codewave | src/Application/Router.php | Router.dispatch | public function dispatch(ServerRequestInterface $request, ResponseInterface $response)
{
$method = $request->getMethod();
$uri = $request->getUri()->getPath();
$d = new \FastRoute\Dispatcher\GroupCountBased($this->collector->getData());
$r = $d->dispatch(
($method === '... | php | public function dispatch(ServerRequestInterface $request, ResponseInterface $response)
{
$method = $request->getMethod();
$uri = $request->getUri()->getPath();
$d = new \FastRoute\Dispatcher\GroupCountBased($this->collector->getData());
$r = $d->dispatch(
($method === '... | [
"public",
"function",
"dispatch",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"method",
"=",
"$",
"request",
"->",
"getMethod",
"(",
")",
";",
"$",
"uri",
"=",
"$",
"request",
"->",
"getUri",
"("... | Performs the route matching and invokes the handler for the route, if
there is an error it throws exception.
@param ServerRequestInterface $request
@param ResponseInterface $response
@throws MethodNotAllowedException
@throws NotFoundException
@return ResponseInterface | [
"Performs",
"the",
"route",
"matching",
"and",
"invokes",
"the",
"handler",
"for",
"the",
"route",
"if",
"there",
"is",
"an",
"error",
"it",
"throws",
"exception",
"."
] | f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8 | https://github.com/DaGhostman/codewave/blob/f0f58e721699cdaaf87cbfaf8ce589a6b3c473b8/src/Application/Router.php#L387-L412 | train |
OxfordInfoLabs/kinikit-core | src/Util/XMLUtils.php | XMLUtils.prettyPrint | public static function prettyPrint($xmlString, $htmlDisplay = false) {
// Create a nicely formatted version
$doc = new \DOMDocument();
$doc->loadXML($xmlString);
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$prettyXML = $doc->saveXML();
if ($htm... | php | public static function prettyPrint($xmlString, $htmlDisplay = false) {
// Create a nicely formatted version
$doc = new \DOMDocument();
$doc->loadXML($xmlString);
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$prettyXML = $doc->saveXML();
if ($htm... | [
"public",
"static",
"function",
"prettyPrint",
"(",
"$",
"xmlString",
",",
"$",
"htmlDisplay",
"=",
"false",
")",
"{",
"// Create a nicely formatted version",
"$",
"doc",
"=",
"new",
"\\",
"DOMDocument",
"(",
")",
";",
"$",
"doc",
"->",
"loadXML",
"(",
"$",
... | Pretty print an XML string - if the HTML Display flag is passed it will be formatted for display on a web page
with special characters escaped.
@param string $xmlString
@param boolean $htmlDisplay
@return string | [
"Pretty",
"print",
"an",
"XML",
"string",
"-",
"if",
"the",
"HTML",
"Display",
"flag",
"is",
"passed",
"it",
"will",
"be",
"formatted",
"for",
"display",
"on",
"a",
"web",
"page",
"with",
"special",
"characters",
"escaped",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/XMLUtils.php#L19-L32 | train |
gplcart/cli | controllers/commands/Language.php | Language.cmdUpdateLanguage | public function cmdUpdateLanguage()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
$this->setSubmitted(null, $params);
$this->setSubmitted('update', $params[0]);
$this-... | php | public function cmdUpdateLanguage()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
$this->setSubmitted(null, $params);
$this->setSubmitted('update', $params[0]);
$this-... | [
"public",
"function",
"cmdUpdateLanguage",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
... | Callback for "language-update" | [
"Callback",
"for",
"language",
"-",
"update"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Language.php#L31-L45 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.