id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
10,200 | phlexible/task-bundle | Controller/TaskController.php | TaskController.commentAction | public function commentAction(Request $request)
{
$id = $request->get('id');
$comment = $request->get('comment');
if ($comment) {
$comment = urldecode($comment);
}
$taskManager = $this->get('phlexible_task.task_manager');
$task = $taskManager->find($id)... | php | public function commentAction(Request $request)
{
$id = $request->get('id');
$comment = $request->get('comment');
if ($comment) {
$comment = urldecode($comment);
}
$taskManager = $this->get('phlexible_task.task_manager');
$task = $taskManager->find($id)... | [
"public",
"function",
"commentAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"id",
"=",
"$",
"request",
"->",
"get",
"(",
"'id'",
")",
";",
"$",
"comment",
"=",
"$",
"request",
"->",
"get",
"(",
"'comment'",
")",
";",
"if",
"(",
"$",
"comm... | Create task comment.
@param Request $request
@return ResultResponse
@Route("/create/comment", name="tasks_create_comment")
@Method({"GET", "POST"})
@ApiDoc(
description="Create status",
requirements={
{"name"="id", "dataType"="string", "required"=true, "description"="Task ID"},
{"name"="comment", "dataType"="string",... | [
"Create",
"task",
"comment",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L293-L308 |
10,201 | phlexible/task-bundle | Controller/TaskController.php | TaskController.transitionAction | public function transitionAction(Request $request)
{
$id = $request->get('id');
$assignedUserId = $request->get('recipient');
$name = $request->get('name');
$comment = $request->get('comment');
if ($comment) {
$comment = urldecode($comment);
}
$t... | php | public function transitionAction(Request $request)
{
$id = $request->get('id');
$assignedUserId = $request->get('recipient');
$name = $request->get('name');
$comment = $request->get('comment');
if ($comment) {
$comment = urldecode($comment);
}
$t... | [
"public",
"function",
"transitionAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"id",
"=",
"$",
"request",
"->",
"get",
"(",
"'id'",
")",
";",
"$",
"assignedUserId",
"=",
"$",
"request",
"->",
"get",
"(",
"'recipient'",
")",
";",
"$",
"name",
... | Create task transition.
@param Request $request
@return ResultResponse
@Route("/create/transition", name="tasks_create_transition")
@Method({"GET", "POST"})
@ApiDoc(
description="Create status",
requirements={
{"name"="id", "dataType"="string", "required"=true, "description"="Task ID"},
{"name"="recipient", "dataType... | [
"Create",
"task",
"transition",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L328-L351 |
10,202 | phlexible/task-bundle | Controller/TaskController.php | TaskController.viewAction | public function viewAction(Request $request)
{
$id = $request->get('id');
$taskManager = $this->get('phlexible_task.task_manager');
$types = $this->get('phlexible_task.types');
$userManager = $this->get('phlexible_user.user_manager');
$task = $taskManager->find($id);
... | php | public function viewAction(Request $request)
{
$id = $request->get('id');
$taskManager = $this->get('phlexible_task.task_manager');
$types = $this->get('phlexible_task.types');
$userManager = $this->get('phlexible_user.user_manager');
$task = $taskManager->find($id);
... | [
"public",
"function",
"viewAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"id",
"=",
"$",
"request",
"->",
"get",
"(",
"'id'",
")",
";",
"$",
"taskManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_task.task_manager'",
")",
";",
"$",
"t... | View task.
@param Request $request
@return JsonResponse
@Route("/view", name="tasks_view")
@Method({"GET", "POST"})
@ApiDoc(
description="View",
requirements={
{"name"="id", "dataType"="string", "required"=true, "description"="Task ID"}
}
) | [
"View",
"task",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L406-L470 |
10,203 | agalbourdin/agl-core | src/Mvc/Controller/Controller.php | Controller._getCacheInfo | private function _getCacheInfo()
{
$request = Agl::getRequest();
$module = $request->getModule();
$view = $request->getView();
$action = $request->getAction();
$cacheInfo = array();
$cacheConfig = Agl::app()->getConfig('core-layout/modules/' . $module . '#' . $view . '#action#' . $ac... | php | private function _getCacheInfo()
{
$request = Agl::getRequest();
$module = $request->getModule();
$view = $request->getView();
$action = $request->getAction();
$cacheInfo = array();
$cacheConfig = Agl::app()->getConfig('core-layout/modules/' . $module . '#' . $view . '#action#' . $ac... | [
"private",
"function",
"_getCacheInfo",
"(",
")",
"{",
"$",
"request",
"=",
"Agl",
"::",
"getRequest",
"(",
")",
";",
"$",
"module",
"=",
"$",
"request",
"->",
"getModule",
"(",
")",
";",
"$",
"view",
"=",
"$",
"request",
"->",
"getView",
"(",
")",
... | Return a TTL and a cache key composed of the module, the view, the
actions and of the locale code and the request string if required.
@return array | [
"Return",
"a",
"TTL",
"and",
"a",
"cache",
"key",
"composed",
"of",
"the",
"module",
"the",
"view",
"the",
"actions",
"and",
"of",
"the",
"locale",
"code",
"and",
"the",
"request",
"string",
"if",
"required",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Mvc/Controller/Controller.php#L66-L118 |
10,204 | agalbourdin/agl-core | src/Mvc/Controller/Controller.php | Controller._getView | protected function _getView()
{
if ($viewInstance = Registry::get('view')) {
return $viewInstance;
}
$request = Agl::getRequest();
$module = $request->getModule();
$view = $request->getView();
$viewPath = APP_PATH
. Agl::APP_PHP_DIR
. ViewInterface::APP_PHP_... | php | protected function _getView()
{
if ($viewInstance = Registry::get('view')) {
return $viewInstance;
}
$request = Agl::getRequest();
$module = $request->getModule();
$view = $request->getView();
$viewPath = APP_PATH
. Agl::APP_PHP_DIR
. ViewInterface::APP_PHP_... | [
"protected",
"function",
"_getView",
"(",
")",
"{",
"if",
"(",
"$",
"viewInstance",
"=",
"Registry",
"::",
"get",
"(",
"'view'",
")",
")",
"{",
"return",
"$",
"viewInstance",
";",
"}",
"$",
"request",
"=",
"Agl",
"::",
"getRequest",
"(",
")",
";",
"$... | Create and return the current view instance.
@return mixed | [
"Create",
"and",
"return",
"the",
"current",
"view",
"instance",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Mvc/Controller/Controller.php#L125-L156 |
10,205 | agalbourdin/agl-core | src/Mvc/Controller/Controller.php | Controller._renderView | protected function _renderView()
{
$isCacheEnabled = Agl::app()->isCacheEnabled();
if ($isCacheEnabled) {
$cacheInfo = $this->_getCacheInfo();
if (! empty($cacheInfo)
and $cacheInstance = Agl::getCache()
and $cacheInstance->has($cacheInfo[CacheInterface::CACHE_KEY])) {
return $cacheInstance->ge... | php | protected function _renderView()
{
$isCacheEnabled = Agl::app()->isCacheEnabled();
if ($isCacheEnabled) {
$cacheInfo = $this->_getCacheInfo();
if (! empty($cacheInfo)
and $cacheInstance = Agl::getCache()
and $cacheInstance->has($cacheInfo[CacheInterface::CACHE_KEY])) {
return $cacheInstance->ge... | [
"protected",
"function",
"_renderView",
"(",
")",
"{",
"$",
"isCacheEnabled",
"=",
"Agl",
"::",
"app",
"(",
")",
"->",
"isCacheEnabled",
"(",
")",
";",
"if",
"(",
"$",
"isCacheEnabled",
")",
"{",
"$",
"cacheInfo",
"=",
"$",
"this",
"->",
"_getCacheInfo",... | Render the view page.
@return Controller | [
"Render",
"the",
"view",
"page",
"."
] | 1db556f9a49488aa9fab6887fefb7141a79ad97d | https://github.com/agalbourdin/agl-core/blob/1db556f9a49488aa9fab6887fefb7141a79ad97d/src/Mvc/Controller/Controller.php#L163-L188 |
10,206 | sebastianmonzel/webfiles-framework-php | source/core/datasystem/database/MDatabaseTable.php | MDatabaseTable.addColumn | public function addColumn($name, $type, $length = null)
{
$column = new MDatabaseTableColumn($name, $type, $length);
array_push($this->columns, $column);
} | php | public function addColumn($name, $type, $length = null)
{
$column = new MDatabaseTableColumn($name, $type, $length);
array_push($this->columns, $column);
} | [
"public",
"function",
"addColumn",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"column",
"=",
"new",
"MDatabaseTableColumn",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"length",
")",
";",
"array_push",
"(",
... | Adds a new column to the actual database representation.
@param string $name
@param string $type
@param int $length | [
"Adds",
"a",
"new",
"column",
"to",
"the",
"actual",
"database",
"representation",
"."
] | 5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d | https://github.com/sebastianmonzel/webfiles-framework-php/blob/5ac1fc99e8e9946080e3ba877b2320cd6a3e5b5d/source/core/datasystem/database/MDatabaseTable.php#L106-L110 |
10,207 | broeser/wellid | src/ValidatableTrait.php | ValidatableTrait.validate | public function validate() {
if($this instanceof Cache\CacheableValidatableInterface && $this->isValidationCacheEnabled() && $this->lastValidationResult instanceof ValidationResultSet) {
return $this->lastValidationResult;
}
$validationResultSet = $this->validateValu... | php | public function validate() {
if($this instanceof Cache\CacheableValidatableInterface && $this->isValidationCacheEnabled() && $this->lastValidationResult instanceof ValidationResultSet) {
return $this->lastValidationResult;
}
$validationResultSet = $this->validateValu... | [
"public",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"instanceof",
"Cache",
"\\",
"CacheableValidatableInterface",
"&&",
"$",
"this",
"->",
"isValidationCacheEnabled",
"(",
")",
"&&",
"$",
"this",
"->",
"lastValidationResult",
"instanceof",
"... | Validates this against all given Validators
@return ValidationResultSet | [
"Validates",
"this",
"against",
"all",
"given",
"Validators"
] | 0de2e6119382530221f4f7285158f19d45c78704 | https://github.com/broeser/wellid/blob/0de2e6119382530221f4f7285158f19d45c78704/src/ValidatableTrait.php#L42-L54 |
10,208 | Opifer/RulesEngineBundle | Provider/EntityProvider.php | EntityProvider.getEntity | protected function getEntity(Rule $rule)
{
if ($rule instanceof RuleSet) {
foreach ($rule->getChildren() as $child) {
return $child->getEntity();
}
throw new \Exception(sprintf('The rule %s and non of its children have an entity', get_class($rule)));
... | php | protected function getEntity(Rule $rule)
{
if ($rule instanceof RuleSet) {
foreach ($rule->getChildren() as $child) {
return $child->getEntity();
}
throw new \Exception(sprintf('The rule %s and non of its children have an entity', get_class($rule)));
... | [
"protected",
"function",
"getEntity",
"(",
"Rule",
"$",
"rule",
")",
"{",
"if",
"(",
"$",
"rule",
"instanceof",
"RuleSet",
")",
"{",
"foreach",
"(",
"$",
"rule",
"->",
"getChildren",
"(",
")",
"as",
"$",
"child",
")",
"{",
"return",
"$",
"child",
"->... | Get the entity from the passed rule
@param Rule $rule | [
"Get",
"the",
"entity",
"from",
"the",
"passed",
"rule"
] | a7975576d4e3203b1af6614369840c30b1af2312 | https://github.com/Opifer/RulesEngineBundle/blob/a7975576d4e3203b1af6614369840c30b1af2312/Provider/EntityProvider.php#L116-L127 |
10,209 | Opifer/RulesEngineBundle | Provider/EntityProvider.php | EntityProvider.setQueryParams | public function setQueryParams($id, $params = [])
{
$requestQuery = $this->request->query->get('query_id');
if(isset($requestQuery[$id])) {
$paramsQuery = $requestQuery[$id];
} elseif(isset($params['query'])) {
$paramsQuery = $params['query'];
} else ... | php | public function setQueryParams($id, $params = [])
{
$requestQuery = $this->request->query->get('query_id');
if(isset($requestQuery[$id])) {
$paramsQuery = $requestQuery[$id];
} elseif(isset($params['query'])) {
$paramsQuery = $params['query'];
} else ... | [
"public",
"function",
"setQueryParams",
"(",
"$",
"id",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"requestQuery",
"=",
"$",
"this",
"->",
"request",
"->",
"query",
"->",
"get",
"(",
"'query_id'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"req... | Update query builder to include additional parameters
@param integer $id
@param array $params | [
"Update",
"query",
"builder",
"to",
"include",
"additional",
"parameters"
] | a7975576d4e3203b1af6614369840c30b1af2312 | https://github.com/Opifer/RulesEngineBundle/blob/a7975576d4e3203b1af6614369840c30b1af2312/Provider/EntityProvider.php#L135-L167 |
10,210 | razielsd/webdriverlib | WebDriver/WebDriver/Exception/Protocol.php | WebDriver_Exception_Protocol.getCommandDescription | public static function getCommandDescription(WebDriver_Command $command)
{
$commandDescriptionList = [
"Command: {$command->getCommandName()}",
"Method: {$command->getMethod()}",
"URL: {$command->getUrl()}"
];
$paramList = $command->getParameters();
... | php | public static function getCommandDescription(WebDriver_Command $command)
{
$commandDescriptionList = [
"Command: {$command->getCommandName()}",
"Method: {$command->getMethod()}",
"URL: {$command->getUrl()}"
];
$paramList = $command->getParameters();
... | [
"public",
"static",
"function",
"getCommandDescription",
"(",
"WebDriver_Command",
"$",
"command",
")",
"{",
"$",
"commandDescriptionList",
"=",
"[",
"\"Command: {$command->getCommandName()}\"",
",",
"\"Method: {$command->getMethod()}\"",
",",
"\"URL: {$command->getUrl()}\"",
"... | Returns webdriver command description.
@param WebDriver_Command $command
@return string | [
"Returns",
"webdriver",
"command",
"description",
"."
] | e498afc36a8cdeab5b6ca95016420557baf32f36 | https://github.com/razielsd/webdriverlib/blob/e498afc36a8cdeab5b6ca95016420557baf32f36/WebDriver/WebDriver/Exception/Protocol.php#L35-L50 |
10,211 | razielsd/webdriverlib | WebDriver/WebDriver/Exception/Protocol.php | WebDriver_Exception_Protocol.factory | public static function factory(WebDriver_Command $command, array $infoList = [], $rawResponse = null)
{
$httpStatusCode = isset($infoList['http_code']) ? $infoList['http_code'] : 0;
switch ($httpStatusCode) {
case WebDriver_Http::CLIENT_ERROR_NOT_FOUND:
case WebDriver_Http::S... | php | public static function factory(WebDriver_Command $command, array $infoList = [], $rawResponse = null)
{
$httpStatusCode = isset($infoList['http_code']) ? $infoList['http_code'] : 0;
switch ($httpStatusCode) {
case WebDriver_Http::CLIENT_ERROR_NOT_FOUND:
case WebDriver_Http::S... | [
"public",
"static",
"function",
"factory",
"(",
"WebDriver_Command",
"$",
"command",
",",
"array",
"$",
"infoList",
"=",
"[",
"]",
",",
"$",
"rawResponse",
"=",
"null",
")",
"{",
"$",
"httpStatusCode",
"=",
"isset",
"(",
"$",
"infoList",
"[",
"'http_code'"... | Factory for protocol errors.
@param WebDriver_Command $command
@param array $infoList
@param null|string $rawResponse
@return static | [
"Factory",
"for",
"protocol",
"errors",
"."
] | e498afc36a8cdeab5b6ca95016420557baf32f36 | https://github.com/razielsd/webdriverlib/blob/e498afc36a8cdeab5b6ca95016420557baf32f36/WebDriver/WebDriver/Exception/Protocol.php#L61-L99 |
10,212 | InnoGr/FivePercent-Api | src/Doc/Formatter/JsonRpc/JsonRpcFormatter.php | JsonRpcFormatter.formatActionResponseProperty | public function formatActionResponseProperty(ResponseProperty $responseProperty)
{
$info = [
'name' => $responseProperty->getName(),
'type' => $responseProperty->getType(),
'description' => $responseProperty->getDescription()
];
if ($responseProperty->isO... | php | public function formatActionResponseProperty(ResponseProperty $responseProperty)
{
$info = [
'name' => $responseProperty->getName(),
'type' => $responseProperty->getType(),
'description' => $responseProperty->getDescription()
];
if ($responseProperty->isO... | [
"public",
"function",
"formatActionResponseProperty",
"(",
"ResponseProperty",
"$",
"responseProperty",
")",
"{",
"$",
"info",
"=",
"[",
"'name'",
"=>",
"$",
"responseProperty",
"->",
"getName",
"(",
")",
",",
"'type'",
"=>",
"$",
"responseProperty",
"->",
"getT... | Format action response property
@param ResponseProperty $responseProperty
@return array | [
"Format",
"action",
"response",
"property"
] | 57b78ddc3c9d91a7139c276711e5792824ceab9c | https://github.com/InnoGr/FivePercent-Api/blob/57b78ddc3c9d91a7139c276711e5792824ceab9c/src/Doc/Formatter/JsonRpc/JsonRpcFormatter.php#L108-L123 |
10,213 | hametuha/hametwoo | src/Hametuha/HametWoo/Utility/OrderHandler.php | OrderHandler.restore_stock | public static function restore_stock( $order ) {
$order = wc_get_order( $order );
if (
! $order
|| 'yes' !== get_option( 'woocommerce_manage_stock' )
|| ! apply_filters( 'woocommerce_can_reduce_order_stock', true, $order )
|| 1 > count( $order->get_items() )
) {
// No item to restore.
return fal... | php | public static function restore_stock( $order ) {
$order = wc_get_order( $order );
if (
! $order
|| 'yes' !== get_option( 'woocommerce_manage_stock' )
|| ! apply_filters( 'woocommerce_can_reduce_order_stock', true, $order )
|| 1 > count( $order->get_items() )
) {
// No item to restore.
return fal... | [
"public",
"static",
"function",
"restore_stock",
"(",
"$",
"order",
")",
"{",
"$",
"order",
"=",
"wc_get_order",
"(",
"$",
"order",
")",
";",
"if",
"(",
"!",
"$",
"order",
"||",
"'yes'",
"!==",
"get_option",
"(",
"'woocommerce_manage_stock'",
")",
"||",
... | Restore stock.
@param int|\WC_Order|null $order Order object.
@return bool | [
"Restore",
"stock",
"."
] | bcd5948ea53d6ca2181873a9f9d0d221c346592e | https://github.com/hametuha/hametwoo/blob/bcd5948ea53d6ca2181873a9f9d0d221c346592e/src/Hametuha/HametWoo/Utility/OrderHandler.php#L20-L52 |
10,214 | Daveawb/Repos | src/Repository.php | Repository.create | public function create($data, $flush = self::FLUSH)
{
if ($flush === self::FLUSH) {
$this->flushModel();
}
if (is_callable($data)) {
$model = $this->model;
call_user_func($data, $model);
$model->push();
} else {
$model = ... | php | public function create($data, $flush = self::FLUSH)
{
if ($flush === self::FLUSH) {
$this->flushModel();
}
if (is_callable($data)) {
$model = $this->model;
call_user_func($data, $model);
$model->push();
} else {
$model = ... | [
"public",
"function",
"create",
"(",
"$",
"data",
",",
"$",
"flush",
"=",
"self",
"::",
"FLUSH",
")",
"{",
"if",
"(",
"$",
"flush",
"===",
"self",
"::",
"FLUSH",
")",
"{",
"$",
"this",
"->",
"flushModel",
"(",
")",
";",
"}",
"if",
"(",
"is_callab... | Persist a new set of data
@param array|callable $data
@param int $flush
@return Model|Builder | [
"Persist",
"a",
"new",
"set",
"of",
"data"
] | f11ab47bec71becf894265cb607779fae67261bb | https://github.com/Daveawb/Repos/blob/f11ab47bec71becf894265cb607779fae67261bb/src/Repository.php#L127-L144 |
10,215 | Daveawb/Repos | src/Repository.php | Repository.updateModel | public function updateModel(array $data, Model $model)
{
$model = $model->fill($data);
return $model->isDirty() && $model->update($data);
} | php | public function updateModel(array $data, Model $model)
{
$model = $model->fill($data);
return $model->isDirty() && $model->update($data);
} | [
"public",
"function",
"updateModel",
"(",
"array",
"$",
"data",
",",
"Model",
"$",
"model",
")",
"{",
"$",
"model",
"=",
"$",
"model",
"->",
"fill",
"(",
"$",
"data",
")",
";",
"return",
"$",
"model",
"->",
"isDirty",
"(",
")",
"&&",
"$",
"model",
... | Update a model passed in. Returns a boolean indicating whether the
model has been modified or not.
@param array $data
@param Model $model
@return bool
@throws RepositoryException | [
"Update",
"a",
"model",
"passed",
"in",
".",
"Returns",
"a",
"boolean",
"indicating",
"whether",
"the",
"model",
"has",
"been",
"modified",
"or",
"not",
"."
] | f11ab47bec71becf894265cb607779fae67261bb | https://github.com/Daveawb/Repos/blob/f11ab47bec71becf894265cb607779fae67261bb/src/Repository.php#L175-L180 |
10,216 | Daveawb/Repos | src/Repository.php | Repository.newModel | public function newModel($override = null)
{
$model = $this->model();
if ($override) $model = $override;
$class = '\\'.ltrim($model, '\\');
return $this->app->make($class);
} | php | public function newModel($override = null)
{
$model = $this->model();
if ($override) $model = $override;
$class = '\\'.ltrim($model, '\\');
return $this->app->make($class);
} | [
"public",
"function",
"newModel",
"(",
"$",
"override",
"=",
"null",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"model",
"(",
")",
";",
"if",
"(",
"$",
"override",
")",
"$",
"model",
"=",
"$",
"override",
";",
"$",
"class",
"=",
"'\\\\'",
".... | Make a new model and attach it to the repository
@param null $override
@return \Illuminate\Database\Eloquent\Model|mixed | [
"Make",
"a",
"new",
"model",
"and",
"attach",
"it",
"to",
"the",
"repository"
] | f11ab47bec71becf894265cb607779fae67261bb | https://github.com/Daveawb/Repos/blob/f11ab47bec71becf894265cb607779fae67261bb/src/Repository.php#L219-L228 |
10,217 | polary/polary | src/polary/base/Object.php | Object.createObject | public static function createObject($type, $defaultClass, $instanceOf = false, $param = [])
{
if (is_string($type)) {
$type = ['class' => $type];
}
if (is_array($type) && ! isset($type['class']) && !empty($defaultClass)) {
$type['class'] = $defaultClass;
}
... | php | public static function createObject($type, $defaultClass, $instanceOf = false, $param = [])
{
if (is_string($type)) {
$type = ['class' => $type];
}
if (is_array($type) && ! isset($type['class']) && !empty($defaultClass)) {
$type['class'] = $defaultClass;
}
... | [
"public",
"static",
"function",
"createObject",
"(",
"$",
"type",
",",
"$",
"defaultClass",
",",
"$",
"instanceOf",
"=",
"false",
",",
"$",
"param",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"$",
"type",
"=",... | Create object with set default class and check parent class.
@param array|string|callable $type
@param string $defaultClass
@param string|bool $instanceOf
@param array $param
@return object | [
"Create",
"object",
"with",
"set",
"default",
"class",
"and",
"check",
"parent",
"class",
"."
] | 683212e631e59faedce488f0d2cea82c94a83aae | https://github.com/polary/polary/blob/683212e631e59faedce488f0d2cea82c94a83aae/src/polary/base/Object.php#L26-L45 |
10,218 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.Initialize | public function Initialize() {
$this->Head = new HeadModule($this);
$this->Head->AddTag('meta', array('name' => 'robots', 'content' => 'noindex'));
$this->AddJsFile('jquery.js');
$this->AddJsFile('jquery.livequery.js');
$this->AddJsFile('jquery.form.js');
$this->AddJsFile('jqu... | php | public function Initialize() {
$this->Head = new HeadModule($this);
$this->Head->AddTag('meta', array('name' => 'robots', 'content' => 'noindex'));
$this->AddJsFile('jquery.js');
$this->AddJsFile('jquery.livequery.js');
$this->AddJsFile('jquery.form.js');
$this->AddJsFile('jqu... | [
"public",
"function",
"Initialize",
"(",
")",
"{",
"$",
"this",
"->",
"Head",
"=",
"new",
"HeadModule",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"Head",
"->",
"AddTag",
"(",
"'meta'",
",",
"array",
"(",
"'name'",
"=>",
"'robots'",
",",
"'conten... | Include JS and CSS used by all methods.
Always called by dispatcher before controller's requested method.
@since 2.0.0
@access public | [
"Include",
"JS",
"and",
"CSS",
"used",
"by",
"all",
"methods",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L89-L103 |
10,219 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.CheckOverride | protected function CheckOverride($Type, $Target, $TransientKey = NULL) {
if (!$this->Request->Get('override', TRUE))
return;
$Provider = Gdn_AuthenticationProviderModel::GetDefault();
if (!$Provider)
return;
$this->EventArguments['Target'] = $Target;
$this->... | php | protected function CheckOverride($Type, $Target, $TransientKey = NULL) {
if (!$this->Request->Get('override', TRUE))
return;
$Provider = Gdn_AuthenticationProviderModel::GetDefault();
if (!$Provider)
return;
$this->EventArguments['Target'] = $Target;
$this->... | [
"protected",
"function",
"CheckOverride",
"(",
"$",
"Type",
",",
"$",
"Target",
",",
"$",
"TransientKey",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"Request",
"->",
"Get",
"(",
"'override'",
",",
"TRUE",
")",
")",
"return",
";",
"$",
... | Check the default provider to see if it overrides one of the entry methods and then redirect.
@param string $Type One of the following.
- SignIn
- Register
- SignOut (not complete) | [
"Check",
"the",
"default",
"provider",
"to",
"see",
"if",
"it",
"overrides",
"one",
"of",
"the",
"entry",
"methods",
"and",
"then",
"redirect",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L285-L359 |
10,220 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController._SetRedirect | protected function _SetRedirect($CheckPopup = FALSE) {
$Url = Url($this->RedirectTo(), TRUE);
$this->RedirectUrl = $Url;
$this->MasterView = 'popup';
$this->View = 'redirect';
if ($this->_RealDeliveryType != DELIVERY_TYPE_ALL && $this->DeliveryType() != DELIVERY_TYPE_ALL) {
$thi... | php | protected function _SetRedirect($CheckPopup = FALSE) {
$Url = Url($this->RedirectTo(), TRUE);
$this->RedirectUrl = $Url;
$this->MasterView = 'popup';
$this->View = 'redirect';
if ($this->_RealDeliveryType != DELIVERY_TYPE_ALL && $this->DeliveryType() != DELIVERY_TYPE_ALL) {
$thi... | [
"protected",
"function",
"_SetRedirect",
"(",
"$",
"CheckPopup",
"=",
"FALSE",
")",
"{",
"$",
"Url",
"=",
"Url",
"(",
"$",
"this",
"->",
"RedirectTo",
"(",
")",
",",
"TRUE",
")",
";",
"$",
"this",
"->",
"RedirectUrl",
"=",
"$",
"Url",
";",
"$",
"th... | After sign in, send them along.
@since 2.0.0
@access protected
@param bool $CheckPopup | [
"After",
"sign",
"in",
"send",
"them",
"along",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L726-L741 |
10,221 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.SignOut | public function SignOut($TransientKey = "") {
$this->CheckOverride('SignOut', $this->Target(), $TransientKey);
if (Gdn::Session()->ValidateTransientKey($TransientKey) || $this->Form->IsPostBack()) {
$User = Gdn::Session()->User;
$this->EventArguments['SignoutUser'] = $User... | php | public function SignOut($TransientKey = "") {
$this->CheckOverride('SignOut', $this->Target(), $TransientKey);
if (Gdn::Session()->ValidateTransientKey($TransientKey) || $this->Form->IsPostBack()) {
$User = Gdn::Session()->User;
$this->EventArguments['SignoutUser'] = $User... | [
"public",
"function",
"SignOut",
"(",
"$",
"TransientKey",
"=",
"\"\"",
")",
"{",
"$",
"this",
"->",
"CheckOverride",
"(",
"'SignOut'",
",",
"$",
"this",
"->",
"Target",
"(",
")",
",",
"$",
"TransientKey",
")",
";",
"if",
"(",
"Gdn",
"::",
"Session",
... | Good afternoon, good evening, and goodnight.
Events: SignOut
@access public
@since 2.0.0
@param string $TransientKey (default: "") | [
"Good",
"afternoon",
"good",
"evening",
"and",
"goodnight",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L787-L810 |
10,222 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.Register | public function Register($InvitationCode = '') {
if (!$this->Request->IsPostBack())
$this->CheckOverride('Register', $this->Target());
$this->FireEvent("Register");
$this->Form->SetModel($this->UserModel);
// Define gender dropdown options
$this->GenderOptions = arr... | php | public function Register($InvitationCode = '') {
if (!$this->Request->IsPostBack())
$this->CheckOverride('Register', $this->Target());
$this->FireEvent("Register");
$this->Form->SetModel($this->UserModel);
// Define gender dropdown options
$this->GenderOptions = arr... | [
"public",
"function",
"Register",
"(",
"$",
"InvitationCode",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"Request",
"->",
"IsPostBack",
"(",
")",
")",
"$",
"this",
"->",
"CheckOverride",
"(",
"'Register'",
",",
"$",
"this",
"->",
"Target",... | Calls the appropriate registration method based on the configuration setting.
Events: Register
@access public
@since 2.0.0
@param string $InvitationCode Unique code given to invited user. | [
"Calls",
"the",
"appropriate",
"registration",
"method",
"based",
"on",
"the",
"configuration",
"setting",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L1172-L1198 |
10,223 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.RegisterApproval | private function RegisterApproval() {
Gdn::UserModel()->AddPasswordStrength($this);
// If the form has been posted back...
if ($this->Form->IsPostBack()) {
// Add validation rules that are not enforced by the model
$this->UserModel->DefineSchema();
$this->Us... | php | private function RegisterApproval() {
Gdn::UserModel()->AddPasswordStrength($this);
// If the form has been posted back...
if ($this->Form->IsPostBack()) {
// Add validation rules that are not enforced by the model
$this->UserModel->DefineSchema();
$this->Us... | [
"private",
"function",
"RegisterApproval",
"(",
")",
"{",
"Gdn",
"::",
"UserModel",
"(",
")",
"->",
"AddPasswordStrength",
"(",
"$",
"this",
")",
";",
"// If the form has been posted back...",
"if",
"(",
"$",
"this",
"->",
"Form",
"->",
"IsPostBack",
"(",
")",... | Registration that requires approval.
Events: RegistrationPending
@access private
@since 2.0.0 | [
"Registration",
"that",
"requires",
"approval",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L1224-L1276 |
10,224 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.PasswordRequest | public function PasswordRequest() {
Gdn::Locale()->SetTranslation('Email', T(UserModel::SigninLabelCode()));
if ($this->Form->IsPostBack() === TRUE) {
$this->Form->ValidateRule('Email', 'ValidateRequired');
if ($this->Form->ErrorCount() == 0) {
try {
$Email = $t... | php | public function PasswordRequest() {
Gdn::Locale()->SetTranslation('Email', T(UserModel::SigninLabelCode()));
if ($this->Form->IsPostBack() === TRUE) {
$this->Form->ValidateRule('Email', 'ValidateRequired');
if ($this->Form->ErrorCount() == 0) {
try {
$Email = $t... | [
"public",
"function",
"PasswordRequest",
"(",
")",
"{",
"Gdn",
"::",
"Locale",
"(",
")",
"->",
"SetTranslation",
"(",
"'Email'",
",",
"T",
"(",
"UserModel",
"::",
"SigninLabelCode",
"(",
")",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Form",
"->",
... | Request password reset.
@access public
@since 2.0.0 | [
"Request",
"password",
"reset",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L1496-L1520 |
10,225 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.PasswordReset | public function PasswordReset($UserID = '', $PasswordResetKey = '') {
if (!is_numeric($UserID)
|| $PasswordResetKey == ''
|| $this->UserModel->GetAttribute($UserID, 'PasswordResetKey', '') != $PasswordResetKey
) $this->Form->AddError('Failed to authenticate your password reset request... | php | public function PasswordReset($UserID = '', $PasswordResetKey = '') {
if (!is_numeric($UserID)
|| $PasswordResetKey == ''
|| $this->UserModel->GetAttribute($UserID, 'PasswordResetKey', '') != $PasswordResetKey
) $this->Form->AddError('Failed to authenticate your password reset request... | [
"public",
"function",
"PasswordReset",
"(",
"$",
"UserID",
"=",
"''",
",",
"$",
"PasswordResetKey",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"UserID",
")",
"||",
"$",
"PasswordResetKey",
"==",
"''",
"||",
"$",
"this",
"->",
"UserMod... | Do password reset.
@access public
@since 2.0.0
@param int $UserID Unique.
@param string $PasswordResetKey Authenticate with unique, 1-time code sent via email. | [
"Do",
"password",
"reset",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L1531-L1565 |
10,226 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.EmailConfirm | public function EmailConfirm($UserID, $EmailKey = '') {
$User = $this->UserModel->GetID($UserID);
if (!$User)
throw NotFoundException('User');
$EmailConfirmed = $this->UserModel->ConfirmEmail($User, $EmailKey);
$this->Form->SetValidationResults($this->UserModel->ValidationResult... | php | public function EmailConfirm($UserID, $EmailKey = '') {
$User = $this->UserModel->GetID($UserID);
if (!$User)
throw NotFoundException('User');
$EmailConfirmed = $this->UserModel->ConfirmEmail($User, $EmailKey);
$this->Form->SetValidationResults($this->UserModel->ValidationResult... | [
"public",
"function",
"EmailConfirm",
"(",
"$",
"UserID",
",",
"$",
"EmailKey",
"=",
"''",
")",
"{",
"$",
"User",
"=",
"$",
"this",
"->",
"UserModel",
"->",
"GetID",
"(",
"$",
"UserID",
")",
";",
"if",
"(",
"!",
"$",
"User",
")",
"throw",
"NotFound... | Confirm email address is valid via sent code.
@access public
@since 2.0.0
@param int $UserID
@param string $EmailKey Authenticate with unique, 1-time code sent via email. | [
"Confirm",
"email",
"address",
"is",
"valid",
"via",
"sent",
"code",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L1576-L1593 |
10,227 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.EmailConfirmRequest | public function EmailConfirmRequest($UserID = '') {
if ($UserID && !Gdn::Session()->CheckPermission('Garden.Users.Edit'))
$UserID = '';
try {
$this->UserModel->SendEmailConfirmationEmail($UserID);
} catch (Exception $Ex) {}
$this->Form->SetValidationResults($this->UserMo... | php | public function EmailConfirmRequest($UserID = '') {
if ($UserID && !Gdn::Session()->CheckPermission('Garden.Users.Edit'))
$UserID = '';
try {
$this->UserModel->SendEmailConfirmationEmail($UserID);
} catch (Exception $Ex) {}
$this->Form->SetValidationResults($this->UserMo... | [
"public",
"function",
"EmailConfirmRequest",
"(",
"$",
"UserID",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"UserID",
"&&",
"!",
"Gdn",
"::",
"Session",
"(",
")",
"->",
"CheckPermission",
"(",
"'Garden.Users.Edit'",
")",
")",
"$",
"UserID",
"=",
"''",
";",
"... | Send email confirmation message to user.
@access public
@since 2.0.?
@param int $UserID | [
"Send",
"email",
"confirmation",
"message",
"to",
"user",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L1603-L1613 |
10,228 | bishopb/vanilla | applications/dashboard/controllers/class.entrycontroller.php | EntryController.Target | public function Target($Target = FALSE) {
if ($Target === FALSE) {
$Target = $this->Form->GetFormValue('Target', FALSE);
if (!$Target)
$Target = $this->Request->Get('Target', '/');
}
// Make sure that the target is a valid url.
if (!preg_match('`(^https?://)`... | php | public function Target($Target = FALSE) {
if ($Target === FALSE) {
$Target = $this->Form->GetFormValue('Target', FALSE);
if (!$Target)
$Target = $this->Request->Get('Target', '/');
}
// Make sure that the target is a valid url.
if (!preg_match('`(^https?://)`... | [
"public",
"function",
"Target",
"(",
"$",
"Target",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"Target",
"===",
"FALSE",
")",
"{",
"$",
"Target",
"=",
"$",
"this",
"->",
"Form",
"->",
"GetFormValue",
"(",
"'Target'",
",",
"FALSE",
")",
";",
"if",
"(",... | Set where to go after signin.
@access public
@since 2.0.0
@param string $Target Where we're requested to go to.
@return string URL to actually go to (validated & safe). | [
"Set",
"where",
"to",
"go",
"after",
"signin",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.entrycontroller.php#L1722-L1768 |
10,229 | sgtlambda/jvwp | src/components/WpMediaUploader.php | WpMediaUploader.getHTML | public function getHTML ($showLabel = true)
{
return parent::getHTML(false) .
Templates::getTemplate($this->getTemplateLocation())->render(array(
'id' => $this->getId(),
'showLabel' => $showLabel || $this->overrideShowLabel,
'label' => $this->labe... | php | public function getHTML ($showLabel = true)
{
return parent::getHTML(false) .
Templates::getTemplate($this->getTemplateLocation())->render(array(
'id' => $this->getId(),
'showLabel' => $showLabel || $this->overrideShowLabel,
'label' => $this->labe... | [
"public",
"function",
"getHTML",
"(",
"$",
"showLabel",
"=",
"true",
")",
"{",
"return",
"parent",
"::",
"getHTML",
"(",
"false",
")",
".",
"Templates",
"::",
"getTemplate",
"(",
"$",
"this",
"->",
"getTemplateLocation",
"(",
")",
")",
"->",
"render",
"(... | Gets the HTML markup of the component
@param bool $showLabel
@return mixed | [
"Gets",
"the",
"HTML",
"markup",
"of",
"the",
"component"
] | 85dba59281216ccb9cff580d26063d304350bbe0 | https://github.com/sgtlambda/jvwp/blob/85dba59281216ccb9cff580d26063d304350bbe0/src/components/WpMediaUploader.php#L115-L125 |
10,230 | bytic/translation | src/Translator/Traits/LegacyCodeTrait.php | LegacyCodeTrait.getLanguage | public function getLanguage()
{
if (!$this->selectedLanguage) {
$language = false;
if (isset($_SESSION['language']) && $this->isValidLanguage($_SESSION['language'])) {
$language = $_SESSION['language'];
}
$requestLanguage = $this->getRequest(... | php | public function getLanguage()
{
if (!$this->selectedLanguage) {
$language = false;
if (isset($_SESSION['language']) && $this->isValidLanguage($_SESSION['language'])) {
$language = $_SESSION['language'];
}
$requestLanguage = $this->getRequest(... | [
"public",
"function",
"getLanguage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"selectedLanguage",
")",
"{",
"$",
"language",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"'language'",
"]",
")",
"&&",
"$",
"this",
"->",
... | Checks SESSION, GET and Nip_Request and selects requested language
If language not requested, falls back to default
@return string
@deprecated Use getLocale instead | [
"Checks",
"SESSION",
"GET",
"and",
"Nip_Request",
"and",
"selects",
"requested",
"language",
"If",
"language",
"not",
"requested",
"falls",
"back",
"to",
"default"
] | 974e57099d901126c4117010f4a269fe1f80b651 | https://github.com/bytic/translation/blob/974e57099d901126c4117010f4a269fe1f80b651/src/Translator/Traits/LegacyCodeTrait.php#L38-L60 |
10,231 | bytic/translation | src/Translator/Traits/LegacyCodeTrait.php | LegacyCodeTrait.setLanguage | public function setLanguage($language)
{
$this->setLocale($language);
$code = $this->getLanguageCode($language);
putenv('LC_ALL=' . $code);
setlocale(LC_ALL, $code);
setlocale(LC_NUMERIC, 'en_US');
return $this;
} | php | public function setLanguage($language)
{
$this->setLocale($language);
$code = $this->getLanguageCode($language);
putenv('LC_ALL=' . $code);
setlocale(LC_ALL, $code);
setlocale(LC_NUMERIC, 'en_US');
return $this;
} | [
"public",
"function",
"setLanguage",
"(",
"$",
"language",
")",
"{",
"$",
"this",
"->",
"setLocale",
"(",
"$",
"language",
")",
";",
"$",
"code",
"=",
"$",
"this",
"->",
"getLanguageCode",
"(",
"$",
"language",
")",
";",
"putenv",
"(",
"'LC_ALL='",
"."... | Selects a language to be used when translating
@param string $language
@return $this | [
"Selects",
"a",
"language",
"to",
"be",
"used",
"when",
"translating"
] | 974e57099d901126c4117010f4a269fe1f80b651 | https://github.com/bytic/translation/blob/974e57099d901126c4117010f4a269fe1f80b651/src/Translator/Traits/LegacyCodeTrait.php#L68-L79 |
10,232 | bytic/translation | src/Translator/Traits/LegacyCodeTrait.php | LegacyCodeTrait.getDefaultLanguage | public function getDefaultLanguage()
{
if (!$this->defaultLanguage) {
$language = substr(setlocale(LC_ALL, 0), 0, 2);
$languages = $this->getLanguages();
$languageDefault = reset($languages);
$language = $this->isValidLanguage($language) ? $language : $languag... | php | public function getDefaultLanguage()
{
if (!$this->defaultLanguage) {
$language = substr(setlocale(LC_ALL, 0), 0, 2);
$languages = $this->getLanguages();
$languageDefault = reset($languages);
$language = $this->isValidLanguage($language) ? $language : $languag... | [
"public",
"function",
"getDefaultLanguage",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"defaultLanguage",
")",
"{",
"$",
"language",
"=",
"substr",
"(",
"setlocale",
"(",
"LC_ALL",
",",
"0",
")",
",",
"0",
",",
"2",
")",
";",
"$",
"languages",... | gets the default language to be used when translating
@return boolean $language | [
"gets",
"the",
"default",
"language",
"to",
"be",
"used",
"when",
"translating"
] | 974e57099d901126c4117010f4a269fe1f80b651 | https://github.com/bytic/translation/blob/974e57099d901126c4117010f4a269fe1f80b651/src/Translator/Traits/LegacyCodeTrait.php#L107-L118 |
10,233 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.findUserById | public function findUserById($id)
{
if ($id instanceof UserInterface) {
return $id;
}
$result = $this->userProvider->findById($id);
if ($result) {
return $result;
}
$exceptionMessage = "A user with the ID '%(id)s' cannot be found.";
... | php | public function findUserById($id)
{
if ($id instanceof UserInterface) {
return $id;
}
$result = $this->userProvider->findById($id);
if ($result) {
return $result;
}
$exceptionMessage = "A user with the ID '%(id)s' cannot be found.";
... | [
"public",
"function",
"findUserById",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"id",
"instanceof",
"UserInterface",
")",
"{",
"return",
"$",
"id",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"userProvider",
"->",
"findById",
"(",
"$",
"id",
")"... | Find a user by their ID
@param integer|Reflex\Lockdown\Users\UserInterface $id
@return Reflex\Lockdown\Users\UserInterface
@throws Reflex\Lockdown\UserNotFoundException If User isn't found | [
"Find",
"a",
"user",
"by",
"their",
"ID"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L152-L166 |
10,234 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.findUserByLogin | public function findUserByLogin($login)
{
if ($login instanceof UserInterface) {
return $login;
}
$result = $this->userProvider->findByLogin($login);
if ($result) {
return $result;
}
$exceptionMessage = "A user with the login '%(login)s... | php | public function findUserByLogin($login)
{
if ($login instanceof UserInterface) {
return $login;
}
$result = $this->userProvider->findByLogin($login);
if ($result) {
return $result;
}
$exceptionMessage = "A user with the login '%(login)s... | [
"public",
"function",
"findUserByLogin",
"(",
"$",
"login",
")",
"{",
"if",
"(",
"$",
"login",
"instanceof",
"UserInterface",
")",
"{",
"return",
"$",
"login",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"userProvider",
"->",
"findByLogin",
"(",
"$"... | Find a user by their login
@param string|Reflex\Lockdown\Users\UserInterface $id
@return Reflex\Lockdown\Users\UserInterface
@throws UserNotFoundException If User not found | [
"Find",
"a",
"user",
"by",
"their",
"login"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L174-L188 |
10,235 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.giveRolePermission | public function giveRolePermission($role, $permission, $level = 'allow')
{
$this->checkPermissionLevel($level);
$role = $this->findRoleByKey($role);
$permission = $this->findPermissionByKey($permission);
return $role->give($permission, $level);
} | php | public function giveRolePermission($role, $permission, $level = 'allow')
{
$this->checkPermissionLevel($level);
$role = $this->findRoleByKey($role);
$permission = $this->findPermissionByKey($permission);
return $role->give($permission, $level);
} | [
"public",
"function",
"giveRolePermission",
"(",
"$",
"role",
",",
"$",
"permission",
",",
"$",
"level",
"=",
"'allow'",
")",
"{",
"$",
"this",
"->",
"checkPermissionLevel",
"(",
"$",
"level",
")",
";",
"$",
"role",
"=",
"$",
"this",
"->",
"findRoleByKey... | Give a role a permission
@param Reflex\Lockdown\Roles\RoleInterface|string $role
@param Reflex\Lockdown\Permissions\PermissionInterface|string $permission
@param string $level
@return boolean | [
"Give",
"a",
"role",
"a",
"permission"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L224-L232 |
10,236 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.removeRolePermission | public function removeRolePermission($role, $permission)
{
$role = $this->findRoleByKey($role);
$permission = $this->findPermissionByKey($permission);
return $role->remove($permission);
} | php | public function removeRolePermission($role, $permission)
{
$role = $this->findRoleByKey($role);
$permission = $this->findPermissionByKey($permission);
return $role->remove($permission);
} | [
"public",
"function",
"removeRolePermission",
"(",
"$",
"role",
",",
"$",
"permission",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"findRoleByKey",
"(",
"$",
"role",
")",
";",
"$",
"permission",
"=",
"$",
"this",
"->",
"findPermissionByKey",
"(",
"$"... | Remove a permission from a role
@param Reflex\Lockdown\Roles\RoleInterface|string $role
@param Reflex\Lockdown\Permission\PermissionInterface|string $permission
@return boolean | [
"Remove",
"a",
"permission",
"from",
"a",
"role"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L240-L246 |
10,237 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.giveUserPermission | public function giveUserPermission($user, $permission, $level = 'allow')
{
$this->checkPermissionLevel($level);
$user = $this->findUserById($user);
$permission = $this->findPermissionByKey($permission);
return $user->give($permission, $level);
} | php | public function giveUserPermission($user, $permission, $level = 'allow')
{
$this->checkPermissionLevel($level);
$user = $this->findUserById($user);
$permission = $this->findPermissionByKey($permission);
return $user->give($permission, $level);
} | [
"public",
"function",
"giveUserPermission",
"(",
"$",
"user",
",",
"$",
"permission",
",",
"$",
"level",
"=",
"'allow'",
")",
"{",
"$",
"this",
"->",
"checkPermissionLevel",
"(",
"$",
"level",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"findUserById"... | Give a user a permission
@param Reflex\Lockdown\Users\UserInterface|string $user
@param Reflex\Lockdown\Permissions\PermissionInterface|string $permission
@param string $level
@return boolean | [
"Give",
"a",
"user",
"a",
"permission"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L255-L263 |
10,238 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.removeUserPermission | public function removeUserPermission($user, $permission)
{
$permissions= $this->findPermissionByKey($permission);
$user = $this->findUserById($user);
return $user->remove($permission);
} | php | public function removeUserPermission($user, $permission)
{
$permissions= $this->findPermissionByKey($permission);
$user = $this->findUserById($user);
return $user->remove($permission);
} | [
"public",
"function",
"removeUserPermission",
"(",
"$",
"user",
",",
"$",
"permission",
")",
"{",
"$",
"permissions",
"=",
"$",
"this",
"->",
"findPermissionByKey",
"(",
"$",
"permission",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"findUserById",
"(",... | Remove a permission from a user
@param Reflex\Lockdown\Users\UserInterface|string $user
@param Reflex\Lockdown\Permissions\PermissionInterface|string $permission
@return boolean | [
"Remove",
"a",
"permission",
"from",
"a",
"user"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L271-L277 |
10,239 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.giveUserRole | public function giveUserRole($user, $role)
{
$user = $this->findUserById($user);
$role = $this->findRoleByKey($role);
if ($user->is($role->key)) {
return true;
}
return $user->join($role);
} | php | public function giveUserRole($user, $role)
{
$user = $this->findUserById($user);
$role = $this->findRoleByKey($role);
if ($user->is($role->key)) {
return true;
}
return $user->join($role);
} | [
"public",
"function",
"giveUserRole",
"(",
"$",
"user",
",",
"$",
"role",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"findUserById",
"(",
"$",
"user",
")",
";",
"$",
"role",
"=",
"$",
"this",
"->",
"findRoleByKey",
"(",
"$",
"role",
")",
";",
... | Give a user a role
@param Reflex\Lockdown\Users\UserInterface|string $user
@param Reflex\Lockdown\Roles\RoleInterface|string $role
@return boolean | [
"Give",
"a",
"user",
"a",
"role"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L285-L295 |
10,240 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.removeUserRole | public function removeUserRole($user, $role)
{
$user = $this->findUserById($user);
$role = $this->findRoleByKey($role);
if ($user->not($role->key)) {
return true;
}
return $user->leave($role);
} | php | public function removeUserRole($user, $role)
{
$user = $this->findUserById($user);
$role = $this->findRoleByKey($role);
if ($user->not($role->key)) {
return true;
}
return $user->leave($role);
} | [
"public",
"function",
"removeUserRole",
"(",
"$",
"user",
",",
"$",
"role",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"findUserById",
"(",
"$",
"user",
")",
";",
"$",
"role",
"=",
"$",
"this",
"->",
"findRoleByKey",
"(",
"$",
"role",
")",
";",... | Remove a role from a user
@param Reflex\Lockdown\Users\UserInterface|string $user
@param Reflex\Lockdown\Roles\RoleInterface|string $role
@return boolean | [
"Remove",
"a",
"role",
"from",
"a",
"user"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L303-L313 |
10,241 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.createPermission | public function createPermission($name, $key = null, $description = null)
{
$key = snake_case(isset($key) ? $key : $name);
$description= isset($description) ? $description : $name;
$values = compact('name', 'key', 'description');
return $this->permissionProvider->cr... | php | public function createPermission($name, $key = null, $description = null)
{
$key = snake_case(isset($key) ? $key : $name);
$description= isset($description) ? $description : $name;
$values = compact('name', 'key', 'description');
return $this->permissionProvider->cr... | [
"public",
"function",
"createPermission",
"(",
"$",
"name",
",",
"$",
"key",
"=",
"null",
",",
"$",
"description",
"=",
"null",
")",
"{",
"$",
"key",
"=",
"snake_case",
"(",
"isset",
"(",
"$",
"key",
")",
"?",
"$",
"key",
":",
"$",
"name",
")",
"... | Create a permission
@param string $name
@param string $key
@param string $description
@return boolean | [
"Create",
"a",
"permission"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L348-L355 |
10,242 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.has | public function has($id, $permission, $all = true)
{
if (! $user = $this->findUserById($id)) {
return false;
}
return $user->has($permission, $all);
} | php | public function has($id, $permission, $all = true)
{
if (! $user = $this->findUserById($id)) {
return false;
}
return $user->has($permission, $all);
} | [
"public",
"function",
"has",
"(",
"$",
"id",
",",
"$",
"permission",
",",
"$",
"all",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"=",
"$",
"this",
"->",
"findUserById",
"(",
"$",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"retur... | Does the user have a permission?
@param integer $id
@param string $permission
@param boolean $all
@return boolean | [
"Does",
"the",
"user",
"have",
"a",
"permission?"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L374-L381 |
10,243 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.hasnt | public function hasnt($id, $permission, $all = true)
{
return false === $this->has($id, $permission, $all);
} | php | public function hasnt($id, $permission, $all = true)
{
return false === $this->has($id, $permission, $all);
} | [
"public",
"function",
"hasnt",
"(",
"$",
"id",
",",
"$",
"permission",
",",
"$",
"all",
"=",
"true",
")",
"{",
"return",
"false",
"===",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
",",
"$",
"permission",
",",
"$",
"all",
")",
";",
"}"
] | Does the user not have a permission
@param integer $id
@param string $permission
@param boolean $all
@return boolean | [
"Does",
"the",
"user",
"not",
"have",
"a",
"permission"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L390-L393 |
10,244 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.is | public function is($id, $role, $all = true)
{
if (! $user = $this->findUserById($id)) {
return false;
}
return $user->is($role, $all);
} | php | public function is($id, $role, $all = true)
{
if (! $user = $this->findUserById($id)) {
return false;
}
return $user->is($role, $all);
} | [
"public",
"function",
"is",
"(",
"$",
"id",
",",
"$",
"role",
",",
"$",
"all",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"=",
"$",
"this",
"->",
"findUserById",
"(",
"$",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"... | Is the user part of a role?
@param integer $id
@param string $role
@param boolean $all
@return boolean | [
"Is",
"the",
"user",
"part",
"of",
"a",
"role?"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L402-L409 |
10,245 | reflex-php/lockdown | src/Reflex/Lockdown/Lockdown.php | Lockdown.not | public function not($id, $role, $all = true)
{
return false === $this->is($id, $role, $all);
} | php | public function not($id, $role, $all = true)
{
return false === $this->is($id, $role, $all);
} | [
"public",
"function",
"not",
"(",
"$",
"id",
",",
"$",
"role",
",",
"$",
"all",
"=",
"true",
")",
"{",
"return",
"false",
"===",
"$",
"this",
"->",
"is",
"(",
"$",
"id",
",",
"$",
"role",
",",
"$",
"all",
")",
";",
"}"
] | Is the user not part of a role?
@param integer $id
@param string $role
@param boolean $all
@return boolean | [
"Is",
"the",
"user",
"not",
"part",
"of",
"a",
"role?"
] | 2798e448608eef469f2924d75013deccfd6aca44 | https://github.com/reflex-php/lockdown/blob/2798e448608eef469f2924d75013deccfd6aca44/src/Reflex/Lockdown/Lockdown.php#L418-L421 |
10,246 | nia-php/validation | sources/TimeValidator.php | TimeValidator.checktime | private function checktime(int $hour, int $minute, int $second)
{
if ($hour < 0 || $hour > 23) {
return false;
} elseif ($minute < 0 || $minute > 59) {
return false;
} elseif ($second < 0 || $second > 59) {
return false;
}
return true;
... | php | private function checktime(int $hour, int $minute, int $second)
{
if ($hour < 0 || $hour > 23) {
return false;
} elseif ($minute < 0 || $minute > 59) {
return false;
} elseif ($second < 0 || $second > 59) {
return false;
}
return true;
... | [
"private",
"function",
"checktime",
"(",
"int",
"$",
"hour",
",",
"int",
"$",
"minute",
",",
"int",
"$",
"second",
")",
"{",
"if",
"(",
"$",
"hour",
"<",
"0",
"||",
"$",
"hour",
">",
"23",
")",
"{",
"return",
"false",
";",
"}",
"elseif",
"(",
"... | Checks whether the passed time is a valid time.
@param int $hour
The hour.
@param int $minute
The minute.
@param int $second
The second.
@return bool Returns 'true' if the passed time is a valid time, otherwise 'false' will be returned. | [
"Checks",
"whether",
"the",
"passed",
"time",
"is",
"a",
"valid",
"time",
"."
] | 49e9edc4589721e475be6099213aaf563638b056 | https://github.com/nia-php/validation/blob/49e9edc4589721e475be6099213aaf563638b056/sources/TimeValidator.php#L66-L77 |
10,247 | webforge-labs/webforge-utils | src/php/Webforge/Common/ArrayUtil.php | ArrayUtil.join | public static function join(Array $pieces, $glue) {
$s = NULL;
foreach ($pieces as $key =>$piece) {
if (is_array($piece)) $piece = 'Array';
$s .= sprintf($glue, $piece, $key);
}
return $s;
} | php | public static function join(Array $pieces, $glue) {
$s = NULL;
foreach ($pieces as $key =>$piece) {
if (is_array($piece)) $piece = 'Array';
$s .= sprintf($glue, $piece, $key);
}
return $s;
} | [
"public",
"static",
"function",
"join",
"(",
"Array",
"$",
"pieces",
",",
"$",
"glue",
")",
"{",
"$",
"s",
"=",
"NULL",
";",
"foreach",
"(",
"$",
"pieces",
"as",
"$",
"key",
"=>",
"$",
"piece",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"piece",
... | Joins an array to string
Aus einem Array ein geschriebenes Array machen:
print '$GLOBALS'.A::join(array('conf','default','db'), "['%s']");
// $GLOBALS['conf']['default']['db']
das erste %s ist der Wert aus dem Array das zweite %s ist der Schlüssel aus dem Array.
Diese können mit %1$s (wert) %2$s (schlüssel) addressier... | [
"Joins",
"an",
"array",
"to",
"string"
] | a476eeec046c22ad91794b0ab9fe15a1d3f92bfc | https://github.com/webforge-labs/webforge-utils/blob/a476eeec046c22ad91794b0ab9fe15a1d3f92bfc/src/php/Webforge/Common/ArrayUtil.php#L23-L31 |
10,248 | webforge-labs/webforge-utils | src/php/Webforge/Common/ArrayUtil.php | ArrayUtil.remove | public static function remove(Array &$array, $item, $searchStrict = TRUE) {
if (($key = array_search($item, $array, $searchStrict)) !== FALSE) {
array_splice($array, $key, 1);
}
return $array;
} | php | public static function remove(Array &$array, $item, $searchStrict = TRUE) {
if (($key = array_search($item, $array, $searchStrict)) !== FALSE) {
array_splice($array, $key, 1);
}
return $array;
} | [
"public",
"static",
"function",
"remove",
"(",
"Array",
"&",
"$",
"array",
",",
"$",
"item",
",",
"$",
"searchStrict",
"=",
"TRUE",
")",
"{",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"item",
",",
"$",
"array",
",",
"$",
"searchStr... | Remove an element from an array
the item is searched and removed, numeric arrays are renumbered
only the first item matched will be removed
@TODO FIXME: boolean trap
@param bool $searchStrict if false only the value will be replace
@return array | [
"Remove",
"an",
"element",
"from",
"an",
"array"
] | a476eeec046c22ad91794b0ab9fe15a1d3f92bfc | https://github.com/webforge-labs/webforge-utils/blob/a476eeec046c22ad91794b0ab9fe15a1d3f92bfc/src/php/Webforge/Common/ArrayUtil.php#L151-L157 |
10,249 | webforge-labs/webforge-utils | src/php/Webforge/Common/ArrayUtil.php | ArrayUtil.filterKeys | public static function filterKeys(Array $array, Closure $filter) {
$filtered = array();
//@TODO maybe something with array_filter as callback is faster here? benchmark?
foreach ($array as $key => $value) {
if ($filter($key, $value)) {
$filtered[$key] = $value;
}
}
return $filte... | php | public static function filterKeys(Array $array, Closure $filter) {
$filtered = array();
//@TODO maybe something with array_filter as callback is faster here? benchmark?
foreach ($array as $key => $value) {
if ($filter($key, $value)) {
$filtered[$key] = $value;
}
}
return $filte... | [
"public",
"static",
"function",
"filterKeys",
"(",
"Array",
"$",
"array",
",",
"Closure",
"$",
"filter",
")",
"{",
"$",
"filtered",
"=",
"array",
"(",
")",
";",
"//@TODO maybe something with array_filter as callback is faster here? benchmark?",
"foreach",
"(",
"$",
... | Filters the keys and values from an array
there is only one callback allowed that should return truthy if the value SHOULD exist in the new array
the first parameter of the callback is the key and the second is the key
but this function has the keys passed as second parameter
the new array is NOT renumbered
@param a... | [
"Filters",
"the",
"keys",
"and",
"values",
"from",
"an",
"array"
] | a476eeec046c22ad91794b0ab9fe15a1d3f92bfc | https://github.com/webforge-labs/webforge-utils/blob/a476eeec046c22ad91794b0ab9fe15a1d3f92bfc/src/php/Webforge/Common/ArrayUtil.php#L337-L348 |
10,250 | webforge-labs/webforge-utils | src/php/Webforge/Common/ArrayUtil.php | ArrayUtil.indexBy | public static function indexBy(Array $array, $property) {
$ret = array();
if (count($array) > 0) {
$index = Util::castGetterFromSample($property, current($array));
foreach ($array as $item) {
$ret[$index($item)] = $item;
}
}
return $ret;
} | php | public static function indexBy(Array $array, $property) {
$ret = array();
if (count($array) > 0) {
$index = Util::castGetterFromSample($property, current($array));
foreach ($array as $item) {
$ret[$index($item)] = $item;
}
}
return $ret;
} | [
"public",
"static",
"function",
"indexBy",
"(",
"Array",
"$",
"array",
",",
"$",
"property",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"array",
")",
">",
"0",
")",
"{",
"$",
"index",
"=",
"Util",
"::",
"ca... | Returns an array with the index constructred from objects in the collection
@param mixed $property see pluck() for details
@return array | [
"Returns",
"an",
"array",
"with",
"the",
"index",
"constructred",
"from",
"objects",
"in",
"the",
"collection"
] | a476eeec046c22ad91794b0ab9fe15a1d3f92bfc | https://github.com/webforge-labs/webforge-utils/blob/a476eeec046c22ad91794b0ab9fe15a1d3f92bfc/src/php/Webforge/Common/ArrayUtil.php#L356-L368 |
10,251 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.getAttributeDataFromTabs | public function getAttributeDataFromTabs(array $limit = []) {
$api_root_data = json_decode($this->nt8RestService->get('/'));
$attrib_data = $api_root_data->constants->attributes;
if (count($limit) > 0) {
$attrib_data = array_filter($attrib_data, function ($value) use ($limit) {
$attr_code = $... | php | public function getAttributeDataFromTabs(array $limit = []) {
$api_root_data = json_decode($this->nt8RestService->get('/'));
$attrib_data = $api_root_data->constants->attributes;
if (count($limit) > 0) {
$attrib_data = array_filter($attrib_data, function ($value) use ($limit) {
$attr_code = $... | [
"public",
"function",
"getAttributeDataFromTabs",
"(",
"array",
"$",
"limit",
"=",
"[",
"]",
")",
"{",
"$",
"api_root_data",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"nt8RestService",
"->",
"get",
"(",
"'/'",
")",
")",
";",
"$",
"attrib_data",
"=",
"$... | Fetches data for the specified attributes from Tabs.
@param array $limit
Limit the returned results by attribute code.
Example: $limit = [ 'ATTR01', 'ATTR02' ]
This will only return data for those attributes from the API.
If an empty array is passed all of the data will be returned.
@return array
Data for each attrib... | [
"Fetches",
"data",
"for",
"the",
"specified",
"attributes",
"from",
"Tabs",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L56-L72 |
10,252 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.createAttributesFromTabs | public function createAttributesFromTabs(array $attrib_data = []) {
// Return value.
$updatedAttrs = "";
$save_status = FALSE;
foreach ($attrib_data as $attr_key => $attribute) {
$attr_array = [
'field_attribute_code' => ['value' => $attribute->code],
'field_attribute_brand' => ... | php | public function createAttributesFromTabs(array $attrib_data = []) {
// Return value.
$updatedAttrs = "";
$save_status = FALSE;
foreach ($attrib_data as $attr_key => $attribute) {
$attr_array = [
'field_attribute_code' => ['value' => $attribute->code],
'field_attribute_brand' => ... | [
"public",
"function",
"createAttributesFromTabs",
"(",
"array",
"$",
"attrib_data",
"=",
"[",
"]",
")",
"{",
"// Return value.",
"$",
"updatedAttrs",
"=",
"\"\"",
";",
"$",
"save_status",
"=",
"FALSE",
";",
"foreach",
"(",
"$",
"attrib_data",
"as",
"$",
"att... | Populates the cottage_attributes taxonomy with data from TABS.
@param array $attrib_data
The response array retrieved from TABS.
@return string
A comma separated list of created/updated entries in the taxonomy.
@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
@throws \Drupal\Core\Entity\En... | [
"Populates",
"the",
"cottage_attributes",
"taxonomy",
"with",
"data",
"from",
"TABS",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L309-L355 |
10,253 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.loadNodesFromProprefs | public function loadNodesFromProprefs(array $proprefs) {
$loadedNodes = [];
foreach ($proprefs as $propref) {
$nodes = $this->loadNodesFromPropref($propref) ?: [];
if (count($nodes) > 0) {
foreach ($nodes as $node) {
$loadedNodes[$propref][] = $node;
}
}
}
... | php | public function loadNodesFromProprefs(array $proprefs) {
$loadedNodes = [];
foreach ($proprefs as $propref) {
$nodes = $this->loadNodesFromPropref($propref) ?: [];
if (count($nodes) > 0) {
foreach ($nodes as $node) {
$loadedNodes[$propref][] = $node;
}
}
}
... | [
"public",
"function",
"loadNodesFromProprefs",
"(",
"array",
"$",
"proprefs",
")",
"{",
"$",
"loadedNodes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"proprefs",
"as",
"$",
"propref",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"loadNodesFromPropref",
... | Load node objects from an array of property references.
@param array $proprefs
Property references.
@return array
Loaded property nodes. | [
"Load",
"node",
"objects",
"from",
"an",
"array",
"of",
"property",
"references",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L366-L380 |
10,254 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.loadNodesFromPropref | public function loadNodesFromPropref(string $propref, bool $load = TRUE) {
// Get the nodes to update with this data.
$nodeQuery = $this->entityQuery->get('node');
$nodeStorage = $this->entityTypeManager->getStorage('node');
$nids = $nodeQuery->condition('field_cottage_reference_code.value', $propref, '... | php | public function loadNodesFromPropref(string $propref, bool $load = TRUE) {
// Get the nodes to update with this data.
$nodeQuery = $this->entityQuery->get('node');
$nodeStorage = $this->entityTypeManager->getStorage('node');
$nids = $nodeQuery->condition('field_cottage_reference_code.value', $propref, '... | [
"public",
"function",
"loadNodesFromPropref",
"(",
"string",
"$",
"propref",
",",
"bool",
"$",
"load",
"=",
"TRUE",
")",
"{",
"// Get the nodes to update with this data.",
"$",
"nodeQuery",
"=",
"$",
"this",
"->",
"entityQuery",
"->",
"get",
"(",
"'node'",
")",
... | Loads property nodes which have the same propref as the one provided.
@param string $propref
Property reference to query for.
@param bool $load
True: Return loaded node objects.
False: Make no attempt to load and return an array of NIDs.
@return array|\Drupal\Core\Entity\EntityInterface[]|int|null
An array of loaded ... | [
"Loads",
"property",
"nodes",
"which",
"have",
"the",
"same",
"propref",
"as",
"the",
"one",
"provided",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L397-L415 |
10,255 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.updateNodeInstancesFromData | public function updateNodeInstancesFromData(\stdClass $data) {
$updatedProperties = [];
$nids = self::loadNodesFromPropref($data->propertyRef, FALSE);
$updatedValues = self::generateUpdateArray($data, FALSE);
if (count($nids) > 0) {
$nodes = $this->entityTypeManager->getStorage('node')->loadMult... | php | public function updateNodeInstancesFromData(\stdClass $data) {
$updatedProperties = [];
$nids = self::loadNodesFromPropref($data->propertyRef, FALSE);
$updatedValues = self::generateUpdateArray($data, FALSE);
if (count($nids) > 0) {
$nodes = $this->entityTypeManager->getStorage('node')->loadMult... | [
"public",
"function",
"updateNodeInstancesFromData",
"(",
"\\",
"stdClass",
"$",
"data",
")",
"{",
"$",
"updatedProperties",
"=",
"[",
"]",
";",
"$",
"nids",
"=",
"self",
"::",
"loadNodesFromPropref",
"(",
"$",
"data",
"->",
"propertyRef",
",",
"FALSE",
")",... | Updates all matching nodes with data provided by the TABS api.
Example Usage:
$data = json_decode($api_property_data_response_string);
updateNodeInstancesFromData($data);
@param \stdClass $data
Property data as returned from the API.
@return array
Returns an array of all of the successfully updated properties' NIDs.... | [
"Updates",
"all",
"matching",
"nodes",
"with",
"data",
"provided",
"by",
"the",
"TABS",
"api",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L433-L453 |
10,256 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.getNodeFieldValue | public static function getNodeFieldValue(
EntityInterface $node,
string $fieldName,
int $index = -1,
string $keyname = 'value'
) {
$field_instance = static::getNodeField($node, $fieldName);
$field_instance_value = $field_instance->getValue();
if ($index > -1) {
$field_instance_value... | php | public static function getNodeFieldValue(
EntityInterface $node,
string $fieldName,
int $index = -1,
string $keyname = 'value'
) {
$field_instance = static::getNodeField($node, $fieldName);
$field_instance_value = $field_instance->getValue();
if ($index > -1) {
$field_instance_value... | [
"public",
"static",
"function",
"getNodeFieldValue",
"(",
"EntityInterface",
"$",
"node",
",",
"string",
"$",
"fieldName",
",",
"int",
"$",
"index",
"=",
"-",
"1",
",",
"string",
"$",
"keyname",
"=",
"'value'",
")",
"{",
"$",
"field_instance",
"=",
"static... | Retrieves a field value from a specified node.
@param \Drupal\Core\Entity\EntityInterface $node
Loaded property node.
@param string $fieldName
Field to load.
@param int $index
Load $index of the field instance array.
@param string $keyname
Load $keyname of the specified $index of the field instance array.
@return mix... | [
"Retrieves",
"a",
"field",
"value",
"from",
"a",
"specified",
"node",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L474-L488 |
10,257 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.getTidFromTermName | public static function getTidFromTermName($term_name, $vocab_name) {
$tid = -1;
if ($terms = taxonomy_term_load_multiple_by_name($term_name, $vocab_name)) {
$term = reset($terms);
$tid = $term->id();
}
return $tid;
} | php | public static function getTidFromTermName($term_name, $vocab_name) {
$tid = -1;
if ($terms = taxonomy_term_load_multiple_by_name($term_name, $vocab_name)) {
$term = reset($terms);
$tid = $term->id();
}
return $tid;
} | [
"public",
"static",
"function",
"getTidFromTermName",
"(",
"$",
"term_name",
",",
"$",
"vocab_name",
")",
"{",
"$",
"tid",
"=",
"-",
"1",
";",
"if",
"(",
"$",
"terms",
"=",
"taxonomy_term_load_multiple_by_name",
"(",
"$",
"term_name",
",",
"$",
"vocab_name",... | Retrieves a TID for a given term name. Rturns -1 if term couldn't be found. | [
"Retrieves",
"a",
"TID",
"for",
"a",
"given",
"term",
"name",
".",
"Rturns",
"-",
"1",
"if",
"term",
"couldn",
"t",
"be",
"found",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L508-L516 |
10,258 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.updateNodeInstanceFromData | public function updateNodeInstanceFromData(array $updatedValues, EntityInterface &$nodeInstance) {
$updated = FALSE;
// Compare for differences and update if a difference is found.
foreach ($updatedValues as $updatedValueKey => $updatedValue) {
$currentNodeField = static::getNodeFieldValue($nodeInsta... | php | public function updateNodeInstanceFromData(array $updatedValues, EntityInterface &$nodeInstance) {
$updated = FALSE;
// Compare for differences and update if a difference is found.
foreach ($updatedValues as $updatedValueKey => $updatedValue) {
$currentNodeField = static::getNodeFieldValue($nodeInsta... | [
"public",
"function",
"updateNodeInstanceFromData",
"(",
"array",
"$",
"updatedValues",
",",
"EntityInterface",
"&",
"$",
"nodeInstance",
")",
"{",
"$",
"updated",
"=",
"FALSE",
";",
"// Compare for differences and update if a difference is found.",
"foreach",
"(",
"$",
... | Updates an EntityInterface from a provided array of updated values.
@param array $updatedValues
Array of updated values to be compared against.
@param \Drupal\Core\Entity\EntityInterface $nodeInstance
Instance of the node which has the fields to compare against.
@return bool
Indicates that field(s) have been changed ... | [
"Updates",
"an",
"EntityInterface",
"from",
"a",
"provided",
"array",
"of",
"updated",
"values",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L531-L583 |
10,259 | neontabs-drupal8/nt8property | src/Service/NT8PropertyService.php | NT8PropertyService.createNodeInstanceFromPropref | public function createNodeInstanceFromPropref(string $propRef = "") {
$data = $this->getPropertyFromApi($propRef);
$created_node = NULL;
if ($data && $data instanceof \stdClass) {
$created_node = $this->createNodeInstanceFromData($data, TRUE);
}
return $created_node;
} | php | public function createNodeInstanceFromPropref(string $propRef = "") {
$data = $this->getPropertyFromApi($propRef);
$created_node = NULL;
if ($data && $data instanceof \stdClass) {
$created_node = $this->createNodeInstanceFromData($data, TRUE);
}
return $created_node;
} | [
"public",
"function",
"createNodeInstanceFromPropref",
"(",
"string",
"$",
"propRef",
"=",
"\"\"",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getPropertyFromApi",
"(",
"$",
"propRef",
")",
";",
"$",
"created_node",
"=",
"NULL",
";",
"if",
"(",
"$",
... | Creates a property node populated with data returned from the API.
@param string $propRef
propRef to load into a property node.
@return \Drupal\Core\Entity\EntityInterface|null
The created property entity.
@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
@throws \Drupal\Core\Entity\EntityS... | [
"Creates",
"a",
"property",
"node",
"populated",
"with",
"data",
"returned",
"from",
"the",
"API",
"."
] | 53b630a612c6dc7c90a8ca1ce4ceb41568473447 | https://github.com/neontabs-drupal8/nt8property/blob/53b630a612c6dc7c90a8ca1ce4ceb41568473447/src/Service/NT8PropertyService.php#L643-L652 |
10,260 | phPoirot/Module-MongoDriver | src/MongoDriver/Actions/MongoDriverAction.php | MongoDriverAction.setClient | function setClient($clientName, MongoDB\Client $clientMongo)
{
if ($this->hasClient($clientName))
throw new \Exception(sprintf('Client with name (%s) already exists and cant be replaced.', $clientName));
$this->clients[$clientName] = $clientMongo;
return $this;
} | php | function setClient($clientName, MongoDB\Client $clientMongo)
{
if ($this->hasClient($clientName))
throw new \Exception(sprintf('Client with name (%s) already exists and cant be replaced.', $clientName));
$this->clients[$clientName] = $clientMongo;
return $this;
} | [
"function",
"setClient",
"(",
"$",
"clientName",
",",
"MongoDB",
"\\",
"Client",
"$",
"clientMongo",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasClient",
"(",
"$",
"clientName",
")",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Client w... | Add Client Connection
Options:
'db' => (string) default database to query on
@param string $clientName
@param MongoDB\Client $clientMongo
@return $this
@throws \Exception | [
"Add",
"Client",
"Connection"
] | 5c11c01676f10e88b0af899971fcd86ca23e81bd | https://github.com/phPoirot/Module-MongoDriver/blob/5c11c01676f10e88b0af899971fcd86ca23e81bd/src/MongoDriver/Actions/MongoDriverAction.php#L55-L63 |
10,261 | phPoirot/Module-MongoDriver | src/MongoDriver/Actions/MongoDriverAction.php | MongoDriverAction.getClient | function getClient($clientName)
{
if (! isset($this->clients[$clientName]) )
// if not client constructed look for lazy options:
$this->clients[$clientName] = $this->_attainClient($clientName);
return $this->clients[$clientName];
} | php | function getClient($clientName)
{
if (! isset($this->clients[$clientName]) )
// if not client constructed look for lazy options:
$this->clients[$clientName] = $this->_attainClient($clientName);
return $this->clients[$clientName];
} | [
"function",
"getClient",
"(",
"$",
"clientName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"clients",
"[",
"$",
"clientName",
"]",
")",
")",
"// if not client constructed look for lazy options:",
"$",
"this",
"->",
"clients",
"[",
"$",
"clie... | Attain Client By Name
@param string $clientName
@return MongoDB\Client
@throws \Exception | [
"Attain",
"Client",
"By",
"Name"
] | 5c11c01676f10e88b0af899971fcd86ca23e81bd | https://github.com/phPoirot/Module-MongoDriver/blob/5c11c01676f10e88b0af899971fcd86ca23e81bd/src/MongoDriver/Actions/MongoDriverAction.php#L73-L81 |
10,262 | phPoirot/Module-MongoDriver | src/MongoDriver/Actions/MongoDriverAction.php | MongoDriverAction.hasClient | function hasClient($clientName)
{
if (! isset($this->clients[$clientName]) ) {
// Lookup for lazy client options
try {
$exists = true;
$this->getClient($clientName);
} catch (\Exception $e) {
$exists = false;
}
... | php | function hasClient($clientName)
{
if (! isset($this->clients[$clientName]) ) {
// Lookup for lazy client options
try {
$exists = true;
$this->getClient($clientName);
} catch (\Exception $e) {
$exists = false;
}
... | [
"function",
"hasClient",
"(",
"$",
"clientName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"clients",
"[",
"$",
"clientName",
"]",
")",
")",
"{",
"// Lookup for lazy client options",
"try",
"{",
"$",
"exists",
"=",
"true",
";",
"$",
"t... | Has Client Connection?
@param string $clientName
@return boolean | [
"Has",
"Client",
"Connection?"
] | 5c11c01676f10e88b0af899971fcd86ca23e81bd | https://github.com/phPoirot/Module-MongoDriver/blob/5c11c01676f10e88b0af899971fcd86ca23e81bd/src/MongoDriver/Actions/MongoDriverAction.php#L90-L106 |
10,263 | phPoirot/Module-MongoDriver | src/MongoDriver/Actions/MongoDriverAction.php | MongoDriverAction._attainClient | protected function _attainClient($clientName)
{
if (! isset($this->lazyClientOptions[$clientName]) )
throw new \Exception(sprintf('MongoDB Client (%s) not Registered.', $clientName));
$conf = $this->lazyClientOptions[$clientName];
if (! isset($conf['host']) )
throw ... | php | protected function _attainClient($clientName)
{
if (! isset($this->lazyClientOptions[$clientName]) )
throw new \Exception(sprintf('MongoDB Client (%s) not Registered.', $clientName));
$conf = $this->lazyClientOptions[$clientName];
if (! isset($conf['host']) )
throw ... | [
"protected",
"function",
"_attainClient",
"(",
"$",
"clientName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"lazyClientOptions",
"[",
"$",
"clientName",
"]",
")",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'MongoDB Clien... | Attain Client Instance from LazyConfigs
@param $clientName
@return MongoDB\Client
@throws \Exception | [
"Attain",
"Client",
"Instance",
"from",
"LazyConfigs"
] | 5c11c01676f10e88b0af899971fcd86ca23e81bd | https://github.com/phPoirot/Module-MongoDriver/blob/5c11c01676f10e88b0af899971fcd86ca23e81bd/src/MongoDriver/Actions/MongoDriverAction.php#L169-L189 |
10,264 | RhubarbPHP/Module.Leaf.SearchPanel | src/Leaves/SearchPanel.php | SearchPanel.getSearchControlValues | public function getSearchControlValues()
{
$data = $this->model->searchValues;
$controlData = [];
foreach ($this->model->searchControls as $control) {
$controlName = $control->getName();
if (isset($data[$controlName])) {
$controlData[$controlName] = ... | php | public function getSearchControlValues()
{
$data = $this->model->searchValues;
$controlData = [];
foreach ($this->model->searchControls as $control) {
$controlName = $control->getName();
if (isset($data[$controlName])) {
$controlData[$controlName] = ... | [
"public",
"function",
"getSearchControlValues",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"model",
"->",
"searchValues",
";",
"$",
"controlData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"model",
"->",
"searchControls",
"as",
"$",... | Returns a key value pair array of each control name and it's value
@return string[] | [
"Returns",
"a",
"key",
"value",
"pair",
"array",
"of",
"each",
"control",
"name",
"and",
"it",
"s",
"value"
] | 8136023d37e07806f88de31c7c69a98cf900169d | https://github.com/RhubarbPHP/Module.Leaf.SearchPanel/blob/8136023d37e07806f88de31c7c69a98cf900169d/src/Leaves/SearchPanel.php#L100-L114 |
10,265 | RhubarbPHP/Module.Leaf.SearchPanel | src/Leaves/SearchPanel.php | SearchPanel.setSearchControlValues | public function setSearchControlValues($controlValues = [], $rememberPrevious = false)
{
if ($rememberPrevious){
$this->previousSearchValues = $this->model->searchValues;
} else {
if ($this->previousSearchValues) {
$this->model->searchValues = $this->previou... | php | public function setSearchControlValues($controlValues = [], $rememberPrevious = false)
{
if ($rememberPrevious){
$this->previousSearchValues = $this->model->searchValues;
} else {
if ($this->previousSearchValues) {
$this->model->searchValues = $this->previou... | [
"public",
"function",
"setSearchControlValues",
"(",
"$",
"controlValues",
"=",
"[",
"]",
",",
"$",
"rememberPrevious",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"rememberPrevious",
")",
"{",
"$",
"this",
"->",
"previousSearchValues",
"=",
"$",
"this",
"->",
... | Sets the values of the search controls.
@param array $controlValues A key value pair array. | [
"Sets",
"the",
"values",
"of",
"the",
"search",
"controls",
"."
] | 8136023d37e07806f88de31c7c69a98cf900169d | https://github.com/RhubarbPHP/Module.Leaf.SearchPanel/blob/8136023d37e07806f88de31c7c69a98cf900169d/src/Leaves/SearchPanel.php#L123-L148 |
10,266 | RhubarbPHP/Module.Leaf.SearchPanel | src/Leaves/SearchPanel.php | SearchPanel.getUrlStateNames | protected function getUrlStateNames(array $searchControls)
{
$names = [];
foreach ($searchControls as $control) {
$name = $control->getName();
$names[$name] = StringTools::camelCaseToSeparated($name);
}
return $names;
} | php | protected function getUrlStateNames(array $searchControls)
{
$names = [];
foreach ($searchControls as $control) {
$name = $control->getName();
$names[$name] = StringTools::camelCaseToSeparated($name);
}
return $names;
} | [
"protected",
"function",
"getUrlStateNames",
"(",
"array",
"$",
"searchControls",
")",
"{",
"$",
"names",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"searchControls",
"as",
"$",
"control",
")",
"{",
"$",
"name",
"=",
"$",
"control",
"->",
"getName",
"(",
... | Return URL GET param names for the controls in this panel
@param Control[] $searchControls
@return \string[] An array with keys matching the control names and values defining the GET param names | [
"Return",
"URL",
"GET",
"param",
"names",
"for",
"the",
"controls",
"in",
"this",
"panel"
] | 8136023d37e07806f88de31c7c69a98cf900169d | https://github.com/RhubarbPHP/Module.Leaf.SearchPanel/blob/8136023d37e07806f88de31c7c69a98cf900169d/src/Leaves/SearchPanel.php#L225-L234 |
10,267 | Dhii/php-cs-fixer-config | src/Config.php | Config.getApplicableRules | public static function getApplicableRules()
{
$rules = [
FixerInterface::PSR2_LEVEL => static::getPsr2Rules(),
FixerInterface::SYMFONY_LEVEL => static::getSymfonyRules(),
FixerInterface::CONTRIB_LEVEL => static::getContribRules(),
];
return static::_pr... | php | public static function getApplicableRules()
{
$rules = [
FixerInterface::PSR2_LEVEL => static::getPsr2Rules(),
FixerInterface::SYMFONY_LEVEL => static::getSymfonyRules(),
FixerInterface::CONTRIB_LEVEL => static::getContribRules(),
];
return static::_pr... | [
"public",
"static",
"function",
"getApplicableRules",
"(",
")",
"{",
"$",
"rules",
"=",
"[",
"FixerInterface",
"::",
"PSR2_LEVEL",
"=>",
"static",
"::",
"getPsr2Rules",
"(",
")",
",",
"FixerInterface",
"::",
"SYMFONY_LEVEL",
"=>",
"static",
"::",
"getSymfonyRule... | Return all the rules that should be part of the config.
@return array Format for version <2.0 is numeric array of strings.
@since [*next-version*] | [
"Return",
"all",
"the",
"rules",
"that",
"should",
"be",
"part",
"of",
"the",
"config",
"."
] | fc2f45d1f822bff7d871ba3c4c9750ad66f5ab0c | https://github.com/Dhii/php-cs-fixer-config/blob/fc2f45d1f822bff7d871ba3c4c9750ad66f5ab0c/src/Config.php#L56-L65 |
10,268 | Dhii/php-cs-fixer-config | src/Config.php | Config._prepareRules | protected static function _prepareRules($rules)
{
foreach ($rules as $_name => $_rules) {
$rules[$_name] = array_flip($_rules);
}
$rules = call_user_func_array('array_merge', $rules);
return array_keys($rules);
} | php | protected static function _prepareRules($rules)
{
foreach ($rules as $_name => $_rules) {
$rules[$_name] = array_flip($_rules);
}
$rules = call_user_func_array('array_merge', $rules);
return array_keys($rules);
} | [
"protected",
"static",
"function",
"_prepareRules",
"(",
"$",
"rules",
")",
"{",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"_name",
"=>",
"$",
"_rules",
")",
"{",
"$",
"rules",
"[",
"$",
"_name",
"]",
"=",
"array_flip",
"(",
"$",
"_rules",
")",
";",
... | Combines a map of rule levels to rule lists into one list.
@since [*next-version*]
@param array $rules Map of rule level to rule list, where rule list is a numeric array of string names.
@return array A unique list of all rules combined in a numeric array of strings. | [
"Combines",
"a",
"map",
"of",
"rule",
"levels",
"to",
"rule",
"lists",
"into",
"one",
"list",
"."
] | fc2f45d1f822bff7d871ba3c4c9750ad66f5ab0c | https://github.com/Dhii/php-cs-fixer-config/blob/fc2f45d1f822bff7d871ba3c4c9750ad66f5ab0c/src/Config.php#L76-L85 |
10,269 | Dhii/php-cs-fixer-config | src/Config.php | Config.getSymfonyRules20 | public static function getSymfonyRules20()
{
return [
'blank_line_after_opening_tag' => true,
'blank_line_before_return' => true,
'cast_spaces' => true,
'concat_without_spaces' ... | php | public static function getSymfonyRules20()
{
return [
'blank_line_after_opening_tag' => true,
'blank_line_before_return' => true,
'cast_spaces' => true,
'concat_without_spaces' ... | [
"public",
"static",
"function",
"getSymfonyRules20",
"(",
")",
"{",
"return",
"[",
"'blank_line_after_opening_tag'",
"=>",
"true",
",",
"'blank_line_before_return'",
"=>",
"true",
",",
"'cast_spaces'",
"=>",
"true",
",",
"'concat_without_spaces'",
"=>",
"false",
",",
... | Gets rules of the Symfony level that are applicable to this config.
@todo Rename to `getSymfonyRules()` and use when using CS Fixer >= 2.0
@return array Map of rule name (strig) to enabled/disabled (bool)
@since [*next-version*] | [
"Gets",
"rules",
"of",
"the",
"Symfony",
"level",
"that",
"are",
"applicable",
"to",
"this",
"config",
"."
] | fc2f45d1f822bff7d871ba3c4c9750ad66f5ab0c | https://github.com/Dhii/php-cs-fixer-config/blob/fc2f45d1f822bff7d871ba3c4c9750ad66f5ab0c/src/Config.php#L147-L213 |
10,270 | Hifone/Dashboard | src/Frozennode/Administrator/Menu.php | Menu.getMenu | public function getMenu($subMenu = null)
{
$menu = array();
if (!$subMenu) {
$arr = include __DIR__.'/../../config/administrator.php';
$subMenu = $arr['menu'];
}
//iterate over the menu to build the return array of valid menu items
foreach ($subMenu ... | php | public function getMenu($subMenu = null)
{
$menu = array();
if (!$subMenu) {
$arr = include __DIR__.'/../../config/administrator.php';
$subMenu = $arr['menu'];
}
//iterate over the menu to build the return array of valid menu items
foreach ($subMenu ... | [
"public",
"function",
"getMenu",
"(",
"$",
"subMenu",
"=",
"null",
")",
"{",
"$",
"menu",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"subMenu",
")",
"{",
"$",
"arr",
"=",
"include",
"__DIR__",
".",
"'/../../config/administrator.php'",
";",
"$",
... | Gets the menu items indexed by their name with a value of the title.
@param array $subMenu (used for recursion)
@return array | [
"Gets",
"the",
"menu",
"items",
"indexed",
"by",
"their",
"name",
"with",
"a",
"value",
"of",
"the",
"title",
"."
] | 45b35879e74d99164db9c8a34da40cdb53d25e90 | https://github.com/Hifone/Dashboard/blob/45b35879e74d99164db9c8a34da40cdb53d25e90/src/Frozennode/Administrator/Menu.php#L43-L80 |
10,271 | asbsoft/yii2-common_2_170212 | models/BaseDataModel.php | BaseDataModel.calcPage | public function calcPage($currentQuery = null)
{
$page = 1;
$primaryKeys = static::primaryKey();
if (isset($primaryKeys[0])) {
$primaryKey = $primaryKeys[0];
$num = $this->getOrderNumber($this->$primaryKey, $currentQuery);
if ($num > 0) {
$... | php | public function calcPage($currentQuery = null)
{
$page = 1;
$primaryKeys = static::primaryKey();
if (isset($primaryKeys[0])) {
$primaryKey = $primaryKeys[0];
$num = $this->getOrderNumber($this->$primaryKey, $currentQuery);
if ($num > 0) {
$... | [
"public",
"function",
"calcPage",
"(",
"$",
"currentQuery",
"=",
"null",
")",
"{",
"$",
"page",
"=",
"1",
";",
"$",
"primaryKeys",
"=",
"static",
"::",
"primaryKey",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"primaryKeys",
"[",
"0",
"]",
")",
")... | Calculate page number for current record. | [
"Calculate",
"page",
"number",
"for",
"current",
"record",
"."
] | 6c58012ff89225d7d4e42b200cf39e009e9d9dac | https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/models/BaseDataModel.php#L168-L180 |
10,272 | asbsoft/yii2-common_2_170212 | models/BaseDataModel.php | BaseDataModel.moduleClass | public static function moduleClass($moduleName = 'Module')
{
$result = false;
$className = get_called_class();
$refClass = new ReflectionClass($className);
$ns = $refClass->getNamespaceName();
$len = strlen($ns) - strlen(UniModule::$modelsSubdir);
if (strrpos($ns, U... | php | public static function moduleClass($moduleName = 'Module')
{
$result = false;
$className = get_called_class();
$refClass = new ReflectionClass($className);
$ns = $refClass->getNamespaceName();
$len = strlen($ns) - strlen(UniModule::$modelsSubdir);
if (strrpos($ns, U... | [
"public",
"static",
"function",
"moduleClass",
"(",
"$",
"moduleName",
"=",
"'Module'",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"className",
"=",
"get_called_class",
"(",
")",
";",
"$",
"refClass",
"=",
"new",
"ReflectionClass",
"(",
"$",
"classNa... | Try to get module class this model belong to.
Get latest module in inheritance chain.
@return string|false class name. | [
"Try",
"to",
"get",
"module",
"class",
"this",
"model",
"belong",
"to",
".",
"Get",
"latest",
"module",
"in",
"inheritance",
"chain",
"."
] | 6c58012ff89225d7d4e42b200cf39e009e9d9dac | https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/models/BaseDataModel.php#L230-L245 |
10,273 | asbsoft/yii2-common_2_170212 | models/BaseDataModel.php | BaseDataModel.swapPrio | public function swapPrio($id1, $id2, $orderField = 'prio')
{
$item1 = self::findOne(['id' => $id1]);
if (!empty($item1->$orderField)) {
$prio1 = $item1->$orderField;
} else {
return false;
}
$item2 = self::findOne(['id' => $id2]);
if (!empty($i... | php | public function swapPrio($id1, $id2, $orderField = 'prio')
{
$item1 = self::findOne(['id' => $id1]);
if (!empty($item1->$orderField)) {
$prio1 = $item1->$orderField;
} else {
return false;
}
$item2 = self::findOne(['id' => $id2]);
if (!empty($i... | [
"public",
"function",
"swapPrio",
"(",
"$",
"id1",
",",
"$",
"id2",
",",
"$",
"orderField",
"=",
"'prio'",
")",
"{",
"$",
"item1",
"=",
"self",
"::",
"findOne",
"(",
"[",
"'id'",
"=>",
"$",
"id1",
"]",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$... | Swap order field values for
@param integer $id1
@param integer $id2
@param string $orderField
@return boolean | [
"Swap",
"order",
"field",
"values",
"for"
] | 6c58012ff89225d7d4e42b200cf39e009e9d9dac | https://github.com/asbsoft/yii2-common_2_170212/blob/6c58012ff89225d7d4e42b200cf39e009e9d9dac/models/BaseDataModel.php#L317-L345 |
10,274 | eFrane/Transfugio | src/Http/ResponseBuilder.php | ResponseBuilder.respondWithEmpty | public function respondWithEmpty($message = "The requested result set is empty.", $status = 204)
{
if ($this->options['format'] === 'html') {
$status = 200;
}
return $this->respondWithError($message, $status);
} | php | public function respondWithEmpty($message = "The requested result set is empty.", $status = 204)
{
if ($this->options['format'] === 'html') {
$status = 200;
}
return $this->respondWithError($message, $status);
} | [
"public",
"function",
"respondWithEmpty",
"(",
"$",
"message",
"=",
"\"The requested result set is empty.\"",
",",
"$",
"status",
"=",
"204",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"options",
"[",
"'format'",
"]",
"===",
"'html'",
")",
"{",
"$",
"status",
... | Return an empty response.
APIs should never return nothing, thus a response stating that there is no
content is returned.
The issue is, that the correct HTTP Status code for "No Content" is 204, which
is being used for all machine-readable output formats, however, if the
output will be a web view, 200 is set as statu... | [
"Return",
"an",
"empty",
"response",
"."
] | c213b3c0e3649150d0c6675167e781930fda9125 | https://github.com/eFrane/Transfugio/blob/c213b3c0e3649150d0c6675167e781930fda9125/src/Http/ResponseBuilder.php#L153-L160 |
10,275 | webriq/core | module/Customize/src/Grid/Customize/Model/Exporter.php | Exporter.setDomainList | protected function setDomainList( DomainList $domainList )
{
$this->urlPattern = null;
$this->domainList = $domainList;
return $this;
} | php | protected function setDomainList( DomainList $domainList )
{
$this->urlPattern = null;
$this->domainList = $domainList;
return $this;
} | [
"protected",
"function",
"setDomainList",
"(",
"DomainList",
"$",
"domainList",
")",
"{",
"$",
"this",
"->",
"urlPattern",
"=",
"null",
";",
"$",
"this",
"->",
"domainList",
"=",
"$",
"domainList",
";",
"return",
"$",
"this",
";",
"}"
] | Set the domain-list
@param DomainList $domainList
@return Exporter | [
"Set",
"the",
"domain",
"-",
"list"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Customize/src/Grid/Customize/Model/Exporter.php#L47-L52 |
10,276 | webriq/core | module/Customize/src/Grid/Customize/Model/Exporter.php | Exporter.getUrlPattern | protected function getUrlPattern()
{
if ( $this->urlPattern )
{
return $this->urlPattern;
}
$domains = iterator_to_array( $this->getDomainList() );
if ( empty( $domains ) )
{
$domains = array( 'localhost' );
}
return $this->u... | php | protected function getUrlPattern()
{
if ( $this->urlPattern )
{
return $this->urlPattern;
}
$domains = iterator_to_array( $this->getDomainList() );
if ( empty( $domains ) )
{
$domains = array( 'localhost' );
}
return $this->u... | [
"protected",
"function",
"getUrlPattern",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"urlPattern",
")",
"{",
"return",
"$",
"this",
"->",
"urlPattern",
";",
"}",
"$",
"domains",
"=",
"iterator_to_array",
"(",
"$",
"this",
"->",
"getDomainList",
"(",
")... | Get url pattern
@return string | [
"Get",
"url",
"pattern"
] | cfeb6e8a4732561c2215ec94e736c07f9b8bc990 | https://github.com/webriq/core/blob/cfeb6e8a4732561c2215ec94e736c07f9b8bc990/module/Customize/src/Grid/Customize/Model/Exporter.php#L59-L76 |
10,277 | bishopb/vanilla | applications/dashboard/models/class.vbulletinimportmodel.php | vBulletinImportModel.ProfileExtenderPrep | public function ProfileExtenderPrep() {
$ProfileKeyData = $this->SQL->Select('m.Name')->Distinct()->From('UserMeta m')->Like('m.Name', 'Profile_%')->Get();
$ExistingKeys = array_filter((array)explode(',', C('Plugins.ProfileExtender.ProfileFields', '')));
foreach ($ProfileKeyData->Result() as $Key) {
... | php | public function ProfileExtenderPrep() {
$ProfileKeyData = $this->SQL->Select('m.Name')->Distinct()->From('UserMeta m')->Like('m.Name', 'Profile_%')->Get();
$ExistingKeys = array_filter((array)explode(',', C('Plugins.ProfileExtender.ProfileFields', '')));
foreach ($ProfileKeyData->Result() as $Key) {
... | [
"public",
"function",
"ProfileExtenderPrep",
"(",
")",
"{",
"$",
"ProfileKeyData",
"=",
"$",
"this",
"->",
"SQL",
"->",
"Select",
"(",
"'m.Name'",
")",
"->",
"Distinct",
"(",
")",
"->",
"From",
"(",
"'UserMeta m'",
")",
"->",
"Like",
"(",
"'m.Name'",
","... | Get profile fields imported and add to ProfileFields list. | [
"Get",
"profile",
"fields",
"imported",
"and",
"add",
"to",
"ProfileFields",
"list",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/models/class.vbulletinimportmodel.php#L111-L122 |
10,278 | sirgrimorum/crudgenerator | src/Traits/CrudConfig.php | CrudConfig.hasTipo | public static function hasTipo($array, $tipo) {
foreach ($array['campos'] as $campo => $configCampo) {
if (is_array($tipo)) {
foreach ($tipo as $miniTipo) {
if (strtolower($configCampo['tipo']) == strtolower($miniTipo)) {
return true;
... | php | public static function hasTipo($array, $tipo) {
foreach ($array['campos'] as $campo => $configCampo) {
if (is_array($tipo)) {
foreach ($tipo as $miniTipo) {
if (strtolower($configCampo['tipo']) == strtolower($miniTipo)) {
return true;
... | [
"public",
"static",
"function",
"hasTipo",
"(",
"$",
"array",
",",
"$",
"tipo",
")",
"{",
"foreach",
"(",
"$",
"array",
"[",
"'campos'",
"]",
"as",
"$",
"campo",
"=>",
"$",
"configCampo",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"tipo",
")",
")",... | Know if a config array has any field of certain type
@param array $array Config array
@param string|array $tipo Type of field
@return boolean | [
"Know",
"if",
"a",
"config",
"array",
"has",
"any",
"field",
"of",
"certain",
"type"
] | 4431e9991a705689be50c4367776dc611bffb863 | https://github.com/sirgrimorum/crudgenerator/blob/4431e9991a705689be50c4367776dc611bffb863/src/Traits/CrudConfig.php#L1030-L1043 |
10,279 | WebCodr/Collection | src/Collection/Habit/AttributeTrait.php | AttributeTrait.get | public function get($attribute, $arrayAsMap = true)
{
if ($this->has($attribute)) {
$value = $this->attributes[$attribute];
if ($arrayAsMap === true && is_array($value)) {
$value = new self($value);
}
return $value;
}
throw n... | php | public function get($attribute, $arrayAsMap = true)
{
if ($this->has($attribute)) {
$value = $this->attributes[$attribute];
if ($arrayAsMap === true && is_array($value)) {
$value = new self($value);
}
return $value;
}
throw n... | [
"public",
"function",
"get",
"(",
"$",
"attribute",
",",
"$",
"arrayAsMap",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"attribute",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",... | Returns value of given attribute name or throws an exception if the attribute does not exist
@param $attribute
@param bool $arrayAsMap
@return \Collection\MutableMap
@throws \OutOfBoundsException | [
"Returns",
"value",
"of",
"given",
"attribute",
"name",
"or",
"throws",
"an",
"exception",
"if",
"the",
"attribute",
"does",
"not",
"exist"
] | 2c8e0dd2c1eb217cca318bc8c62ab86a9964f20f | https://github.com/WebCodr/Collection/blob/2c8e0dd2c1eb217cca318bc8c62ab86a9964f20f/src/Collection/Habit/AttributeTrait.php#L44-L57 |
10,280 | WebCodr/Collection | src/Collection/Habit/AttributeTrait.php | AttributeTrait.delete | public function delete($value)
{
$index = $this->index($value);
if ($index !== false) {
$this->remove($index);
}
return $this;
} | php | public function delete($value)
{
$index = $this->index($value);
if ($index !== false) {
$this->remove($index);
}
return $this;
} | [
"public",
"function",
"delete",
"(",
"$",
"value",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"index",
"(",
"$",
"value",
")",
";",
"if",
"(",
"$",
"index",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"remove",
"(",
"$",
"index",
")",
";"... | Removes an attribute by value
@param $value
@return $this | [
"Removes",
"an",
"attribute",
"by",
"value"
] | 2c8e0dd2c1eb217cca318bc8c62ab86a9964f20f | https://github.com/WebCodr/Collection/blob/2c8e0dd2c1eb217cca318bc8c62ab86a9964f20f/src/Collection/Habit/AttributeTrait.php#L124-L133 |
10,281 | WebCodr/Collection | src/Collection/Habit/AttributeTrait.php | AttributeTrait.update | public function update($attributes)
{
if (!empty($attributes)) {
foreach ($attributes as $attribute => $value) {
$this->set($attribute, $value);
}
}
return $this;
} | php | public function update($attributes)
{
if (!empty($attributes)) {
foreach ($attributes as $attribute => $value) {
$this->set($attribute, $value);
}
}
return $this;
} | [
"public",
"function",
"update",
"(",
"$",
"attributes",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"attributes",
")",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"set",
"("... | Update attributes with from given array
@param array $attributes
@return \Collection\MutableMap | [
"Update",
"attributes",
"with",
"from",
"given",
"array"
] | 2c8e0dd2c1eb217cca318bc8c62ab86a9964f20f | https://github.com/WebCodr/Collection/blob/2c8e0dd2c1eb217cca318bc8c62ab86a9964f20f/src/Collection/Habit/AttributeTrait.php#L156-L165 |
10,282 | colorium/templating | src/Colorium/Templating/Sandbox.php | Sandbox.end | protected function end()
{
// stop recording block
$content = ob_get_clean();
// read record
list($name, $rewrite) = $this->record;
// rewrite
if($rewrite) {
$this->blocks += [$name => $content];
}
// render
else {
ech... | php | protected function end()
{
// stop recording block
$content = ob_get_clean();
// read record
list($name, $rewrite) = $this->record;
// rewrite
if($rewrite) {
$this->blocks += [$name => $content];
}
// render
else {
ech... | [
"protected",
"function",
"end",
"(",
")",
"{",
"// stop recording block",
"$",
"content",
"=",
"ob_get_clean",
"(",
")",
";",
"// read record",
"list",
"(",
"$",
"name",
",",
"$",
"rewrite",
")",
"=",
"$",
"this",
"->",
"record",
";",
"// rewrite",
"if",
... | Stop recording block | [
"Stop",
"recording",
"block"
] | d6c68954c6f8f776e3fcc887a4bc34d0f8d26219 | https://github.com/colorium/templating/blob/d6c68954c6f8f776e3fcc887a4bc34d0f8d26219/src/Colorium/Templating/Sandbox.php#L98-L119 |
10,283 | Archi-Strasbourg/archi-wiki | modules/opendata/lib/Convertor.php | Convertor.connect | public function connect($server,$user,$password,$database){
if(empty($this->database_info['server']) || $this->database_info['server']==''){
$this->database_info['server'] = $server;
}
if(empty($this->database_info['user']) || $this->database_info['user']==''){
$this->database_info['user'] = $user;
}
if... | php | public function connect($server,$user,$password,$database){
if(empty($this->database_info['server']) || $this->database_info['server']==''){
$this->database_info['server'] = $server;
}
if(empty($this->database_info['user']) || $this->database_info['user']==''){
$this->database_info['user'] = $user;
}
if... | [
"public",
"function",
"connect",
"(",
"$",
"server",
",",
"$",
"user",
",",
"$",
"password",
",",
"$",
"database",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"database_info",
"[",
"'server'",
"]",
")",
"||",
"$",
"this",
"->",
"database_in... | Connect to the database, using credentials
Credentiel input in constructor have priority
@param unknown $server
@param unknown $user
@param unknown $password
@param unknown $database | [
"Connect",
"to",
"the",
"database",
"using",
"credentials",
"Credentiel",
"input",
"in",
"constructor",
"have",
"priority"
] | b9fb39f43a78409890a7de96426c1f6c49d5c323 | https://github.com/Archi-Strasbourg/archi-wiki/blob/b9fb39f43a78409890a7de96426c1f6c49d5c323/modules/opendata/lib/Convertor.php#L33-L53 |
10,284 | Archi-Strasbourg/archi-wiki | modules/opendata/lib/Convertor.php | Convertor.execute | function execute($request,$silencieux=false){
if ($silencieux==false) {
$res = mysql_query($request)
or
die($request.' -- '.mysql_error().' -- <br/> Request in file : <b>'.debug_backtrace()[0]['file'].'</b><br/> on line <b>'.debug_backtrace()[0]['line']).'</b>';
}
else {
$res = mysql_query($request);
... | php | function execute($request,$silencieux=false){
if ($silencieux==false) {
$res = mysql_query($request)
or
die($request.' -- '.mysql_error().' -- <br/> Request in file : <b>'.debug_backtrace()[0]['file'].'</b><br/> on line <b>'.debug_backtrace()[0]['line']).'</b>';
}
else {
$res = mysql_query($request);
... | [
"function",
"execute",
"(",
"$",
"request",
",",
"$",
"silencieux",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"silencieux",
"==",
"false",
")",
"{",
"$",
"res",
"=",
"mysql_query",
"(",
"$",
"request",
")",
"or",
"die",
"(",
"$",
"request",
".",
"' -... | Executing the request in parameter
@param unknown $request
@param string $silencieux
@return resource | [
"Executing",
"the",
"request",
"in",
"parameter"
] | b9fb39f43a78409890a7de96426c1f6c49d5c323 | https://github.com/Archi-Strasbourg/archi-wiki/blob/b9fb39f43a78409890a7de96426c1f6c49d5c323/modules/opendata/lib/Convertor.php#L62-L72 |
10,285 | Archi-Strasbourg/archi-wiki | modules/opendata/lib/Convertor.php | Convertor.processRequest | public function processRequest($request,$rowIndex ='row'){
$requestResult = array();
$result = $this->execute($request);
$i=0;
while($row = mysql_fetch_assoc($result)){
$index = $rowIndex.$i++;
$requestResult[$index] = $row;
}
return $requestResult;
} | php | public function processRequest($request,$rowIndex ='row'){
$requestResult = array();
$result = $this->execute($request);
$i=0;
while($row = mysql_fetch_assoc($result)){
$index = $rowIndex.$i++;
$requestResult[$index] = $row;
}
return $requestResult;
} | [
"public",
"function",
"processRequest",
"(",
"$",
"request",
",",
"$",
"rowIndex",
"=",
"'row'",
")",
"{",
"$",
"requestResult",
"=",
"array",
"(",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"execute",
"(",
"$",
"request",
")",
";",
"$",
"i",
... | Execute a request and return the result as an array
@param unknown $request
@return multitype:multitype: | [
"Execute",
"a",
"request",
"and",
"return",
"the",
"result",
"as",
"an",
"array"
] | b9fb39f43a78409890a7de96426c1f6c49d5c323 | https://github.com/Archi-Strasbourg/archi-wiki/blob/b9fb39f43a78409890a7de96426c1f6c49d5c323/modules/opendata/lib/Convertor.php#L80-L89 |
10,286 | needle-project/common | src/ClassFinder.php | ClassFinder.findClasses | public function findClasses()
{
$files = $this->getFiles($this->searchPath);
// if class are not loaded they will ne be caught by "declared_classes"
$this->loadFiles($files);
return $this->identifyClasses();
} | php | public function findClasses()
{
$files = $this->getFiles($this->searchPath);
// if class are not loaded they will ne be caught by "declared_classes"
$this->loadFiles($files);
return $this->identifyClasses();
} | [
"public",
"function",
"findClasses",
"(",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"getFiles",
"(",
"$",
"this",
"->",
"searchPath",
")",
";",
"// if class are not loaded they will ne be caught by \"declared_classes\"",
"$",
"this",
"->",
"loadFiles",
"(",
... | Start searching for files
@return array | [
"Start",
"searching",
"for",
"files"
] | 07630d51a7d4ffe31e3d39e8fa3b106055290dad | https://github.com/needle-project/common/blob/07630d51a7d4ffe31e3d39e8fa3b106055290dad/src/ClassFinder.php#L61-L69 |
10,287 | needle-project/common | src/ClassFinder.php | ClassFinder.getFiles | private function getFiles($directory)
{
$fileList = [];
$files = scandir($directory);
$this->log(sprintf("Scanning dir %s, found %d files", $directory, count($files)));
foreach ($files as $index => $file) {
// recursive retrieve files in subdirectories
if (tru... | php | private function getFiles($directory)
{
$fileList = [];
$files = scandir($directory);
$this->log(sprintf("Scanning dir %s, found %d files", $directory, count($files)));
foreach ($files as $index => $file) {
// recursive retrieve files in subdirectories
if (tru... | [
"private",
"function",
"getFiles",
"(",
"$",
"directory",
")",
"{",
"$",
"fileList",
"=",
"[",
"]",
";",
"$",
"files",
"=",
"scandir",
"(",
"$",
"directory",
")",
";",
"$",
"this",
"->",
"log",
"(",
"sprintf",
"(",
"\"Scanning dir %s, found %d files\"",
... | Scan a directory and list all files that correspond to given criteria
@param string $directory
@return array | [
"Scan",
"a",
"directory",
"and",
"list",
"all",
"files",
"that",
"correspond",
"to",
"given",
"criteria"
] | 07630d51a7d4ffe31e3d39e8fa3b106055290dad | https://github.com/needle-project/common/blob/07630d51a7d4ffe31e3d39e8fa3b106055290dad/src/ClassFinder.php#L90-L114 |
10,288 | needle-project/common | src/ClassFinder.php | ClassFinder.isA | private function isA($className, $classType)
{
$types = array_merge(
class_parents($className),
class_implements($className)
);
$this->log(sprintf("Class %s is a %s", $className, implode(', ', $types)));
return in_array($classType, $types);
} | php | private function isA($className, $classType)
{
$types = array_merge(
class_parents($className),
class_implements($className)
);
$this->log(sprintf("Class %s is a %s", $className, implode(', ', $types)));
return in_array($classType, $types);
} | [
"private",
"function",
"isA",
"(",
"$",
"className",
",",
"$",
"classType",
")",
"{",
"$",
"types",
"=",
"array_merge",
"(",
"class_parents",
"(",
"$",
"className",
")",
",",
"class_implements",
"(",
"$",
"className",
")",
")",
";",
"$",
"this",
"->",
... | Identify if a class-name extends a type or implements an interface
@param string $className
@param string $classType
@return bool | [
"Identify",
"if",
"a",
"class",
"-",
"name",
"extends",
"a",
"type",
"or",
"implements",
"an",
"interface"
] | 07630d51a7d4ffe31e3d39e8fa3b106055290dad | https://github.com/needle-project/common/blob/07630d51a7d4ffe31e3d39e8fa3b106055290dad/src/ClassFinder.php#L158-L166 |
10,289 | popy-dev/popy-calendar | src/Factory/ConfigurableFactory.php | ConfigurableFactory.get | protected function get($service, array &$options)
{
if (isset($options[$service]) && is_object($options[$service])) {
return $options[$service];
}
$service = explode('_', $service);
$service = array_map('ucfirst', $service);
$service = 'get' . implode('', $servic... | php | protected function get($service, array &$options)
{
if (isset($options[$service]) && is_object($options[$service])) {
return $options[$service];
}
$service = explode('_', $service);
$service = array_map('ucfirst', $service);
$service = 'get' . implode('', $servic... | [
"protected",
"function",
"get",
"(",
"$",
"service",
",",
"array",
"&",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"$",
"service",
"]",
")",
"&&",
"is_object",
"(",
"$",
"options",
"[",
"$",
"service",
"]",
")",
")",
... | Generic service getter.
@param string $service Service name.
@param array $options Option array
@return mixed | [
"Generic",
"service",
"getter",
"."
] | 989048be18451c813cfce926229c6aaddd1b0639 | https://github.com/popy-dev/popy-calendar/blob/989048be18451c813cfce926229c6aaddd1b0639/src/Factory/ConfigurableFactory.php#L143-L154 |
10,290 | MINISTRYGmbH/morrow-core | src/Core/Base.php | Base.arrayOrderBy | public function arrayOrderBy($data, $orderby) {
// all the references are part of a workaround which only occurs with array_multisort and call_user_func_array in PHP >= 5.3
$asc = SORT_ASC;
$desc = SORT_DESC;
// the array we pass to array_multisort at the end
$params = [];
// explode the orderby to use... | php | public function arrayOrderBy($data, $orderby) {
// all the references are part of a workaround which only occurs with array_multisort and call_user_func_array in PHP >= 5.3
$asc = SORT_ASC;
$desc = SORT_DESC;
// the array we pass to array_multisort at the end
$params = [];
// explode the orderby to use... | [
"public",
"function",
"arrayOrderBy",
"(",
"$",
"data",
",",
"$",
"orderby",
")",
"{",
"// all the references are part of a workaround which only occurs with array_multisort and call_user_func_array in PHP >= 5.3",
"$",
"asc",
"=",
"SORT_ASC",
";",
"$",
"desc",
"=",
"SORT_DES... | Orders an array like in a SQL query.
Usage example:
~~~{.php}
class Dummy extends \Morrow\Core\Base {
public function sort() {
$data = [
0 => [
'title' => 'Foo',
'position' => 1,
],
1 => [
'title' => 'Bar',
'position' => 0,
],
];
return $this->arrayOrderBy($data, 'position ASC, title ASC');
}
}
~~~
@param array $d... | [
"Orders",
"an",
"array",
"like",
"in",
"a",
"SQL",
"query",
"."
] | bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e | https://github.com/MINISTRYGmbH/morrow-core/blob/bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e/src/Core/Base.php#L59-L101 |
10,291 | MINISTRYGmbH/morrow-core | src/Core/Base.php | Base.arrayGet | public function arrayGet(array &$array, $identifier = '', $fallback = null) {
if (empty($identifier)) return $array;
// create reference
$parts = explode('.', $identifier);
$returner =& $array;
foreach ($parts as $part) {
if (isset($returner[$part])) {
// if the array key is set expand the reference
... | php | public function arrayGet(array &$array, $identifier = '', $fallback = null) {
if (empty($identifier)) return $array;
// create reference
$parts = explode('.', $identifier);
$returner =& $array;
foreach ($parts as $part) {
if (isset($returner[$part])) {
// if the array key is set expand the reference
... | [
"public",
"function",
"arrayGet",
"(",
"array",
"&",
"$",
"array",
",",
"$",
"identifier",
"=",
"''",
",",
"$",
"fallback",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"identifier",
")",
")",
"return",
"$",
"array",
";",
"// create reference",... | Returns a branch or a value of a multidimensional array tree by use of the dot syntax to define subnodes.
Usage example:
~~~{.php}
class Dummy extends \Morrow\Core\Base {
public function foo() {
$data = [
0 => [
'title' => 'Foo',
'position' => 1,
],
1 => [
'title' => 'Bar',
'position' => 0,
],
];
return $this->array... | [
"Returns",
"a",
"branch",
"or",
"a",
"value",
"of",
"a",
"multidimensional",
"array",
"tree",
"by",
"use",
"of",
"the",
"dot",
"syntax",
"to",
"define",
"subnodes",
"."
] | bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e | https://github.com/MINISTRYGmbH/morrow-core/blob/bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e/src/Core/Base.php#L132-L152 |
10,292 | MINISTRYGmbH/morrow-core | src/Core/Base.php | Base.arraySet | public function arraySet(array &$array, $identifier, $value) {
// create reference
$returner =& $array;
foreach (explode('.', $identifier) as $part) {
if (!isset($returner[$part])) {
$returner[$part] = '';
}
$returner =& $returner[$part];
}
$returner = $value;
} | php | public function arraySet(array &$array, $identifier, $value) {
// create reference
$returner =& $array;
foreach (explode('.', $identifier) as $part) {
if (!isset($returner[$part])) {
$returner[$part] = '';
}
$returner =& $returner[$part];
}
$returner = $value;
} | [
"public",
"function",
"arraySet",
"(",
"array",
"&",
"$",
"array",
",",
"$",
"identifier",
",",
"$",
"value",
")",
"{",
"// create reference",
"$",
"returner",
"=",
"&",
"$",
"array",
";",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"identifier",
... | Sets a branch or a value of a multidimensional array tree by use of the dot syntax to define subnodes.
Usage example:
~~~{.php}
class Dummy extends \Morrow\Core\Base {
public function foo() {
$data = [
0 => [
'title' => 'Foo',
'position' => 1,
],
1 => [
'title' => 'Bar',
'position' => 0,
],
];
return $this->arraySet... | [
"Sets",
"a",
"branch",
"or",
"a",
"value",
"of",
"a",
"multidimensional",
"array",
"tree",
"by",
"use",
"of",
"the",
"dot",
"syntax",
"to",
"define",
"subnodes",
"."
] | bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e | https://github.com/MINISTRYGmbH/morrow-core/blob/bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e/src/Core/Base.php#L183-L195 |
10,293 | MINISTRYGmbH/morrow-core | src/Core/Base.php | Base.arrayDelete | public function arrayDelete(array &$array, $identifier) {
// create reference
$parts = explode('.', $identifier);
$returner =& $array;
$parent =& $array;
foreach ($parts as $part) {
// if the array key is set expand the reference
if (isset($returner[$part]) && !empty($part)) {
$parent =& $returner;... | php | public function arrayDelete(array &$array, $identifier) {
// create reference
$parts = explode('.', $identifier);
$returner =& $array;
$parent =& $array;
foreach ($parts as $part) {
// if the array key is set expand the reference
if (isset($returner[$part]) && !empty($part)) {
$parent =& $returner;... | [
"public",
"function",
"arrayDelete",
"(",
"array",
"&",
"$",
"array",
",",
"$",
"identifier",
")",
"{",
"// create reference",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"identifier",
")",
";",
"$",
"returner",
"=",
"&",
"$",
"array",
";",
"$"... | Deletes a branch or a key of a multidimensional array tree by use of the dot syntax to define subnodes.
Usage example:
~~~{.php}
class Dummy extends \Morrow\Core\Base {
public function foo() {
$data = [
0 => [
'title' => 'Foo',
'position' => 1,
],
1 => [
'title' => 'Bar',
'position' => 0,
],
];
return $this->arrayDe... | [
"Deletes",
"a",
"branch",
"or",
"a",
"key",
"of",
"a",
"multidimensional",
"array",
"tree",
"by",
"use",
"of",
"the",
"dot",
"syntax",
"to",
"define",
"subnodes",
"."
] | bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e | https://github.com/MINISTRYGmbH/morrow-core/blob/bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e/src/Core/Base.php#L225-L249 |
10,294 | MINISTRYGmbH/morrow-core | src/Core/Base.php | Base.arrayExplode | public function arrayExplode(array $array) {
$data = [];
// iterate keys
foreach ($array as $rkey => $row) {
$parent =& $data;
$parts = explode('.', $rkey);
// iterate key parts
foreach ($parts as $part) {
// build values
if (!isset($parent[$part]) || !is_array($parent[$part])) {
if ($p... | php | public function arrayExplode(array $array) {
$data = [];
// iterate keys
foreach ($array as $rkey => $row) {
$parent =& $data;
$parts = explode('.', $rkey);
// iterate key parts
foreach ($parts as $part) {
// build values
if (!isset($parent[$part]) || !is_array($parent[$part])) {
if ($p... | [
"public",
"function",
"arrayExplode",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"// iterate keys",
"foreach",
"(",
"$",
"array",
"as",
"$",
"rkey",
"=>",
"$",
"row",
")",
"{",
"$",
"parent",
"=",
"&",
"$",
"data",
";",
... | Explodes an array with dotted keys to a normal array.
Usage example:
~~~{.php}
class Dummy extends \Morrow\Core\Base {
public function foo() {
$data = [
'0.title' => 'Foo',
'0.position' => 1,
'1.title' => 'Bar',
'1.position' => 0,
];
return $this->arrayExplode($data);
}
}
~~~
@param array $array The input array th... | [
"Explodes",
"an",
"array",
"with",
"dotted",
"keys",
"to",
"a",
"normal",
"array",
"."
] | bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e | https://github.com/MINISTRYGmbH/morrow-core/blob/bdc916eedb14b65b06dbc88efbd2b7779f4a9a9e/src/Core/Base.php#L274-L296 |
10,295 | keboola/php-oauth | src/Keboola/OAuth/OAuthController.php | OAuthController.initSessionBag | protected function initSessionBag($reset = false)
{
if ($reset || !$this->sessionBag) {
$name = str_replace("-", "", $this->appName);
/** @var Session $session */
$session = $this->container->get('session');
$bag = new AttributeBag('_' . str_replace("-", "_", ... | php | protected function initSessionBag($reset = false)
{
if ($reset || !$this->sessionBag) {
$name = str_replace("-", "", $this->appName);
/** @var Session $session */
$session = $this->container->get('session');
$bag = new AttributeBag('_' . str_replace("-", "_", ... | [
"protected",
"function",
"initSessionBag",
"(",
"$",
"reset",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"reset",
"||",
"!",
"$",
"this",
"->",
"sessionBag",
")",
"{",
"$",
"name",
"=",
"str_replace",
"(",
"\"-\"",
",",
"\"\"",
",",
"$",
"this",
"->",
... | Init OAuth session bag
@param bool $reset
@return AttributeBag | [
"Init",
"OAuth",
"session",
"bag"
] | 6c62e85133adc0d8207aa79a36f281a78dbaa607 | https://github.com/keboola/php-oauth/blob/6c62e85133adc0d8207aa79a36f281a78dbaa607/src/Keboola/OAuth/OAuthController.php#L148-L162 |
10,296 | keboola/php-oauth | src/Keboola/OAuth/OAuthController.php | OAuthController.getCallbackUrl | protected function getCallbackUrl(Request $request)
{
$selfUrl = $this->getSelfUrl($request);
if (substr($selfUrl, -9) == "-callback") {
return $selfUrl;
} else {
return $selfUrl . "-callback";
}
} | php | protected function getCallbackUrl(Request $request)
{
$selfUrl = $this->getSelfUrl($request);
if (substr($selfUrl, -9) == "-callback") {
return $selfUrl;
} else {
return $selfUrl . "-callback";
}
} | [
"protected",
"function",
"getCallbackUrl",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"selfUrl",
"=",
"$",
"this",
"->",
"getSelfUrl",
"(",
"$",
"request",
")",
";",
"if",
"(",
"substr",
"(",
"$",
"selfUrl",
",",
"-",
"9",
")",
"==",
"\"-callback\"... | Get the callback URL
@param Request $request
@return string | [
"Get",
"the",
"callback",
"URL"
] | 6c62e85133adc0d8207aa79a36f281a78dbaa607 | https://github.com/keboola/php-oauth/blob/6c62e85133adc0d8207aa79a36f281a78dbaa607/src/Keboola/OAuth/OAuthController.php#L202-L210 |
10,297 | keboola/php-oauth | src/Keboola/OAuth/OAuthController.php | OAuthController.getParam | protected function getParam($name, $required = false)
{
if (!$this->container->hasParameter($name)) {
if ($required) {
throw new SyrupComponentException(500, "Parameter '{$name}' not set in parameters.yml");
} else {
return null;
}
... | php | protected function getParam($name, $required = false)
{
if (!$this->container->hasParameter($name)) {
if ($required) {
throw new SyrupComponentException(500, "Parameter '{$name}' not set in parameters.yml");
} else {
return null;
}
... | [
"protected",
"function",
"getParam",
"(",
"$",
"name",
",",
"$",
"required",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"container",
"->",
"hasParameter",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"$",
"required",
")",
"{",
"throw... | Get an attribute from parameters.yml
@param $name Name of the attribute
@param $required (bool) Whether the attribute is mandatory (false by default)
@return mixed | [
"Get",
"an",
"attribute",
"from",
"parameters",
".",
"yml"
] | 6c62e85133adc0d8207aa79a36f281a78dbaa607 | https://github.com/keboola/php-oauth/blob/6c62e85133adc0d8207aa79a36f281a78dbaa607/src/Keboola/OAuth/OAuthController.php#L219-L230 |
10,298 | keboola/php-oauth | src/Keboola/OAuth/OAuthController.php | OAuthController.externalAuthAction | public function externalAuthAction(Request $request)
{
$this->checkParams($request->query);
foreach($request->query->all() as $k => $v) {
$request->request->set($k, $v);
}
return $this->getOAuthAction($request);
} | php | public function externalAuthAction(Request $request)
{
$this->checkParams($request->query);
foreach($request->query->all() as $k => $v) {
$request->request->set($k, $v);
}
return $this->getOAuthAction($request);
} | [
"public",
"function",
"externalAuthAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"checkParams",
"(",
"$",
"request",
"->",
"query",
")",
";",
"foreach",
"(",
"$",
"request",
"->",
"query",
"->",
"all",
"(",
")",
"as",
"$",
"k",
... | Handle a GET request with token&config parameters in URL
@param Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"Handle",
"a",
"GET",
"request",
"with",
"token&config",
"parameters",
"in",
"URL"
] | 6c62e85133adc0d8207aa79a36f281a78dbaa607 | https://github.com/keboola/php-oauth/blob/6c62e85133adc0d8207aa79a36f281a78dbaa607/src/Keboola/OAuth/OAuthController.php#L237-L246 |
10,299 | keboola/php-oauth | src/Keboola/OAuth/OAuthController.php | OAuthController.returnResult | protected function returnResult($data, $status = "ok")
{
$referrer = $this->sessionBag->get("referrer");
if (!empty($referrer)) {
return $this->redirect($referrer);
} else {
return new Response(jsonDecode(array_replace(array("status" => $status), (array) $data)), 200,... | php | protected function returnResult($data, $status = "ok")
{
$referrer = $this->sessionBag->get("referrer");
if (!empty($referrer)) {
return $this->redirect($referrer);
} else {
return new Response(jsonDecode(array_replace(array("status" => $status), (array) $data)), 200,... | [
"protected",
"function",
"returnResult",
"(",
"$",
"data",
",",
"$",
"status",
"=",
"\"ok\"",
")",
"{",
"$",
"referrer",
"=",
"$",
"this",
"->",
"sessionBag",
"->",
"get",
"(",
"\"referrer\"",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"referrer",
... | Return Decide whether to return a redirect to "referrer" or a JSON encoded response
@param array|stdClass $data Data to be returned in the JSON
@param string $status A status to be included in the result.
If the response contains a "status" key, it will replace the status
@return \Symfony\Component\HttpFoundation\Respo... | [
"Return",
"Decide",
"whether",
"to",
"return",
"a",
"redirect",
"to",
"referrer",
"or",
"a",
"JSON",
"encoded",
"response"
] | 6c62e85133adc0d8207aa79a36f281a78dbaa607 | https://github.com/keboola/php-oauth/blob/6c62e85133adc0d8207aa79a36f281a78dbaa607/src/Keboola/OAuth/OAuthController.php#L268-L276 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.