repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jails/li3_tree | extensions/data/behavior/Tree.php | Tree.moveDown | public function moveDown($entity) {
extract($this->_config);
$next = $model::find('first', [
'conditions' => [
$parent => $entity->$parent,
$left => $entity->$right + 1
]]);
if ($next !== null) {
$spanToZero = $entity->$right;
$rangeX = ['floor' => $entity->$left, 'ceiling' => $entity-... | php | public function moveDown($entity) {
extract($this->_config);
$next = $model::find('first', [
'conditions' => [
$parent => $entity->$parent,
$left => $entity->$right + 1
]]);
if ($next !== null) {
$spanToZero = $entity->$right;
$rangeX = ['floor' => $entity->$left, 'ceiling' => $entity-... | [
"public",
"function",
"moveDown",
"(",
"$",
"entity",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"_config",
")",
";",
"$",
"next",
"=",
"$",
"model",
"::",
"find",
"(",
"'first'",
",",
"[",
"'conditions'",
"=>",
"[",
"$",
"parent",
"=>",
"$",
"en... | Moves an element down in order
@param object $entity The Entity to move down | [
"Moves",
"an",
"element",
"down",
"in",
"order"
] | 43fdbe9c621f1f712131c6a338bb5421da67fc17 | https://github.com/jails/li3_tree/blob/43fdbe9c621f1f712131c6a338bb5421da67fc17/extensions/data/behavior/Tree.php#L420-L446 | train |
jails/li3_tree | extensions/data/behavior/Tree.php | Tree.moveUp | public function moveUp($entity) {
extract($this->_config);
$prev = $model::find('first', [
'conditions' => [
$parent => $entity->$parent,
$right => $entity->$left - 1
]
]);
if (!$prev) {
return true;
}
$spanToZero = $entity->$right;
$rangeX = ['floor' => $entity->$left, 'ceiling' => $enti... | php | public function moveUp($entity) {
extract($this->_config);
$prev = $model::find('first', [
'conditions' => [
$parent => $entity->$parent,
$right => $entity->$left - 1
]
]);
if (!$prev) {
return true;
}
$spanToZero = $entity->$right;
$rangeX = ['floor' => $entity->$left, 'ceiling' => $enti... | [
"public",
"function",
"moveUp",
"(",
"$",
"entity",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"_config",
")",
";",
"$",
"prev",
"=",
"$",
"model",
"::",
"find",
"(",
"'first'",
",",
"[",
"'conditions'",
"=>",
"[",
"$",
"parent",
"=>",
"$",
"enti... | Moves an element up in order
@param object $entity The Entity to move up | [
"Moves",
"an",
"element",
"up",
"in",
"order"
] | 43fdbe9c621f1f712131c6a338bb5421da67fc17 | https://github.com/jails/li3_tree/blob/43fdbe9c621f1f712131c6a338bb5421da67fc17/extensions/data/behavior/Tree.php#L453-L480 | train |
jails/li3_tree | extensions/data/behavior/Tree.php | Tree._getPosition | protected function _getPosition($entity, $childrenCount = false) {
extract($this->_config);
$parent = $this->_getById($entity->$parent);
if ($entity->$left === ($parent->$left + 1)) {
return 0;
}
if (($entity->$right + 1) === $parent->$right) {
if ($childrenCount === false) {
$childrenCount = $pa... | php | protected function _getPosition($entity, $childrenCount = false) {
extract($this->_config);
$parent = $this->_getById($entity->$parent);
if ($entity->$left === ($parent->$left + 1)) {
return 0;
}
if (($entity->$right + 1) === $parent->$right) {
if ($childrenCount === false) {
$childrenCount = $pa... | [
"protected",
"function",
"_getPosition",
"(",
"$",
"entity",
",",
"$",
"childrenCount",
"=",
"false",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"_config",
")",
";",
"$",
"parent",
"=",
"$",
"this",
"->",
"_getById",
"(",
"$",
"entity",
"->",
"$",
... | Returns the current position number of an element at the same level,
where 0 is first position
@param object $entity the entity node to get the position from.
@param integer $childrenCount number of children of entity's parent,
performance parameter to avoid double select. | [
"Returns",
"the",
"current",
"position",
"number",
"of",
"an",
"element",
"at",
"the",
"same",
"level",
"where",
"0",
"is",
"first",
"position"
] | 43fdbe9c621f1f712131c6a338bb5421da67fc17 | https://github.com/jails/li3_tree/blob/43fdbe9c621f1f712131c6a338bb5421da67fc17/extensions/data/behavior/Tree.php#L509-L537 | train |
alphacomm/alpharpc | src/AlphaRPC/Client/AlphaRPCStatus.php | AlphaRPCStatus.queueStatus | public function queueStatus($manager)
{
$socket = $this->getSocket($manager);
$stream = $socket->getStream();
$stream->send(new QueueStatusRequest());
$msg = $stream->read(new TimeoutTimer(1500));
if (!$msg instanceof QueueStatusResponse) {
throw new RuntimeExce... | php | public function queueStatus($manager)
{
$socket = $this->getSocket($manager);
$stream = $socket->getStream();
$stream->send(new QueueStatusRequest());
$msg = $stream->read(new TimeoutTimer(1500));
if (!$msg instanceof QueueStatusResponse) {
throw new RuntimeExce... | [
"public",
"function",
"queueStatus",
"(",
"$",
"manager",
")",
"{",
"$",
"socket",
"=",
"$",
"this",
"->",
"getSocket",
"(",
"$",
"manager",
")",
";",
"$",
"stream",
"=",
"$",
"socket",
"->",
"getStream",
"(",
")",
";",
"$",
"stream",
"->",
"send",
... | Requests the queue status.
@param string $manager
@return array
@throws \RuntimeException | [
"Requests",
"the",
"queue",
"status",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/AlphaRPCStatus.php#L70-L83 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/service/HCServiceFormValidators.php | HCServiceFormValidators.optimize | public function optimize (stdClass $data)
{
$data->formValidationName = $data->serviceName . 'Validator';
$data->formValidationNameSpace = str_replace ('\\http\\controllers', '\\validators', $data->controllerNamespace);
$data->formValidationDestination = str_replace ('/http/controllers', '/v... | php | public function optimize (stdClass $data)
{
$data->formValidationName = $data->serviceName . 'Validator';
$data->formValidationNameSpace = str_replace ('\\http\\controllers', '\\validators', $data->controllerNamespace);
$data->formValidationDestination = str_replace ('/http/controllers', '/v... | [
"public",
"function",
"optimize",
"(",
"stdClass",
"$",
"data",
")",
"{",
"$",
"data",
"->",
"formValidationName",
"=",
"$",
"data",
"->",
"serviceName",
".",
"'Validator'",
";",
"$",
"data",
"->",
"formValidationNameSpace",
"=",
"str_replace",
"(",
"'\\\\http... | Optimizing configuration for form creation
@param stdClass $data
@return stdClass | [
"Optimizing",
"configuration",
"for",
"form",
"creation"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/service/HCServiceFormValidators.php#L21-L33 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/service/HCServiceFormValidators.php | HCServiceFormValidators.generate | public function generate (stdClass $data)
{
$files = [];
$this->createFileFromTemplate ([
"destination" => $data->formValidationDestination,
"templateDestination" => __DIR__ . '/../templates/service/validator.hctpl',
"content" => [
... | php | public function generate (stdClass $data)
{
$files = [];
$this->createFileFromTemplate ([
"destination" => $data->formValidationDestination,
"templateDestination" => __DIR__ . '/../templates/service/validator.hctpl',
"content" => [
... | [
"public",
"function",
"generate",
"(",
"stdClass",
"$",
"data",
")",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"createFileFromTemplate",
"(",
"[",
"\"destination\"",
"=>",
"$",
"data",
"->",
"formValidationDestination",
",",
"\"templateDestinat... | Generating validator files
@param stdClass $data
@return array | [
"Generating",
"validator",
"files"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/service/HCServiceFormValidators.php#L41-L73 | train |
pmdevelopment/tool-bundle | Components/Helper/ComposerHelper.php | ComposerHelper.getConsoleDir | public static function getConsoleDir()
{
$rootDir = sprintf('%s/../../../../../../../..', __DIR__);
$paths = [
'bin',
'app',
];
foreach ($paths as $path) {
$fullPath = sprintf('%s/%s', $rootDir, $path);
if (true === is_dir($fullPath)... | php | public static function getConsoleDir()
{
$rootDir = sprintf('%s/../../../../../../../..', __DIR__);
$paths = [
'bin',
'app',
];
foreach ($paths as $path) {
$fullPath = sprintf('%s/%s', $rootDir, $path);
if (true === is_dir($fullPath)... | [
"public",
"static",
"function",
"getConsoleDir",
"(",
")",
"{",
"$",
"rootDir",
"=",
"sprintf",
"(",
"'%s/../../../../../../../..'",
",",
"__DIR__",
")",
";",
"$",
"paths",
"=",
"[",
"'bin'",
",",
"'app'",
",",
"]",
";",
"foreach",
"(",
"$",
"paths",
"as... | Get Console Dir
@return null|string | [
"Get",
"Console",
"Dir"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Components/Helper/ComposerHelper.php#L100-L118 | train |
mglaman/docker-helper | src/Machine.php | Machine.start | public static function start($name)
{
// Check if machine is running.
$status = self::status($name);
if ($status == self::STOPPED) {
// If not, try to start it.
return self::runCommand('start', [$name])->isSuccessful();
}
return $status == Machine::R... | php | public static function start($name)
{
// Check if machine is running.
$status = self::status($name);
if ($status == self::STOPPED) {
// If not, try to start it.
return self::runCommand('start', [$name])->isSuccessful();
}
return $status == Machine::R... | [
"public",
"static",
"function",
"start",
"(",
"$",
"name",
")",
"{",
"// Check if machine is running.",
"$",
"status",
"=",
"self",
"::",
"status",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"status",
"==",
"self",
"::",
"STOPPED",
")",
"{",
"// If not,... | Start a machine.
@param $name
@return bool
@throws \Exception | [
"Start",
"a",
"machine",
"."
] | b262a50dcdbc495487568f775a8f41da82ae2c03 | https://github.com/mglaman/docker-helper/blob/b262a50dcdbc495487568f775a8f41da82ae2c03/src/Machine.php#L45-L56 | train |
mglaman/docker-helper | src/Machine.php | Machine.getEnv | public static function getEnv($name)
{
$envs = [];
$output = self::runCommand('env', [$name]);
if (trim($output->getOutput()) == "$name is not running. Please start this with docker-machine start $name") {
throw new \Exception('Docker machine has not been started yet.');
... | php | public static function getEnv($name)
{
$envs = [];
$output = self::runCommand('env', [$name]);
if (trim($output->getOutput()) == "$name is not running. Please start this with docker-machine start $name") {
throw new \Exception('Docker machine has not been started yet.');
... | [
"public",
"static",
"function",
"getEnv",
"(",
"$",
"name",
")",
"{",
"$",
"envs",
"=",
"[",
"]",
";",
"$",
"output",
"=",
"self",
"::",
"runCommand",
"(",
"'env'",
",",
"[",
"$",
"name",
"]",
")",
";",
"if",
"(",
"trim",
"(",
"$",
"output",
"-... | Returns an array of the environment for the Docker client.
@param $name
@return array
@throws \Exception | [
"Returns",
"an",
"array",
"of",
"the",
"environment",
"for",
"the",
"Docker",
"client",
"."
] | b262a50dcdbc495487568f775a8f41da82ae2c03 | https://github.com/mglaman/docker-helper/blob/b262a50dcdbc495487568f775a8f41da82ae2c03/src/Machine.php#L89-L105 | train |
K-Phoen/gaufrette-extras-bundle | Form/Type/ImageType.php | ImageType.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
$parentData = $form->getParent()->getData();
if ($parentData !== null) {
$accessor = PropertyAccess::getPropertyAccessor();
// set an "image_url" variable that will be available when rendering t... | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
$parentData = $form->getParent()->getData();
if ($parentData !== null) {
$accessor = PropertyAccess::getPropertyAccessor();
// set an "image_url" variable that will be available when rendering t... | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"$",
"parentData",
"=",
"$",
"form",
"->",
"getParent",
"(",
")",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"... | Pass the image url to the view
@param FormView $view
@param FormInterface $form
@param array $options | [
"Pass",
"the",
"image",
"url",
"to",
"the",
"view"
] | 3f05779179117d5649184164544e1f22de28d706 | https://github.com/K-Phoen/gaufrette-extras-bundle/blob/3f05779179117d5649184164544e1f22de28d706/Form/Type/ImageType.php#L46-L67 | train |
antaresproject/translations | src/Http/Controllers/Admin/SyncController.php | SyncController.index | public function index($area = null, $locale = null)
{
return $this->processor->index($this, !is_null($area) ? $area : area(), $locale);
} | php | public function index($area = null, $locale = null)
{
return $this->processor->index($this, !is_null($area) ? $area : area(), $locale);
} | [
"public",
"function",
"index",
"(",
"$",
"area",
"=",
"null",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"processor",
"->",
"index",
"(",
"$",
"this",
",",
"!",
"is_null",
"(",
"$",
"area",
")",
"?",
"$",
"area",
":",... | index default action
@return \Illuminate\View\View | [
"index",
"default",
"action"
] | 63097aeb97f18c5aeeef7dcf15f0c67959951685 | https://github.com/antaresproject/translations/blob/63097aeb97f18c5aeeef7dcf15f0c67959951685/src/Http/Controllers/Admin/SyncController.php#L57-L60 | train |
newup/core | src/Console/Commandable.php | Commandable.setApplication | public function setApplication(ApplicationContract $application = null)
{
$this->application = $application;
if ($application) {
$this->setHelperSet($application->getHelperSet());
} else {
$this->helperSet = null;
}
} | php | public function setApplication(ApplicationContract $application = null)
{
$this->application = $application;
if ($application) {
$this->setHelperSet($application->getHelperSet());
} else {
$this->helperSet = null;
}
} | [
"public",
"function",
"setApplication",
"(",
"ApplicationContract",
"$",
"application",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"application",
"=",
"$",
"application",
";",
"if",
"(",
"$",
"application",
")",
"{",
"$",
"this",
"->",
"setHelperSet",
"(",
... | Sets the ApplicationContract instance.
@param ApplicationContract|null $application | [
"Sets",
"the",
"ApplicationContract",
"instance",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Console/Commandable.php#L50-L58 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Subscriber_Update | public function Subscriber_Update($user_id, $subscription_state, $division, $attributes, $allow_resubscribe = true,
$append = false) {
$data = $this->_package_subscriber_elements($subscription_state, $division, $attributes);
if (is_null($allow_resubscribe) === fals... | php | public function Subscriber_Update($user_id, $subscription_state, $division, $attributes, $allow_resubscribe = true,
$append = false) {
$data = $this->_package_subscriber_elements($subscription_state, $division, $attributes);
if (is_null($allow_resubscribe) === fals... | [
"public",
"function",
"Subscriber_Update",
"(",
"$",
"user_id",
",",
"$",
"subscription_state",
",",
"$",
"division",
",",
"$",
"attributes",
",",
"$",
"allow_resubscribe",
"=",
"true",
",",
"$",
"append",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"$",
"... | Update an existing subscriber.
@param int $user_id The id of the subscriber to update
@param mixed $subscription_state [optional] Any of {"UNSUBSCRIBED", "SUBSCRIBED", "REFERRED", "DEAD", "REVIVED"}
@param mixed $division [optional] The division display name. If this is specified the subscriber will be
subscribed to t... | [
"Update",
"an",
"existing",
"subscriber",
"."
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L99-L114 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Subscriber_Get_Id | public function Subscriber_Get_Id($attributes) {
try {
$ret = $this->Subscriber_Lookup($attributes);
$uri = $ret->uri;
$id = (int) substr(strrchr($uri, '/'), 1);
} catch (\Exception $e) {
if( $e->getCode() === 404){
$id = false;
... | php | public function Subscriber_Get_Id($attributes) {
try {
$ret = $this->Subscriber_Lookup($attributes);
$uri = $ret->uri;
$id = (int) substr(strrchr($uri, '/'), 1);
} catch (\Exception $e) {
if( $e->getCode() === 404){
$id = false;
... | [
"public",
"function",
"Subscriber_Get_Id",
"(",
"$",
"attributes",
")",
"{",
"try",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"Subscriber_Lookup",
"(",
"$",
"attributes",
")",
";",
"$",
"uri",
"=",
"$",
"ret",
"->",
"uri",
";",
"$",
"id",
"=",
"(",
... | Look up the id of an existing subscriber.
@param array $attributes An array of attribute to look up the subscriber with
@return mixed Either the subscriber id, or false if the subscriber is not found
@access public | [
"Look",
"up",
"the",
"id",
"of",
"an",
"existing",
"subscriber",
"."
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L136-L150 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Subscriber_Retrieve | public function Subscriber_Retrieve($attributes, $division) {
$ret = false;
$subscriberId = $this->Subscriber_Get_Id($attributes);
if ($subscriberId !== false) {
$ret = $this->_call_api('get', "{$this->_url}/subscribers/$subscriberId", array('division' => $division));
}
... | php | public function Subscriber_Retrieve($attributes, $division) {
$ret = false;
$subscriberId = $this->Subscriber_Get_Id($attributes);
if ($subscriberId !== false) {
$ret = $this->_call_api('get', "{$this->_url}/subscribers/$subscriberId", array('division' => $division));
}
... | [
"public",
"function",
"Subscriber_Retrieve",
"(",
"$",
"attributes",
",",
"$",
"division",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"$",
"subscriberId",
"=",
"$",
"this",
"->",
"Subscriber_Get_Id",
"(",
"$",
"attributes",
")",
";",
"if",
"(",
"$",
"subsc... | Retrieve all information about a subscriber, including attributes, division subscription status, etc.
@param array $attributes An array of attribute to look up the subscriber with
@param mixed $division The division display name. The division from which to get the subscribers information
@return mixed A JSON decoded P... | [
"Retrieve",
"all",
"information",
"about",
"a",
"subscriber",
"including",
"attributes",
"division",
"subscription",
"status",
"etc",
"."
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L174-L182 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Subscribe_And_Send | public function Subscribe_And_Send($subscription_state, $division, $attributes, $allow_resubscribe, $masterId) {
$data = new \stdClass();
$subscriber = $this->_package_subscriber_elements($subscription_state, $division, $attributes);
if (is_bool($allow_resubscribe) === true) {
$subs... | php | public function Subscribe_And_Send($subscription_state, $division, $attributes, $allow_resubscribe, $masterId) {
$data = new \stdClass();
$subscriber = $this->_package_subscriber_elements($subscription_state, $division, $attributes);
if (is_bool($allow_resubscribe) === true) {
$subs... | [
"public",
"function",
"Subscribe_And_Send",
"(",
"$",
"subscription_state",
",",
"$",
"division",
",",
"$",
"attributes",
",",
"$",
"allow_resubscribe",
",",
"$",
"masterId",
")",
"{",
"$",
"data",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"subscri... | Subscribe and send
@param mixed $subscription_state Any of {"UNSUBSCRIBED", "SUBSCRIBED", "REFERRED", "DEAD", "REVIVED"} or null
@param mixed $division The division display name. If specified, the subscriber will be subscribed
to this division. If null, subscriber will not be subscribed to a division.
@param array $at... | [
"Subscribe",
"and",
"send"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L198-L214 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Status_Get | public function Status_Get($guid, $nowait = true) {
if ($nowait === true) {
$ret = $this->_call_api('get', "{$this->_url}/statusNoWait/$guid", array());
} else {
do {
$ret = $this->_call_api('get', "{$this->_url}/status/$guid", array());
switch($re... | php | public function Status_Get($guid, $nowait = true) {
if ($nowait === true) {
$ret = $this->_call_api('get', "{$this->_url}/statusNoWait/$guid", array());
} else {
do {
$ret = $this->_call_api('get', "{$this->_url}/status/$guid", array());
switch($re... | [
"public",
"function",
"Status_Get",
"(",
"$",
"guid",
",",
"$",
"nowait",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"nowait",
"===",
"true",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"_call_api",
"(",
"'get'",
",",
"\"{$this->_url}/statusNoWait/$guid\""... | Get the status of an outstanding request.
@param int $guid The trackingId of the request to get status for
@param bool $nowait True if we should return without blocking. False if we should block until the request
reaches a completed state.
@return mixed A JSON decoded PHP variable representing the HTTP response.
@acce... | [
"Get",
"the",
"status",
"of",
"an",
"outstanding",
"request",
"."
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L225-L251 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Create | public function Master_Create($envelope, $targeting, $scheduling) {
$ret = false;
$data = $this->_package_master_elements($envelope, $targeting, $scheduling);
if ($data !== false) {
$ret = $this->_call_api('post', "{$this->_url}/masters", $data);
}
return $ret;
... | php | public function Master_Create($envelope, $targeting, $scheduling) {
$ret = false;
$data = $this->_package_master_elements($envelope, $targeting, $scheduling);
if ($data !== false) {
$ret = $this->_call_api('post', "{$this->_url}/masters", $data);
}
return $ret;
... | [
"public",
"function",
"Master_Create",
"(",
"$",
"envelope",
",",
"$",
"targeting",
",",
"$",
"scheduling",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"_package_master_elements",
"(",
"$",
"envelope",
",",
"$",
"targeti... | Create a new Master
@param object $envelope The envelope to use for the new master
@param mixed $targeting [optional] Optional targeting parameters to use for the new master
@param mixed $scheduling [optional] Optional scheduling parameters to use for the new master
@return mixed A JSON decoded PHP variable representi... | [
"Create",
"a",
"new",
"Master"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L271-L280 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Update | public function Master_Update($masterId, $envelope, $targeting, $scheduling) {
$ret = false;
$data = $this->_package_master_elements($envelope, $targeting, $scheduling);
if ($data !== false) {
$ret = $this->_call_api('put', "{$this->_url}/masters/$masterId", $data);
}
... | php | public function Master_Update($masterId, $envelope, $targeting, $scheduling) {
$ret = false;
$data = $this->_package_master_elements($envelope, $targeting, $scheduling);
if ($data !== false) {
$ret = $this->_call_api('put', "{$this->_url}/masters/$masterId", $data);
}
... | [
"public",
"function",
"Master_Update",
"(",
"$",
"masterId",
",",
"$",
"envelope",
",",
"$",
"targeting",
",",
"$",
"scheduling",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"_package_master_elements",
"(",
"$",
"envelop... | Update an existing Master
@param int $masterId The id of the master to update
@param object $envelope The envelope to use for the new master
@param mixed $targeting [optional] Optional targeting parameters to use for the new master
@param mixed $scheduling [optional] Optional scheduling parameters to use for the new m... | [
"Update",
"an",
"existing",
"Master"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L292-L301 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Get | public function Master_Get($masterId) {
$ret = false;
if (is_int($masterId) === true) {
try {
$ret = $this->_call_api('get', "{$this->_url}/masters/$masterId", array());
$ret = $this->_Type_Safe_Yesmail_Master($ret);
$ret->id = (int) $masterId... | php | public function Master_Get($masterId) {
$ret = false;
if (is_int($masterId) === true) {
try {
$ret = $this->_call_api('get', "{$this->_url}/masters/$masterId", array());
$ret = $this->_Type_Safe_Yesmail_Master($ret);
$ret->id = (int) $masterId... | [
"public",
"function",
"Master_Get",
"(",
"$",
"masterId",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"is_int",
"(",
"$",
"masterId",
")",
"===",
"true",
")",
"{",
"try",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"_call_api",
"(",
"'get'",
... | Get an existing Master
@param int $masterId The id of the master to retrieve
@return mixed A JSON decoded PHP variable representing the HTTP response.
@access public | [
"Get",
"an",
"existing",
"Master"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L337-L355 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Get_By_Name | public function Master_Get_By_Name($masterName) {
$ret = false;
if (is_string($masterName) === true) {
$pageSize = 50;
$begin = 1;
$end = $pageSize;
$filter = 'active';
$more = true;
while($more) {
$res = $this->_ca... | php | public function Master_Get_By_Name($masterName) {
$ret = false;
if (is_string($masterName) === true) {
$pageSize = 50;
$begin = 1;
$end = $pageSize;
$filter = 'active';
$more = true;
while($more) {
$res = $this->_ca... | [
"public",
"function",
"Master_Get_By_Name",
"(",
"$",
"masterName",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"is_string",
"(",
"$",
"masterName",
")",
"===",
"true",
")",
"{",
"$",
"pageSize",
"=",
"50",
";",
"$",
"begin",
"=",
"1",
";",
... | Get an existing Master by name
@param int $masterName The name of the master to retrieve
@return mixed A JSON decoded PHP variable representing the HTTP response, or false if the master is not found
@access public | [
"Get",
"an",
"existing",
"Master",
"by",
"name"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L364-L397 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Post_Run_Count | public function Master_Post_Run_Count($masterId) {
$ret = false;
if (is_int($masterId) === true) {
$ret = $this->_call_api('post', "{$this->_url}/masters/$masterId/RUN/countData", array());
}
return $ret;
} | php | public function Master_Post_Run_Count($masterId) {
$ret = false;
if (is_int($masterId) === true) {
$ret = $this->_call_api('post', "{$this->_url}/masters/$masterId/RUN/countData", array());
}
return $ret;
} | [
"public",
"function",
"Master_Post_Run_Count",
"(",
"$",
"masterId",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"is_int",
"(",
"$",
"masterId",
")",
"===",
"true",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"_call_api",
"(",
"'post'",
","... | Submit the master's ID and RUN the eAPI service URL to request the the count job for a specific master
Run this before doing Master_Post_Run_Count
@param int $master_id master's id to check the count for
@return mixed A JSON decoded PHP variable representing the HTTP response.
@access public | [
"Submit",
"the",
"master",
"s",
"ID",
"and",
"RUN",
"the",
"eAPI",
"service",
"URL",
"to",
"request",
"the",
"the",
"count",
"job",
"for",
"a",
"specific",
"master",
"Run",
"this",
"before",
"doing",
"Master_Post_Run_Count"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L407-L415 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Get_Count | public function Master_Get_Count($masterId) {
$ret = false;
if (is_int($masterId) === true) {
do {
$ret = $this->_call_api('get', "{$this->_url}/masters/$masterId/countData", array());
// Sleep for 15 seconds so we don't keep hammering the api
... | php | public function Master_Get_Count($masterId) {
$ret = false;
if (is_int($masterId) === true) {
do {
$ret = $this->_call_api('get', "{$this->_url}/masters/$masterId/countData", array());
// Sleep for 15 seconds so we don't keep hammering the api
... | [
"public",
"function",
"Master_Get_Count",
"(",
"$",
"masterId",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"is_int",
"(",
"$",
"masterId",
")",
"===",
"true",
")",
"{",
"do",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"_call_api",
"(",
"'get... | Get the number of active subscribers based on master's id.
Run this after doing Master_Post_Run_Count
@param int $master_id master's id to check the count for
@return mixed A JSON decoded PHP variable representing the HTTP response.
@access public | [
"Get",
"the",
"number",
"of",
"active",
"subscribers",
"based",
"on",
"master",
"s",
"id",
".",
"Run",
"this",
"after",
"doing",
"Master_Post_Run_Count"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L425-L438 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Assets_Get | public function Master_Assets_Get($masterId) {
$ret = false;
if (is_int($masterId) === true) {
$ret = $this->_call_api('get', "{$this->_url}/masters/$masterId/assets", array());
}
return $ret;
} | php | public function Master_Assets_Get($masterId) {
$ret = false;
if (is_int($masterId) === true) {
$ret = $this->_call_api('get', "{$this->_url}/masters/$masterId/assets", array());
}
return $ret;
} | [
"public",
"function",
"Master_Assets_Get",
"(",
"$",
"masterId",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"is_int",
"(",
"$",
"masterId",
")",
"===",
"true",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"_call_api",
"(",
"'get'",
",",
"... | Get the assets that belong to a Master
@param int $masterId The id of the master who's assets are being requested
@return mixed A JSON decoded PHP variable representing the HTTP response.
@access public | [
"Get",
"the",
"assets",
"that",
"belong",
"to",
"a",
"Master"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L484-L492 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.Master_Preview | public function Master_Preview($masterId, $contentType, $distributionList, $userId, $emails) {
$ret = false;
$contentTypes = array('HTML', 'PLAIN', 'BOTH', 'USERPREFERENCE');
if (in_array($contentType, $contentTypes) === true) {
if (is_string($distributionList) === true xor (is_int(... | php | public function Master_Preview($masterId, $contentType, $distributionList, $userId, $emails) {
$ret = false;
$contentTypes = array('HTML', 'PLAIN', 'BOTH', 'USERPREFERENCE');
if (in_array($contentType, $contentTypes) === true) {
if (is_string($distributionList) === true xor (is_int(... | [
"public",
"function",
"Master_Preview",
"(",
"$",
"masterId",
",",
"$",
"contentType",
",",
"$",
"distributionList",
",",
"$",
"userId",
",",
"$",
"emails",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"$",
"contentTypes",
"=",
"array",
"(",
"'HTML'",
",",
... | Provides a way to preview a message by sending it to a group of email addresses, following the same semantics as
the preview functionality within the Enterprise Application.
@param int $masterId The id of the master to preview
@param string $contentType HTML - Use HTML content in the email
PLAIN - Use plain text conte... | [
"Provides",
"a",
"way",
"to",
"preview",
"a",
"message",
"by",
"sending",
"it",
"to",
"a",
"group",
"of",
"email",
"addresses",
"following",
"the",
"same",
"semantics",
"as",
"the",
"preview",
"functionality",
"within",
"the",
"Enterprise",
"Application",
"."
... | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L545-L567 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.ListManagement_Get_Lists | public function ListManagement_Get_Lists($type) {
$ret = false;
if (is_string($type) === true) {
$type = rawurlencode($type);
$ret = $this->_call_api('get', "{$this->_url}/lists/$type", array());
}
return $ret;
} | php | public function ListManagement_Get_Lists($type) {
$ret = false;
if (is_string($type) === true) {
$type = rawurlencode($type);
$ret = $this->_call_api('get', "{$this->_url}/lists/$type", array());
}
return $ret;
} | [
"public",
"function",
"ListManagement_Get_Lists",
"(",
"$",
"type",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"is_string",
"(",
"$",
"type",
")",
"===",
"true",
")",
"{",
"$",
"type",
"=",
"rawurlencode",
"(",
"$",
"type",
")",
";",
"$",
... | Get a list of lists given a list type
@param string $type The type of lists to get. Should be either LISTLOADLIST or DISTRIBUTIONLIST
@return mixed A JSON decoded PHP variable representing the HTTP response | [
"Get",
"a",
"list",
"of",
"lists",
"given",
"a",
"list",
"type"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L575-L584 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.ListManagement_Update_List | public function ListManagement_Update_List($modifyList) {
$ret = false;
if ($modifyList instanceof \Yesmail\YesmailListManagementModifyList && $modifyList->is_valid() === true) {
$name = rawurlencode($modifyList->name);
$type = rawurlencode($modifyList->type);
$ret =... | php | public function ListManagement_Update_List($modifyList) {
$ret = false;
if ($modifyList instanceof \Yesmail\YesmailListManagementModifyList && $modifyList->is_valid() === true) {
$name = rawurlencode($modifyList->name);
$type = rawurlencode($modifyList->type);
$ret =... | [
"public",
"function",
"ListManagement_Update_List",
"(",
"$",
"modifyList",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"$",
"modifyList",
"instanceof",
"\\",
"Yesmail",
"\\",
"YesmailListManagementModifyList",
"&&",
"$",
"modifyList",
"->",
"is_valid",
... | Either remove or append the subscribers identified in the payload. For subscriberIds and emails that are
submitted as part of a request that cannot be mapped back to existing subscriber data are ignored and a total
count of the number added users is returned as part of the status message.
@param object $modifyList
@re... | [
"Either",
"remove",
"or",
"append",
"the",
"subscribers",
"identified",
"in",
"the",
"payload",
".",
"For",
"subscriberIds",
"and",
"emails",
"that",
"are",
"submitted",
"as",
"part",
"of",
"a",
"request",
"that",
"cannot",
"be",
"mapped",
"back",
"to",
"exi... | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L614-L624 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail.ListManagement_Create_List | public function ListManagement_Create_List($modifyList) {
$ret = false;
if ($modifyList instanceof \Yesmail\YesmailListManagementModifyList && $modifyList->is_valid() === true) {
$ret = $this->_call_api('post', "{$this->_url}/lists/{$modifyList->type}", $modifyList);
}
retu... | php | public function ListManagement_Create_List($modifyList) {
$ret = false;
if ($modifyList instanceof \Yesmail\YesmailListManagementModifyList && $modifyList->is_valid() === true) {
$ret = $this->_call_api('post', "{$this->_url}/lists/{$modifyList->type}", $modifyList);
}
retu... | [
"public",
"function",
"ListManagement_Create_List",
"(",
"$",
"modifyList",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"$",
"modifyList",
"instanceof",
"\\",
"Yesmail",
"\\",
"YesmailListManagementModifyList",
"&&",
"$",
"modifyList",
"->",
"is_valid",
... | Create a new list of the given type
@param object $modifyList
@return mixed A JSON decoded PHP variable representing the HTTP response | [
"Create",
"a",
"new",
"list",
"of",
"the",
"given",
"type"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L632-L640 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail._package_master_elements | protected function _package_master_elements($envelope, $targeting, $scheduling) {
$ret = false;
if ($envelope instanceof \Yesmail\YesmailMasterEnvelope && $envelope->is_valid() === true) {
$ret = new \stdClass();
$ret->envelope = $envelope;
if ($targeting instanceof... | php | protected function _package_master_elements($envelope, $targeting, $scheduling) {
$ret = false;
if ($envelope instanceof \Yesmail\YesmailMasterEnvelope && $envelope->is_valid() === true) {
$ret = new \stdClass();
$ret->envelope = $envelope;
if ($targeting instanceof... | [
"protected",
"function",
"_package_master_elements",
"(",
"$",
"envelope",
",",
"$",
"targeting",
",",
"$",
"scheduling",
")",
"{",
"$",
"ret",
"=",
"false",
";",
"if",
"(",
"$",
"envelope",
"instanceof",
"\\",
"Yesmail",
"\\",
"YesmailMasterEnvelope",
"&&",
... | Package a Master's envelope, targeting, and scheduling for sending in a request
@param object $envelope The Master's envelope
@param mixed $targeting [optional] Optional targeting parameters for the new master
@param mixed $scheduling [optional] Optional scheduling parameters for the new master
@return mixed Either a ... | [
"Package",
"a",
"Master",
"s",
"envelope",
"targeting",
"and",
"scheduling",
"for",
"sending",
"in",
"a",
"request"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L681-L698 | train |
PopSugar/php-yesmail-api | src/Yesmail/Yesmail.php | Yesmail._call_api | protected function _call_api( $method, $url, $params ) {
$raw_response = $this->_client->$method($url, $params);
$info = $this->_client->get_info();
if ($info['http_code'] != null) {
switch ($info["http_code"]) {
case 200:
case 202:
... | php | protected function _call_api( $method, $url, $params ) {
$raw_response = $this->_client->$method($url, $params);
$info = $this->_client->get_info();
if ($info['http_code'] != null) {
switch ($info["http_code"]) {
case 200:
case 202:
... | [
"protected",
"function",
"_call_api",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"params",
")",
"{",
"$",
"raw_response",
"=",
"$",
"this",
"->",
"_client",
"->",
"$",
"method",
"(",
"$",
"url",
",",
"$",
"params",
")",
";",
"$",
"info",
"=",
... | Make a call to the Yesmail API
@param string $method Any of {'get', 'put', 'post', 'delete'}
@param string $url The url of the API call
@param mixed $params An object or array of parameters to submit in the request
@return mixed A JSON decoded PHP variable representing the HTTP response.
@access protected
@throws Exce... | [
"Make",
"a",
"call",
"to",
"the",
"Yesmail",
"API"
] | 42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c | https://github.com/PopSugar/php-yesmail-api/blob/42c20a3ded1d8f2177c792cd3aa44bcdfdcb239c/src/Yesmail/Yesmail.php#L735-L762 | train |
pmdevelopment/tool-bundle | Twig/TimeExtension.php | TimeExtension.getSecondsAsText | public function getSecondsAsText($seconds, $decimals = 2, $decPoint = ',', $thousandsSep = '.')
{
$seconds = floatval($seconds);
if (60 > $seconds) {
return sprintf('%ss', number_format($seconds, $decimals, $decPoint, $thousandsSep));
}
$minutes = floor($seconds / 60);
... | php | public function getSecondsAsText($seconds, $decimals = 2, $decPoint = ',', $thousandsSep = '.')
{
$seconds = floatval($seconds);
if (60 > $seconds) {
return sprintf('%ss', number_format($seconds, $decimals, $decPoint, $thousandsSep));
}
$minutes = floor($seconds / 60);
... | [
"public",
"function",
"getSecondsAsText",
"(",
"$",
"seconds",
",",
"$",
"decimals",
"=",
"2",
",",
"$",
"decPoint",
"=",
"','",
",",
"$",
"thousandsSep",
"=",
"'.'",
")",
"{",
"$",
"seconds",
"=",
"floatval",
"(",
"$",
"seconds",
")",
";",
"if",
"("... | Get Seconds As Text
@param float $seconds
@param int $decimals
@param string $decPoint
@param string $thousandsSep
@return string | [
"Get",
"Seconds",
"As",
"Text"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Twig/TimeExtension.php#L82-L100 | train |
pmdevelopment/tool-bundle | Twig/TimeExtension.php | TimeExtension.getSecondsAsTextExtended | public function getSecondsAsTextExtended($seconds)
{
$seconds = floatval($seconds);
$result = [];
$steps = [
'days' => 86400,
'hours' => 3600,
'minutes' => 60,
'seconds' => 1,
];
foreach ($steps as $stepName => $stepDivid... | php | public function getSecondsAsTextExtended($seconds)
{
$seconds = floatval($seconds);
$result = [];
$steps = [
'days' => 86400,
'hours' => 3600,
'minutes' => 60,
'seconds' => 1,
];
foreach ($steps as $stepName => $stepDivid... | [
"public",
"function",
"getSecondsAsTextExtended",
"(",
"$",
"seconds",
")",
"{",
"$",
"seconds",
"=",
"floatval",
"(",
"$",
"seconds",
")",
";",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"steps",
"=",
"[",
"'days'",
"=>",
"86400",
",",
"'hours'",
"=>",
... | Get Seconds As Text Extended
@param float $seconds
@return string | [
"Get",
"Seconds",
"As",
"Text",
"Extended"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Twig/TimeExtension.php#L109-L130 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebClient.php | WebClient.validate | protected function validate()
{
if ($this->method === HttpMethods::POST && empty($this->data)) {
throw new Exceptions\WebException(
"Using method POST without data."
);
}
} | php | protected function validate()
{
if ($this->method === HttpMethods::POST && empty($this->data)) {
throw new Exceptions\WebException(
"Using method POST without data."
);
}
} | [
"protected",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"method",
"===",
"HttpMethods",
"::",
"POST",
"&&",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"WebException",
"(",
"\"Us... | Validates the request values for correctness
@throws Exceptions\WebException When an incorrect value is found | [
"Validates",
"the",
"request",
"values",
"for",
"correctness"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebClient.php#L297-L304 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebClient.php | WebClient.prepareCurl | protected function prepareCurl()
{
$this->curl = curl_init();
$this->complete = Complete::factory(function() {
if ($this->curl) {
curl_close($this->curl);
}
$this->curl = null;
$this->complete = null;
});
foreach(se... | php | protected function prepareCurl()
{
$this->curl = curl_init();
$this->complete = Complete::factory(function() {
if ($this->curl) {
curl_close($this->curl);
}
$this->curl = null;
$this->complete = null;
});
foreach(se... | [
"protected",
"function",
"prepareCurl",
"(",
")",
"{",
"$",
"this",
"->",
"curl",
"=",
"curl_init",
"(",
")",
";",
"$",
"this",
"->",
"complete",
"=",
"Complete",
"::",
"factory",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"curl",
... | Initializes the curl resource | [
"Initializes",
"the",
"curl",
"resource"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebClient.php#L309-L333 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebClient.php | WebClient.prepareData | protected function prepareData()
{
if (!empty($this->data)) {
if ($this->method === HttpMethods::GET) {
$this->url = Utils::appendUrlQuery($this->url, $this->data);
} else if ($this->method === HttpMethods::POST) {
curl_setopt($this->curl, CURLOPT_POST... | php | protected function prepareData()
{
if (!empty($this->data)) {
if ($this->method === HttpMethods::GET) {
$this->url = Utils::appendUrlQuery($this->url, $this->data);
} else if ($this->method === HttpMethods::POST) {
curl_setopt($this->curl, CURLOPT_POST... | [
"protected",
"function",
"prepareData",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"method",
"===",
"HttpMethods",
"::",
"GET",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"Ut... | Adds the data value to the curl request | [
"Adds",
"the",
"data",
"value",
"to",
"the",
"curl",
"request"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebClient.php#L338-L347 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebClient.php | WebClient.prepareHeaders | protected function prepareHeaders()
{
// Need to let curl set the content type when posting. Our own content type
// value would overwrite that.
if ($this->method === HttpMethods::POST && !empty($this->headers["Content-Type"])) {
unset($this->headers["Content-Type"]);
}
... | php | protected function prepareHeaders()
{
// Need to let curl set the content type when posting. Our own content type
// value would overwrite that.
if ($this->method === HttpMethods::POST && !empty($this->headers["Content-Type"])) {
unset($this->headers["Content-Type"]);
}
... | [
"protected",
"function",
"prepareHeaders",
"(",
")",
"{",
"// Need to let curl set the content type when posting. Our own content type",
"// value would overwrite that.",
"if",
"(",
"$",
"this",
"->",
"method",
"===",
"HttpMethods",
"::",
"POST",
"&&",
"!",
"empty",
"(",
... | Adds the set headers to the curl request | [
"Adds",
"the",
"set",
"headers",
"to",
"the",
"curl",
"request"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebClient.php#L352-L365 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebClient.php | WebClient.exec | protected function exec()
{
curl_setopt($this->curl, CURLOPT_URL, $this->url);
$response_text = curl_exec($this->curl);
$this->info = curl_getinfo($this->curl);
$this->logInformation();
if (false === $response_text) {
throw new Exceptions\WebException(... | php | protected function exec()
{
curl_setopt($this->curl, CURLOPT_URL, $this->url);
$response_text = curl_exec($this->curl);
$this->info = curl_getinfo($this->curl);
$this->logInformation();
if (false === $response_text) {
throw new Exceptions\WebException(... | [
"protected",
"function",
"exec",
"(",
")",
"{",
"curl_setopt",
"(",
"$",
"this",
"->",
"curl",
",",
"CURLOPT_URL",
",",
"$",
"this",
"->",
"url",
")",
";",
"$",
"response_text",
"=",
"curl_exec",
"(",
"$",
"this",
"->",
"curl",
")",
";",
"$",
"this",... | Executes the configured request | [
"Executes",
"the",
"configured",
"request"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebClient.php#L370-L401 | train |
headzoo/web-tools | src/Headzoo/Web/Tools/WebClient.php | WebClient.logInformation | protected function logInformation()
{
if ($this->logger) {
$level = $this->info["http_code"] > 0 && $this->info["http_code"] < 400
? LogLevel::INFO
: LogLevel::ERROR;
$this->info["method"] = $this->method;
$this->logger->log($level, $this->... | php | protected function logInformation()
{
if ($this->logger) {
$level = $this->info["http_code"] > 0 && $this->info["http_code"] < 400
? LogLevel::INFO
: LogLevel::ERROR;
$this->info["method"] = $this->method;
$this->logger->log($level, $this->... | [
"protected",
"function",
"logInformation",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"level",
"=",
"$",
"this",
"->",
"info",
"[",
"\"http_code\"",
"]",
">",
"0",
"&&",
"$",
"this",
"->",
"info",
"[",
"\"http_code\"",
"]",... | Logs request information when logging is enabled | [
"Logs",
"request",
"information",
"when",
"logging",
"is",
"enabled"
] | 305ce78029b86fa1fadaf8341d8fc737c84eab87 | https://github.com/headzoo/web-tools/blob/305ce78029b86fa1fadaf8341d8fc737c84eab87/src/Headzoo/Web/Tools/WebClient.php#L406-L415 | train |
andyburton/Sonic-Framework | src/Resource/IP.php | IP.Allow | public function Allow ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
$this->allowIPs[$formatted[0]] = $formatted[1];
return TRUE;
} | php | public function Allow ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
$this->allowIPs[$formatted[0]] = $formatted[1];
return TRUE;
} | [
"public",
"function",
"Allow",
"(",
"$",
"range",
")",
"{",
"$",
"formatted",
"=",
"$",
"this",
"->",
"formatRange",
"(",
"$",
"range",
")",
";",
"if",
"(",
"!",
"$",
"formatted",
")",
"{",
"return",
"FALSE",
";",
"}",
"$",
"this",
"->",
"allowIPs"... | Add an IP address range to allow
Return FALSE is the IP range is invalid
@see formatRange ()
@param string $range IP range to allow
@return boolean | [
"Add",
"an",
"IP",
"address",
"range",
"to",
"allow",
"Return",
"FALSE",
"is",
"the",
"IP",
"range",
"is",
"invalid"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/IP.php#L37-L50 | train |
andyburton/Sonic-Framework | src/Resource/IP.php | IP.Deny | public function Deny ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
$this->denyIPs[$formatted[0]] = $formatted[1];
return TRUE;
} | php | public function Deny ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
$this->denyIPs[$formatted[0]] = $formatted[1];
return TRUE;
} | [
"public",
"function",
"Deny",
"(",
"$",
"range",
")",
"{",
"$",
"formatted",
"=",
"$",
"this",
"->",
"formatRange",
"(",
"$",
"range",
")",
";",
"if",
"(",
"!",
"$",
"formatted",
")",
"{",
"return",
"FALSE",
";",
"}",
"$",
"this",
"->",
"denyIPs",
... | Add an IP address range to deny
Return FALSE is the IP range is invalid
@see formatRange ()
@param string $range IP range to deny
@return boolean | [
"Add",
"an",
"IP",
"address",
"range",
"to",
"deny",
"Return",
"FALSE",
"is",
"the",
"IP",
"range",
"is",
"invalid"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/IP.php#L61-L74 | train |
andyburton/Sonic-Framework | src/Resource/IP.php | IP.removeAllowed | public function removeAllowed ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
unset ($this->allowIPs[$formatted[0]]);
return TRUE;
} | php | public function removeAllowed ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
unset ($this->allowIPs[$formatted[0]]);
return TRUE;
} | [
"public",
"function",
"removeAllowed",
"(",
"$",
"range",
")",
"{",
"$",
"formatted",
"=",
"$",
"this",
"->",
"formatRange",
"(",
"$",
"range",
")",
";",
"if",
"(",
"!",
"$",
"formatted",
")",
"{",
"return",
"FALSE",
";",
"}",
"unset",
"(",
"$",
"t... | Remove an allowed IP address range
Return FALSE is the IP range is invalid
@param string $range IP range to remove
@return boolean | [
"Remove",
"an",
"allowed",
"IP",
"address",
"range",
"Return",
"FALSE",
"is",
"the",
"IP",
"range",
"is",
"invalid"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/IP.php#L84-L97 | train |
andyburton/Sonic-Framework | src/Resource/IP.php | IP.removeDenied | public function removeDenied ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
unset ($this->denyIPs[$formatted[0]]);
return TRUE;
} | php | public function removeDenied ($range)
{
$formatted = $this->formatRange ($range);
if (!$formatted)
{
return FALSE;
}
unset ($this->denyIPs[$formatted[0]]);
return TRUE;
} | [
"public",
"function",
"removeDenied",
"(",
"$",
"range",
")",
"{",
"$",
"formatted",
"=",
"$",
"this",
"->",
"formatRange",
"(",
"$",
"range",
")",
";",
"if",
"(",
"!",
"$",
"formatted",
")",
"{",
"return",
"FALSE",
";",
"}",
"unset",
"(",
"$",
"th... | Remove a denied IP address range
Return FALSE is the IP range is invalid
@param string $range IP range to remove
@return boolean | [
"Remove",
"a",
"denied",
"IP",
"address",
"range",
"Return",
"FALSE",
"is",
"the",
"IP",
"range",
"is",
"invalid"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/IP.php#L107-L120 | train |
andyburton/Sonic-Framework | src/Resource/IP.php | IP.formatRange | public function formatRange ($range)
{
// CIDR
if (strpos ($range, '/') !== FALSE)
{
// Get the IP and netmask
list ($ip, $netmask) = explode ('/', $range, 2);
// Split decimal and pad to ensure we have 4 octets
$ip = implode ('.', array_pad (explode ('.', $ip), 4, 0));
// I... | php | public function formatRange ($range)
{
// CIDR
if (strpos ($range, '/') !== FALSE)
{
// Get the IP and netmask
list ($ip, $netmask) = explode ('/', $range, 2);
// Split decimal and pad to ensure we have 4 octets
$ip = implode ('.', array_pad (explode ('.', $ip), 4, 0));
// I... | [
"public",
"function",
"formatRange",
"(",
"$",
"range",
")",
"{",
"// CIDR",
"if",
"(",
"strpos",
"(",
"$",
"range",
",",
"'/'",
")",
"!==",
"FALSE",
")",
"{",
"// Get the IP and netmask",
"list",
"(",
"$",
"ip",
",",
"$",
"netmask",
")",
"=",
"explode... | Format an IP address range
Valid IP ranges can be:
Single: 192.168.1.1
CIDR: 192.168.1/24, 192.168.1.0/24 or 192.168.1.0/255.255.255.0
Wildcard: 192.168.1.*
Start-End: 192.168.1.0-192.168.1.255
@param string $range Valid IP range
@return FALSE|array (name, range) | [
"Format",
"an",
"IP",
"address",
"range"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/IP.php#L182-L325 | train |
andyburton/Sonic-Framework | src/Resource/IP.php | IP.isInside | protected function isInside ($ip, $name, $range)
{
// Single IP
if (!is_array ($range))
{
if ($ip == $range)
{
return TRUE;
}
}
// CIDR
elseif (strpos ($name, '/') !== FALSE)
{
if (($ip & $range[1]) == ($range[0] & $range[1]))
{
return TRUE;
}
}
// Start-End
elseif... | php | protected function isInside ($ip, $name, $range)
{
// Single IP
if (!is_array ($range))
{
if ($ip == $range)
{
return TRUE;
}
}
// CIDR
elseif (strpos ($name, '/') !== FALSE)
{
if (($ip & $range[1]) == ($range[0] & $range[1]))
{
return TRUE;
}
}
// Start-End
elseif... | [
"protected",
"function",
"isInside",
"(",
"$",
"ip",
",",
"$",
"name",
",",
"$",
"range",
")",
"{",
"// Single IP",
"if",
"(",
"!",
"is_array",
"(",
"$",
"range",
")",
")",
"{",
"if",
"(",
"$",
"ip",
"==",
"$",
"range",
")",
"{",
"return",
"TRUE"... | Return whether an IP is inside a range
@param intger $ip IP decimal to check
@param string $name IP Range name
@param string|array $range Valid IP range
@return boolean | [
"Return",
"whether",
"an",
"IP",
"is",
"inside",
"a",
"range"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/IP.php#L336-L373 | train |
andyburton/Sonic-Framework | src/Resource/IP.php | IP.isAllowed | public function isAllowed ($ip, $priority = 'deny,allow')
{
// Convert IP to decimal
$ipDec = (float)sprintf ("%u", ip2long ($ip));
// Check
foreach (explode (',', $priority) as $type)
{
switch ($type)
{
// Check if the IP is allowed
case 'allow':
foreach ($... | php | public function isAllowed ($ip, $priority = 'deny,allow')
{
// Convert IP to decimal
$ipDec = (float)sprintf ("%u", ip2long ($ip));
// Check
foreach (explode (',', $priority) as $type)
{
switch ($type)
{
// Check if the IP is allowed
case 'allow':
foreach ($... | [
"public",
"function",
"isAllowed",
"(",
"$",
"ip",
",",
"$",
"priority",
"=",
"'deny,allow'",
")",
"{",
"// Convert IP to decimal",
"$",
"ipDec",
"=",
"(",
"float",
")",
"sprintf",
"(",
"\"%u\"",
",",
"ip2long",
"(",
"$",
"ip",
")",
")",
";",
"// Check",... | Return whether an IP is allowed
@param string $ip IPv4 address
@param string $priority Order priority, default deny,allow
@return boolean | [
"Return",
"whether",
"an",
"IP",
"is",
"allowed"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/IP.php#L383-L434 | train |
alphacomm/alpharpc | src/AlphaRPC/Console/Command/WorkerStatus.php | WorkerStatus.row | protected function row($worker, $service, $current, $ready, $valid)
{
$mask = "| %-10.10s | %-40.40s | %-40.40s | %-5s | %-5s |";
$text = sprintf($mask, $worker, $service, $current, $ready, $valid);
$this->output->writeln($text);
} | php | protected function row($worker, $service, $current, $ready, $valid)
{
$mask = "| %-10.10s | %-40.40s | %-40.40s | %-5s | %-5s |";
$text = sprintf($mask, $worker, $service, $current, $ready, $valid);
$this->output->writeln($text);
} | [
"protected",
"function",
"row",
"(",
"$",
"worker",
",",
"$",
"service",
",",
"$",
"current",
",",
"$",
"ready",
",",
"$",
"valid",
")",
"{",
"$",
"mask",
"=",
"\"| %-10.10s | %-40.40s | %-40.40s | %-5s | %-5s |\"",
";",
"$",
"text",
"=",
"sprintf",
"(",
"... | Print a single line with information.
@param $worker
@param $service
@param $current
@param $ready
@param $valid | [
"Print",
"a",
"single",
"line",
"with",
"information",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Console/Command/WorkerStatus.php#L120-L125 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.parseValidKeys | protected static function parseValidKeys()
{
if (self::$validOptions !== null) {
return;
}
$refl = new ReflectionClass('\ZMQ');
$const = $refl->getConstants();
self::$validOptions = array();
foreach ($const as $key => $value) {
if (substr($key... | php | protected static function parseValidKeys()
{
if (self::$validOptions !== null) {
return;
}
$refl = new ReflectionClass('\ZMQ');
$const = $refl->getConstants();
self::$validOptions = array();
foreach ($const as $key => $value) {
if (substr($key... | [
"protected",
"static",
"function",
"parseValidKeys",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"validOptions",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"$",
"refl",
"=",
"new",
"ReflectionClass",
"(",
"'\\ZMQ'",
")",
";",
"$",
"const",
"=",
"$",... | Fills the attribute validOptions containing a list of options that
can be set.
@return null | [
"Fills",
"the",
"attribute",
"validOptions",
"containing",
"a",
"list",
"of",
"options",
"that",
"can",
"be",
"set",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L73-L87 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.isOptionKeyValid | public function isOptionKeyValid($key)
{
self::parseValidKeys();
if (isset(self::$validOptions[$key])) {
return true;
}
return false;
} | php | public function isOptionKeyValid($key)
{
self::parseValidKeys();
if (isset(self::$validOptions[$key])) {
return true;
}
return false;
} | [
"public",
"function",
"isOptionKeyValid",
"(",
"$",
"key",
")",
"{",
"self",
"::",
"parseValidKeys",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"validOptions",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",... | Checks if the given option key is valid for ZMQ.
@param mixed $key
@return boolean | [
"Checks",
"if",
"the",
"given",
"option",
"key",
"is",
"valid",
"for",
"ZMQ",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L96-L105 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.addOption | public function addOption($key, $value)
{
if (!$this->isOptionKeyValid($key)) {
throw new \RuntimeException('Invalid socket option '.$key.'.');
}
$this->options[$key] = $value;
return $this;
} | php | public function addOption($key, $value)
{
if (!$this->isOptionKeyValid($key)) {
throw new \RuntimeException('Invalid socket option '.$key.'.');
}
$this->options[$key] = $value;
return $this;
} | [
"public",
"function",
"addOption",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isOptionKeyValid",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Invalid socket option '",
".",
"$",
... | Overrides a default ZMQ option.
@param int $key
@param mixed $value
@return \AlphaRPC\Common\Socket\Factory
@throws \RuntimeException | [
"Overrides",
"a",
"default",
"ZMQ",
"option",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L116-L125 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.addOptions | public function addOptions($options)
{
foreach ($options as $key => $value) {
$this->addOption($key, $value);
}
return $this;
} | php | public function addOptions($options)
{
foreach ($options as $key => $value) {
$this->addOption($key, $value);
}
return $this;
} | [
"public",
"function",
"addOptions",
"(",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"addOption",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"... | Adds ZMQ socket options.
@param array $options
@return \AlphaRPC\Common\Socket\Factory
@throws \RuntimeException | [
"Adds",
"ZMQ",
"socket",
"options",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L135-L142 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.createPublisher | public function createPublisher($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_PUB, $mode, $dsn, $options);
} | php | public function createPublisher($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_PUB, $mode, $dsn, $options);
} | [
"public",
"function",
"createPublisher",
"(",
"$",
"mode",
",",
"$",
"dsn",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"createSocket",
"(",
"ZMQ",
"::",
"SOCKET_PUB",
",",
"$",
"mode",
",",
"$",
... | Creates a publiser socket.
@param string $mode
@param string|array $dsn
@param array $options
@return Socket | [
"Creates",
"a",
"publiser",
"socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L167-L170 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.createSubscriber | public function createSubscriber($mode, $dsn = null, $subscribe = '', $options = array())
{
$options[ZMQ::SOCKOPT_SUBSCRIBE] = $subscribe;
return $this->createSocket(ZMQ::SOCKET_SUB, $mode, $dsn, $options);
} | php | public function createSubscriber($mode, $dsn = null, $subscribe = '', $options = array())
{
$options[ZMQ::SOCKOPT_SUBSCRIBE] = $subscribe;
return $this->createSocket(ZMQ::SOCKET_SUB, $mode, $dsn, $options);
} | [
"public",
"function",
"createSubscriber",
"(",
"$",
"mode",
",",
"$",
"dsn",
"=",
"null",
",",
"$",
"subscribe",
"=",
"''",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"[",
"ZMQ",
"::",
"SOCKOPT_SUBSCRIBE",
"]",
"=",
"$",
... | Creates a subscriber socket.
@param string $mode
@param string $subscribe
@param string|array $dsn
@param array $options
@return Socket | [
"Creates",
"a",
"subscriber",
"socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L182-L187 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.createRequest | public function createRequest($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_REQ, $mode, $dsn, $options);
} | php | public function createRequest($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_REQ, $mode, $dsn, $options);
} | [
"public",
"function",
"createRequest",
"(",
"$",
"mode",
",",
"$",
"dsn",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"createSocket",
"(",
"ZMQ",
"::",
"SOCKET_REQ",
",",
"$",
"mode",
",",
"$",
"... | Creates a request socket.
@param string $mode
@param string|array $dsn
@param array $options
@return Socket | [
"Creates",
"a",
"request",
"socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L198-L201 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.createReply | public function createReply($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_REP, $mode, $dsn, $options);
} | php | public function createReply($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_REP, $mode, $dsn, $options);
} | [
"public",
"function",
"createReply",
"(",
"$",
"mode",
",",
"$",
"dsn",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"createSocket",
"(",
"ZMQ",
"::",
"SOCKET_REP",
",",
"$",
"mode",
",",
"$",
"ds... | Creates a reply socket.
@param string $mode
@param string|array $dsn
@param array $options
@return Socket | [
"Creates",
"a",
"reply",
"socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L212-L215 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.createRouter | public function createRouter($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_ROUTER, $mode, $dsn, $options);
} | php | public function createRouter($mode, $dsn = null, $options = array())
{
return $this->createSocket(ZMQ::SOCKET_ROUTER, $mode, $dsn, $options);
} | [
"public",
"function",
"createRouter",
"(",
"$",
"mode",
",",
"$",
"dsn",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"createSocket",
"(",
"ZMQ",
"::",
"SOCKET_ROUTER",
",",
"$",
"mode",
",",
"$",
... | Creates a router socket.
@param string $mode
@param string|array $dsn
@param array $options
@return Socket | [
"Creates",
"a",
"router",
"socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L226-L229 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.createSocket | protected function createSocket($type, $mode, $dsn = null, $options = array())
{
$context = $this->getContext();
$socket = new Socket($context, $type);
$options = $this->options + $options;
foreach ($options as $key => $value) {
$socket->setSockOpt($key, $value);
... | php | protected function createSocket($type, $mode, $dsn = null, $options = array())
{
$context = $this->getContext();
$socket = new Socket($context, $type);
$options = $this->options + $options;
foreach ($options as $key => $value) {
$socket->setSockOpt($key, $value);
... | [
"protected",
"function",
"createSocket",
"(",
"$",
"type",
",",
"$",
"mode",
",",
"$",
"dsn",
"=",
"null",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
";",
"$",
"socket",
... | Creates a socket.
@param int $type
@param string $mode
@param string $dsn
@param array $options
@return Socket | [
"Creates",
"a",
"socket",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L241-L254 | train |
alphacomm/alpharpc | src/AlphaRPC/Common/Socket/Factory.php | Factory.connect | public function connect(ZMQSocket $socket, $mode, $dsn)
{
if ($mode == self::MODE_CONSTRUCT) {
return $this;
}
$func = null;
if ($mode == self::MODE_BIND) {
$func = 'bind';
} elseif ($mode == self::MODE_CONNECT) {
$func = 'connect';
... | php | public function connect(ZMQSocket $socket, $mode, $dsn)
{
if ($mode == self::MODE_CONSTRUCT) {
return $this;
}
$func = null;
if ($mode == self::MODE_BIND) {
$func = 'bind';
} elseif ($mode == self::MODE_CONNECT) {
$func = 'connect';
... | [
"public",
"function",
"connect",
"(",
"ZMQSocket",
"$",
"socket",
",",
"$",
"mode",
",",
"$",
"dsn",
")",
"{",
"if",
"(",
"$",
"mode",
"==",
"self",
"::",
"MODE_CONSTRUCT",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"func",
"=",
"null",
";",
... | Connects or binds a socket based on mode.
@param ZMQSocket $socket
@param string $mode
@param string|array $dsn
@return \AlphaRPC\Common\Socket\Factory
@throws \RuntimeException | [
"Connects",
"or",
"binds",
"a",
"socket",
"based",
"on",
"mode",
"."
] | cf162854500554c4ba8d39f2675de35a49c30ed0 | https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Common/Socket/Factory.php#L266-L293 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Cmf/Framework/Media/Media/Domain/ProxyDomain.php | ProxyDomain.registerMediaDomain | public function registerMediaDomain($extensions, DomainInterface $mediaDomain)
{
foreach ((array) $extensions as $extensions) {
$this->mediaDomainsMap[strtolower($extensions)] = $mediaDomain;
}
} | php | public function registerMediaDomain($extensions, DomainInterface $mediaDomain)
{
foreach ((array) $extensions as $extensions) {
$this->mediaDomainsMap[strtolower($extensions)] = $mediaDomain;
}
} | [
"public",
"function",
"registerMediaDomain",
"(",
"$",
"extensions",
",",
"DomainInterface",
"$",
"mediaDomain",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"extensions",
"as",
"$",
"extensions",
")",
"{",
"$",
"this",
"->",
"mediaDomainsMap",
"[",
"st... | Register a media domain for given file extension set.
@param string|array $extensions
@param DomainInterface $mediaDomain | [
"Register",
"a",
"media",
"domain",
"for",
"given",
"file",
"extension",
"set",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Cmf/Framework/Media/Media/Domain/ProxyDomain.php#L37-L42 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Cmf/Framework/Media/Media/Domain/ProxyDomain.php | ProxyDomain.fetchDomain | private function fetchDomain($extension)
{
if (!array_key_exists($extension = strtolower($extension), $this->mediaDomainsMap)) {
throw new UnsupportedFileException(sprintf(
'Extension ".%s" isnt supported by Media component, only ["%s"] are.',
$extension,
... | php | private function fetchDomain($extension)
{
if (!array_key_exists($extension = strtolower($extension), $this->mediaDomainsMap)) {
throw new UnsupportedFileException(sprintf(
'Extension ".%s" isnt supported by Media component, only ["%s"] are.',
$extension,
... | [
"private",
"function",
"fetchDomain",
"(",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"extension",
"=",
"strtolower",
"(",
"$",
"extension",
")",
",",
"$",
"this",
"->",
"mediaDomainsMap",
")",
")",
"{",
"throw",
"new",
"Un... | Fetch and return domain matching given file extension.
@param string $extension
@return DomainInterface
@throws UnsupportedFileException If given extension isnt supported | [
"Fetch",
"and",
"return",
"domain",
"matching",
"given",
"file",
"extension",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Cmf/Framework/Media/Media/Domain/ProxyDomain.php#L53-L64 | train |
inhere/php-library-plus | libs/Auth/User.php | User.can | public function can($permission, array $params = [], $caching = true)
{
return $this->canAccess($permission, $params, $caching);
} | php | public function can($permission, array $params = [], $caching = true)
{
return $this->canAccess($permission, $params, $caching);
} | [
"public",
"function",
"can",
"(",
"$",
"permission",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"caching",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"canAccess",
"(",
"$",
"permission",
",",
"$",
"params",
",",
"$",
"caching",
... | check user permission
@param string $permission a permission name or a url
@param array $params
@param bool|true $caching
@return bool | [
"check",
"user",
"permission"
] | 8604e037937d31fa2338d79aaf9d0910cb48f559 | https://github.com/inhere/php-library-plus/blob/8604e037937d31fa2338d79aaf9d0910cb48f559/libs/Auth/User.php#L162-L165 | train |
PHPColibri/framework | Session/Session.php | Session.get | public static function get($dottedKey, $default = null)
{
if (self::$flashedVars) {
$flashedValue = Arr::get(self::$flashedVars, $dottedKey, '~no~flashed~value~');
if ($flashedValue !== '~no~flashed~value~') {
return $flashedValue;
}
}
ret... | php | public static function get($dottedKey, $default = null)
{
if (self::$flashedVars) {
$flashedValue = Arr::get(self::$flashedVars, $dottedKey, '~no~flashed~value~');
if ($flashedValue !== '~no~flashed~value~') {
return $flashedValue;
}
}
ret... | [
"public",
"static",
"function",
"get",
"(",
"$",
"dottedKey",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"flashedVars",
")",
"{",
"$",
"flashedValue",
"=",
"Arr",
"::",
"get",
"(",
"self",
"::",
"$",
"flashedVars",
",",... | Retrieve the value from session.
@param string $dottedKey
@param mixed $default
@return mixed | [
"Retrieve",
"the",
"value",
"from",
"session",
"."
] | 7e5b77141da5e5e7c63afc83592671321ac52f36 | https://github.com/PHPColibri/framework/blob/7e5b77141da5e5e7c63afc83592671321ac52f36/Session/Session.php#L53-L63 | train |
cymapgt/logger | src/Logger.php | Logger.addLogHandler | public function addLogHandler(array $logHandlers, $createLogger = false) {
try {
$this->configuredLogHandlers = array_merge($this->configuredLogHandlers, $logHandlers);
if ($createLogger === true) {
$this->createLogger($this->channelName);
$this->createLo... | php | public function addLogHandler(array $logHandlers, $createLogger = false) {
try {
$this->configuredLogHandlers = array_merge($this->configuredLogHandlers, $logHandlers);
if ($createLogger === true) {
$this->createLogger($this->channelName);
$this->createLo... | [
"public",
"function",
"addLogHandler",
"(",
"array",
"$",
"logHandlers",
",",
"$",
"createLogger",
"=",
"false",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"configuredLogHandlers",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"configuredLogHandlers",
",",
"$",
... | Add log handlers to the configuration
@param array $logHandlers - Array of log handler configuration. The alphanumeric keys are the namespace
@param bool $createLogger - Boolean flag. If true, create concrete Logger and instantiate the log handlers | [
"Add",
"log",
"handlers",
"to",
"the",
"configuration"
] | 8d042b21a9e13a3597c99084229781ab6151d78f | https://github.com/cymapgt/logger/blob/8d042b21a9e13a3597c99084229781ab6151d78f/src/Logger.php#L72-L88 | train |
cymapgt/logger | src/Logger.php | Logger.createLogHandlers | protected function createLogHandlers() {
$logHandlers = $this->configuredLogHandlers;
foreach ($logHandlers as $handlerNamespace => $handlerDetails) {
if (
is_array($handlerDetails)
&& array_key_exists('handler_parameters', $handlerDetai... | php | protected function createLogHandlers() {
$logHandlers = $this->configuredLogHandlers;
foreach ($logHandlers as $handlerNamespace => $handlerDetails) {
if (
is_array($handlerDetails)
&& array_key_exists('handler_parameters', $handlerDetai... | [
"protected",
"function",
"createLogHandlers",
"(",
")",
"{",
"$",
"logHandlers",
"=",
"$",
"this",
"->",
"configuredLogHandlers",
";",
"foreach",
"(",
"$",
"logHandlers",
"as",
"$",
"handlerNamespace",
"=>",
"$",
"handlerDetails",
")",
"{",
"if",
"(",
"is_arra... | Iterate the configured log handlers and create concrete handlers | [
"Iterate",
"the",
"configured",
"log",
"handlers",
"and",
"create",
"concrete",
"handlers"
] | 8d042b21a9e13a3597c99084229781ab6151d78f | https://github.com/cymapgt/logger/blob/8d042b21a9e13a3597c99084229781ab6151d78f/src/Logger.php#L102-L115 | train |
cymapgt/logger | src/Logger.php | Logger._getLoggerStderr | private static function _getLoggerStderr() {
if (!isset(self::$loggerStderr)) {
$CymapgtStderrLogger = new MonologLogger('cymapgt_stderr');
$CymapgtStderrLogger->pushHandler(new ErrorLogHandler());
self::$loggerStderr = $CymapgtStderrLogger;
}
return s... | php | private static function _getLoggerStderr() {
if (!isset(self::$loggerStderr)) {
$CymapgtStderrLogger = new MonologLogger('cymapgt_stderr');
$CymapgtStderrLogger->pushHandler(new ErrorLogHandler());
self::$loggerStderr = $CymapgtStderrLogger;
}
return s... | [
"private",
"static",
"function",
"_getLoggerStderr",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"loggerStderr",
")",
")",
"{",
"$",
"CymapgtStderrLogger",
"=",
"new",
"MonologLogger",
"(",
"'cymapgt_stderr'",
")",
";",
"$",
"CymapgtStder... | return the stderr logger
@return object
@private
@static | [
"return",
"the",
"stderr",
"logger"
] | 8d042b21a9e13a3597c99084229781ab6151d78f | https://github.com/cymapgt/logger/blob/8d042b21a9e13a3597c99084229781ab6151d78f/src/Logger.php#L179-L186 | train |
cymapgt/logger | src/Logger.php | Logger._getLoggerLevel1 | private static function _getLoggerLevel1($loggerParams) {
if (!isset(self::$loggerLevel1)) {
$CymapgtLevel1LogDir = $loggerParams['log_dir'];
$CymapgtLevel1Stream = new StreamHandler($CymapgtLevel1LogDir, MonologLogger::DEBUG);
$CymapgtLevel1Logger = new MonologLogger('cymapg... | php | private static function _getLoggerLevel1($loggerParams) {
if (!isset(self::$loggerLevel1)) {
$CymapgtLevel1LogDir = $loggerParams['log_dir'];
$CymapgtLevel1Stream = new StreamHandler($CymapgtLevel1LogDir, MonologLogger::DEBUG);
$CymapgtLevel1Logger = new MonologLogger('cymapg... | [
"private",
"static",
"function",
"_getLoggerLevel1",
"(",
"$",
"loggerParams",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"loggerLevel1",
")",
")",
"{",
"$",
"CymapgtLevel1LogDir",
"=",
"$",
"loggerParams",
"[",
"'log_dir'",
"]",
";",
"$",
... | return the level1 logger
@param array $loggerParams - Array of parameters to configure the level 1 logger
@return object
@private
@static | [
"return",
"the",
"level1",
"logger"
] | 8d042b21a9e13a3597c99084229781ab6151d78f | https://github.com/cymapgt/logger/blob/8d042b21a9e13a3597c99084229781ab6151d78f/src/Logger.php#L197-L206 | train |
cymapgt/logger | src/Logger.php | Logger._getLoggerLevel2 | private static function _getLoggerLevel2($loggerParams) {
if (!isset(self::$loggerLevel2)) {
$CymapgtLevel2LogDir = $loggerParams['log_dir'];
$CymapgtLevel2Stream = new StreamHandler($CymapgtLevel2LogDir, MonologLogger::ERROR);
$CymapgtLevel2Logger = new MonologLogger... | php | private static function _getLoggerLevel2($loggerParams) {
if (!isset(self::$loggerLevel2)) {
$CymapgtLevel2LogDir = $loggerParams['log_dir'];
$CymapgtLevel2Stream = new StreamHandler($CymapgtLevel2LogDir, MonologLogger::ERROR);
$CymapgtLevel2Logger = new MonologLogger... | [
"private",
"static",
"function",
"_getLoggerLevel2",
"(",
"$",
"loggerParams",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"loggerLevel2",
")",
")",
"{",
"$",
"CymapgtLevel2LogDir",
"=",
"$",
"loggerParams",
"[",
"'log_dir'",
"]",
";",
"$",
... | return the level2 logger
@param array $loggerParams - Array of parameters to configure the level 2 logger
@return object
@private
@static | [
"return",
"the",
"level2",
"logger"
] | 8d042b21a9e13a3597c99084229781ab6151d78f | https://github.com/cymapgt/logger/blob/8d042b21a9e13a3597c99084229781ab6151d78f/src/Logger.php#L217-L229 | train |
cymapgt/logger | src/Logger.php | Logger._getLoggerLevel3 | private static function _getLoggerLevel3($loggerParams) {
if (!isset(self::$loggerLevel3)) {
/*create notifier object for africas talking. If you are behind a proxy, the
*second parameter should be true, and your configuration array should contain
*the proxy serve... | php | private static function _getLoggerLevel3($loggerParams) {
if (!isset(self::$loggerLevel3)) {
/*create notifier object for africas talking. If you are behind a proxy, the
*second parameter should be true, and your configuration array should contain
*the proxy serve... | [
"private",
"static",
"function",
"_getLoggerLevel3",
"(",
"$",
"loggerParams",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"loggerLevel3",
")",
")",
"{",
"/*create notifier object for africas talking. If you are behind a proxy, the\n *second param... | return the level3 logger
@param array $loggerParams - Array of parameters to configure the level 3 logger
@return object
@private
@static | [
"return",
"the",
"level3",
"logger"
] | 8d042b21a9e13a3597c99084229781ab6151d78f | https://github.com/cymapgt/logger/blob/8d042b21a9e13a3597c99084229781ab6151d78f/src/Logger.php#L240-L262 | train |
cymapgt/logger | src/Logger.php | Logger._getLoggerSecurity | private static function _getLoggerSecurity($loggerParams) {
if (!isset(self::$loggerSecurity)) {
/*create notifier object for africas talking. If you are behind a proxy, the
*second parameter should be true, and your configuration array should contain
... | php | private static function _getLoggerSecurity($loggerParams) {
if (!isset(self::$loggerSecurity)) {
/*create notifier object for africas talking. If you are behind a proxy, the
*second parameter should be true, and your configuration array should contain
... | [
"private",
"static",
"function",
"_getLoggerSecurity",
"(",
"$",
"loggerParams",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"loggerSecurity",
")",
")",
"{",
"/*create notifier object for africas talking. If you are behind a proxy, the\n ... | return the security logger
@param array $loggerParams - Array of parameters to configure the security logger
@return object
@private
@static | [
"return",
"the",
"security",
"logger"
] | 8d042b21a9e13a3597c99084229781ab6151d78f | https://github.com/cymapgt/logger/blob/8d042b21a9e13a3597c99084229781ab6151d78f/src/Logger.php#L273-L295 | train |
IStranger/yii2-resource-smart-load | base/BaseObject.php | BaseObject.setProperties | public function setProperties($propValues)
{
foreach ($propValues as $propName => $propValue) {
if (property_exists($this, $propName)) {
$this->{$propName} = $propValue;
} else {
$this->throwException('Property "%propName%" does not exist in class "%cl... | php | public function setProperties($propValues)
{
foreach ($propValues as $propName => $propValue) {
if (property_exists($this, $propName)) {
$this->{$propName} = $propValue;
} else {
$this->throwException('Property "%propName%" does not exist in class "%cl... | [
"public",
"function",
"setProperties",
"(",
"$",
"propValues",
")",
"{",
"foreach",
"(",
"$",
"propValues",
"as",
"$",
"propName",
"=>",
"$",
"propValue",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"propName",
")",
")",
"{",
"$... | Sets properties values
@param array $propValues Array of properties values in format: ['propName' => 'propValue'] | [
"Sets",
"properties",
"values"
] | a4f203745d9a02fd97853b49c55b287aea6d7e6d | https://github.com/IStranger/yii2-resource-smart-load/blob/a4f203745d9a02fd97853b49c55b287aea6d7e6d/base/BaseObject.php#L28-L40 | train |
akumar2-velsof/guzzlehttp | src/Pool.php | Pool.batch | public static function batch(
ClientInterface $client,
$requests,
array $options = []
) {
$hash = new \SplObjectStorage();
foreach ($requests as $request) {
$hash->attach($request);
}
// In addition to the normally run events when requests complet... | php | public static function batch(
ClientInterface $client,
$requests,
array $options = []
) {
$hash = new \SplObjectStorage();
foreach ($requests as $request) {
$hash->attach($request);
}
// In addition to the normally run events when requests complet... | [
"public",
"static",
"function",
"batch",
"(",
"ClientInterface",
"$",
"client",
",",
"$",
"requests",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"hash",
"=",
"new",
"\\",
"SplObjectStorage",
"(",
")",
";",
"foreach",
"(",
"$",
"request... | Sends multiple requests in parallel and returns an array of responses
and exceptions that uses the same ordering as the provided requests.
IMPORTANT: This method keeps every request and response in memory, and
as such, is NOT recommended when sending a large number or an
indeterminate number of requests concurrently.
... | [
"Sends",
"multiple",
"requests",
"in",
"parallel",
"and",
"returns",
"an",
"array",
"of",
"responses",
"and",
"exceptions",
"that",
"uses",
"the",
"same",
"ordering",
"as",
"the",
"provided",
"requests",
"."
] | 9588a489c52b27e2d4047f146ddacffc3e111b7e | https://github.com/akumar2-velsof/guzzlehttp/blob/9588a489c52b27e2d4047f146ddacffc3e111b7e/src/Pool.php#L109-L135 | train |
akumar2-velsof/guzzlehttp | src/Pool.php | Pool.send | public static function send(
ClientInterface $client,
$requests,
array $options = []
) {
$pool = new self($client, $requests, $options);
$pool->wait();
} | php | public static function send(
ClientInterface $client,
$requests,
array $options = []
) {
$pool = new self($client, $requests, $options);
$pool->wait();
} | [
"public",
"static",
"function",
"send",
"(",
"ClientInterface",
"$",
"client",
",",
"$",
"requests",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"pool",
"=",
"new",
"self",
"(",
"$",
"client",
",",
"$",
"requests",
",",
"$",
"options"... | Creates a Pool and immediately sends the requests.
@param ClientInterface $client Client used to send the requests
@param array|\Iterator $requests Requests to send in parallel
@param array $options Passes through the options available in
{@see GuzzleHttp1\Pool::__construct} | [
"Creates",
"a",
"Pool",
"and",
"immediately",
"sends",
"the",
"requests",
"."
] | 9588a489c52b27e2d4047f146ddacffc3e111b7e | https://github.com/akumar2-velsof/guzzlehttp/blob/9588a489c52b27e2d4047f146ddacffc3e111b7e/src/Pool.php#L145-L152 | train |
akumar2-velsof/guzzlehttp | src/Pool.php | Pool.addNextRequests | private function addNextRequests()
{
$limit = max($this->getPoolSize() - count($this->waitQueue), 0);
while ($limit--) {
if (!$this->addNextRequest()) {
break;
}
}
} | php | private function addNextRequests()
{
$limit = max($this->getPoolSize() - count($this->waitQueue), 0);
while ($limit--) {
if (!$this->addNextRequest()) {
break;
}
}
} | [
"private",
"function",
"addNextRequests",
"(",
")",
"{",
"$",
"limit",
"=",
"max",
"(",
"$",
"this",
"->",
"getPoolSize",
"(",
")",
"-",
"count",
"(",
"$",
"this",
"->",
"waitQueue",
")",
",",
"0",
")",
";",
"while",
"(",
"$",
"limit",
"--",
")",
... | Add as many requests as possible up to the current pool limit. | [
"Add",
"as",
"many",
"requests",
"as",
"possible",
"up",
"to",
"the",
"current",
"pool",
"limit",
"."
] | 9588a489c52b27e2d4047f146ddacffc3e111b7e | https://github.com/akumar2-velsof/guzzlehttp/blob/9588a489c52b27e2d4047f146ddacffc3e111b7e/src/Pool.php#L164-L172 | train |
akumar2-velsof/guzzlehttp | src/Pool.php | Pool.addNextRequest | private function addNextRequest()
{
add_next:
if ($this->isRealized || !$this->iter || !$this->iter->valid()) {
return false;
}
$request = $this->iter->current();
$this->iter->next();
if (!($request instanceof RequestInterface)) {
throw new ... | php | private function addNextRequest()
{
add_next:
if ($this->isRealized || !$this->iter || !$this->iter->valid()) {
return false;
}
$request = $this->iter->current();
$this->iter->next();
if (!($request instanceof RequestInterface)) {
throw new ... | [
"private",
"function",
"addNextRequest",
"(",
")",
"{",
"add_next",
":",
"if",
"(",
"$",
"this",
"->",
"isRealized",
"||",
"!",
"$",
"this",
"->",
"iter",
"||",
"!",
"$",
"this",
"->",
"iter",
"->",
"valid",
"(",
")",
")",
"{",
"return",
"false",
"... | Adds the next request to pool and tracks what requests need to be
dereferenced when completing the pool. | [
"Adds",
"the",
"next",
"request",
"to",
"pool",
"and",
"tracks",
"what",
"requests",
"need",
"to",
"be",
"dereferenced",
"when",
"completing",
"the",
"pool",
"."
] | 9588a489c52b27e2d4047f146ddacffc3e111b7e | https://github.com/akumar2-velsof/guzzlehttp/blob/9588a489c52b27e2d4047f146ddacffc3e111b7e/src/Pool.php#L267-L318 | train |
ellipsephp/handlers-adr | src/ActionRequestHandler.php | ActionRequestHandler.handle | public function handle(ServerRequestInterface $request): ResponseInterface
{
$input = $this->input($request);
$payload = $this->domain->payload($input);
return $this->responder->response($request, $payload);
} | php | public function handle(ServerRequestInterface $request): ResponseInterface
{
$input = $this->input($request);
$payload = $this->domain->payload($input);
return $this->responder->response($request, $payload);
} | [
"public",
"function",
"handle",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ResponseInterface",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"input",
"(",
"$",
"request",
")",
";",
"$",
"payload",
"=",
"$",
"this",
"->",
"domain",
"->",
"payl... | Return a response by following the action domain responder pattern.
@param \Psr\Http\Message\ServerRequestInterface $request
@return \Psr\Http\Message\ResponseInterface | [
"Return",
"a",
"response",
"by",
"following",
"the",
"action",
"domain",
"responder",
"pattern",
"."
] | 1c0879494a8b7718f7e157d0cd41b4c5ec19b5c5 | https://github.com/ellipsephp/handlers-adr/blob/1c0879494a8b7718f7e157d0cd41b4c5ec19b5c5/src/ActionRequestHandler.php#L57-L64 | train |
ellipsephp/handlers-adr | src/ActionRequestHandler.php | ActionRequestHandler.input | private function input(ServerRequestInterface $request): array
{
if (! is_null($this->parser)) {
$input = ($this->parser)($request);
if (is_array($input)) {
return $input;
}
throw new InputTypeException($input);
}
return ... | php | private function input(ServerRequestInterface $request): array
{
if (! is_null($this->parser)) {
$input = ($this->parser)($request);
if (is_array($input)) {
return $input;
}
throw new InputTypeException($input);
}
return ... | [
"private",
"function",
"input",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"parser",
")",
")",
"{",
"$",
"input",
"=",
"(",
"$",
"this",
"->",
"parser",
")",
"(",
"$",
"... | Return an input array from the given request using the request parser.
@param \Psr\Http\Message\ServerRequestInterface $request
@return array
@throws \Ellipse\Handlers\Exceptions\InputTypeException | [
"Return",
"an",
"input",
"array",
"from",
"the",
"given",
"request",
"using",
"the",
"request",
"parser",
"."
] | 1c0879494a8b7718f7e157d0cd41b4c5ec19b5c5 | https://github.com/ellipsephp/handlers-adr/blob/1c0879494a8b7718f7e157d0cd41b4c5ec19b5c5/src/ActionRequestHandler.php#L73-L95 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Helper/Languages.php | Radial_Core_Helper_Languages.getStores | public function getStores($langCode = null)
{
$stores = array();
foreach (Mage::app()->getWebsites() as $website) {
$stores = array_replace($stores, $this->getWebsiteStores($website, $langCode));
}
return $stores;
} | php | public function getStores($langCode = null)
{
$stores = array();
foreach (Mage::app()->getWebsites() as $website) {
$stores = array_replace($stores, $this->getWebsiteStores($website, $langCode));
}
return $stores;
} | [
"public",
"function",
"getStores",
"(",
"$",
"langCode",
"=",
"null",
")",
"{",
"$",
"stores",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"Mage",
"::",
"app",
"(",
")",
"->",
"getWebsites",
"(",
")",
"as",
"$",
"website",
")",
"{",
"$",
"stores",... | Return an array of stores and attach a language code to them, Varien_Object style
@param string $langCode (optional) if passed, only stores using that langCode are returned.
@return array of Mage_Core_Model_Store, keyed by StoreId. Each store has a new magic getter 'getLanguageCode()' | [
"Return",
"an",
"array",
"of",
"stores",
"and",
"attach",
"a",
"language",
"code",
"to",
"them",
"Varien_Object",
"style"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Helper/Languages.php#L61-L68 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Helper/Languages.php | Radial_Core_Helper_Languages.getWebsiteStores | public function getWebsiteStores($website, $langCode = null)
{
$stores = array();
$config = Mage::helper('radial_core')->getConfigModel();
$website = Mage::app()->getWebsite($website);
foreach ($website->getGroups() as $group) {
foreach ($group->getStores() as $store) {
... | php | public function getWebsiteStores($website, $langCode = null)
{
$stores = array();
$config = Mage::helper('radial_core')->getConfigModel();
$website = Mage::app()->getWebsite($website);
foreach ($website->getGroups() as $group) {
foreach ($group->getStores() as $store) {
... | [
"public",
"function",
"getWebsiteStores",
"(",
"$",
"website",
",",
"$",
"langCode",
"=",
"null",
")",
"{",
"$",
"stores",
"=",
"array",
"(",
")",
";",
"$",
"config",
"=",
"Mage",
"::",
"helper",
"(",
"'radial_core'",
")",
"->",
"getConfigModel",
"(",
... | Return an array of stores for the given website and attach a language code to them, Varien_Object style
@param mixed $website the website to get stores from.
@param string $langCode (optional) if passed, only stores using that langCode are returned.
@return array of Mage_Core_Model_Store, keyed by StoreId. Each store... | [
"Return",
"an",
"array",
"of",
"stores",
"for",
"the",
"given",
"website",
"and",
"attach",
"a",
"language",
"code",
"to",
"them",
"Varien_Object",
"style"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Helper/Languages.php#L75-L91 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Core/Helper/Languages.php | Radial_Core_Helper_Languages.getLanguageCodesList | public function getLanguageCodesList()
{
$languages = array();
foreach ($this->getStores() as $store) {
$languages[] = $store->getLanguageCode();
}
return array_unique($languages);
} | php | public function getLanguageCodesList()
{
$languages = array();
foreach ($this->getStores() as $store) {
$languages[] = $store->getLanguageCode();
}
return array_unique($languages);
} | [
"public",
"function",
"getLanguageCodesList",
"(",
")",
"{",
"$",
"languages",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getStores",
"(",
")",
"as",
"$",
"store",
")",
"{",
"$",
"languages",
"[",
"]",
"=",
"$",
"store",
"->",
... | Get a simple array of all language codes used in this installation
@return array | [
"Get",
"a",
"simple",
"array",
"of",
"all",
"language",
"codes",
"used",
"in",
"this",
"installation"
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Helper/Languages.php#L96-L103 | train |
rkeet/zf-doctrine-mvc | src/Controller/AbstractActionController.php | AbstractActionController.redirectToRoute | public function redirectToRoute()
{
if ($this->getRequest()
->isXmlHttpRequest()) {
return [
'redirect' => call_user_func_array(
[
$this->url(),
'fromRoute',
],
... | php | public function redirectToRoute()
{
if ($this->getRequest()
->isXmlHttpRequest()) {
return [
'redirect' => call_user_func_array(
[
$this->url(),
'fromRoute',
],
... | [
"public",
"function",
"redirectToRoute",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"return",
"[",
"'redirect'",
"=>",
"call_user_func_array",
"(",
"[",
"$",
"this",
"->",
"url",
"("... | Redirect to a route, or pass the url to the view for a javascript redirect
@return mixed|\Zend\Http\Response | [
"Redirect",
"to",
"a",
"route",
"or",
"pass",
"the",
"url",
"to",
"the",
"view",
"for",
"a",
"javascript",
"redirect"
] | ec5fb19e453824383b39570d15bd77b85cec3ca1 | https://github.com/rkeet/zf-doctrine-mvc/blob/ec5fb19e453824383b39570d15bd77b85cec3ca1/src/Controller/AbstractActionController.php#L14-L36 | train |
dark-prospect-games/obsidian-moon-engine | src/Modules/Input.php | Input.fetchFromArray | protected function fetchFromArray(
array $array,
string $index = '',
$xss_clean = false
) {
if (!array_key_exists($index, $array)) {
return false;
}
// Checks to see if the variable is set, since 0 returns as false.
if ($xss_clean === 'isset') {
... | php | protected function fetchFromArray(
array $array,
string $index = '',
$xss_clean = false
) {
if (!array_key_exists($index, $array)) {
return false;
}
// Checks to see if the variable is set, since 0 returns as false.
if ($xss_clean === 'isset') {
... | [
"protected",
"function",
"fetchFromArray",
"(",
"array",
"$",
"array",
",",
"string",
"$",
"index",
"=",
"''",
",",
"$",
"xss_clean",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"index",
",",
"$",
"array",
")",
")",
"{",
"re... | The function that will handle getting the data from the arrays.
@param mixed $array The array that will pulled from.
@param string $index What we are looking for.
@param boolean $xss_clean Whether to clean it or not or not. Incomplete.
@since 1.0.0
@return mixed | [
"The",
"function",
"that",
"will",
"handle",
"getting",
"the",
"data",
"from",
"the",
"arrays",
"."
] | 83b82990bdea79960a93b52f963cc81b6fa009ba | https://github.com/dark-prospect-games/obsidian-moon-engine/blob/83b82990bdea79960a93b52f963cc81b6fa009ba/src/Modules/Input.php#L60-L75 | train |
acacha/forge-publish | src/Console/Commands/PublishKeyGenerate.php | PublishKeyGenerate.keyIsAlreadyInstalled | protected function keyIsAlreadyInstalled()
{
$key = 'APP_KEY=base64:';
$output = $this->execSSH("cd $this->domain;cat .env");
if (str_contains($output, $key)) {
return true;
}
return false;
} | php | protected function keyIsAlreadyInstalled()
{
$key = 'APP_KEY=base64:';
$output = $this->execSSH("cd $this->domain;cat .env");
if (str_contains($output, $key)) {
return true;
}
return false;
} | [
"protected",
"function",
"keyIsAlreadyInstalled",
"(",
")",
"{",
"$",
"key",
"=",
"'APP_KEY=base64:'",
";",
"$",
"output",
"=",
"$",
"this",
"->",
"execSSH",
"(",
"\"cd $this->domain;cat .env\"",
")",
";",
"if",
"(",
"str_contains",
"(",
"$",
"output",
",",
... | Key is already installed on production?
@return bool | [
"Key",
"is",
"already",
"installed",
"on",
"production?"
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishKeyGenerate.php#L88-L96 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.getRouteInfo | public function getRouteInfo()
{
if ($this->isSingle()) {
if (isset($this->containers['route_info']) && ($controller = $this->containers['route_info']->get('controller'))
&& ($action = $this->containers['route_info']->get('action'))
) {
return ['contr... | php | public function getRouteInfo()
{
if ($this->isSingle()) {
if (isset($this->containers['route_info']) && ($controller = $this->containers['route_info']->get('controller'))
&& ($action = $this->containers['route_info']->get('action'))
) {
return ['contr... | [
"public",
"function",
"getRouteInfo",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"containers",
"[",
"'route_info'",
"]",
")",
"&&",
"(",
"$",
"controller",
"=",
"$",
"thi... | Get Route Info
@return array | [
"Get",
"Route",
"Info"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L197-L207 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.isHome | public function isHome()
{
if ($this->isSingle()) {
if (isset($this->containers['route_info'])) {
$home_controller = 'index';
$home_action = 'index';
$home = $this->getHome();
if ($home && isset($home['controller']) && isset($home['... | php | public function isHome()
{
if ($this->isSingle()) {
if (isset($this->containers['route_info'])) {
$home_controller = 'index';
$home_action = 'index';
$home = $this->getHome();
if ($home && isset($home['controller']) && isset($home['... | [
"public",
"function",
"isHome",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"containers",
"[",
"'route_info'",
"]",
")",
")",
"{",
"$",
"home_controller",
"=",
"'index'",
... | If is home | [
"If",
"is",
"home"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L210-L227 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.getHomeUri | public function getHomeUri()
{
$homeUri = '';
if ($this->isSingle()) {
$controller = 'index';
$action = 'index';
$home = $this->getHome();
if (isset($home['controller']) && isset($home['action']) && $home['controller'] && $home['action']) {
... | php | public function getHomeUri()
{
$homeUri = '';
if ($this->isSingle()) {
$controller = 'index';
$action = 'index';
$home = $this->getHome();
if (isset($home['controller']) && isset($home['action']) && $home['controller'] && $home['action']) {
... | [
"public",
"function",
"getHomeUri",
"(",
")",
"{",
"$",
"homeUri",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"$",
"controller",
"=",
"'index'",
";",
"$",
"action",
"=",
"'index'",
";",
"$",
"home",
"=",
"$",
"t... | Get Home Uri | [
"Get",
"Home",
"Uri"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L230-L248 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.getDb | public function getDb($db_type, $node_type)
{
if ($this->isSingle()) {
switch ($db_type) {
case Connection::DB_TYPE:
switch ($node_type) {
case 'master':
return Connection::component()->write_conn;
case 'slave':
... | php | public function getDb($db_type, $node_type)
{
if ($this->isSingle()) {
switch ($db_type) {
case Connection::DB_TYPE:
switch ($node_type) {
case 'master':
return Connection::component()->write_conn;
case 'slave':
... | [
"public",
"function",
"getDb",
"(",
"$",
"db_type",
",",
"$",
"node_type",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"switch",
"(",
"$",
"db_type",
")",
"{",
"case",
"Connection",
"::",
"DB_TYPE",
":",
"switch",
"(",
"... | Get Db Connection | [
"Get",
"Db",
"Connection"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L282-L302 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.createAbsoluteUrl | public function createAbsoluteUrl($uri, $query_params = [], $ssl = false, $port = 80, $request = null)
{
if ($this->isSingle()) {
return UrlManager::createAbsoluteUrl($uri, $query_params, $ssl, $port, $request);
}
return '';
} | php | public function createAbsoluteUrl($uri, $query_params = [], $ssl = false, $port = 80, $request = null)
{
if ($this->isSingle()) {
return UrlManager::createAbsoluteUrl($uri, $query_params, $ssl, $port, $request);
}
return '';
} | [
"public",
"function",
"createAbsoluteUrl",
"(",
"$",
"uri",
",",
"$",
"query_params",
"=",
"[",
"]",
",",
"$",
"ssl",
"=",
"false",
",",
"$",
"port",
"=",
"80",
",",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
... | Create Absolute Url | [
"Create",
"Absolute",
"Url"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L313-L319 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.getParam | public function getParam($param_name, $default_value = null)
{
if ($this->isSingle()) {
return RequestKit::getParam($param_name, $default_value);
}
return false;
} | php | public function getParam($param_name, $default_value = null)
{
if ($this->isSingle()) {
return RequestKit::getParam($param_name, $default_value);
}
return false;
} | [
"public",
"function",
"getParam",
"(",
"$",
"param_name",
",",
"$",
"default_value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"return",
"RequestKit",
"::",
"getParam",
"(",
"$",
"param_name",
",",
"$",
"defau... | Get Http Request Param Value | [
"Get",
"Http",
"Request",
"Param",
"Value"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L331-L337 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.import | public function import($path)
{
if ($this->isSingle()) {
if (file_exists($path) && strtolower(FileHelper::getExtensionName($path)) == 'php') {
include_once str_replace(Security::INSECURE_CODES, '', $path);
}
}
} | php | public function import($path)
{
if ($this->isSingle()) {
if (file_exists($path) && strtolower(FileHelper::getExtensionName($path)) == 'php') {
include_once str_replace(Security::INSECURE_CODES, '', $path);
}
}
} | [
"public",
"function",
"import",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
"&&",
"strtolower",
"(",
"FileHelper",
"::",
"getExtensionName",
"(",
"$",
"pat... | Import PHP File | [
"Import",
"PHP",
"File"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L367-L374 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.swiftSend | public function swiftSend(
$from_name,
$receivers,
&$successfulRecipients,
&$failedRecipients,
$subject = '',
$body = '',
$content_type = 'text/html',
$charset = 'UTF-8'
) {
if ($this->isSingle()) {
Swift::component()->send(
... | php | public function swiftSend(
$from_name,
$receivers,
&$successfulRecipients,
&$failedRecipients,
$subject = '',
$body = '',
$content_type = 'text/html',
$charset = 'UTF-8'
) {
if ($this->isSingle()) {
Swift::component()->send(
... | [
"public",
"function",
"swiftSend",
"(",
"$",
"from_name",
",",
"$",
"receivers",
",",
"&",
"$",
"successfulRecipients",
",",
"&",
"$",
"failedRecipients",
",",
"$",
"subject",
"=",
"''",
",",
"$",
"body",
"=",
"''",
",",
"$",
"content_type",
"=",
"'text/... | Send Swift Mail | [
"Send",
"Swift",
"Mail"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L386-L409 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.loginRequired | public function loginRequired($redirect_url, $request = null, $response = null)
{
if ($this->isSingle()) {
User::loginRequired($redirect_url, $request, $response);
}
} | php | public function loginRequired($redirect_url, $request = null, $response = null)
{
if ($this->isSingle()) {
User::loginRequired($redirect_url, $request, $response);
}
} | [
"public",
"function",
"loginRequired",
"(",
"$",
"redirect_url",
",",
"$",
"request",
"=",
"null",
",",
"$",
"response",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"User",
"::",
"loginRequired",
"(",
"$",
"re... | Check If Logged In
@param $redirect_url
@param RequestContract $request
@param ResponseContract $response | [
"Check",
"If",
"Logged",
"In"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L418-L423 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.isAction | public function isAction($request = null)
{
$is_action = false;
if ($this->isSingle()) {
$queryString = $request ? $request->getQueryString() : Lb::app()->getQueryString();
$requestUri = $request ? $request->getUri() : Lb::app()->getUri();
if (Lb::app()->isPrettyU... | php | public function isAction($request = null)
{
$is_action = false;
if ($this->isSingle()) {
$queryString = $request ? $request->getQueryString() : Lb::app()->getQueryString();
$requestUri = $request ? $request->getUri() : Lb::app()->getUri();
if (Lb::app()->isPrettyU... | [
"public",
"function",
"isAction",
"(",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"is_action",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"$",
"queryString",
"=",
"$",
"request",
"?",
"$",
"request",
"->",
"ge... | Detect Action Exists
@param RequestContract $request
@return bool | [
"Detect",
"Action",
"Exists"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L478-L496 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.get_rpc_client | public function get_rpc_client($url)
{
if ($this->isSingle()) {
include_once Lb::app()->getRootDir() . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'hprose' .
DIRECTORY_SEPARATOR . 'hprose' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Hprose.php';
retu... | php | public function get_rpc_client($url)
{
if ($this->isSingle()) {
include_once Lb::app()->getRootDir() . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'hprose' .
DIRECTORY_SEPARATOR . 'hprose' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Hprose.php';
retu... | [
"public",
"function",
"get_rpc_client",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"include_once",
"Lb",
"::",
"app",
"(",
")",
"->",
"getRootDir",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"'vendor'",
"."... | Get RPC Client | [
"Get",
"RPC",
"Client"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L551-L559 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.on | public function on($event_name, $listener, $data = null)
{
if ($this->isSingle()) {
BaseObserver::on($event_name, $listener, $data);
}
} | php | public function on($event_name, $listener, $data = null)
{
if ($this->isSingle()) {
BaseObserver::on($event_name, $listener, $data);
}
} | [
"public",
"function",
"on",
"(",
"$",
"event_name",
",",
"$",
"listener",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"BaseObserver",
"::",
"on",
"(",
"$",
"event_name",
",",
"$",
"listener... | Register Event Listener | [
"Register",
"Event",
"Listener"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L571-L576 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.dispatchJob | public function dispatchJob($job, $data = [], $handler = 'handler')
{
if ($this->isSingle()) {
if (!is_object($job)) {
$job = new $job;
}
return call_user_func_array([$job, $handler], ['data' => $data]);
}
return null;
} | php | public function dispatchJob($job, $data = [], $handler = 'handler')
{
if ($this->isSingle()) {
if (!is_object($job)) {
$job = new $job;
}
return call_user_func_array([$job, $handler], ['data' => $data]);
}
return null;
} | [
"public",
"function",
"dispatchJob",
"(",
"$",
"job",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"handler",
"=",
"'handler'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSingle",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"job",
... | Dispatch a job
@param $job
@param array $data
@param string $handler
@return mixed | [
"Dispatch",
"a",
"job"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L609-L619 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.loadEnv | protected function loadEnv()
{
if (defined('ENV_DIR') && file_exists(ENV_DIR)) {
if (defined('ENV_FILE') && file_exists(ENV_FILE)) {
$dotenv = new \Dotenv\Dotenv(ENV_DIR, ENV_FILE);
} else {
$dotenv = new \Dotenv\Dotenv(ENV_DIR);
}
... | php | protected function loadEnv()
{
if (defined('ENV_DIR') && file_exists(ENV_DIR)) {
if (defined('ENV_FILE') && file_exists(ENV_FILE)) {
$dotenv = new \Dotenv\Dotenv(ENV_DIR, ENV_FILE);
} else {
$dotenv = new \Dotenv\Dotenv(ENV_DIR);
}
... | [
"protected",
"function",
"loadEnv",
"(",
")",
"{",
"if",
"(",
"defined",
"(",
"'ENV_DIR'",
")",
"&&",
"file_exists",
"(",
"ENV_DIR",
")",
")",
"{",
"if",
"(",
"defined",
"(",
"'ENV_FILE'",
")",
"&&",
"file_exists",
"(",
"ENV_FILE",
")",
")",
"{",
"$",
... | Load Environment Variables | [
"Load",
"Environment",
"Variables"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L667-L677 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.getPageCache | protected function getPageCache($cache_type)
{
$route_info = Lb::app()->getRouteInfo();
$page_cache_key = implode('_', ['page_cache', $route_info['controller'], $route_info['action']]);
return Lb::app()->getCache($page_cache_key, $cache_type);
} | php | protected function getPageCache($cache_type)
{
$route_info = Lb::app()->getRouteInfo();
$page_cache_key = implode('_', ['page_cache', $route_info['controller'], $route_info['action']]);
return Lb::app()->getCache($page_cache_key, $cache_type);
} | [
"protected",
"function",
"getPageCache",
"(",
"$",
"cache_type",
")",
"{",
"$",
"route_info",
"=",
"Lb",
"::",
"app",
"(",
")",
"->",
"getRouteInfo",
"(",
")",
";",
"$",
"page_cache_key",
"=",
"implode",
"(",
"'_'",
",",
"[",
"'page_cache'",
",",
"$",
... | Get Page Cache
@param $cache_type
@return string | [
"Get",
"Page",
"Cache"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L928-L933 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.setPageCache | protected function setPageCache($cache_type, $page_cache, $expire = 60)
{
$route_info = Lb::app()->getRouteInfo();
$page_cache_key = implode('_', ['page_cache', $route_info['controller'], $route_info['action']]);
Lb::app()->setCache($page_cache_key, $page_cache, $cache_type, $expire);
} | php | protected function setPageCache($cache_type, $page_cache, $expire = 60)
{
$route_info = Lb::app()->getRouteInfo();
$page_cache_key = implode('_', ['page_cache', $route_info['controller'], $route_info['action']]);
Lb::app()->setCache($page_cache_key, $page_cache, $cache_type, $expire);
} | [
"protected",
"function",
"setPageCache",
"(",
"$",
"cache_type",
",",
"$",
"page_cache",
",",
"$",
"expire",
"=",
"60",
")",
"{",
"$",
"route_info",
"=",
"Lb",
"::",
"app",
"(",
")",
"->",
"getRouteInfo",
"(",
")",
";",
"$",
"page_cache_key",
"=",
"imp... | Set Page Cache
@param $cache_type
@param $page_cache
@param int $expire | [
"Set",
"Page",
"Cache"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L942-L947 | train |
luoxiaojun1992/lb_framework | Lb.php | Lb.setHttpCache | protected function setHttpCache($response = null)
{
$http_cache_config = Lb::app()->getHttpCacheConfig();
if (isset($http_cache_config['cache_control']) && isset($http_cache_config['offset'])) {
HttpHelper::setCache($http_cache_config['cache_control'], $http_cache_config['offset'], $resp... | php | protected function setHttpCache($response = null)
{
$http_cache_config = Lb::app()->getHttpCacheConfig();
if (isset($http_cache_config['cache_control']) && isset($http_cache_config['offset'])) {
HttpHelper::setCache($http_cache_config['cache_control'], $http_cache_config['offset'], $resp... | [
"protected",
"function",
"setHttpCache",
"(",
"$",
"response",
"=",
"null",
")",
"{",
"$",
"http_cache_config",
"=",
"Lb",
"::",
"app",
"(",
")",
"->",
"getHttpCacheConfig",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"http_cache_config",
"[",
"'cache_con... | Set Http Cache
@param $response ResponseContract | [
"Set",
"Http",
"Cache"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/Lb.php#L954-L960 | train |
infusephp/auth | src/Libs/Storage/SymfonySessionStorage.php | SymfonySessionStorage.createSession | private function createSession($sid, $userId, Request $req)
{
$sessionCookie = session_get_cookie_params();
$expires = time() + $sessionCookie['lifetime'];
$session = new ActiveSession();
$session->id = $sid;
$session->user_id = $userId;
$session->ip = $req->ip();
... | php | private function createSession($sid, $userId, Request $req)
{
$sessionCookie = session_get_cookie_params();
$expires = time() + $sessionCookie['lifetime'];
$session = new ActiveSession();
$session->id = $sid;
$session->user_id = $userId;
$session->ip = $req->ip();
... | [
"private",
"function",
"createSession",
"(",
"$",
"sid",
",",
"$",
"userId",
",",
"Request",
"$",
"req",
")",
"{",
"$",
"sessionCookie",
"=",
"session_get_cookie_params",
"(",
")",
";",
"$",
"expires",
"=",
"time",
"(",
")",
"+",
"$",
"sessionCookie",
"[... | Creates an active session for a user.
@param string $sid session ID
@param int $userId
@param Request $req
@return ActiveSession | [
"Creates",
"an",
"active",
"session",
"for",
"a",
"user",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/Storage/SymfonySessionStorage.php#L218-L232 | train |
infusephp/auth | src/Libs/Storage/SymfonySessionStorage.php | SymfonySessionStorage.refreshSession | private function refreshSession($sid)
{
$sessionCookie = session_get_cookie_params();
$expires = time() + $sessionCookie['lifetime'];
$this->getDatabase()
->update('ActiveSessions')
->where('id', $sid)
->values([
'expires' => $expires,
... | php | private function refreshSession($sid)
{
$sessionCookie = session_get_cookie_params();
$expires = time() + $sessionCookie['lifetime'];
$this->getDatabase()
->update('ActiveSessions')
->where('id', $sid)
->values([
'expires' => $expires,
... | [
"private",
"function",
"refreshSession",
"(",
"$",
"sid",
")",
"{",
"$",
"sessionCookie",
"=",
"session_get_cookie_params",
"(",
")",
";",
"$",
"expires",
"=",
"time",
"(",
")",
"+",
"$",
"sessionCookie",
"[",
"'lifetime'",
"]",
";",
"$",
"this",
"->",
"... | Refreshes the expiration on an active session.
@param string $sid session ID
@return bool | [
"Refreshes",
"the",
"expiration",
"on",
"an",
"active",
"session",
"."
] | 720280b4b2635572f331afe8d082e3e88cf54eb7 | https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/Storage/SymfonySessionStorage.php#L255-L270 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.