repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
VincentChalnot/SidusAdminBundle | Controller/AbstractAdminController.php | AbstractAdminController.getTemplate | protected function getTemplate(Action $action = null, $templateType = 'html')
{
return $this->container->get(TemplateResolverInterface::class)->getTemplate(
$action ?: $this->admin->getCurrentAction(),
$templateType
);
} | php | protected function getTemplate(Action $action = null, $templateType = 'html')
{
return $this->container->get(TemplateResolverInterface::class)->getTemplate(
$action ?: $this->admin->getCurrentAction(),
$templateType
);
} | [
"protected",
"function",
"getTemplate",
"(",
"Action",
"$",
"action",
"=",
"null",
",",
"$",
"templateType",
"=",
"'html'",
")",
"{",
"return",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"TemplateResolverInterface",
"::",
"class",
")",
"->",
"getTempl... | @param Action $action
@param string $templateType
@throws \Exception
@return \Twig_Template | [
"@param",
"Action",
"$action",
"@param",
"string",
"$templateType"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L214-L220 |
VincentChalnot/SidusAdminBundle | Controller/AbstractAdminController.php | AbstractAdminController.renderAction | protected function renderAction(array $parameters = [], Action $action = null)
{
$response = new Response();
$response->setContent($this->getTemplate($action)->render($parameters));
return $response;
} | php | protected function renderAction(array $parameters = [], Action $action = null)
{
$response = new Response();
$response->setContent($this->getTemplate($action)->render($parameters));
return $response;
} | [
"protected",
"function",
"renderAction",
"(",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"Action",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"new",
"Response",
"(",
")",
";",
"$",
"response",
"->",
"setContent",
"(",
"$",
"this",... | @param array $parameters
@param Action|null $action
@throws \UnexpectedValueException
@throws \InvalidArgumentException
@return Response | [
"@param",
"array",
"$parameters",
"@param",
"Action|null",
"$action"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L232-L238 |
VincentChalnot/SidusAdminBundle | Controller/AbstractAdminController.php | AbstractAdminController.getDataFromRequest | protected function getDataFromRequest(Request $request, $configuration = null)
{
if (null === $configuration) {
$configuration = [
new ParamConverter(
[
'name' => 'data',
'class' => $this->admin->getEntity(),
... | php | protected function getDataFromRequest(Request $request, $configuration = null)
{
if (null === $configuration) {
$configuration = [
new ParamConverter(
[
'name' => 'data',
'class' => $this->admin->getEntity(),
... | [
"protected",
"function",
"getDataFromRequest",
"(",
"Request",
"$",
"request",
",",
"$",
"configuration",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"configuration",
")",
"{",
"$",
"configuration",
"=",
"[",
"new",
"ParamConverter",
"(",
"[",
"'... | @param Request $request
@param array|ParamConverterInterface $configuration
@throws \Exception
@return mixed | [
"@param",
"Request",
"$request",
"@param",
"array|ParamConverterInterface",
"$configuration"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L248-L263 |
VincentChalnot/SidusAdminBundle | Controller/AbstractAdminController.php | AbstractAdminController.redirectToEntity | protected function redirectToEntity(
$entity,
$action,
array $parameters = [],
$referenceType = UrlGeneratorInterface::ABSOLUTE_PATH,
$status = 302
) {
$url = $this->container->get(AdminRouter::class)
->generateAdminEntityPath($this->admin, $entity, $actio... | php | protected function redirectToEntity(
$entity,
$action,
array $parameters = [],
$referenceType = UrlGeneratorInterface::ABSOLUTE_PATH,
$status = 302
) {
$url = $this->container->get(AdminRouter::class)
->generateAdminEntityPath($this->admin, $entity, $actio... | [
"protected",
"function",
"redirectToEntity",
"(",
"$",
"entity",
",",
"$",
"action",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"referenceType",
"=",
"UrlGeneratorInterface",
"::",
"ABSOLUTE_PATH",
",",
"$",
"status",
"=",
"302",
")",
"{",
"... | @param mixed $entity
@param string $action
@param array $parameters
@param int $referenceType
@param int $status
@throws \Exception
@return RedirectResponse | [
"@param",
"mixed",
"$entity",
"@param",
"string",
"$action",
"@param",
"array",
"$parameters",
"@param",
"int",
"$referenceType",
"@param",
"int",
"$status"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L276-L287 |
VincentChalnot/SidusAdminBundle | Controller/AbstractAdminController.php | AbstractAdminController.redirectToAction | protected function redirectToAction(
$action,
array $parameters = [],
$referenceType = UrlGeneratorInterface::ABSOLUTE_PATH,
$status = 302
) {
$url = $this->container->get(AdminRouter::class)
->generateAdminPath($this->admin, $action, $parameters, $referenceType);... | php | protected function redirectToAction(
$action,
array $parameters = [],
$referenceType = UrlGeneratorInterface::ABSOLUTE_PATH,
$status = 302
) {
$url = $this->container->get(AdminRouter::class)
->generateAdminPath($this->admin, $action, $parameters, $referenceType);... | [
"protected",
"function",
"redirectToAction",
"(",
"$",
"action",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"referenceType",
"=",
"UrlGeneratorInterface",
"::",
"ABSOLUTE_PATH",
",",
"$",
"status",
"=",
"302",
")",
"{",
"$",
"url",
"=",
"$",... | @param string $action
@param array $parameters
@param int $referenceType
@param int $status
@throws \Exception
@return RedirectResponse | [
"@param",
"string",
"$action",
"@param",
"array",
"$parameters",
"@param",
"int",
"$referenceType",
"@param",
"int",
"$status"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L299-L309 |
VincentChalnot/SidusAdminBundle | Controller/AbstractAdminController.php | AbstractAdminController.getCurrentUri | protected function getCurrentUri(Request $request, array $parameters = [])
{
$params = $request->attributes->get('_route_params');
return $this->generateUrl($request->attributes->get('_route'), array_merge($params, $parameters));
} | php | protected function getCurrentUri(Request $request, array $parameters = [])
{
$params = $request->attributes->get('_route_params');
return $this->generateUrl($request->attributes->get('_route'), array_merge($params, $parameters));
} | [
"protected",
"function",
"getCurrentUri",
"(",
"Request",
"$",
"request",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"$",
"request",
"->",
"attributes",
"->",
"get",
"(",
"'_route_params'",
")",
";",
"return",
"$",
"thi... | @param Request $request
@param array $parameters
@throws \InvalidArgumentException
@return string | [
"@param",
"Request",
"$request",
"@param",
"array",
"$parameters"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L319-L324 |
phpmob/changmin | src/PhpMob/CoreBundle/Fixture/UserGroupFactory.php | UserGroupFactory.create | public function create(array $options = [])
{
$options = $this->optionsResolver->resolve($options);
/** @var UserGroupInterface $group */
$group = $this->userGroupFactory->createNew();
$group->setCode($options['code']);
$group->setName($options['name']);
return $gro... | php | public function create(array $options = [])
{
$options = $this->optionsResolver->resolve($options);
/** @var UserGroupInterface $group */
$group = $this->userGroupFactory->createNew();
$group->setCode($options['code']);
$group->setName($options['name']);
return $gro... | [
"public",
"function",
"create",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"optionsResolver",
"->",
"resolve",
"(",
"$",
"options",
")",
";",
"/** @var UserGroupInterface $group */",
"$",
"group",
"=",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/Fixture/UserGroupFactory.php#L47-L57 |
phpmob/changmin | src/PhpMob/CoreBundle/Fixture/UserGroupFactory.php | UserGroupFactory.configureOptions | protected function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('code', function (Options $options) {
return $this->faker->word;
})
->setDefault('name', function (Options $options) {
return $this->faker->word;
... | php | protected function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('code', function (Options $options) {
return $this->faker->word;
})
->setDefault('name', function (Options $options) {
return $this->faker->word;
... | [
"protected",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setDefault",
"(",
"'code'",
",",
"function",
"(",
"Options",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"faker",
"->",
"word",... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/Fixture/UserGroupFactory.php#L62-L72 |
abbert/datagrid | src/Datagrid.php | Datagrid.renderJson | public function renderJson()
{
$totalCount = $this->getDatasource()->totalCount();
$rows = $this->getDatasource()->listRows();
$tmpData = [];
foreach ($rows as $row) {
$tmp = [];
$this->currentRow = new DefaultRow();
if ($this->rowCallback instan... | php | public function renderJson()
{
$totalCount = $this->getDatasource()->totalCount();
$rows = $this->getDatasource()->listRows();
$tmpData = [];
foreach ($rows as $row) {
$tmp = [];
$this->currentRow = new DefaultRow();
if ($this->rowCallback instan... | [
"public",
"function",
"renderJson",
"(",
")",
"{",
"$",
"totalCount",
"=",
"$",
"this",
"->",
"getDatasource",
"(",
")",
"->",
"totalCount",
"(",
")",
";",
"$",
"rows",
"=",
"$",
"this",
"->",
"getDatasource",
"(",
")",
"->",
"listRows",
"(",
")",
";... | Send immediately | [
"Send",
"immediately"
] | train | https://github.com/abbert/datagrid/blob/fff9ee02f9f41c734f926c9d4834a251b891a6e1/src/Datagrid.php#L197-L228 |
lode/fem | src/resources.php | resources.get_timestamped_url | private static function get_timestamped_url($file, $type) {
$search = ['{{root_dir}}', '{{type}}'];
$replace = [self::$root_dir, $type];
$base_path = str_replace($search, $replace, self::$base_path);
$base_url = str_replace($search, $replace, self::$base_url);
$file = trim($file);
$absolute = ($file[0] ... | php | private static function get_timestamped_url($file, $type) {
$search = ['{{root_dir}}', '{{type}}'];
$replace = [self::$root_dir, $type];
$base_path = str_replace($search, $replace, self::$base_path);
$base_url = str_replace($search, $replace, self::$base_url);
$file = trim($file);
$absolute = ($file[0] ... | [
"private",
"static",
"function",
"get_timestamped_url",
"(",
"$",
"file",
",",
"$",
"type",
")",
"{",
"$",
"search",
"=",
"[",
"'{{root_dir}}'",
",",
"'{{type}}'",
"]",
";",
"$",
"replace",
"=",
"[",
"self",
"::",
"$",
"root_dir",
",",
"$",
"type",
"]"... | adds a modification timestamp to a file path
@param string $file relative path from css/ or js/, excluding the extension
or absolute from the docroot when starting with a '/'
absolute is handy for loading css from a js plugin directory
i.e.: 'foo/bar' will become '/frontend/css/foo/bar.1234567890.cs... | [
"adds",
"a",
"modification",
"timestamp",
"to",
"a",
"file",
"path"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/resources.php#L34-L54 |
openclerk/emails | src/Email.php | Email.send | static function send($to_or_user, $template_id, $arguments = array()) {
// add any global arguments
foreach (static::$global_arguments as $name => $callback) {
if (!isset($arguments[$name])) {
$arguments[$name] = call_user_func($callback, $arguments);
}
}
$to_name = false;
$to_i... | php | static function send($to_or_user, $template_id, $arguments = array()) {
// add any global arguments
foreach (static::$global_arguments as $name => $callback) {
if (!isset($arguments[$name])) {
$arguments[$name] = call_user_func($callback, $arguments);
}
}
$to_name = false;
$to_i... | [
"static",
"function",
"send",
"(",
"$",
"to_or_user",
",",
"$",
"template_id",
",",
"$",
"arguments",
"=",
"array",
"(",
")",
")",
"{",
"// add any global arguments",
"foreach",
"(",
"static",
"::",
"$",
"global_arguments",
"as",
"$",
"name",
"=>",
"$",
"c... | Send an email with the given template to the given user or address.
The subject of the e-mail is obtained from the first line of the text e-mail template, or the
<title> of the HTML template.
TODO support mock mailing
TODO support i18n
TODO service wrapper to allow emails to be queued
@param $to_or_user either an ema... | [
"Send",
"an",
"email",
"with",
"the",
"given",
"template",
"to",
"the",
"given",
"user",
"or",
"address",
".",
"The",
"subject",
"of",
"the",
"e",
"-",
"mail",
"is",
"obtained",
"from",
"the",
"first",
"line",
"of",
"the",
"text",
"e",
"-",
"mail",
"... | train | https://github.com/openclerk/emails/blob/b145e5f1f85524e84a37784e86d6beeac66999d2/src/Email.php#L31-L92 |
openclerk/emails | src/Email.php | Email.phpmailer | static function phpmailer($to, $to_name, $subject, $message, $html_message = false) {
$mail = new \PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = \Openclerk\Config::get('phpmailer_host'); // specify main and backup server
$mail->SMTPAuth = tr... | php | static function phpmailer($to, $to_name, $subject, $message, $html_message = false) {
$mail = new \PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = \Openclerk\Config::get('phpmailer_host'); // specify main and backup server
$mail->SMTPAuth = tr... | [
"static",
"function",
"phpmailer",
"(",
"$",
"to",
",",
"$",
"to_name",
",",
"$",
"subject",
",",
"$",
"message",
",",
"$",
"html_message",
"=",
"false",
")",
"{",
"$",
"mail",
"=",
"new",
"\\",
"PHPMailer",
"(",
")",
";",
"$",
"mail",
"->",
"IsSMT... | TODO support HTML emails
@return the sent message ID
@throws MailerException if the mail could not be immediately sent | [
"TODO",
"support",
"HTML",
"emails"
] | train | https://github.com/openclerk/emails/blob/b145e5f1f85524e84a37784e86d6beeac66999d2/src/Email.php#L180-L215 |
tableau-mkt/eggs-n-cereal | src/Utils/ConverterToHTML.php | ConverterToHTML.toHTML | public function toHTML($pretty_print = TRUE) {
$this->out = new \DOMDocument('1.0', 'UTF-8');
$this->out->formatOutput = $pretty_print;
$field = $this->doc->getElementsByTagName('xlf:group')->item(0);
foreach ($field->childNodes as $child) {
if ($output = $this->convert($child)) {
$this-... | php | public function toHTML($pretty_print = TRUE) {
$this->out = new \DOMDocument('1.0', 'UTF-8');
$this->out->formatOutput = $pretty_print;
$field = $this->doc->getElementsByTagName('xlf:group')->item(0);
foreach ($field->childNodes as $child) {
if ($output = $this->convert($child)) {
$this-... | [
"public",
"function",
"toHTML",
"(",
"$",
"pretty_print",
"=",
"TRUE",
")",
"{",
"$",
"this",
"->",
"out",
"=",
"new",
"\\",
"DOMDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
"$",
"this",
"->",
"out",
"->",
"formatOutput",
"=",
"$",
"pretty_print"... | Converts XML to the corresponding HTML representation.
@return string
The source XML converted to HTML. | [
"Converts",
"XML",
"to",
"the",
"corresponding",
"HTML",
"representation",
"."
] | train | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Utils/ConverterToHTML.php#L36-L49 |
VincentChalnot/SidusAdminBundle | Admin/Admin.php | Admin.getAction | public function getAction(string $code): Action
{
if (!$this->hasAction($code)) {
throw new \UnexpectedValueException("No action with code: '{$code}' for admin '{$this->getCode()}'");
}
return $this->actions[$code];
} | php | public function getAction(string $code): Action
{
if (!$this->hasAction($code)) {
throw new \UnexpectedValueException("No action with code: '{$code}' for admin '{$this->getCode()}'");
}
return $this->actions[$code];
} | [
"public",
"function",
"getAction",
"(",
"string",
"$",
"code",
")",
":",
"Action",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAction",
"(",
"$",
"code",
")",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueException",
"(",
"\"No action with code: '{$code}' ... | @param string $code
@throws \UnexpectedValueException
@return Action | [
"@param",
"string",
"$code"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Admin/Admin.php#L134-L141 |
VincentChalnot/SidusAdminBundle | Admin/Admin.php | Admin.hasRoute | public function hasRoute(string $route): bool
{
foreach ($this->getActions() as $action) {
if ($action->getRouteName() === $route) {
return true;
}
}
return false;
} | php | public function hasRoute(string $route): bool
{
foreach ($this->getActions() as $action) {
if ($action->getRouteName() === $route) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasRoute",
"(",
"string",
"$",
"route",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getActions",
"(",
")",
"as",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"action",
"->",
"getRouteName",
"(",
")",
"===",
"$",
"r... | @param string $route
@return bool | [
"@param",
"string",
"$route"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Admin/Admin.php#L158-L167 |
VincentChalnot/SidusAdminBundle | Admin/Admin.php | Admin.getOption | public function getOption(string $option, $default = null)
{
if (!$this->hasOption($option)) {
return $default;
}
return $this->options[$option];
} | php | public function getOption(string $option, $default = null)
{
if (!$this->hasOption($option)) {
return $default;
}
return $this->options[$option];
} | [
"public",
"function",
"getOption",
"(",
"string",
"$",
"option",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasOption",
"(",
"$",
"option",
")",
")",
"{",
"return",
"$",
"default",
";",
"}",
"return",
"$",
"this... | @param string $option
@param mixed $default
@return mixed | [
"@param",
"string",
"$option",
"@param",
"mixed",
"$default"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Admin/Admin.php#L199-L206 |
VincentChalnot/SidusAdminBundle | Admin/Admin.php | Admin.setCurrentAction | public function setCurrentAction($action): void
{
if (!$action instanceof Action) {
$action = $this->getAction($action);
}
$this->currentAction = $action;
} | php | public function setCurrentAction($action): void
{
if (!$action instanceof Action) {
$action = $this->getAction($action);
}
$this->currentAction = $action;
} | [
"public",
"function",
"setCurrentAction",
"(",
"$",
"action",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"action",
"instanceof",
"Action",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"getAction",
"(",
"$",
"action",
")",
";",
"}",
"$",
"this",
... | @param string|Action $action
@throws \UnexpectedValueException | [
"@param",
"string|Action",
"$action"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Admin/Admin.php#L239-L245 |
ClanCats/Core | src/classes/CCDataObject.php | CCDataObject.set | public function set( $key, $value, $param = null )
{
CCArr::set( $key, $value, $this->_data );
} | php | public function set( $key, $value, $param = null )
{
CCArr::set( $key, $value, $this->_data );
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"param",
"=",
"null",
")",
"{",
"CCArr",
"::",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"this",
"->",
"_data",
")",
";",
"}"
] | set data to the object.
@param string $key
@param mixed $value
@param mixed $param
@return void | [
"set",
"data",
"to",
"the",
"object",
"."
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCDataObject.php#L43-L46 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Processor.php | Processor.synchronizeCollectionNormal | public function synchronizeCollectionNormal($entity, $field, $toCollection, Type $type) {
if (!$this->dc) {
throw new \RuntimeException('DCPackage muss für synchronizeCollectionNormal gesetzt sein');
}
$entityMeta = $this->dc->getEntityMeta($entity->getEntityName());
$entityClassMeta = $entit... | php | public function synchronizeCollectionNormal($entity, $field, $toCollection, Type $type) {
if (!$this->dc) {
throw new \RuntimeException('DCPackage muss für synchronizeCollectionNormal gesetzt sein');
}
$entityMeta = $this->dc->getEntityMeta($entity->getEntityName());
$entityClassMeta = $entit... | [
"public",
"function",
"synchronizeCollectionNormal",
"(",
"$",
"entity",
",",
"$",
"field",
",",
"$",
"toCollection",
",",
"Type",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"dc",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
... | Synchronisiert Collections in einem Property des Entities
Initialisiert einen CollectionSynchronizer, um das $entity->$field vom $type zu $toCollection zu synchronisieren | [
"Synchronisiert",
"Collections",
"in",
"einem",
"Property",
"des",
"Entities"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Processor.php#L118-L168 |
webforge-labs/psc-cms | lib/Psc/Doctrine/Processor.php | Processor.synchronizeCollection | public function synchronizeCollection($associationName, $newCollection) {
if (!is_string($associationName)) {
throw new \Psc\Exception('string erwartet: '.Code::varInfo($associationName));
}
/*
$mapping = $coll->getMapping();
$targetClass = $this->_em->getClassMetadata($mappin... | php | public function synchronizeCollection($associationName, $newCollection) {
if (!is_string($associationName)) {
throw new \Psc\Exception('string erwartet: '.Code::varInfo($associationName));
}
/*
$mapping = $coll->getMapping();
$targetClass = $this->_em->getClassMetadata($mappin... | [
"public",
"function",
"synchronizeCollection",
"(",
"$",
"associationName",
",",
"$",
"newCollection",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"associationName",
")",
")",
"{",
"throw",
"new",
"\\",
"Psc",
"\\",
"Exception",
"(",
"'string erwartet: '"... | Synchronisiert eine Collection eines Entities mit Entities in der Datenbank (deprecated)
Diese Art der Synchroniserung ist deprecated, weil es mittlerweile ausgelagerte Funktionen dafür gibt
(siehe Psc\Doctrine\*Synchro*)
also es werden für die bestehenden Objekte in $entity->$collectionProperty die objekte gelöscht
... | [
"Synchronisiert",
"eine",
"Collection",
"eines",
"Entities",
"mit",
"Entities",
"in",
"der",
"Datenbank",
"(",
"deprecated",
")"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/Processor.php#L233-L320 |
Chill-project/Main | Timeline/TimelineBuilder.php | TimelineBuilder.getTimelineHTML | public function getTimelineHTML($context, array $args, $page = 0, $number = 20)
{
$query = $this->buildUnionQuery($context, $args, $page, $number);
$fetched = $this->runQuery($query);
$entitiesByKey = $this->getEntities($fetched, $context);
return $this->render($fetched, $en... | php | public function getTimelineHTML($context, array $args, $page = 0, $number = 20)
{
$query = $this->buildUnionQuery($context, $args, $page, $number);
$fetched = $this->runQuery($query);
$entitiesByKey = $this->getEntities($fetched, $context);
return $this->render($fetched, $en... | [
"public",
"function",
"getTimelineHTML",
"(",
"$",
"context",
",",
"array",
"$",
"args",
",",
"$",
"page",
"=",
"0",
",",
"$",
"number",
"=",
"20",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"buildUnionQuery",
"(",
"$",
"context",
",",
"$",
"a... | return an HTML string with timeline
This function must be called from controller
@example https://redmine.champs-libres.coop/projects/chillperson/repository/revisions/bd2e1b1808f73e39532e9538413025df5487cad0/entry/Controller/TimelinePersonController.php#L47 the implementation in person bundle
@param string $context
... | [
"return",
"an",
"HTML",
"string",
"with",
"timeline"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Timeline/TimelineBuilder.php#L66-L73 |
Chill-project/Main | Timeline/TimelineBuilder.php | TimelineBuilder.getProvidersByContext | public function getProvidersByContext($context)
{
$providers = array();
foreach($this->providers[$context] as $providerId) {
$providers[] = $this->container->get($providerId);
}
return $providers;
} | php | public function getProvidersByContext($context)
{
$providers = array();
foreach($this->providers[$context] as $providerId) {
$providers[] = $this->container->get($providerId);
}
return $providers;
} | [
"public",
"function",
"getProvidersByContext",
"(",
"$",
"context",
")",
"{",
"$",
"providers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"providers",
"[",
"$",
"context",
"]",
"as",
"$",
"providerId",
")",
"{",
"$",
"providers",
... | Get providers by context
@param string $context
@return TimelineProviderInterface[] | [
"Get",
"providers",
"by",
"context"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Timeline/TimelineBuilder.php#L94-L103 |
Chill-project/Main | Timeline/TimelineBuilder.php | TimelineBuilder.buildUnionQuery | private function buildUnionQuery($context, array $args, $page, $number)
{
//throw an exception if no provider have been defined for this context
if (!array_key_exists($context, $this->providers)) {
throw new \LogicException(sprintf('No builders have been defined for "%s"'
... | php | private function buildUnionQuery($context, array $args, $page, $number)
{
//throw an exception if no provider have been defined for this context
if (!array_key_exists($context, $this->providers)) {
throw new \LogicException(sprintf('No builders have been defined for "%s"'
... | [
"private",
"function",
"buildUnionQuery",
"(",
"$",
"context",
",",
"array",
"$",
"args",
",",
"$",
"page",
",",
"$",
"number",
")",
"{",
"//throw an exception if no provider have been defined for this context",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"context... | build the UNION query with all providers
@uses self::buildSelectQuery to build individual SELECT queries
@param string $context
@param mixed $args
@param int $page
@param int $number
@return string
@throws \LogicException if no builder have been defined for this context | [
"build",
"the",
"UNION",
"query",
"with",
"all",
"providers"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Timeline/TimelineBuilder.php#L117-L137 |
Chill-project/Main | Timeline/TimelineBuilder.php | TimelineBuilder.buildSelectQuery | private function buildSelectQuery(TimelineProviderInterface $provider, $context, array $args)
{
$data = $provider->fetchQuery($context, $args);
return sprintf(
'SELECT %s AS id, '
. '%s AS "date", '
. "'%s' AS type "
. 'FROM %s... | php | private function buildSelectQuery(TimelineProviderInterface $provider, $context, array $args)
{
$data = $provider->fetchQuery($context, $args);
return sprintf(
'SELECT %s AS id, '
. '%s AS "date", '
. "'%s' AS type "
. 'FROM %s... | [
"private",
"function",
"buildSelectQuery",
"(",
"TimelineProviderInterface",
"$",
"provider",
",",
"$",
"context",
",",
"array",
"$",
"args",
")",
"{",
"$",
"data",
"=",
"$",
"provider",
"->",
"fetchQuery",
"(",
"$",
"context",
",",
"$",
"args",
")",
";",
... | return the SQL SELECT query as a string,
@uses TimelineProfiderInterface::fetchQuery use the fetchQuery function
@param \Chill\MainBundle\Timeline\TimelineProviderInterface $provider
@param string $context
@param mixed[] $args
@return string | [
"return",
"the",
"SQL",
"SELECT",
"query",
"as",
"a",
"string"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Timeline/TimelineBuilder.php#L148-L163 |
Chill-project/Main | Timeline/TimelineBuilder.php | TimelineBuilder.runQuery | private function runQuery($query)
{
$resultSetMapping = (new ResultSetMapping())
->addScalarResult('id', 'id')
->addScalarResult('type', 'type')
->addScalarResult('date', 'date');
return $this->em->createNativeQuery($query, $resultSetMapping)
... | php | private function runQuery($query)
{
$resultSetMapping = (new ResultSetMapping())
->addScalarResult('id', 'id')
->addScalarResult('type', 'type')
->addScalarResult('date', 'date');
return $this->em->createNativeQuery($query, $resultSetMapping)
... | [
"private",
"function",
"runQuery",
"(",
"$",
"query",
")",
"{",
"$",
"resultSetMapping",
"=",
"(",
"new",
"ResultSetMapping",
"(",
")",
")",
"->",
"addScalarResult",
"(",
"'id'",
",",
"'id'",
")",
"->",
"addScalarResult",
"(",
"'type'",
",",
"'type'",
")",... | run the UNION query and return result as an array
@param string $query
@return array | [
"run",
"the",
"UNION",
"query",
"and",
"return",
"result",
"as",
"an",
"array"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Timeline/TimelineBuilder.php#L171-L180 |
Chill-project/Main | Timeline/TimelineBuilder.php | TimelineBuilder.render | private function render(array $fetched, array $entitiesByType, $context, array $args)
{
//add results to a pretty array
$timelineEntries = array();
foreach ($fetched as $result) {
$data = $this->getTemplateData(
$result['type'],
$entitiesB... | php | private function render(array $fetched, array $entitiesByType, $context, array $args)
{
//add results to a pretty array
$timelineEntries = array();
foreach ($fetched as $result) {
$data = $this->getTemplateData(
$result['type'],
$entitiesB... | [
"private",
"function",
"render",
"(",
"array",
"$",
"fetched",
",",
"array",
"$",
"entitiesByType",
",",
"$",
"context",
",",
"array",
"$",
"args",
")",
"{",
"//add results to a pretty array",
"$",
"timelineEntries",
"=",
"array",
"(",
")",
";",
"foreach",
"... | render the timeline as HTML
@param array $fetched
@param array $entitiesByType
@param string $context
@param mixed[] $args
@return string the HTML representation of the timeline | [
"render",
"the",
"timeline",
"as",
"HTML"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Timeline/TimelineBuilder.php#L221-L243 |
Chill-project/Main | Timeline/TimelineBuilder.php | TimelineBuilder.getTemplateData | private function getTemplateData($type, $entity, $context, array $args)
{
foreach($this->getProvidersByContext($context) as $provider) {
if ($provider->supportsType($type)) {
return $provider->getEntityTemplate($entity, $context, $args);
}
}
} | php | private function getTemplateData($type, $entity, $context, array $args)
{
foreach($this->getProvidersByContext($context) as $provider) {
if ($provider->supportsType($type)) {
return $provider->getEntityTemplate($entity, $context, $args);
}
}
} | [
"private",
"function",
"getTemplateData",
"(",
"$",
"type",
",",
"$",
"entity",
",",
"$",
"context",
",",
"array",
"$",
"args",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getProvidersByContext",
"(",
"$",
"context",
")",
"as",
"$",
"provider",
")",
... | get the template data from the provider for the given entity, by type.
@param string $type
@param mixed $entity
@param string $context
@param mixed[] $args
@return array the template data fetched from the provider | [
"get",
"the",
"template",
"data",
"from",
"the",
"provider",
"for",
"the",
"given",
"entity",
"by",
"type",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Timeline/TimelineBuilder.php#L254-L261 |
flipboxstudio/orm-manager | src/Flipbox/OrmManager/Consoles/FontColor.php | FontColor.paintString | public function paintString($string, $foregroundColor = null, $backgroundCcolor = null, $option=null)
{
$coloredString = "";
if (isset($this->foregroundColors[$foregroundColor])) {
$coloredString .= "\033[".$this->foregroundColors[$foregroundColor]."m";
}
if (isset($thi... | php | public function paintString($string, $foregroundColor = null, $backgroundCcolor = null, $option=null)
{
$coloredString = "";
if (isset($this->foregroundColors[$foregroundColor])) {
$coloredString .= "\033[".$this->foregroundColors[$foregroundColor]."m";
}
if (isset($thi... | [
"public",
"function",
"paintString",
"(",
"$",
"string",
",",
"$",
"foregroundColor",
"=",
"null",
",",
"$",
"backgroundCcolor",
"=",
"null",
",",
"$",
"option",
"=",
"null",
")",
"{",
"$",
"coloredString",
"=",
"\"\"",
";",
"if",
"(",
"isset",
"(",
"$... | paint string
@param string $string
@param mixed $foregroundColor
@param mixed $backgroundCcolor
@return string | [
"paint",
"string"
] | train | https://github.com/flipboxstudio/orm-manager/blob/4288426517f53d05177b8729c4ba94c5beca9a98/src/Flipbox/OrmManager/Consoles/FontColor.php#L55-L72 |
spiral-modules/auth | source/Auth/Authenticators/CredentialsAuthenticator.php | CredentialsAuthenticator.getUser | public function getUser(string $username, string $password): PasswordAwareInterface
{
$user = $this->source->findByUsername($username);
if (empty($user)) {
throw new CredentialsException("Unable to authorize, no such user");
}
if (!$user instanceof PasswordAwareInterface... | php | public function getUser(string $username, string $password): PasswordAwareInterface
{
$user = $this->source->findByUsername($username);
if (empty($user)) {
throw new CredentialsException("Unable to authorize, no such user");
}
if (!$user instanceof PasswordAwareInterface... | [
"public",
"function",
"getUser",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"password",
")",
":",
"PasswordAwareInterface",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"source",
"->",
"findByUsername",
"(",
"$",
"username",
")",
";",
"if",
"(",
"e... | Authorizes user based on given credentials. Will throw CredentialsException in case of any
auth related error (i.e. invalid password, invalid username).
@param string $username
@param string $password
@return PasswordAwareInterface
@throws LogicException When user does not implement proper interface.
@throws Credent... | [
"Authorizes",
"user",
"based",
"on",
"given",
"credentials",
".",
"Will",
"throw",
"CredentialsException",
"in",
"case",
"of",
"any",
"auth",
"related",
"error",
"(",
"i",
".",
"e",
".",
"invalid",
"password",
"invalid",
"username",
")",
"."
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Authenticators/CredentialsAuthenticator.php#L52-L68 |
nexusnetsoftgmbh/nexuscli | src/Nexus/DockerClient/Communication/Command/Exec/DockerExecCommand.php | DockerExecCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$command = sprintf(
'exec -i %s %s',
$input->getArgument('container'),
$input->getArgument('execcmd')
);
$response = $this->getFacade()->runDocker($command);
if ($output... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$command = sprintf(
'exec -i %s %s',
$input->getArgument('container'),
$input->getArgument('execcmd')
);
$response = $this->getFacade()->runDocker($command);
if ($output... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"command",
"=",
"sprintf",
"(",
"'exec -i %s %s'",
",",
"$",
"input",
"->",
"getArgument",
"(",
"'container'",
")",
",",
"$",
"inpu... | @param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int|null|void | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Input",
"\\",
"InputInterface",
"$input",
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Output",
"\\",
"OutputInterface",
"$output"
] | train | https://github.com/nexusnetsoftgmbh/nexuscli/blob/8416b43d31ad56ea379ae2b0bf85d456e78ba67a/src/Nexus/DockerClient/Communication/Command/Exec/DockerExecCommand.php#L32-L45 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.getAuthorizationCode | public function getAuthorizationCode($code)
{
$sql = sprintf('SELECT * from %s where authorization_code = :code', $this->config['code_table']);
$code = $this->fetch($sql, compact('code'));
if ($code) {
// convert date string back to timestamp
$code['expires'] = strto... | php | public function getAuthorizationCode($code)
{
$sql = sprintf('SELECT * from %s where authorization_code = :code', $this->config['code_table']);
$code = $this->fetch($sql, compact('code'));
if ($code) {
// convert date string back to timestamp
$code['expires'] = strto... | [
"public",
"function",
"getAuthorizationCode",
"(",
"$",
"code",
")",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'SELECT * from %s where authorization_code = :code'",
",",
"$",
"this",
"->",
"config",
"[",
"'code_table'",
"]",
")",
";",
"$",
"code",
"=",
"$",
"this... | /* OAuth2_Storage_AuthorizationCodeInterface | [
"/",
"*",
"OAuth2_Storage_AuthorizationCodeInterface"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L40-L50 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.checkClientCredentials | public function checkClientCredentials($client_id, $client_secret = null)
{
$sql = sprintf('SELECT * from %s where client_id = :client_id', $this->config['client_table']);
$result = $this->fetch($sql, compact('client_id'));
// make this extensible
return $result ? $result['client... | php | public function checkClientCredentials($client_id, $client_secret = null)
{
$sql = sprintf('SELECT * from %s where client_id = :client_id', $this->config['client_table']);
$result = $this->fetch($sql, compact('client_id'));
// make this extensible
return $result ? $result['client... | [
"public",
"function",
"checkClientCredentials",
"(",
"$",
"client_id",
",",
"$",
"client_secret",
"=",
"null",
")",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'SELECT * from %s where client_id = :client_id'",
",",
"$",
"this",
"->",
"config",
"[",
"'client_table'",
"]... | /* OAuth2_Storage_ClientCredentialsInterface | [
"/",
"*",
"OAuth2_Storage_ClientCredentialsInterface"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L53-L60 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.getAccessToken | public function getAccessToken($access_token)
{
$sql = sprintf('SELECT * from %s where access_token = :access_token', $this->config['access_token_table']);
$token = $this->fetch($sql, compact('access_token'));
if ($token) {
// convert date string back to timestamp
$... | php | public function getAccessToken($access_token)
{
$sql = sprintf('SELECT * from %s where access_token = :access_token', $this->config['access_token_table']);
$token = $this->fetch($sql, compact('access_token'));
if ($token) {
// convert date string back to timestamp
$... | [
"public",
"function",
"getAccessToken",
"(",
"$",
"access_token",
")",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'SELECT * from %s where access_token = :access_token'",
",",
"$",
"this",
"->",
"config",
"[",
"'access_token_table'",
"]",
")",
";",
"$",
"token",
"=",
... | /* OAuth2_Storage_AccessTokenInterface | [
"/",
"*",
"OAuth2_Storage_AccessTokenInterface"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L70-L80 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.getRefreshToken | public function getRefreshToken($refresh_token)
{
$sql = sprintf('SELECT * from %s where refresh_token = :refresh_token', $this->config['refresh_token_table']);
$token = $this->fetch($sql, compact('refresh_token'));
if ($token) {
// convert expires to epoch time
$to... | php | public function getRefreshToken($refresh_token)
{
$sql = sprintf('SELECT * from %s where refresh_token = :refresh_token', $this->config['refresh_token_table']);
$token = $this->fetch($sql, compact('refresh_token'));
if ($token) {
// convert expires to epoch time
$to... | [
"public",
"function",
"getRefreshToken",
"(",
"$",
"refresh_token",
")",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'SELECT * from %s where refresh_token = :refresh_token'",
",",
"$",
"this",
"->",
"config",
"[",
"'refresh_token_table'",
"]",
")",
";",
"$",
"token",
"... | /* OAuth2_Storage_RefreshTokenInterface | [
"/",
"*",
"OAuth2_Storage_RefreshTokenInterface"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L83-L93 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.fetch | public function fetch($sql, $params = array())
{
$stmt = $this->db->prepare($sql);
$stmt->execute($params);
if (!$res = $stmt->fetch(\PDO::FETCH_ASSOC)) {
return false;
}
return $res;
} | php | public function fetch($sql, $params = array())
{
$stmt = $this->db->prepare($sql);
$stmt->execute($params);
if (!$res = $stmt->fetch(\PDO::FETCH_ASSOC)) {
return false;
}
return $res;
} | [
"public",
"function",
"fetch",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"db",
"->",
"prepare",
"(",
"$",
"sql",
")",
";",
"$",
"stmt",
"->",
"execute",
"(",
"$",
"params",
")",
... | @param string $sql
@param array $params
@return array|bool | [
"@param",
"string",
"$sql",
"@param",
"array",
"$params"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L101-L110 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.gc | public function gc()
{
$expires = date('Y-m-d H:i:s');
$tables = array(
'access_token_table',
'refresh_token_table',
'code_table',
);
foreach ($tables as $table) {
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE expires < :exp... | php | public function gc()
{
$expires = date('Y-m-d H:i:s');
$tables = array(
'access_token_table',
'refresh_token_table',
'code_table',
);
foreach ($tables as $table) {
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE expires < :exp... | [
"public",
"function",
"gc",
"(",
")",
"{",
"$",
"expires",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"tables",
"=",
"array",
"(",
"'access_token_table'",
",",
"'refresh_token_table'",
",",
"'code_table'",
",",
")",
";",
"foreach",
"(",
"$",
"tables... | Garbage Collection | [
"Garbage",
"Collection"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L115-L127 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.setClientUser | public function setClientUser($client_id, $user_id)
{
if ($this->getClientUser($client_id, $user_id)) {
return true;
} else {
$created_at = date('Y-m-d H:i:s');
$sql = 'INSERT INTO %s (client_id, user_id, created_at) VALUES (:client_id, :user_id, :created_a... | php | public function setClientUser($client_id, $user_id)
{
if ($this->getClientUser($client_id, $user_id)) {
return true;
} else {
$created_at = date('Y-m-d H:i:s');
$sql = 'INSERT INTO %s (client_id, user_id, created_at) VALUES (:client_id, :user_id, :created_a... | [
"public",
"function",
"setClientUser",
"(",
"$",
"client_id",
",",
"$",
"user_id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getClientUser",
"(",
"$",
"client_id",
",",
"$",
"user_id",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"$",
"crea... | @param string $client_id
@param string $user_id
@return bool | [
"@param",
"string",
"$client_id",
"@param",
"string",
"$user_id"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L135-L148 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.getClientUser | public function getClientUser($client_id, $user_id)
{
$sql = 'SELECT * from %s where client_id = :client_id and user_id = :user_id';
$sql = sprintf($sql, $this->config['client_user_table']);
return $this->fetch($sql, compact('client_id', 'user_id'));
} | php | public function getClientUser($client_id, $user_id)
{
$sql = 'SELECT * from %s where client_id = :client_id and user_id = :user_id';
$sql = sprintf($sql, $this->config['client_user_table']);
return $this->fetch($sql, compact('client_id', 'user_id'));
} | [
"public",
"function",
"getClientUser",
"(",
"$",
"client_id",
",",
"$",
"user_id",
")",
"{",
"$",
"sql",
"=",
"'SELECT * from %s where client_id = :client_id and user_id = :user_id'",
";",
"$",
"sql",
"=",
"sprintf",
"(",
"$",
"sql",
",",
"$",
"this",
"->",
"con... | @param string $client_id
@param string $user_id
@return array|bool | [
"@param",
"string",
"$client_id",
"@param",
"string",
"$user_id"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L156-L162 |
paliari/oauth2-server-facade | src/Paliari/Oauth2ServerFacade/Storage.php | Storage.removeClientUser | public function removeClientUser($client_id, $user_id)
{
$sql = 'DELETE from %s where client_id = :client_id and user_id = :user_id';
$sql = sprintf($sql, $this->config['client_user_table']);
$params = array_map('trim', compact('client_id', 'user_id'));
return $this->db->prepa... | php | public function removeClientUser($client_id, $user_id)
{
$sql = 'DELETE from %s where client_id = :client_id and user_id = :user_id';
$sql = sprintf($sql, $this->config['client_user_table']);
$params = array_map('trim', compact('client_id', 'user_id'));
return $this->db->prepa... | [
"public",
"function",
"removeClientUser",
"(",
"$",
"client_id",
",",
"$",
"user_id",
")",
"{",
"$",
"sql",
"=",
"'DELETE from %s where client_id = :client_id and user_id = :user_id'",
";",
"$",
"sql",
"=",
"sprintf",
"(",
"$",
"sql",
",",
"$",
"this",
"->",
"co... | @param string $client_id
@param string $user_id
@return bool | [
"@param",
"string",
"$client_id",
"@param",
"string",
"$user_id"
] | train | https://github.com/paliari/oauth2-server-facade/blob/72785397ff5b2d4c9e8cf487b4215b3808bbcfdf/src/Paliari/Oauth2ServerFacade/Storage.php#L170-L177 |
titon/db | src/Titon/Db/Finder/ListFinder.php | ListFinder.after | public function after(array $results, array $options = []) {
$key = isset($options['key']) ? $options['key'] : null;
$value = isset($options['value']) ? $options['value'] : null;
$list = [];
if (!$key || !$value) {
throw new InvalidArgumentException('Missing key or value opt... | php | public function after(array $results, array $options = []) {
$key = isset($options['key']) ? $options['key'] : null;
$value = isset($options['value']) ? $options['value'] : null;
$list = [];
if (!$key || !$value) {
throw new InvalidArgumentException('Missing key or value opt... | [
"public",
"function",
"after",
"(",
"array",
"$",
"results",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"key",
"=",
"isset",
"(",
"$",
"options",
"[",
"'key'",
"]",
")",
"?",
"$",
"options",
"[",
"'key'",
"]",
":",
"null",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Finder/ListFinder.php#L24-L42 |
phrest/sdk | src/Generator/Request/RequestGenerator.php | RequestGenerator.create | public function create()
{
$class = ClassGen::classGen(
$this->name,
$this->namespace,
[
'Phrest\API\Enums\RequestMethodEnum',
'Phrest\SDK\Request\AbstractRequest',
'Phrest\SDK\Request\RequestOptions',
'Phrest\SDK\PhrestSDK'
],
'AbstractRequest'
);... | php | public function create()
{
$class = ClassGen::classGen(
$this->name,
$this->namespace,
[
'Phrest\API\Enums\RequestMethodEnum',
'Phrest\SDK\Request\AbstractRequest',
'Phrest\SDK\Request\RequestOptions',
'Phrest\SDK\PhrestSDK'
],
'AbstractRequest'
);... | [
"public",
"function",
"create",
"(",
")",
"{",
"$",
"class",
"=",
"ClassGen",
"::",
"classGen",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"namespace",
",",
"[",
"'Phrest\\API\\Enums\\RequestMethodEnum'",
",",
"'Phrest\\SDK\\Request\\AbstractRequest'"... | Process and create code/files | [
"Process",
"and",
"create",
"code",
"/",
"files"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Request/RequestGenerator.php#L72-L156 |
phrest/sdk | src/Generator/Request/RequestGenerator.php | RequestGenerator.getCreateBody | public function getCreateBody()
{
$createBody = '$requestOptions = new RequestOptions();' . PHP_EOL . PHP_EOL;
if (!empty($this->action->postParams))
{
$createBody .= '$requestOptions->addPostParams(' . PHP_EOL .
Generator::$indentation . "[" . PHP_EOL;
foreach ($this->action->postPa... | php | public function getCreateBody()
{
$createBody = '$requestOptions = new RequestOptions();' . PHP_EOL . PHP_EOL;
if (!empty($this->action->postParams))
{
$createBody .= '$requestOptions->addPostParams(' . PHP_EOL .
Generator::$indentation . "[" . PHP_EOL;
foreach ($this->action->postPa... | [
"public",
"function",
"getCreateBody",
"(",
")",
"{",
"$",
"createBody",
"=",
"'$requestOptions = new RequestOptions();'",
".",
"PHP_EOL",
".",
"PHP_EOL",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"action",
"->",
"postParams",
")",
")",
"{",
"$",... | E.G.
<code>
$requestOptions = new RequestOptions();
$requestOptions->addPostParams(
[
'name' => $this->name,
'email' => $this->email,
'password' => $this->password,
]
);
if (!isset($this->id))
{
throw new \Exception("Parameter 'id' is required. It is a GET
parameter.");
}
return PhrestSDK::getResponse(
self::METHOD_POS... | [
"E",
".",
"G",
".",
"<code",
">",
"$requestOptions",
"=",
"new",
"RequestOptions",
"()",
";",
"$requestOptions",
"-",
">",
"addPostParams",
"(",
"[",
"name",
"=",
">",
"$this",
"-",
">",
"name",
"email",
"=",
">",
"$this",
"-",
">",
"email",
"password"... | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Request/RequestGenerator.php#L210-L273 |
PeekAndPoke/psi | src/DefaultPsiFactory.php | DefaultPsiFactory.createIterator | public function createIterator(array $iteratables, PsiOptions $options)
{
$count = count($iteratables);
if ($count === 1) {
return $this->createSingleIterator($iteratables[0]);
}
if ($count > 1) {
return $this->createIteratorForMultipleInputs($iteratables, $... | php | public function createIterator(array $iteratables, PsiOptions $options)
{
$count = count($iteratables);
if ($count === 1) {
return $this->createSingleIterator($iteratables[0]);
}
if ($count > 1) {
return $this->createIteratorForMultipleInputs($iteratables, $... | [
"public",
"function",
"createIterator",
"(",
"array",
"$",
"iteratables",
",",
"PsiOptions",
"$",
"options",
")",
"{",
"$",
"count",
"=",
"count",
"(",
"$",
"iteratables",
")",
";",
"if",
"(",
"$",
"count",
"===",
"1",
")",
"{",
"return",
"$",
"this",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/DefaultPsiFactory.php#L31-L44 |
PeekAndPoke/psi | src/DefaultPsiFactory.php | DefaultPsiFactory.createIteratorForMultipleInputs | protected function createIteratorForMultipleInputs(array $iteratables, PsiOptions $options)
{
// when we have multiple inputs we need an option to decide on how to deal with colliding keys
if ($options->isPreserveKeysOfMultipleInputs()) {
// this iterator return the original keys of each... | php | protected function createIteratorForMultipleInputs(array $iteratables, PsiOptions $options)
{
// when we have multiple inputs we need an option to decide on how to deal with colliding keys
if ($options->isPreserveKeysOfMultipleInputs()) {
// this iterator return the original keys of each... | [
"protected",
"function",
"createIteratorForMultipleInputs",
"(",
"array",
"$",
"iteratables",
",",
"PsiOptions",
"$",
"options",
")",
"{",
"// when we have multiple inputs we need an option to decide on how to deal with colliding keys",
"if",
"(",
"$",
"options",
"->",
"isPrese... | @param array $iteratables
@param PsiOptions $options
@return \AppendIterator|KeylessAppendIterator
@throws PsiException | [
"@param",
"array",
"$iteratables",
"@param",
"PsiOptions",
"$options"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/DefaultPsiFactory.php#L54-L71 |
PeekAndPoke/psi | src/DefaultPsiFactory.php | DefaultPsiFactory.createSingleIterator | protected function createSingleIterator($iteratable)
{
if ($iteratable === null) {
return new \ArrayIterator();
}
if ($iteratable instanceof \Iterator) {
return $iteratable;
}
if ($iteratable instanceof \Traversable) {
return new \Iterato... | php | protected function createSingleIterator($iteratable)
{
if ($iteratable === null) {
return new \ArrayIterator();
}
if ($iteratable instanceof \Iterator) {
return $iteratable;
}
if ($iteratable instanceof \Traversable) {
return new \Iterato... | [
"protected",
"function",
"createSingleIterator",
"(",
"$",
"iteratable",
")",
"{",
"if",
"(",
"$",
"iteratable",
"===",
"null",
")",
"{",
"return",
"new",
"\\",
"ArrayIterator",
"(",
")",
";",
"}",
"if",
"(",
"$",
"iteratable",
"instanceof",
"\\",
"Iterato... | @param mixed $iteratable
@return \Iterator|\Traversable
@throws PsiException | [
"@param",
"mixed",
"$iteratable"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/DefaultPsiFactory.php#L80-L99 |
dandisy/laravel-generator | src/Commands/Publish/VueJsLayoutPublishCommand.php | VueJsLayoutPublishCommand.fillTemplate | private function fillTemplate($templateData)
{
$templateData = str_replace(
'$NAMESPACE_CONTROLLER$',
config('webcore.laravel_generator.namespace.controller'), $templateData
);
$templateData = str_replace(
'$NAMESPACE_REQUEST$',
config('webcor... | php | private function fillTemplate($templateData)
{
$templateData = str_replace(
'$NAMESPACE_CONTROLLER$',
config('webcore.laravel_generator.namespace.controller'), $templateData
);
$templateData = str_replace(
'$NAMESPACE_REQUEST$',
config('webcor... | [
"private",
"function",
"fillTemplate",
"(",
"$",
"templateData",
")",
"{",
"$",
"templateData",
"=",
"str_replace",
"(",
"'$NAMESPACE_CONTROLLER$'",
",",
"config",
"(",
"'webcore.laravel_generator.namespace.controller'",
")",
",",
"$",
"templateData",
")",
";",
"$",
... | Replaces dynamic variables of template.
@param string $templateData
@return string | [
"Replaces",
"dynamic",
"variables",
"of",
"template",
"."
] | train | https://github.com/dandisy/laravel-generator/blob/742797c8483bc88b54b6302a516a9a85eeb8579b/src/Commands/Publish/VueJsLayoutPublishCommand.php#L260-L273 |
2amigos/yiifoundation | helpers/Panel.php | Panel.panel | public static function panel($content, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::PANEL, $htmlOptions);
return \CHtml::tag('div', $htmlOptions, $content);
} | php | public static function panel($content, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::PANEL, $htmlOptions);
return \CHtml::tag('div', $htmlOptions, $content);
} | [
"public",
"static",
"function",
"panel",
"(",
"$",
"content",
",",
"$",
"htmlOptions",
"=",
"array",
"(",
")",
")",
"{",
"ArrayHelper",
"::",
"addValue",
"(",
"'class'",
",",
"Enum",
"::",
"PANEL",
",",
"$",
"htmlOptions",
")",
";",
"return",
"\\",
"CH... | Generates a panel
@param string $content the content to display
@param array $htmlOptions the HTML attributes of the panel
@return string
@see http://foundation.zurb.com/docs/components/panels.html | [
"Generates",
"a",
"panel"
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Panel.php#L31-L35 |
2amigos/yiifoundation | helpers/Panel.php | Panel.callout | public static function callout($content, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::PANEL_CALLOUT, $htmlOptions);
return static::panel($content, $htmlOptions);
} | php | public static function callout($content, $htmlOptions = array())
{
ArrayHelper::addValue('class', Enum::PANEL_CALLOUT, $htmlOptions);
return static::panel($content, $htmlOptions);
} | [
"public",
"static",
"function",
"callout",
"(",
"$",
"content",
",",
"$",
"htmlOptions",
"=",
"array",
"(",
")",
")",
"{",
"ArrayHelper",
"::",
"addValue",
"(",
"'class'",
",",
"Enum",
"::",
"PANEL_CALLOUT",
",",
"$",
"htmlOptions",
")",
";",
"return",
"... | Generates a callout panel
@param string $content the content to display
@param array $htmlOptions the HTML attributes of the panel
@return string | [
"Generates",
"a",
"callout",
"panel"
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/helpers/Panel.php#L44-L48 |
ClanCats/Core | src/console/doctor.php | doctor.action_security_key | public function action_security_key( $params )
{
$path = \CCPath::config( 'main.config'.EXT );
// Check if the file exists
if ( !file_exists( $path ) )
{
$this->error( 'Could not find main configuration file.' ); return;
}
// Now try to replace the placeholder with
// an new generated key
$da... | php | public function action_security_key( $params )
{
$path = \CCPath::config( 'main.config'.EXT );
// Check if the file exists
if ( !file_exists( $path ) )
{
$this->error( 'Could not find main configuration file.' ); return;
}
// Now try to replace the placeholder with
// an new generated key
$da... | [
"public",
"function",
"action_security_key",
"(",
"$",
"params",
")",
"{",
"$",
"path",
"=",
"\\",
"CCPath",
"::",
"config",
"(",
"'main.config'",
".",
"EXT",
")",
";",
"// Check if the file exists",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")... | Try to generate a security key in the main config file
@param array $params | [
"Try",
"to",
"generate",
"a",
"security",
"key",
"in",
"the",
"main",
"config",
"file"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/console/doctor.php#L43-L68 |
ClanCats/Core | src/console/doctor.php | doctor.action_permissions | public function action_permissions( $params )
{
$folders = \CCEvent::fire( 'ccdoctor.permissions' );
if ( !is_array( $folders ) )
{
$folders = array();
}
// add storage directories
foreach( \ClanCats::$config->get( 'storage.paths' ) as $folder )
{
$folders[] = $folder;
}
foreach( $fol... | php | public function action_permissions( $params )
{
$folders = \CCEvent::fire( 'ccdoctor.permissions' );
if ( !is_array( $folders ) )
{
$folders = array();
}
// add storage directories
foreach( \ClanCats::$config->get( 'storage.paths' ) as $folder )
{
$folders[] = $folder;
}
foreach( $fol... | [
"public",
"function",
"action_permissions",
"(",
"$",
"params",
")",
"{",
"$",
"folders",
"=",
"\\",
"CCEvent",
"::",
"fire",
"(",
"'ccdoctor.permissions'",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"folders",
")",
")",
"{",
"$",
"folders",
"=",
... | install an orbit module
@param array $params | [
"install",
"an",
"orbit",
"module"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/console/doctor.php#L75-L131 |
xltxlm/logger | src/Operation/Connect/ElasticsearchConnectLog.php | ElasticsearchConnectLog.setElasticsearchConfig | public function setElasticsearchConfig(ElasticsearchConfig $ElasticsearchConfig): ElasticsearchConnectLog
{
if (strpos(get_class($ElasticsearchConfig), 'class@anonymous') !== false) {
$this->ElasticsearchConfig = (new ConvertObject())
->setObject($ElasticsearchConfig)
... | php | public function setElasticsearchConfig(ElasticsearchConfig $ElasticsearchConfig): ElasticsearchConnectLog
{
if (strpos(get_class($ElasticsearchConfig), 'class@anonymous') !== false) {
$this->ElasticsearchConfig = (new ConvertObject())
->setObject($ElasticsearchConfig)
... | [
"public",
"function",
"setElasticsearchConfig",
"(",
"ElasticsearchConfig",
"$",
"ElasticsearchConfig",
")",
":",
"ElasticsearchConnectLog",
"{",
"if",
"(",
"strpos",
"(",
"get_class",
"(",
"$",
"ElasticsearchConfig",
")",
",",
"'class@anonymous'",
")",
"!==",
"false"... | @param ElasticsearchConfig $ElasticsearchConfig
@return ElasticsearchConnectLog | [
"@param",
"ElasticsearchConfig",
"$ElasticsearchConfig"
] | train | https://github.com/xltxlm/logger/blob/09592eeac38c6760bb4faabef939dd542f69b056/src/Operation/Connect/ElasticsearchConnectLog.php#L54-L65 |
barebone-php/barebone-core | lib/Database.php | Database.instance | public static function instance()
{
if (null === self::$_instance) {
$capsule = new Capsule;
$capsule->addConnection(self::getConfig());
$capsule->setEventDispatcher(new Dispatcher(new Container));
$capsule->setAsGlobal();
self::$_instance = $caps... | php | public static function instance()
{
if (null === self::$_instance) {
$capsule = new Capsule;
$capsule->addConnection(self::getConfig());
$capsule->setEventDispatcher(new Dispatcher(new Container));
$capsule->setAsGlobal();
self::$_instance = $caps... | [
"public",
"static",
"function",
"instance",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"_instance",
")",
"{",
"$",
"capsule",
"=",
"new",
"Capsule",
";",
"$",
"capsule",
"->",
"addConnection",
"(",
"self",
"::",
"getConfig",
"(",
")",
... | Instantiate Eloquent ORM
@return Capsule | [
"Instantiate",
"Eloquent",
"ORM"
] | train | https://github.com/barebone-php/barebone-core/blob/7fda3a62d5fa103cdc4d2d34e1adf8f3ccbfe2bc/lib/Database.php#L48-L59 |
yuncms/framework | src/console/controllers/MigrateController.php | MigrateController.initMigrationPath | public function initMigrationPath()
{
$manifestFile = Yii::getAlias('@vendor/yuncms/migrations.php');
if (is_file($manifestFile)) {
$migrationPaths = require($manifestFile);
$this->migrationPath = ArrayHelper::merge($this->migrationPath, $migrationPaths);
}
$t... | php | public function initMigrationPath()
{
$manifestFile = Yii::getAlias('@vendor/yuncms/migrations.php');
if (is_file($manifestFile)) {
$migrationPaths = require($manifestFile);
$this->migrationPath = ArrayHelper::merge($this->migrationPath, $migrationPaths);
}
$t... | [
"public",
"function",
"initMigrationPath",
"(",
")",
"{",
"$",
"manifestFile",
"=",
"Yii",
"::",
"getAlias",
"(",
"'@vendor/yuncms/migrations.php'",
")",
";",
"if",
"(",
"is_file",
"(",
"$",
"manifestFile",
")",
")",
"{",
"$",
"migrationPaths",
"=",
"require",... | 初始化迁移路径 | [
"初始化迁移路径"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/console/controllers/MigrateController.php#L67-L75 |
phpbench/container | lib/Container.php | Container.init | public function init()
{
$extensions = [];
if (empty($this->extensionClasses) && empty($this->userConfig)) {
return;
}
foreach ($this->extensionClasses as $extensionClass) {
if (!class_exists($extensionClass)) {
throw new \InvalidArgumentExce... | php | public function init()
{
$extensions = [];
if (empty($this->extensionClasses) && empty($this->userConfig)) {
return;
}
foreach ($this->extensionClasses as $extensionClass) {
if (!class_exists($extensionClass)) {
throw new \InvalidArgumentExce... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"extensions",
"=",
"[",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"extensionClasses",
")",
"&&",
"empty",
"(",
"$",
"this",
"->",
"userConfig",
")",
")",
"{",
"return",
";",
"}",
"foreac... | Configure the container. This method will call the `configure()` method
on each extension. Extensions must use this opportunity to register their
services and define any default config.
This method must be called before `build()`. | [
"Configure",
"the",
"container",
".",
"This",
"method",
"will",
"call",
"the",
"configure",
"()",
"method",
"on",
"each",
"extension",
".",
"Extensions",
"must",
"use",
"this",
"opportunity",
"to",
"register",
"their",
"services",
"and",
"define",
"any",
"defa... | train | https://github.com/phpbench/container/blob/7acabddac1fd09cb58d4790443b6b791bf9f3095/lib/Container.php#L44-L95 |
phpbench/container | lib/Container.php | Container.get | public function get($serviceId)
{
if (isset($this->services[$serviceId])) {
return $this->services[$serviceId];
}
if (!isset($this->instantiators[$serviceId])) {
throw new \InvalidArgumentException(sprintf(
'No instantiator has been registered for req... | php | public function get($serviceId)
{
if (isset($this->services[$serviceId])) {
return $this->services[$serviceId];
}
if (!isset($this->instantiators[$serviceId])) {
throw new \InvalidArgumentException(sprintf(
'No instantiator has been registered for req... | [
"public",
"function",
"get",
"(",
"$",
"serviceId",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"services",
"[",
"$",
"serviceId",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"services",
"[",
"$",
"serviceId",
"]",
";",
"}",
"if",
... | Instantiate and return the service with the given ID.
Note that this method will return the same instance on subsequent calls.
@param string $serviceId
@return mixed | [
"Instantiate",
"and",
"return",
"the",
"service",
"with",
"the",
"given",
"ID",
".",
"Note",
"that",
"this",
"method",
"will",
"return",
"the",
"same",
"instance",
"on",
"subsequent",
"calls",
"."
] | train | https://github.com/phpbench/container/blob/7acabddac1fd09cb58d4790443b6b791bf9f3095/lib/Container.php#L105-L121 |
phpbench/container | lib/Container.php | Container.getServiceIdsForTag | public function getServiceIdsForTag($tag)
{
$serviceIds = [];
foreach ($this->tags as $serviceId => $tags) {
if (isset($tags[$tag])) {
$serviceIds[$serviceId] = $tags[$tag];
}
}
return $serviceIds;
} | php | public function getServiceIdsForTag($tag)
{
$serviceIds = [];
foreach ($this->tags as $serviceId => $tags) {
if (isset($tags[$tag])) {
$serviceIds[$serviceId] = $tags[$tag];
}
}
return $serviceIds;
} | [
"public",
"function",
"getServiceIdsForTag",
"(",
"$",
"tag",
")",
"{",
"$",
"serviceIds",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"tags",
"as",
"$",
"serviceId",
"=>",
"$",
"tags",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"tags",
"["... | Return services IDs for the given tag.
@param string $tag
@return string[][] | [
"Return",
"services",
"IDs",
"for",
"the",
"given",
"tag",
"."
] | train | https://github.com/phpbench/container/blob/7acabddac1fd09cb58d4790443b6b791bf9f3095/lib/Container.php#L146-L156 |
phpbench/container | lib/Container.php | Container.register | public function register($serviceId, \Closure $instantiator, array $tags = [])
{
if (isset($this->instantiators[$serviceId])) {
throw new \InvalidArgumentException(sprintf(
'Service with ID "%s" has already been registered', $serviceId));
}
$this->instantiators[$... | php | public function register($serviceId, \Closure $instantiator, array $tags = [])
{
if (isset($this->instantiators[$serviceId])) {
throw new \InvalidArgumentException(sprintf(
'Service with ID "%s" has already been registered', $serviceId));
}
$this->instantiators[$... | [
"public",
"function",
"register",
"(",
"$",
"serviceId",
",",
"\\",
"Closure",
"$",
"instantiator",
",",
"array",
"$",
"tags",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"instantiators",
"[",
"$",
"serviceId",
"]",
")",
")",... | Register a service with the given ID and instantiator.
The instantiator is a closure which accepts an instance of this container and
returns a new instance of the service class.
@param string $serviceId
@param \Closure $instantiator
@param string[][] $tags | [
"Register",
"a",
"service",
"with",
"the",
"given",
"ID",
"and",
"instantiator",
"."
] | train | https://github.com/phpbench/container/blob/7acabddac1fd09cb58d4790443b6b791bf9f3095/lib/Container.php#L168-L177 |
phpbench/container | lib/Container.php | Container.getParameter | public function getParameter($name)
{
if (!array_key_exists($name, $this->config)) {
throw new \InvalidArgumentException(sprintf(
'Parameter "%s" has not been registered',
$name
));
}
return $this->config[$name];
} | php | public function getParameter($name)
{
if (!array_key_exists($name, $this->config)) {
throw new \InvalidArgumentException(sprintf(
'Parameter "%s" has not been registered',
$name
));
}
return $this->config[$name];
} | [
"public",
"function",
"getParameter",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"config",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Parameter \"%s... | Return the parameter with the given name.
@param string $name
@throws \InvalidArgumentException
@return mixed | [
"Return",
"the",
"parameter",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/phpbench/container/blob/7acabddac1fd09cb58d4790443b6b791bf9f3095/lib/Container.php#L216-L226 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.escape | public function escape( $string )
{
if ( \DB::is_expression( $string ) )
{
return $string->value;
}
// the string might contain an 'as' statement that we wil have to split.
if ( strpos( $string, ' as ' ) !== false )
{
$string = explode( ' as ', $string );
return $this->escape( trim( $string[0] ... | php | public function escape( $string )
{
if ( \DB::is_expression( $string ) )
{
return $string->value;
}
// the string might contain an 'as' statement that we wil have to split.
if ( strpos( $string, ' as ' ) !== false )
{
$string = explode( ' as ', $string );
return $this->escape( trim( $string[0] ... | [
"public",
"function",
"escape",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"\\",
"DB",
"::",
"is_expression",
"(",
"$",
"string",
")",
")",
"{",
"return",
"$",
"string",
"->",
"value",
";",
"}",
"// the string might contain an 'as' statement that we wil have to sp... | Escape / wrap an string for sql
@param string|Expression $string | [
"Escape",
"/",
"wrap",
"an",
"string",
"for",
"sql"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L82-L110 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.escape_table | public function escape_table( &$query )
{
$table = $query->table;
if ( is_array( $table ) )
{
reset($table); $table = key($table).' as '.$table[key($table)];
}
return $this->escape( $table );
} | php | public function escape_table( &$query )
{
$table = $query->table;
if ( is_array( $table ) )
{
reset($table); $table = key($table).' as '.$table[key($table)];
}
return $this->escape( $table );
} | [
"public",
"function",
"escape_table",
"(",
"&",
"$",
"query",
")",
"{",
"$",
"table",
"=",
"$",
"query",
"->",
"table",
";",
"if",
"(",
"is_array",
"(",
"$",
"table",
")",
")",
"{",
"reset",
"(",
"$",
"table",
")",
";",
"$",
"table",
"=",
"key",
... | Escape the table
@param Query $query
@return string | [
"Escape",
"the",
"table"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L145-L155 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.parameterize | public function parameterize( $params )
{
foreach( $params as $key => $param )
{
$params[$key] = $this->param( $param );
}
return implode( ', ', $params );
} | php | public function parameterize( $params )
{
foreach( $params as $key => $param )
{
$params[$key] = $this->param( $param );
}
return implode( ', ', $params );
} | [
"public",
"function",
"parameterize",
"(",
"$",
"params",
")",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"param",
")",
"{",
"$",
"params",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"param",
"(",
"$",
"param",
")",
";",
... | Convert data to parameters and bind them to the query
@param array $params
@return string | [
"Convert",
"data",
"to",
"parameters",
"and",
"bind",
"them",
"to",
"the",
"query"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L163-L171 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.compile_insert | public function compile_insert( &$query )
{
$build = ( $query->ignore ? 'insert ignore' : 'insert' ).' into '.$this->escape_table( $query ).' ';
$value_collection = $query->values;
// Get the array keys from the first array in the collection.
// We use them as insert keys.
$build .= '('.$this->escape_list(... | php | public function compile_insert( &$query )
{
$build = ( $query->ignore ? 'insert ignore' : 'insert' ).' into '.$this->escape_table( $query ).' ';
$value_collection = $query->values;
// Get the array keys from the first array in the collection.
// We use them as insert keys.
$build .= '('.$this->escape_list(... | [
"public",
"function",
"compile_insert",
"(",
"&",
"$",
"query",
")",
"{",
"$",
"build",
"=",
"(",
"$",
"query",
"->",
"ignore",
"?",
"'insert ignore'",
":",
"'insert'",
")",
".",
"' into '",
".",
"$",
"this",
"->",
"escape_table",
"(",
"$",
"query",
")... | Build an insert query
@param Query $query
@return string | [
"Build",
"an",
"insert",
"query"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L179-L197 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.compile_update | public function compile_update( &$query )
{
$build = 'update '.$this->escape_table( $query ).' set ';
// add the array values.
foreach( $query->values as $key => $value )
{
$build .= $this->escape( $key ).' = '.$this->param( $value ).', ';
}
$build = substr( $build, 0, -2 );
$build .= $this->compile... | php | public function compile_update( &$query )
{
$build = 'update '.$this->escape_table( $query ).' set ';
// add the array values.
foreach( $query->values as $key => $value )
{
$build .= $this->escape( $key ).' = '.$this->param( $value ).', ';
}
$build = substr( $build, 0, -2 );
$build .= $this->compile... | [
"public",
"function",
"compile_update",
"(",
"&",
"$",
"query",
")",
"{",
"$",
"build",
"=",
"'update '",
".",
"$",
"this",
"->",
"escape_table",
"(",
"$",
"query",
")",
".",
"' set '",
";",
"// add the array values.",
"foreach",
"(",
"$",
"query",
"->",
... | Build an update query
@param Query $query
@return string | [
"Build",
"an",
"update",
"query"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L205-L221 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.compile_delete | public function compile_delete( &$query )
{
$build = 'delete from '.$this->escape_table( $query );
$build .= $this->compile_where( $query );
$build .= $this->compile_limit( $query );
// cut the last comma away
return $build;
} | php | public function compile_delete( &$query )
{
$build = 'delete from '.$this->escape_table( $query );
$build .= $this->compile_where( $query );
$build .= $this->compile_limit( $query );
// cut the last comma away
return $build;
} | [
"public",
"function",
"compile_delete",
"(",
"&",
"$",
"query",
")",
"{",
"$",
"build",
"=",
"'delete from '",
".",
"$",
"this",
"->",
"escape_table",
"(",
"$",
"query",
")",
";",
"$",
"build",
".=",
"$",
"this",
"->",
"compile_where",
"(",
"$",
"query... | Build an delete query
@param Query $query
@return string | [
"Build",
"an",
"delete",
"query"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L229-L238 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.compile_select | public function compile_select( &$query )
{
$build = ( $query->distinct ? 'select distinct' : 'select' ).' ';
if ( !empty( $query->fields ) )
{
foreach( $query->fields as $key => $field )
{
if ( !is_numeric( $key ) )
{
$build .= $this->escape( $key ).' as '.$this->escape( $field );
}
... | php | public function compile_select( &$query )
{
$build = ( $query->distinct ? 'select distinct' : 'select' ).' ';
if ( !empty( $query->fields ) )
{
foreach( $query->fields as $key => $field )
{
if ( !is_numeric( $key ) )
{
$build .= $this->escape( $key ).' as '.$this->escape( $field );
}
... | [
"public",
"function",
"compile_select",
"(",
"&",
"$",
"query",
")",
"{",
"$",
"build",
"=",
"(",
"$",
"query",
"->",
"distinct",
"?",
"'select distinct'",
":",
"'select'",
")",
".",
"' '",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"query",
"->",
"fiel... | Build a select
@param Query $query
@return string | [
"Build",
"a",
"select"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L246-L286 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.compile_where | public function compile_where( &$query )
{
$build = '';
foreach( $query->wheres as $where )
{
// to make nested wheres possible you can pass an closure
// wich will create a new query where you can add your nested wheres
if ( !isset( $where[2] ) && is_closure( $where[1] ) )
{
$sub_query = new ... | php | public function compile_where( &$query )
{
$build = '';
foreach( $query->wheres as $where )
{
// to make nested wheres possible you can pass an closure
// wich will create a new query where you can add your nested wheres
if ( !isset( $where[2] ) && is_closure( $where[1] ) )
{
$sub_query = new ... | [
"public",
"function",
"compile_where",
"(",
"&",
"$",
"query",
")",
"{",
"$",
"build",
"=",
"''",
";",
"foreach",
"(",
"$",
"query",
"->",
"wheres",
"as",
"$",
"where",
")",
"{",
"// to make nested wheres possible you can pass an closure ",
"// wich will create a ... | Build the where part
@param Query $query
@return string | [
"Build",
"the",
"where",
"part"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L294-L333 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.compile_limit_with_offset | public function compile_limit_with_offset( &$query )
{
if ( is_null( $query->limit ) )
{
return "";
}
return ' limit '.( (int) $query->offset ).', '.( (int) $query->limit );
} | php | public function compile_limit_with_offset( &$query )
{
if ( is_null( $query->limit ) )
{
return "";
}
return ' limit '.( (int) $query->offset ).', '.( (int) $query->limit );
} | [
"public",
"function",
"compile_limit_with_offset",
"(",
"&",
"$",
"query",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"query",
"->",
"limit",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"return",
"' limit '",
".",
"(",
"(",
"int",
")",
"$",
"query",
"-... | Build the limit and offset part
@param Query $query
@return string | [
"Build",
"the",
"limit",
"and",
"offset",
"part"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L341-L349 |
ClanCats/Core | src/bundles/Database/Builder.php | Builder.compile_order | protected function compile_order( &$query )
{
if ( empty( $query->orders ) )
{
return '';
}
$build = " order by ";
foreach( $query->orders as $order )
{
$build .= $this->escape( $order[0] ).' '.$order[1].', ';
}
return substr( $build, 0, -2 );
} | php | protected function compile_order( &$query )
{
if ( empty( $query->orders ) )
{
return '';
}
$build = " order by ";
foreach( $query->orders as $order )
{
$build .= $this->escape( $order[0] ).' '.$order[1].', ';
}
return substr( $build, 0, -2 );
} | [
"protected",
"function",
"compile_order",
"(",
"&",
"$",
"query",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"query",
"->",
"orders",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"build",
"=",
"\" order by \"",
";",
"foreach",
"(",
"$",
"query",
"->",
... | Build the order by statement
@param Query $query
@return string | [
"Build",
"the",
"order",
"by",
"statement"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Builder.php#L373-L388 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.element | protected function element(string $name): \DOMElement
{
if (\strpos($name, ':') !== false)
{
$keys = explode(':', $name);
return $this->document()->createElementNS(
$this->namespaces[$this->options()->getNamespace() . ':' . \current($keys)],
$... | php | protected function element(string $name): \DOMElement
{
if (\strpos($name, ':') !== false)
{
$keys = explode(':', $name);
return $this->document()->createElementNS(
$this->namespaces[$this->options()->getNamespace() . ':' . \current($keys)],
$... | [
"protected",
"function",
"element",
"(",
"string",
"$",
"name",
")",
":",
"\\",
"DOMElement",
"{",
"if",
"(",
"\\",
"strpos",
"(",
"$",
"name",
",",
"':'",
")",
"!==",
"false",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"':'",
",",
"$",
"name",
... | @param string $name
@return \DOMElement | [
"@param",
"string",
"$name"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L108-L121 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader._property | protected function _property(\SimpleXMLElement $element, $property): array
{
$output = [];
if (\method_exists($element, $property)) {
$properties = $element->$property();
if ($properties) {
$data = \is_array($properties) ?
$properties : ... | php | protected function _property(\SimpleXMLElement $element, $property): array
{
$output = [];
if (\method_exists($element, $property)) {
$properties = $element->$property();
if ($properties) {
$data = \is_array($properties) ?
$properties : ... | [
"protected",
"function",
"_property",
"(",
"\\",
"SimpleXMLElement",
"$",
"element",
",",
"$",
"property",
")",
":",
"array",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"if",
"(",
"\\",
"method_exists",
"(",
"$",
"element",
",",
"$",
"property",
")",
")",... | @param \SimpleXMLElement $element
@param string $property
@return array | [
"@param",
"\\",
"SimpleXMLElement",
"$element",
"@param",
"string",
"$property"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L129-L148 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader._asData | protected function _asData(\SimpleXMLElement $element)
{
$output = $this->_property($element, 'attributes');
if (!$element->count()) {
$output['@value'] = (string)$element;
if (!isset($output['@attributes'])) {
$output = $output['@value'];
}
... | php | protected function _asData(\SimpleXMLElement $element)
{
$output = $this->_property($element, 'attributes');
if (!$element->count()) {
$output['@value'] = (string)$element;
if (!isset($output['@attributes'])) {
$output = $output['@value'];
}
... | [
"protected",
"function",
"_asData",
"(",
"\\",
"SimpleXMLElement",
"$",
"element",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"_property",
"(",
"$",
"element",
",",
"'attributes'",
")",
";",
"if",
"(",
"!",
"$",
"element",
"->",
"count",
"(",
")"... | @param \SimpleXMLElement $element
@return array|string
@codeCoverageIgnore | [
"@param",
"\\",
"SimpleXMLElement",
"$element"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L157-L169 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader._asArray | protected function _asArray(\SimpleXMLElement $element)
{
$output = $this->_asData($element);
if (!$element->count()) {
return $output;
}
return $this->_pushArray($output, $element);
} | php | protected function _asArray(\SimpleXMLElement $element)
{
$output = $this->_asData($element);
if (!$element->count()) {
return $output;
}
return $this->_pushArray($output, $element);
} | [
"protected",
"function",
"_asArray",
"(",
"\\",
"SimpleXMLElement",
"$",
"element",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"_asData",
"(",
"$",
"element",
")",
";",
"if",
"(",
"!",
"$",
"element",
"->",
"count",
"(",
")",
")",
"{",
"return"... | @param \SimpleXMLElement $element
@return array|string
@codeCoverageIgnore | [
"@param",
"\\",
"SimpleXMLElement",
"$element"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L178-L187 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader._pushArray | protected function _pushArray(array &$output, \SimpleXMLElement $element): array
{
$first = [];
/**
* @var \SimpleXMLElement $item
*/
foreach ($element as $key => $item)
{
if (!isset($output[$key])) {
$first[$key] = true;
... | php | protected function _pushArray(array &$output, \SimpleXMLElement $element): array
{
$first = [];
/**
* @var \SimpleXMLElement $item
*/
foreach ($element as $key => $item)
{
if (!isset($output[$key])) {
$first[$key] = true;
... | [
"protected",
"function",
"_pushArray",
"(",
"array",
"&",
"$",
"output",
",",
"\\",
"SimpleXMLElement",
"$",
"element",
")",
":",
"array",
"{",
"$",
"first",
"=",
"[",
"]",
";",
"/**\n * @var \\SimpleXMLElement $item\n */",
"foreach",
"(",
"$",
"... | @param array $output
@param \SimpleXMLElement $element
@return array
@codeCoverageIgnore | [
"@param",
"array",
"$output",
"@param",
"\\",
"SimpleXMLElement",
"$element"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L197-L221 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader._simpleXml | protected function _simpleXml($mixed): \SimpleXMLElement
{
if ($mixed instanceof \DOMNode) {
return \simplexml_import_dom($mixed);
}
if (File::isFile($mixed))
{
$mixed = \file_get_contents($mixed);
}
return \simplexml_load_string($mixed);
... | php | protected function _simpleXml($mixed): \SimpleXMLElement
{
if ($mixed instanceof \DOMNode) {
return \simplexml_import_dom($mixed);
}
if (File::isFile($mixed))
{
$mixed = \file_get_contents($mixed);
}
return \simplexml_load_string($mixed);
... | [
"protected",
"function",
"_simpleXml",
"(",
"$",
"mixed",
")",
":",
"\\",
"SimpleXMLElement",
"{",
"if",
"(",
"$",
"mixed",
"instanceof",
"\\",
"DOMNode",
")",
"{",
"return",
"\\",
"simplexml_import_dom",
"(",
"$",
"mixed",
")",
";",
"}",
"if",
"(",
"Fil... | @param string|\DOMNode $mixed
@return \SimpleXMLElement
@codeCoverageIgnore | [
"@param",
"string|",
"\\",
"DOMNode",
"$mixed"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L230-L242 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.asArray | public function asArray($mixed): ?array
{
$data = $this->_simpleXml($mixed);
return $data ? $this->_asArray($data) : null;
} | php | public function asArray($mixed): ?array
{
$data = $this->_simpleXml($mixed);
return $data ? $this->_asArray($data) : null;
} | [
"public",
"function",
"asArray",
"(",
"$",
"mixed",
")",
":",
"?",
"array",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_simpleXml",
"(",
"$",
"mixed",
")",
";",
"return",
"$",
"data",
"?",
"$",
"this",
"->",
"_asArray",
"(",
"$",
"data",
")",
":"... | @param string|\DOMNode $mixed
@return array|null | [
"@param",
"string|",
"\\",
"DOMNode",
"$mixed"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L249-L253 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.asXML | public function asXML($storage, string $name = null, array $attributes = []): string
{
$storage = $this->fragments($storage);
$element = $this->element($name ?? $this->options()->getRootName());
$this->addAttributes($element, $attributes);
$this->document()->appendChild($element);
... | php | public function asXML($storage, string $name = null, array $attributes = []): string
{
$storage = $this->fragments($storage);
$element = $this->element($name ?? $this->options()->getRootName());
$this->addAttributes($element, $attributes);
$this->document()->appendChild($element);
... | [
"public",
"function",
"asXML",
"(",
"$",
"storage",
",",
"string",
"$",
"name",
"=",
"null",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
":",
"string",
"{",
"$",
"storage",
"=",
"$",
"this",
"->",
"fragments",
"(",
"$",
"storage",
")",
";"... | @param array|\Traversable $storage
@param string $name
@param array $attributes
@return string | [
"@param",
"array|",
"\\",
"Traversable",
"$storage",
"@param",
"string",
"$name",
"@param",
"array",
"$attributes"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L286-L299 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.convert | protected function convert(DOMElement $element, $storage): void
{
if (\is_object($storage)) {
$element->appendChild($element->ownerDocument->importNode($storage));
return;
}
if (!\is_array($storage)) {
$element->nodeValue = \htmlspecialchars($storage);
... | php | protected function convert(DOMElement $element, $storage): void
{
if (\is_object($storage)) {
$element->appendChild($element->ownerDocument->importNode($storage));
return;
}
if (!\is_array($storage)) {
$element->nodeValue = \htmlspecialchars($storage);
... | [
"protected",
"function",
"convert",
"(",
"DOMElement",
"$",
"element",
",",
"$",
"storage",
")",
":",
"void",
"{",
"if",
"(",
"\\",
"is_object",
"(",
"$",
"storage",
")",
")",
"{",
"$",
"element",
"->",
"appendChild",
"(",
"$",
"element",
"->",
"ownerD... | @param DOMElement $element
@param mixed $storage
@throws Exceptions\Blank
@codeCoverageIgnore | [
"@param",
"DOMElement",
"$element",
"@param",
"mixed",
"$storage"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L309-L336 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.addNodeWithKey | protected function addNodeWithKey($key, DOMElement $element, $storage): void
{
if ($key === '@attributes') {
$this->addAttributes($element, $storage);
return;
}
if ($key === '@value') {
if (\is_string($storage)) {
$element->nodeValue = $s... | php | protected function addNodeWithKey($key, DOMElement $element, $storage): void
{
if ($key === '@attributes') {
$this->addAttributes($element, $storage);
return;
}
if ($key === '@value') {
if (\is_string($storage)) {
$element->nodeValue = $s... | [
"protected",
"function",
"addNodeWithKey",
"(",
"$",
"key",
",",
"DOMElement",
"$",
"element",
",",
"$",
"storage",
")",
":",
"void",
"{",
"if",
"(",
"$",
"key",
"===",
"'@attributes'",
")",
"{",
"$",
"this",
"->",
"addAttributes",
"(",
"$",
"element",
... | @param string $key
@param DOMElement $element
@param mixed $storage
@codeCoverageIgnore | [
"@param",
"string",
"$key",
"@param",
"DOMElement",
"$element",
"@param",
"mixed",
"$storage"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L360-L390 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.sequential | protected function sequential(DOMElement $element, $storage): void
{
if (\is_array($storage)) {
$this->addCollectionNode($element, $storage);
return;
}
$this->addSequentialNode($element, $storage);
} | php | protected function sequential(DOMElement $element, $storage): void
{
if (\is_array($storage)) {
$this->addCollectionNode($element, $storage);
return;
}
$this->addSequentialNode($element, $storage);
} | [
"protected",
"function",
"sequential",
"(",
"DOMElement",
"$",
"element",
",",
"$",
"storage",
")",
":",
"void",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"storage",
")",
")",
"{",
"$",
"this",
"->",
"addCollectionNode",
"(",
"$",
"element",
",",
"$"... | @param DOMElement $element
@param mixed $storage
@codeCoverageIgnore | [
"@param",
"DOMElement",
"$element",
"@param",
"mixed",
"$storage"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L398-L406 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.addNode | protected function addNode(DOMElement $element, $key, $value): void
{
$key = \str_replace(' ', '-', $key);
$child = $this->element($key);
$element->appendChild($child);
$this->convert($child, $value);
} | php | protected function addNode(DOMElement $element, $key, $value): void
{
$key = \str_replace(' ', '-', $key);
$child = $this->element($key);
$element->appendChild($child);
$this->convert($child, $value);
} | [
"protected",
"function",
"addNode",
"(",
"DOMElement",
"$",
"element",
",",
"$",
"key",
",",
"$",
"value",
")",
":",
"void",
"{",
"$",
"key",
"=",
"\\",
"str_replace",
"(",
"' '",
",",
"'-'",
",",
"$",
"key",
")",
";",
"$",
"child",
"=",
"$",
"th... | @param DOMElement $element
@param string $key
@param mixed $value
@throws Exceptions\Blank
@codeCoverageIgnore | [
"@param",
"DOMElement",
"$element",
"@param",
"string",
"$key",
"@param",
"mixed",
"$value"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L417-L423 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.addCollectionNode | protected function addCollectionNode(DOMElement $element, $value): void
{
if ($element->childNodes->length === 0) {
$this->convert($element, $value);
return;
}
/**
* @var $child DOMElement
*/
$child = $this->element($element->nodeName);
... | php | protected function addCollectionNode(DOMElement $element, $value): void
{
if ($element->childNodes->length === 0) {
$this->convert($element, $value);
return;
}
/**
* @var $child DOMElement
*/
$child = $this->element($element->nodeName);
... | [
"protected",
"function",
"addCollectionNode",
"(",
"DOMElement",
"$",
"element",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"$",
"element",
"->",
"childNodes",
"->",
"length",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"convert",
"(",
"$",
"ele... | @param DOMElement $element
@param mixed $value
@throws Exceptions\Blank
@codeCoverageIgnore | [
"@param",
"DOMElement",
"$element",
"@param",
"mixed",
"$value"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L433-L446 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.addSequentialNode | protected function addSequentialNode(DOMElement $element, $value): void
{
if (empty($element->nodeValue)) {
$element->nodeValue = \htmlspecialchars($value);
return;
}
$child = $this->element($element->nodeName);
$child->nodeValue = \htmlspecialchars($value);
... | php | protected function addSequentialNode(DOMElement $element, $value): void
{
if (empty($element->nodeValue)) {
$element->nodeValue = \htmlspecialchars($value);
return;
}
$child = $this->element($element->nodeName);
$child->nodeValue = \htmlspecialchars($value);
... | [
"protected",
"function",
"addSequentialNode",
"(",
"DOMElement",
"$",
"element",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"empty",
"(",
"$",
"element",
"->",
"nodeValue",
")",
")",
"{",
"$",
"element",
"->",
"nodeValue",
"=",
"\\",
"htmlspeci... | @param DOMElement $element
@param mixed $value
@codeCoverageIgnore | [
"@param",
"DOMElement",
"$element",
"@param",
"mixed",
"$value"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L454-L464 |
bavix/xml | src/XMLReader/XMLReader.php | XMLReader.addAttributes | protected function addAttributes(DOMElement $element, $storage): void
{
foreach ($storage as $attrKey => $attrVal) {
if (strpos($attrKey, ':') !== false) {
$this->namespaces[$attrKey] = $attrVal;
}
$element->setAttribute($attrKey, $attrVal);
}
... | php | protected function addAttributes(DOMElement $element, $storage): void
{
foreach ($storage as $attrKey => $attrVal) {
if (strpos($attrKey, ':') !== false) {
$this->namespaces[$attrKey] = $attrVal;
}
$element->setAttribute($attrKey, $attrVal);
}
... | [
"protected",
"function",
"addAttributes",
"(",
"DOMElement",
"$",
"element",
",",
"$",
"storage",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"storage",
"as",
"$",
"attrKey",
"=>",
"$",
"attrVal",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"attrKey",
","... | @param DOMElement $element
@param array|\Traversable $storage
@codeCoverageIgnore | [
"@param",
"DOMElement",
"$element",
"@param",
"array|",
"\\",
"Traversable",
"$storage"
] | train | https://github.com/bavix/xml/blob/c329f16863260e7fd822d2d8b24ee47426f8224d/src/XMLReader/XMLReader.php#L472-L481 |
devture/dbal | src/Devture/Component/DBAL/Repository/BaseRepository.php | BaseRepository.createModel | public function createModel(array $data) {
if (!isset($data['_id'])) {
return $this->hydrateModel($data);
}
$id = (string) $data['_id'];
if (!isset($this->models[$id])) {
$this->models[$id] = $this->hydrateModel($data);
}
return $this->models[$id];
} | php | public function createModel(array $data) {
if (!isset($data['_id'])) {
return $this->hydrateModel($data);
}
$id = (string) $data['_id'];
if (!isset($this->models[$id])) {
$this->models[$id] = $this->hydrateModel($data);
}
return $this->models[$id];
} | [
"public",
"function",
"createModel",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'_id'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"hydrateModel",
"(",
"$",
"data",
")",
";",
"}",
"$",
"id",
"=",
... | Creates a new model from the data the first time it's called.
If called subsequently for the same id, it will return a reference to the first
object, no matter what $data contains this run.
@see \Devture\Component\DBAL\Repository\RepositoryInterface::createModel()
@param array $data
@return BaseModel | [
"Creates",
"a",
"new",
"model",
"from",
"the",
"data",
"the",
"first",
"time",
"it",
"s",
"called",
".",
"If",
"called",
"subsequently",
"for",
"the",
"same",
"id",
"it",
"will",
"return",
"a",
"reference",
"to",
"the",
"first",
"object",
"no",
"matter",... | train | https://github.com/devture/dbal/blob/e2538d13baf9220fc388a48596acd176cd2bb42f/src/Devture/Component/DBAL/Repository/BaseRepository.php#L21-L31 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.newUserModel | protected function newUserModel($username, $password, array $options = [])
{
$user = new User();
$user->username = $username;
$user->password = $password;
foreach ($options as $key => $value) {
$user->{$key} = $value;
}
return $user;
} | php | protected function newUserModel($username, $password, array $options = [])
{
$user = new User();
$user->username = $username;
$user->password = $password;
foreach ($options as $key => $value) {
$user->{$key} = $value;
}
return $user;
} | [
"protected",
"function",
"newUserModel",
"(",
"$",
"username",
",",
"$",
"password",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"user",
"=",
"new",
"User",
"(",
")",
";",
"$",
"user",
"->",
"username",
"=",
"$",
"username",
";",
"$... | Create new user model instance
@param string $username
@param string $password
@param array $options
@return \ViKon\Auth\Model\User | [
"Create",
"new",
"user",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L28-L39 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.createUserModel | protected function createUserModel($username, $password, array $options = [])
{
$user = $this->newUserModel($username, $password, $options);
$user->save();
return $user;
} | php | protected function createUserModel($username, $password, array $options = [])
{
$user = $this->newUserModel($username, $password, $options);
$user->save();
return $user;
} | [
"protected",
"function",
"createUserModel",
"(",
"$",
"username",
",",
"$",
"password",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"newUserModel",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
... | Create and store in database new user model instance
@param string $username
@param string $password
@param array $options
@return \ViKon\Auth\Model\User | [
"Create",
"and",
"store",
"in",
"database",
"new",
"user",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L50-L56 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.createUserRecord | protected function createUserRecord($username, $password, array $options = [])
{
return [
// Username
User::FIELD_USERNAME => $username,
// Password
User::FIELD_PASSWORD => bcrypt($password),
// Email
User::FIELD_EMAIL => array_key_e... | php | protected function createUserRecord($username, $password, array $options = [])
{
return [
// Username
User::FIELD_USERNAME => $username,
// Password
User::FIELD_PASSWORD => bcrypt($password),
// Email
User::FIELD_EMAIL => array_key_e... | [
"protected",
"function",
"createUserRecord",
"(",
"$",
"username",
",",
"$",
"password",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"[",
"// Username",
"User",
"::",
"FIELD_USERNAME",
"=>",
"$",
"username",
",",
"// Password",
"User",
... | Create single user record
@param string $username authentication username
@param string $password authentication password
@param array $options additional column values
@return array array with user field values | [
"Create",
"single",
"user",
"record"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L67-L95 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.newGroupModel | protected function newGroupModel($token, array $options = [])
{
$group = new Group();
$group->token = $token;
foreach ($options as $key => $value) {
$group->{$key} = $value;
}
return $group;
} | php | protected function newGroupModel($token, array $options = [])
{
$group = new Group();
$group->token = $token;
foreach ($options as $key => $value) {
$group->{$key} = $value;
}
return $group;
} | [
"protected",
"function",
"newGroupModel",
"(",
"$",
"token",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"group",
"=",
"new",
"Group",
"(",
")",
";",
"$",
"group",
"->",
"token",
"=",
"$",
"token",
";",
"foreach",
"(",
"$",
"options... | Create new group model instance
@param string $token group token
@param array $options additional column valuesF
@return \ViKon\Auth\Model\Group | [
"Create",
"new",
"group",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L105-L115 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.createGroupModel | protected function createGroupModel($token, array $options = [])
{
$group = $this->newGroupModel($token, $options);
$group->save();
return $group;
} | php | protected function createGroupModel($token, array $options = [])
{
$group = $this->newGroupModel($token, $options);
$group->save();
return $group;
} | [
"protected",
"function",
"createGroupModel",
"(",
"$",
"token",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"group",
"=",
"$",
"this",
"->",
"newGroupModel",
"(",
"$",
"token",
",",
"$",
"options",
")",
";",
"$",
"group",
"->",
"save"... | Create and store in database new group model instance
@param string $token group token
@param array $options additional column values
@return \ViKon\Auth\Model\Group | [
"Create",
"and",
"store",
"in",
"database",
"new",
"group",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L125-L131 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.newRoleModel | protected function newRoleModel($token, array $options = [])
{
$role = new Role();
$role->token = $token;
foreach ($options as $key => $value) {
$role->{$key} = $value;
}
return $role;
} | php | protected function newRoleModel($token, array $options = [])
{
$role = new Role();
$role->token = $token;
foreach ($options as $key => $value) {
$role->{$key} = $value;
}
return $role;
} | [
"protected",
"function",
"newRoleModel",
"(",
"$",
"token",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"role",
"=",
"new",
"Role",
"(",
")",
";",
"$",
"role",
"->",
"token",
"=",
"$",
"token",
";",
"foreach",
"(",
"$",
"options",
... | Create new role model instance
@param string $token role token
@param array $options additional column valuesF
@return \ViKon\Auth\Model\Role | [
"Create",
"new",
"role",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L141-L151 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.createRoleModel | protected function createRoleModel($token, array $options = [])
{
$role = $this->newRoleModel($token, $options);
$role->save();
return $role;
} | php | protected function createRoleModel($token, array $options = [])
{
$role = $this->newRoleModel($token, $options);
$role->save();
return $role;
} | [
"protected",
"function",
"createRoleModel",
"(",
"$",
"token",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"newRoleModel",
"(",
"$",
"token",
",",
"$",
"options",
")",
";",
"$",
"role",
"->",
"save",
... | Create and store in database new role model instance
@param string $token role token
@param array $options additional column values
@return \ViKon\Auth\Model\Role | [
"Create",
"and",
"store",
"in",
"database",
"new",
"role",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L161-L167 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.newPermissionModel | protected function newPermissionModel($token, array $options = [])
{
$permission = new Permission();
$permission->token = $token;
foreach ($options as $key => $value) {
$permission->{$key} = $value;
}
return $permission;
} | php | protected function newPermissionModel($token, array $options = [])
{
$permission = new Permission();
$permission->token = $token;
foreach ($options as $key => $value) {
$permission->{$key} = $value;
}
return $permission;
} | [
"protected",
"function",
"newPermissionModel",
"(",
"$",
"token",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"permission",
"=",
"new",
"Permission",
"(",
")",
";",
"$",
"permission",
"->",
"token",
"=",
"$",
"token",
";",
"foreach",
"(... | Create new permission model instance
@param string $token
@param array $options
@return \ViKon\Auth\Model\Permission | [
"Create",
"new",
"permission",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L177-L187 |
vi-kon/laravel-auth | src/ViKon/Auth/AuthSeederTrait.php | AuthSeederTrait.createPermissionModel | protected function createPermissionModel($token, array $options = [])
{
$permission = $this->newPermissionModel($token, $options);
$permission->save();
return $permission;
} | php | protected function createPermissionModel($token, array $options = [])
{
$permission = $this->newPermissionModel($token, $options);
$permission->save();
return $permission;
} | [
"protected",
"function",
"createPermissionModel",
"(",
"$",
"token",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"permission",
"=",
"$",
"this",
"->",
"newPermissionModel",
"(",
"$",
"token",
",",
"$",
"options",
")",
";",
"$",
"permissio... | Create and store in database new permission model instance
@param string $token
@param array $options
@return \ViKon\Auth\Model\Permission | [
"Create",
"and",
"store",
"in",
"database",
"new",
"permission",
"model",
"instance"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/AuthSeederTrait.php#L197-L203 |
webforge-labs/psc-cms | lib/Psc/Code/Compile/AddPropertyExtension.php | AddPropertyExtension.compile | public function compile(GClass $gClass, $flags = 0x000000) {
// das ist okay, wenn man getters oder setters oder den constructor adden will (imo)
//if ($gClass->hasProperty($this->property->name)) {
// throw new \InvalidArgumentException('Property: '.$this->property->name. ' besteht bereits in Klasse '.$gC... | php | public function compile(GClass $gClass, $flags = 0x000000) {
// das ist okay, wenn man getters oder setters oder den constructor adden will (imo)
//if ($gClass->hasProperty($this->property->name)) {
// throw new \InvalidArgumentException('Property: '.$this->property->name. ' besteht bereits in Klasse '.$gC... | [
"public",
"function",
"compile",
"(",
"GClass",
"$",
"gClass",
",",
"$",
"flags",
"=",
"0x000000",
")",
"{",
"// das ist okay, wenn man getters oder setters oder den constructor adden will (imo)",
"//if ($gClass->hasProperty($this->property->name)) {",
"// throw new \\InvalidArgumen... | Fügt ein Property hinzu
added das Property, seine Setter und gegebenfalls auch einen Eintrag im Constructor | [
"Fügt",
"ein",
"Property",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Compile/AddPropertyExtension.php#L68-L123 |
inpsyde/inpsyde-filter | src/WordPress/EscHtml.php | EscHtml.filter | public function filter( $value ) {
if ( ! is_scalar( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not scalar or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return esc_html( (string) $value );
} | php | public function filter( $value ) {
if ( ! is_scalar( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not scalar or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return esc_html( (string) $value );
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"do_action",
"(",
"'inpsyde.filter.error'",
",",
"'The given value is not scalar or empty.'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/WordPress/EscHtml.php#L17-L26 |
webforge-labs/psc-cms | lib/Psc/TPL/TPL.php | TPL.get | public static function get($tpl, Array $__variablesDefinitions = NULL, $__indent = NULL) {
$tpl = new Template($tpl);
$tpl->setLanguage(Config::req('i18n.language'));
$tpl->setVars($__variablesDefinitions);
//if (FALSE) {
// print 'Variables for "'.$__templateName.'": '."\n";
// prin... | php | public static function get($tpl, Array $__variablesDefinitions = NULL, $__indent = NULL) {
$tpl = new Template($tpl);
$tpl->setLanguage(Config::req('i18n.language'));
$tpl->setVars($__variablesDefinitions);
//if (FALSE) {
// print 'Variables for "'.$__templateName.'": '."\n";
// prin... | [
"public",
"static",
"function",
"get",
"(",
"$",
"tpl",
",",
"Array",
"$",
"__variablesDefinitions",
"=",
"NULL",
",",
"$",
"__indent",
"=",
"NULL",
")",
"{",
"$",
"tpl",
"=",
"new",
"Template",
"(",
"$",
"tpl",
")",
";",
"$",
"tpl",
"->",
"setLangua... | Inkludiert ein Template und gibt das HTML zurück
Das Template wird inkludiert und das ausgegebene HTML als String zurückgegeben.<br />
Nur die definierten Variablen in <var>$__variablesDefinitions</var> werden an das Template weitergereicht.<br />
Im Template werden Smarty ähmliche Variablen Bezeichner wie z.b. {$tit... | [
"Inkludiert",
"ein",
"Template",
"und",
"gibt",
"das",
"HTML",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/TPL.php#L29-L42 |
webforge-labs/psc-cms | lib/Psc/TPL/TPL.php | TPL.display | public static function display($tpl, $variablesDefinitions = NULL, $indent = NULL) {
$html = self::get($tpl, $variablesDefinitions, $indent);
print $html;
} | php | public static function display($tpl, $variablesDefinitions = NULL, $indent = NULL) {
$html = self::get($tpl, $variablesDefinitions, $indent);
print $html;
} | [
"public",
"static",
"function",
"display",
"(",
"$",
"tpl",
",",
"$",
"variablesDefinitions",
"=",
"NULL",
",",
"$",
"indent",
"=",
"NULL",
")",
"{",
"$",
"html",
"=",
"self",
"::",
"get",
"(",
"$",
"tpl",
",",
"$",
"variablesDefinitions",
",",
"$",
... | Inkludiert ein Template
Gibt die Rückgabe von template_get aus.
@param mixed $tpl
@param array $variablesDefinitions
@param int $indent wie weit der Quelltext eingerückt werden soll
@see template_get | [
"Inkludiert",
"ein",
"Template"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/TPL.php#L53-L56 |
SURFnet/messagebird-api-client-bundle | src/Surfnet/MessageBirdApiClient/Messaging/MessagingService.php | MessagingService.send | public function send(Message $message)
{
$response = $this->guzzleClient->post('/messages', [
'json' => [
'originator' => $message->getOriginator(),
'recipients' => $message->getRecipient(),
'body' => $message->getBody(),
],
... | php | public function send(Message $message)
{
$response = $this->guzzleClient->post('/messages', [
'json' => [
'originator' => $message->getOriginator(),
'recipients' => $message->getRecipient(),
'body' => $message->getBody(),
],
... | [
"public",
"function",
"send",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"guzzleClient",
"->",
"post",
"(",
"'/messages'",
",",
"[",
"'json'",
"=>",
"[",
"'originator'",
"=>",
"$",
"message",
"->",
"getOriginator",
... | @param Message $message
@return SendMessageResult
@throws ApiRuntimeException
@throws TransferException Thrown by Guzzle during communication failure or unexpected server behaviour. | [
"@param",
"Message",
"$message",
"@return",
"SendMessageResult"
] | train | https://github.com/SURFnet/messagebird-api-client-bundle/blob/50f3bc942f3313e218c54270b64fc23cbcd768c4/src/Surfnet/MessageBirdApiClient/Messaging/MessagingService.php#L50-L86 |
cohesion/cohesion-core | src/Config/Config.php | Config.load | public function load($data, $key = null) {
if ($key) {
if (isset($this->data[$key])) {
$this->data[$key] = self::array_merge_recursive_unique($this->data[$key], $data);
} else {
$this->data[$key] = $data;
}
} else {
if (is_a... | php | public function load($data, $key = null) {
if ($key) {
if (isset($this->data[$key])) {
$this->data[$key] = self::array_merge_recursive_unique($this->data[$key], $data);
} else {
$this->data[$key] = $data;
}
} else {
if (is_a... | [
"public",
"function",
"load",
"(",
"$",
"data",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"this",
"->",
"data",
"["... | Load from array | [
"Load",
"from",
"array"
] | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Config/Config.php#L45-L57 |
cohesion/cohesion-core | src/Config/Config.php | Config.add | public function add($key, $value) {
if (isset($this->data[$key])) {
throw new \InvalidArgumentException("Key $key is already set");
}
$this->data[$key] = $value;
} | php | public function add($key, $value) {
if (isset($this->data[$key])) {
throw new \InvalidArgumentException("Key $key is already set");
}
$this->data[$key] = $value;
} | [
"public",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Key $key is already set\"",
")... | Add a new key value pairing.
@throws InvalidArgumentException if the key is already set | [
"Add",
"a",
"new",
"key",
"value",
"pairing",
"."
] | train | https://github.com/cohesion/cohesion-core/blob/c6352aef7336e06285f0943da68235dc45523998/src/Config/Config.php#L64-L69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.