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,200 | thejacer87/php-canadapost-api | src/Shipment.php | Shipment.getShipments | public function getShipments(
$from = '',
$to = '',
$tracking_pin = '',
array $options = []
) {
if (!isset($from) && !isset($tracking_pin)) {
$message = 'You must include either a $from date or a $tracking_pin.';
throw new \InvalidArgumentException($me... | php | public function getShipments(
$from = '',
$to = '',
$tracking_pin = '',
array $options = []
) {
if (!isset($from) && !isset($tracking_pin)) {
$message = 'You must include either a $from date or a $tracking_pin.';
throw new \InvalidArgumentException($me... | [
"public",
"function",
"getShipments",
"(",
"$",
"from",
"=",
"''",
",",
"$",
"to",
"=",
"''",
",",
"$",
"tracking_pin",
"=",
"''",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"from",
")",
"&&",
"!",... | Get Shipments from Canada Post within the specified range.
@param string $from
The beginning range. YmdHs format, eg. 201808282359.
@param string $to
The end range, defaults to current time. YmdHs format, eg. 201808282359.
@param string $tracking_pin
The Tracking PIN of the shipment to retrieve.
@param array $options
... | [
"Get",
"Shipments",
"from",
"Canada",
"Post",
"within",
"the",
"specified",
"range",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Shipment.php#L158-L184 |
31,201 | thejacer87/php-canadapost-api | src/Shipment.php | Shipment.requestShipmentRefund | public function requestShipmentRefund($shipment_id, $email, $options)
{
$content = [
'email' => $email,
];
$xml = Array2XML::createXML(
'non-contract-shipment-refund-request',
$content
);
$envelope = $xml->documentElement;
$envelop... | php | public function requestShipmentRefund($shipment_id, $email, $options)
{
$content = [
'email' => $email,
];
$xml = Array2XML::createXML(
'non-contract-shipment-refund-request',
$content
);
$envelope = $xml->documentElement;
$envelop... | [
"public",
"function",
"requestShipmentRefund",
"(",
"$",
"shipment_id",
",",
"$",
"email",
",",
"$",
"options",
")",
"{",
"$",
"content",
"=",
"[",
"'email'",
"=>",
"$",
"email",
",",
"]",
";",
"$",
"xml",
"=",
"Array2XML",
"::",
"createXML",
"(",
"'no... | Request a refund for a shipment that has been transmitted.
@param string $shipment_id
The shipment id.
@param string $email
The email that will receive updates from Canada Post.
@param array $options
The options to pass along to the Guzzle Client.
@return \DOMDocument
@throws \GuzzleHttp\Exception\GuzzleException
@se... | [
"Request",
"a",
"refund",
"for",
"a",
"shipment",
"that",
"has",
"been",
"transmitted",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Shipment.php#L201-L234 |
31,202 | thejacer87/php-canadapost-api | src/Shipment.php | Shipment.transmitShipments | public function transmitShipments(
array $manifest_address,
array $group_ids,
array $options = []
) {
$this->formatPostalCode($manifest_address['address-details']['postal-zip-code']);
$content = [
'group-ids' => [
'group-id' => $group_ids,
... | php | public function transmitShipments(
array $manifest_address,
array $group_ids,
array $options = []
) {
$this->formatPostalCode($manifest_address['address-details']['postal-zip-code']);
$content = [
'group-ids' => [
'group-id' => $group_ids,
... | [
"public",
"function",
"transmitShipments",
"(",
"array",
"$",
"manifest_address",
",",
"array",
"$",
"group_ids",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"formatPostalCode",
"(",
"$",
"manifest_address",
"[",
"'address-details... | Transmit shipments for pickup by Canada Post.
@param array $manifest_address
The destination info.
<code>
$manifest_address = [
'manifest-company' => 'ACME Inc.',
'phone-number' => '778 867 5309',
'address-details' => [
'address-line-1' => '123 Main St',
'city' => 'Kelowna',
'prov-state' => 'BC',... | [
"Transmit",
"shipments",
"for",
"pickup",
"by",
"Canada",
"Post",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Shipment.php#L266-L304 |
31,203 | thejacer87/php-canadapost-api | src/Shipment.php | Shipment.getManifest | public function getManifest($manifest_id, $rel = '', array $options = [])
{
if (!empty($rel) && ($rel !== 'details')) {
$message = sprintf(
'Unsupported "rel" value: "%s". Supported "rel" value are "details" or null.',
$rel
);
throw new \In... | php | public function getManifest($manifest_id, $rel = '', array $options = [])
{
if (!empty($rel) && ($rel !== 'details')) {
$message = sprintf(
'Unsupported "rel" value: "%s". Supported "rel" value are "details" or null.',
$rel
);
throw new \In... | [
"public",
"function",
"getManifest",
"(",
"$",
"manifest_id",
",",
"$",
"rel",
"=",
"''",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"rel",
")",
"&&",
"(",
"$",
"rel",
"!==",
"'details'",
")",
")",
... | Get the manifest from Canada Post server.
@param string $manifest_id
The manifest id.
@param string $rel
The 'rel' value from the links for a manifest. 'details' is the only valid argument.
@param array $options
The options array.
@return \DOMDocument|\Psr\Http\Message\StreamInterface
@throws \GuzzleHttp\Exception\Gu... | [
"Get",
"the",
"manifest",
"from",
"Canada",
"Post",
"server",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Shipment.php#L319-L342 |
31,204 | pulsarvp/vps-tools | src/controllers/SettingsController.php | SettingsController.actionList | public function actionList ()
{
$class = $this->_modelClass;
$list = $class::find()->select('name,value,description')->orderBy([ 'name' => SORT_ASC ])->asArray()->all();
Console::printTable($list, [ 'Name', 'Value', 'Description' ]);
} | php | public function actionList ()
{
$class = $this->_modelClass;
$list = $class::find()->select('name,value,description')->orderBy([ 'name' => SORT_ASC ])->asArray()->all();
Console::printTable($list, [ 'Name', 'Value', 'Description' ]);
} | [
"public",
"function",
"actionList",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"_modelClass",
";",
"$",
"list",
"=",
"$",
"class",
"::",
"find",
"(",
")",
"->",
"select",
"(",
"'name,value,description'",
")",
"->",
"orderBy",
"(",
"[",
"'name... | List all settings in database. | [
"List",
"all",
"settings",
"in",
"database",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/SettingsController.php#L33-L38 |
31,205 | pulsarvp/vps-tools | src/controllers/SettingsController.php | SettingsController.actionGet | public function actionGet ($name)
{
$class = $this->_modelClass;
$object = $class::find()->select('name,value,description')->where([ 'name' => $name ])->asArray()->one();
if ($object == null)
{
Console::printColor('Setting not found.', 'red');
Yii::$app->end();
}
Console::printTable([ $objec... | php | public function actionGet ($name)
{
$class = $this->_modelClass;
$object = $class::find()->select('name,value,description')->where([ 'name' => $name ])->asArray()->one();
if ($object == null)
{
Console::printColor('Setting not found.', 'red');
Yii::$app->end();
}
Console::printTable([ $objec... | [
"public",
"function",
"actionGet",
"(",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"_modelClass",
";",
"$",
"object",
"=",
"$",
"class",
"::",
"find",
"(",
")",
"->",
"select",
"(",
"'name,value,description'",
")",
"->",
"where",
"(",... | Gets setting with given name.
@param $name | [
"Gets",
"setting",
"with",
"given",
"name",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/SettingsController.php#L45-L55 |
31,206 | pulsarvp/vps-tools | src/controllers/SettingsController.php | SettingsController.actionSet | public function actionSet ($name, $value, $description = null)
{
$class = $this->_modelClass;
$object = $class::find()->where([ 'name' => $name ])->one();
if ($object == null)
{
Console::printColor('Setting not found.', 'red');
Yii::$app->end();
}
else
{
$object->value = $value;
i... | php | public function actionSet ($name, $value, $description = null)
{
$class = $this->_modelClass;
$object = $class::find()->where([ 'name' => $name ])->one();
if ($object == null)
{
Console::printColor('Setting not found.', 'red');
Yii::$app->end();
}
else
{
$object->value = $value;
i... | [
"public",
"function",
"actionSet",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"description",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"_modelClass",
";",
"$",
"object",
"=",
"$",
"class",
"::",
"find",
"(",
")",
"->",
"where... | Updates or creates setting with given name and value.
@param $name
@param $value
@param $description | [
"Updates",
"or",
"creates",
"setting",
"with",
"given",
"name",
"and",
"value",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/SettingsController.php#L64-L81 |
31,207 | pulsarvp/vps-tools | src/controllers/SettingsController.php | SettingsController.actionDelete | public function actionDelete ($name)
{
$class = $this->_modelClass;
$object = $class::find()->where([ 'name' => $name ])->one();
if ($object == null)
{
Console::printColor('Setting not found.', 'red');
Yii::$app->end();
}
if ($this->confirm("Remove setting '" . $name . "'?"))
{
if ($... | php | public function actionDelete ($name)
{
$class = $this->_modelClass;
$object = $class::find()->where([ 'name' => $name ])->one();
if ($object == null)
{
Console::printColor('Setting not found.', 'red');
Yii::$app->end();
}
if ($this->confirm("Remove setting '" . $name . "'?"))
{
if ($... | [
"public",
"function",
"actionDelete",
"(",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"_modelClass",
";",
"$",
"object",
"=",
"$",
"class",
"::",
"find",
"(",
")",
"->",
"where",
"(",
"[",
"'name'",
"=>",
"$",
"name",
"]",
")",
... | Deletes setting with given name.
@param $name | [
"Deletes",
"setting",
"with",
"given",
"name",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/SettingsController.php#L88-L105 |
31,208 | pulsarvp/vps-tools | src/components/redis/Connection.php | Connection.setPasswordDb | public function setPasswordDb ($name)
{
$value = Yii::$app->settings->get($name);
if (empty($value))
{
return;
}
$this->password = $value;
} | php | public function setPasswordDb ($name)
{
$value = Yii::$app->settings->get($name);
if (empty($value))
{
return;
}
$this->password = $value;
} | [
"public",
"function",
"setPasswordDb",
"(",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"Yii",
"::",
"$",
"app",
"->",
"settings",
"->",
"get",
"(",
"$",
"name",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
";",
"}",
... | Set password DB settings.
@param string $name | [
"Set",
"password",
"DB",
"settings",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/redis/Connection.php#L32-L42 |
31,209 | oradwell/covers-validator | src/Command/ValidateCommand.php | ValidateCommand.writeValidity | protected function writeValidity($output, $message, $isValid = null) {
if ($this->firstValidityWrite) {
$output->writeln('');
$this->firstValidityWrite = false;
}
if (is_bool($isValid)) {
$message = sprintf(
'%s - %s',
$isValid... | php | protected function writeValidity($output, $message, $isValid = null) {
if ($this->firstValidityWrite) {
$output->writeln('');
$this->firstValidityWrite = false;
}
if (is_bool($isValid)) {
$message = sprintf(
'%s - %s',
$isValid... | [
"protected",
"function",
"writeValidity",
"(",
"$",
"output",
",",
"$",
"message",
",",
"$",
"isValid",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"firstValidityWrite",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"$",
"th... | Write validity message for tests
The purpose of this method is to write a new line for the first
validity related message
@param OutputInterface $output
@param string $message
@param bool|null $isValid | [
"Write",
"validity",
"message",
"for",
"tests",
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"write",
"a",
"new",
"line",
"for",
"the",
"first",
"validity",
"related",
"message"
] | 1bc9db0e4846d80ad38b14662b6e48edaa7d289f | https://github.com/oradwell/covers-validator/blob/1bc9db0e4846d80ad38b14662b6e48edaa7d289f/src/Command/ValidateCommand.php#L119-L134 |
31,210 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/Themes.php | Themes.getValues | public function getValues(string $id): array
{
$data = Internal\Data::getValue('bearcms/themes/theme/' . md5($id) . '.json');
if ($data !== null) {
$data = json_decode($data, true);
if (isset($data['options'])) {
return $data['options'];
}
... | php | public function getValues(string $id): array
{
$data = Internal\Data::getValue('bearcms/themes/theme/' . md5($id) . '.json');
if ($data !== null) {
$data = json_decode($data, true);
if (isset($data['options'])) {
return $data['options'];
}
... | [
"public",
"function",
"getValues",
"(",
"string",
"$",
"id",
")",
":",
"array",
"{",
"$",
"data",
"=",
"Internal",
"\\",
"Data",
"::",
"getValue",
"(",
"'bearcms/themes/theme/'",
".",
"md5",
"(",
"$",
"id",
")",
".",
"'.json'",
")",
";",
"if",
"(",
"... | Returns a list containing the options for the theme specified
@param string $id The id of the theme
@return array A list containing the theme options
@throws \InvalidArgumentException | [
"Returns",
"a",
"list",
"containing",
"the",
"options",
"for",
"the",
"theme",
"specified"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/Themes.php#L29-L39 |
31,211 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/Themes.php | Themes.getUserOptions | public function getUserOptions(string $id, string $userID): ?array
{
$data = Internal\Data::getValue('.temp/bearcms/userthemeoptions/' . md5($userID) . '/' . md5($id) . '.json');
if ($data !== null) {
$data = json_decode($data, true);
if (isset($data['options'])) {
... | php | public function getUserOptions(string $id, string $userID): ?array
{
$data = Internal\Data::getValue('.temp/bearcms/userthemeoptions/' . md5($userID) . '/' . md5($id) . '.json');
if ($data !== null) {
$data = json_decode($data, true);
if (isset($data['options'])) {
... | [
"public",
"function",
"getUserOptions",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"userID",
")",
":",
"?",
"array",
"{",
"$",
"data",
"=",
"Internal",
"\\",
"Data",
"::",
"getValue",
"(",
"'.temp/bearcms/userthemeoptions/'",
".",
"md5",
"(",
"$",
"user... | Returns a list containing the theme options a specific user has made
@param string $id The id of the theme
@param string $userID The id of the user
@return array A list containing the theme options
@throws \InvalidArgumentException | [
"Returns",
"a",
"list",
"containing",
"the",
"theme",
"options",
"a",
"specific",
"user",
"has",
"made"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/Themes.php#L49-L59 |
31,212 | traderinteractive/filter-php | src/Filterer.php | Filterer.setFilterAliases | public static function setFilterAliases(array $aliases)
{
$originalAliases = self::$registeredFilterAliases;
self::$registeredFilterAliases = [];
try {
foreach ($aliases as $alias => $callback) {
self::registerAlias($alias, $callback);
}
} catc... | php | public static function setFilterAliases(array $aliases)
{
$originalAliases = self::$registeredFilterAliases;
self::$registeredFilterAliases = [];
try {
foreach ($aliases as $alias => $callback) {
self::registerAlias($alias, $callback);
}
} catc... | [
"public",
"static",
"function",
"setFilterAliases",
"(",
"array",
"$",
"aliases",
")",
"{",
"$",
"originalAliases",
"=",
"self",
"::",
"$",
"registeredFilterAliases",
";",
"self",
"::",
"$",
"registeredFilterAliases",
"=",
"[",
"]",
";",
"try",
"{",
"foreach",... | Set the filter aliases.
@param array $aliases array where keys are aliases and values pass is_callable().
@return void
@throws Exception Thrown if any of the given $aliases is not valid. @see registerAlias() | [
"Set",
"the",
"filter",
"aliases",
"."
] | a8dec173063ee2444ec297f065f64496b7d21590 | https://github.com/traderinteractive/filter-php/blob/a8dec173063ee2444ec297f065f64496b7d21590/src/Filterer.php#L325-L337 |
31,213 | traderinteractive/filter-php | src/Filterer.php | Filterer.registerAlias | public static function registerAlias($alias, callable $filter, bool $overwrite = false)
{
self::assertIfStringOrInt($alias);
self::assertIfAliasExists($alias, $overwrite);
self::$registeredFilterAliases[$alias] = $filter;
} | php | public static function registerAlias($alias, callable $filter, bool $overwrite = false)
{
self::assertIfStringOrInt($alias);
self::assertIfAliasExists($alias, $overwrite);
self::$registeredFilterAliases[$alias] = $filter;
} | [
"public",
"static",
"function",
"registerAlias",
"(",
"$",
"alias",
",",
"callable",
"$",
"filter",
",",
"bool",
"$",
"overwrite",
"=",
"false",
")",
"{",
"self",
"::",
"assertIfStringOrInt",
"(",
"$",
"alias",
")",
";",
"self",
"::",
"assertIfAliasExists",
... | Register a new alias with the Filterer
@param string|int $alias the alias to register
@param callable $filter the aliased callable filter
@param bool $overwrite Flag to overwrite existing alias if it exists
@return void
@throws \InvalidArgumentException if $alias was not a string or int
@throws Exception if $overwri... | [
"Register",
"a",
"new",
"alias",
"with",
"the",
"Filterer"
] | a8dec173063ee2444ec297f065f64496b7d21590 | https://github.com/traderinteractive/filter-php/blob/a8dec173063ee2444ec297f065f64496b7d21590/src/Filterer.php#L351-L356 |
31,214 | thejacer87/php-canadapost-api | src/Rating.php | Rating.parseServiceCodes | protected function parseServiceCodes(array $options)
{
$services = [];
foreach ($options['service_codes'] as $serviceCode) {
if (!array_key_exists(strtoupper($serviceCode), self::getServiceCodes())) {
$message = sprintf(
'Unsupported service code: "%s"... | php | protected function parseServiceCodes(array $options)
{
$services = [];
foreach ($options['service_codes'] as $serviceCode) {
if (!array_key_exists(strtoupper($serviceCode), self::getServiceCodes())) {
$message = sprintf(
'Unsupported service code: "%s"... | [
"protected",
"function",
"parseServiceCodes",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"services",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"options",
"[",
"'service_codes'",
"]",
"as",
"$",
"serviceCode",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
... | Helper function to extract the service codes.
@param array $options
The options array.
@return array
The list of services to look up. | [
"Helper",
"function",
"to",
"extract",
"the",
"service",
"codes",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/Rating.php#L144-L160 |
31,215 | EmchBerger/cube-custom-fields-bundle | src/EntityHelper/CustomFieldsGetSet.php | CustomFieldsGetSet.getField | public static function getField($owningEntity, $key)
{
$entity = $owningEntity->getNonemptyCustomFields()->get($key);
if (!$entity) {
self::checkCustomFieldExists($owningEntity, $key);
}
return $entity;
} | php | public static function getField($owningEntity, $key)
{
$entity = $owningEntity->getNonemptyCustomFields()->get($key);
if (!$entity) {
self::checkCustomFieldExists($owningEntity, $key);
}
return $entity;
} | [
"public",
"static",
"function",
"getField",
"(",
"$",
"owningEntity",
",",
"$",
"key",
")",
"{",
"$",
"entity",
"=",
"$",
"owningEntity",
"->",
"getNonemptyCustomFields",
"(",
")",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"$",
"entity",
... | Gets the customField, null if the key does not exist.
@param object $owningEntity
@param string $key
@return CustomFieldBase|null | [
"Gets",
"the",
"customField",
"null",
"if",
"the",
"key",
"does",
"not",
"exist",
"."
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/EntityHelper/CustomFieldsGetSet.php#L26-L35 |
31,216 | EmchBerger/cube-custom-fields-bundle | src/EntityHelper/CustomFieldsGetSet.php | CustomFieldsGetSet.getValue | public static function getValue($owningEntity, $key)
{
$entity = $owningEntity->getNonemptyCustomFields()->get($key);
if ($entity) {
$value = $entity->getValue();
} else {
self::checkCustomFieldExists($owningEntity, $key);
$value = null;
}
... | php | public static function getValue($owningEntity, $key)
{
$entity = $owningEntity->getNonemptyCustomFields()->get($key);
if ($entity) {
$value = $entity->getValue();
} else {
self::checkCustomFieldExists($owningEntity, $key);
$value = null;
}
... | [
"public",
"static",
"function",
"getValue",
"(",
"$",
"owningEntity",
",",
"$",
"key",
")",
"{",
"$",
"entity",
"=",
"$",
"owningEntity",
"->",
"getNonemptyCustomFields",
"(",
")",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"entity",
")",
... | Gets the value of a custom field, null if not set.
@param object $owningEntity
@param string $key
@return mixed | [
"Gets",
"the",
"value",
"of",
"a",
"custom",
"field",
"null",
"if",
"not",
"set",
"."
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/EntityHelper/CustomFieldsGetSet.php#L45-L57 |
31,217 | EmchBerger/cube-custom-fields-bundle | src/EntityHelper/CustomFieldsGetSet.php | CustomFieldsGetSet.getEntityType | private static function getEntityType($owningEntity, $key)
{
$config = self::getConfig();
$owningClass = ClassUtils::getClass($owningEntity);
if (isset($config[$owningClass][$key])) {
return $config[$owningClass][$key]['type'];
}
return null;
} | php | private static function getEntityType($owningEntity, $key)
{
$config = self::getConfig();
$owningClass = ClassUtils::getClass($owningEntity);
if (isset($config[$owningClass][$key])) {
return $config[$owningClass][$key]['type'];
}
return null;
} | [
"private",
"static",
"function",
"getEntityType",
"(",
"$",
"owningEntity",
",",
"$",
"key",
")",
"{",
"$",
"config",
"=",
"self",
"::",
"getConfig",
"(",
")",
";",
"$",
"owningClass",
"=",
"ClassUtils",
"::",
"getClass",
"(",
"$",
"owningEntity",
")",
"... | Returns the type according to the configuration.
@param object $owningEntity
@param string $key
@return string|null | [
"Returns",
"the",
"type",
"according",
"to",
"the",
"configuration",
"."
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/EntityHelper/CustomFieldsGetSet.php#L137-L146 |
31,218 | EmchBerger/cube-custom-fields-bundle | src/EntityHelper/CustomFieldsGetSet.php | CustomFieldsGetSet.checkCustomFieldExists | private static function checkCustomFieldExists($owningEntity, $key)
{
if (is_null(self::getEntityType($owningEntity, $key))) {
$msg = sprintf('CustomField "%s" does not exist for entity class "%s"', $key, ClassUtils::getClass($owningEntity));
throw new \LogicException($msg);
... | php | private static function checkCustomFieldExists($owningEntity, $key)
{
if (is_null(self::getEntityType($owningEntity, $key))) {
$msg = sprintf('CustomField "%s" does not exist for entity class "%s"', $key, ClassUtils::getClass($owningEntity));
throw new \LogicException($msg);
... | [
"private",
"static",
"function",
"checkCustomFieldExists",
"(",
"$",
"owningEntity",
",",
"$",
"key",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"getEntityType",
"(",
"$",
"owningEntity",
",",
"$",
"key",
")",
")",
")",
"{",
"$",
"msg",
"=",
"s... | Throws an error if the entity does not contain the custom field.
@param object $owningEntity
@param string $key
@throws \LogicException | [
"Throws",
"an",
"error",
"if",
"the",
"entity",
"does",
"not",
"contain",
"the",
"custom",
"field",
"."
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/EntityHelper/CustomFieldsGetSet.php#L156-L162 |
31,219 | wikimedia/slimapp | src/CsrfMiddleware.php | CsrfMiddleware.call | public function call() {
if ( !isset( $_SESSION[self::PARAM] ) ) {
$_SESSION[self::PARAM] = sha1( session_id() . microtime() );
}
$token = $_SESSION[self::PARAM];
$method = $this->app->request()->getMethod();
if ( in_array( $method, [ 'POST', 'PUT', 'DELETE' ] ) ) {
$requestToken = $this->app->request... | php | public function call() {
if ( !isset( $_SESSION[self::PARAM] ) ) {
$_SESSION[self::PARAM] = sha1( session_id() . microtime() );
}
$token = $_SESSION[self::PARAM];
$method = $this->app->request()->getMethod();
if ( in_array( $method, [ 'POST', 'PUT', 'DELETE' ] ) ) {
$requestToken = $this->app->request... | [
"public",
"function",
"call",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"self",
"::",
"PARAM",
"]",
")",
")",
"{",
"$",
"_SESSION",
"[",
"self",
"::",
"PARAM",
"]",
"=",
"sha1",
"(",
"session_id",
"(",
")",
".",
"microtim... | Handle CSRF validation and view injection. | [
"Handle",
"CSRF",
"validation",
"and",
"view",
"injection",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/CsrfMiddleware.php#L44-L70 |
31,220 | thejacer87/php-canadapost-api | src/NCShipment.php | NCShipment.createNCShipment | public function createNCShipment(
array $sender,
array $destination,
array $parcel,
array $options = []
) {
$content = $this->buildShipmentArray($sender, $destination, $parcel, $options);
$xml = Array2XML::createXML('non-contract-shipment', $content);
$envelo... | php | public function createNCShipment(
array $sender,
array $destination,
array $parcel,
array $options = []
) {
$content = $this->buildShipmentArray($sender, $destination, $parcel, $options);
$xml = Array2XML::createXML('non-contract-shipment', $content);
$envelo... | [
"public",
"function",
"createNCShipment",
"(",
"array",
"$",
"sender",
",",
"array",
"$",
"destination",
",",
"array",
"$",
"parcel",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"buildShipmentArray",
"("... | Create the shipment.
@param array $sender
The sender info.
<code>
$sender = [
'company' => 'Acro Media',
'contact-phone' => '(250) 763-8884',
'address-details' => [
'address-line-1' => '103-2303 Leckie Rd',
'city' => 'Kelowna',
'prov-state' => 'BC',
'postal-zip-code' => 'V1X 6Y5',
],
]
</cod... | [
"Create",
"the",
"shipment",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/NCShipment.php#L68-L94 |
31,221 | thejacer87/php-canadapost-api | src/NCShipment.php | NCShipment.getNCShipments | public function getNCShipments(
$from = '',
$to = '',
$tracking_pin = '',
array $options = []
) {
if (!isset($from) && !isset($tracking_pin)) {
$message = 'You must include either a $from date or a $tracking_pin.';
throw new \InvalidArgumentException($... | php | public function getNCShipments(
$from = '',
$to = '',
$tracking_pin = '',
array $options = []
) {
if (!isset($from) && !isset($tracking_pin)) {
$message = 'You must include either a $from date or a $tracking_pin.';
throw new \InvalidArgumentException($... | [
"public",
"function",
"getNCShipments",
"(",
"$",
"from",
"=",
"''",
",",
"$",
"to",
"=",
"''",
",",
"$",
"tracking_pin",
"=",
"''",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"from",
")",
"&&",
"!... | Get NCShipments from Canada Post within the specified range.
If you supply a tracking PIN, the from/to dates will be ignored.
@param string $from
The beginning range. YmdHs format, eg. 201808282359.
@param string $to
The end range, defaults to current time. YmdHs format, eg. 201808282359.
@param string $tracking_pin
... | [
"Get",
"NCShipments",
"from",
"Canada",
"Post",
"within",
"the",
"specified",
"range",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/NCShipment.php#L153-L184 |
31,222 | thejacer87/php-canadapost-api | src/NCShipment.php | NCShipment.requestNCShipmentRefund | public function requestNCShipmentRefund($shipment_id, $email, $options)
{
$content = [
'email' => $email,
];
$xml = Array2XML::createXML(
'non-contract-shipment-refund-request',
$content
);
$envelope = $xml->documentElement;
$envel... | php | public function requestNCShipmentRefund($shipment_id, $email, $options)
{
$content = [
'email' => $email,
];
$xml = Array2XML::createXML(
'non-contract-shipment-refund-request',
$content
);
$envelope = $xml->documentElement;
$envel... | [
"public",
"function",
"requestNCShipmentRefund",
"(",
"$",
"shipment_id",
",",
"$",
"email",
",",
"$",
"options",
")",
"{",
"$",
"content",
"=",
"[",
"'email'",
"=>",
"$",
"email",
",",
"]",
";",
"$",
"xml",
"=",
"Array2XML",
"::",
"createXML",
"(",
"'... | Request a refund for a non-contract shipment that has been transmitted.
@param string $shipment_id
The shipment id.
@param string $email
The email that will receive updates from Canada Post.
@param array $options
The options to pass along to the Guzzle Client.
@return \DOMDocument
@throws \GuzzleHttp\Exception\Guzzle... | [
"Request",
"a",
"refund",
"for",
"a",
"non",
"-",
"contract",
"shipment",
"that",
"has",
"been",
"transmitted",
"."
] | 1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a | https://github.com/thejacer87/php-canadapost-api/blob/1f0f6db5ac2a85aa1e4adf6ddd6b99d29310923a/src/NCShipment.php#L201-L227 |
31,223 | EmchBerger/cube-custom-fields-bundle | src/Entity/AbstractCustomFieldRepository.php | AbstractCustomFieldRepository.findByObject | public function findByObject($object, $fieldId = null)
{
$qb = $this->createQueryBuilder('cf');
$this->addFindByObject($qb, 'cf', $object, $fieldId);
return $qb->getQuery()->getResult();
} | php | public function findByObject($object, $fieldId = null)
{
$qb = $this->createQueryBuilder('cf');
$this->addFindByObject($qb, 'cf', $object, $fieldId);
return $qb->getQuery()->getResult();
} | [
"public",
"function",
"findByObject",
"(",
"$",
"object",
",",
"$",
"fieldId",
"=",
"null",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'cf'",
")",
";",
"$",
"this",
"->",
"addFindByObject",
"(",
"$",
"qb",
",",
"'cf'",
"... | Finds EntityCustomFields which point to a specific object.
@param object $object value to filter for
@param string $fieldId optional
@return \Doctrine\ORM\QueryBuilder $qb | [
"Finds",
"EntityCustomFields",
"which",
"point",
"to",
"a",
"specific",
"object",
"."
] | 7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414 | https://github.com/EmchBerger/cube-custom-fields-bundle/blob/7c87f9e8e0f7a5f50536d0d801c04a0ba6de3414/src/Entity/AbstractCustomFieldRepository.php#L20-L26 |
31,224 | oradwell/covers-validator | src/Locator/ConfigLocator.php | ConfigLocator.locate | public static function locate($configOption)
{
$configurationFile = static::CONFIG_FILENAME;
if (is_dir($configOption)) {
$configurationFile = $configOption . DIRECTORY_SEPARATOR . $configurationFile;
}
if (file_exists($configOption) && is_file($configOption)) {
... | php | public static function locate($configOption)
{
$configurationFile = static::CONFIG_FILENAME;
if (is_dir($configOption)) {
$configurationFile = $configOption . DIRECTORY_SEPARATOR . $configurationFile;
}
if (file_exists($configOption) && is_file($configOption)) {
... | [
"public",
"static",
"function",
"locate",
"(",
"$",
"configOption",
")",
"{",
"$",
"configurationFile",
"=",
"static",
"::",
"CONFIG_FILENAME",
";",
"if",
"(",
"is_dir",
"(",
"$",
"configOption",
")",
")",
"{",
"$",
"configurationFile",
"=",
"$",
"configOpti... | Locates config file to use in the way PHPUnit does it
@param string $configOption
@return string|null | [
"Locates",
"config",
"file",
"to",
"use",
"in",
"the",
"way",
"PHPUnit",
"does",
"it"
] | 1bc9db0e4846d80ad38b14662b6e48edaa7d289f | https://github.com/oradwell/covers-validator/blob/1bc9db0e4846d80ad38b14662b6e48edaa7d289f/src/Locator/ConfigLocator.php#L15-L32 |
31,225 | oradwell/covers-validator | src/Loader/FileLoader.php | FileLoader.loadFile | public static function loadFile($filename)
{
if (class_exists(\PHPUnit\Util\Fileloader::class)) {
// PHPUnit 6.x
\PHPUnit\Util\Fileloader::checkAndLoad($filename);
} else {
// PHPUnit 7.x+
\PHPUnit\Util\FileLoader::checkAndLoad($filename);
}
... | php | public static function loadFile($filename)
{
if (class_exists(\PHPUnit\Util\Fileloader::class)) {
// PHPUnit 6.x
\PHPUnit\Util\Fileloader::checkAndLoad($filename);
} else {
// PHPUnit 7.x+
\PHPUnit\Util\FileLoader::checkAndLoad($filename);
}
... | [
"public",
"static",
"function",
"loadFile",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"class_exists",
"(",
"\\",
"PHPUnit",
"\\",
"Util",
"\\",
"Fileloader",
"::",
"class",
")",
")",
"{",
"// PHPUnit 6.x",
"\\",
"PHPUnit",
"\\",
"Util",
"\\",
"Fileloader"... | Include a file
@param string $filename | [
"Include",
"a",
"file"
] | 1bc9db0e4846d80ad38b14662b6e48edaa7d289f | https://github.com/oradwell/covers-validator/blob/1bc9db0e4846d80ad38b14662b6e48edaa7d289f/src/Loader/FileLoader.php#L12-L21 |
31,226 | bearcms/bearframework-addon | classes/BearCMS/Internal/CurrentTheme.php | CurrentTheme.getID | static public function getID(): string
{
if (!isset(self::$cache['id'])) {
$cookies = Internal\Cookies::getList(Internal\Cookies::TYPE_SERVER);
self::$cache['id'] = isset($cookies['tmpr']) ? $cookies['tmpr'] : Internal\Themes::getActiveThemeID();
}
return self::$cache... | php | static public function getID(): string
{
if (!isset(self::$cache['id'])) {
$cookies = Internal\Cookies::getList(Internal\Cookies::TYPE_SERVER);
self::$cache['id'] = isset($cookies['tmpr']) ? $cookies['tmpr'] : Internal\Themes::getActiveThemeID();
}
return self::$cache... | [
"static",
"public",
"function",
"getID",
"(",
")",
":",
"string",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"cache",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"cookies",
"=",
"Internal",
"\\",
"Cookies",
"::",
"getList",
"(",
"Internal",
"\... | Returns the id of the current active theme or theme in preview
@return string The id of the current active theme or theme in preview | [
"Returns",
"the",
"id",
"of",
"the",
"current",
"active",
"theme",
"or",
"theme",
"in",
"preview"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/CurrentTheme.php#L33-L40 |
31,227 | pulsarvp/vps-tools | src/db/Migration.php | Migration.addEnumValue | public function addEnumValue ($table, $column, $value, $default = false)
{
echo " > add enum value $value to column $column in $table ...\n";
$time = microtime(true);
$columnSchema = $this->db->getTableSchema($table)->columns[ $column ];
$values = $columnSchema->enumValues;
$values[] = $value;
$... | php | public function addEnumValue ($table, $column, $value, $default = false)
{
echo " > add enum value $value to column $column in $table ...\n";
$time = microtime(true);
$columnSchema = $this->db->getTableSchema($table)->columns[ $column ];
$values = $columnSchema->enumValues;
$values[] = $value;
$... | [
"public",
"function",
"addEnumValue",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"value",
",",
"$",
"default",
"=",
"false",
")",
"{",
"echo",
"\" > add enum value $value to column $column in $table ...\\n\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"t... | Adds value to enum column.
@param string $table Table name.
@param string $column Column name.
@param string $value New value in enum.
@param bool $default Whether to set new value as default. | [
"Adds",
"value",
"to",
"enum",
"column",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L25-L37 |
31,228 | pulsarvp/vps-tools | src/db/Migration.php | Migration.createView | public function createView ($name, Query $query, $replace = true)
{
echo " > create table $name ...";
$time = microtime(true);
$sql = 'CREATE' . ( $replace ? ' OR REPLACE' : '' ) . ' VIEW ' . $this->db->quoteTableName($name) . ' AS ' . $query->createCommand()->getRawSql();
$this->db->createCommand($sq... | php | public function createView ($name, Query $query, $replace = true)
{
echo " > create table $name ...";
$time = microtime(true);
$sql = 'CREATE' . ( $replace ? ' OR REPLACE' : '' ) . ' VIEW ' . $this->db->quoteTableName($name) . ' AS ' . $query->createCommand()->getRawSql();
$this->db->createCommand($sq... | [
"public",
"function",
"createView",
"(",
"$",
"name",
",",
"Query",
"$",
"query",
",",
"$",
"replace",
"=",
"true",
")",
"{",
"echo",
"\" > create table $name ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"sql",
"=",
"'CREATE... | Creates database view.
@param string $name View name.
@param Query $query Query that is used to create view.
@param bool $replace Whether to replace existing view with the same name.
@throws \yii\db\Exception
@see dropView | [
"Creates",
"database",
"view",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L49-L58 |
31,229 | pulsarvp/vps-tools | src/db/Migration.php | Migration.checkCollation | public function checkCollation ($encoding = 'utf8', $exception = true)
{
$variables = [
'character_set_client',
'character_set_connection',
'character_set_database',
'character_set_results',
'character_set_server',
'character_set_system',
'collation_connection',
'collation_database'... | php | public function checkCollation ($encoding = 'utf8', $exception = true)
{
$variables = [
'character_set_client',
'character_set_connection',
'character_set_database',
'character_set_results',
'character_set_server',
'character_set_system',
'collation_connection',
'collation_database'... | [
"public",
"function",
"checkCollation",
"(",
"$",
"encoding",
"=",
"'utf8'",
",",
"$",
"exception",
"=",
"true",
")",
"{",
"$",
"variables",
"=",
"[",
"'character_set_client'",
",",
"'character_set_connection'",
",",
"'character_set_database'",
",",
"'character_set_... | Server encoding checking
@param string $encoding
@param bool $exception
@return bool
@throws InvalidConfigException | [
"Server",
"encoding",
"checking"
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L69-L97 |
31,230 | pulsarvp/vps-tools | src/db/Migration.php | Migration.checkEngine | public function checkEngine (string $name = 'InnoDB', bool $default = true, bool $exception = true)
{
$engines = $this->db->createCommand("SHOW ENGINES")->queryAll();
foreach ($engines as $engine)
{
if (strcasecmp($engine[ 'Engine' ], $name) == 0)
{
switch ($engine[ 'Support' ])
{
cas... | php | public function checkEngine (string $name = 'InnoDB', bool $default = true, bool $exception = true)
{
$engines = $this->db->createCommand("SHOW ENGINES")->queryAll();
foreach ($engines as $engine)
{
if (strcasecmp($engine[ 'Engine' ], $name) == 0)
{
switch ($engine[ 'Support' ])
{
cas... | [
"public",
"function",
"checkEngine",
"(",
"string",
"$",
"name",
"=",
"'InnoDB'",
",",
"bool",
"$",
"default",
"=",
"true",
",",
"bool",
"$",
"exception",
"=",
"true",
")",
"{",
"$",
"engines",
"=",
"$",
"this",
"->",
"db",
"->",
"createCommand",
"(",
... | Check if provided engine is supported and enabled.
@param string $name Engine name.
@param bool $default Whether to check if engine is default.
@param bool $exception Whether to throw exception on error.
@return bool True in case of engine is enabled and (in case of default is true) default. Otherwise exception i... | [
"Check",
"if",
"provided",
"engine",
"is",
"supported",
"and",
"enabled",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L109-L151 |
31,231 | pulsarvp/vps-tools | src/db/Migration.php | Migration.deleteEnumValue | public function deleteEnumValue ($table, $column, $value, $default = null)
{
echo " > delete enum value $value from column $column in $table ...\n";
$time = microtime(true);
$columnSchema = $this->db->getTableSchema($table)->columns[ $column ];
$values = $columnSchema->enumValues;
$key = array_sear... | php | public function deleteEnumValue ($table, $column, $value, $default = null)
{
echo " > delete enum value $value from column $column in $table ...\n";
$time = microtime(true);
$columnSchema = $this->db->getTableSchema($table)->columns[ $column ];
$values = $columnSchema->enumValues;
$key = array_sear... | [
"public",
"function",
"deleteEnumValue",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"value",
",",
"$",
"default",
"=",
"null",
")",
"{",
"echo",
"\" > delete enum value $value from column $column in $table ...\\n\"",
";",
"$",
"time",
"=",
"microtime",
"(... | Deletes value from enum column.
@param string $table Table name.
@param string $column Column name.
@param string $value Value to be removed from column.
@param null $default New default value. If null the old one will be used.
@throws \yii\db\Exception | [
"Deletes",
"value",
"from",
"enum",
"column",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L163-L178 |
31,232 | pulsarvp/vps-tools | src/db/Migration.php | Migration.dropView | public function dropView ($name)
{
echo " > drop view $name ...";
$time = microtime(true);
$this->db->createCommand('DROP VIEW IF EXISTS ' . $this->db->quoteTableName($name))->execute();
echo ' > done (time: ' . sprintf('%.3f', microtime(true) - $time) . "s)\n";
} | php | public function dropView ($name)
{
echo " > drop view $name ...";
$time = microtime(true);
$this->db->createCommand('DROP VIEW IF EXISTS ' . $this->db->quoteTableName($name))->execute();
echo ' > done (time: ' . sprintf('%.3f', microtime(true) - $time) . "s)\n";
} | [
"public",
"function",
"dropView",
"(",
"$",
"name",
")",
"{",
"echo",
"\" > drop view $name ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"db",
"->",
"createCommand",
"(",
"'DROP VIEW IF EXISTS '",
".",
"$",
"this",... | Drops view by name.
@param string $name
@see createView | [
"Drops",
"view",
"by",
"name",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L187-L193 |
31,233 | pulsarvp/vps-tools | src/db/Migration.php | Migration.findForeignKeys | public function findForeignKeys ($table, $column = null)
{
$query = ( new Query )
->select('CONSTRAINT_NAME')
->from('INFORMATION_SCHEMA.KEY_COLUMN_USAGE')
->where([
'TABLE_SCHEMA' => $this->getDbName(),
'TABLE_NAME' => $table
]);
if (!is_null($column))
$query->andWhere([ 'COLUM... | php | public function findForeignKeys ($table, $column = null)
{
$query = ( new Query )
->select('CONSTRAINT_NAME')
->from('INFORMATION_SCHEMA.KEY_COLUMN_USAGE')
->where([
'TABLE_SCHEMA' => $this->getDbName(),
'TABLE_NAME' => $table
]);
if (!is_null($column))
$query->andWhere([ 'COLUM... | [
"public",
"function",
"findForeignKeys",
"(",
"$",
"table",
",",
"$",
"column",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"(",
"new",
"Query",
")",
"->",
"select",
"(",
"'CONSTRAINT_NAME'",
")",
"->",
"from",
"(",
"'INFORMATION_SCHEMA.KEY_COLUMN_USAGE'",
")"... | Find all foreign keys names for specific table and column.
@param string $table
@param string|null $column
@return string[] | [
"Find",
"all",
"foreign",
"keys",
"names",
"for",
"specific",
"table",
"and",
"column",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L215-L228 |
31,234 | pulsarvp/vps-tools | src/db/Migration.php | Migration.fromFile | public function fromFile ($path)
{
if (file_exists($path) and is_readable($path))
{
echo " > loading queries from file $path ...";
$time = microtime(true);
$rows = file($path, FILE_SKIP_EMPTY_LINES);
foreach ($rows as $row)
$this->db->createCommand($row)->execute();
echo ' > don... | php | public function fromFile ($path)
{
if (file_exists($path) and is_readable($path))
{
echo " > loading queries from file $path ...";
$time = microtime(true);
$rows = file($path, FILE_SKIP_EMPTY_LINES);
foreach ($rows as $row)
$this->db->createCommand($row)->execute();
echo ' > don... | [
"public",
"function",
"fromFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
"and",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"echo",
"\" > loading queries from file $path ...\"",
";",
"$",
"time",
"=",
"microtime",... | Loads queries from file and executes them. Each query should be on
new line just in case.
@param string $path Path to the file.
@throws \Exception
@throws \yii\db\Exception | [
"Loads",
"queries",
"from",
"file",
"and",
"executes",
"them",
".",
"Each",
"query",
"should",
"be",
"on",
"new",
"line",
"just",
"in",
"case",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L239-L254 |
31,235 | pulsarvp/vps-tools | src/db/Migration.php | Migration.foreignKeyCheck | public function foreignKeyCheck ($check = true)
{
$check = intval(boolval($check));
$this->db->createCommand("SET FOREIGN_KEY_CHECKS=$check")->execute();
} | php | public function foreignKeyCheck ($check = true)
{
$check = intval(boolval($check));
$this->db->createCommand("SET FOREIGN_KEY_CHECKS=$check")->execute();
} | [
"public",
"function",
"foreignKeyCheck",
"(",
"$",
"check",
"=",
"true",
")",
"{",
"$",
"check",
"=",
"intval",
"(",
"boolval",
"(",
"$",
"check",
")",
")",
";",
"$",
"this",
"->",
"db",
"->",
"createCommand",
"(",
"\"SET FOREIGN_KEY_CHECKS=$check\"",
")",... | Sets foreign key check to 1 or 0.
@param bool $check | [
"Sets",
"foreign",
"key",
"check",
"to",
"1",
"or",
"0",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L261-L265 |
31,236 | pulsarvp/vps-tools | src/db/Migration.php | Migration.getDbName | public function getDbName ()
{
if ($this->db->getDriverName() == 'mysql')
{
preg_match("/dbname=([^;]*)/", $this->db->dsn, $match);
if (isset($match[ 1 ]))
return $match[ 1 ];
}
return null;
} | php | public function getDbName ()
{
if ($this->db->getDriverName() == 'mysql')
{
preg_match("/dbname=([^;]*)/", $this->db->dsn, $match);
if (isset($match[ 1 ]))
return $match[ 1 ];
}
return null;
} | [
"public",
"function",
"getDbName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"db",
"->",
"getDriverName",
"(",
")",
"==",
"'mysql'",
")",
"{",
"preg_match",
"(",
"\"/dbname=([^;]*)/\"",
",",
"$",
"this",
"->",
"db",
"->",
"dsn",
",",
"$",
"match",
... | Gets database name via dbname parameter from dsn.
@return string|null | [
"Gets",
"database",
"name",
"via",
"dbname",
"parameter",
"from",
"dsn",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L272-L282 |
31,237 | pulsarvp/vps-tools | src/db/Migration.php | Migration.hasColumn | public function hasColumn ($table, $column)
{
$schema = $this->db->getTableSchema($table);
return isset($schema->columns[ $column ]);
} | php | public function hasColumn ($table, $column)
{
$schema = $this->db->getTableSchema($table);
return isset($schema->columns[ $column ]);
} | [
"public",
"function",
"hasColumn",
"(",
"$",
"table",
",",
"$",
"column",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"db",
"->",
"getTableSchema",
"(",
"$",
"table",
")",
";",
"return",
"isset",
"(",
"$",
"schema",
"->",
"columns",
"[",
"$",
... | Checks whether column for a table exist.
@param string $table
@param string $column
@return bool | [
"Checks",
"whether",
"column",
"for",
"a",
"table",
"exist",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/db/Migration.php#L292-L297 |
31,238 | FernleafSystems/ApiWrappers-FreeAgent | src/Entities/BankTransactions/Finder.php | Finder.byAmount | public function byAmount( $nAmount ) {
$oTheOne = null;
foreach ( $this as $oBankTxn ) {
if ( (string)$oBankTxn->amount == (string)$nAmount ) {
$oTheOne = $oBankTxn;
break;
}
}
return $oTheOne;
} | php | public function byAmount( $nAmount ) {
$oTheOne = null;
foreach ( $this as $oBankTxn ) {
if ( (string)$oBankTxn->amount == (string)$nAmount ) {
$oTheOne = $oBankTxn;
break;
}
}
return $oTheOne;
} | [
"public",
"function",
"byAmount",
"(",
"$",
"nAmount",
")",
"{",
"$",
"oTheOne",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"as",
"$",
"oBankTxn",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"oBankTxn",
"->",
"amount",
"==",
"(",
"string",
")... | Ideally you would set other filter params on this if you're looking for a specific
transaction - i.e. unexplained, within a date range
@param string $nAmount
@return BankTransactionVO|null | [
"Ideally",
"you",
"would",
"set",
"other",
"filter",
"params",
"on",
"this",
"if",
"you",
"re",
"looking",
"for",
"a",
"specific",
"transaction",
"-",
"i",
".",
"e",
".",
"unexplained",
"within",
"a",
"date",
"range"
] | bfa283d27b81eccc34d214839b68cee7bf75f17a | https://github.com/FernleafSystems/ApiWrappers-FreeAgent/blob/bfa283d27b81eccc34d214839b68cee7bf75f17a/src/Entities/BankTransactions/Finder.php#L17-L26 |
31,239 | pulsarvp/vps-tools | src/html/Field.php | Field.hidden | public function hidden ($options = [])
{
$this->options[ 'class' ] = ( isset($this->options[ 'class' ]) ? $this->options[ 'class' ] . ' ' : '' ) . 'hide';
$this->parts[ '{input}' ] = Html::activeHiddenInput($this->model, $this->attribute, $options);
return $this;
} | php | public function hidden ($options = [])
{
$this->options[ 'class' ] = ( isset($this->options[ 'class' ]) ? $this->options[ 'class' ] . ' ' : '' ) . 'hide';
$this->parts[ '{input}' ] = Html::activeHiddenInput($this->model, $this->attribute, $options);
return $this;
} | [
"public",
"function",
"hidden",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'class'",
"]",
"=",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'class'",
"]",
")",
"?",
"$",
"this",
"->",
"options",
"[... | Generates hidden input inside hidden form-group.
@param array $options
@return $this | [
"Generates",
"hidden",
"input",
"inside",
"hidden",
"form",
"-",
"group",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/html/Field.php#L45-L51 |
31,240 | pulsarvp/vps-tools | src/html/Field.php | Field.render | public function render ($content = null)
{
// Custom error output.
$errors = $this->model->getErrors($this->attribute);
if (count($errors) == 0)
$this->parts[ '{error}' ] = '';
else
{
$class = isset($this->errorOptions[ 'class' ]) ? ' class="' . $this->errorOptions[ 'class' ] . '"' : '';
$... | php | public function render ($content = null)
{
// Custom error output.
$errors = $this->model->getErrors($this->attribute);
if (count($errors) == 0)
$this->parts[ '{error}' ] = '';
else
{
$class = isset($this->errorOptions[ 'class' ]) ? ' class="' . $this->errorOptions[ 'class' ] . '"' : '';
$... | [
"public",
"function",
"render",
"(",
"$",
"content",
"=",
"null",
")",
"{",
"// Custom error output.",
"$",
"errors",
"=",
"$",
"this",
"->",
"model",
"->",
"getErrors",
"(",
"$",
"this",
"->",
"attribute",
")",
";",
"if",
"(",
"count",
"(",
"$",
"erro... | This function overrides error output. All errors are displayed.
@inheritdoc | [
"This",
"function",
"overrides",
"error",
"output",
".",
"All",
"errors",
"are",
"displayed",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/html/Field.php#L111-L130 |
31,241 | pulsarvp/vps-tools | src/html/Field.php | Field.submit | public function submit ($text, $options = [])
{
$this->label(false);
$this->parts[ '{input}' ] = Html::submitButton($text, [ 'class' => 'btn btn-lg btn-primary', 'name' => 's-' . $this->attribute ]);
return $this;
} | php | public function submit ($text, $options = [])
{
$this->label(false);
$this->parts[ '{input}' ] = Html::submitButton($text, [ 'class' => 'btn btn-lg btn-primary', 'name' => 's-' . $this->attribute ]);
return $this;
} | [
"public",
"function",
"submit",
"(",
"$",
"text",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"label",
"(",
"false",
")",
";",
"$",
"this",
"->",
"parts",
"[",
"'{input}'",
"]",
"=",
"Html",
"::",
"submitButton",
"(",
"$",
"t... | Renders submit button.
@param string $text
@param array $options
@return $this | [
"Renders",
"submit",
"button",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/html/Field.php#L240-L246 |
31,242 | pulsarvp/vps-tools | src/html/Field.php | Field.renderLabelParts | protected function renderLabelParts ($label = null, $options = [])
{
parent::renderLabelParts($label, $options);
if (!empty($this->parts[ '{labelTitle}' ]))
$this->parts[ '{labelTitle}' ] = Yii::tr($this->parts[ '{labelTitle}' ]);
} | php | protected function renderLabelParts ($label = null, $options = [])
{
parent::renderLabelParts($label, $options);
if (!empty($this->parts[ '{labelTitle}' ]))
$this->parts[ '{labelTitle}' ] = Yii::tr($this->parts[ '{labelTitle}' ]);
} | [
"protected",
"function",
"renderLabelParts",
"(",
"$",
"label",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"parent",
"::",
"renderLabelParts",
"(",
"$",
"label",
",",
"$",
"options",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this"... | Added translation for label title.
@inheritdoc | [
"Added",
"translation",
"for",
"label",
"title",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/html/Field.php#L289-L294 |
31,243 | cedx/yii2-mustache | lib/helpers/Url.php | Url.getBase | function getBase(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return UrlHelper::base($helper->render($value) ?: false);
};
} | php | function getBase(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return UrlHelper::base($helper->render($value) ?: false);
};
} | [
"function",
"getBase",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"return",
"UrlHelper",
"::",
"base",
"(",
"$",
"helper",
"->",
"render",
"(",
"$",
"value",
... | Returns a function returning the base URL of the current request.
@return \Closure A function returning the base URL of the current request. | [
"Returns",
"a",
"function",
"returning",
"the",
"base",
"URL",
"of",
"the",
"current",
"request",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Url.php#L23-L27 |
31,244 | cedx/yii2-mustache | lib/helpers/Url.php | Url.getCurrent | function getCurrent(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'params', ['scheme' => false]);
return UrlHelper::current($args['params'], $args['scheme']);
};
} | php | function getCurrent(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'params', ['scheme' => false]);
return UrlHelper::current($args['params'], $args['scheme']);
};
} | [
"function",
"getCurrent",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"parseArguments",
"(",
"$",
"helper",
"->",
"render"... | Returns a function creating a URL by using the current route and the GET parameters.
@return \Closure A function creating a URL by using the current route and the GET parameters. | [
"Returns",
"a",
"function",
"creating",
"a",
"URL",
"by",
"using",
"the",
"current",
"route",
"and",
"the",
"GET",
"parameters",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Url.php#L41-L46 |
31,245 | cedx/yii2-mustache | lib/helpers/Url.php | Url.getHome | function getHome(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return UrlHelper::home($helper->render($value) ?: false);
};
} | php | function getHome(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return UrlHelper::home($helper->render($value) ?: false);
};
} | [
"function",
"getHome",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"return",
"UrlHelper",
"::",
"home",
"(",
"$",
"helper",
"->",
"render",
"(",
"$",
"value",
... | Returns a function returning the home URL.
@return \Closure A function returning the home URL. | [
"Returns",
"a",
"function",
"returning",
"the",
"home",
"URL",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Url.php#L52-L56 |
31,246 | cedx/yii2-mustache | lib/helpers/Url.php | Url.getPrevious | function getPrevious(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return UrlHelper::previous($helper->render($value) ?: null);
};
} | php | function getPrevious(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return UrlHelper::previous($helper->render($value) ?: null);
};
} | [
"function",
"getPrevious",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"return",
"UrlHelper",
"::",
"previous",
"(",
"$",
"helper",
"->",
"render",
"(",
"$",
"... | Returns a function returning the URL previously remembered.
@return \Closure A function returning the URL previously remembered. | [
"Returns",
"a",
"function",
"returning",
"the",
"URL",
"previously",
"remembered",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Url.php#L62-L66 |
31,247 | cedx/yii2-mustache | lib/helpers/Url.php | Url.getTo | function getTo(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'url', ['scheme' => false]);
return UrlHelper::to($args['url'], $args['scheme']);
};
} | php | function getTo(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'url', ['scheme' => false]);
return UrlHelper::to($args['url'], $args['scheme']);
};
} | [
"function",
"getTo",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"parseArguments",
"(",
"$",
"helper",
"->",
"render",
"... | Returns a function creating a URL based on the given parameters.
@return \Closure A function creating a URL based on the given parameters. | [
"Returns",
"a",
"function",
"creating",
"a",
"URL",
"based",
"on",
"the",
"given",
"parameters",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Url.php#L72-L77 |
31,248 | cedx/yii2-mustache | lib/helpers/Url.php | Url.getToRoute | function getToRoute(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'route', ['scheme' => false]);
return UrlHelper::toRoute($args['route'], $args['scheme']);
};
} | php | function getToRoute(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'route', ['scheme' => false]);
return UrlHelper::toRoute($args['route'], $args['scheme']);
};
} | [
"function",
"getToRoute",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"parseArguments",
"(",
"$",
"helper",
"->",
"render"... | Returns a function creating a URL for the given route.
@return \Closure A function creating a URL for the given route. | [
"Returns",
"a",
"function",
"creating",
"a",
"URL",
"for",
"the",
"given",
"route",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Url.php#L83-L88 |
31,249 | cedx/yii2-mustache | lib/helpers/Html.php | Html.getBeginBody | function getBeginBody(): string {
/** @var \yii\web\View|null $view */
$view = \Yii::$app->view;
if (!$view || !$view->hasMethod('beginBody')) return '';
return $this->captureOutput([$view, 'beginBody']);
} | php | function getBeginBody(): string {
/** @var \yii\web\View|null $view */
$view = \Yii::$app->view;
if (!$view || !$view->hasMethod('beginBody')) return '';
return $this->captureOutput([$view, 'beginBody']);
} | [
"function",
"getBeginBody",
"(",
")",
":",
"string",
"{",
"/** @var \\yii\\web\\View|null $view */",
"$",
"view",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"view",
";",
"if",
"(",
"!",
"$",
"view",
"||",
"!",
"$",
"view",
"->",
"hasMethod",
"(",
"'beginB... | Returns the tag marking the beginning of an HTML body section.
@return string The tag marking the beginning of an HTML body section. | [
"Returns",
"the",
"tag",
"marking",
"the",
"beginning",
"of",
"an",
"HTML",
"body",
"section",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Html.php#L24-L29 |
31,250 | cedx/yii2-mustache | lib/helpers/Html.php | Html.getEndBody | function getEndBody(): string {
/** @var \yii\web\View|null $view */
$view = \Yii::$app->view;
if (!$view || !$view->hasMethod('endBody')) return '';
return $this->captureOutput([$view, 'endBody']);
} | php | function getEndBody(): string {
/** @var \yii\web\View|null $view */
$view = \Yii::$app->view;
if (!$view || !$view->hasMethod('endBody')) return '';
return $this->captureOutput([$view, 'endBody']);
} | [
"function",
"getEndBody",
"(",
")",
":",
"string",
"{",
"/** @var \\yii\\web\\View|null $view */",
"$",
"view",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"view",
";",
"if",
"(",
"!",
"$",
"view",
"||",
"!",
"$",
"view",
"->",
"hasMethod",
"(",
"'endBody'... | Returns the tag marking the ending of an HTML body section.
@return string The tag marking the ending of an HTML body section. | [
"Returns",
"the",
"tag",
"marking",
"the",
"ending",
"of",
"an",
"HTML",
"body",
"section",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Html.php#L35-L40 |
31,251 | cedx/yii2-mustache | lib/helpers/Html.php | Html.getHead | function getHead(): string {
/** @var \yii\web\View|null $view */
$view = \Yii::$app->view;
if (!$view || !$view->hasMethod('head')) return '';
return $this->captureOutput([$view, 'head']);
} | php | function getHead(): string {
/** @var \yii\web\View|null $view */
$view = \Yii::$app->view;
if (!$view || !$view->hasMethod('head')) return '';
return $this->captureOutput([$view, 'head']);
} | [
"function",
"getHead",
"(",
")",
":",
"string",
"{",
"/** @var \\yii\\web\\View|null $view */",
"$",
"view",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"view",
";",
"if",
"(",
"!",
"$",
"view",
"||",
"!",
"$",
"view",
"->",
"hasMethod",
"(",
"'head'",
"... | Returns the tag marking the position of an HTML head section.
@return string The tag marking the position of an HTML head section. | [
"Returns",
"the",
"tag",
"marking",
"the",
"position",
"of",
"an",
"HTML",
"head",
"section",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Html.php#L46-L51 |
31,252 | cedx/yii2-mustache | lib/helpers/Html.php | Html.getMarkdown | function getMarkdown(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'markdown', ['flavor' => Markdown::$defaultFlavor]);
return Markdown::process($args['markdown'], $args['flavor']);
};
} | php | function getMarkdown(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'markdown', ['flavor' => Markdown::$defaultFlavor]);
return Markdown::process($args['markdown'], $args['flavor']);
};
} | [
"function",
"getMarkdown",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"parseArguments",
"(",
"$",
"helper",
"->",
"render... | Returns a function converting Markdown into HTML.
@return \Closure A function converting Markdown into HTML. | [
"Returns",
"a",
"function",
"converting",
"Markdown",
"into",
"HTML",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Html.php#L57-L62 |
31,253 | cedx/yii2-mustache | lib/helpers/Html.php | Html.getMarkdownParagraph | function getMarkdownParagraph(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'markdown', ['flavor' => Markdown::$defaultFlavor]);
return Markdown::processParagraph($args['markdown'], $args['flavor']);
};
} | php | function getMarkdownParagraph(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$args = $this->parseArguments($helper->render($value), 'markdown', ['flavor' => Markdown::$defaultFlavor]);
return Markdown::processParagraph($args['markdown'], $args['flavor']);
};
} | [
"function",
"getMarkdownParagraph",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"parseArguments",
"(",
"$",
"helper",
"->",
... | Returns a function converting Markdown into HTML but only parsing inline elements.
@return \Closure A function converting Markdown into HTML but only parsing inline elements. | [
"Returns",
"a",
"function",
"converting",
"Markdown",
"into",
"HTML",
"but",
"only",
"parsing",
"inline",
"elements",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Html.php#L68-L73 |
31,254 | cedx/yii2-mustache | lib/helpers/Html.php | Html.getSpaceless | function getSpaceless(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return $this->captureOutput(function() use ($helper, $value) {
Spaceless::begin();
echo $helper->render($value);
Spaceless::end();
});
};
} | php | function getSpaceless(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
return $this->captureOutput(function() use ($helper, $value) {
Spaceless::begin();
echo $helper->render($value);
Spaceless::end();
});
};
} | [
"function",
"getSpaceless",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"return",
"$",
"this",
"->",
"captureOutput",
"(",
"function",
"(",
")",
"use",
"(",
"$... | Returns a function removing whitespace characters between HTML tags.
@return \Closure A function removing whitespaces between HTML tags. | [
"Returns",
"a",
"function",
"removing",
"whitespace",
"characters",
"between",
"HTML",
"tags",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Html.php#L79-L87 |
31,255 | cedx/yii2-mustache | lib/helpers/Html.php | Html.getViewTitle | function getViewTitle(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$view = \Yii::$app->view;
if ($view && $view->canSetProperty('title')) $view->title = trim($helper->render($value));
};
} | php | function getViewTitle(): \Closure {
return function($value, \Mustache_LambdaHelper $helper) {
$view = \Yii::$app->view;
if ($view && $view->canSetProperty('title')) $view->title = trim($helper->render($value));
};
} | [
"function",
"getViewTitle",
"(",
")",
":",
"\\",
"Closure",
"{",
"return",
"function",
"(",
"$",
"value",
",",
"\\",
"Mustache_LambdaHelper",
"$",
"helper",
")",
"{",
"$",
"view",
"=",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"view",
";",
"if",
"(",
"$",... | Returns a function setting the view title.
@return \Closure A function setting the view title. | [
"Returns",
"a",
"function",
"setting",
"the",
"view",
"title",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/helpers/Html.php#L93-L98 |
31,256 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/Addons.php | Addons.get | public function get(string $id)
{
$app = App::get();
$data = $app->data->getValue('bearcms/addons/addon/' . md5($id) . '.json');
if ($data !== null) {
return $this->makeAddonFromRawData($data);
}
return null;
} | php | public function get(string $id)
{
$app = App::get();
$data = $app->data->getValue('bearcms/addons/addon/' . md5($id) . '.json');
if ($data !== null) {
return $this->makeAddonFromRawData($data);
}
return null;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"id",
")",
"{",
"$",
"app",
"=",
"App",
"::",
"get",
"(",
")",
";",
"$",
"data",
"=",
"$",
"app",
"->",
"data",
"->",
"getValue",
"(",
"'bearcms/addons/addon/'",
".",
"md5",
"(",
"$",
"id",
")",
".... | Retrieves information about the addon specified
@param string $id The addon ID
@return \IvoPetkov\DataObject|null The addon data or null if addon not found
@throws \InvalidArgumentException | [
"Retrieves",
"information",
"about",
"the",
"addon",
"specified"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/Addons.php#L34-L42 |
31,257 | bearcms/bearframework-addon | classes/BearCMS/Internal/Data2/Addons.php | Addons.getList | public function getList()
{
$app = App::get();
$list = $app->data->getList()
->filterBy('key', 'bearcms/addons/addon/', 'startWith');
$result = [];
foreach ($list as $item) {
$result[] = $this->makeAddonFromRawData($item->value);
}
return n... | php | public function getList()
{
$app = App::get();
$list = $app->data->getList()
->filterBy('key', 'bearcms/addons/addon/', 'startWith');
$result = [];
foreach ($list as $item) {
$result[] = $this->makeAddonFromRawData($item->value);
}
return n... | [
"public",
"function",
"getList",
"(",
")",
"{",
"$",
"app",
"=",
"App",
"::",
"get",
"(",
")",
";",
"$",
"list",
"=",
"$",
"app",
"->",
"data",
"->",
"getList",
"(",
")",
"->",
"filterBy",
"(",
"'key'",
",",
"'bearcms/addons/addon/'",
",",
"'startWit... | Retrieves a list of all addons
@return \IvoPetkov\DataList List containing all addons data | [
"Retrieves",
"a",
"list",
"of",
"all",
"addons"
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS/Internal/Data2/Addons.php#L49-L59 |
31,258 | wikimedia/slimapp | src/AbstractApp.php | AbstractApp.run | public function run() {
session_name( '_s' );
session_cache_limiter( false );
ini_set( 'session.cookie_httponly', true );
session_start();
register_shutdown_function( 'session_write_close' );
$this->slim->run();
} | php | public function run() {
session_name( '_s' );
session_cache_limiter( false );
ini_set( 'session.cookie_httponly', true );
session_start();
register_shutdown_function( 'session_write_close' );
$this->slim->run();
} | [
"public",
"function",
"run",
"(",
")",
"{",
"session_name",
"(",
"'_s'",
")",
";",
"session_cache_limiter",
"(",
"false",
")",
";",
"ini_set",
"(",
"'session.cookie_httponly'",
",",
"true",
")",
";",
"session_start",
"(",
")",
";",
"register_shutdown_function",
... | Main entry point for all requests. | [
"Main",
"entry",
"point",
"for",
"all",
"requests",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/AbstractApp.php#L165-L172 |
31,259 | wikimedia/slimapp | src/AbstractApp.php | AbstractApp.redirect | public static function redirect(
\Slim\Slim $slim, $name, $to, $routeName = null
) {
$routeName = $routeName ?: $name;
$slim->get( $name, function () use ( $slim, $name, $to ) {
$slim->flashKeep();
$slim->redirect( $slim->urlFor( $to ) );
} )->name( $routeName );
} | php | public static function redirect(
\Slim\Slim $slim, $name, $to, $routeName = null
) {
$routeName = $routeName ?: $name;
$slim->get( $name, function () use ( $slim, $name, $to ) {
$slim->flashKeep();
$slim->redirect( $slim->urlFor( $to ) );
} )->name( $routeName );
} | [
"public",
"static",
"function",
"redirect",
"(",
"\\",
"Slim",
"\\",
"Slim",
"$",
"slim",
",",
"$",
"name",
",",
"$",
"to",
",",
"$",
"routeName",
"=",
"null",
")",
"{",
"$",
"routeName",
"=",
"$",
"routeName",
"?",
":",
"$",
"name",
";",
"$",
"s... | Add a redirect route to the app.
@param \Slim\Slim $slim App
@param string $name Page name
@param string $to Redirect target route name
@param string $routeName Name for the route | [
"Add",
"a",
"redirect",
"route",
"to",
"the",
"app",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/AbstractApp.php#L181-L190 |
31,260 | wikimedia/slimapp | src/AbstractApp.php | AbstractApp.template | public static function template(
\Slim\Slim $slim, $name, $routeName = null
) {
$routeName = $routeName ?: $name;
$slim->get( $name, function () use ( $slim, $name ) {
$slim->render( "{$name}.html" );
} )->name( $routeName );
} | php | public static function template(
\Slim\Slim $slim, $name, $routeName = null
) {
$routeName = $routeName ?: $name;
$slim->get( $name, function () use ( $slim, $name ) {
$slim->render( "{$name}.html" );
} )->name( $routeName );
} | [
"public",
"static",
"function",
"template",
"(",
"\\",
"Slim",
"\\",
"Slim",
"$",
"slim",
",",
"$",
"name",
",",
"$",
"routeName",
"=",
"null",
")",
"{",
"$",
"routeName",
"=",
"$",
"routeName",
"?",
":",
"$",
"name",
";",
"$",
"slim",
"->",
"get",... | Add a static template route to the app.
@param \Slim\Slim $slim App
@param string $name Page name
@param string $routeName Name for the route | [
"Add",
"a",
"static",
"template",
"route",
"to",
"the",
"app",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/AbstractApp.php#L198-L206 |
31,261 | Jalle19/php-yui-compressor | lib/YUI/Compressor.php | Compressor.setType | public function setType($type)
{
if ($type === self::TYPE_CSS || $type === self::TYPE_JS)
$this->_options['type'] = $type;
else
throw new Exception('Invalid type: '.$type);
} | php | public function setType($type)
{
if ($type === self::TYPE_CSS || $type === self::TYPE_JS)
$this->_options['type'] = $type;
else
throw new Exception('Invalid type: '.$type);
} | [
"public",
"function",
"setType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"self",
"::",
"TYPE_CSS",
"||",
"$",
"type",
"===",
"self",
"::",
"TYPE_JS",
")",
"$",
"this",
"->",
"_options",
"[",
"'type'",
"]",
"=",
"$",
"type",
";",
... | Sets the compressor type. Valid values are TYPE_JS and TYPE_CSS. This
method can be used to change the compressor type after the class has
been instantiated.
@param string $type the type
@throws Exception if the type is invalid | [
"Sets",
"the",
"compressor",
"type",
".",
"Valid",
"values",
"are",
"TYPE_JS",
"and",
"TYPE_CSS",
".",
"This",
"method",
"can",
"be",
"used",
"to",
"change",
"the",
"compressor",
"type",
"after",
"the",
"class",
"has",
"been",
"instantiated",
"."
] | eb88c4f7fd8d7c8bd15a1970611d67cca11f71a0 | https://github.com/Jalle19/php-yui-compressor/blob/eb88c4f7fd8d7c8bd15a1970611d67cca11f71a0/lib/YUI/Compressor.php#L85-L91 |
31,262 | Jalle19/php-yui-compressor | lib/YUI/Compressor.php | Compressor.compress | public function compress($data)
{
// Construct the command
$cmd = $this->_options['javaPath'].' -jar '.escapeshellarg($this->_jarPath);
$cmd .= ' --charset '.$this->_options['charset'];
$cmd .= ' --type '.$this->_options['type'];
if ($this->_options['line-break'] !== false)
$cmd .= ' --line-break '.(int)... | php | public function compress($data)
{
// Construct the command
$cmd = $this->_options['javaPath'].' -jar '.escapeshellarg($this->_jarPath);
$cmd .= ' --charset '.$this->_options['charset'];
$cmd .= ' --type '.$this->_options['type'];
if ($this->_options['line-break'] !== false)
$cmd .= ' --line-break '.(int)... | [
"public",
"function",
"compress",
"(",
"$",
"data",
")",
"{",
"// Construct the command",
"$",
"cmd",
"=",
"$",
"this",
"->",
"_options",
"[",
"'javaPath'",
"]",
".",
"' -jar '",
".",
"escapeshellarg",
"(",
"$",
"this",
"->",
"_jarPath",
")",
";",
"$",
"... | Compresses the specified data and returns it
@param string $data the data
@return string the compressed data
@throws Exception if the compression fails | [
"Compresses",
"the",
"specified",
"data",
"and",
"returns",
"it"
] | eb88c4f7fd8d7c8bd15a1970611d67cca11f71a0 | https://github.com/Jalle19/php-yui-compressor/blob/eb88c4f7fd8d7c8bd15a1970611d67cca11f71a0/lib/YUI/Compressor.php#L99-L150 |
31,263 | shimabox/SMBArrayto | src/SMB/Arrayto/Traits/Ltsv/Creatable.php | Creatable.createOutputContents | protected function createOutputContents()
{
$formattedItems = $this->formatterInstance()->format($this->rows);
$ret = array();
foreach ($formattedItems as $label => $value) {
$ret[] = $label . ':' . $value;
}
return join("\t", $ret) . $this->EOL;
} | php | protected function createOutputContents()
{
$formattedItems = $this->formatterInstance()->format($this->rows);
$ret = array();
foreach ($formattedItems as $label => $value) {
$ret[] = $label . ':' . $value;
}
return join("\t", $ret) . $this->EOL;
} | [
"protected",
"function",
"createOutputContents",
"(",
")",
"{",
"$",
"formattedItems",
"=",
"$",
"this",
"->",
"formatterInstance",
"(",
")",
"->",
"format",
"(",
"$",
"this",
"->",
"rows",
")",
";",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"foreach",
... | Create an output content for Ltsv
@return string | [
"Create",
"an",
"output",
"content",
"for",
"Ltsv"
] | 7ecacc0c15994c02224bbd3efe055d3bce243971 | https://github.com/shimabox/SMBArrayto/blob/7ecacc0c15994c02224bbd3efe055d3bce243971/src/SMB/Arrayto/Traits/Ltsv/Creatable.php#L33-L43 |
31,264 | pulsarvp/vps-tools | src/helpers/Html.php | Html.buttonFa | public static function buttonFa ($text, $fa, $options = [])
{
$class = 'fa fa-' . $fa;
if (!empty(trim($text)))
$class .= ' margin';
$icon = self::tag('i', '', [ 'class' => $class ]);
if (!isset($options[ 'title' ]))
$options[ 'title' ] = $text;
if (isset($options[ 'raw' ]) and $options[ 'raw'... | php | public static function buttonFa ($text, $fa, $options = [])
{
$class = 'fa fa-' . $fa;
if (!empty(trim($text)))
$class .= ' margin';
$icon = self::tag('i', '', [ 'class' => $class ]);
if (!isset($options[ 'title' ]))
$options[ 'title' ] = $text;
if (isset($options[ 'raw' ]) and $options[ 'raw'... | [
"public",
"static",
"function",
"buttonFa",
"(",
"$",
"text",
",",
"$",
"fa",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"class",
"=",
"'fa fa-'",
".",
"$",
"fa",
";",
"if",
"(",
"!",
"empty",
"(",
"trim",
"(",
"$",
"text",
")",
")",
... | Creates button with FontAwesome icon.
```php
Html::buttonFa('Save', 'save', [ 'raw' => true ]);
// <button type="button"><i class="fa fa-save margin"></i>Save</button>
```
@param string $text Button text.
@param string $fa Icon name.
@param array $options Additional options.
@return string | [
"Creates",
"button",
"with",
"FontAwesome",
"icon",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/helpers/Html.php#L99-L120 |
31,265 | wikimedia/slimapp | src/Controller.php | Controller.flashGet | protected function flashGet( $key ) {
if ( isset( $this->slim->environment['slim.flash'] ) ) {
return $this->slim->environment['slim.flash'][$key];
} else {
return null;
}
} | php | protected function flashGet( $key ) {
if ( isset( $this->slim->environment['slim.flash'] ) ) {
return $this->slim->environment['slim.flash'][$key];
} else {
return null;
}
} | [
"protected",
"function",
"flashGet",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"slim",
"->",
"environment",
"[",
"'slim.flash'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"slim",
"->",
"environment",
"[",
"'slim.flas... | Get a flash message.
@param string $key Message key
@return mixed|null | [
"Get",
"a",
"flash",
"message",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Controller.php#L163-L169 |
31,266 | wikimedia/slimapp | src/Controller.php | Controller.pagination | protected function pagination( $total, $current, $pageSize, $around = 4 ) {
$pageCount = ceil( $total / $pageSize );
$first = max( 0, $current - $around );
$last = min( max( 0, $pageCount - 1 ), $current + 4 );
return [ $pageCount, $first, $last ];
} | php | protected function pagination( $total, $current, $pageSize, $around = 4 ) {
$pageCount = ceil( $total / $pageSize );
$first = max( 0, $current - $around );
$last = min( max( 0, $pageCount - 1 ), $current + 4 );
return [ $pageCount, $first, $last ];
} | [
"protected",
"function",
"pagination",
"(",
"$",
"total",
",",
"$",
"current",
",",
"$",
"pageSize",
",",
"$",
"around",
"=",
"4",
")",
"{",
"$",
"pageCount",
"=",
"ceil",
"(",
"$",
"total",
"/",
"$",
"pageSize",
")",
";",
"$",
"first",
"=",
"max",... | Compute pagination data.
@param int $total Total records
@param int $current Current page number (0-indexed)
@param int $pageSize Number of items per page
@param int $around Numer of pages to show on each side of current
@return array Page count, first page index, last page index | [
"Compute",
"pagination",
"data",
"."
] | 9fd0deba96f635c96d28d59d1f761283f62842d4 | https://github.com/wikimedia/slimapp/blob/9fd0deba96f635c96d28d59d1f761283f62842d4/src/Controller.php#L191-L196 |
31,267 | pulsarvp/vps-tools | src/controllers/DbController.php | DbController.actionRecreateViews | public function actionRecreateViews ()
{
$db = Yii::$app->db;
$views = $this->getViews();
foreach ($views as $view)
{
$info = $db->createCommand("SHOW CREATE VIEW `$view`")->queryAll();
$sql = $info[ 0 ][ 'Create View' ];
preg_match("/.*VIEW `$view` as (.*)/i", $sql, $match);
if (isset($m... | php | public function actionRecreateViews ()
{
$db = Yii::$app->db;
$views = $this->getViews();
foreach ($views as $view)
{
$info = $db->createCommand("SHOW CREATE VIEW `$view`")->queryAll();
$sql = $info[ 0 ][ 'Create View' ];
preg_match("/.*VIEW `$view` as (.*)/i", $sql, $match);
if (isset($m... | [
"public",
"function",
"actionRecreateViews",
"(",
")",
"{",
"$",
"db",
"=",
"Yii",
"::",
"$",
"app",
"->",
"db",
";",
"$",
"views",
"=",
"$",
"this",
"->",
"getViews",
"(",
")",
";",
"foreach",
"(",
"$",
"views",
"as",
"$",
"view",
")",
"{",
"$",... | List all views. This method is needed in order to match the database collection if it was changed. | [
"List",
"all",
"views",
".",
"This",
"method",
"is",
"needed",
"in",
"order",
"to",
"match",
"the",
"database",
"collection",
"if",
"it",
"was",
"changed",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/controllers/DbController.php#L17-L37 |
31,268 | cedx/yii2-mustache | lib/ViewRenderer.php | ViewRenderer.setHelpers | function setHelpers(array $value): self {
if ($this->engine) $this->engine->setHelpers($value);
else $this->helpers = $value;
return $this;
} | php | function setHelpers(array $value): self {
if ($this->engine) $this->engine->setHelpers($value);
else $this->helpers = $value;
return $this;
} | [
"function",
"setHelpers",
"(",
"array",
"$",
"value",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"engine",
")",
"$",
"this",
"->",
"engine",
"->",
"setHelpers",
"(",
"$",
"value",
")",
";",
"else",
"$",
"this",
"->",
"helpers",
"=",
"$",
... | Sets the values to prepend to the context stack, so they will be available in any view loaded by this instance.
@param array $value The list of the values to prepend to the context stack.
@return $this This instance. | [
"Sets",
"the",
"values",
"to",
"prepend",
"to",
"the",
"context",
"stack",
"so",
"they",
"will",
"be",
"available",
"in",
"any",
"view",
"loaded",
"by",
"this",
"instance",
"."
] | 20c961e65e74a0bacbe992dd7fdb28319f58a919 | https://github.com/cedx/yii2-mustache/blob/20c961e65e74a0bacbe992dd7fdb28319f58a919/lib/ViewRenderer.php#L107-L111 |
31,269 | pulsarvp/vps-tools | src/components/ImageManager.php | ImageManager.saveImage | public function saveImage ($path, $file, $resize = false)
{
$filename = UuidHelper::generate() . '.' . $file->extension;
$name = $filename[ 0 ] . DIRECTORY_SEPARATOR . $filename[ 1 ] . DIRECTORY_SEPARATOR . $filename;
$filepath = $path . DIRECTORY_SEPARATOR . $name;
if ($resize)
{
$data = [];
f... | php | public function saveImage ($path, $file, $resize = false)
{
$filename = UuidHelper::generate() . '.' . $file->extension;
$name = $filename[ 0 ] . DIRECTORY_SEPARATOR . $filename[ 1 ] . DIRECTORY_SEPARATOR . $filename;
$filepath = $path . DIRECTORY_SEPARATOR . $name;
if ($resize)
{
$data = [];
f... | [
"public",
"function",
"saveImage",
"(",
"$",
"path",
",",
"$",
"file",
",",
"$",
"resize",
"=",
"false",
")",
"{",
"$",
"filename",
"=",
"UuidHelper",
"::",
"generate",
"(",
")",
".",
"'.'",
".",
"$",
"file",
"->",
"extension",
";",
"$",
"name",
"=... | Save all formats image.
@param string $path The path to the file.
@param UploadedFile $file The path to the source file.
```php
return Yii::$app->image->saveImage('var/www/site/data/img/author', $image);
```
@return bool|string | [
"Save",
"all",
"formats",
"image",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/ImageManager.php#L44-L72 |
31,270 | pulsarvp/vps-tools | src/components/ImageManager.php | ImageManager._resize | private function _resize (ImageInterface $image, BoxInterface $newSize)
{
$size = $image->getSize();
$ratio = min($newSize->getHeight() / $size->getHeight(), $newSize->getWidth() / $size->getWidth());
if ($ratio < 1)
$image->resize($size->scale($ratio));
} | php | private function _resize (ImageInterface $image, BoxInterface $newSize)
{
$size = $image->getSize();
$ratio = min($newSize->getHeight() / $size->getHeight(), $newSize->getWidth() / $size->getWidth());
if ($ratio < 1)
$image->resize($size->scale($ratio));
} | [
"private",
"function",
"_resize",
"(",
"ImageInterface",
"$",
"image",
",",
"BoxInterface",
"$",
"newSize",
")",
"{",
"$",
"size",
"=",
"$",
"image",
"->",
"getSize",
"(",
")",
";",
"$",
"ratio",
"=",
"min",
"(",
"$",
"newSize",
"->",
"getHeight",
"(",... | Resize the image proportionally with max sizes constraints
@param ImageInterface $image
@param BoxInterface $newSize | [
"Resize",
"the",
"image",
"proportionally",
"with",
"max",
"sizes",
"constraints"
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/ImageManager.php#L92-L98 |
31,271 | pulsarvp/vps-tools | src/components/ImageManager.php | ImageManager._save | private function _save ($path, $file, $format)
{
$image = ( new Imagine() )->open($file);
$class = $this->config;
$params = $class::get($format);
$newSize = $this->_size($format);
if ($class::$fit == ImageSizeFit::WIDTH)
$this->resizeToWidth($image, $newSize->getWidth());
elseif ($class::$fit ==... | php | private function _save ($path, $file, $format)
{
$image = ( new Imagine() )->open($file);
$class = $this->config;
$params = $class::get($format);
$newSize = $this->_size($format);
if ($class::$fit == ImageSizeFit::WIDTH)
$this->resizeToWidth($image, $newSize->getWidth());
elseif ($class::$fit ==... | [
"private",
"function",
"_save",
"(",
"$",
"path",
",",
"$",
"file",
",",
"$",
"format",
")",
"{",
"$",
"image",
"=",
"(",
"new",
"Imagine",
"(",
")",
")",
"->",
"open",
"(",
"$",
"file",
")",
";",
"$",
"class",
"=",
"$",
"this",
"->",
"config",... | Saves image to the format using sizes from settings.
@param string $path
@param string $dest
@param string $type
@param string $format | [
"Saves",
"image",
"to",
"the",
"format",
"using",
"sizes",
"from",
"settings",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/ImageManager.php#L108-L122 |
31,272 | pulsarvp/vps-tools | src/components/ImageManager.php | ImageManager._saveHd | private function _saveHd ($path, $name, $file)
{
$this->_save($path . DIRECTORY_SEPARATOR . self::F_HD . DIRECTORY_SEPARATOR . $name, $file, self::F_HD);
} | php | private function _saveHd ($path, $name, $file)
{
$this->_save($path . DIRECTORY_SEPARATOR . self::F_HD . DIRECTORY_SEPARATOR . $name, $file, self::F_HD);
} | [
"private",
"function",
"_saveHd",
"(",
"$",
"path",
",",
"$",
"name",
",",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"_save",
"(",
"$",
"path",
".",
"DIRECTORY_SEPARATOR",
".",
"self",
"::",
"F_HD",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"name",
",",
... | Saves a image to the HD format.
@param string $path
@param string $dest
@param string $type | [
"Saves",
"a",
"image",
"to",
"the",
"HD",
"format",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/ImageManager.php#L163-L166 |
31,273 | pulsarvp/vps-tools | src/components/ImageManager.php | ImageManager._saveOriginal | private function _saveOriginal ($path, $name, $file)
{
$filepath = $path . DIRECTORY_SEPARATOR . $name;
if (Yii::$app->settings->get('image_original_save', true))
{
FileHelper::createDirectory(dirname($filepath));
copy($file, $filepath);
}
} | php | private function _saveOriginal ($path, $name, $file)
{
$filepath = $path . DIRECTORY_SEPARATOR . $name;
if (Yii::$app->settings->get('image_original_save', true))
{
FileHelper::createDirectory(dirname($filepath));
copy($file, $filepath);
}
} | [
"private",
"function",
"_saveOriginal",
"(",
"$",
"path",
",",
"$",
"name",
",",
"$",
"file",
")",
"{",
"$",
"filepath",
"=",
"$",
"path",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"name",
";",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"settings",
"->",
... | Saves a image to the original format.
@param string $path
@param string $dest
@param string $type | [
"Saves",
"a",
"image",
"to",
"the",
"original",
"format",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/ImageManager.php#L175-L183 |
31,274 | pulsarvp/vps-tools | src/components/ImageManager.php | ImageManager._saveSd | private function _saveSd ($path, $name, $file)
{
$this->_save($path . DIRECTORY_SEPARATOR . self::F_SD . DIRECTORY_SEPARATOR . $name, $file, self::F_SD);
} | php | private function _saveSd ($path, $name, $file)
{
$this->_save($path . DIRECTORY_SEPARATOR . self::F_SD . DIRECTORY_SEPARATOR . $name, $file, self::F_SD);
} | [
"private",
"function",
"_saveSd",
"(",
"$",
"path",
",",
"$",
"name",
",",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"_save",
"(",
"$",
"path",
".",
"DIRECTORY_SEPARATOR",
".",
"self",
"::",
"F_SD",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"name",
",",
... | Saves a image to the SD format.
@param string $path
@param string $dest
@param string $type | [
"Saves",
"a",
"image",
"to",
"the",
"SD",
"format",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/components/ImageManager.php#L192-L195 |
31,275 | pulsarvp/vps-tools | src/modules/user/models/User.php | User.getRoleName | public function getRoleName ()
{
$auth = Yii::$app->getAuthManager();
$roles = $auth->getRolesByUser($this->id);
$role = current($roles);
return $role ? $role->name : null;
} | php | public function getRoleName ()
{
$auth = Yii::$app->getAuthManager();
$roles = $auth->getRolesByUser($this->id);
$role = current($roles);
return $role ? $role->name : null;
} | [
"public",
"function",
"getRoleName",
"(",
")",
"{",
"$",
"auth",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getAuthManager",
"(",
")",
";",
"$",
"roles",
"=",
"$",
"auth",
"->",
"getRolesByUser",
"(",
"$",
"this",
"->",
"id",
")",
";",
"$",
"role",
"=",
... | Gets user role.
@return string|null | [
"Gets",
"user",
"role",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/user/models/User.php#L57-L64 |
31,276 | pulsarvp/vps-tools | src/modules/user/models/User.php | User.getRolesNames | public function getRolesNames ()
{
$auth = Yii::$app->getAuthManager();
$rolesByUser = $auth->getRolesByUser($this->id);
$roles = ArrayHelper::objectsAttribute($rolesByUser, 'name');
return $roles;
} | php | public function getRolesNames ()
{
$auth = Yii::$app->getAuthManager();
$rolesByUser = $auth->getRolesByUser($this->id);
$roles = ArrayHelper::objectsAttribute($rolesByUser, 'name');
return $roles;
} | [
"public",
"function",
"getRolesNames",
"(",
")",
"{",
"$",
"auth",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getAuthManager",
"(",
")",
";",
"$",
"rolesByUser",
"=",
"$",
"auth",
"->",
"getRolesByUser",
"(",
"$",
"this",
"->",
"id",
")",
";",
"$",
"roles"... | Gets user all roles.
@return array | [
"Gets",
"user",
"all",
"roles",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/user/models/User.php#L71-L78 |
31,277 | pulsarvp/vps-tools | src/modules/user/models/User.php | User.register | public function register ($name, $email, $profile, $active)
{
$this->active = $active;
$this->name = $name;
$this->email = $email;
$this->profile = $profile;
$this->loginDT = TimeHelper::now();
return $this->save();
} | php | public function register ($name, $email, $profile, $active)
{
$this->active = $active;
$this->name = $name;
$this->email = $email;
$this->profile = $profile;
$this->loginDT = TimeHelper::now();
return $this->save();
} | [
"public",
"function",
"register",
"(",
"$",
"name",
",",
"$",
"email",
",",
"$",
"profile",
",",
"$",
"active",
")",
"{",
"$",
"this",
"->",
"active",
"=",
"$",
"active",
";",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
... | Saves user with given parameters.
@param string $name
@param string $email
@param string $profile
@return bool Whether user save was successful. | [
"Saves",
"user",
"with",
"given",
"parameters",
"."
] | bb51fd5f68669edbd2801b52a9edeebaa756eec2 | https://github.com/pulsarvp/vps-tools/blob/bb51fd5f68669edbd2801b52a9edeebaa756eec2/src/modules/user/models/User.php#L154-L163 |
31,278 | bearcms/bearframework-addon | classes/BearCMS.php | BearCMS.disabledCheck | public function disabledCheck(): ?\BearFramework\App\Response
{
$currentUserExists = Config::hasServer() && (Config::hasFeature('USERS') || Config::hasFeature('USERS_LOGIN_*')) ? $this->currentUser->exists() : false;
$settings = $this->app->bearCMS->data->settings->get();
$isDisabled = !$cur... | php | public function disabledCheck(): ?\BearFramework\App\Response
{
$currentUserExists = Config::hasServer() && (Config::hasFeature('USERS') || Config::hasFeature('USERS_LOGIN_*')) ? $this->currentUser->exists() : false;
$settings = $this->app->bearCMS->data->settings->get();
$isDisabled = !$cur... | [
"public",
"function",
"disabledCheck",
"(",
")",
":",
"?",
"\\",
"BearFramework",
"\\",
"App",
"\\",
"Response",
"{",
"$",
"currentUserExists",
"=",
"Config",
"::",
"hasServer",
"(",
")",
"&&",
"(",
"Config",
"::",
"hasFeature",
"(",
"'USERS'",
")",
"||",
... | A middleware to be used in routes that returns a temporary unavailable response if an administrator has disabled the app.
@return \BearFramework\App\Response|null | [
"A",
"middleware",
"to",
"be",
"used",
"in",
"routes",
"that",
"returns",
"a",
"temporary",
"unavailable",
"response",
"if",
"an",
"administrator",
"has",
"disabled",
"the",
"app",
"."
] | 7ef131b81aac26070a2b937dd67f530a6caa02f0 | https://github.com/bearcms/bearframework-addon/blob/7ef131b81aac26070a2b937dd67f530a6caa02f0/classes/BearCMS.php#L1629-L1638 |
31,279 | czim/laravel-listify | src/Listify.php | Listify.setListifyConfig | public function setListifyConfig($key, $value)
{
switch ($key) {
case 'add_new_at':
if ( ! method_exists($this, "addToList{$value}")) {
throw new \UnexpectedValueException("No method exists for applying the add_new_at value '{$value}'.");
}
... | php | public function setListifyConfig($key, $value)
{
switch ($key) {
case 'add_new_at':
if ( ! method_exists($this, "addToList{$value}")) {
throw new \UnexpectedValueException("No method exists for applying the add_new_at value '{$value}'.");
}
... | [
"public",
"function",
"setListifyConfig",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"key",
")",
"{",
"case",
"'add_new_at'",
":",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"\"addToList{$value}\"",
")",
")",
"{",
"t... | Sets a listify config value.
@param string
@param mixed
@return $this | [
"Sets",
"a",
"listify",
"config",
"value",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L117-L146 |
31,280 | czim/laravel-listify | src/Listify.php | Listify.getListifyConfigValue | protected function getListifyConfigValue($key)
{
return array_key_exists($key, $this->listifyConfig) ? $this->listifyConfig[ $key ] : null;
} | php | protected function getListifyConfigValue($key)
{
return array_key_exists($key, $this->listifyConfig) ? $this->listifyConfig[ $key ] : null;
} | [
"protected",
"function",
"getListifyConfigValue",
"(",
"$",
"key",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"listifyConfig",
")",
"?",
"$",
"this",
"->",
"listifyConfig",
"[",
"$",
"key",
"]",
":",
"null",
";",
"}"... | Returns a config value by key, or null if it does not exist.
@param string $key
@return null|mixed | [
"Returns",
"a",
"config",
"value",
"by",
"key",
"or",
"null",
"if",
"it",
"does",
"not",
"exist",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L194-L197 |
31,281 | czim/laravel-listify | src/Listify.php | Listify.scopeListifyScope | public function scopeListifyScope(Builder $query)
{
if (method_exists($this, 'cleanListifyScopedQuery')) {
$this->cleanListifyScopedQuery($query);
}
return $query->whereRaw($this->listifyScopeCondition());
} | php | public function scopeListifyScope(Builder $query)
{
if (method_exists($this, 'cleanListifyScopedQuery')) {
$this->cleanListifyScopedQuery($query);
}
return $query->whereRaw($this->listifyScopeCondition());
} | [
"public",
"function",
"scopeListifyScope",
"(",
"Builder",
"$",
"query",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'cleanListifyScopedQuery'",
")",
")",
"{",
"$",
"this",
"->",
"cleanListifyScopedQuery",
"(",
"$",
"query",
")",
";",
"}",
... | Applies the listify scope to a query builder instance.
Eloquent scope method.
@param Builder|QueryBuilder $query
@return Builder|QueryBuilder | [
"Applies",
"the",
"listify",
"scope",
"to",
"a",
"query",
"builder",
"instance",
".",
"Eloquent",
"scope",
"method",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L211-L218 |
31,282 | czim/laravel-listify | src/Listify.php | Listify.scopeInList | public function scopeInList(Builder $query)
{
return $query->listifyScope()->whereNotNull($this->getTable() . "." . $this->positionColumn());
} | php | public function scopeInList(Builder $query)
{
return $query->listifyScope()->whereNotNull($this->getTable() . "." . $this->positionColumn());
} | [
"public",
"function",
"scopeInList",
"(",
"Builder",
"$",
"query",
")",
"{",
"return",
"$",
"query",
"->",
"listifyScope",
"(",
")",
"->",
"whereNotNull",
"(",
"$",
"this",
"->",
"getTable",
"(",
")",
".",
"\".\"",
".",
"$",
"this",
"->",
"positionColumn... | Applies conditions to a query in order to retrieve only the records that are in a list.
Eloquent scope method.
@param Builder|QueryBuilder|Listify $query
@return Builder|QueryBuilder|Listify | [
"Applies",
"conditions",
"to",
"a",
"query",
"in",
"order",
"to",
"retrieve",
"only",
"the",
"records",
"that",
"are",
"in",
"a",
"list",
".",
"Eloquent",
"scope",
"method",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L227-L230 |
31,283 | czim/laravel-listify | src/Listify.php | Listify.addToListBottom | protected function addToListBottom()
{
if ($this->isInList()) return;
$newPosition = $this->getBottomPositionValue();
if (null === $newPosition) {
$newPosition = $this->listifyTop();
} else {
$newPosition += 1;
}
$this->setListifyPosition($n... | php | protected function addToListBottom()
{
if ($this->isInList()) return;
$newPosition = $this->getBottomPositionValue();
if (null === $newPosition) {
$newPosition = $this->listifyTop();
} else {
$newPosition += 1;
}
$this->setListifyPosition($n... | [
"protected",
"function",
"addToListBottom",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isInList",
"(",
")",
")",
"return",
";",
"$",
"newPosition",
"=",
"$",
"this",
"->",
"getBottomPositionValue",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"newP... | Adds record to the bottom of the list.
Note that this does not save the model. | [
"Adds",
"record",
"to",
"the",
"bottom",
"of",
"the",
"list",
".",
"Note",
"that",
"this",
"does",
"not",
"save",
"the",
"model",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L299-L312 |
31,284 | czim/laravel-listify | src/Listify.php | Listify.insertAt | public function insertAt($position = null)
{
if (null === $position) {
$position = $this->listifyTop();
}
$this->insertAtPositionAndReorder($position);
return $this;
} | php | public function insertAt($position = null)
{
if (null === $position) {
$position = $this->listifyTop();
}
$this->insertAtPositionAndReorder($position);
return $this;
} | [
"public",
"function",
"insertAt",
"(",
"$",
"position",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"position",
")",
"{",
"$",
"position",
"=",
"$",
"this",
"->",
"listifyTop",
"(",
")",
";",
"}",
"$",
"this",
"->",
"insertAtPositionAndReorde... | Inserts record at the given position.
This re-arranges the affected surrounding records.
@param integer $position default is listifyTop()
@return $this | [
"Inserts",
"record",
"at",
"the",
"given",
"position",
".",
"This",
"re",
"-",
"arranges",
"the",
"affected",
"surrounding",
"records",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L321-L330 |
31,285 | czim/laravel-listify | src/Listify.php | Listify.moveToBottom | public function moveToBottom()
{
if ($this->isNotInList()) return $this;
$this->getConnection()->transaction(function() {
$this->decrementPositionsOfItemsBelow();
$bottomPosition = $this->getBottomPositionValue($this);
$newPosition = (null === $bottomPositio... | php | public function moveToBottom()
{
if ($this->isNotInList()) return $this;
$this->getConnection()->transaction(function() {
$this->decrementPositionsOfItemsBelow();
$bottomPosition = $this->getBottomPositionValue($this);
$newPosition = (null === $bottomPositio... | [
"public",
"function",
"moveToBottom",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNotInList",
"(",
")",
")",
"return",
"$",
"this",
";",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"transaction",
"(",
"function",
"(",
")",
"{",
"$",
"this... | Moves the record to the bottom of the list.
This re-arranges the affected surrounding records.
@return $this | [
"Moves",
"the",
"record",
"to",
"the",
"bottom",
"of",
"the",
"list",
".",
"This",
"re",
"-",
"arranges",
"the",
"affected",
"surrounding",
"records",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L386-L401 |
31,286 | czim/laravel-listify | src/Listify.php | Listify.moveToTop | public function moveToTop()
{
if ($this->isNotInList()) return $this;
$this->getConnection()->transaction(function() {
$this->incrementPositionsOfItemsAbove();
$this->setListPosition($this->listifyTop());
});
return $this;
} | php | public function moveToTop()
{
if ($this->isNotInList()) return $this;
$this->getConnection()->transaction(function() {
$this->incrementPositionsOfItemsAbove();
$this->setListPosition($this->listifyTop());
});
return $this;
} | [
"public",
"function",
"moveToTop",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNotInList",
"(",
")",
")",
"return",
"$",
"this",
";",
"$",
"this",
"->",
"getConnection",
"(",
")",
"->",
"transaction",
"(",
"function",
"(",
")",
"{",
"$",
"this",
... | Moves the record to the top of the list.
This re-arranges the affected surrounding records.
@return $this | [
"Moves",
"the",
"record",
"to",
"the",
"top",
"of",
"the",
"list",
".",
"This",
"re",
"-",
"arranges",
"the",
"affected",
"surrounding",
"records",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L409-L421 |
31,287 | czim/laravel-listify | src/Listify.php | Listify.removeFromList | public function removeFromList()
{
if ( ! $this->isInList()) return $this;
$this->decrementPositionsOfItemsBelow();
$this->setListPosition(null);
return $this;
} | php | public function removeFromList()
{
if ( ! $this->isInList()) return $this;
$this->decrementPositionsOfItemsBelow();
$this->setListPosition(null);
return $this;
} | [
"public",
"function",
"removeFromList",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isInList",
"(",
")",
")",
"return",
"$",
"this",
";",
"$",
"this",
"->",
"decrementPositionsOfItemsBelow",
"(",
")",
";",
"$",
"this",
"->",
"setListPosition",
"("... | Removes the record from the list.
This re-arranges the affected surrounding records.
@return $this | [
"Removes",
"the",
"record",
"from",
"the",
"list",
".",
"This",
"re",
"-",
"arranges",
"the",
"affected",
"surrounding",
"records",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L429-L437 |
31,288 | czim/laravel-listify | src/Listify.php | Listify.decrementPosition | public function decrementPosition($count = 1)
{
if ($this->isNotInList()) return $this;
$newPosition = $this->getListifyPosition() - $count;
if ($newPosition < $this->listifyTop()) {
$newPosition = $this->listifyTop();
}
$this->setListifyPosition($newPosition);... | php | public function decrementPosition($count = 1)
{
if ($this->isNotInList()) return $this;
$newPosition = $this->getListifyPosition() - $count;
if ($newPosition < $this->listifyTop()) {
$newPosition = $this->listifyTop();
}
$this->setListifyPosition($newPosition);... | [
"public",
"function",
"decrementPosition",
"(",
"$",
"count",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNotInList",
"(",
")",
")",
"return",
"$",
"this",
";",
"$",
"newPosition",
"=",
"$",
"this",
"->",
"getListifyPosition",
"(",
")",
"-",
... | Decrease the position of the record without affecting other record positions.
@param integer $count default 1
@return $this | [
"Decrease",
"the",
"position",
"of",
"the",
"record",
"without",
"affecting",
"other",
"record",
"positions",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L461-L474 |
31,289 | czim/laravel-listify | src/Listify.php | Listify.higherItems | public function higherItems($limit = null)
{
if ($this->isNotInList()) return null;
$query = $this->listifyScopedQuery()
->where($this->positionColumn(), '<', $this->getListifyPosition())
->orderBy($this->getTable() . '.' . $this->positionColumn(), 'DESC');
if (null... | php | public function higherItems($limit = null)
{
if ($this->isNotInList()) return null;
$query = $this->listifyScopedQuery()
->where($this->positionColumn(), '<', $this->getListifyPosition())
->orderBy($this->getTable() . '.' . $this->positionColumn(), 'DESC');
if (null... | [
"public",
"function",
"higherItems",
"(",
"$",
"limit",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNotInList",
"(",
")",
")",
"return",
"null",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"listifyScopedQuery",
"(",
")",
"->",
"where",
"("... | Returns a number of previous records on the list, above the current record.
@param null|integer $limit the maximum number of records to retrieve
@return \Illuminate\Database\Eloquent\Collection|static[] | [
"Returns",
"a",
"number",
"of",
"previous",
"records",
"on",
"the",
"list",
"above",
"the",
"current",
"record",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L523-L536 |
31,290 | czim/laravel-listify | src/Listify.php | Listify.lowerItem | public function lowerItem()
{
if ($this->isNotInList()) return null;
return $this->listifyScopedQuery()
->where($this->positionColumn(), '>', $this->getListifyPosition())
->orderBy($this->getTable() . '.' . $this->positionColumn())
->first();
} | php | public function lowerItem()
{
if ($this->isNotInList()) return null;
return $this->listifyScopedQuery()
->where($this->positionColumn(), '>', $this->getListifyPosition())
->orderBy($this->getTable() . '.' . $this->positionColumn())
->first();
} | [
"public",
"function",
"lowerItem",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNotInList",
"(",
")",
")",
"return",
"null",
";",
"return",
"$",
"this",
"->",
"listifyScopedQuery",
"(",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"positionColumn",
"... | Returns the next record on the list, the one below the current record.
@return null|static | [
"Returns",
"the",
"next",
"record",
"on",
"the",
"list",
"the",
"one",
"below",
"the",
"current",
"record",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L544-L552 |
31,291 | czim/laravel-listify | src/Listify.php | Listify.hasListifyScopeChanged | protected function hasListifyScopeChanged()
{
$scope = $this->normalizeListifyScope($this->getScopeName(), true);
if ($scope instanceof BelongsTo) {
// for BelongsTo scopes, use a cleaner way to check for differences
$foreignKey = $scope->getForeignKeyName();
ret... | php | protected function hasListifyScopeChanged()
{
$scope = $this->normalizeListifyScope($this->getScopeName(), true);
if ($scope instanceof BelongsTo) {
// for BelongsTo scopes, use a cleaner way to check for differences
$foreignKey = $scope->getForeignKeyName();
ret... | [
"protected",
"function",
"hasListifyScopeChanged",
"(",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"normalizeListifyScope",
"(",
"$",
"this",
"->",
"getScopeName",
"(",
")",
",",
"true",
")",
";",
"if",
"(",
"$",
"scope",
"instanceof",
"BelongsTo",
")... | Returns whether the scope has changed since it was last applied.
Note that this also updates the last known scope, resetting the changed state back to false
@return boolean | [
"Returns",
"whether",
"the",
"scope",
"has",
"changed",
"since",
"it",
"was",
"last",
"applied",
".",
"Note",
"that",
"this",
"also",
"updates",
"the",
"last",
"known",
"scope",
"resetting",
"the",
"changed",
"state",
"back",
"to",
"false"
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L648-L677 |
31,292 | czim/laravel-listify | src/Listify.php | Listify.normalizeListifyScope | protected function normalizeListifyScope($scope, $doNotResolveBelongsTo = false)
{
if ($scope instanceof BelongsTo) {
if ($doNotResolveBelongsTo) return $scope;
return $this->getConditionStringFromBelongsTo($scope);
}
if ($scope instanceof QueryBuilder) {
... | php | protected function normalizeListifyScope($scope, $doNotResolveBelongsTo = false)
{
if ($scope instanceof BelongsTo) {
if ($doNotResolveBelongsTo) return $scope;
return $this->getConditionStringFromBelongsTo($scope);
}
if ($scope instanceof QueryBuilder) {
... | [
"protected",
"function",
"normalizeListifyScope",
"(",
"$",
"scope",
",",
"$",
"doNotResolveBelongsTo",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"scope",
"instanceof",
"BelongsTo",
")",
"{",
"if",
"(",
"$",
"doNotResolveBelongsTo",
")",
"return",
"$",
"scope",
... | Normalizes the currently applicable list scope to a string
or BelongsTo relation instance.
@param mixed $scope
@param boolean $doNotResolveBelongsTo if true, does not stringify a BelongsTo instance
@return string|BelongsTo | [
"Normalizes",
"the",
"currently",
"applicable",
"list",
"scope",
"to",
"a",
"string",
"or",
"BelongsTo",
"relation",
"instance",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L712-L730 |
31,293 | czim/laravel-listify | src/Listify.php | Listify.listifyScopeCondition | protected function listifyScopeCondition()
{
$this->stringScopeValue = $this->normalizeListifyScope($this->getScopeName());
$this->stringScopeNullExplicitlySet = (null === $this->stringScopeValue);
return $this->stringScopeValue;
} | php | protected function listifyScopeCondition()
{
$this->stringScopeValue = $this->normalizeListifyScope($this->getScopeName());
$this->stringScopeNullExplicitlySet = (null === $this->stringScopeValue);
return $this->stringScopeValue;
} | [
"protected",
"function",
"listifyScopeCondition",
"(",
")",
"{",
"$",
"this",
"->",
"stringScopeValue",
"=",
"$",
"this",
"->",
"normalizeListifyScope",
"(",
"$",
"this",
"->",
"getScopeName",
"(",
")",
")",
";",
"$",
"this",
"->",
"stringScopeNullExplicitlySet"... | Returns string version of current listify scope.
@return string | [
"Returns",
"string",
"version",
"of",
"current",
"listify",
"scope",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L737-L744 |
31,294 | czim/laravel-listify | src/Listify.php | Listify.listifyScopedQuery | protected function listifyScopedQuery()
{
$model = new static;
$model->setListifyConfig('scope', $this->listifyScopeCondition());
// if set, call a method that may be used to remove global scopes
// and other automatically active listify-scope breaking clauses
if (method_ex... | php | protected function listifyScopedQuery()
{
$model = new static;
$model->setListifyConfig('scope', $this->listifyScopeCondition());
// if set, call a method that may be used to remove global scopes
// and other automatically active listify-scope breaking clauses
if (method_ex... | [
"protected",
"function",
"listifyScopedQuery",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"static",
";",
"$",
"model",
"->",
"setListifyConfig",
"(",
"'scope'",
",",
"$",
"this",
"->",
"listifyScopeCondition",
"(",
")",
")",
";",
"// if set, call a method that may... | Returns a fresh query builder after re-applying the listify scope condition.
@return Builder | [
"Returns",
"a",
"fresh",
"query",
"builder",
"after",
"re",
"-",
"applying",
"the",
"listify",
"scope",
"condition",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L752-L765 |
31,295 | czim/laravel-listify | src/Listify.php | Listify.handleListifyScopeChange | protected function handleListifyScopeChange()
{
if ( ! $this->hasListifyScopeChanged()) return;
$this->rememberCurrentlyUsedScope();
// swap the attributes so the record is scoped in its old scope
$this->swapChangedAttributes();
if ( ! $this->excludeFromList() && $this->lo... | php | protected function handleListifyScopeChange()
{
if ( ! $this->hasListifyScopeChanged()) return;
$this->rememberCurrentlyUsedScope();
// swap the attributes so the record is scoped in its old scope
$this->swapChangedAttributes();
if ( ! $this->excludeFromList() && $this->lo... | [
"protected",
"function",
"handleListifyScopeChange",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasListifyScopeChanged",
"(",
")",
")",
"return",
";",
"$",
"this",
"->",
"rememberCurrentlyUsedScope",
"(",
")",
";",
"// swap the attributes so the record is sc... | Checks and handles when the model's list scope has changed.
Makes sure that the old list positions are adjusted and the model
is correctly placed in the new list. | [
"Checks",
"and",
"handles",
"when",
"the",
"model",
"s",
"list",
"scope",
"has",
"changed",
".",
"Makes",
"sure",
"that",
"the",
"old",
"list",
"positions",
"are",
"adjusted",
"and",
"the",
"model",
"is",
"correctly",
"placed",
"in",
"the",
"new",
"list",
... | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L772-L792 |
31,296 | czim/laravel-listify | src/Listify.php | Listify.reorderPositionsOnItemsBetween | protected function reorderPositionsOnItemsBetween($positionBefore, $positionAfter, $ignoreId = null)
{
if ($positionBefore == $positionAfter) {
return;
}
$query = $this->listifyScopedQuery();
if ($ignoreId) {
$query->where($this->getPrimaryKey(), '!=', $igno... | php | protected function reorderPositionsOnItemsBetween($positionBefore, $positionAfter, $ignoreId = null)
{
if ($positionBefore == $positionAfter) {
return;
}
$query = $this->listifyScopedQuery();
if ($ignoreId) {
$query->where($this->getPrimaryKey(), '!=', $igno... | [
"protected",
"function",
"reorderPositionsOnItemsBetween",
"(",
"$",
"positionBefore",
",",
"$",
"positionAfter",
",",
"$",
"ignoreId",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"positionBefore",
"==",
"$",
"positionAfter",
")",
"{",
"return",
";",
"}",
"$",
"q... | Reorders the positions of all items between two affected positions.
@param integer $positionBefore
@param integer $positionAfter
@param null|integer $ignoreId | [
"Reorders",
"the",
"positions",
"of",
"all",
"items",
"between",
"two",
"affected",
"positions",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L828-L856 |
31,297 | czim/laravel-listify | src/Listify.php | Listify.decrementPositionsOfItemsBelow | protected function decrementPositionsOfItemsBelow($position = null)
{
if ($this->isNotInList()) return;
if (null === $position) {
$position = $this->getListifyPosition();
}
$this->listifyScopedQuery()
->where($this->positionColumn(), '>', $position)
... | php | protected function decrementPositionsOfItemsBelow($position = null)
{
if ($this->isNotInList()) return;
if (null === $position) {
$position = $this->getListifyPosition();
}
$this->listifyScopedQuery()
->where($this->positionColumn(), '>', $position)
... | [
"protected",
"function",
"decrementPositionsOfItemsBelow",
"(",
"$",
"position",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNotInList",
"(",
")",
")",
"return",
";",
"if",
"(",
"null",
"===",
"$",
"position",
")",
"{",
"$",
"position",
"=",
... | Increments the position values of records with a higher position value than the given.
Note that 'below' means a higher position value.
@param null|integer $position if null, uses this record's current position | [
"Increments",
"the",
"position",
"values",
"of",
"records",
"with",
"a",
"higher",
"position",
"value",
"than",
"the",
"given",
".",
"Note",
"that",
"below",
"means",
"a",
"higher",
"position",
"value",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L864-L875 |
31,298 | czim/laravel-listify | src/Listify.php | Listify.incrementPositionsOfItemsAbove | protected function incrementPositionsOfItemsAbove($position = null)
{
if ($this->isNotInList()) return;
if (null === $position) {
$position = $this->getListifyPosition();
}
$this->listifyScopedQuery()
->where($this->positionColumn(), '<', $position)
... | php | protected function incrementPositionsOfItemsAbove($position = null)
{
if ($this->isNotInList()) return;
if (null === $position) {
$position = $this->getListifyPosition();
}
$this->listifyScopedQuery()
->where($this->positionColumn(), '<', $position)
... | [
"protected",
"function",
"incrementPositionsOfItemsAbove",
"(",
"$",
"position",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNotInList",
"(",
")",
")",
"return",
";",
"if",
"(",
"null",
"===",
"$",
"position",
")",
"{",
"$",
"position",
"=",
... | Increments the position values of records with a lower position value than the given.
Note that 'above' means a lower position value.
@param null|integer $position if null, uses this record's current position | [
"Increments",
"the",
"position",
"values",
"of",
"records",
"with",
"a",
"lower",
"position",
"value",
"than",
"the",
"given",
".",
"Note",
"that",
"above",
"means",
"a",
"lower",
"position",
"value",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L883-L894 |
31,299 | czim/laravel-listify | src/Listify.php | Listify.incrementPositionsOfItemsBelow | protected function incrementPositionsOfItemsBelow($position)
{
$this->listifyScopedQuery()
->where($this->positionColumn(), '>=', $position)
->increment($this->positionColumn());
} | php | protected function incrementPositionsOfItemsBelow($position)
{
$this->listifyScopedQuery()
->where($this->positionColumn(), '>=', $position)
->increment($this->positionColumn());
} | [
"protected",
"function",
"incrementPositionsOfItemsBelow",
"(",
"$",
"position",
")",
"{",
"$",
"this",
"->",
"listifyScopedQuery",
"(",
")",
"->",
"where",
"(",
"$",
"this",
"->",
"positionColumn",
"(",
")",
",",
"'>='",
",",
"$",
"position",
")",
"->",
"... | Increments the position values of records with a lower position value than the given.
Note that 'below' means a smaller position value.
@param integer $position if null, uses this record's current position | [
"Increments",
"the",
"position",
"values",
"of",
"records",
"with",
"a",
"lower",
"position",
"value",
"than",
"the",
"given",
".",
"Note",
"that",
"below",
"means",
"a",
"smaller",
"position",
"value",
"."
] | c7c12faacf43de1c024a7b39cb44183d2711a838 | https://github.com/czim/laravel-listify/blob/c7c12faacf43de1c024a7b39cb44183d2711a838/src/Listify.php#L902-L907 |
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.