id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,300 | czim/laravel-listify | src/Listify.php | Listify.updateListifyPositions | protected function updateListifyPositions()
{
$newPosition = $this->getListifyPosition();
// check for duplicate positions and resolve them if required
if (null === $newPosition) return;
$count = $this->listifyScopedQuery()
->where($this->positionColumn(), $newPosition)... | php | protected function updateListifyPositions()
{
$newPosition = $this->getListifyPosition();
// check for duplicate positions and resolve them if required
if (null === $newPosition) return;
$count = $this->listifyScopedQuery()
->where($this->positionColumn(), $newPosition)... | [
"protected",
"function",
"updateListifyPositions",
"(",
")",
"{",
"$",
"newPosition",
"=",
"$",
"this",
"->",
"getListifyPosition",
"(",
")",
";",
"// check for duplicate positions and resolve them if required",
"if",
"(",
"null",
"===",
"$",
"newPosition",
")",
"retu... | Updates all record positions based on changed position of the record in the current list. | [
"Updates",
"all",
"record",
"positions",
"based",
"on",
"changed",
"position",
"of",
"the",
"record",
"in",
"the",
"current",
"list",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L920-L939 |
31,301 | czim/laravel-listify | src/Listify.php | Listify.getBottomPositionValue | protected function getBottomPositionValue($exclude = null)
{
$item = $this->getBottomItem($exclude);
if ( ! $item) return null;
return $item->getListifyPosition();
} | php | protected function getBottomPositionValue($exclude = null)
{
$item = $this->getBottomItem($exclude);
if ( ! $item) return null;
return $item->getListifyPosition();
} | [
"protected",
"function",
"getBottomPositionValue",
"(",
"$",
"exclude",
"=",
"null",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"getBottomItem",
"(",
"$",
"exclude",
")",
";",
"if",
"(",
"!",
"$",
"item",
")",
"return",
"null",
";",
"return",
"$",
... | Returns the value of the bottom position.
@param null|Model|Listify $exclude a model whose value to exclude in determining the position
@return integer|null | [
"Returns",
"the",
"value",
"of",
"the",
"bottom",
"position",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L948-L955 |
31,302 | czim/laravel-listify | src/Listify.php | Listify.getBottomItem | protected function getBottomItem(Model $exclude = null)
{
$query = $this->listifyScopedQuery()
->whereNotNull($this->getTable() . '.' . $this->positionColumn())
->orderBy($this->getTable() . "." . $this->positionColumn(), "DESC")
->take(1);
if ($exclude) {
... | php | protected function getBottomItem(Model $exclude = null)
{
$query = $this->listifyScopedQuery()
->whereNotNull($this->getTable() . '.' . $this->positionColumn())
->orderBy($this->getTable() . "." . $this->positionColumn(), "DESC")
->take(1);
if ($exclude) {
... | [
"protected",
"function",
"getBottomItem",
"(",
"Model",
"$",
"exclude",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"listifyScopedQuery",
"(",
")",
"->",
"whereNotNull",
"(",
"$",
"this",
"->",
"getTable",
"(",
")",
".",
"'.'",
".",
"$... | Returns the bottom item.
@param null|Model|Listify $exclude a model to exclude as a match
@return null|Model|Listify | [
"Returns",
"the",
"bottom",
"item",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L963-L975 |
31,303 | czim/laravel-listify | src/Listify.php | Listify.getConditionStringFromQueryBuilder | protected function getConditionStringFromQueryBuilder(QueryBuilder $query)
{
$initialQueryChunks = explode('where ', $query->toSql());
if (count($initialQueryChunks) == 1) {
throw new InvalidArgumentException(
'The query builder instance must have a where clause to build... | php | protected function getConditionStringFromQueryBuilder(QueryBuilder $query)
{
$initialQueryChunks = explode('where ', $query->toSql());
if (count($initialQueryChunks) == 1) {
throw new InvalidArgumentException(
'The query builder instance must have a where clause to build... | [
"protected",
"function",
"getConditionStringFromQueryBuilder",
"(",
"QueryBuilder",
"$",
"query",
")",
"{",
"$",
"initialQueryChunks",
"=",
"explode",
"(",
"'where '",
",",
"$",
"query",
"->",
"toSql",
"(",
")",
")",
";",
"if",
"(",
"count",
"(",
"$",
"initi... | Extracts a raw WHERE clause string from a QueryBuilder instance.
Note that this is practically identical to the original Listify.
@param QueryBuilder $query A Query Builder instance
@return string | [
"Extracts",
"a",
"raw",
"WHERE",
"clause",
"string",
"from",
"a",
"QueryBuilder",
"instance",
".",
"Note",
"that",
"this",
"is",
"practically",
"identical",
"to",
"the",
"original",
"Listify",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L990-L1018 |
31,304 | czim/laravel-listify | src/Listify.php | Listify.getConditionStringFromBelongsTo | protected function getConditionStringFromBelongsTo(BelongsTo $relation)
{
$id = $this->getAttribute( $relation->getForeignKeyName() );
// an empty foreign key will, as a null-scope, remove the item from any list
if (null === $id) return null;
return '`' . $relation->getForeignKeyNa... | php | protected function getConditionStringFromBelongsTo(BelongsTo $relation)
{
$id = $this->getAttribute( $relation->getForeignKeyName() );
// an empty foreign key will, as a null-scope, remove the item from any list
if (null === $id) return null;
return '`' . $relation->getForeignKeyNa... | [
"protected",
"function",
"getConditionStringFromBelongsTo",
"(",
"BelongsTo",
"$",
"relation",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"$",
"relation",
"->",
"getForeignKeyName",
"(",
")",
")",
";",
"// an empty foreign key will, as a null-... | Makes a raw where condition string from a BelongsTo relation instance.
@param BelongsTo $relation
@return string | [
"Makes",
"a",
"raw",
"where",
"condition",
"string",
"from",
"a",
"BelongsTo",
"relation",
"instance",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L1026-L1034 |
31,305 | EmchBerger/cube-custom-fields-bundle | src/Form/DataTransformer/EntityCustomFieldTransformer.php | EntityCustomFieldTransformer.transform | public function transform($collection)
{
if ($collection && !is_array($collection) && !($collection instanceof \ArrayAccess)) {
// in case of single entity, we have to make sure it's managed
if (!$this->er->getManager()->contains($collection)) {
$collection = $this->e... | php | public function transform($collection)
{
if ($collection && !is_array($collection) && !($collection instanceof \ArrayAccess)) {
// in case of single entity, we have to make sure it's managed
if (!$this->er->getManager()->contains($collection)) {
$collection = $this->e... | [
"public",
"function",
"transform",
"(",
"$",
"collection",
")",
"{",
"if",
"(",
"$",
"collection",
"&&",
"!",
"is_array",
"(",
"$",
"collection",
")",
"&&",
"!",
"(",
"$",
"collection",
"instanceof",
"\\",
"ArrayAccess",
")",
")",
"{",
"// in case of singl... | No real transformation required in forward direction
@return mixed An array of entities
@throws TransformationFailedException | [
"No",
"real",
"transformation",
"required",
"in",
"forward",
"direction"
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/Form/DataTransformer/EntityCustomFieldTransformer.php#L32-L41 |
31,306 | bearcms/bearframework-addon | classes/BearCMS/Themes.php | Themes.register | public function register(string $id, callable $callback): self
{
Internal\Themes::$registrations[$id] = $callback;
if (Config::$initialized) { // Initialize to add asset dirs
$currentThemeID = Internal\CurrentTheme::getID();
if ($currentThemeID === $id) {
Int... | php | public function register(string $id, callable $callback): self
{
Internal\Themes::$registrations[$id] = $callback;
if (Config::$initialized) { // Initialize to add asset dirs
$currentThemeID = Internal\CurrentTheme::getID();
if ($currentThemeID === $id) {
Int... | [
"public",
"function",
"register",
"(",
"string",
"$",
"id",
",",
"callable",
"$",
"callback",
")",
":",
"self",
"{",
"Internal",
"\\",
"Themes",
"::",
"$",
"registrations",
"[",
"$",
"id",
"]",
"=",
"$",
"callback",
";",
"if",
"(",
"Config",
"::",
"$... | Register a new theme.
@param string $id The theme ID.
@param callable $callback A function to define theme parameters.
@return self Returns a reference to itself. | [
"Register",
"a",
"new",
"theme",
"."
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Themes.php#L29-L41 |
31,307 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.init | public function init ()
{
if (session_status() == PHP_SESSION_NONE)
session_start();
if (isset($_SESSION[ 'notification' ]))
{
$notification = $_SESSION[ 'notification' ];
foreach ($notification as $type => $data)
foreach ($data as $message)
$this->_data[] = new Notification($message,... | php | public function init ()
{
if (session_status() == PHP_SESSION_NONE)
session_start();
if (isset($_SESSION[ 'notification' ]))
{
$notification = $_SESSION[ 'notification' ];
foreach ($notification as $type => $data)
foreach ($data as $message)
$this->_data[] = new Notification($message,... | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"session_status",
"(",
")",
"==",
"PHP_SESSION_NONE",
")",
"session_start",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"'notification'",
"]",
")",
")",
"{",
"$",
"notification",
... | Initialization method for checking if there are some notification
stored in session. If so the list of notifications is populated and
the list of notifications stored in session is cleared.
@return void | [
"Initialization",
"method",
"for",
"checking",
"if",
"there",
"are",
"some",
"notification",
"stored",
"in",
"session",
".",
"If",
"so",
"the",
"list",
"of",
"notifications",
"is",
"populated",
"and",
"the",
"list",
"of",
"notifications",
"stored",
"in",
"sess... | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L70-L84 |
31,308 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.error | public function error ($message, $isRaw = false, $canHide = true)
{
$this->add($message, Notification::ERROR, $isRaw, $canHide);
} | php | public function error ($message, $isRaw = false, $canHide = true)
{
$this->add($message, Notification::ERROR, $isRaw, $canHide);
} | [
"public",
"function",
"error",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"$",
"message",
",",
"Notification",
"::",
"ERROR",
",",
"$",
"isRaw",
",",
"$",
"canHid... | Adds notification of type 'error' to list.
@param string $message Message.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Adds",
"notification",
"of",
"type",
"error",
"to",
"list",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L134-L137 |
31,309 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.errorToSession | public function errorToSession ($message, $isRaw = false, $canHide = true)
{
$this->toSession($message, Notification::ERROR, $isRaw, $canHide);
} | php | public function errorToSession ($message, $isRaw = false, $canHide = true)
{
$this->toSession($message, Notification::ERROR, $isRaw, $canHide);
} | [
"public",
"function",
"errorToSession",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"toSession",
"(",
"$",
"message",
",",
"Notification",
"::",
"ERROR",
",",
"$",
"isRaw",
",",
... | Saves notification of type 'error' type to session.
@param string $message Message.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Saves",
"notification",
"of",
"type",
"error",
"type",
"to",
"session",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L147-L150 |
31,310 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.message | public function message ($message, $isRaw = false, $canHide = true)
{
$this->add($message, Notification::MESSAGE, $isRaw, $canHide);
} | php | public function message ($message, $isRaw = false, $canHide = true)
{
$this->add($message, Notification::MESSAGE, $isRaw, $canHide);
} | [
"public",
"function",
"message",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"$",
"message",
",",
"Notification",
"::",
"MESSAGE",
",",
"$",
"isRaw",
",",
"$",
"ca... | Adds notification of type 'message' to list.
@param string $message Message.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Adds",
"notification",
"of",
"type",
"message",
"to",
"list",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L160-L163 |
31,311 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.messageToSession | public function messageToSession ($message, $isRaw = false, $canHide = true)
{
$this->toSession($message, Notification::MESSAGE, $isRaw, $canHide);
} | php | public function messageToSession ($message, $isRaw = false, $canHide = true)
{
$this->toSession($message, Notification::MESSAGE, $isRaw, $canHide);
} | [
"public",
"function",
"messageToSession",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"toSession",
"(",
"$",
"message",
",",
"Notification",
"::",
"MESSAGE",
",",
"$",
"isRaw",
",... | Saves notification of type 'message' type to session.
@param string $message Message.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Saves",
"notification",
"of",
"type",
"message",
"type",
"to",
"session",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L173-L176 |
31,312 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.warning | public function warning ($message, $isRaw = false, $canHide = true)
{
$this->add($message, Notification::WARNING, $isRaw, $canHide);
} | php | public function warning ($message, $isRaw = false, $canHide = true)
{
$this->add($message, Notification::WARNING, $isRaw, $canHide);
} | [
"public",
"function",
"warning",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"add",
"(",
"$",
"message",
",",
"Notification",
"::",
"WARNING",
",",
"$",
"isRaw",
",",
"$",
"ca... | Adds notification of type 'warning' to list.
@param string $message Message.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Adds",
"notification",
"of",
"type",
"warning",
"to",
"list",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L186-L189 |
31,313 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.warningToSession | public function warningToSession ($message, $isRaw = false, $canHide = true)
{
$this->toSession($message, Notification::WARNING, $isRaw, $canHide);
} | php | public function warningToSession ($message, $isRaw = false, $canHide = true)
{
$this->toSession($message, Notification::WARNING, $isRaw, $canHide);
} | [
"public",
"function",
"warningToSession",
"(",
"$",
"message",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"toSession",
"(",
"$",
"message",
",",
"Notification",
"::",
"WARNING",
",",
"$",
"isRaw",
",... | Saves notification of type 'warning' type to session.
@param string $message Message.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Saves",
"notification",
"of",
"type",
"warning",
"type",
"to",
"session",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L199-L202 |
31,314 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.add | private function add ($message, $type = Notification::ERROR, $isRaw = false, $canHide = true)
{
$this->_data[] = new Notification ($message, $type, $isRaw, $canHide);
} | php | private function add ($message, $type = Notification::ERROR, $isRaw = false, $canHide = true)
{
$this->_data[] = new Notification ($message, $type, $isRaw, $canHide);
} | [
"private",
"function",
"add",
"(",
"$",
"message",
",",
"$",
"type",
"=",
"Notification",
"::",
"ERROR",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"_data",
"[",
"]",
"=",
"new",
"Notification",
... | Adds notification to list.
@param string $message Message.
@param integer $type Message type.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Adds",
"notification",
"to",
"list",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L213-L216 |
31,315 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.getNotifications | private function getNotifications ($type)
{
$data = [];
/** @var Notification $notification */
foreach ($this->_data as $notification)
{
if ($notification->type == $type)
$data[] = $notification;
}
return $data;
} | php | private function getNotifications ($type)
{
$data = [];
/** @var Notification $notification */
foreach ($this->_data as $notification)
{
if ($notification->type == $type)
$data[] = $notification;
}
return $data;
} | [
"private",
"function",
"getNotifications",
"(",
"$",
"type",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"/** @var Notification $notification */",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"notification",
")",
"{",
"if",
"(",
"$",
"notification",... | Finds all notifications of given type.
@param int $type
@return array | [
"Finds",
"all",
"notifications",
"of",
"given",
"type",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L224-L235 |
31,316 | pulsarvp/vps-tools | src/modules/notification/components/NotificationManager.php | NotificationManager.toSession | private function toSession ($message, $type = Notification::ERROR, $isRaw = false, $canHide = true)
{
$ntf = new Notification($message, $type, $isRaw, $canHide);
$notification = isset($_SESSION[ 'notification' ]) ? $_SESSION[ 'notification' ] : [];
$notification[ $type ][] = $ntf->message;
$_SESSION[ 'n... | php | private function toSession ($message, $type = Notification::ERROR, $isRaw = false, $canHide = true)
{
$ntf = new Notification($message, $type, $isRaw, $canHide);
$notification = isset($_SESSION[ 'notification' ]) ? $_SESSION[ 'notification' ] : [];
$notification[ $type ][] = $ntf->message;
$_SESSION[ 'n... | [
"private",
"function",
"toSession",
"(",
"$",
"message",
",",
"$",
"type",
"=",
"Notification",
"::",
"ERROR",
",",
"$",
"isRaw",
"=",
"false",
",",
"$",
"canHide",
"=",
"true",
")",
"{",
"$",
"ntf",
"=",
"new",
"Notification",
"(",
"$",
"message",
"... | Saves notification to session.
@param string $message Message.
@param integer $type Message type.
@param boolean $isRaw Whether given message is raw text or should be translated.
@param boolean $canHide viewed button close.
@return void | [
"Saves",
"notification",
"to",
"session",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/notification/components/NotificationManager.php#L246-L254 |
31,317 | radig/auditable | Lib/QueryLogSource.php | QueryLogSource.getModelQueries | public function getModelQueries(Model $Model, $action = 'create', $associateds = false)
{
$queries = $this->getCleanLog($Model);
$valids = array();
$table = $Model->tablePrefix . $Model->table;
foreach ($queries as $query) {
// Guarda apenas queries do modelo atual que representam a ação executada
if (s... | php | public function getModelQueries(Model $Model, $action = 'create', $associateds = false)
{
$queries = $this->getCleanLog($Model);
$valids = array();
$table = $Model->tablePrefix . $Model->table;
foreach ($queries as $query) {
// Guarda apenas queries do modelo atual que representam a ação executada
if (s... | [
"public",
"function",
"getModelQueries",
"(",
"Model",
"$",
"Model",
",",
"$",
"action",
"=",
"'create'",
",",
"$",
"associateds",
"=",
"false",
")",
"{",
"$",
"queries",
"=",
"$",
"this",
"->",
"getCleanLog",
"(",
"$",
"Model",
")",
";",
"$",
"valids"... | Recupera todas as queries que foram registradas
pelo datasource para um determinado modelo.
@param Model $Model Instancia do modelo que terá
as queries retornadas.
@param string $action 'create' | 'modify' | 'delete'
@param bool $associateds Habilita ou não o retorno
de queries geradas por modelos relacionados. Não... | [
"Recupera",
"todas",
"as",
"queries",
"que",
"foram",
"registradas",
"pelo",
"datasource",
"para",
"um",
"determinado",
"modelo",
"."
] | af8b5031522ebd6d69daa0e694a65c1cb2935b48 | https://github.com/radig/auditable/blob/af8b5031522ebd6d69daa0e694a65c1cb2935b48/Lib/QueryLogSource.php#L90-L104 |
31,318 | gdbots/ncr-php | src/PbjxHelperTrait.php | PbjxHelperTrait.bindFromNode | protected function bindFromNode(Message $message, Node $node, Pbjx $pbjx): void
{
$node->freeze();
$pbjxEvent = new BindFromNodeEvent($message, $node);
$pbjx->trigger($message, 'bind_from_node', $pbjxEvent, false);
} | php | protected function bindFromNode(Message $message, Node $node, Pbjx $pbjx): void
{
$node->freeze();
$pbjxEvent = new BindFromNodeEvent($message, $node);
$pbjx->trigger($message, 'bind_from_node', $pbjxEvent, false);
} | [
"protected",
"function",
"bindFromNode",
"(",
"Message",
"$",
"message",
",",
"Node",
"$",
"node",
",",
"Pbjx",
"$",
"pbjx",
")",
":",
"void",
"{",
"$",
"node",
"->",
"freeze",
"(",
")",
";",
"$",
"pbjxEvent",
"=",
"new",
"BindFromNodeEvent",
"(",
"$",... | The handler generally has the current node which provides
an opportunity to bind data to the event, response, etc.
@param Message $message
@param Node $node
@param Pbjx $pbjx | [
"The",
"handler",
"generally",
"has",
"the",
"current",
"node",
"which",
"provides",
"an",
"opportunity",
"to",
"bind",
"data",
"to",
"the",
"event",
"response",
"etc",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/PbjxHelperTrait.php#L61-L66 |
31,319 | gdbots/ncr-php | src/PbjxHelperTrait.php | PbjxHelperTrait.createGetNodeRequest | protected function createGetNodeRequest(Message $message, NodeRef $nodeRef, Pbjx $pbjx): GetNodeRequest
{
$curie = $message::schema()->getCurie();
/** @var GetNodeRequest $class */
$class = MessageResolver::resolveCurie(SchemaCurie::fromString(
"{$curie->getVendor()}:{$curie->ge... | php | protected function createGetNodeRequest(Message $message, NodeRef $nodeRef, Pbjx $pbjx): GetNodeRequest
{
$curie = $message::schema()->getCurie();
/** @var GetNodeRequest $class */
$class = MessageResolver::resolveCurie(SchemaCurie::fromString(
"{$curie->getVendor()}:{$curie->ge... | [
"protected",
"function",
"createGetNodeRequest",
"(",
"Message",
"$",
"message",
",",
"NodeRef",
"$",
"nodeRef",
",",
"Pbjx",
"$",
"pbjx",
")",
":",
"GetNodeRequest",
"{",
"$",
"curie",
"=",
"$",
"message",
"::",
"schema",
"(",
")",
"->",
"getCurie",
"(",
... | A conventional factory to create a get node request from an existing message
and node ref. Various pbjx lifecycle events need to fetch the node for the
operation currently executing. For example, when attempting to update a node
we fetch the current node in order to make some validations possible.
Override this metho... | [
"A",
"conventional",
"factory",
"to",
"create",
"a",
"get",
"node",
"request",
"from",
"an",
"existing",
"message",
"and",
"node",
"ref",
".",
"Various",
"pbjx",
"lifecycle",
"events",
"need",
"to",
"fetch",
"the",
"node",
"for",
"the",
"operation",
"current... | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/PbjxHelperTrait.php#L84-L94 |
31,320 | gdbots/ncr-php | src/PbjxHelperTrait.php | PbjxHelperTrait.createResponseFromRequest | protected function createResponseFromRequest(Request $request, Pbjx $pbjx): Response
{
$curie = str_replace('-request', '-response', $request::schema()->getCurie()->toString());
/** @var Response $class */
$class = MessageResolver::resolveCurie(SchemaCurie::fromString($curie));
retur... | php | protected function createResponseFromRequest(Request $request, Pbjx $pbjx): Response
{
$curie = str_replace('-request', '-response', $request::schema()->getCurie()->toString());
/** @var Response $class */
$class = MessageResolver::resolveCurie(SchemaCurie::fromString($curie));
retur... | [
"protected",
"function",
"createResponseFromRequest",
"(",
"Request",
"$",
"request",
",",
"Pbjx",
"$",
"pbjx",
")",
":",
"Response",
"{",
"$",
"curie",
"=",
"str_replace",
"(",
"'-request'",
",",
"'-response'",
",",
"$",
"request",
"::",
"schema",
"(",
")",... | Conventionally the response messages are named the same as the request but
with a "-response" suffix. Override when needed.
@param Request $request
@param Pbjx $pbjx
@return Response | [
"Conventionally",
"the",
"response",
"messages",
"are",
"named",
"the",
"same",
"as",
"the",
"request",
"but",
"with",
"a",
"-",
"response",
"suffix",
".",
"Override",
"when",
"needed",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/PbjxHelperTrait.php#L105-L111 |
31,321 | gdbots/ncr-php | src/Validator/NodeIdempotencyValidator.php | NodeIdempotencyValidator.onCreateNodeAfterHandle | public function onCreateNodeAfterHandle(PbjxEvent $pbjxEvent): void
{
$command = $pbjxEvent->getMessage();
if (!$command->has('node')) {
return;
}
/** @var Node $node */
$node = $command->get('node');
if ($this->shouldIgnoreNode($node)) {
retu... | php | public function onCreateNodeAfterHandle(PbjxEvent $pbjxEvent): void
{
$command = $pbjxEvent->getMessage();
if (!$command->has('node')) {
return;
}
/** @var Node $node */
$node = $command->get('node');
if ($this->shouldIgnoreNode($node)) {
retu... | [
"public",
"function",
"onCreateNodeAfterHandle",
"(",
"PbjxEvent",
"$",
"pbjxEvent",
")",
":",
"void",
"{",
"$",
"command",
"=",
"$",
"pbjxEvent",
"->",
"getMessage",
"(",
")",
";",
"if",
"(",
"!",
"$",
"command",
"->",
"has",
"(",
"'node'",
")",
")",
... | Populates cache keys so idempotency check can reject duplicates
after nodes are successfully created.
@param PbjxEvent $pbjxEvent | [
"Populates",
"cache",
"keys",
"so",
"idempotency",
"check",
"can",
"reject",
"duplicates",
"after",
"nodes",
"are",
"successfully",
"created",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Validator/NodeIdempotencyValidator.php#L89-L109 |
31,322 | gdbots/ncr-php | src/Validator/NodeIdempotencyValidator.php | NodeIdempotencyValidator.getIdempotencyKeys | public function getIdempotencyKeys(Node $node): array
{
$qname = $node::schema()->getQName();
$keys = [];
if ($node->has('title')) {
$keys[$this->getCacheKey($qname, SlugUtils::create($node->get('title')))] = true;
}
if ($node->has('slug')) {
$keys[$... | php | public function getIdempotencyKeys(Node $node): array
{
$qname = $node::schema()->getQName();
$keys = [];
if ($node->has('title')) {
$keys[$this->getCacheKey($qname, SlugUtils::create($node->get('title')))] = true;
}
if ($node->has('slug')) {
$keys[$... | [
"public",
"function",
"getIdempotencyKeys",
"(",
"Node",
"$",
"node",
")",
":",
"array",
"{",
"$",
"qname",
"=",
"$",
"node",
"::",
"schema",
"(",
")",
"->",
"getQName",
"(",
")",
";",
"$",
"keys",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"node",
"->"... | Derives the keys to use for the idempotency check from the node itself.
@param Node $node
@return array | [
"Derives",
"the",
"keys",
"to",
"use",
"for",
"the",
"idempotency",
"check",
"from",
"the",
"node",
"itself",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Validator/NodeIdempotencyValidator.php#L118-L136 |
31,323 | starweb/starlit-db | src/BasicDbEntityService.php | BasicDbEntityService.load | public function load(AbstractDbEntity $dbEntity)
{
// Check that the primary key is set
if (!$dbEntity->getPrimaryDbValue()) {
throw new \InvalidArgumentException(
'Database entity can not be loaded because primary value is not set'
);
}
// Fe... | php | public function load(AbstractDbEntity $dbEntity)
{
// Check that the primary key is set
if (!$dbEntity->getPrimaryDbValue()) {
throw new \InvalidArgumentException(
'Database entity can not be loaded because primary value is not set'
);
}
// Fe... | [
"public",
"function",
"load",
"(",
"AbstractDbEntity",
"$",
"dbEntity",
")",
"{",
"// Check that the primary key is set",
"if",
"(",
"!",
"$",
"dbEntity",
"->",
"getPrimaryDbValue",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Datab... | Load object's values from database table.
@param AbstractDbEntity $dbEntity
@throws Exception\EntityNotFoundException | [
"Load",
"object",
"s",
"values",
"from",
"database",
"table",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/BasicDbEntityService.php#L44-L68 |
31,324 | starweb/starlit-db | src/BasicDbEntityService.php | BasicDbEntityService.save | public function save(AbstractDbEntity $dbEntity)
{
if ($dbEntity->shouldBeDeletedFromDbOnSave()) {
// Only delete if previously saved to db
if ($dbEntity->getPrimaryDbValue()) {
$this->delete($dbEntity);
}
return false;
}
if (... | php | public function save(AbstractDbEntity $dbEntity)
{
if ($dbEntity->shouldBeDeletedFromDbOnSave()) {
// Only delete if previously saved to db
if ($dbEntity->getPrimaryDbValue()) {
$this->delete($dbEntity);
}
return false;
}
if (... | [
"public",
"function",
"save",
"(",
"AbstractDbEntity",
"$",
"dbEntity",
")",
"{",
"if",
"(",
"$",
"dbEntity",
"->",
"shouldBeDeletedFromDbOnSave",
"(",
")",
")",
"{",
"// Only delete if previously saved to db",
"if",
"(",
"$",
"dbEntity",
"->",
"getPrimaryDbValue",
... | Save entity to database table.
@param AbstractDbEntity $dbEntity
@return bool | [
"Save",
"entity",
"to",
"database",
"table",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/BasicDbEntityService.php#L76-L158 |
31,325 | starweb/starlit-db | src/BasicDbEntityService.php | BasicDbEntityService.delete | public function delete(AbstractDbEntity $dbEntity)
{
if (!$dbEntity->getPrimaryDbValue()) {
throw new \InvalidArgumentException('Primary database value not set');
}
$this->db->exec(
'DELETE FROM `' . $dbEntity->getDbTableName() . '` WHERE ' . $this->getPrimaryKeyWher... | php | public function delete(AbstractDbEntity $dbEntity)
{
if (!$dbEntity->getPrimaryDbValue()) {
throw new \InvalidArgumentException('Primary database value not set');
}
$this->db->exec(
'DELETE FROM `' . $dbEntity->getDbTableName() . '` WHERE ' . $this->getPrimaryKeyWher... | [
"public",
"function",
"delete",
"(",
"AbstractDbEntity",
"$",
"dbEntity",
")",
"{",
"if",
"(",
"!",
"$",
"dbEntity",
"->",
"getPrimaryDbValue",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Primary database value not set'",
")",
";... | Delete entity's corresponding database row.
@param AbstractDbEntity $dbEntity | [
"Delete",
"entity",
"s",
"corresponding",
"database",
"row",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/BasicDbEntityService.php#L165-L177 |
31,326 | gdbots/ncr-php | src/Repository/DynamoDb/BatchGetItemRequest.php | BatchGetItemRequest.addItemKey | public function addItemKey(string $table, array $key): self
{
$this->queue[] = ['table' => $table, 'key' => $key];
return $this;
} | php | public function addItemKey(string $table, array $key): self
{
$this->queue[] = ['table' => $table, 'key' => $key];
return $this;
} | [
"public",
"function",
"addItemKey",
"(",
"string",
"$",
"table",
",",
"array",
"$",
"key",
")",
":",
"self",
"{",
"$",
"this",
"->",
"queue",
"[",
"]",
"=",
"[",
"'table'",
"=>",
"$",
"table",
",",
"'key'",
"=>",
"$",
"key",
"]",
";",
"return",
"... | Adds an item key to get in this batch request.
@param string $table
@param array $key
@return self | [
"Adds",
"an",
"item",
"key",
"to",
"get",
"in",
"this",
"batch",
"request",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/BatchGetItemRequest.php#L116-L120 |
31,327 | gdbots/ncr-php | src/Repository/DynamoDb/BatchGetItemRequest.php | BatchGetItemRequest.getItems | public function getItems(): array
{
$allItems = [];
while ($this->queue) {
$commands = $this->prepareCommands();
$pool = new CommandPool($this->client, $commands, [
'concurrency' => $this->poolSize,
'fulfilled' => function (ResultInterface $... | php | public function getItems(): array
{
$allItems = [];
while ($this->queue) {
$commands = $this->prepareCommands();
$pool = new CommandPool($this->client, $commands, [
'concurrency' => $this->poolSize,
'fulfilled' => function (ResultInterface $... | [
"public",
"function",
"getItems",
"(",
")",
":",
"array",
"{",
"$",
"allItems",
"=",
"[",
"]",
";",
"while",
"(",
"$",
"this",
"->",
"queue",
")",
"{",
"$",
"commands",
"=",
"$",
"this",
"->",
"prepareCommands",
"(",
")",
";",
"$",
"pool",
"=",
"... | Processes the batch by combining all the queued requests into
BatchGetItem commands and executing them. UnprocessedKeys
are automatically re-queued.
@return array | [
"Processes",
"the",
"batch",
"by",
"combining",
"all",
"the",
"queued",
"requests",
"into",
"BatchGetItem",
"commands",
"and",
"executing",
"them",
".",
"UnprocessedKeys",
"are",
"automatically",
"re",
"-",
"queued",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/BatchGetItemRequest.php#L129-L165 |
31,328 | gdbots/ncr-php | src/Repository/DynamoDb/BatchGetItemRequest.php | BatchGetItemRequest.prepareCommands | private function prepareCommands(): array
{
$batches = array_chunk($this->queue, $this->batchSize);
$this->queue = [];
$commands = [];
foreach ($batches as $batch) {
$requests = [];
foreach ($batch as $item) {
if (!isset($requests[$item['table... | php | private function prepareCommands(): array
{
$batches = array_chunk($this->queue, $this->batchSize);
$this->queue = [];
$commands = [];
foreach ($batches as $batch) {
$requests = [];
foreach ($batch as $item) {
if (!isset($requests[$item['table... | [
"private",
"function",
"prepareCommands",
"(",
")",
":",
"array",
"{",
"$",
"batches",
"=",
"array_chunk",
"(",
"$",
"this",
"->",
"queue",
",",
"$",
"this",
"->",
"batchSize",
")",
";",
"$",
"this",
"->",
"queue",
"=",
"[",
"]",
";",
"$",
"commands"... | Creates BatchGetItem commands from the items in the queue.
@return CommandInterface[] | [
"Creates",
"BatchGetItem",
"commands",
"from",
"the",
"items",
"in",
"the",
"queue",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/BatchGetItemRequest.php#L172-L190 |
31,329 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.checkStaticProperties | private static function checkStaticProperties()
{
static $checkedClasses = [];
if (!in_array(static::class, $checkedClasses)) {
if (empty(static::$dbTableName)
|| empty(static::$dbProperties)
|| empty(static::$primaryDbPropertyKey)
|| (is_s... | php | private static function checkStaticProperties()
{
static $checkedClasses = [];
if (!in_array(static::class, $checkedClasses)) {
if (empty(static::$dbTableName)
|| empty(static::$dbProperties)
|| empty(static::$primaryDbPropertyKey)
|| (is_s... | [
"private",
"static",
"function",
"checkStaticProperties",
"(",
")",
"{",
"static",
"$",
"checkedClasses",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"in_array",
"(",
"static",
"::",
"class",
",",
"$",
"checkedClasses",
")",
")",
"{",
"if",
"(",
"empty",
"(",
... | Make sure that class has all necessary static properties set. | [
"Make",
"sure",
"that",
"class",
"has",
"all",
"necessary",
"static",
"properties",
"set",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L142-L158 |
31,330 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.getDefaultDbData | public function getDefaultDbData()
{
$class = get_called_class();
if (!isset(self::$cachedDefaultDbData[$class])) {
self::$cachedDefaultDbData[$class] = [];
foreach (array_keys(static::$dbProperties) as $propertyName) {
self::$cachedDefaultDbData[$class][$prop... | php | public function getDefaultDbData()
{
$class = get_called_class();
if (!isset(self::$cachedDefaultDbData[$class])) {
self::$cachedDefaultDbData[$class] = [];
foreach (array_keys(static::$dbProperties) as $propertyName) {
self::$cachedDefaultDbData[$class][$prop... | [
"public",
"function",
"getDefaultDbData",
"(",
")",
"{",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"cachedDefaultDbData",
"[",
"$",
"class",
"]",
")",
")",
"{",
"self",
"::",
"$",
"cachedDefa... | Get all default database values.
@return array | [
"Get",
"all",
"default",
"database",
"values",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L179-L190 |
31,331 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.updatePrimaryDbValueFromDbData | public function updatePrimaryDbValueFromDbData()
{
$dbDataPrimaryValue = $this->getDbDataPrimaryValue();
if ($dbDataPrimaryValue !== $this->getDbDataPrimaryDefaultValue()) {
$this->setPrimaryDbValue($dbDataPrimaryValue);
}
} | php | public function updatePrimaryDbValueFromDbData()
{
$dbDataPrimaryValue = $this->getDbDataPrimaryValue();
if ($dbDataPrimaryValue !== $this->getDbDataPrimaryDefaultValue()) {
$this->setPrimaryDbValue($dbDataPrimaryValue);
}
} | [
"public",
"function",
"updatePrimaryDbValueFromDbData",
"(",
")",
"{",
"$",
"dbDataPrimaryValue",
"=",
"$",
"this",
"->",
"getDbDataPrimaryValue",
"(",
")",
";",
"if",
"(",
"$",
"dbDataPrimaryValue",
"!==",
"$",
"this",
"->",
"getDbDataPrimaryDefaultValue",
"(",
"... | Update primary database value with data from set database data. | [
"Update",
"primary",
"database",
"value",
"with",
"data",
"from",
"set",
"database",
"data",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L254-L261 |
31,332 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.setDbValue | protected function setDbValue($property, $value, $setAsModified = true, $force = false)
{
$value = $this->getValueWithPropertyType($property, $value);
if ($this->dbData[$property] !== $value || $force) {
$this->dbData[$property] = $value;
if ($setAsModified && !$this->isDbP... | php | protected function setDbValue($property, $value, $setAsModified = true, $force = false)
{
$value = $this->getValueWithPropertyType($property, $value);
if ($this->dbData[$property] !== $value || $force) {
$this->dbData[$property] = $value;
if ($setAsModified && !$this->isDbP... | [
"protected",
"function",
"setDbValue",
"(",
"$",
"property",
",",
"$",
"value",
",",
"$",
"setAsModified",
"=",
"true",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getValueWithPropertyType",
"(",
"$",
"property",
","... | Set a row field value.
@param string $property
@param mixed $value
@param bool $setAsModified
@param bool $force | [
"Set",
"a",
"row",
"field",
"value",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L329-L340 |
31,333 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.setDbData | public function setDbData(array $data)
{
foreach (array_keys(static::$dbProperties) as $propertyName) {
if (array_key_exists($propertyName, $data)) {
$this->setDbValue($propertyName, $data[$propertyName], true);
}
}
} | php | public function setDbData(array $data)
{
foreach (array_keys(static::$dbProperties) as $propertyName) {
if (array_key_exists($propertyName, $data)) {
$this->setDbValue($propertyName, $data[$propertyName], true);
}
}
} | [
"public",
"function",
"setDbData",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"static",
"::",
"$",
"dbProperties",
")",
"as",
"$",
"propertyName",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"propertyName",
",",
"$",
"... | Set database fields' data.
@param array $data | [
"Set",
"database",
"fields",
"data",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L548-L555 |
31,334 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.setDbDataFromRow | public function setDbDataFromRow(array $rowData)
{
// If there are less row data than properties, use rows as starting point (optimization)
if (count($rowData) < count(static::$dbProperties)) {
foreach ($rowData as $dbFieldName => $value) {
$propertyName = static::getDbPr... | php | public function setDbDataFromRow(array $rowData)
{
// If there are less row data than properties, use rows as starting point (optimization)
if (count($rowData) < count(static::$dbProperties)) {
foreach ($rowData as $dbFieldName => $value) {
$propertyName = static::getDbPr... | [
"public",
"function",
"setDbDataFromRow",
"(",
"array",
"$",
"rowData",
")",
"{",
"// If there are less row data than properties, use rows as starting point (optimization)",
"if",
"(",
"count",
"(",
"$",
"rowData",
")",
"<",
"count",
"(",
"static",
"::",
"$",
"dbPropert... | Set db data from raw database row data with field names in database format.
@param array $rowData | [
"Set",
"db",
"data",
"from",
"raw",
"database",
"row",
"data",
"with",
"field",
"names",
"in",
"database",
"format",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L562-L583 |
31,335 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.getDbPropertyNames | public static function getDbPropertyNames(array $exclude = [])
{
$dbPropertyNames = array_keys(static::$dbProperties);
return $exclude ? array_diff($dbPropertyNames, $exclude) : $dbPropertyNames;
} | php | public static function getDbPropertyNames(array $exclude = [])
{
$dbPropertyNames = array_keys(static::$dbProperties);
return $exclude ? array_diff($dbPropertyNames, $exclude) : $dbPropertyNames;
} | [
"public",
"static",
"function",
"getDbPropertyNames",
"(",
"array",
"$",
"exclude",
"=",
"[",
"]",
")",
"{",
"$",
"dbPropertyNames",
"=",
"array_keys",
"(",
"static",
"::",
"$",
"dbProperties",
")",
";",
"return",
"$",
"exclude",
"?",
"array_diff",
"(",
"$... | Return array with db property names.
@param array $exclude
@return array | [
"Return",
"array",
"with",
"db",
"property",
"names",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L767-L772 |
31,336 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.getDbFieldNames | public static function getDbFieldNames(array $exclude = [])
{
$fieldNames = [];
foreach (array_keys(static::$dbProperties) as $propertyName) {
$fieldNames[] = static::getDbFieldName($propertyName);
}
return $exclude ? array_diff($fieldNames, $exclude) : $fieldNames;
... | php | public static function getDbFieldNames(array $exclude = [])
{
$fieldNames = [];
foreach (array_keys(static::$dbProperties) as $propertyName) {
$fieldNames[] = static::getDbFieldName($propertyName);
}
return $exclude ? array_diff($fieldNames, $exclude) : $fieldNames;
... | [
"public",
"static",
"function",
"getDbFieldNames",
"(",
"array",
"$",
"exclude",
"=",
"[",
"]",
")",
"{",
"$",
"fieldNames",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_keys",
"(",
"static",
"::",
"$",
"dbProperties",
")",
"as",
"$",
"propertyName",
")",
... | Return array with raw db field names.
@param array $exclude
@return array | [
"Return",
"array",
"with",
"raw",
"db",
"field",
"names",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L780-L788 |
31,337 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.filterStripDbRowData | public static function filterStripDbRowData(array $rowData, $dbTableAlias, $skipStrip = false)
{
$columnPrefix = $dbTableAlias . '_';
$filteredAndStrippedRowData = [];
foreach ($rowData as $key => $val) {
if (strpos($key, $columnPrefix) === 0) {
$strippedKey = $s... | php | public static function filterStripDbRowData(array $rowData, $dbTableAlias, $skipStrip = false)
{
$columnPrefix = $dbTableAlias . '_';
$filteredAndStrippedRowData = [];
foreach ($rowData as $key => $val) {
if (strpos($key, $columnPrefix) === 0) {
$strippedKey = $s... | [
"public",
"static",
"function",
"filterStripDbRowData",
"(",
"array",
"$",
"rowData",
",",
"$",
"dbTableAlias",
",",
"$",
"skipStrip",
"=",
"false",
")",
"{",
"$",
"columnPrefix",
"=",
"$",
"dbTableAlias",
".",
"'_'",
";",
"$",
"filteredAndStrippedRowData",
"=... | Filters a full db item array by it's table alias and the strips the table alias.
@param array $rowData
@param string $dbTableAlias
@param bool $skipStrip For cases when you want to filter only (no stripping)
@return array | [
"Filters",
"a",
"full",
"db",
"item",
"array",
"by",
"it",
"s",
"table",
"alias",
"and",
"the",
"strips",
"the",
"table",
"alias",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L830-L843 |
31,338 | starweb/starlit-db | src/AbstractDbEntity.php | AbstractDbEntity.unserialize | public function unserialize($serializedObject)
{
$objectVars = unserialize($serializedObject);
foreach ($objectVars as $key => $value) {
$this->{$key} = $value;
}
} | php | public function unserialize($serializedObject)
{
$objectVars = unserialize($serializedObject);
foreach ($objectVars as $key => $value) {
$this->{$key} = $value;
}
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serializedObject",
")",
"{",
"$",
"objectVars",
"=",
"unserialize",
"(",
"$",
"serializedObject",
")",
";",
"foreach",
"(",
"$",
"objectVars",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"-... | Method to handle the unserialization of this object.
Implementation of Serializable interface. If descendant private properties
should be unserialized, they need to be visible to this parent (i.e. not private).
@param string $serializedObject | [
"Method",
"to",
"handle",
"the",
"unserialization",
"of",
"this",
"object",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntity.php#L874-L881 |
31,339 | gdbots/ncr-php | src/AbstractNodeCommandHandler.php | AbstractNodeCommandHandler.createEventFromCommand | protected function createEventFromCommand(Command $command, string $suffix): Event
{
/** @var NodeRef $nodeRef */
$nodeRef = $command->get('node_ref') ?: NodeRef::fromNode($command->get('node'));
$curie = $command::schema()->getCurie();
$eventCurie = "{$curie->getVendor()}:{$curie->g... | php | protected function createEventFromCommand(Command $command, string $suffix): Event
{
/** @var NodeRef $nodeRef */
$nodeRef = $command->get('node_ref') ?: NodeRef::fromNode($command->get('node'));
$curie = $command::schema()->getCurie();
$eventCurie = "{$curie->getVendor()}:{$curie->g... | [
"protected",
"function",
"createEventFromCommand",
"(",
"Command",
"$",
"command",
",",
"string",
"$",
"suffix",
")",
":",
"Event",
"{",
"/** @var NodeRef $nodeRef */",
"$",
"nodeRef",
"=",
"$",
"command",
"->",
"get",
"(",
"'node_ref'",
")",
"?",
":",
"NodeRe... | 90% of the time this works 100% of the time. When events for common
node operations match the convention of "blah-suffix" you can use
this method to save some typing. It's always optional.
@param Command $command
@param string $suffix
@return Event | [
"90%",
"of",
"the",
"time",
"this",
"works",
"100%",
"of",
"the",
"time",
".",
"When",
"events",
"for",
"common",
"node",
"operations",
"match",
"the",
"convention",
"of",
"blah",
"-",
"suffix",
"you",
"can",
"use",
"this",
"method",
"to",
"save",
"some"... | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/AbstractNodeCommandHandler.php#L58-L68 |
31,340 | gdbots/ncr-php | src/NcrLazyLoader.php | NcrLazyLoader.hasNodeRef | public function hasNodeRef(NodeRef $nodeRef): bool
{
if (null === $this->getNodeBatchRequest) {
return false;
}
return $this->getNodeBatchRequest->isInSet('node_refs', $nodeRef);
} | php | public function hasNodeRef(NodeRef $nodeRef): bool
{
if (null === $this->getNodeBatchRequest) {
return false;
}
return $this->getNodeBatchRequest->isInSet('node_refs', $nodeRef);
} | [
"public",
"function",
"hasNodeRef",
"(",
"NodeRef",
"$",
"nodeRef",
")",
":",
"bool",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getNodeBatchRequest",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"getNodeBatchRequest",
"->",
... | Returns true if the given NodeRef is in the pending lazy load request.
@param NodeRef $nodeRef
@return bool | [
"Returns",
"true",
"if",
"the",
"given",
"NodeRef",
"is",
"in",
"the",
"pending",
"lazy",
"load",
"request",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/NcrLazyLoader.php#L45-L52 |
31,341 | gdbots/ncr-php | src/NcrLazyLoader.php | NcrLazyLoader.removeNodeRefs | public function removeNodeRefs(array $nodeRefs): void
{
if (null === $this->getNodeBatchRequest) {
return;
}
$this->getNodeBatchRequest->removeFromSet('node_refs', $nodeRefs);
} | php | public function removeNodeRefs(array $nodeRefs): void
{
if (null === $this->getNodeBatchRequest) {
return;
}
$this->getNodeBatchRequest->removeFromSet('node_refs', $nodeRefs);
} | [
"public",
"function",
"removeNodeRefs",
"(",
"array",
"$",
"nodeRefs",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getNodeBatchRequest",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"getNodeBatchRequest",
"->",
"removeFromSet",
... | Removes an array of NodeRefs from the deferrered request.
@param NodeRef[] $nodeRefs | [
"Removes",
"an",
"array",
"of",
"NodeRefs",
"from",
"the",
"deferrered",
"request",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/NcrLazyLoader.php#L138-L145 |
31,342 | gdbots/ncr-php | src/NcrLazyLoader.php | NcrLazyLoader.flush | public function flush(): void
{
if (null === $this->getNodeBatchRequest) {
return;
}
if (!$this->getNodeBatchRequest->has('node_refs')) {
return;
}
try {
$request = $this->getNodeBatchRequest;
$this->getNodeBatchRequest = null... | php | public function flush(): void
{
if (null === $this->getNodeBatchRequest) {
return;
}
if (!$this->getNodeBatchRequest->has('node_refs')) {
return;
}
try {
$request = $this->getNodeBatchRequest;
$this->getNodeBatchRequest = null... | [
"public",
"function",
"flush",
"(",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getNodeBatchRequest",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"getNodeBatchRequest",
"->",
"has",
"(",
"'node_refs'",
")",... | Processes the deferrered request which should populate the
NcrCache once complete. At least for any nodes that exist. | [
"Processes",
"the",
"deferrered",
"request",
"which",
"should",
"populate",
"the",
"NcrCache",
"once",
"complete",
".",
"At",
"least",
"for",
"any",
"nodes",
"that",
"exist",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/NcrLazyLoader.php#L159-L179 |
31,343 | gdbots/ncr-php | src/Search/Elastica/QueryFactory.php | QueryFactory.filterStatuses | protected function filterStatuses(SearchNodesRequest $request, Query\BoolQuery $query): void
{
if (!$request->has('statuses')) {
return;
}
$statuses = array_map('strval', $request->get('statuses'));
$query->addFilter(new Query\Terms('status', $statuses));
} | php | protected function filterStatuses(SearchNodesRequest $request, Query\BoolQuery $query): void
{
if (!$request->has('statuses')) {
return;
}
$statuses = array_map('strval', $request->get('statuses'));
$query->addFilter(new Query\Terms('status', $statuses));
} | [
"protected",
"function",
"filterStatuses",
"(",
"SearchNodesRequest",
"$",
"request",
",",
"Query",
"\\",
"BoolQuery",
"$",
"query",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"has",
"(",
"'statuses'",
")",
")",
"{",
"return",
";",
"}",... | Add the "statuses" into one terms query as it's more efficient.
@link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html
@param SearchNodesRequest $request
@param Query\BoolQuery $query | [
"Add",
"the",
"statuses",
"into",
"one",
"terms",
"query",
"as",
"it",
"s",
"more",
"efficient",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Search/Elastica/QueryFactory.php#L65-L73 |
31,344 | gdbots/ncr-php | src/NcrRequestInterceptor.php | NcrRequestInterceptor.enrichGetNodeRequest | public function enrichGetNodeRequest(PbjxEvent $pbjxEvent): void
{
$request = $pbjxEvent->getMessage();
if ($request->has('node_ref')
|| $request->get('consistent_read')
|| !$request->has('qname')
|| !$request->has('slug')
) {
return;
}... | php | public function enrichGetNodeRequest(PbjxEvent $pbjxEvent): void
{
$request = $pbjxEvent->getMessage();
if ($request->has('node_ref')
|| $request->get('consistent_read')
|| !$request->has('qname')
|| !$request->has('slug')
) {
return;
}... | [
"public",
"function",
"enrichGetNodeRequest",
"(",
"PbjxEvent",
"$",
"pbjxEvent",
")",
":",
"void",
"{",
"$",
"request",
"=",
"$",
"pbjxEvent",
"->",
"getMessage",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"has",
"(",
"'node_ref'",
")",
"||",
"$",
... | Enrich the request with a node_ref if possible to minimize
the number of lookups against the slug secondary index.
@param PbjxEvent $pbjxEvent | [
"Enrich",
"the",
"request",
"with",
"a",
"node_ref",
"if",
"possible",
"to",
"minimize",
"the",
"number",
"of",
"lookups",
"against",
"the",
"slug",
"secondary",
"index",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/NcrRequestInterceptor.php#L72-L99 |
31,345 | gdbots/ncr-php | src/NcrCache.php | NcrCache.pruneNodeCache | private function pruneNodeCache(): void
{
if ($this->maxItems > 0 && count($this->nodes) > $this->maxItems) {
$this->nodes = array_slice($this->nodes, (int)($this->maxItems * 0.2), null, true);
}
} | php | private function pruneNodeCache(): void
{
if ($this->maxItems > 0 && count($this->nodes) > $this->maxItems) {
$this->nodes = array_slice($this->nodes, (int)($this->maxItems * 0.2), null, true);
}
} | [
"private",
"function",
"pruneNodeCache",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"maxItems",
">",
"0",
"&&",
"count",
"(",
"$",
"this",
"->",
"nodes",
")",
">",
"$",
"this",
"->",
"maxItems",
")",
"{",
"$",
"this",
"->",
"nodes",
... | Prunes node cache by removing 20% of the cache if it is full. | [
"Prunes",
"node",
"cache",
"by",
"removing",
"20%",
"of",
"the",
"cache",
"if",
"it",
"is",
"full",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/NcrCache.php#L220-L225 |
31,346 | starweb/starlit-db | src/Db.php | Db.executeQuery | protected function executeQuery($sql, array $parameters = [])
{
$this->connect();
$dbParameters = $this->prepareParameters($parameters);
try {
$pdoStatement = $this->pdo->prepare($sql);
$pdoStatement->execute($dbParameters);
return $pdoStatement;
... | php | protected function executeQuery($sql, array $parameters = [])
{
$this->connect();
$dbParameters = $this->prepareParameters($parameters);
try {
$pdoStatement = $this->pdo->prepare($sql);
$pdoStatement->execute($dbParameters);
return $pdoStatement;
... | [
"protected",
"function",
"executeQuery",
"(",
"$",
"sql",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"dbParameters",
"=",
"$",
"this",
"->",
"prepareParameters",
"(",
"$",
"parameters",
"... | Creates and executes a PDO statement.
@param string $sql
@param array $parameters
@return PDOStatement | [
"Creates",
"and",
"executes",
"a",
"PDO",
"statement",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/Db.php#L189-L202 |
31,347 | starweb/starlit-db | src/Db.php | Db.exec | public function exec($sql, array $parameters = [])
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->rowCount();
} | php | public function exec($sql, array $parameters = [])
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->rowCount();
} | [
"public",
"function",
"exec",
"(",
"$",
"sql",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"sql",
",",
"$",
"parameters",
")",
";",
"return",
"$",
"statement",
"->",
... | Execute an SQL statement and return the number of affected rows.
@param string $sql
@param array $parameters
@return int The number of rows affected | [
"Execute",
"an",
"SQL",
"statement",
"and",
"return",
"the",
"number",
"of",
"affected",
"rows",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/Db.php#L211-L216 |
31,348 | starweb/starlit-db | src/Db.php | Db.fetchRow | public function fetchRow($sql, array $parameters = [], $indexedKeys = false)
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->fetch($indexedKeys ? PDO::FETCH_NUM : PDO::FETCH_ASSOC);
} | php | public function fetchRow($sql, array $parameters = [], $indexedKeys = false)
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->fetch($indexedKeys ? PDO::FETCH_NUM : PDO::FETCH_ASSOC);
} | [
"public",
"function",
"fetchRow",
"(",
"$",
"sql",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"indexedKeys",
"=",
"false",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"sql",
",",
"$",
"parameters",
")"... | Execute an SQL statement and return the first row.
@param string $sql
@param array $parameters
@param bool $indexedKeys
@return array|false | [
"Execute",
"an",
"SQL",
"statement",
"and",
"return",
"the",
"first",
"row",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/Db.php#L226-L231 |
31,349 | starweb/starlit-db | src/Db.php | Db.fetchRows | public function fetchRows($sql, array $parameters = [], $indexedKeys = false)
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->fetchAll($indexedKeys ? PDO::FETCH_NUM : PDO::FETCH_ASSOC);
} | php | public function fetchRows($sql, array $parameters = [], $indexedKeys = false)
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->fetchAll($indexedKeys ? PDO::FETCH_NUM : PDO::FETCH_ASSOC);
} | [
"public",
"function",
"fetchRows",
"(",
"$",
"sql",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"indexedKeys",
"=",
"false",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"sql",
",",
"$",
"parameters",
")... | Execute an SQL statement and return all rows as an array.
@param string $sql
@param array $parameters
@param bool $indexedKeys
@return array | [
"Execute",
"an",
"SQL",
"statement",
"and",
"return",
"all",
"rows",
"as",
"an",
"array",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/Db.php#L241-L246 |
31,350 | starweb/starlit-db | src/Db.php | Db.fetchValue | public function fetchValue($sql, array $parameters = [])
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->fetchColumn(0);
} | php | public function fetchValue($sql, array $parameters = [])
{
$statement = $this->executeQuery($sql, $parameters);
return $statement->fetchColumn(0);
} | [
"public",
"function",
"fetchValue",
"(",
"$",
"sql",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"sql",
",",
"$",
"parameters",
")",
";",
"return",
"$",
"statement",
"-... | Execute an SQL statement and return the first column of the first row.
@param string $sql
@param array $parameters
@return string|false | [
"Execute",
"an",
"SQL",
"statement",
"and",
"return",
"the",
"first",
"column",
"of",
"the",
"first",
"row",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/Db.php#L255-L260 |
31,351 | starweb/starlit-db | src/Db.php | Db.prepareParameters | protected function prepareParameters(array $parameters = [])
{
foreach ($parameters as &$parameterValue) {
if (is_bool($parameterValue)) {
$parameterValue = (int) $parameterValue;
} elseif ($parameterValue instanceof \DateTimeInterface) {
$parameterVal... | php | protected function prepareParameters(array $parameters = [])
{
foreach ($parameters as &$parameterValue) {
if (is_bool($parameterValue)) {
$parameterValue = (int) $parameterValue;
} elseif ($parameterValue instanceof \DateTimeInterface) {
$parameterVal... | [
"protected",
"function",
"prepareParameters",
"(",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"&",
"$",
"parameterValue",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"parameterValue",
")",
")",
"{",
"$",
... | Prepare parameters for database use.
@param array $parameters
@return array | [
"Prepare",
"parameters",
"for",
"database",
"use",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/Db.php#L293-L309 |
31,352 | gdbots/ncr-php | src/Repository/DynamoDb/NodeTable.php | NodeTable.create | final public function create(DynamoDbClient $client, string $tableName): void
{
try {
$client->describeTable(['TableName' => $tableName]);
return;
} catch (DynamoDbException $e) {
// table doesn't exist, create it below
}
$this->loadIndexes();
... | php | final public function create(DynamoDbClient $client, string $tableName): void
{
try {
$client->describeTable(['TableName' => $tableName]);
return;
} catch (DynamoDbException $e) {
// table doesn't exist, create it below
}
$this->loadIndexes();
... | [
"final",
"public",
"function",
"create",
"(",
"DynamoDbClient",
"$",
"client",
",",
"string",
"$",
"tableName",
")",
":",
"void",
"{",
"try",
"{",
"$",
"client",
"->",
"describeTable",
"(",
"[",
"'TableName'",
"=>",
"$",
"tableName",
"]",
")",
";",
"retu... | Creates a DynamoDb table with the node schema.
@param DynamoDbClient $client
@param string $tableName
@throws RepositoryOperationFailed | [
"Creates",
"a",
"DynamoDb",
"table",
"with",
"the",
"node",
"schema",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/NodeTable.php#L50-L116 |
31,353 | gdbots/ncr-php | src/Repository/DynamoDb/NodeTable.php | NodeTable.hasIndex | final public function hasIndex(string $alias): bool
{
$this->loadIndexes();
return isset($this->gsi[$alias]);
} | php | final public function hasIndex(string $alias): bool
{
$this->loadIndexes();
return isset($this->gsi[$alias]);
} | [
"final",
"public",
"function",
"hasIndex",
"(",
"string",
"$",
"alias",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"loadIndexes",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"gsi",
"[",
"$",
"alias",
"]",
")",
";",
"}"
] | Returns true if this NodeTable has the given index.
@see GlobalSecondaryIndex::getAlias()
@param string $alias
@return bool | [
"Returns",
"true",
"if",
"this",
"NodeTable",
"has",
"the",
"given",
"index",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/NodeTable.php#L156-L160 |
31,354 | gdbots/ncr-php | src/Repository/DynamoDb/NodeTable.php | NodeTable.getIndex | final public function getIndex(string $alias): ?GlobalSecondaryIndex
{
$this->loadIndexes();
return $this->gsi[$alias] ?? null;
} | php | final public function getIndex(string $alias): ?GlobalSecondaryIndex
{
$this->loadIndexes();
return $this->gsi[$alias] ?? null;
} | [
"final",
"public",
"function",
"getIndex",
"(",
"string",
"$",
"alias",
")",
":",
"?",
"GlobalSecondaryIndex",
"{",
"$",
"this",
"->",
"loadIndexes",
"(",
")",
";",
"return",
"$",
"this",
"->",
"gsi",
"[",
"$",
"alias",
"]",
"??",
"null",
";",
"}"
] | Returns an index by its alias if it exists on this table.
@param string $alias
@return GlobalSecondaryIndex|null | [
"Returns",
"an",
"index",
"by",
"its",
"alias",
"if",
"it",
"exists",
"on",
"this",
"table",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/NodeTable.php#L169-L173 |
31,355 | gdbots/ncr-php | src/Repository/DynamoDb/NodeTable.php | NodeTable.beforePutItem | final public function beforePutItem(array &$item, Node $node): void
{
$this->loadIndexes();
$this->addShardAttributes($item, $node);
if ($node instanceof Indexed) {
$item[NodeTable::INDEXED_KEY_NAME] = ['BOOL' => true];
}
foreach ($this->gsi as $gsi) {
... | php | final public function beforePutItem(array &$item, Node $node): void
{
$this->loadIndexes();
$this->addShardAttributes($item, $node);
if ($node instanceof Indexed) {
$item[NodeTable::INDEXED_KEY_NAME] = ['BOOL' => true];
}
foreach ($this->gsi as $gsi) {
... | [
"final",
"public",
"function",
"beforePutItem",
"(",
"array",
"&",
"$",
"item",
",",
"Node",
"$",
"node",
")",
":",
"void",
"{",
"$",
"this",
"->",
"loadIndexes",
"(",
")",
";",
"$",
"this",
"->",
"addShardAttributes",
"(",
"$",
"item",
",",
"$",
"no... | Calls all of the indexes on this table "beforePutItem" methods.
@param array $item
@param Node $node | [
"Calls",
"all",
"of",
"the",
"indexes",
"on",
"this",
"table",
"beforePutItem",
"methods",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/NodeTable.php#L181-L194 |
31,356 | gdbots/ncr-php | src/Repository/DynamoDb/NodeTable.php | NodeTable.loadIndexes | private function loadIndexes(): void
{
if (null !== $this->gsi) {
return;
}
$this->gsi = [];
foreach ($this->getIndexes() as $gsi) {
$this->gsi[$gsi->getAlias()] = $gsi;
}
} | php | private function loadIndexes(): void
{
if (null !== $this->gsi) {
return;
}
$this->gsi = [];
foreach ($this->getIndexes() as $gsi) {
$this->gsi[$gsi->getAlias()] = $gsi;
}
} | [
"private",
"function",
"loadIndexes",
"(",
")",
":",
"void",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"gsi",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"gsi",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getIndexes",
"("... | Load the indexes for this table. | [
"Load",
"the",
"indexes",
"for",
"this",
"table",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/DynamoDb/NodeTable.php#L250-L260 |
31,357 | starweb/starlit-db | src/AbstractDbEntityFetcher.php | AbstractDbEntityFetcher.getLimitSql | protected function getLimitSql($limit, array $pageItem = [])
{
$limitSql = '';
if (!empty($limit) || !empty($pageItem)) {
$limitSql = 'LIMIT ';
if (!empty($pageItem)) {
list($pageNo, $rowsPerPage) = $pageItem;
$pageNo = (int) $pageNo;
... | php | protected function getLimitSql($limit, array $pageItem = [])
{
$limitSql = '';
if (!empty($limit) || !empty($pageItem)) {
$limitSql = 'LIMIT ';
if (!empty($pageItem)) {
list($pageNo, $rowsPerPage) = $pageItem;
$pageNo = (int) $pageNo;
... | [
"protected",
"function",
"getLimitSql",
"(",
"$",
"limit",
",",
"array",
"$",
"pageItem",
"=",
"[",
"]",
")",
"{",
"$",
"limitSql",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"limit",
")",
"||",
"!",
"empty",
"(",
"$",
"pageItem",
")",
")... | Helper method to get LIMIT SQL and paging flag from limit parameter.
@param int $limit A limit number (like 5)
@param array $pageItem A pagination array like [1, 10], where 1 is the page number and 10 the number of
rows per page (first page is 1).
@return string | [
"Helper",
"method",
"to",
"get",
"LIMIT",
"SQL",
"and",
"paging",
"flag",
"from",
"limit",
"parameter",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntityFetcher.php#L50-L73 |
31,358 | starweb/starlit-db | src/AbstractDbEntityFetcher.php | AbstractDbEntityFetcher.getFetchPaginationResult | protected function getFetchPaginationResult(array $objects, $pagination)
{
if ($pagination) {
$totalRowCount = $this->db->fetchValue('SELECT FOUND_ROWS()');
return [$objects, $totalRowCount];
} else {
return $objects;
}
} | php | protected function getFetchPaginationResult(array $objects, $pagination)
{
if ($pagination) {
$totalRowCount = $this->db->fetchValue('SELECT FOUND_ROWS()');
return [$objects, $totalRowCount];
} else {
return $objects;
}
} | [
"protected",
"function",
"getFetchPaginationResult",
"(",
"array",
"$",
"objects",
",",
"$",
"pagination",
")",
"{",
"if",
"(",
"$",
"pagination",
")",
"{",
"$",
"totalRowCount",
"=",
"$",
"this",
"->",
"db",
"->",
"fetchValue",
"(",
"'SELECT FOUND_ROWS()'",
... | Helper method to get pagination result array if pagination is requested.
@param array $objects
@param bool $pagination
@return array | [
"Helper",
"method",
"to",
"get",
"pagination",
"result",
"array",
"if",
"pagination",
"is",
"requested",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntityFetcher.php#L82-L91 |
31,359 | starweb/starlit-db | src/AbstractDbEntityFetcher.php | AbstractDbEntityFetcher.getDbEntitiesFromRowsPaginated | protected function getDbEntitiesFromRowsPaginated(array $rows, $pagination)
{
if ($pagination) {
$totalRowCount = $this->db->fetchValue('SELECT FOUND_ROWS()');
return [$this->getDbEntitiesFromRows($rows), $totalRowCount];
}
return $this->getDbEntitiesFromRows($rows);... | php | protected function getDbEntitiesFromRowsPaginated(array $rows, $pagination)
{
if ($pagination) {
$totalRowCount = $this->db->fetchValue('SELECT FOUND_ROWS()');
return [$this->getDbEntitiesFromRows($rows), $totalRowCount];
}
return $this->getDbEntitiesFromRows($rows);... | [
"protected",
"function",
"getDbEntitiesFromRowsPaginated",
"(",
"array",
"$",
"rows",
",",
"$",
"pagination",
")",
"{",
"if",
"(",
"$",
"pagination",
")",
"{",
"$",
"totalRowCount",
"=",
"$",
"this",
"->",
"db",
"->",
"fetchValue",
"(",
"'SELECT FOUND_ROWS()'"... | Helper method to get pagination result as objects if pagination is requested.
@param array $rows
@param bool $pagination
@return array | [
"Helper",
"method",
"to",
"get",
"pagination",
"result",
"as",
"objects",
"if",
"pagination",
"is",
"requested",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/AbstractDbEntityFetcher.php#L100-L108 |
31,360 | gdbots/ncr-php | src/Search/Elastica/IndexManager.php | IndexManager.createIndex | final public function createIndex(Client $client, SchemaQName $qname, array $context = []): Index
{
static $created = [];
$indexName = $this->getIndexName($qname, $context);
if (isset($created[$indexName])) {
return $created[$indexName];
}
$index = $created[$ind... | php | final public function createIndex(Client $client, SchemaQName $qname, array $context = []): Index
{
static $created = [];
$indexName = $this->getIndexName($qname, $context);
if (isset($created[$indexName])) {
return $created[$indexName];
}
$index = $created[$ind... | [
"final",
"public",
"function",
"createIndex",
"(",
"Client",
"$",
"client",
",",
"SchemaQName",
"$",
"qname",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
":",
"Index",
"{",
"static",
"$",
"created",
"=",
"[",
"]",
";",
"$",
"indexName",
"=",
"$... | Creates the index in ElasticSearch if it doesn't already exist. It will NOT
perform an update as that requires the index be closed and reopened which
is not currently supported on AWS ElasticSearch service.
@param Client $client The Elastica client
@param SchemaQName $qname QName used to derive the index name... | [
"Creates",
"the",
"index",
"in",
"ElasticSearch",
"if",
"it",
"doesn",
"t",
"already",
"exist",
".",
"It",
"will",
"NOT",
"perform",
"an",
"update",
"as",
"that",
"requires",
"the",
"index",
"be",
"closed",
"and",
"reopened",
"which",
"is",
"not",
"current... | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Search/Elastica/IndexManager.php#L97-L135 |
31,361 | gdbots/ncr-php | src/Search/Elastica/IndexManager.php | IndexManager.createType | final public function createType(Index $index, SchemaQName $qname): Type
{
$type = new Type($index, $this->getTypeName($qname));
$mapping = $this->getNodeMapper($qname)->getMapping($qname);
$mapping->setType($type);
try {
$mapping->send();
} catch (\Throwable $e)... | php | final public function createType(Index $index, SchemaQName $qname): Type
{
$type = new Type($index, $this->getTypeName($qname));
$mapping = $this->getNodeMapper($qname)->getMapping($qname);
$mapping->setType($type);
try {
$mapping->send();
} catch (\Throwable $e)... | [
"final",
"public",
"function",
"createType",
"(",
"Index",
"$",
"index",
",",
"SchemaQName",
"$",
"qname",
")",
":",
"Type",
"{",
"$",
"type",
"=",
"new",
"Type",
"(",
"$",
"index",
",",
"$",
"this",
"->",
"getTypeName",
"(",
"$",
"qname",
")",
")",
... | Creates or updates the Type in ElasticSearch. This expects the
Index to already exist and have any analyzers it needs.
@param Index $index The Elastica Index to create the Type in.
@param SchemaQName $qname QName used to derive the type name.
@return Type | [
"Creates",
"or",
"updates",
"the",
"Type",
"in",
"ElasticSearch",
".",
"This",
"expects",
"the",
"Index",
"to",
"already",
"exist",
"and",
"have",
"any",
"analyzers",
"it",
"needs",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Search/Elastica/IndexManager.php#L146-L169 |
31,362 | starweb/starlit-db | src/Migration/Migrator.php | Migrator.emptyDb | public function emptyDb()
{
if (($rows = $this->db->fetchRows('SHOW TABLES', [], true))) {
$this->db->exec('SET foreign_key_checks = 0');
foreach ($rows as $row) {
$this->db->exec('DROP TABLE `' . $row[0] . '`');
}
$this->db->exec('SET foreign_... | php | public function emptyDb()
{
if (($rows = $this->db->fetchRows('SHOW TABLES', [], true))) {
$this->db->exec('SET foreign_key_checks = 0');
foreach ($rows as $row) {
$this->db->exec('DROP TABLE `' . $row[0] . '`');
}
$this->db->exec('SET foreign_... | [
"public",
"function",
"emptyDb",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"rows",
"=",
"$",
"this",
"->",
"db",
"->",
"fetchRows",
"(",
"'SHOW TABLES'",
",",
"[",
"]",
",",
"true",
")",
")",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"exec",
"(",
"'SE... | Empty database. | [
"Empty",
"database",
"."
] | 521efeb4a6ffebf616b02a436575bdc1bf304e88 | https://github.com/starweb/starlit-db/blob/521efeb4a6ffebf616b02a436575bdc1bf304e88/src/Migration/Migrator.php#L286-L295 |
31,363 | gdbots/ncr-php | src/IndexQueryFilterProcessor.php | IndexQueryFilterProcessor.valueMatchesFilter | protected function valueMatchesFilter($value, IndexQueryFilter $filter): bool
{
switch ($filter->getOperator()) {
case IndexQueryFilterOperator::EQUAL_TO:
return $value == $filter->getValue();
case IndexQueryFilterOperator::NOT_EQUAL_TO:
return $value... | php | protected function valueMatchesFilter($value, IndexQueryFilter $filter): bool
{
switch ($filter->getOperator()) {
case IndexQueryFilterOperator::EQUAL_TO:
return $value == $filter->getValue();
case IndexQueryFilterOperator::NOT_EQUAL_TO:
return $value... | [
"protected",
"function",
"valueMatchesFilter",
"(",
"$",
"value",
",",
"IndexQueryFilter",
"$",
"filter",
")",
":",
"bool",
"{",
"switch",
"(",
"$",
"filter",
"->",
"getOperator",
"(",
")",
")",
"{",
"case",
"IndexQueryFilterOperator",
"::",
"EQUAL_TO",
":",
... | Returns true if the provided value matches the filter.
@param mixed $value
@param IndexQueryFilter $filter
@return bool | [
"Returns",
"true",
"if",
"the",
"provided",
"value",
"matches",
"the",
"filter",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/IndexQueryFilterProcessor.php#L70-L91 |
31,364 | gdbots/ncr-php | src/Repository/Psr6Ncr.php | Psr6Ncr.beforeSaveCacheItem | protected function beforeSaveCacheItem(CacheItemInterface $cacheItem, Node $node): void
{
$cacheItem->expiresAfter(null)->expiresAt(null);
} | php | protected function beforeSaveCacheItem(CacheItemInterface $cacheItem, Node $node): void
{
$cacheItem->expiresAfter(null)->expiresAt(null);
} | [
"protected",
"function",
"beforeSaveCacheItem",
"(",
"CacheItemInterface",
"$",
"cacheItem",
",",
"Node",
"$",
"node",
")",
":",
"void",
"{",
"$",
"cacheItem",
"->",
"expiresAfter",
"(",
"null",
")",
"->",
"expiresAt",
"(",
"null",
")",
";",
"}"
] | Prepares the cache item before it's saved into the cache pool.
By default, all nodes are stored in cache forever, to change this behavior
either set the default ttl on the cache provider, or tweak the expiry on
a per item basis by overriding this method.
@param CacheItemInterface $cacheItem
@param Node $... | [
"Prepares",
"the",
"cache",
"item",
"before",
"it",
"s",
"saved",
"into",
"the",
"cache",
"pool",
".",
"By",
"default",
"all",
"nodes",
"are",
"stored",
"in",
"cache",
"forever",
"to",
"change",
"this",
"behavior",
"either",
"set",
"the",
"default",
"ttl",... | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Repository/Psr6Ncr.php#L307-L310 |
31,365 | gdbots/ncr-php | src/NcrPreloader.php | NcrPreloader.clear | public function clear(?string $namespace = self::DEFAULT_NAMESPACE): void
{
if (null === $namespace) {
$this->nodeRefs = [];
return;
}
unset($this->nodeRefs[$namespace]);
} | php | public function clear(?string $namespace = self::DEFAULT_NAMESPACE): void
{
if (null === $namespace) {
$this->nodeRefs = [];
return;
}
unset($this->nodeRefs[$namespace]);
} | [
"public",
"function",
"clear",
"(",
"?",
"string",
"$",
"namespace",
"=",
"self",
"::",
"DEFAULT_NAMESPACE",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"namespace",
")",
"{",
"$",
"this",
"->",
"nodeRefs",
"=",
"[",
"]",
";",
"return",
";"... | Clears the preloaded node refs.
@param string $namespace | [
"Clears",
"the",
"preloaded",
"node",
"refs",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/NcrPreloader.php#L209-L217 |
31,366 | gdbots/ncr-php | src/Search/Elastica/ClientManager.php | ClientManager.getClient | final public function getClient(string $cluster = 'default'): Client
{
if (isset($this->clients[$cluster])) {
return $this->clients[$cluster];
}
if (!$this->hasCluster($cluster)) {
throw new \InvalidArgumentException(
sprintf(
'The... | php | final public function getClient(string $cluster = 'default'): Client
{
if (isset($this->clients[$cluster])) {
return $this->clients[$cluster];
}
if (!$this->hasCluster($cluster)) {
throw new \InvalidArgumentException(
sprintf(
'The... | [
"final",
"public",
"function",
"getClient",
"(",
"string",
"$",
"cluster",
"=",
"'default'",
")",
":",
"Client",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"clients",
"[",
"$",
"cluster",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"client... | Gets an elastica client using the config from the provided cluster name.
All calls with the same cluster name will return the same client instance.
@param string $cluster
@return Client | [
"Gets",
"an",
"elastica",
"client",
"using",
"the",
"config",
"from",
"the",
"provided",
"cluster",
"name",
"."
] | b31c1315144f9a5bc6c48463dd77b6c643fdf250 | https://github.com/gdbots/ncr-php/blob/b31c1315144f9a5bc6c48463dd77b6c643fdf250/src/Search/Elastica/ClientManager.php#L63-L105 |
31,367 | agroviva/egroupware-api | src/Api/Categories.php | Categories.ReadAll | public static function ReadAll($app = 'phpgw')
{
$Categories = new Api\Categories(0, $app);
return $Categories->return_array('all', 0, true, '', 'ASC', '', true, null, -1, '', null);
} | php | public static function ReadAll($app = 'phpgw')
{
$Categories = new Api\Categories(0, $app);
return $Categories->return_array('all', 0, true, '', 'ASC', '', true, null, -1, '', null);
} | [
"public",
"static",
"function",
"ReadAll",
"(",
"$",
"app",
"=",
"'phpgw'",
")",
"{",
"$",
"Categories",
"=",
"new",
"Api",
"\\",
"Categories",
"(",
"0",
",",
"$",
"app",
")",
";",
"return",
"$",
"Categories",
"->",
"return_array",
"(",
"'all'",
",",
... | Returns all Categories.
@param string $app [If app given it will read only the categories of the app] | [
"Returns",
"all",
"Categories",
"."
] | 2dd3d94d5e06d9b4485d41af772d4e9188fd1c76 | https://github.com/agroviva/egroupware-api/blob/2dd3d94d5e06d9b4485d41af772d4e9188fd1c76/src/Api/Categories.php#L35-L40 |
31,368 | salted-herring/salted-library | code/Utilities.php | Utilities.nl2p | public static function nl2p($string, $viewer) {
$items = new \ArrayList();
foreach(explode(PHP_EOL, $string) as $item) {
if (trim($item)) {
$items->push(new \ArrayData(array(
'line' => $item
)));
}
}
return $vi... | php | public static function nl2p($string, $viewer) {
$items = new \ArrayList();
foreach(explode(PHP_EOL, $string) as $item) {
if (trim($item)) {
$items->push(new \ArrayData(array(
'line' => $item
)));
}
}
return $vi... | [
"public",
"static",
"function",
"nl2p",
"(",
"$",
"string",
",",
"$",
"viewer",
")",
"{",
"$",
"items",
"=",
"new",
"\\",
"ArrayList",
"(",
")",
";",
"foreach",
"(",
"explode",
"(",
"PHP_EOL",
",",
"$",
"string",
")",
"as",
"$",
"item",
")",
"{",
... | Take a string with new line feeds & create paragraphs. | [
"Take",
"a",
"string",
"with",
"new",
"line",
"feeds",
"&",
"create",
"paragraphs",
"."
] | bf062feaa6f11da1a5b7010c15d50976c6cbee6b | https://github.com/salted-herring/salted-library/blob/bf062feaa6f11da1a5b7010c15d50976c6cbee6b/code/Utilities.php#L314-L328 |
31,369 | salted-herring/salted-library | code/Utilities.php | Utilities.getValidKey | public static function getValidKey($pattern, $arr) {
$keys = array();
foreach($arr as $key => $value) {
if (preg_match($pattern, $key)){
$keys[] = $key;
}
}
return $keys;
} | php | public static function getValidKey($pattern, $arr) {
$keys = array();
foreach($arr as $key => $value) {
if (preg_match($pattern, $key)){
$keys[] = $key;
}
}
return $keys;
} | [
"public",
"static",
"function",
"getValidKey",
"(",
"$",
"pattern",
",",
"$",
"arr",
")",
"{",
"$",
"keys",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"preg_match",
"(",
"$"... | find the key that matches a specific pattern.
Used primarily with dbo field tags.
e.g. UtilityFunctions::getValidKey('/*Description/', $this->db); | [
"find",
"the",
"key",
"that",
"matches",
"a",
"specific",
"pattern",
".",
"Used",
"primarily",
"with",
"dbo",
"field",
"tags",
"."
] | bf062feaa6f11da1a5b7010c15d50976c6cbee6b | https://github.com/salted-herring/salted-library/blob/bf062feaa6f11da1a5b7010c15d50976c6cbee6b/code/Utilities.php#L336-L345 |
31,370 | salted-herring/salted-library | code/Utilities.php | Utilities.getWordsWithinCharLimit | public static function getWordsWithinCharLimit($sentence, $limit = 150) {
$str = '';
$i = 1;
if(strlen($sentence) < $limit) {
return $sentence;
}
while (strlen($current = self::getWords($sentence, $i++)) < $limit) {
$str = $current;
}
re... | php | public static function getWordsWithinCharLimit($sentence, $limit = 150) {
$str = '';
$i = 1;
if(strlen($sentence) < $limit) {
return $sentence;
}
while (strlen($current = self::getWords($sentence, $i++)) < $limit) {
$str = $current;
}
re... | [
"public",
"static",
"function",
"getWordsWithinCharLimit",
"(",
"$",
"sentence",
",",
"$",
"limit",
"=",
"150",
")",
"{",
"$",
"str",
"=",
"''",
";",
"$",
"i",
"=",
"1",
";",
"if",
"(",
"strlen",
"(",
"$",
"sentence",
")",
"<",
"$",
"limit",
")",
... | Get max number of words within a character limit. | [
"Get",
"max",
"number",
"of",
"words",
"within",
"a",
"character",
"limit",
"."
] | bf062feaa6f11da1a5b7010c15d50976c6cbee6b | https://github.com/salted-herring/salted-library/blob/bf062feaa6f11da1a5b7010c15d50976c6cbee6b/code/Utilities.php#L371-L384 |
31,371 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.create | public function create($name, $config, $object = null, $class = null, $reformatted = false, $populated = true)
{
$defaultConfig = include __DIR__.'/../../config/form-maker.php';
if (is_null($class)) {
$class = config('form-maker.forms.form-class', 'form-control');
}
$in... | php | public function create($name, $config, $object = null, $class = null, $reformatted = false, $populated = true)
{
$defaultConfig = include __DIR__.'/../../config/form-maker.php';
if (is_null($class)) {
$class = config('form-maker.forms.form-class', 'form-control');
}
$in... | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"config",
",",
"$",
"object",
"=",
"null",
",",
"$",
"class",
"=",
"null",
",",
"$",
"reformatted",
"=",
"false",
",",
"$",
"populated",
"=",
"true",
")",
"{",
"$",
"defaultConfig",
"=",
"... | Create the input HTML.
@param string $name Column/ Input name
@param array $config Array of config info for the input
@param object|array $object Object or Table Object
@param string $class CSS class
@param bool $reformatted Clean the labels and placeholder values
@par... | [
"Create",
"the",
"input",
"HTML",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L72-L96 |
31,372 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.getObjectValue | public function getObjectValue($object, $name)
{
if (is_object($object) && isset($object->$name) && !method_exists($object, $name)) {
return $object->$name;
}
// If its a nested value like meta[user[phone]]
if (strpos($name, '[') > 0) {
$nested = explode('[',... | php | public function getObjectValue($object, $name)
{
if (is_object($object) && isset($object->$name) && !method_exists($object, $name)) {
return $object->$name;
}
// If its a nested value like meta[user[phone]]
if (strpos($name, '[') > 0) {
$nested = explode('[',... | [
"public",
"function",
"getObjectValue",
"(",
"$",
"object",
",",
"$",
"name",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"object",
")",
"&&",
"isset",
"(",
"$",
"object",
"->",
"$",
"name",
")",
"&&",
"!",
"method_exists",
"(",
"$",
"object",
",",
... | Get the object value from the object with the name.
@param mixed $object
@param string $name
@return mixed | [
"Get",
"the",
"object",
"value",
"from",
"the",
"object",
"with",
"the",
"name",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L106-L128 |
31,373 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.inputStringPreparer | public function inputStringPreparer($config)
{
$inputString = '';
$beforeAfterCondition = ($this->before($config) > '' || $this->after($config) > '');
$method = $this->getGeneratorMethod($config['inputType']);
if ($beforeAfterCondition) {
$inputString .= '<div class="'.c... | php | public function inputStringPreparer($config)
{
$inputString = '';
$beforeAfterCondition = ($this->before($config) > '' || $this->after($config) > '');
$method = $this->getGeneratorMethod($config['inputType']);
if ($beforeAfterCondition) {
$inputString .= '<div class="'.c... | [
"public",
"function",
"inputStringPreparer",
"(",
"$",
"config",
")",
"{",
"$",
"inputString",
"=",
"''",
";",
"$",
"beforeAfterCondition",
"=",
"(",
"$",
"this",
"->",
"before",
"(",
"$",
"config",
")",
">",
"''",
"||",
"$",
"this",
"->",
"after",
"("... | Input string preparer.
@param array $config
@return string | [
"Input",
"string",
"preparer",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L137-L160 |
31,374 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.label | public function label($name, $attributes = [])
{
$attributeString = '';
if (!isset($attributes['for'])) {
$attributeString = 'for="'.$name.'"';
}
foreach ($attributes as $key => $value) {
$attributeString .= $key.'="'.$value.'" ';
}
return '... | php | public function label($name, $attributes = [])
{
$attributeString = '';
if (!isset($attributes['for'])) {
$attributeString = 'for="'.$name.'"';
}
foreach ($attributes as $key => $value) {
$attributeString .= $key.'="'.$value.'" ';
}
return '... | [
"public",
"function",
"label",
"(",
"$",
"name",
",",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"attributeString",
"=",
"''",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"attributes",
"[",
"'for'",
"]",
")",
")",
"{",
"$",
"attributeString",
"="... | Create a label for an input.
@param string $name
@param array $attributes
@return string | [
"Create",
"a",
"label",
"for",
"an",
"input",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L170-L183 |
31,375 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.refineConfigs | private function refineConfigs($inputConfig, $reformatted, $name, $config)
{
// If validation inputs are available lets prepopulate the fields!
if (!empty($inputConfig['inputs']) && isset($inputConfig['inputs'][$name])) {
$inputConfig['populated'] = true;
$inputConfig['object... | php | private function refineConfigs($inputConfig, $reformatted, $name, $config)
{
// If validation inputs are available lets prepopulate the fields!
if (!empty($inputConfig['inputs']) && isset($inputConfig['inputs'][$name])) {
$inputConfig['populated'] = true;
$inputConfig['object... | [
"private",
"function",
"refineConfigs",
"(",
"$",
"inputConfig",
",",
"$",
"reformatted",
",",
"$",
"name",
",",
"$",
"config",
")",
"{",
"// If validation inputs are available lets prepopulate the fields!",
"if",
"(",
"!",
"empty",
"(",
"$",
"inputConfig",
"[",
"... | Set the configs.
@param array $config
@param bool $reformatted
@param string $name
@param array $config
@return array | [
"Set",
"the",
"configs",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L257-L282 |
31,376 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.inputStringGenerator | private function inputStringGenerator($config)
{
$config = $this->prepareObjectValue($config);
$population = $this->inputCalibrator->getPopulation($config);
$checkType = $this->inputCalibrator->checkType($config, $this->inputGroups['checkbox']);
$selected = $this->inputCalibrator->is... | php | private function inputStringGenerator($config)
{
$config = $this->prepareObjectValue($config);
$population = $this->inputCalibrator->getPopulation($config);
$checkType = $this->inputCalibrator->checkType($config, $this->inputGroups['checkbox']);
$selected = $this->inputCalibrator->is... | [
"private",
"function",
"inputStringGenerator",
"(",
"$",
"config",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"prepareObjectValue",
"(",
"$",
"config",
")",
";",
"$",
"population",
"=",
"$",
"this",
"->",
"inputCalibrator",
"->",
"getPopulation",
"(",
... | The input string generator.
@param array $config Config
@return string | [
"The",
"input",
"string",
"generator",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L291-L319 |
31,377 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.prepareType | public function prepareType($config)
{
$config['type'] = $config['inputTypes']['string'];
if (isset($config['inputTypes'][$config['inputType']])) {
$config['type'] = $config['inputTypes'][$config['inputType']];
}
return $config;
} | php | public function prepareType($config)
{
$config['type'] = $config['inputTypes']['string'];
if (isset($config['inputTypes'][$config['inputType']])) {
$config['type'] = $config['inputTypes'][$config['inputType']];
}
return $config;
} | [
"public",
"function",
"prepareType",
"(",
"$",
"config",
")",
"{",
"$",
"config",
"[",
"'type'",
"]",
"=",
"$",
"config",
"[",
"'inputTypes'",
"]",
"[",
"'string'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'inputTypes'",
"]",
"[",
"$",... | prepare the type.
@param array $config
@return array | [
"prepare",
"the",
"type",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L328-L337 |
31,378 | GrafiteInc/FormMaker | src/Services/InputMaker.php | InputMaker.getGeneratorMethod | public function getGeneratorMethod($type)
{
switch ($type) {
case in_array($type, $this->inputGroups['hidden']):
return 'makeHidden';
case in_array($type, $this->inputGroups['text']):
return 'makeText';
case in_array($type, $this->inputGr... | php | public function getGeneratorMethod($type)
{
switch ($type) {
case in_array($type, $this->inputGroups['hidden']):
return 'makeHidden';
case in_array($type, $this->inputGroups['text']):
return 'makeText';
case in_array($type, $this->inputGr... | [
"public",
"function",
"getGeneratorMethod",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"in_array",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"inputGroups",
"[",
"'hidden'",
"]",
")",
":",
"return",
"'makeHidden'",
";",
"c... | Get the generator method.
@param string $type
@return string | [
"Get",
"the",
"generator",
"method",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputMaker.php#L362-L386 |
31,379 | GrafiteInc/FormMaker | src/Services/InputCalibrator.php | InputCalibrator.getId | public function getId($name, $config)
{
$inputId = str_replace('[]', '', ucfirst($name));
if (isset($config['id'])) {
$inputId = $config['id'];
}
return $inputId;
} | php | public function getId($name, $config)
{
$inputId = str_replace('[]', '', ucfirst($name));
if (isset($config['id'])) {
$inputId = $config['id'];
}
return $inputId;
} | [
"public",
"function",
"getId",
"(",
"$",
"name",
",",
"$",
"config",
")",
"{",
"$",
"inputId",
"=",
"str_replace",
"(",
"'[]'",
",",
"''",
",",
"ucfirst",
"(",
"$",
"name",
")",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'id'",
"]",
... | Customizable input name
@param string $name
@param array $config
@return string | [
"Customizable",
"input",
"name"
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputCalibrator.php#L68-L77 |
31,380 | GrafiteInc/FormMaker | src/Services/InputCalibrator.php | InputCalibrator.isSelected | public function isSelected($config, $checkType)
{
$selected = false;
if (!is_object($config['objectValue'])) {
$selected = (isset($config['inputs'][$config['name']])
|| isset($config['config']['selected'])
|| $config['objectValue'] === 'on'
... | php | public function isSelected($config, $checkType)
{
$selected = false;
if (!is_object($config['objectValue'])) {
$selected = (isset($config['inputs'][$config['name']])
|| isset($config['config']['selected'])
|| $config['objectValue'] === 'on'
... | [
"public",
"function",
"isSelected",
"(",
"$",
"config",
",",
"$",
"checkType",
")",
"{",
"$",
"selected",
"=",
"false",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"config",
"[",
"'objectValue'",
"]",
")",
")",
"{",
"$",
"selected",
"=",
"(",
"isset"... | Has been selected.
@param array $config
@param string $checkType Type of checkmark
@return bool | [
"Has",
"been",
"selected",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputCalibrator.php#L87-L100 |
31,381 | GrafiteInc/FormMaker | src/Services/InputCalibrator.php | InputCalibrator.placeholder | public function placeholder($field, $column)
{
if (!is_array($field) && !in_array($field, $this->columnTypes)) {
return ucfirst($field);
}
if (strpos($column, '[') > 0) {
$nested = explode('[', str_replace(']', '', $column));
$column = implode(' ', $neste... | php | public function placeholder($field, $column)
{
if (!is_array($field) && !in_array($field, $this->columnTypes)) {
return ucfirst($field);
}
if (strpos($column, '[') > 0) {
$nested = explode('[', str_replace(']', '', $column));
$column = implode(' ', $neste... | [
"public",
"function",
"placeholder",
"(",
"$",
"field",
",",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"field",
")",
"&&",
"!",
"in_array",
"(",
"$",
"field",
",",
"$",
"this",
"->",
"columnTypes",
")",
")",
"{",
"return",
"ucf... | Create the placeholder.
@param array $field Field from Column Array
@param string $column Column name
@return string | [
"Create",
"the",
"placeholder",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/InputCalibrator.php#L139-L154 |
31,382 | GrafiteInc/FormMaker | src/Services/FormMaker.php | FormMaker.fromTable | public function fromTable(
$table,
$columns = null,
$class = null,
$view = null,
$reformatted = true,
$populated = false,
$idAndTimestamps = false
) {
$formBuild = [];
if (is_null($class)) {
$class = config('form-maker.forms.form-c... | php | public function fromTable(
$table,
$columns = null,
$class = null,
$view = null,
$reformatted = true,
$populated = false,
$idAndTimestamps = false
) {
$formBuild = [];
if (is_null($class)) {
$class = config('form-maker.forms.form-c... | [
"public",
"function",
"fromTable",
"(",
"$",
"table",
",",
"$",
"columns",
"=",
"null",
",",
"$",
"class",
"=",
"null",
",",
"$",
"view",
"=",
"null",
",",
"$",
"reformatted",
"=",
"true",
",",
"$",
"populated",
"=",
"false",
",",
"$",
"idAndTimestam... | Generate a form from a table.
@param string $table Table name
@param array $columns Array of columns and details regarding them see config/forms.php for examples
@param string $class Class names to be given to the inputs
@param string $view View to use - for custom form layouts
... | [
"Generate",
"a",
"form",
"from",
"a",
"table",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/FormMaker.php#L88-L128 |
31,383 | GrafiteInc/FormMaker | src/Services/FormMaker.php | FormMaker.fromArray | public function fromArray(
$array,
$columns = null,
$view = null,
$class = null,
$populated = true,
$reformatted = false,
$timestamps = false
) {
$formBuild = [];
if (is_null($class)) {
$class = config('form-maker.forms.form-class'... | php | public function fromArray(
$array,
$columns = null,
$view = null,
$class = null,
$populated = true,
$reformatted = false,
$timestamps = false
) {
$formBuild = [];
if (is_null($class)) {
$class = config('form-maker.forms.form-class'... | [
"public",
"function",
"fromArray",
"(",
"$",
"array",
",",
"$",
"columns",
"=",
"null",
",",
"$",
"view",
"=",
"null",
",",
"$",
"class",
"=",
"null",
",",
"$",
"populated",
"=",
"true",
",",
"$",
"reformatted",
"=",
"false",
",",
"$",
"timestamps",
... | Build the form from an array.
@param array $array
@param array $columns
@param string $view A template to use for the rows
@param string $class Default input class
@param bool $populated Is content populated
@param bool $reformatted Are column names reformatted
@param bool $timestamps Are the t... | [
"Build",
"the",
"form",
"from",
"an",
"array",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/FormMaker.php#L143-L178 |
31,384 | GrafiteInc/FormMaker | src/Services/FormMaker.php | FormMaker.cleanupIdAndTimeStamps | public function cleanupIdAndTimeStamps($collection, $timestamps, $id)
{
if (!$timestamps) {
unset($collection['created_at']);
unset($collection['updated_at']);
}
if (!$id) {
unset($collection['id']);
}
return $collection;
} | php | public function cleanupIdAndTimeStamps($collection, $timestamps, $id)
{
if (!$timestamps) {
unset($collection['created_at']);
unset($collection['updated_at']);
}
if (!$id) {
unset($collection['id']);
}
return $collection;
} | [
"public",
"function",
"cleanupIdAndTimeStamps",
"(",
"$",
"collection",
",",
"$",
"timestamps",
",",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"timestamps",
")",
"{",
"unset",
"(",
"$",
"collection",
"[",
"'created_at'",
"]",
")",
";",
"unset",
"(",
"$... | Cleanup the ID and TimeStamp columns.
@param array $collection
@param bool $timestamps
@param bool $id
@return array | [
"Cleanup",
"the",
"ID",
"and",
"TimeStamp",
"columns",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/FormMaker.php#L238-L250 |
31,385 | GrafiteInc/FormMaker | src/Services/FormMaker.php | FormMaker.formBuilder | private function formBuilder($view, $errors, $field, $column, $input)
{
$formGroupClass = config('form-maker.form.group-class', 'form-group');
$formErrorClass = config('form-maker.form.error-class', 'has-error');
$errorHighlight = '';
$errorMessage = false;
if (!empty($erro... | php | private function formBuilder($view, $errors, $field, $column, $input)
{
$formGroupClass = config('form-maker.form.group-class', 'form-group');
$formErrorClass = config('form-maker.form.error-class', 'has-error');
$errorHighlight = '';
$errorMessage = false;
if (!empty($erro... | [
"private",
"function",
"formBuilder",
"(",
"$",
"view",
",",
"$",
"errors",
",",
"$",
"field",
",",
"$",
"column",
",",
"$",
"input",
")",
"{",
"$",
"formGroupClass",
"=",
"config",
"(",
"'form-maker.form.group-class'",
",",
"'form-group'",
")",
";",
"$",
... | Constructs HTML forms.
@param string $view View template
@param array|object $errors
@param array $field Array of field values
@param string $column Column name
@param string $input Input string
@return string | [
"Constructs",
"HTML",
"forms",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/FormMaker.php#L279-L308 |
31,386 | GrafiteInc/FormMaker | src/Services/FormMaker.php | FormMaker.formContentBuild | public function formContentBuild($field, $column, $input, $errorMessage)
{
$labelColumn = $labelCheckableColumn = '';
$singleLineCheckType = false;
$formLabelClass = config('form-maker.form.label-class', 'control-label');
if (config('form-maker.form.orientation') == 'horizontal') {
... | php | public function formContentBuild($field, $column, $input, $errorMessage)
{
$labelColumn = $labelCheckableColumn = '';
$singleLineCheckType = false;
$formLabelClass = config('form-maker.form.label-class', 'control-label');
if (config('form-maker.form.orientation') == 'horizontal') {
... | [
"public",
"function",
"formContentBuild",
"(",
"$",
"field",
",",
"$",
"column",
",",
"$",
"input",
",",
"$",
"errorMessage",
")",
"{",
"$",
"labelColumn",
"=",
"$",
"labelCheckableColumn",
"=",
"''",
";",
"$",
"singleLineCheckType",
"=",
"false",
";",
"$"... | Form Content Builder.
@param array $field Array of field values
@param string $column Column name
@param string $input Input string
@param string $errorMessage
@return string | [
"Form",
"Content",
"Builder",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/FormMaker.php#L320-L356 |
31,387 | GrafiteInc/FormMaker | src/Services/FormMaker.php | FormMaker.buildBootstrapColumnForm | private function buildBootstrapColumnForm($formBuild, $columns)
{
$newFormBuild = [];
$formChunks = array_chunk($formBuild, $columns);
$class = 'col-md-'.(12 / $columns);
foreach ($formChunks as $chunk) {
$newFormBuild[] = '<div class="row">';
foreach ($chunk... | php | private function buildBootstrapColumnForm($formBuild, $columns)
{
$newFormBuild = [];
$formChunks = array_chunk($formBuild, $columns);
$class = 'col-md-'.(12 / $columns);
foreach ($formChunks as $chunk) {
$newFormBuild[] = '<div class="row">';
foreach ($chunk... | [
"private",
"function",
"buildBootstrapColumnForm",
"(",
"$",
"formBuild",
",",
"$",
"columns",
")",
"{",
"$",
"newFormBuild",
"=",
"[",
"]",
";",
"$",
"formChunks",
"=",
"array_chunk",
"(",
"$",
"formBuild",
",",
"$",
"columns",
")",
";",
"$",
"class",
"... | Build a two column form using standard bootstrap classes
@param array $formBuild
@return string | [
"Build",
"a",
"two",
"column",
"form",
"using",
"standard",
"bootstrap",
"classes"
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/FormMaker.php#L400-L417 |
31,388 | GrafiteInc/FormMaker | src/Services/FormMaker.php | FormMaker.columnLabel | private function columnLabel($field, $column)
{
if (!is_array($field) && !in_array($field, $this->columnTypes)) {
return ucfirst($field);
}
return (isset($field['alt_name'])) ? $field['alt_name'] : ucfirst($column);
} | php | private function columnLabel($field, $column)
{
if (!is_array($field) && !in_array($field, $this->columnTypes)) {
return ucfirst($field);
}
return (isset($field['alt_name'])) ? $field['alt_name'] : ucfirst($column);
} | [
"private",
"function",
"columnLabel",
"(",
"$",
"field",
",",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"field",
")",
"&&",
"!",
"in_array",
"(",
"$",
"field",
",",
"$",
"this",
"->",
"columnTypes",
")",
")",
"{",
"return",
"uc... | Create the column label.
@param array $field Field from Column Array
@param string $column Column name
@return string | [
"Create",
"the",
"column",
"label",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Services/FormMaker.php#L445-L452 |
31,389 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.makeHidden | public function makeHidden($config, $population, $custom)
{
return '<input '.$this->processCustom($custom).' id="'.$this->getId($config).'" name="'.$config['name'].'" type="hidden" value="'.$population.'">';
} | php | public function makeHidden($config, $population, $custom)
{
return '<input '.$this->processCustom($custom).' id="'.$this->getId($config).'" name="'.$config['name'].'" type="hidden" value="'.$population.'">';
} | [
"public",
"function",
"makeHidden",
"(",
"$",
"config",
",",
"$",
"population",
",",
"$",
"custom",
")",
"{",
"return",
"'<input '",
".",
"$",
"this",
"->",
"processCustom",
"(",
"$",
"custom",
")",
".",
"' id=\"'",
".",
"$",
"this",
"->",
"getId",
"("... | Make a hidden input.
@param array $config
@param string $population
@param mixed $custom
@return string | [
"Make",
"a",
"hidden",
"input",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L27-L30 |
31,390 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.makeText | public function makeText($config, $population, $custom)
{
return '<textarea '.$this->processCustom($custom).' id="'.$this->getId($config).'" class="'.$config['class'].'" name="'.$config['name'].'" placeholder="'.$config['placeholder'].'">'.$population.'</textarea>';
} | php | public function makeText($config, $population, $custom)
{
return '<textarea '.$this->processCustom($custom).' id="'.$this->getId($config).'" class="'.$config['class'].'" name="'.$config['name'].'" placeholder="'.$config['placeholder'].'">'.$population.'</textarea>';
} | [
"public",
"function",
"makeText",
"(",
"$",
"config",
",",
"$",
"population",
",",
"$",
"custom",
")",
"{",
"return",
"'<textarea '",
".",
"$",
"this",
"->",
"processCustom",
"(",
"$",
"custom",
")",
".",
"' id=\"'",
".",
"$",
"this",
"->",
"getId",
"(... | Make text input.
@param array $config
@param string $population
@param mixed $custom
@return string | [
"Make",
"text",
"input",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L41-L44 |
31,391 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.makeSelected | public function makeSelected($config, $selected, $custom)
{
$options = $prefix = $suffix = '';
if (isset($config['config']['multiple'])) {
$custom = 'multiple';
$config['name'] = $config['name'].'[]';
}
if (config('form-maker.form.orientation') === 'horizont... | php | public function makeSelected($config, $selected, $custom)
{
$options = $prefix = $suffix = '';
if (isset($config['config']['multiple'])) {
$custom = 'multiple';
$config['name'] = $config['name'].'[]';
}
if (config('form-maker.form.orientation') === 'horizont... | [
"public",
"function",
"makeSelected",
"(",
"$",
"config",
",",
"$",
"selected",
",",
"$",
"custom",
")",
"{",
"$",
"options",
"=",
"$",
"prefix",
"=",
"$",
"suffix",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'config'",
"]",
"[",... | Make a select input.
@param array $config
@param string $selected
@param mixed $custom
@return string | [
"Make",
"a",
"select",
"input",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L55-L92 |
31,392 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.makeCheckbox | public function makeCheckbox($config, $selected, $custom)
{
if (str_contains($config['class'], 'form-control')) {
if (str_contains($config['class'], 'form-check-inline')) {
$config['class'] = str_replace('form-control', '', $config['class']);
} else {
... | php | public function makeCheckbox($config, $selected, $custom)
{
if (str_contains($config['class'], 'form-control')) {
if (str_contains($config['class'], 'form-check-inline')) {
$config['class'] = str_replace('form-control', '', $config['class']);
} else {
... | [
"public",
"function",
"makeCheckbox",
"(",
"$",
"config",
",",
"$",
"selected",
",",
"$",
"custom",
")",
"{",
"if",
"(",
"str_contains",
"(",
"$",
"config",
"[",
"'class'",
"]",
",",
"'form-control'",
")",
")",
"{",
"if",
"(",
"str_contains",
"(",
"$",... | Make a checkbox.
@param array $config
@param string $selected
@param mixed $custom
@return string | [
"Make",
"a",
"checkbox",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L103-L114 |
31,393 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.makeRadio | public function makeRadio($config, $selected, $custom)
{
return '<input '.$this->processCustom($custom).' id="'.$this->getId($config).'" '.$selected.' type="radio" name="'.$config['name'].'" class="'. $config['class'] .'">';
} | php | public function makeRadio($config, $selected, $custom)
{
return '<input '.$this->processCustom($custom).' id="'.$this->getId($config).'" '.$selected.' type="radio" name="'.$config['name'].'" class="'. $config['class'] .'">';
} | [
"public",
"function",
"makeRadio",
"(",
"$",
"config",
",",
"$",
"selected",
",",
"$",
"custom",
")",
"{",
"return",
"'<input '",
".",
"$",
"this",
"->",
"processCustom",
"(",
"$",
"custom",
")",
".",
"' id=\"'",
".",
"$",
"this",
"->",
"getId",
"(",
... | Make a radio input.
@param array $config
@param string $selected
@param mixed $custom
@return string | [
"Make",
"a",
"radio",
"input",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L125-L128 |
31,394 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.makeRelationship | public function makeRelationship($config, $label = 'name', $value = 'id', $custom = '')
{
$object = $config['object'];
if (isset($config['config']['relationship'])) {
$relationship = $config['config']['relationship'];
} else {
$relationship = $config['name'];
... | php | public function makeRelationship($config, $label = 'name', $value = 'id', $custom = '')
{
$object = $config['object'];
if (isset($config['config']['relationship'])) {
$relationship = $config['config']['relationship'];
} else {
$relationship = $config['name'];
... | [
"public",
"function",
"makeRelationship",
"(",
"$",
"config",
",",
"$",
"label",
"=",
"'name'",
",",
"$",
"value",
"=",
"'id'",
",",
"$",
"custom",
"=",
"''",
")",
"{",
"$",
"object",
"=",
"$",
"config",
"[",
"'object'",
"]",
";",
"if",
"(",
"isset... | Make a relationship input.
@param array $config
@param string $label
@param string $value
@param mixed $custom
@return string | [
"Make",
"a",
"relationship",
"input",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L146-L209 |
31,395 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.makeHTMLInputString | public function makeHTMLInputString($config)
{
$custom = $this->getCustom($config);
$multiple = $this->isMultiple($config, 'multiple');
$multipleArray = $this->isMultiple($config, '[]');
$floatingNumber = $this->getFloatingNumber($config);
$population = $this->getPopulation($... | php | public function makeHTMLInputString($config)
{
$custom = $this->getCustom($config);
$multiple = $this->isMultiple($config, 'multiple');
$multipleArray = $this->isMultiple($config, '[]');
$floatingNumber = $this->getFloatingNumber($config);
$population = $this->getPopulation($... | [
"public",
"function",
"makeHTMLInputString",
"(",
"$",
"config",
")",
"{",
"$",
"custom",
"=",
"$",
"this",
"->",
"getCustom",
"(",
"$",
"config",
")",
";",
"$",
"multiple",
"=",
"$",
"this",
"->",
"isMultiple",
"(",
"$",
"config",
",",
"'multiple'",
"... | Generate a standard HTML input string.
@param array $config Config array
@return string | [
"Generate",
"a",
"standard",
"HTML",
"input",
"string",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L218-L233 |
31,396 | GrafiteInc/FormMaker | src/Generators/HtmlGenerator.php | HtmlGenerator.getPopulation | public function getPopulation($config)
{
if ($config['populated'] && ($config['name'] !== $config['objectValue'])) {
if ($config['type'] == 'date' && method_exists($config['objectValue'], 'format')) {
$format = (isset($config['format'])) ? $config['format'] : 'Y-m-d';
... | php | public function getPopulation($config)
{
if ($config['populated'] && ($config['name'] !== $config['objectValue'])) {
if ($config['type'] == 'date' && method_exists($config['objectValue'], 'format')) {
$format = (isset($config['format'])) ? $config['format'] : 'Y-m-d';
... | [
"public",
"function",
"getPopulation",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"$",
"config",
"[",
"'populated'",
"]",
"&&",
"(",
"$",
"config",
"[",
"'name'",
"]",
"!==",
"$",
"config",
"[",
"'objectValue'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"c... | Get the population.
@param array $config
@return string | [
"Get",
"the",
"population",
"."
] | 9c92d5592e852183c30b20193970bfc1afef2596 | https://github.com/GrafiteInc/FormMaker/blob/9c92d5592e852183c30b20193970bfc1afef2596/src/Generators/HtmlGenerator.php#L259-L272 |
31,397 | chameleon-system/chameleon-shop | src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php | MTExtranetRegistrationGuestCore.RegisterGuestUser | protected function RegisterGuestUser($sSuccessURL = null, $sFailureURL = null)
{
if (null === $sSuccessURL) {
if ($this->global->UserDataExists('sSuccessURL')) {
$sSuccessURL = $this->global->GetUserData('sSuccessURL', array(), TCMSUserInput::FILTER_URL);
}
... | php | protected function RegisterGuestUser($sSuccessURL = null, $sFailureURL = null)
{
if (null === $sSuccessURL) {
if ($this->global->UserDataExists('sSuccessURL')) {
$sSuccessURL = $this->global->GetUserData('sSuccessURL', array(), TCMSUserInput::FILTER_URL);
}
... | [
"protected",
"function",
"RegisterGuestUser",
"(",
"$",
"sSuccessURL",
"=",
"null",
",",
"$",
"sFailureURL",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"sSuccessURL",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"global",
"->",
"UserDataExists",
"(... | Register guest user. Requires last basket step to be thankyou.
@param null $sSuccessURL
@param null $sFailureURL | [
"Register",
"guest",
"user",
".",
"Requires",
"last",
"basket",
"step",
"to",
"be",
"thankyou",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php#L39-L96 |
31,398 | chameleon-system/chameleon-shop | src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php | MTExtranetRegistrationGuestCore.HandleRegisterAfterShopping | protected function HandleRegisterAfterShopping()
{
if ($this->ActivePageIsRegisterAfterShopping()) {
if (!$this->IsAllowedToShowRegisterAfterShoppingPage()) {
$oExtranetConfig = TdbDataExtranet::GetInstance();
$this->controller->HeaderURLRedirect($oExtranetConfig-... | php | protected function HandleRegisterAfterShopping()
{
if ($this->ActivePageIsRegisterAfterShopping()) {
if (!$this->IsAllowedToShowRegisterAfterShoppingPage()) {
$oExtranetConfig = TdbDataExtranet::GetInstance();
$this->controller->HeaderURLRedirect($oExtranetConfig-... | [
"protected",
"function",
"HandleRegisterAfterShopping",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ActivePageIsRegisterAfterShopping",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"IsAllowedToShowRegisterAfterShoppingPage",
"(",
")",
")",
"{",
"$",
... | if user is not allowed to be register redirect to access denied page. | [
"if",
"user",
"is",
"not",
"allowed",
"to",
"be",
"register",
"redirect",
"to",
"access",
"denied",
"page",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php#L101-L109 |
31,399 | chameleon-system/chameleon-shop | src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php | MTExtranetRegistrationGuestCore.IsAllowedToShowRegisterAfterShoppingPage | protected function IsAllowedToShowRegisterAfterShoppingPage()
{
$oStep = TdbShopOrderStep::GetStep('thankyou');
$bUserIsValid = false;
if (!is_null($oStep)) {
$oUser = $oStep->GetLastUserBoughtFromSession();
if (!is_null($oUser)) {
$bUserIsValid = $thi... | php | protected function IsAllowedToShowRegisterAfterShoppingPage()
{
$oStep = TdbShopOrderStep::GetStep('thankyou');
$bUserIsValid = false;
if (!is_null($oStep)) {
$oUser = $oStep->GetLastUserBoughtFromSession();
if (!is_null($oUser)) {
$bUserIsValid = $thi... | [
"protected",
"function",
"IsAllowedToShowRegisterAfterShoppingPage",
"(",
")",
"{",
"$",
"oStep",
"=",
"TdbShopOrderStep",
"::",
"GetStep",
"(",
"'thankyou'",
")",
";",
"$",
"bUserIsValid",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oStep",
")",
... | Checks if user is allowed to register after shopping.
@return bool | [
"Checks",
"if",
"user",
"is",
"allowed",
"to",
"register",
"after",
"shopping",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ExtranetRegistrationGuestBundle/pkgExtranet/objects/WebModules/MTExtranetRegistrationGuestCore/MTExtranetRegistrationGuestCore.class.php#L116-L137 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.