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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
229,800 | pingpong-labs/widget | Widget.php | Widget.callGroup | public function callGroup($name, $parameters = array())
{
if (!$this->hasGroup($name)) {
return;
}
$result = '';
foreach ($this->groups[$name] as $key => $widget) {
$result .= $this->get($widget, array_get($parameters, $key, array()));
}
ret... | php | public function callGroup($name, $parameters = array())
{
if (!$this->hasGroup($name)) {
return;
}
$result = '';
foreach ($this->groups[$name] as $key => $widget) {
$result .= $this->get($widget, array_get($parameters, $key, array()));
}
ret... | [
"public",
"function",
"callGroup",
"(",
"$",
"name",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasGroup",
"(",
"$",
"name",
")",
")",
"{",
"return",
";",
"}",
"$",
"result",
"=",
"''",
";",
"f... | Call a specific group of widgets.
@param string $name
@param array $parameters
@return string | [
"Call",
"a",
"specific",
"group",
"of",
"widgets",
"."
] | 4d3d4667da4b7037a0d00c42d1017e1edc0b8315 | https://github.com/pingpong-labs/widget/blob/4d3d4667da4b7037a0d00c42d1017e1edc0b8315/Widget.php#L262-L275 |
229,801 | pingpong-labs/widget | Widget.php | Widget.reorderWidgets | protected function reorderWidgets($widgets)
{
$formatted = [];
foreach ($widgets as $key => $widget) {
if (is_array($widget)) {
$formatted[] = [
'name' => array_get($widget, 0),
'order' => array_get($widget, 1),
];
... | php | protected function reorderWidgets($widgets)
{
$formatted = [];
foreach ($widgets as $key => $widget) {
if (is_array($widget)) {
$formatted[] = [
'name' => array_get($widget, 0),
'order' => array_get($widget, 1),
];
... | [
"protected",
"function",
"reorderWidgets",
"(",
"$",
"widgets",
")",
"{",
"$",
"formatted",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"widgets",
"as",
"$",
"key",
"=>",
"$",
"widget",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"widget",
")",
")",
"{... | Reorder widgets.
@param array $widgets
@return array | [
"Reorder",
"widgets",
"."
] | 4d3d4667da4b7037a0d00c42d1017e1edc0b8315 | https://github.com/pingpong-labs/widget/blob/4d3d4667da4b7037a0d00c42d1017e1edc0b8315/Widget.php#L314-L335 |
229,802 | ZenMagick/ZenCart | includes/modules/order_total/ot_gv.php | ot_gv.pre_confirmation_check | function pre_confirmation_check($order_total) {
global $order, $currencies, $messageStack;
// clean out negative values and strip common currency symbols
$_SESSION['cot_gv'] = preg_replace('/[^0-9.%]/', '', $_SESSION['cot_gv']);
$_SESSION['cot_gv'] = abs($_SESSION['cot_gv']);
if ($_SESSION['cot_gv'... | php | function pre_confirmation_check($order_total) {
global $order, $currencies, $messageStack;
// clean out negative values and strip common currency symbols
$_SESSION['cot_gv'] = preg_replace('/[^0-9.%]/', '', $_SESSION['cot_gv']);
$_SESSION['cot_gv'] = abs($_SESSION['cot_gv']);
if ($_SESSION['cot_gv'... | [
"function",
"pre_confirmation_check",
"(",
"$",
"order_total",
")",
"{",
"global",
"$",
"order",
",",
"$",
"currencies",
",",
"$",
"messageStack",
";",
"// clean out negative values and strip common currency symbols",
"$",
"_SESSION",
"[",
"'cot_gv'",
"]",
"=",
"preg_... | Check for validity of redemption amounts and recalculate order totals to include proposed GV redemption deductions | [
"Check",
"for",
"validity",
"of",
"redemption",
"amounts",
"and",
"recalculate",
"order",
"totals",
"to",
"include",
"proposed",
"GV",
"redemption",
"deductions"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/order_total/ot_gv.php#L105-L130 |
229,803 | ZenMagick/ZenCart | includes/modules/order_total/ot_gv.php | ot_gv.update_credit_account | function update_credit_account($i) {
global $db, $order, $insert_id;
// only act on newly-purchased gift certificates
if (preg_match('/^GIFT/', addslashes($order->products[$i]['model']))) {
// determine how much GV was purchased
$gv_order_amount = ($order->products[$i]['final_price'] * $order->p... | php | function update_credit_account($i) {
global $db, $order, $insert_id;
// only act on newly-purchased gift certificates
if (preg_match('/^GIFT/', addslashes($order->products[$i]['model']))) {
// determine how much GV was purchased
$gv_order_amount = ($order->products[$i]['final_price'] * $order->p... | [
"function",
"update_credit_account",
"(",
"$",
"i",
")",
"{",
"global",
"$",
"db",
",",
"$",
"order",
",",
"$",
"insert_id",
";",
"// only act on newly-purchased gift certificates",
"if",
"(",
"preg_match",
"(",
"'/^GIFT/'",
",",
"addslashes",
"(",
"$",
"order",... | queue or release newly-purchased GV's | [
"queue",
"or",
"release",
"newly",
"-",
"purchased",
"GV",
"s"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/order_total/ot_gv.php#L143-L173 |
229,804 | ZenMagick/ZenCart | includes/modules/order_total/ot_gv.php | ot_gv.credit_selection | function credit_selection() {
global $db, $currencies;
$gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
// checks to see if any GVs are in the system and active or if the current customer has any GV balance
if ($gv_query->RecordCount(... | php | function credit_selection() {
global $db, $currencies;
$gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
// checks to see if any GVs are in the system and active or if the current customer has any GV balance
if ($gv_query->RecordCount(... | [
"function",
"credit_selection",
"(",
")",
"{",
"global",
"$",
"db",
",",
"$",
"currencies",
";",
"$",
"gv_query",
"=",
"$",
"db",
"->",
"Execute",
"(",
"\"select coupon_id from \"",
".",
"TABLE_COUPONS",
".",
"\" where coupon_type = 'G' and coupon_active='Y'\"",
")"... | check system to see if GVs should be made available or not. If true, then supply GV-selection fields on checkout pages | [
"check",
"system",
"to",
"see",
"if",
"GVs",
"should",
"be",
"made",
"available",
"or",
"not",
".",
"If",
"true",
"then",
"supply",
"GV",
"-",
"selection",
"fields",
"on",
"checkout",
"pages"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/order_total/ot_gv.php#L177-L193 |
229,805 | ZenMagick/ZenCart | includes/modules/order_total/ot_gv.php | ot_gv.apply_credit | function apply_credit() {
global $db, $order, $messageStack;
// check for valid redemption amount vs available credit for current customer
if ($_SESSION['cot_gv'] != 0) {
$gv_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$_SESSION['customer_id... | php | function apply_credit() {
global $db, $order, $messageStack;
// check for valid redemption amount vs available credit for current customer
if ($_SESSION['cot_gv'] != 0) {
$gv_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$_SESSION['customer_id... | [
"function",
"apply_credit",
"(",
")",
"{",
"global",
"$",
"db",
",",
"$",
"order",
",",
"$",
"messageStack",
";",
"// check for valid redemption amount vs available credit for current customer",
"if",
"(",
"$",
"_SESSION",
"[",
"'cot_gv'",
"]",
"!=",
"0",
")",
"{"... | Verify that the customer has entered a valid redemption amount, and return the amount that can be applied to this order | [
"Verify",
"that",
"the",
"customer",
"has",
"entered",
"a",
"valid",
"redemption",
"amount",
"and",
"return",
"the",
"amount",
"that",
"can",
"be",
"applied",
"to",
"this",
"order"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/order_total/ot_gv.php#L197-L213 |
229,806 | ZenMagick/ZenCart | includes/modules/order_total/ot_gv.php | ot_gv.user_has_gv_account | function user_has_gv_account($c_id) {
global $db;
$gv_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$c_id . "'");
if ($gv_result->RecordCount() > 0) {
return $gv_result->fields['amount'];
}
return 0; // use 0 because 'false' was preven... | php | function user_has_gv_account($c_id) {
global $db;
$gv_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$c_id . "'");
if ($gv_result->RecordCount() > 0) {
return $gv_result->fields['amount'];
}
return 0; // use 0 because 'false' was preven... | [
"function",
"user_has_gv_account",
"(",
"$",
"c_id",
")",
"{",
"global",
"$",
"db",
";",
"$",
"gv_result",
"=",
"$",
"db",
"->",
"Execute",
"(",
"\"select amount from \"",
".",
"TABLE_COUPON_GV_CUSTOMER",
".",
"\" where customer_id = '\"",
".",
"(",
"int",
")",
... | Check to see whether current customer has a GV balance available
Returns amount of GV balance on account | [
"Check",
"to",
"see",
"whether",
"current",
"customer",
"has",
"a",
"GV",
"balance",
"available",
"Returns",
"amount",
"of",
"GV",
"balance",
"on",
"account"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/order_total/ot_gv.php#L340-L347 |
229,807 | ZenMagick/ZenCart | includes/modules/order_total/ot_gv.php | ot_gv.get_order_total | function get_order_total() {
global $order;
$order_total = $order->info['total'];
// if we are not supposed to include tax in credit calculations, subtract it out
if ($this->include_tax != 'true') $order_total -= $order->info['tax'];
// if we are not supposed to include shipping amount in credit cal... | php | function get_order_total() {
global $order;
$order_total = $order->info['total'];
// if we are not supposed to include tax in credit calculations, subtract it out
if ($this->include_tax != 'true') $order_total -= $order->info['tax'];
// if we are not supposed to include shipping amount in credit cal... | [
"function",
"get_order_total",
"(",
")",
"{",
"global",
"$",
"order",
";",
"$",
"order_total",
"=",
"$",
"order",
"->",
"info",
"[",
"'total'",
"]",
";",
"// if we are not supposed to include tax in credit calculations, subtract it out",
"if",
"(",
"$",
"this",
"->"... | Recalculates base order-total amount for use in deduction calculations | [
"Recalculates",
"base",
"order",
"-",
"total",
"amount",
"for",
"use",
"in",
"deduction",
"calculations"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/modules/order_total/ot_gv.php#L351-L360 |
229,808 | Webiny/Framework | src/Webiny/Component/Rest/Compiler/Compiler.php | Compiler.writeCacheFiles | public function writeCacheFiles(ParsedApi $parsedApi)
{
$writtenCacheFiles = [];
// first delete the cache
foreach ($parsedApi->versions as $v => $parsedClass) {
$this->cache->deleteCache($this->api, $parsedApi->apiClass);
}
// then build the cache
forea... | php | public function writeCacheFiles(ParsedApi $parsedApi)
{
$writtenCacheFiles = [];
// first delete the cache
foreach ($parsedApi->versions as $v => $parsedClass) {
$this->cache->deleteCache($this->api, $parsedApi->apiClass);
}
// then build the cache
forea... | [
"public",
"function",
"writeCacheFiles",
"(",
"ParsedApi",
"$",
"parsedApi",
")",
"{",
"$",
"writtenCacheFiles",
"=",
"[",
"]",
";",
"// first delete the cache",
"foreach",
"(",
"$",
"parsedApi",
"->",
"versions",
"as",
"$",
"v",
"=>",
"$",
"parsedClass",
")",... | Based on the given ParsedApi instance, the method will create several cache file and update the
cache index.
@param ParsedApi $parsedApi | [
"Based",
"on",
"the",
"given",
"ParsedApi",
"instance",
"the",
"method",
"will",
"create",
"several",
"cache",
"file",
"and",
"update",
"the",
"cache",
"index",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Compiler/Compiler.php#L57-L80 |
229,809 | Webiny/Framework | src/Webiny/Component/Rest/Compiler/Compiler.php | Compiler.compileCacheFile | private function compileCacheFile(ParsedClass $parsedClass, $version)
{
$compileArray = [];
$compileArray['class'] = $parsedClass->class;
$compileArray['cacheKeyInterface'] = $parsedClass->cacheKeyInterface;
$compileArray['accessInterface'] = $parsedClass->accessInterface;
$c... | php | private function compileCacheFile(ParsedClass $parsedClass, $version)
{
$compileArray = [];
$compileArray['class'] = $parsedClass->class;
$compileArray['cacheKeyInterface'] = $parsedClass->cacheKeyInterface;
$compileArray['accessInterface'] = $parsedClass->accessInterface;
$c... | [
"private",
"function",
"compileCacheFile",
"(",
"ParsedClass",
"$",
"parsedClass",
",",
"$",
"version",
")",
"{",
"$",
"compileArray",
"=",
"[",
"]",
";",
"$",
"compileArray",
"[",
"'class'",
"]",
"=",
"$",
"parsedClass",
"->",
"class",
";",
"$",
"compileA... | This method does the actual processing of ParsedClass instance into a compiled array that is later
written into a cache file.
@param ParsedClass $parsedClass ParsedClass instance that will be compiled into an array.
@param string $version Version of the API.
@return array The compiled array. | [
"This",
"method",
"does",
"the",
"actual",
"processing",
"of",
"ParsedClass",
"instance",
"into",
"a",
"compiled",
"array",
"that",
"is",
"later",
"written",
"into",
"a",
"cache",
"file",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Compiler/Compiler.php#L91-L124 |
229,810 | Webiny/Framework | src/Webiny/Component/TemplateEngine/Bridge/TemplateEngine.php | TemplateEngine.getLibrary | private static function getLibrary($engineName)
{
$bridges = \Webiny\Component\TemplateEngine\TemplateEngine::getConfig()->get('Bridges', false);
if (!$bridges) {
if (!isset(self::$library[$engineName])) {
return false;
}
return self::$library[$en... | php | private static function getLibrary($engineName)
{
$bridges = \Webiny\Component\TemplateEngine\TemplateEngine::getConfig()->get('Bridges', false);
if (!$bridges) {
if (!isset(self::$library[$engineName])) {
return false;
}
return self::$library[$en... | [
"private",
"static",
"function",
"getLibrary",
"(",
"$",
"engineName",
")",
"{",
"$",
"bridges",
"=",
"\\",
"Webiny",
"\\",
"Component",
"\\",
"TemplateEngine",
"\\",
"TemplateEngine",
"::",
"getConfig",
"(",
")",
"->",
"get",
"(",
"'Bridges'",
",",
"false",... | Get the name of bridge library which will be used as the driver.
@param string $engineName Name of the template engine for which you wish to get the
@return string | [
"Get",
"the",
"name",
"of",
"bridge",
"library",
"which",
"will",
"be",
"used",
"as",
"the",
"driver",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/TemplateEngine/Bridge/TemplateEngine.php#L35-L47 |
229,811 | Webiny/Framework | src/Webiny/Component/TemplateEngine/Bridge/TemplateEngine.php | TemplateEngine.getInstance | public static function getInstance($engineName, ConfigObject $config)
{
$driver = static::getLibrary($engineName);
if (!self::isString($driver)) {
throw new TemplateEngineException('Invalid driver returned for ' . $engineName . ' engine');
}
try {
$instance ... | php | public static function getInstance($engineName, ConfigObject $config)
{
$driver = static::getLibrary($engineName);
if (!self::isString($driver)) {
throw new TemplateEngineException('Invalid driver returned for ' . $engineName . ' engine');
}
try {
$instance ... | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"engineName",
",",
"ConfigObject",
"$",
"config",
")",
"{",
"$",
"driver",
"=",
"static",
"::",
"getLibrary",
"(",
"$",
"engineName",
")",
";",
"if",
"(",
"!",
"self",
"::",
"isString",
"(",
"$",
... | Create an instance of an TemplateEngine driver.
@param string $engineName Name of the template engine for which to load the instance.
@param ConfigObject $config Template engine config.
@throws TemplateEngineException
@throws \Exception
@return TemplateEngineInterface | [
"Create",
"an",
"instance",
"of",
"an",
"TemplateEngine",
"driver",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/TemplateEngine/Bridge/TemplateEngine.php#L70-L89 |
229,812 | milesj/admin | Console/Command/InstallShell.php | InstallShell.main | public function main() {
$this->setSteps(array(
'Check Database Configuration' => 'checkDbConfig',
'Set Table Prefix' => 'checkTablePrefix',
'Set Users Table' => 'checkUsersTable',
'Check Table Status' => 'checkRequiredTables',
'Create Database Tables'... | php | public function main() {
$this->setSteps(array(
'Check Database Configuration' => 'checkDbConfig',
'Set Table Prefix' => 'checkTablePrefix',
'Set Users Table' => 'checkUsersTable',
'Check Table Status' => 'checkRequiredTables',
'Create Database Tables'... | [
"public",
"function",
"main",
"(",
")",
"{",
"$",
"this",
"->",
"setSteps",
"(",
"array",
"(",
"'Check Database Configuration'",
"=>",
"'checkDbConfig'",
",",
"'Set Table Prefix'",
"=>",
"'checkTablePrefix'",
",",
"'Set Users Table'",
"=>",
"'checkUsersTable'",
",",
... | Trigger install. | [
"Trigger",
"install",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Console/Command/InstallShell.php#L28-L47 |
229,813 | milesj/admin | Console/Command/InstallShell.php | InstallShell.setupAcl | public function setupAcl() {
$adminAlias = Configure::read('Admin.aliases.administrator');
$this->out(sprintf('Administrator Role: <info>%s</info>', $adminAlias));
$answer = mb_strtoupper($this->in('Is this correct?', array('Y', 'N')));
if ($answer === 'N') {
$this->out('<... | php | public function setupAcl() {
$adminAlias = Configure::read('Admin.aliases.administrator');
$this->out(sprintf('Administrator Role: <info>%s</info>', $adminAlias));
$answer = mb_strtoupper($this->in('Is this correct?', array('Y', 'N')));
if ($answer === 'N') {
$this->out('<... | [
"public",
"function",
"setupAcl",
"(",
")",
"{",
"$",
"adminAlias",
"=",
"Configure",
"::",
"read",
"(",
"'Admin.aliases.administrator'",
")",
";",
"$",
"this",
"->",
"out",
"(",
"sprintf",
"(",
"'Administrator Role: <info>%s</info>'",
",",
"$",
"adminAlias",
")... | Setup all the ACL records.
@return bool | [
"Setup",
"all",
"the",
"ACL",
"records",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Console/Command/InstallShell.php#L54-L90 |
229,814 | milesj/admin | Console/Command/InstallShell.php | InstallShell.finish | public function finish() {
$this->hr(1);
$this->out('Admin installation complete!');
$this->out('Please read the documentation for further instructions:');
$this->out('http://milesj.me/code/cakephp/admin');
$this->hr(1);
return true;
} | php | public function finish() {
$this->hr(1);
$this->out('Admin installation complete!');
$this->out('Please read the documentation for further instructions:');
$this->out('http://milesj.me/code/cakephp/admin');
$this->hr(1);
return true;
} | [
"public",
"function",
"finish",
"(",
")",
"{",
"$",
"this",
"->",
"hr",
"(",
"1",
")",
";",
"$",
"this",
"->",
"out",
"(",
"'Admin installation complete!'",
")",
";",
"$",
"this",
"->",
"out",
"(",
"'Please read the documentation for further instructions:'",
"... | Finalize the installation.
@return bool | [
"Finalize",
"the",
"installation",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Console/Command/InstallShell.php#L97-L105 |
229,815 | milesj/admin | Console/Command/InstallShell.php | InstallShell.plugin | public function plugin($name = null) {
$this->out();
$pluginName = $name ?: $this->args[0];
$plugin = Admin::getPlugin($pluginName);
if (!$plugin) {
$this->err(sprintf('<error>%s plugin does not exist</error>', $pluginName));
return;
}
$this->ou... | php | public function plugin($name = null) {
$this->out();
$pluginName = $name ?: $this->args[0];
$plugin = Admin::getPlugin($pluginName);
if (!$plugin) {
$this->err(sprintf('<error>%s plugin does not exist</error>', $pluginName));
return;
}
$this->ou... | [
"public",
"function",
"plugin",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"out",
"(",
")",
";",
"$",
"pluginName",
"=",
"$",
"name",
"?",
":",
"$",
"this",
"->",
"args",
"[",
"0",
"]",
";",
"$",
"plugin",
"=",
"Admin",
"::",
... | Install ACOs for all plugin models.
@param string $name | [
"Install",
"ACOs",
"for",
"all",
"plugin",
"models",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Console/Command/InstallShell.php#L112-L140 |
229,816 | milesj/admin | Console/Command/InstallShell.php | InstallShell.model | public function model($name = null) {
$this->out();
$modelName = Inflector::classify($name ?: $this->args[0]);
$model = ClassRegistry::init($modelName, true);
if (get_class($model) === 'AppModel') {
$this->err(sprintf('<error>%s model does not exist</error>', $modelName));
... | php | public function model($name = null) {
$this->out();
$modelName = Inflector::classify($name ?: $this->args[0]);
$model = ClassRegistry::init($modelName, true);
if (get_class($model) === 'AppModel') {
$this->err(sprintf('<error>%s model does not exist</error>', $modelName));
... | [
"public",
"function",
"model",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"out",
"(",
")",
";",
"$",
"modelName",
"=",
"Inflector",
"::",
"classify",
"(",
"$",
"name",
"?",
":",
"$",
"this",
"->",
"args",
"[",
"0",
"]",
")",
";... | Install ACOs for a single model.
@param string $name | [
"Install",
"ACOs",
"for",
"a",
"single",
"model",
"."
] | e5e93823d1eb4415f05a3191f653eb50c296d2c6 | https://github.com/milesj/admin/blob/e5e93823d1eb4415f05a3191f653eb50c296d2c6/Console/Command/InstallShell.php#L147-L177 |
229,817 | Webiny/Framework | src/Webiny/Component/Entity/Attribute/AbstractDateAttribute.php | AbstractDateAttribute.setDefaultValueInternal | private function setDefaultValueInternal()
{
$defaultValue = $this->getDefaultValue();
if ($defaultValue == 'now') {
$defaultValue = new DateTimeObject('now');
}
$this->setValue($defaultValue);
} | php | private function setDefaultValueInternal()
{
$defaultValue = $this->getDefaultValue();
if ($defaultValue == 'now') {
$defaultValue = new DateTimeObject('now');
}
$this->setValue($defaultValue);
} | [
"private",
"function",
"setDefaultValueInternal",
"(",
")",
"{",
"$",
"defaultValue",
"=",
"$",
"this",
"->",
"getDefaultValue",
"(",
")",
";",
"if",
"(",
"$",
"defaultValue",
"==",
"'now'",
")",
"{",
"$",
"defaultValue",
"=",
"new",
"DateTimeObject",
"(",
... | Set default attribute value | [
"Set",
"default",
"attribute",
"value"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/Attribute/AbstractDateAttribute.php#L118-L125 |
229,818 | Webiny/Framework | src/Webiny/Component/Image/Bridge/AbstractImage.php | AbstractImage.setFormat | public function setFormat($format)
{
if (!in_array($format, self::$formats)) {
throw new ImageException('Invalid image format provided. Supported formats are [jpg, jpeg, png, gif].');
}
$this->format = $format;
} | php | public function setFormat($format)
{
if (!in_array($format, self::$formats)) {
throw new ImageException('Invalid image format provided. Supported formats are [jpg, jpeg, png, gif].');
}
$this->format = $format;
} | [
"public",
"function",
"setFormat",
"(",
"$",
"format",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"format",
",",
"self",
"::",
"$",
"formats",
")",
")",
"{",
"throw",
"new",
"ImageException",
"(",
"'Invalid image format provided. Supported formats are [jpg,... | Sets image mime-type format.
@param string $format Format name. Supported formats are [jpg, jpeg, png, gif]
@throws ImageException | [
"Sets",
"image",
"mime",
"-",
"type",
"format",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/AbstractImage.php#L63-L70 |
229,819 | Webiny/Framework | src/Webiny/Component/Image/Bridge/AbstractImage.php | AbstractImage.save | public function save(File $file = null, $options = [])
{
if ($this->isNull($file)) {
if ($this->isNull($this->destination)) {
throw new ImageException('Unable to save the image. Destination storage is not defined.');
}
$file = $this->destination;
... | php | public function save(File $file = null, $options = [])
{
if ($this->isNull($file)) {
if ($this->isNull($this->destination)) {
throw new ImageException('Unable to save the image. Destination storage is not defined.');
}
$file = $this->destination;
... | [
"public",
"function",
"save",
"(",
"File",
"$",
"file",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNull",
"(",
"$",
"file",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNull",
"(",
"$",
"thi... | Saves the image in the defined storage.
@param File $file Where to save the image.
@param array $options An array of options. Possible keys are [quality, filters].
@return bool True if image is save successfully, otherwise false.
@throws \Exception|ImageException | [
"Saves",
"the",
"image",
"in",
"the",
"defined",
"storage",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Image/Bridge/AbstractImage.php#L92-L114 |
229,820 | Webiny/Framework | src/Webiny/Component/Entity/EntityCollection.php | EntityCollection.filter | public function filter(\Closure $callback)
{
$result = [];
foreach ($this->value as $entity) {
if ($callback($entity)) {
$result[] = $entity;
}
}
return $result;
} | php | public function filter(\Closure $callback)
{
$result = [];
foreach ($this->value as $entity) {
if ($callback($entity)) {
$result[] = $entity;
}
}
return $result;
} | [
"public",
"function",
"filter",
"(",
"\\",
"Closure",
"$",
"callback",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"value",
"as",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"callback",
"(",
"$",
"entity",
")",
")... | Filter current EntityCollection using the given \Closure and return a new array
@param \Closure $callback
@return array | [
"Filter",
"current",
"EntityCollection",
"using",
"the",
"given",
"\\",
"Closure",
"and",
"return",
"a",
"new",
"array"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/EntityCollection.php#L115-L125 |
229,821 | Webiny/Framework | src/Webiny/Component/Entity/EntityCollection.php | EntityCollection.map | public function map(\Closure $callback)
{
$result = [];
foreach ($this->value as $entity) {
$result[] = $callback($entity);
}
return $result;
} | php | public function map(\Closure $callback)
{
$result = [];
foreach ($this->value as $entity) {
$result[] = $callback($entity);
}
return $result;
} | [
"public",
"function",
"map",
"(",
"\\",
"Closure",
"$",
"callback",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"value",
"as",
"$",
"entity",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"callback",
"(",
"$",
... | Apply the callback to each entity in the current EntityCollection
Returns a new array containing the return values of each callback execution.
@param \Closure $callback
@return array | [
"Apply",
"the",
"callback",
"to",
"each",
"entity",
"in",
"the",
"current",
"EntityCollection"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/EntityCollection.php#L136-L144 |
229,822 | Webiny/Framework | src/Webiny/Component/Entity/EntityCollection.php | EntityCollection.totalCount | public function totalCount()
{
if (!isset($this->parameters['conditions'])) {
return count($this->value);
}
if (!$this->totalCount) {
if (is_callable($this->totalCountCalculation)) {
$this->totalCount = ($this->totalCountCalculation)();
} ... | php | public function totalCount()
{
if (!isset($this->parameters['conditions'])) {
return count($this->value);
}
if (!$this->totalCount) {
if (is_callable($this->totalCountCalculation)) {
$this->totalCount = ($this->totalCountCalculation)();
} ... | [
"public",
"function",
"totalCount",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"parameters",
"[",
"'conditions'",
"]",
")",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"value",
")",
";",
"}",
"if",
"(",
"!",
"$",
"th... | Count total number of items in collection
@return mixed | [
"Count",
"total",
"number",
"of",
"items",
"in",
"collection"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/EntityCollection.php#L151-L168 |
229,823 | Webiny/Framework | src/Webiny/Component/Entity/EntityCollection.php | EntityCollection.removeItem | public function removeItem($item)
{
if ($item instanceof AbstractEntity) {
$item = $item->id;
}
foreach ($this->value as $index => $entity) {
if ($entity->id == $item) {
unset($this->value[$index]);
return;
}
}
... | php | public function removeItem($item)
{
if ($item instanceof AbstractEntity) {
$item = $item->id;
}
foreach ($this->value as $index => $entity) {
if ($entity->id == $item) {
unset($this->value[$index]);
return;
}
}
... | [
"public",
"function",
"removeItem",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"instanceof",
"AbstractEntity",
")",
"{",
"$",
"item",
"=",
"$",
"item",
"->",
"id",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"value",
"as",
"$",
"index",
"... | Remove item from data set
@param $item | [
"Remove",
"item",
"from",
"data",
"set"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/EntityCollection.php#L237-L249 |
229,824 | Webiny/Framework | src/Webiny/Component/Entity/EntityCollection.php | EntityCollection.normalizeValue | protected function normalizeValue($item, $fromDb = false)
{
$entityClass = $this->entityClass;
$itemEntity = null;
// $item can be an array of data or AbstractEntity
if ($this->isInstanceOf($item, $entityClass)) {
return $item;
}
if ($this->isArray($item... | php | protected function normalizeValue($item, $fromDb = false)
{
$entityClass = $this->entityClass;
$itemEntity = null;
// $item can be an array of data or AbstractEntity
if ($this->isInstanceOf($item, $entityClass)) {
return $item;
}
if ($this->isArray($item... | [
"protected",
"function",
"normalizeValue",
"(",
"$",
"item",
",",
"$",
"fromDb",
"=",
"false",
")",
"{",
"$",
"entityClass",
"=",
"$",
"this",
"->",
"entityClass",
";",
"$",
"itemEntity",
"=",
"null",
";",
"// $item can be an array of data or AbstractEntity",
"i... | Normalize value to always be an instance of AbstractEntity
@param array|AbstractEntity $item
@param bool $fromDb Is $item coming from DB
@return AbstractEntity
@throws EntityException | [
"Normalize",
"value",
"to",
"always",
"be",
"an",
"instance",
"of",
"AbstractEntity"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/EntityCollection.php#L328-L366 |
229,825 | themsaid/katana-core | src/SiteBuilder.php | SiteBuilder.build | public function build()
{
$this->readConfigs();
$files = $this->getSiteFiles();
$otherFiles = array_filter($files, function ($file) {
return ! str_contains($file->getRelativePath(), '_blog');
});
if (@$this->configs['enableBlog']) {
$blogPostsFiles ... | php | public function build()
{
$this->readConfigs();
$files = $this->getSiteFiles();
$otherFiles = array_filter($files, function ($file) {
return ! str_contains($file->getRelativePath(), '_blog');
});
if (@$this->configs['enableBlog']) {
$blogPostsFiles ... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"this",
"->",
"readConfigs",
"(",
")",
";",
"$",
"files",
"=",
"$",
"this",
"->",
"getSiteFiles",
"(",
")",
";",
"$",
"otherFiles",
"=",
"array_filter",
"(",
"$",
"files",
",",
"function",
"(",
"$",
... | Build the site from blade views.
@return void | [
"Build",
"the",
"site",
"from",
"blade",
"views",
"."
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/SiteBuilder.php#L95-L128 |
229,826 | themsaid/katana-core | src/SiteBuilder.php | SiteBuilder.readConfigs | protected function readConfigs()
{
$configs = include getcwd().'/config.php';
if (
$this->environment != 'default' &&
$this->filesystem->exists(getcwd().'/'.$fileName = "config-{$this->environment}.php")
) {
$configs = array_merge($configs, include getcwd... | php | protected function readConfigs()
{
$configs = include getcwd().'/config.php';
if (
$this->environment != 'default' &&
$this->filesystem->exists(getcwd().'/'.$fileName = "config-{$this->environment}.php")
) {
$configs = array_merge($configs, include getcwd... | [
"protected",
"function",
"readConfigs",
"(",
")",
"{",
"$",
"configs",
"=",
"include",
"getcwd",
"(",
")",
".",
"'/config.php'",
";",
"if",
"(",
"$",
"this",
"->",
"environment",
"!=",
"'default'",
"&&",
"$",
"this",
"->",
"filesystem",
"->",
"exists",
"... | Read site configurations based on the current environment.
It loads the default config file, then the environment specific
config file, if found, and finally merges any other configs.
@return void | [
"Read",
"site",
"configurations",
"based",
"on",
"the",
"current",
"environment",
"."
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/SiteBuilder.php#L151-L163 |
229,827 | themsaid/katana-core | src/SiteBuilder.php | SiteBuilder.getSiteFiles | protected function getSiteFiles()
{
$files = array_filter($this->filesystem->allFiles(KATANA_CONTENT_DIR), function (SplFileInfo $file) {
return $this->filterFile($file);
});
$this->appendFiles($files);
return $files;
} | php | protected function getSiteFiles()
{
$files = array_filter($this->filesystem->allFiles(KATANA_CONTENT_DIR), function (SplFileInfo $file) {
return $this->filterFile($file);
});
$this->appendFiles($files);
return $files;
} | [
"protected",
"function",
"getSiteFiles",
"(",
")",
"{",
"$",
"files",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"filesystem",
"->",
"allFiles",
"(",
"KATANA_CONTENT_DIR",
")",
",",
"function",
"(",
"SplFileInfo",
"$",
"file",
")",
"{",
"return",
"$",
"t... | Get the site files that will be converted into pages.
@return SplFileInfo[] | [
"Get",
"the",
"site",
"files",
"that",
"will",
"be",
"converted",
"into",
"pages",
"."
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/SiteBuilder.php#L198-L207 |
229,828 | themsaid/katana-core | src/SiteBuilder.php | SiteBuilder.readBlogPostsData | protected function readBlogPostsData($files)
{
foreach ($files as $file) {
$this->postsData[] = $this->blogPostHandler->getPostData($file);
}
} | php | protected function readBlogPostsData($files)
{
foreach ($files as $file) {
$this->postsData[] = $this->blogPostHandler->getPostData($file);
}
} | [
"protected",
"function",
"readBlogPostsData",
"(",
"$",
"files",
")",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"postsData",
"[",
"]",
"=",
"$",
"this",
"->",
"blogPostHandler",
"->",
"getPostData",
"(",
"$",
"f... | Read the data of every blog post.
@param array $files
@return void | [
"Read",
"the",
"data",
"of",
"every",
"blog",
"post",
"."
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/SiteBuilder.php#L239-L244 |
229,829 | themsaid/katana-core | src/SiteBuilder.php | SiteBuilder.buildViewsData | protected function buildViewsData()
{
$this->viewsData = $this->configs + ['blogPosts' => array_reverse((array) $this->postsData)];
$this->fileHandler->viewsData = $this->viewsData;
$this->blogPostHandler->viewsData = $this->viewsData;
} | php | protected function buildViewsData()
{
$this->viewsData = $this->configs + ['blogPosts' => array_reverse((array) $this->postsData)];
$this->fileHandler->viewsData = $this->viewsData;
$this->blogPostHandler->viewsData = $this->viewsData;
} | [
"protected",
"function",
"buildViewsData",
"(",
")",
"{",
"$",
"this",
"->",
"viewsData",
"=",
"$",
"this",
"->",
"configs",
"+",
"[",
"'blogPosts'",
"=>",
"array_reverse",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"postsData",
")",
"]",
";",
"$",
"th... | Build array of data to be passed to every view.
@return void | [
"Build",
"array",
"of",
"data",
"to",
"be",
"passed",
"to",
"every",
"view",
"."
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/SiteBuilder.php#L251-L258 |
229,830 | themsaid/katana-core | src/SiteBuilder.php | SiteBuilder.buildBlogPagination | protected function buildBlogPagination()
{
$builder = new BlogPaginationBuilder(
$this->filesystem,
$this->viewFactory,
$this->viewsData
);
$builder->build();
} | php | protected function buildBlogPagination()
{
$builder = new BlogPaginationBuilder(
$this->filesystem,
$this->viewFactory,
$this->viewsData
);
$builder->build();
} | [
"protected",
"function",
"buildBlogPagination",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"BlogPaginationBuilder",
"(",
"$",
"this",
"->",
"filesystem",
",",
"$",
"this",
"->",
"viewFactory",
",",
"$",
"this",
"->",
"viewsData",
")",
";",
"$",
"builder",
... | Build the blog pagination files.
@return void | [
"Build",
"the",
"blog",
"pagination",
"files",
"."
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/SiteBuilder.php#L265-L274 |
229,831 | themsaid/katana-core | src/SiteBuilder.php | SiteBuilder.buildRSSFeed | protected function buildRSSFeed()
{
$builder = new RSSFeedBuilder(
$this->filesystem,
$this->viewFactory,
$this->viewsData
);
$builder->build();
} | php | protected function buildRSSFeed()
{
$builder = new RSSFeedBuilder(
$this->filesystem,
$this->viewFactory,
$this->viewsData
);
$builder->build();
} | [
"protected",
"function",
"buildRSSFeed",
"(",
")",
"{",
"$",
"builder",
"=",
"new",
"RSSFeedBuilder",
"(",
"$",
"this",
"->",
"filesystem",
",",
"$",
"this",
"->",
"viewFactory",
",",
"$",
"this",
"->",
"viewsData",
")",
";",
"$",
"builder",
"->",
"build... | Build the blog RSS feed.
@return void | [
"Build",
"the",
"blog",
"RSS",
"feed",
"."
] | 897c1adb6863d5145f1f104cbc8c9200cd98c3fb | https://github.com/themsaid/katana-core/blob/897c1adb6863d5145f1f104cbc8c9200cd98c3fb/src/SiteBuilder.php#L281-L290 |
229,832 | ZenMagick/ZenCart | includes/classes/split_page_results.php | splitPageResults.display_count | function display_count($text_output) {
$to_num = ($this->number_of_rows_per_page * $this->current_page_number);
if ($to_num > $this->number_of_rows) $to_num = $this->number_of_rows;
$from_num = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
if ($to_num == 0) {
$from_num = 0... | php | function display_count($text_output) {
$to_num = ($this->number_of_rows_per_page * $this->current_page_number);
if ($to_num > $this->number_of_rows) $to_num = $this->number_of_rows;
$from_num = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
if ($to_num == 0) {
$from_num = 0... | [
"function",
"display_count",
"(",
"$",
"text_output",
")",
"{",
"$",
"to_num",
"=",
"(",
"$",
"this",
"->",
"number_of_rows_per_page",
"*",
"$",
"this",
"->",
"current_page_number",
")",
";",
"if",
"(",
"$",
"to_num",
">",
"$",
"this",
"->",
"number_of_row... | display number of total products found | [
"display",
"number",
"of",
"total",
"products",
"found"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/classes/split_page_results.php#L145-L163 |
229,833 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.processLogin | public function processLogin($authProvider = '')
{
try {
// if we are on login page, first try to get the instance of Login object from current auth provider
$login = $this->getAuthProvider($authProvider)->getLoginObject($this->getConfig());
if (!$this->isInstanceOf($logi... | php | public function processLogin($authProvider = '')
{
try {
// if we are on login page, first try to get the instance of Login object from current auth provider
$login = $this->getAuthProvider($authProvider)->getLoginObject($this->getConfig());
if (!$this->isInstanceOf($logi... | [
"public",
"function",
"processLogin",
"(",
"$",
"authProvider",
"=",
"''",
")",
"{",
"try",
"{",
"// if we are on login page, first try to get the instance of Login object from current auth provider",
"$",
"login",
"=",
"$",
"this",
"->",
"getAuthProvider",
"(",
"$",
"aut... | Call this method on your login submit page, it will trigger the authentication provider and validate the provided
credentials.
@param string $authProvider Name of the auth provider you wish to use to process the login.
If you don't set it, the first registered provider will be used.
@return bool True if login is vali... | [
"Call",
"this",
"method",
"on",
"your",
"login",
"submit",
"page",
"it",
"will",
"trigger",
"the",
"authentication",
"provider",
"and",
"validate",
"the",
"provided",
"credentials",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L159-L188 |
229,834 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.processLogout | public function processLogout()
{
$this->getToken()->deleteUserToken();
if ($this->getUser()->isAuthenticated()) {
$this->getAuthProvider($this->user->getAuthProviderName())->logoutCallback();
}
$this->user = new AnonymousUser();
$this->userAuthenticated = false;
... | php | public function processLogout()
{
$this->getToken()->deleteUserToken();
if ($this->getUser()->isAuthenticated()) {
$this->getAuthProvider($this->user->getAuthProviderName())->logoutCallback();
}
$this->user = new AnonymousUser();
$this->userAuthenticated = false;
... | [
"public",
"function",
"processLogout",
"(",
")",
"{",
"$",
"this",
"->",
"getToken",
"(",
")",
"->",
"deleteUserToken",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getUser",
"(",
")",
"->",
"isAuthenticated",
"(",
")",
")",
"{",
"$",
"this",
"->",
... | This method deletes user auth token and calls the logoutCallback on current login provider.
After that, it replaces the current user instance with an instance of AnonymousUser and redirects the request to
the logout.target. | [
"This",
"method",
"deletes",
"user",
"auth",
"token",
"and",
"calls",
"the",
"logoutCallback",
"on",
"current",
"login",
"provider",
".",
"After",
"that",
"it",
"replaces",
"the",
"current",
"user",
"instance",
"with",
"an",
"instance",
"of",
"AnonymousUser",
... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L195-L207 |
229,835 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.getUser | public function getUser()
{
if ($this->userAuthenticated) {
return $this->user;
}
try {
// get token
$this->user = new AnonymousUser();
$tokenData = $this->getToken()->getUserFromToken();
if (!$tokenData) {
$this->... | php | public function getUser()
{
if ($this->userAuthenticated) {
return $this->user;
}
try {
// get token
$this->user = new AnonymousUser();
$tokenData = $this->getToken()->getUserFromToken();
if (!$tokenData) {
$this->... | [
"public",
"function",
"getUser",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"userAuthenticated",
")",
"{",
"return",
"$",
"this",
"->",
"user",
";",
"}",
"try",
"{",
"// get token",
"$",
"this",
"->",
"user",
"=",
"new",
"AnonymousUser",
"(",
")",
... | Tries to retrieve the user from current token.
If the token does not exist, AnonymousUser is returned.
@return bool|AbstractUser
@throws FirewallException
@throws TokenException | [
"Tries",
"to",
"retrieve",
"the",
"user",
"from",
"current",
"token",
".",
"If",
"the",
"token",
"does",
"not",
"exist",
"AnonymousUser",
"is",
"returned",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L216-L250 |
229,836 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.isUserAllowedAccess | public function isUserAllowedAccess()
{
if (!is_object($this->accessControl)) {
$this->accessControl = new AccessControl($this->user, $this->config->get('AccessControl', false));
}
$isAccessAllowed = $this->accessControl->isUserAllowedAccess();
if (!$isAccessAllowed) {
... | php | public function isUserAllowedAccess()
{
if (!is_object($this->accessControl)) {
$this->accessControl = new AccessControl($this->user, $this->config->get('AccessControl', false));
}
$isAccessAllowed = $this->accessControl->isUserAllowedAccess();
if (!$isAccessAllowed) {
... | [
"public",
"function",
"isUserAllowedAccess",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"accessControl",
")",
")",
"{",
"$",
"this",
"->",
"accessControl",
"=",
"new",
"AccessControl",
"(",
"$",
"this",
"->",
"user",
",",
"$",
... | Checks if current user has access to current area based by access rules.
@return bool | [
"Checks",
"if",
"current",
"user",
"has",
"access",
"to",
"current",
"area",
"based",
"by",
"access",
"rules",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L257-L269 |
229,837 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.getAuthProviderConfig | private function getAuthProviderConfig($authProvider)
{
// have we already fetched the auth config
if ($this->authProviderConfig) {
return $this->authProviderConfig;
}
if ($authProvider == '') {
// get the first auth provider from the list
$provid... | php | private function getAuthProviderConfig($authProvider)
{
// have we already fetched the auth config
if ($this->authProviderConfig) {
return $this->authProviderConfig;
}
if ($authProvider == '') {
// get the first auth provider from the list
$provid... | [
"private",
"function",
"getAuthProviderConfig",
"(",
"$",
"authProvider",
")",
"{",
"// have we already fetched the auth config",
"if",
"(",
"$",
"this",
"->",
"authProviderConfig",
")",
"{",
"return",
"$",
"this",
"->",
"authProviderConfig",
";",
"}",
"if",
"(",
... | Returns the config of current auth provider.
@param string $authProvider Name of the auth provider you wish to use to process the login.
If you don't set it, the first registered provider will be used.
@throws FirewallException
@return ConfigObject | [
"Returns",
"the",
"config",
"of",
"current",
"auth",
"provider",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L355-L389 |
229,838 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.authenticate | private function authenticate(Login $login)
{
foreach ($this->userProviders as $name => $provider) {
try {
/* @var AbstractUser $user */
$user = $provider->getUser($login);
if ($user && $user->authenticate($login, $this)) {
$use... | php | private function authenticate(Login $login)
{
foreach ($this->userProviders as $name => $provider) {
try {
/* @var AbstractUser $user */
$user = $provider->getUser($login);
if ($user && $user->authenticate($login, $this)) {
$use... | [
"private",
"function",
"authenticate",
"(",
"Login",
"$",
"login",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"userProviders",
"as",
"$",
"name",
"=>",
"$",
"provider",
")",
"{",
"try",
"{",
"/* @var AbstractUser $user */",
"$",
"user",
"=",
"$",
"provid... | Method that validates the submitted credentials with defined firewall user providers.
If authentication is valid, a user object is created and a token is stored.
This method just calls the 'authenticate' method on current user object, and if auth method returns true,
we create a token and return the user instance.
@pa... | [
"Method",
"that",
"validates",
"the",
"submitted",
"credentials",
"with",
"defined",
"firewall",
"user",
"providers",
".",
"If",
"authentication",
"is",
"valid",
"a",
"user",
"object",
"is",
"created",
"and",
"a",
"token",
"is",
"stored",
".",
"This",
"method"... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L402-L421 |
229,839 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.initToken | private function initToken()
{
$tokenName = $this->getConfig()->get('Token', false);
$rememberMe = $this->getConfig()->get('RememberMe', false);
if (!$tokenName) {
// fallback to the default token
$securityKey = $this->getConfig()->get('TokenKey', false);
... | php | private function initToken()
{
$tokenName = $this->getConfig()->get('Token', false);
$rememberMe = $this->getConfig()->get('RememberMe', false);
if (!$tokenName) {
// fallback to the default token
$securityKey = $this->getConfig()->get('TokenKey', false);
... | [
"private",
"function",
"initToken",
"(",
")",
"{",
"$",
"tokenName",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
"(",
"'Token'",
",",
"false",
")",
";",
"$",
"rememberMe",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"get",
... | Initializes the Token. | [
"Initializes",
"the",
"Token",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L426-L457 |
229,840 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.getAuthProvider | private function getAuthProvider($authProvider)
{
if (is_null($this->authProvider)) {
// auth provider config
$authProviderConfig = $this->getAuthProviderConfig($authProvider);
// optional params that will be passed to auth provider constructor
$params = $aut... | php | private function getAuthProvider($authProvider)
{
if (is_null($this->authProvider)) {
// auth provider config
$authProviderConfig = $this->getAuthProviderConfig($authProvider);
// optional params that will be passed to auth provider constructor
$params = $aut... | [
"private",
"function",
"getAuthProvider",
"(",
"$",
"authProvider",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"authProvider",
")",
")",
"{",
"// auth provider config",
"$",
"authProviderConfig",
"=",
"$",
"this",
"->",
"getAuthProviderConfig",
"(",... | Get the authentication provider.
@param string $authProvider Name of the auth provider you wish to use to process the login.
If you don't set it, the first registered provider will be used.
@return AuthenticationInterface
@throws FirewallException | [
"Get",
"the",
"authentication",
"provider",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L479-L496 |
229,841 | Webiny/Framework | src/Webiny/Component/Security/Authentication/Firewall.php | Firewall.setUserRoles | private function setUserRoles()
{
$this->initRoleHierarchy();
$this->user->setRoles($this->roleHierarchy->getAccessibleRoles($this->user->getRoles()));
} | php | private function setUserRoles()
{
$this->initRoleHierarchy();
$this->user->setRoles($this->roleHierarchy->getAccessibleRoles($this->user->getRoles()));
} | [
"private",
"function",
"setUserRoles",
"(",
")",
"{",
"$",
"this",
"->",
"initRoleHierarchy",
"(",
")",
";",
"$",
"this",
"->",
"user",
"->",
"setRoles",
"(",
"$",
"this",
"->",
"roleHierarchy",
"->",
"getAccessibleRoles",
"(",
"$",
"this",
"->",
"user",
... | Sets roles for current user. | [
"Sets",
"roles",
"for",
"current",
"user",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Security/Authentication/Firewall.php#L509-L513 |
229,842 | Webiny/Framework | src/Webiny/Component/Rest/Parser/PathTransformations.php | PathTransformations.methodNameToUrl | public static function methodNameToUrl($methodName)
{
$url = preg_replace('/([A-Z])/', ' $1', $methodName);
$url = self::str($url)->trim()->replace(' ', '-')->caseLower()->val();
return $url;
} | php | public static function methodNameToUrl($methodName)
{
$url = preg_replace('/([A-Z])/', ' $1', $methodName);
$url = self::str($url)->trim()->replace(' ', '-')->caseLower()->val();
return $url;
} | [
"public",
"static",
"function",
"methodNameToUrl",
"(",
"$",
"methodName",
")",
"{",
"$",
"url",
"=",
"preg_replace",
"(",
"'/([A-Z])/'",
",",
"' $1'",
",",
"$",
"methodName",
")",
";",
"$",
"url",
"=",
"self",
"::",
"str",
"(",
"$",
"url",
")",
"->",
... | Transforms method name to a url path.
@param string $methodName Method name.
@return string | [
"Transforms",
"method",
"name",
"to",
"a",
"url",
"path",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/PathTransformations.php#L28-L34 |
229,843 | Webiny/Framework | src/Webiny/Component/Rest/Parser/PathTransformations.php | PathTransformations.classNameToUrl | public static function classNameToUrl($className, $normalize)
{
$className = self::str($className)->explode('\\')->last()->val();
if(!$normalize){
return $className;
}
$url = preg_replace('/([A-Z])/', ' $1', $className);
$url = self::str($url)->trim()->replace(' '... | php | public static function classNameToUrl($className, $normalize)
{
$className = self::str($className)->explode('\\')->last()->val();
if(!$normalize){
return $className;
}
$url = preg_replace('/([A-Z])/', ' $1', $className);
$url = self::str($url)->trim()->replace(' '... | [
"public",
"static",
"function",
"classNameToUrl",
"(",
"$",
"className",
",",
"$",
"normalize",
")",
"{",
"$",
"className",
"=",
"self",
"::",
"str",
"(",
"$",
"className",
")",
"->",
"explode",
"(",
"'\\\\'",
")",
"->",
"last",
"(",
")",
"->",
"val",
... | Transforms the class name to url path.
@param string $className Class name.
@param bool $normalize Should the name be normalized or not
@return string | [
"Transforms",
"the",
"class",
"name",
"to",
"url",
"path",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/PathTransformations.php#L44-L54 |
229,844 | alexandresalome/php-webdriver | src/WebDriver/By.php | By.linkText | static public function linkText($value, $isPartial = false)
{
return new By($isPartial ? self::PARTIAL_LINK_TEXT : self::LINK_TEXT, $value);
} | php | static public function linkText($value, $isPartial = false)
{
return new By($isPartial ? self::PARTIAL_LINK_TEXT : self::LINK_TEXT, $value);
} | [
"static",
"public",
"function",
"linkText",
"(",
"$",
"value",
",",
"$",
"isPartial",
"=",
"false",
")",
"{",
"return",
"new",
"By",
"(",
"$",
"isPartial",
"?",
"self",
"::",
"PARTIAL_LINK_TEXT",
":",
"self",
"::",
"LINK_TEXT",
",",
"$",
"value",
")",
... | Returns an anchor element whose visible text matches the search value.
Browser will search for exact text if you don't specify $isPartial argument to true.
@param string $value Exact text to search in a link
@param boolean $isPartial Set to true to enable partial text search
@return By | [
"Returns",
"an",
"anchor",
"element",
"whose",
"visible",
"text",
"matches",
"the",
"search",
"value",
"."
] | ba187e7b13979e1db5001b7bfbe82d07c8e2e39d | https://github.com/alexandresalome/php-webdriver/blob/ba187e7b13979e1db5001b7bfbe82d07c8e2e39d/src/WebDriver/By.php#L160-L163 |
229,845 | Webiny/Framework | src/Webiny/Component/EventManager/EventManager.php | EventManager.listen | public function listen($eventName, EventListener $eventListener = null)
{
if (!$this->isString($eventName) || $this->str($eventName)->length() == 0) {
throw new EventManagerException(EventManagerException::INVALID_EVENT_NAME);
}
if ($this->isNull($eventListener)) {
... | php | public function listen($eventName, EventListener $eventListener = null)
{
if (!$this->isString($eventName) || $this->str($eventName)->length() == 0) {
throw new EventManagerException(EventManagerException::INVALID_EVENT_NAME);
}
if ($this->isNull($eventListener)) {
... | [
"public",
"function",
"listen",
"(",
"$",
"eventName",
",",
"EventListener",
"$",
"eventListener",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isString",
"(",
"$",
"eventName",
")",
"||",
"$",
"this",
"->",
"str",
"(",
"$",
"eventName",
... | Subscribe to event
@param string $eventName Event name you want to listen
@param EventListener $eventListener (Optional) If specified, given EventListener will be used for this event
@throws EventManagerException
@return EventListener Return instance of EventListener | [
"Subscribe",
"to",
"event"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/EventManager/EventManager.php#L50-L66 |
229,846 | ZenMagick/ZenCart | includes/classes/query_cache.php | QueryCache.cache | function cache($query, $result) {
if ($this->isSelectStatement($query) === TRUE) $this->queries[$query] = $result;
else return(FALSE);
return(TRUE);
} | php | function cache($query, $result) {
if ($this->isSelectStatement($query) === TRUE) $this->queries[$query] = $result;
else return(FALSE);
return(TRUE);
} | [
"function",
"cache",
"(",
"$",
"query",
",",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSelectStatement",
"(",
"$",
"query",
")",
"===",
"TRUE",
")",
"$",
"this",
"->",
"queries",
"[",
"$",
"query",
"]",
"=",
"$",
"result",
";",
"e... | FALSE - otherwise | [
"FALSE",
"-",
"otherwise"
] | 00438ebc0faee786489aab4a6d70fc0d0c1461c7 | https://github.com/ZenMagick/ZenCart/blob/00438ebc0faee786489aab4a6d70fc0d0c1461c7/includes/classes/query_cache.php#L26-L30 |
229,847 | Webiny/Framework | src/Webiny/Component/Config/ConfigObject.php | ConfigObject.getAsYaml | public function getAsYaml($indent = 4)
{
$driver = new YamlDriver($this->toArray());
return $driver->setIndent($indent)->getString();
} | php | public function getAsYaml($indent = 4)
{
$driver = new YamlDriver($this->toArray());
return $driver->setIndent($indent)->getString();
} | [
"public",
"function",
"getAsYaml",
"(",
"$",
"indent",
"=",
"4",
")",
"{",
"$",
"driver",
"=",
"new",
"YamlDriver",
"(",
"$",
"this",
"->",
"toArray",
"(",
")",
")",
";",
"return",
"$",
"driver",
"->",
"setIndent",
"(",
"$",
"indent",
")",
"->",
"g... | Get config as Yaml string
@param int $indent
@return string | [
"Get",
"config",
"as",
"Yaml",
"string"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/ConfigObject.php#L53-L58 |
229,848 | Webiny/Framework | src/Webiny/Component/Config/ConfigObject.php | ConfigObject.toArray | public function toArray($asArrayObject = false)
{
$data = [];
foreach ($this->data as $k => $v) {
$data[$k] = $this->isInstanceOf($v, $this) ? $v->toArray() : $v;
}
return $asArrayObject ? $this->arr($data) : $data;
} | php | public function toArray($asArrayObject = false)
{
$data = [];
foreach ($this->data as $k => $v) {
$data[$k] = $this->isInstanceOf($v, $this) ? $v->toArray() : $v;
}
return $asArrayObject ? $this->arr($data) : $data;
} | [
"public",
"function",
"toArray",
"(",
"$",
"asArrayObject",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"data",
"[",
"$",
"k",
"]",
"=",
"$... | Get Config data in form of an array or ArrayObject
@param bool $asArrayObject (Optional) Defaults to false
@return array|ArrayObject Config data array or ArrayObject | [
"Get",
"Config",
"data",
"in",
"form",
"of",
"an",
"array",
"or",
"ArrayObject"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/ConfigObject.php#L183-L191 |
229,849 | Webiny/Framework | src/Webiny/Component/Config/ConfigObject.php | ConfigObject.mergeWith | public function mergeWith($config)
{
if ($this->isArray($config) || $this->isArrayObject($config)) {
$config = Config::getInstance()->php(StdObjectWrapper::toArray($config));
}
foreach ($config as $key => $value) {
if ($this->data->keyExists($key)) {
... | php | public function mergeWith($config)
{
if ($this->isArray($config) || $this->isArrayObject($config)) {
$config = Config::getInstance()->php(StdObjectWrapper::toArray($config));
}
foreach ($config as $key => $value) {
if ($this->data->keyExists($key)) {
... | [
"public",
"function",
"mergeWith",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isArray",
"(",
"$",
"config",
")",
"||",
"$",
"this",
"->",
"isArrayObject",
"(",
"$",
"config",
")",
")",
"{",
"$",
"config",
"=",
"Config",
"::",
"get... | Merge current config with given config
@param array|ArrayObject|ConfigObject $config ConfigObject or array of ConfigObject to merge with
@throws ConfigException
@return $this | [
"Merge",
"current",
"config",
"with",
"given",
"config"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/ConfigObject.php#L305-L325 |
229,850 | Webiny/Framework | src/Webiny/Component/Rest/Compiler/Cache.php | Cache.isCacheValid | public function isCacheValid($api, $class)
{
// get the modified time of the $class
try {
$reflection = new \ReflectionClass($class);
} catch (\Exception $e) {
throw new RestException('Unable to validate the cache for ' . $class . '. ' . $e->getMessage());
}
... | php | public function isCacheValid($api, $class)
{
// get the modified time of the $class
try {
$reflection = new \ReflectionClass($class);
} catch (\Exception $e) {
throw new RestException('Unable to validate the cache for ' . $class . '. ' . $e->getMessage());
}
... | [
"public",
"function",
"isCacheValid",
"(",
"$",
"api",
",",
"$",
"class",
")",
"{",
"// get the modified time of the $class",
"try",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception... | Checks if a cache file is valid.
A valid file is considered and existing cache file that has a newer creation time, than the modify time,
of an api class that the cache file belongs to.
@param string $api Name of the rest api configuration.
@param string $class Fully qualified class name.
@throws \Webiny\Component\R... | [
"Checks",
"if",
"a",
"cache",
"file",
"is",
"valid",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Compiler/Cache.php#L48-L60 |
229,851 | Webiny/Framework | src/Webiny/Component/StdLib/StdObject/StdObjectWrapper.php | StdObjectWrapper.returnStdObject | public static function returnStdObject(&$var)
{
// check if $var is already a standard object
if (self::isInstanceOf($var, AbstractStdObject::class)) {
return $var;
}
// try to map $var to a standard object
if (self::isString($var)) {
return new Strin... | php | public static function returnStdObject(&$var)
{
// check if $var is already a standard object
if (self::isInstanceOf($var, AbstractStdObject::class)) {
return $var;
}
// try to map $var to a standard object
if (self::isString($var)) {
return new Strin... | [
"public",
"static",
"function",
"returnStdObject",
"(",
"&",
"$",
"var",
")",
"{",
"// check if $var is already a standard object",
"if",
"(",
"self",
"::",
"isInstanceOf",
"(",
"$",
"var",
",",
"AbstractStdObject",
"::",
"class",
")",
")",
"{",
"return",
"$",
... | This function make sure you are returning a standard object.
@param mixed $var
@return ArrayObject|StdObjectWrapper|StringObject | [
"This",
"function",
"make",
"sure",
"you",
"are",
"returning",
"a",
"standard",
"object",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/StdLib/StdObject/StdObjectWrapper.php#L47-L65 |
229,852 | khepin/KhepinYamlFixturesBundle | Fixture/MongoYamlFixture.php | MongoYamlFixture.createObject | public function createObject($class, $data, $metadata, $options = array())
{
// options to state if a document is to be embedded or persisted on its own
$embedded = isset($options['embedded']);
$mapping = array_keys($metadata->fieldMappings);
// Instantiate new object
$object... | php | public function createObject($class, $data, $metadata, $options = array())
{
// options to state if a document is to be embedded or persisted on its own
$embedded = isset($options['embedded']);
$mapping = array_keys($metadata->fieldMappings);
// Instantiate new object
$object... | [
"public",
"function",
"createObject",
"(",
"$",
"class",
",",
"$",
"data",
",",
"$",
"metadata",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"// options to state if a document is to be embedded or persisted on its own",
"$",
"embedded",
"=",
"isset",
"(... | Creates and returns one object based on the given data and metadata
@param $class object's class name
@param $data array of the object's fixture data
@param $metadata the class metadata for doctrine
@param $embedded true for embedded documents
@return Object | [
"Creates",
"and",
"returns",
"one",
"object",
"based",
"on",
"the",
"given",
"data",
"and",
"metadata"
] | 4f1947b03809421057e7b8a3553ccaa93423d192 | https://github.com/khepin/KhepinYamlFixturesBundle/blob/4f1947b03809421057e7b8a3553ccaa93423d192/Fixture/MongoYamlFixture.php#L18-L87 |
229,853 | addiks/phpsql | src/Addiks/PHPSQL/Value/Text/Email.php | Email.validate | protected function validate($value)
{
parent::validate($value);
$validator = new EmailValidator();
if (!$validator->isValid($value)) {
throw new ErrorException("Email address '{$value}' is invalid!");
}
} | php | protected function validate($value)
{
parent::validate($value);
$validator = new EmailValidator();
if (!$validator->isValid($value)) {
throw new ErrorException("Email address '{$value}' is invalid!");
}
} | [
"protected",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"parent",
"::",
"validate",
"(",
"$",
"value",
")",
";",
"$",
"validator",
"=",
"new",
"EmailValidator",
"(",
")",
";",
"if",
"(",
"!",
"$",
"validator",
"->",
"isValid",
"(",
"$",
"va... | Validates the mail-address using Zend.
@param string $value
@throws InvalidArgumentException | [
"Validates",
"the",
"mail",
"-",
"address",
"using",
"Zend",
"."
] | 28dae64ffc2123f39f801a50ab53bfe29890cbd9 | https://github.com/addiks/phpsql/blob/28dae64ffc2123f39f801a50ab53bfe29890cbd9/src/Addiks/PHPSQL/Value/Text/Email.php#L45-L55 |
229,854 | Webiny/Framework | src/Webiny/Component/Mailer/MailerTrait.php | MailerTrait.mailer | protected static function mailer($key = 'Default')
{
if (isset(self::$mailerInstances[$key])) {
return self::$mailerInstances[$key];
} else {
self::$mailerInstances[$key] = new Mailer($key);
return self::$mailerInstances[$key];
}
} | php | protected static function mailer($key = 'Default')
{
if (isset(self::$mailerInstances[$key])) {
return self::$mailerInstances[$key];
} else {
self::$mailerInstances[$key] = new Mailer($key);
return self::$mailerInstances[$key];
}
} | [
"protected",
"static",
"function",
"mailer",
"(",
"$",
"key",
"=",
"'Default'",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"mailerInstances",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"mailerInstances",
"[",
"$",
"k... | Returns an instance of Mailer.
@param string $key Key that identifies which mailer configuration to load.
@return Mailer | [
"Returns",
"an",
"instance",
"of",
"Mailer",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Mailer/MailerTrait.php#L28-L37 |
229,855 | Webiny/Framework | src/Webiny/Component/Mailer/Bridge/SwiftMailer/SwiftMailer.php | SwiftMailer.getMessage | public static function getMessage(ConfigObject $config)
{
$message = new Message($config);
if ($config->get('Sender', false)) {
$sender = new Email($config->get('Sender.Email', 'me@localhost'), $config->get('Sender.Name', null));
$message->setSender($sender);
//... | php | public static function getMessage(ConfigObject $config)
{
$message = new Message($config);
if ($config->get('Sender', false)) {
$sender = new Email($config->get('Sender.Email', 'me@localhost'), $config->get('Sender.Name', null));
$message->setSender($sender);
//... | [
"public",
"static",
"function",
"getMessage",
"(",
"ConfigObject",
"$",
"config",
")",
"{",
"$",
"message",
"=",
"new",
"Message",
"(",
"$",
"config",
")",
";",
"if",
"(",
"$",
"config",
"->",
"get",
"(",
"'Sender'",
",",
"false",
")",
")",
"{",
"$",... | Returns an instance of MessageInterface.
@param ConfigObject $config The configuration of current mailer
@return MessageInterface | [
"Returns",
"an",
"instance",
"of",
"MessageInterface",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Mailer/Bridge/SwiftMailer/SwiftMailer.php#L42-L55 |
229,856 | Webiny/Framework | src/Webiny/Component/Config/Drivers/JsonDriver.php | JsonDriver.parseJsonString | private function parseJsonString($data)
{
try {
return json_decode($data, true);
} catch (Exception $e) {
throw new ConfigException($e->getMessage());
}
} | php | private function parseJsonString($data)
{
try {
return json_decode($data, true);
} catch (Exception $e) {
throw new ConfigException($e->getMessage());
}
} | [
"private",
"function",
"parseJsonString",
"(",
"$",
"data",
")",
"{",
"try",
"{",
"return",
"json_decode",
"(",
"$",
"data",
",",
"true",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"throw",
"new",
"ConfigException",
"(",
"$",
"e",
... | Parse JSON string and return config array
@param array $data
@throws ConfigException
@return array | [
"Parse",
"JSON",
"string",
"and",
"return",
"config",
"array"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Config/Drivers/JsonDriver.php#L51-L58 |
229,857 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.getProfile | public function getProfile($id)
{
return $this->send($this->getHttp()->get($this->url.'profiles/'.$id.'.json'));
} | php | public function getProfile($id)
{
return $this->send($this->getHttp()->get($this->url.'profiles/'.$id.'.json'));
} | [
"public",
"function",
"getProfile",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"url",
".",
"'profiles/'",
".",
"$",
"id",
".",
"'.json'",
")",
"... | Returns details of the single specified social media profile.
@param string $id
@return array | [
"Returns",
"details",
"of",
"the",
"single",
"specified",
"social",
"media",
"profile",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L69-L72 |
229,858 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.getProfileSchedules | public function getProfileSchedules($id)
{
return $this->send($this->getHttp()->get($this->url.'profiles/'.$id.'/schedules.json'));
} | php | public function getProfileSchedules($id)
{
return $this->send($this->getHttp()->get($this->url.'profiles/'.$id.'/schedules.json'));
} | [
"public",
"function",
"getProfileSchedules",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"url",
".",
"'profiles/'",
".",
"$",
"id",
".",
"'/schedules... | Returns details of the posting schedules associated with a social media profile.
@param string $id
@return array | [
"Returns",
"details",
"of",
"the",
"posting",
"schedules",
"associated",
"with",
"a",
"social",
"media",
"profile",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L80-L83 |
229,859 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.updateProfileSchedules | public function updateProfileSchedules($id, $schedules)
{
$payload = $this->buildProfileSchedulesPayload($schedules);
return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/schedules/update.json', null, $payload));
} | php | public function updateProfileSchedules($id, $schedules)
{
$payload = $this->buildProfileSchedulesPayload($schedules);
return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/schedules/update.json', null, $payload));
} | [
"public",
"function",
"updateProfileSchedules",
"(",
"$",
"id",
",",
"$",
"schedules",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"buildProfileSchedulesPayload",
"(",
"$",
"schedules",
")",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",... | Set the posting schedules for the specified social media profile.
@param string $id
@param mixed $schedules
@return array | [
"Set",
"the",
"posting",
"schedules",
"for",
"the",
"specified",
"social",
"media",
"profile",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L92-L97 |
229,860 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.buildProfileSchedulesPayload | protected function buildProfileSchedulesPayload($schedules)
{
if (is_array($schedules)) {
throw new Exception('Multiple schedules update are not implemented.');
}
$payload = array('schedules' => array());
$payload['schedules'][] = array(
'days' => $schedule... | php | protected function buildProfileSchedulesPayload($schedules)
{
if (is_array($schedules)) {
throw new Exception('Multiple schedules update are not implemented.');
}
$payload = array('schedules' => array());
$payload['schedules'][] = array(
'days' => $schedule... | [
"protected",
"function",
"buildProfileSchedulesPayload",
"(",
"$",
"schedules",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"schedules",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Multiple schedules update are not implemented.'",
")",
";",
"}",
"$",
"payloa... | Given an array of Schedule objects, build the necessary payload to
update the profile schedules.
@param mixed $schedules
@return array | [
"Given",
"an",
"array",
"of",
"Schedule",
"objects",
"build",
"the",
"necessary",
"payload",
"to",
"update",
"the",
"profile",
"schedules",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L106-L120 |
229,861 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.getUpdate | public function getUpdate($id)
{
return $this->send($this->getHttp()->get($this->url.'updates/'.$id.'.json'));
} | php | public function getUpdate($id)
{
return $this->send($this->getHttp()->get($this->url.'updates/'.$id.'.json'));
} | [
"public",
"function",
"getUpdate",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"url",
".",
"'updates/'",
".",
"$",
"id",
".",
"'.json'",
")",
")"... | Returns a single social media update.
@param string $id
@return array | [
"Returns",
"a",
"single",
"social",
"media",
"update",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L128-L131 |
229,862 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.getProfilePendingUpdates | public function getProfilePendingUpdates($id, $page = null, $count = null, $since = null, $utc = false)
{
$payload = $this->buildProfileUpdatesPayload(compact('page', 'count', 'since', 'utc'));
return $this->send($this->getHttp()->get($this->url.'profiles/'.$id.'/updates/pending.json?'.$payload));
... | php | public function getProfilePendingUpdates($id, $page = null, $count = null, $since = null, $utc = false)
{
$payload = $this->buildProfileUpdatesPayload(compact('page', 'count', 'since', 'utc'));
return $this->send($this->getHttp()->get($this->url.'profiles/'.$id.'/updates/pending.json?'.$payload));
... | [
"public",
"function",
"getProfilePendingUpdates",
"(",
"$",
"id",
",",
"$",
"page",
"=",
"null",
",",
"$",
"count",
"=",
"null",
",",
"$",
"since",
"=",
"null",
",",
"$",
"utc",
"=",
"false",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"build... | Returns an array of updates that are currently in the buffer for an
individual social media profile.
@param string $id
@param integer $page
@param integer $count
@param integer $since
@param bool $utc
@return array | [
"Returns",
"an",
"array",
"of",
"updates",
"that",
"are",
"currently",
"in",
"the",
"buffer",
"for",
"an",
"individual",
"social",
"media",
"profile",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L144-L149 |
229,863 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.getUpdateInteractions | public function getUpdateInteractions($id, $page = null, $count = null, $event = null)
{
$payload = $this->buildProfileUpdatesPayload(compact('page', 'count', 'event'));
return $this->send($this->getHttp()->get($this->url.'updates/'.$id.'/interactions.json?'.$payload));
} | php | public function getUpdateInteractions($id, $page = null, $count = null, $event = null)
{
$payload = $this->buildProfileUpdatesPayload(compact('page', 'count', 'event'));
return $this->send($this->getHttp()->get($this->url.'updates/'.$id.'/interactions.json?'.$payload));
} | [
"public",
"function",
"getUpdateInteractions",
"(",
"$",
"id",
",",
"$",
"page",
"=",
"null",
",",
"$",
"count",
"=",
"null",
",",
"$",
"event",
"=",
"null",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"buildProfileUpdatesPayload",
"(",
"compact",
... | Returns the detailed information on individual interactions with the
social media update such as favorites, retweets and likes.
@param string $id
@param integer $page
@param integer $count
@param string $event
@return array | [
"Returns",
"the",
"detailed",
"information",
"on",
"individual",
"interactions",
"with",
"the",
"social",
"media",
"update",
"such",
"as",
"favorites",
"retweets",
"and",
"likes",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L179-L184 |
229,864 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.buildProfileUpdatesPayload | protected function buildProfileUpdatesPayload($data)
{
$payload = array();
if (isset($data['page']) and is_numeric($data['page'])) {
$payload['page'] = $data['page'];
}
if (isset($data['count']) and is_numeric($data['count'])) {
$payload['count'] = $data['co... | php | protected function buildProfileUpdatesPayload($data)
{
$payload = array();
if (isset($data['page']) and is_numeric($data['page'])) {
$payload['page'] = $data['page'];
}
if (isset($data['count']) and is_numeric($data['count'])) {
$payload['count'] = $data['co... | [
"protected",
"function",
"buildProfileUpdatesPayload",
"(",
"$",
"data",
")",
"{",
"$",
"payload",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'page'",
"]",
")",
"and",
"is_numeric",
"(",
"$",
"data",
"[",
"'page'",
"]",
... | Generic querystring generator for some of the Updates methods.
@param array $data
@return string | [
"Generic",
"querystring",
"generator",
"for",
"some",
"of",
"the",
"Updates",
"methods",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L192-L224 |
229,865 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.reorderProfileUpdates | public function reorderProfileUpdates($id, $order, $offset = null, $utc = false)
{
$payload = $this->buildReorderProfileUpdatesPayload((array) $order, $offset, $utc);
return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/updates/reorder.json', null, $payload));
} | php | public function reorderProfileUpdates($id, $order, $offset = null, $utc = false)
{
$payload = $this->buildReorderProfileUpdatesPayload((array) $order, $offset, $utc);
return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/updates/reorder.json', null, $payload));
} | [
"public",
"function",
"reorderProfileUpdates",
"(",
"$",
"id",
",",
"$",
"order",
",",
"$",
"offset",
"=",
"null",
",",
"$",
"utc",
"=",
"false",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"buildReorderProfileUpdatesPayload",
"(",
"(",
"array",
")... | Edit the order at which statuses for the specified social media profile
will be sent out of the buffer.
@param string $id
@param array|string $order
@param integer $offset
@param boolean $utc
@return array | [
"Edit",
"the",
"order",
"at",
"which",
"statuses",
"for",
"the",
"specified",
"social",
"media",
"profile",
"will",
"be",
"sent",
"out",
"of",
"the",
"buffer",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L236-L241 |
229,866 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.buildReorderProfileUpdatesPayload | protected function buildReorderProfileUpdatesPayload($order, $offset, $utc)
{
$payload = array();
$payload['order'] = $order;
if (is_numeric($offset)) {
$payload['offset'] = $offset;
}
if ($utc) {
$payload['utc'] = true;
}
return $p... | php | protected function buildReorderProfileUpdatesPayload($order, $offset, $utc)
{
$payload = array();
$payload['order'] = $order;
if (is_numeric($offset)) {
$payload['offset'] = $offset;
}
if ($utc) {
$payload['utc'] = true;
}
return $p... | [
"protected",
"function",
"buildReorderProfileUpdatesPayload",
"(",
"$",
"order",
",",
"$",
"offset",
",",
"$",
"utc",
")",
"{",
"$",
"payload",
"=",
"array",
"(",
")",
";",
"$",
"payload",
"[",
"'order'",
"]",
"=",
"$",
"order",
";",
"if",
"(",
"is_num... | Build the payload for reorderProfileUpdates.
@param array $order
@param integer $offset
@param boolean $utc
@return array | [
"Build",
"the",
"payload",
"for",
"reorderProfileUpdates",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L251-L266 |
229,867 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.shuffleProfileUpdates | public function shuffleProfileUpdates($id, $count = null, $utc = false)
{
$payload = $this->buildShuffleProfileUpdatesPayload($count, $utc);
return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/updates/shuffle.json', null, $payload));
} | php | public function shuffleProfileUpdates($id, $count = null, $utc = false)
{
$payload = $this->buildShuffleProfileUpdatesPayload($count, $utc);
return $this->send($this->getHttp()->post($this->url.'profiles/'.$id.'/updates/shuffle.json', null, $payload));
} | [
"public",
"function",
"shuffleProfileUpdates",
"(",
"$",
"id",
",",
"$",
"count",
"=",
"null",
",",
"$",
"utc",
"=",
"false",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"buildShuffleProfileUpdatesPayload",
"(",
"$",
"count",
",",
"$",
"utc",
")",
... | Randomize the order at which statuses for the specified social media
profile will be sent out of the buffer.
@param string $id
@param integer $count
@param boolean $utc
@return array | [
"Randomize",
"the",
"order",
"at",
"which",
"statuses",
"for",
"the",
"specified",
"social",
"media",
"profile",
"will",
"be",
"sent",
"out",
"of",
"the",
"buffer",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L277-L282 |
229,868 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.buildShuffleProfileUpdatesPayload | protected function buildShuffleProfileUpdatesPayload($count, $utc)
{
$payload = array();
if (is_numeric($count)) {
$payload['count'] = $count;
}
if ($utc) {
$payload['utc'] = true;
}
return $payload;
} | php | protected function buildShuffleProfileUpdatesPayload($count, $utc)
{
$payload = array();
if (is_numeric($count)) {
$payload['count'] = $count;
}
if ($utc) {
$payload['utc'] = true;
}
return $payload;
} | [
"protected",
"function",
"buildShuffleProfileUpdatesPayload",
"(",
"$",
"count",
",",
"$",
"utc",
")",
"{",
"$",
"payload",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"count",
")",
")",
"{",
"$",
"payload",
"[",
"'count'",
"]",
"="... | Build the payload for shuffleProfileUpdates.
@param integer $count
@param boolean $utc
@return array | [
"Build",
"the",
"payload",
"for",
"shuffleProfileUpdates",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L291-L304 |
229,869 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.createUpdate | public function createUpdate(Update $update)
{
$payload = $this->buildCreateUpdatePayload($update);
return $this->send($this->getHttp()->post($this->url.'updates/create.json', null, $payload));
} | php | public function createUpdate(Update $update)
{
$payload = $this->buildCreateUpdatePayload($update);
return $this->send($this->getHttp()->post($this->url.'updates/create.json', null, $payload));
} | [
"public",
"function",
"createUpdate",
"(",
"Update",
"$",
"update",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"buildCreateUpdatePayload",
"(",
"$",
"update",
")",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
... | Create one or more new status updates.
@param \Ipalaus\Buffer\Update $update
@return array | [
"Create",
"one",
"or",
"more",
"new",
"status",
"updates",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L312-L317 |
229,870 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.buildCreateUpdatePayload | protected function buildCreateUpdatePayload(Update $update)
{
$payload = array(
'text' => $update->text,
'profile_ids' => $update->profiles,
'shorten' => $update->shorten,
'now' => $update->now,
'top' => $update->top,
'attachment' => $u... | php | protected function buildCreateUpdatePayload(Update $update)
{
$payload = array(
'text' => $update->text,
'profile_ids' => $update->profiles,
'shorten' => $update->shorten,
'now' => $update->now,
'top' => $update->top,
'attachment' => $u... | [
"protected",
"function",
"buildCreateUpdatePayload",
"(",
"Update",
"$",
"update",
")",
"{",
"$",
"payload",
"=",
"array",
"(",
"'text'",
"=>",
"$",
"update",
"->",
"text",
",",
"'profile_ids'",
"=>",
"$",
"update",
"->",
"profiles",
",",
"'shorten'",
"=>",
... | Build the payload for createUpdate.
@param \Ipalaus\Buffer\Update $update
@return array | [
"Build",
"the",
"payload",
"for",
"createUpdate",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L325-L345 |
229,871 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.updateUpdate | public function updateUpdate($id, Update $update)
{
$payload = $this->buildUpdateUpdatePayload($update);
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/update.json', null, $payload));
} | php | public function updateUpdate($id, Update $update)
{
$payload = $this->buildUpdateUpdatePayload($update);
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/update.json', null, $payload));
} | [
"public",
"function",
"updateUpdate",
"(",
"$",
"id",
",",
"Update",
"$",
"update",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"buildUpdateUpdatePayload",
"(",
"$",
"update",
")",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",... | Edit an existing, individual status update.
@param string $id
@param \Ipalaus\Buffer\Update $update
@return array | [
"Edit",
"an",
"existing",
"individual",
"status",
"update",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L354-L359 |
229,872 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.buildUpdateUpdatePayload | protected function buildUpdateUpdatePayload(Update $update)
{
$payload = array(
'text' => $update->text,
'now' => $update->now,
);
if ( ! empty($update->media)) {
$payload['media'] = $update->media;
}
if ( ! is_null($update->scheduled_at)... | php | protected function buildUpdateUpdatePayload(Update $update)
{
$payload = array(
'text' => $update->text,
'now' => $update->now,
);
if ( ! empty($update->media)) {
$payload['media'] = $update->media;
}
if ( ! is_null($update->scheduled_at)... | [
"protected",
"function",
"buildUpdateUpdatePayload",
"(",
"Update",
"$",
"update",
")",
"{",
"$",
"payload",
"=",
"array",
"(",
"'text'",
"=>",
"$",
"update",
"->",
"text",
",",
"'now'",
"=>",
"$",
"update",
"->",
"now",
",",
")",
";",
"if",
"(",
"!",
... | Build the payload for updateUpdate.
@param \Ipalaus\Buffer\Update $update
@return array | [
"Build",
"the",
"payload",
"for",
"updateUpdate",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L367-L383 |
229,873 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.shareUpdate | public function shareUpdate($id)
{
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/share.json'));
} | php | public function shareUpdate($id)
{
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/share.json'));
} | [
"public",
"function",
"shareUpdate",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
")",
"->",
"post",
"(",
"$",
"this",
"->",
"url",
".",
"'updates/'",
".",
"$",
"id",
".",
"'/share.json'",
"... | Immediately shares a single pending update and recalculates times for
updates remaining in the queue.
@param string $id
@return array | [
"Immediately",
"shares",
"a",
"single",
"pending",
"update",
"and",
"recalculates",
"times",
"for",
"updates",
"remaining",
"in",
"the",
"queue",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L392-L395 |
229,874 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.destroyUpdate | public function destroyUpdate($id)
{
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/destroy.json'));
} | php | public function destroyUpdate($id)
{
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/destroy.json'));
} | [
"public",
"function",
"destroyUpdate",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
")",
"->",
"post",
"(",
"$",
"this",
"->",
"url",
".",
"'updates/'",
".",
"$",
"id",
".",
"'/destroy.json'",... | Permanently delete an existing status update.
@param string $id
@return array | [
"Permanently",
"delete",
"an",
"existing",
"status",
"update",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L403-L406 |
229,875 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.moveUpdateToTop | public function moveUpdateToTop($id)
{
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/move_to_top.json'));
} | php | public function moveUpdateToTop($id)
{
return $this->send($this->getHttp()->post($this->url.'updates/'.$id.'/move_to_top.json'));
} | [
"public",
"function",
"moveUpdateToTop",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
")",
"->",
"post",
"(",
"$",
"this",
"->",
"url",
".",
"'updates/'",
".",
"$",
"id",
".",
"'/move_to_top.j... | Move an existing status update to the top of the queue and recalculate
times for all updates in the queue. Returns the update with its new
posting time.
@param string $id
@return array | [
"Move",
"an",
"existing",
"status",
"update",
"to",
"the",
"top",
"of",
"the",
"queue",
"and",
"recalculate",
"times",
"for",
"all",
"updates",
"in",
"the",
"queue",
".",
"Returns",
"the",
"update",
"with",
"its",
"new",
"posting",
"time",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L416-L419 |
229,876 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.getLinkShares | public function getLinkShares($url)
{
$payload = http_build_query(array('url' => $url));
return $this->send($this->getHttp()->get($this->url.'links/shares.json?'.$payload));
} | php | public function getLinkShares($url)
{
$payload = http_build_query(array('url' => $url));
return $this->send($this->getHttp()->get($this->url.'links/shares.json?'.$payload));
} | [
"public",
"function",
"getLinkShares",
"(",
"$",
"url",
")",
"{",
"$",
"payload",
"=",
"http_build_query",
"(",
"array",
"(",
"'url'",
"=>",
"$",
"url",
")",
")",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"this",
"->",
"getHttp",
"(",
")",
... | Returns an object with a the numbers of shares a link has had using
Buffer.
@param string $url
@return array | [
"Returns",
"an",
"object",
"with",
"a",
"the",
"numbers",
"of",
"shares",
"a",
"link",
"has",
"had",
"using",
"Buffer",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L428-L433 |
229,877 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Client.php | Client.send | protected function send(Request $request)
{
$request = $this->auth->addCredentialsToRequest($request);
return $request->send()->json();
} | php | protected function send(Request $request)
{
$request = $this->auth->addCredentialsToRequest($request);
return $request->send()->json();
} | [
"protected",
"function",
"send",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"auth",
"->",
"addCredentialsToRequest",
"(",
"$",
"request",
")",
";",
"return",
"$",
"request",
"->",
"send",
"(",
")",
"->",
"json",
"... | Send an authorized request and the response as an array.
@param \Guzzle\Http\Message\Request $request
@return array | [
"Send",
"an",
"authorized",
"request",
"and",
"the",
"response",
"as",
"an",
"array",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Client.php#L457-L462 |
229,878 | Webiny/Framework | src/Webiny/Component/Rest/Parser/ParameterParser.php | ParameterParser.parse | public function parse()
{
if (!is_array($this->paramList)) {
return [];
}
$parsedParams = [];
foreach ($this->paramList as $p) {
$param = new ParsedParameter();
$param->name = $p->name;
$param->type = $this->getType($p->name, $this->pa... | php | public function parse()
{
if (!is_array($this->paramList)) {
return [];
}
$parsedParams = [];
foreach ($this->paramList as $p) {
$param = new ParsedParameter();
$param->name = $p->name;
$param->type = $this->getType($p->name, $this->pa... | [
"public",
"function",
"parse",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"paramList",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"parsedParams",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"paramList",
"... | Parses all the parameters and return an array of ParsedParameter instances.
@return array Array of ParsedParameter instances. | [
"Parses",
"all",
"the",
"parameters",
"and",
"return",
"an",
"array",
"of",
"ParsedParameter",
"instances",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/ParameterParser.php#L72-L99 |
229,879 | Webiny/Framework | src/Webiny/Component/Rest/Parser/ParameterParser.php | ParameterParser.getType | private function getType($pName, $annotations)
{
$type = 'string';
foreach ($annotations as $a) {
if (strpos($a, '$' . $pName)) {
foreach (self::$paramTypes as $typeKey => $typeList) {
foreach ($typeList as $t) {
if (strpos(trim... | php | private function getType($pName, $annotations)
{
$type = 'string';
foreach ($annotations as $a) {
if (strpos($a, '$' . $pName)) {
foreach (self::$paramTypes as $typeKey => $typeList) {
foreach ($typeList as $t) {
if (strpos(trim... | [
"private",
"function",
"getType",
"(",
"$",
"pName",
",",
"$",
"annotations",
")",
"{",
"$",
"type",
"=",
"'string'",
";",
"foreach",
"(",
"$",
"annotations",
"as",
"$",
"a",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"a",
",",
"'$'",
".",
"$",
"pN... | Tries to detect the type of a parameter based on its phpDoc block.
If type is not detected, "string" is returned as the default type.
@param string $pName Name of the parameter.
@param ConfigObject $annotations Parameter annotations.
@return string Name of the parameter type, based on keys in static::$par... | [
"Tries",
"to",
"detect",
"the",
"type",
"of",
"a",
"parameter",
"based",
"on",
"its",
"phpDoc",
"block",
".",
"If",
"type",
"is",
"not",
"detected",
"string",
"is",
"returned",
"as",
"the",
"default",
"type",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Rest/Parser/ParameterParser.php#L110-L126 |
229,880 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Schedule.php | Schedule.addDay | public function addDay($day)
{
$available = array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');
foreach ((array) $day as $value) {
// only accept valid values
if ( ! in_array($value, $available)) {
throw new InvalidArgumentException('Day must be a valid v... | php | public function addDay($day)
{
$available = array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');
foreach ((array) $day as $value) {
// only accept valid values
if ( ! in_array($value, $available)) {
throw new InvalidArgumentException('Day must be a valid v... | [
"public",
"function",
"addDay",
"(",
"$",
"day",
")",
"{",
"$",
"available",
"=",
"array",
"(",
"'mon'",
",",
"'tue'",
",",
"'wed'",
",",
"'thu'",
",",
"'fri'",
",",
"'sat'",
",",
"'sun'",
")",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"day",
... | Schedule a new day.
@param string|array $day
@return \Ipalaus\Buffer\Schedule | [
"Schedule",
"a",
"new",
"day",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Schedule.php#L48-L62 |
229,881 | ipalaus/buffer-php-sdk | src/Ipalaus/Buffer/Schedule.php | Schedule.addTime | public function addTime($time)
{
foreach ((array) $time as $value) {
// only accept valid times (HH:mm)
if ( ! preg_match('#([01][0-9]|2[0-3]):[0-5][0-9]#', $value)) {
throw new InvalidArgumentException('Time must be valid: HH:mm.');
}
$this->... | php | public function addTime($time)
{
foreach ((array) $time as $value) {
// only accept valid times (HH:mm)
if ( ! preg_match('#([01][0-9]|2[0-3]):[0-5][0-9]#', $value)) {
throw new InvalidArgumentException('Time must be valid: HH:mm.');
}
$this->... | [
"public",
"function",
"addTime",
"(",
"$",
"time",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"time",
"as",
"$",
"value",
")",
"{",
"// only accept valid times (HH:mm)",
"if",
"(",
"!",
"preg_match",
"(",
"'#([01][0-9]|2[0-3]):[0-5][0-9]#'",
",",
"$",
... | Schedule a time.
@param string|array $time
@return \Ipalaus\Buffer\Schedule | [
"Schedule",
"a",
"time",
"."
] | f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f | https://github.com/ipalaus/buffer-php-sdk/blob/f9314df3510f1dcdd6b3d5f618ce845c5f56bd5f/src/Ipalaus/Buffer/Schedule.php#L70-L82 |
229,882 | Webiny/Framework | src/Webiny/Component/OAuth2/Server/Facebook.php | Facebook.processAuthResponse | public function processAuthResponse($response)
{
if (!$this->isArray($response)) {
throw new OAuth2Exception('Invalid response while trying to get the access token.');
}
if (isset($response['result']['error'])) {
throw new OAuth2Exception($this->jsonEncode($response[... | php | public function processAuthResponse($response)
{
if (!$this->isArray($response)) {
throw new OAuth2Exception('Invalid response while trying to get the access token.');
}
if (isset($response['result']['error'])) {
throw new OAuth2Exception($this->jsonEncode($response[... | [
"public",
"function",
"processAuthResponse",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isArray",
"(",
"$",
"response",
")",
")",
"{",
"throw",
"new",
"OAuth2Exception",
"(",
"'Invalid response while trying to get the access token.'",
")",... | This method is called when user is redirected to the redirect_uri from the authorization step.
Here you should process the response from OAuth2 server and extract the access token if possible.
If you cannot get the access token, throw an exception.
@param array $response Response from the OAuth2 server.
@throws \Webi... | [
"This",
"method",
"is",
"called",
"when",
"user",
"is",
"redirected",
"to",
"the",
"redirect_uri",
"from",
"the",
"authorization",
"step",
".",
"Here",
"you",
"should",
"process",
"the",
"response",
"from",
"OAuth2",
"server",
"and",
"extract",
"the",
"access"... | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/OAuth2/Server/Facebook.php#L75-L88 |
229,883 | Fanamurov/larrock-core | src/Traits/GetLink.php | GetLink.linkQuery | public function linkQuery($childModel)
{
return $this->hasMany(Link::class, 'id_parent')->whereModelParent($this->config->model)->whereModelChild($childModel);
} | php | public function linkQuery($childModel)
{
return $this->hasMany(Link::class, 'id_parent')->whereModelParent($this->config->model)->whereModelChild($childModel);
} | [
"public",
"function",
"linkQuery",
"(",
"$",
"childModel",
")",
"{",
"return",
"$",
"this",
"->",
"hasMany",
"(",
"Link",
"::",
"class",
",",
"'id_parent'",
")",
"->",
"whereModelParent",
"(",
"$",
"this",
"->",
"config",
"->",
"model",
")",
"->",
"where... | Get link query builder.
@param $childModel
@return mixed | [
"Get",
"link",
"query",
"builder",
"."
] | bce1d297182a829453f411d29371ec2a78d62960 | https://github.com/Fanamurov/larrock-core/blob/bce1d297182a829453f411d29371ec2a78d62960/src/Traits/GetLink.php#L15-L18 |
229,884 | Fanamurov/larrock-core | src/Traits/GetLink.php | GetLink.link | public function link($childModel)
{
return $this->hasMany(Link::class, 'id_parent')->whereModelParent($this->config->model)->whereModelChild($childModel)->get();
} | php | public function link($childModel)
{
return $this->hasMany(Link::class, 'id_parent')->whereModelParent($this->config->model)->whereModelChild($childModel)->get();
} | [
"public",
"function",
"link",
"(",
"$",
"childModel",
")",
"{",
"return",
"$",
"this",
"->",
"hasMany",
"(",
"Link",
"::",
"class",
",",
"'id_parent'",
")",
"->",
"whereModelParent",
"(",
"$",
"this",
"->",
"config",
"->",
"model",
")",
"->",
"whereModel... | Get link data.
@param $childModel
@return mixed | [
"Get",
"link",
"data",
"."
] | bce1d297182a829453f411d29371ec2a78d62960 | https://github.com/Fanamurov/larrock-core/blob/bce1d297182a829453f411d29371ec2a78d62960/src/Traits/GetLink.php#L25-L28 |
229,885 | Fanamurov/larrock-core | src/Traits/GetLink.php | GetLink.linkAttribute | public function linkAttribute($childModel)
{
$this->{$childModel} = $this->hasMany(Link::class, 'id_parent')->whereModelParent($this->config->model)->whereModelChild($childModel)->get();
return $this;
} | php | public function linkAttribute($childModel)
{
$this->{$childModel} = $this->hasMany(Link::class, 'id_parent')->whereModelParent($this->config->model)->whereModelChild($childModel)->get();
return $this;
} | [
"public",
"function",
"linkAttribute",
"(",
"$",
"childModel",
")",
"{",
"$",
"this",
"->",
"{",
"$",
"childModel",
"}",
"=",
"$",
"this",
"->",
"hasMany",
"(",
"Link",
"::",
"class",
",",
"'id_parent'",
")",
"->",
"whereModelParent",
"(",
"$",
"this",
... | Get Model Component + link in attrubute.
@param $childModel
@return $this | [
"Get",
"Model",
"Component",
"+",
"link",
"in",
"attrubute",
"."
] | bce1d297182a829453f411d29371ec2a78d62960 | https://github.com/Fanamurov/larrock-core/blob/bce1d297182a829453f411d29371ec2a78d62960/src/Traits/GetLink.php#L45-L50 |
229,886 | Webiny/Framework | src/Webiny/Component/Entity/EntityAttributeContainer.php | EntityAttributeContainer.attr | public function attr($attribute)
{
if (strpos($attribute, '_') !== false) {
throw new EntityException('Underscore is not allowed in attribute names (found in \'' . $attribute . '\')');
}
$this->attribute = $attribute;
return $this;
} | php | public function attr($attribute)
{
if (strpos($attribute, '_') !== false) {
throw new EntityException('Underscore is not allowed in attribute names (found in \'' . $attribute . '\')');
}
$this->attribute = $attribute;
return $this;
} | [
"public",
"function",
"attr",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"attribute",
",",
"'_'",
")",
"!==",
"false",
")",
"{",
"throw",
"new",
"EntityException",
"(",
"'Underscore is not allowed in attribute names (found in \\''",
".",
"$"... | Create a new attribute
@param $attribute
@return $this
@throws EntityException | [
"Create",
"a",
"new",
"attribute"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/EntityAttributeContainer.php#L70-L79 |
229,887 | Webiny/Framework | src/Webiny/Component/Entity/EntityAttributeContainer.php | EntityAttributeContainer.smart | public function smart(AbstractAttribute $attribute)
{
$attribute->setName($this->attribute)->setParent($this->entity);
return $this->attributes[$this->attribute] = $attribute;
} | php | public function smart(AbstractAttribute $attribute)
{
$attribute->setName($this->attribute)->setParent($this->entity);
return $this->attributes[$this->attribute] = $attribute;
} | [
"public",
"function",
"smart",
"(",
"AbstractAttribute",
"$",
"attribute",
")",
"{",
"$",
"attribute",
"->",
"setName",
"(",
"$",
"this",
"->",
"attribute",
")",
"->",
"setParent",
"(",
"$",
"this",
"->",
"entity",
")",
";",
"return",
"$",
"this",
"->",
... | Set attribute instance
@param AbstractAttribute $attribute
@return AbstractAttribute | [
"Set",
"attribute",
"instance"
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Entity/EntityAttributeContainer.php#L101-L106 |
229,888 | Webiny/Framework | src/Webiny/Component/Http/Request/Files.php | Files.createFileObject | private function createFileObject($file, $arrayOffset = null)
{
if (!is_null($arrayOffset)) {
$fileObject = new File($file['name'][$arrayOffset], $file['tmp_name'][$arrayOffset], $file['type'][$arrayOffset],
$file['error'][$arrayOffset], $file['size'][$arrayOffset]);
... | php | private function createFileObject($file, $arrayOffset = null)
{
if (!is_null($arrayOffset)) {
$fileObject = new File($file['name'][$arrayOffset], $file['tmp_name'][$arrayOffset], $file['type'][$arrayOffset],
$file['error'][$arrayOffset], $file['size'][$arrayOffset]);
... | [
"private",
"function",
"createFileObject",
"(",
"$",
"file",
",",
"$",
"arrayOffset",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"arrayOffset",
")",
")",
"{",
"$",
"fileObject",
"=",
"new",
"File",
"(",
"$",
"file",
"[",
"'name'",
"]... | Create the File object.
@param array $file
@param null $arrayOffset
@return File | [
"Create",
"the",
"File",
"object",
"."
] | 2ca7fb238999387e54a1eea8c5cb4735de9022a7 | https://github.com/Webiny/Framework/blob/2ca7fb238999387e54a1eea8c5cb4735de9022a7/src/Webiny/Component/Http/Request/Files.php#L86-L98 |
229,889 | deanblackborough/zf3-view-helpers | src/Bootstrap4Column.php | Bootstrap4Column.lg | public function lg(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->lg_size = $size;
}
return $this;
} | php | public function lg(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->lg_size = $size;
}
return $this;
} | [
"public",
"function",
"lg",
"(",
"int",
"$",
"size",
")",
":",
"Bootstrap4Column",
"{",
"if",
"(",
"$",
"this",
"->",
"validateColumnSize",
"(",
"$",
"size",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"lg_size",
"=",
"$",
"size",
";",
"}",
"r... | Large 'lg' column
@param integer $size Number of lg columns, a value between 1 and 12
@return Bootstrap4Column | [
"Large",
"lg",
"column"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Column.php#L69-L76 |
229,890 | deanblackborough/zf3-view-helpers | src/Bootstrap4Column.php | Bootstrap4Column.md | public function md(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->md_size = $size;
}
return $this;
} | php | public function md(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->md_size = $size;
}
return $this;
} | [
"public",
"function",
"md",
"(",
"int",
"$",
"size",
")",
":",
"Bootstrap4Column",
"{",
"if",
"(",
"$",
"this",
"->",
"validateColumnSize",
"(",
"$",
"size",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"md_size",
"=",
"$",
"size",
";",
"}",
"r... | Medium 'md' column
@param integer $size Number of md columns, a value between 1 and 12
@return Bootstrap4Column | [
"Medium",
"md",
"column"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Column.php#L85-L92 |
229,891 | deanblackborough/zf3-view-helpers | src/Bootstrap4Column.php | Bootstrap4Column.sm | public function sm(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->sm_size = $size;
}
return $this;
} | php | public function sm(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->sm_size = $size;
}
return $this;
} | [
"public",
"function",
"sm",
"(",
"int",
"$",
"size",
")",
":",
"Bootstrap4Column",
"{",
"if",
"(",
"$",
"this",
"->",
"validateColumnSize",
"(",
"$",
"size",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"sm_size",
"=",
"$",
"size",
";",
"}",
"r... | Small 'sm' column
@param integer $size Number of sm columns, a value between 1 and 12
@return Bootstrap4Column | [
"Small",
"sm",
"column"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Column.php#L131-L138 |
229,892 | deanblackborough/zf3-view-helpers | src/Bootstrap4Column.php | Bootstrap4Column.xl | public function xl(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->xl_size = $size;
}
return $this;
} | php | public function xl(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->xl_size = $size;
}
return $this;
} | [
"public",
"function",
"xl",
"(",
"int",
"$",
"size",
")",
":",
"Bootstrap4Column",
"{",
"if",
"(",
"$",
"this",
"->",
"validateColumnSize",
"(",
"$",
"size",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"xl_size",
"=",
"$",
"size",
";",
"}",
"r... | Extra large 'xl' column
@param integer $size Number of xl columns, a value between 1 and 12
@return Bootstrap4Column | [
"Extra",
"large",
"xl",
"column"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Column.php#L147-L154 |
229,893 | deanblackborough/zf3-view-helpers | src/Bootstrap4Column.php | Bootstrap4Column.xs | public function xs(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->xs_size = $size;
}
return $this;
} | php | public function xs(int $size): Bootstrap4Column
{
if ($this->validateColumnSize($size) === true) {
$this->xs_size = $size;
}
return $this;
} | [
"public",
"function",
"xs",
"(",
"int",
"$",
"size",
")",
":",
"Bootstrap4Column",
"{",
"if",
"(",
"$",
"this",
"->",
"validateColumnSize",
"(",
"$",
"size",
")",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"xs_size",
"=",
"$",
"size",
";",
"}",
"r... | Extra small column
@param integer $size Number of xs columns, a value between 1 and 12
@return Bootstrap4Column | [
"Extra",
"small",
"column"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Column.php#L163-L170 |
229,894 | deanblackborough/zf3-view-helpers | src/Bootstrap4Column.php | Bootstrap4Column.classes | private function classes() : string
{
$classes = '';
if ($this->xl_size !== null) {
$classes .= ' col-xl-' . $this->xl_size;
}
if ($this->lg_size !== null) {
$classes .= ' col-lg-' . $this->lg_size;
}
if ($this->md_size !== null) {
... | php | private function classes() : string
{
$classes = '';
if ($this->xl_size !== null) {
$classes .= ' col-xl-' . $this->xl_size;
}
if ($this->lg_size !== null) {
$classes .= ' col-lg-' . $this->lg_size;
}
if ($this->md_size !== null) {
... | [
"private",
"function",
"classes",
"(",
")",
":",
"string",
"{",
"$",
"classes",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"xl_size",
"!==",
"null",
")",
"{",
"$",
"classes",
".=",
"' col-xl-'",
".",
"$",
"this",
"->",
"xl_size",
";",
"}",
"if",... | Generate the classes string for the row
@return string | [
"Generate",
"the",
"classes",
"string",
"for",
"the",
"row"
] | db8bea4ca62709b2ac8c732aedbb2a5235223f23 | https://github.com/deanblackborough/zf3-view-helpers/blob/db8bea4ca62709b2ac8c732aedbb2a5235223f23/src/Bootstrap4Column.php#L177-L210 |
229,895 | addiks/phpsql | src/Addiks/PHPSQL/Value/Text/Annotation.php | Annotation.parseData | protected function parseData()
{
if (is_null($this->dataCache)) {
$patternNamespace = '(?P<namespace>[a-zA-Z0-9\\\\]+\\\\)?';
$patternName = '(?P<name>[a-zA-Z0-9]+)';
$patternString = '\"[^\"]*\"|\'[^\']*\'';
$patternFloat = '[0-9]+\.[0-9]+';
... | php | protected function parseData()
{
if (is_null($this->dataCache)) {
$patternNamespace = '(?P<namespace>[a-zA-Z0-9\\\\]+\\\\)?';
$patternName = '(?P<name>[a-zA-Z0-9]+)';
$patternString = '\"[^\"]*\"|\'[^\']*\'';
$patternFloat = '[0-9]+\.[0-9]+';
... | [
"protected",
"function",
"parseData",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"dataCache",
")",
")",
"{",
"$",
"patternNamespace",
"=",
"'(?P<namespace>[a-zA-Z0-9\\\\\\\\]+\\\\\\\\)?'",
";",
"$",
"patternName",
"=",
"'(?P<name>[a-zA-Z0-9]+)'",
... | Parses the annotation-line down to its components.
array(
'namespace' => $namespace,
'name' => $name,
'attributes' => array(
'someKey' => 'someValue',
'otherKey' => 'otherValue',
),
'tags' => array(
'foo',
'bar',
'baz'
)
)
@return array | [
"Parses",
"the",
"annotation",
"-",
"line",
"down",
"to",
"its",
"components",
"."
] | 28dae64ffc2123f39f801a50ab53bfe29890cbd9 | https://github.com/addiks/phpsql/blob/28dae64ffc2123f39f801a50ab53bfe29890cbd9/src/Addiks/PHPSQL/Value/Text/Annotation.php#L84-L142 |
229,896 | clickalicious/rng | src/Generator.php | Generator.generateSeed | public function generateSeed()
{
list($usec, $sec) = explode(' ', microtime());
return (int)($sec + strrev($usec * 1000000)) + 13;
} | php | public function generateSeed()
{
list($usec, $sec) = explode(' ', microtime());
return (int)($sec + strrev($usec * 1000000)) + 13;
} | [
"public",
"function",
"generateSeed",
"(",
")",
"{",
"list",
"(",
"$",
"usec",
",",
"$",
"sec",
")",
"=",
"explode",
"(",
"' '",
",",
"microtime",
"(",
")",
")",
";",
"return",
"(",
"int",
")",
"(",
"$",
"sec",
"+",
"strrev",
"(",
"$",
"usec",
... | Generate the seed from microtime.
@author Benjamin Carl <opensource@clickalicious.de>
@return int The seed value | [
"Generate",
"the",
"seed",
"from",
"microtime",
"."
] | 9ee48ac4c5a9000e5776559715d027228a015bf9 | https://github.com/clickalicious/rng/blob/9ee48ac4c5a9000e5776559715d027228a015bf9/src/Generator.php#L194-L199 |
229,897 | clickalicious/rng | src/Generator.php | Generator.getRandomBytes | public function getRandomBytes(
$numberOfBytes = PHP_INT_MAX,
$source = null
)
{
switch ($source) {
case self::MODE_OPEN_SSL:
$randomBytes = $this->getRandomBytesFromOpenSSL($numberOfBytes);
break;
default:
// http... | php | public function getRandomBytes(
$numberOfBytes = PHP_INT_MAX,
$source = null
)
{
switch ($source) {
case self::MODE_OPEN_SSL:
$randomBytes = $this->getRandomBytesFromOpenSSL($numberOfBytes);
break;
default:
// http... | [
"public",
"function",
"getRandomBytes",
"(",
"$",
"numberOfBytes",
"=",
"PHP_INT_MAX",
",",
"$",
"source",
"=",
"null",
")",
"{",
"switch",
"(",
"$",
"source",
")",
"{",
"case",
"self",
"::",
"MODE_OPEN_SSL",
":",
"$",
"randomBytes",
"=",
"$",
"this",
"-... | Returns random bytes secure for cryptographic context.
@param int $numberOfBytes Number of bytes to read and return.
@param int|null $source Source of random bytes.
@author Benjamin Carl <opensource@clickalicious.de>
@return string Random bytes
@throws \Clickalicious\Rng\Exception
@throws \Clickalicious... | [
"Returns",
"random",
"bytes",
"secure",
"for",
"cryptographic",
"context",
"."
] | 9ee48ac4c5a9000e5776559715d027228a015bf9 | https://github.com/clickalicious/rng/blob/9ee48ac4c5a9000e5776559715d027228a015bf9/src/Generator.php#L214-L232 |
229,898 | clickalicious/rng | src/Generator.php | Generator.genericRand | protected function genericRand(
$rangeMinimum,
$rangeMaximum,
$source = self::MODE_OPEN_SSL
)
{
$diff = $rangeMaximum - ($rangeMinimum + 1);
if ($diff > PHP_INT_MAX) {
throw new Exception('Bad range');
}
// The largest *multiple* of diff less... | php | protected function genericRand(
$rangeMinimum,
$rangeMaximum,
$source = self::MODE_OPEN_SSL
)
{
$diff = $rangeMaximum - ($rangeMinimum + 1);
if ($diff > PHP_INT_MAX) {
throw new Exception('Bad range');
}
// The largest *multiple* of diff less... | [
"protected",
"function",
"genericRand",
"(",
"$",
"rangeMinimum",
",",
"$",
"rangeMaximum",
",",
"$",
"source",
"=",
"self",
"::",
"MODE_OPEN_SSL",
")",
"{",
"$",
"diff",
"=",
"$",
"rangeMaximum",
"-",
"(",
"$",
"rangeMinimum",
"+",
"1",
")",
";",
"if",
... | "OpenSSL" based equivalent to rand & mt_rand but better randomness.
@param int $rangeMinimum The minimum range border for randomizer
@param int $rangeMaximum The maximum range border for randomizer
@param int $source The source of the random bytes (OpenSSL, ...)
@author Benjamin Carl <opensource@clickalicious.d... | [
"OpenSSL",
"based",
"equivalent",
"to",
"rand",
"&",
"mt_rand",
"but",
"better",
"randomness",
"."
] | 9ee48ac4c5a9000e5776559715d027228a015bf9 | https://github.com/clickalicious/rng/blob/9ee48ac4c5a9000e5776559715d027228a015bf9/src/Generator.php#L282-L334 |
229,899 | clickalicious/rng | src/Generator.php | Generator.getRandomBytesFromOpenSSL | protected function getRandomBytesFromOpenSSL($numberOfBytes)
{
$randomBytes = openssl_random_pseudo_bytes($numberOfBytes, $cryptographicStrong);
$this->setCryptographicStrong($cryptographicStrong);
if (false === $randomBytes || '' === $randomBytes || false === $cryptographicStrong) {
... | php | protected function getRandomBytesFromOpenSSL($numberOfBytes)
{
$randomBytes = openssl_random_pseudo_bytes($numberOfBytes, $cryptographicStrong);
$this->setCryptographicStrong($cryptographicStrong);
if (false === $randomBytes || '' === $randomBytes || false === $cryptographicStrong) {
... | [
"protected",
"function",
"getRandomBytesFromOpenSSL",
"(",
"$",
"numberOfBytes",
")",
"{",
"$",
"randomBytes",
"=",
"openssl_random_pseudo_bytes",
"(",
"$",
"numberOfBytes",
",",
"$",
"cryptographicStrong",
")",
";",
"$",
"this",
"->",
"setCryptographicStrong",
"(",
... | Returns random bytes from OpenSSL.
@param int $numberOfBytes Number of bytes to read and return
@author Benjamin Carl <opensource@clickalicious.de>
@return string The random bytes
@throws \Clickalicious\Rng\CryptographicWeaknessException | [
"Returns",
"random",
"bytes",
"from",
"OpenSSL",
"."
] | 9ee48ac4c5a9000e5776559715d027228a015bf9 | https://github.com/clickalicious/rng/blob/9ee48ac4c5a9000e5776559715d027228a015bf9/src/Generator.php#L347-L360 |
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.