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 |
|---|---|---|---|---|---|---|---|---|---|---|
ufocoder/yii2-SyncSocial | src/SyncService.php | SyncService.isArrayHasKeys | protected function isArrayHasKeys($array = [], $keys = []) {
foreach ($keys as $key) {
if (!ArrayHelper::getValue($array, $key, false)) {
return false;
}
}
return true;
} | php | protected function isArrayHasKeys($array = [], $keys = []) {
foreach ($keys as $key) {
if (!ArrayHelper::getValue($array, $key, false)) {
return false;
}
}
return true;
} | [
"protected",
"function",
"isArrayHasKeys",
"(",
"$",
"array",
"=",
"[",
"]",
",",
"$",
"keys",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"array",
"... | Check if array has keys (include path keys like a.b.c)
@param array $array
@param array $keys
@return bool | [
"Check",
"if",
"array",
"has",
"keys",
"(",
"include",
"path",
"keys",
"like",
"a",
".",
"b",
".",
"c",
")"
] | train | https://github.com/ufocoder/yii2-SyncSocial/blob/2dbaaec2dad782c52fdd5b648a31ba7fe2a75e1b/src/SyncService.php#L191-L199 |
ufocoder/yii2-SyncSocial | src/SyncService.php | SyncService.parsePublishPost | protected function parsePublishPost($response, $indexAttribute = null, $postAttributes = []) {
if (ArrayHelper::getValue($response, $indexAttribute)) {
$time_created = ArrayHelper::getValue($response, $postAttributes['time_created']);
return [
'service_id_author' => ArrayHelper::getValue($response, $postAt... | php | protected function parsePublishPost($response, $indexAttribute = null, $postAttributes = []) {
if (ArrayHelper::getValue($response, $indexAttribute)) {
$time_created = ArrayHelper::getValue($response, $postAttributes['time_created']);
return [
'service_id_author' => ArrayHelper::getValue($response, $postAt... | [
"protected",
"function",
"parsePublishPost",
"(",
"$",
"response",
",",
"$",
"indexAttribute",
"=",
"null",
",",
"$",
"postAttributes",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"response",
",",
"$",
"indexAttribute",
"... | @param $response
@param string $indexAttribute
@param array $postAttributes
@return array | [
"@param",
"$response",
"@param",
"string",
"$indexAttribute",
"@param",
"array",
"$postAttributes"
] | train | https://github.com/ufocoder/yii2-SyncSocial/blob/2dbaaec2dad782c52fdd5b648a31ba7fe2a75e1b/src/SyncService.php#L208-L221 |
ufocoder/yii2-SyncSocial | src/SyncService.php | SyncService.parseGetPosts | protected function parseGetPosts($response, $indexAttribute = null, $existsAttributes = [], $postAttributes = []) {
$posts = $indexAttribute === null ? $response : ArrayHelper::getValue($response, $indexAttribute);
if (empty($posts)) {
return null;
}
$list = [];
foreach ($posts as $post) {
if ($this-... | php | protected function parseGetPosts($response, $indexAttribute = null, $existsAttributes = [], $postAttributes = []) {
$posts = $indexAttribute === null ? $response : ArrayHelper::getValue($response, $indexAttribute);
if (empty($posts)) {
return null;
}
$list = [];
foreach ($posts as $post) {
if ($this-... | [
"protected",
"function",
"parseGetPosts",
"(",
"$",
"response",
",",
"$",
"indexAttribute",
"=",
"null",
",",
"$",
"existsAttributes",
"=",
"[",
"]",
",",
"$",
"postAttributes",
"=",
"[",
"]",
")",
"{",
"$",
"posts",
"=",
"$",
"indexAttribute",
"===",
"n... | @param $response
@param string $indexAttribute
@param array $existsAttributes
@param array $postAttributes
@return array|null | [
"@param",
"$response",
"@param",
"string",
"$indexAttribute",
"@param",
"array",
"$existsAttributes",
"@param",
"array",
"$postAttributes"
] | train | https://github.com/ufocoder/yii2-SyncSocial/blob/2dbaaec2dad782c52fdd5b648a31ba7fe2a75e1b/src/SyncService.php#L231-L255 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.createAction | public function createAction(Request $request)
{
$oCustomer = new Customer();
// create customerform for validation
$oForm = $this->createCreateForm($oCustomer);
$oForm->handleRequest($request);
if ($oForm->isValid()) {
// handle logo... | php | public function createAction(Request $request)
{
$oCustomer = new Customer();
// create customerform for validation
$oForm = $this->createCreateForm($oCustomer);
$oForm->handleRequest($request);
if ($oForm->isValid()) {
// handle logo... | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"oCustomer",
"=",
"new",
"Customer",
"(",
")",
";",
"// create customerform for validation",
"$",
"oForm",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"oCustomer",
"... | Create new customer
@param \Symfony\Component\HttpFoundation\Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
@throws \Exception
@throws \PropelException | [
"Create",
"new",
"customer"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L75-L99 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.modalInfoAction | public function modalInfoAction($id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
return $this->render('SlashworksAppBundle:Customer:modal_info.html.twig', array(
'customer' => $oCustomer
));
... | php | public function modalInfoAction($id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
return $this->render('SlashworksAppBundle:Customer:modal_info.html.twig', array(
'customer' => $oCustomer
));
... | [
"public",
"function",
"modalInfoAction",
"(",
"$",
"id",
")",
"{",
"/** @var Customer $oCustomer */",
"$",
"oCustomer",
"=",
"CustomerQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",... | Modal info window for customerinformations
@param int $id
@return \Symfony\Component\HttpFoundation\Response | [
"Modal",
"info",
"window",
"for",
"customerinformations"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L109-L119 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.newAction | public function newAction()
{
$oCustomer = new Customer();
$form = $this->createCreateForm($oCustomer);
return $this->render('SlashworksAppBundle:Customer:new.html.twig', array(
'entity' => $oCustomer,
'form' => $form->createView(),
... | php | public function newAction()
{
$oCustomer = new Customer();
$form = $this->createCreateForm($oCustomer);
return $this->render('SlashworksAppBundle:Customer:new.html.twig', array(
'entity' => $oCustomer,
'form' => $form->createView(),
... | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"oCustomer",
"=",
"new",
"Customer",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"oCustomer",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'Slashwork... | Displays a form to create a new Customer entity.
@return \Symfony\Component\HttpFoundation\Response | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"Customer",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L127-L137 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.editAction | public function editAction($id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
if (count($oCustomer) === 0) {
throw $this->createNotFoundException('Unable to find Customer entity.');
}
$oEdi... | php | public function editAction($id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
if (count($oCustomer) === 0) {
throw $this->createNotFoundException('Unable to find Customer entity.');
}
$oEdi... | [
"public",
"function",
"editAction",
"(",
"$",
"id",
")",
"{",
"/** @var Customer $oCustomer */",
"$",
"oCustomer",
"=",
"CustomerQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"count",
"(",
"$",
"oCustomer",
")"... | Displays a form to edit an existing Customer entity.
@param int $id
@return \Symfony\Component\HttpFoundation\Response | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"Customer",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L147-L165 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.updateAction | public function updateAction(Request $request, $id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
if (count($oCustomer) === 0) {
throw $this->createNotFoundException('Unable to find Customer entity.');
... | php | public function updateAction(Request $request, $id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
if (count($oCustomer) === 0) {
throw $this->createNotFoundException('Unable to find Customer entity.');
... | [
"public",
"function",
"updateAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"/** @var Customer $oCustomer */",
"$",
"oCustomer",
"=",
"CustomerQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"... | Update existing customer
@param \Symfony\Component\HttpFoundation\Request $request
@param int $id
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response | [
"Update",
"existing",
"customer"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L176-L207 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.deleteAction | public function deleteAction(Request $request, $id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
if ($oCustomer === null) {
throw $this->createNotFoundException('Unable to find Customer entity.');
}
... | php | public function deleteAction(Request $request, $id)
{
/** @var Customer $oCustomer */
$oCustomer = CustomerQuery::create()->findOneById($id);
if ($oCustomer === null) {
throw $this->createNotFoundException('Unable to find Customer entity.');
}
... | [
"public",
"function",
"deleteAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"/** @var Customer $oCustomer */",
"$",
"oCustomer",
"=",
"CustomerQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"... | Delete customer
@param \Symfony\Component\HttpFoundation\Request $request
@param $id
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Delete",
"customer"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L218-L231 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController._handleLogoUpload | private function _handleLogoUpload(Request &$request, Customer &$oCustomer)
{
$sLogoPath = "";
/** @var FileBag $t */
$oFiles = $request->files;
$aFiles = $oFiles->get("slashworks_appbundle_customer");
$sUploadPath = __DIR__ . "/../../../..... | php | private function _handleLogoUpload(Request &$request, Customer &$oCustomer)
{
$sLogoPath = "";
/** @var FileBag $t */
$oFiles = $request->files;
$aFiles = $oFiles->get("slashworks_appbundle_customer");
$sUploadPath = __DIR__ . "/../../../..... | [
"private",
"function",
"_handleLogoUpload",
"(",
"Request",
"&",
"$",
"request",
",",
"Customer",
"&",
"$",
"oCustomer",
")",
"{",
"$",
"sLogoPath",
"=",
"\"\"",
";",
"/** @var FileBag $t */",
"$",
"oFiles",
"=",
"$",
"request",
"->",
"files",
";",
"$",
"a... | Handle Logo uplaod
@param \Symfony\Component\HttpFoundation\Request $request
@param \Slashworks\AppBundle\Model\Customer $oCustomer
@return string | [
"Handle",
"Logo",
"uplaod"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L242-L267 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.createCreateForm | private function createCreateForm(Customer $oCustomer)
{
$form = $this->createForm(new CustomerType(array("language" => $this->get('request')->getLocale())), $oCustomer, array(
'action' => $this->generateUrl('backend_system_customer_create'),
'method' => 'POST',
... | php | private function createCreateForm(Customer $oCustomer)
{
$form = $this->createForm(new CustomerType(array("language" => $this->get('request')->getLocale())), $oCustomer, array(
'action' => $this->generateUrl('backend_system_customer_create'),
'method' => 'POST',
... | [
"private",
"function",
"createCreateForm",
"(",
"Customer",
"$",
"oCustomer",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CustomerType",
"(",
"array",
"(",
"\"language\"",
"=>",
"$",
"this",
"->",
"get",
"(",
"'request'",
")",... | Creates a form to create a Customer entity.
@param Customer $oCustomer The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"a",
"Customer",
"entity",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L277-L288 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/CustomerController.php | CustomerController.createEditForm | private function createEditForm(Customer $oCustomer)
{
$oForm = $this->createForm(new CustomerType(array("language" => $this->get('request')->getLocale())), $oCustomer, array(
'action' => $this->generateUrl('backend_system_customer_update', array('id' => $oCustomer->getId())),
... | php | private function createEditForm(Customer $oCustomer)
{
$oForm = $this->createForm(new CustomerType(array("language" => $this->get('request')->getLocale())), $oCustomer, array(
'action' => $this->generateUrl('backend_system_customer_update', array('id' => $oCustomer->getId())),
... | [
"private",
"function",
"createEditForm",
"(",
"Customer",
"$",
"oCustomer",
")",
"{",
"$",
"oForm",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CustomerType",
"(",
"array",
"(",
"\"language\"",
"=>",
"$",
"this",
"->",
"get",
"(",
"'request'",
")",
... | Create form for editing customer
@param \Slashworks\AppBundle\Model\Customer $oCustomer
@return \Symfony\Component\Form\Form | [
"Create",
"form",
"for",
"editing",
"customer"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/CustomerController.php#L298-L309 |
mremi/Flowdock | src/Mremi/Flowdock/Api/Push/Push.php | Push.sendChatMessage | public function sendChatMessage(ChatMessageInterface $message, array $options = array())
{
return $this->sendMessage($message, self::BASE_CHAT_URL, $options);
} | php | public function sendChatMessage(ChatMessageInterface $message, array $options = array())
{
return $this->sendMessage($message, self::BASE_CHAT_URL, $options);
} | [
"public",
"function",
"sendChatMessage",
"(",
"ChatMessageInterface",
"$",
"message",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sendMessage",
"(",
"$",
"message",
",",
"self",
"::",
"BASE_CHAT_URL",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/mremi/Flowdock/blob/287bfdcef17529055f803f2316e3ad31826e79eb/src/Mremi/Flowdock/Api/Push/Push.php#L44-L47 |
mremi/Flowdock | src/Mremi/Flowdock/Api/Push/Push.php | Push.sendTeamInboxMessage | public function sendTeamInboxMessage(TeamInboxMessageInterface $message, array $options = array())
{
return $this->sendMessage($message, self::BASE_TEAM_INBOX_URL, $options);
} | php | public function sendTeamInboxMessage(TeamInboxMessageInterface $message, array $options = array())
{
return $this->sendMessage($message, self::BASE_TEAM_INBOX_URL, $options);
} | [
"public",
"function",
"sendTeamInboxMessage",
"(",
"TeamInboxMessageInterface",
"$",
"message",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sendMessage",
"(",
"$",
"message",
",",
"self",
"::",
"BASE_TEAM_INBOX... | {@inheritdoc} | [
"{"
] | train | https://github.com/mremi/Flowdock/blob/287bfdcef17529055f803f2316e3ad31826e79eb/src/Mremi/Flowdock/Api/Push/Push.php#L52-L55 |
mremi/Flowdock | src/Mremi/Flowdock/Api/Push/Push.php | Push.sendMessage | protected function sendMessage(BaseMessageInterface $message, $baseUrl, array $options = array())
{
$client = $this->createClient(sprintf('%s/%s', $baseUrl, $this->flowApiToken));
$response = $client->post(null, array_merge(
$options, [
'headers' => ['Content-Type' => 'a... | php | protected function sendMessage(BaseMessageInterface $message, $baseUrl, array $options = array())
{
$client = $this->createClient(sprintf('%s/%s', $baseUrl, $this->flowApiToken));
$response = $client->post(null, array_merge(
$options, [
'headers' => ['Content-Type' => 'a... | [
"protected",
"function",
"sendMessage",
"(",
"BaseMessageInterface",
"$",
"message",
",",
"$",
"baseUrl",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"client",
"=",
"$",
"this",
"->",
"createClient",
"(",
"sprintf",
"(",
"'%s/%s'",... | Sends a message to a flow
@param BaseMessageInterface $message A message instance to send
@param string $baseUrl A base URL
@param array $options An array of options used by request
@return boolean | [
"Sends",
"a",
"message",
"to",
"a",
"flow"
] | train | https://github.com/mremi/Flowdock/blob/287bfdcef17529055f803f2316e3ad31826e79eb/src/Mremi/Flowdock/Api/Push/Push.php#L66-L80 |
alanpich/slender | src/Core/ConfigFinder/ConfigFinder.php | ConfigFinder.findFiles | public function findFiles()
{
$search = (new Finder())->files();
// Add in paths
foreach ($this->paths as $path) {
if (is_readable($path)) {
$search->in($path);
}
}
// Add in names
foreach ($this->files as $pattern) {
... | php | public function findFiles()
{
$search = (new Finder())->files();
// Add in paths
foreach ($this->paths as $path) {
if (is_readable($path)) {
$search->in($path);
}
}
// Add in names
foreach ($this->files as $pattern) {
... | [
"public",
"function",
"findFiles",
"(",
")",
"{",
"$",
"search",
"=",
"(",
"new",
"Finder",
"(",
")",
")",
"->",
"files",
"(",
")",
";",
"// Add in paths",
"foreach",
"(",
"$",
"this",
"->",
"paths",
"as",
"$",
"path",
")",
"{",
"if",
"(",
"is_read... | Return an array of file paths to config files
@return array of string paths | [
"Return",
"an",
"array",
"of",
"file",
"paths",
"to",
"config",
"files"
] | train | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/ConfigFinder/ConfigFinder.php#L54-L75 |
seeruo/framework | src/Command/PushCommand.php | PushCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$output->writeln([
'<bg=yellow;>Push Script Starting...</>',
'=====================',
]);
$push = new PushService($this->config);
$type = $input-... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$output->writeln([
'<bg=yellow;>Push Script Starting...</>',
'=====================',
]);
$push = new PushService($this->config);
$type = $input-... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"try",
"{",
"$",
"output",
"->",
"writeln",
"(",
"[",
"'<bg=yellow;>Push Script Starting...</>'",
",",
"'====================='",
",",
"]",
")... | [执行命令]
@DateTime 2018-12-13
@param InputInterface $input 输入对象
@param OutputInterface $output 输出对象 | [
"[",
"执行命令",
"]"
] | train | https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Command/PushCommand.php#L36-L54 |
vi-kon/laravel-auth | src/ViKon/Auth/Model/User.php | User.hasRole | public function hasRole($role)
{
if (!$this->roles->where('token', $role)->isEmpty()) {
return true;
}
foreach ($this->groups as $group) {
if (!$group->roles->where('token', $role)->isEmpty()) {
return true;
}
}
return fal... | php | public function hasRole($role)
{
if (!$this->roles->where('token', $role)->isEmpty()) {
return true;
}
foreach ($this->groups as $group) {
if (!$group->roles->where('token', $role)->isEmpty()) {
return true;
}
}
return fal... | [
"public",
"function",
"hasRole",
"(",
"$",
"role",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"roles",
"->",
"where",
"(",
"'token'",
",",
"$",
"role",
")",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"foreach",
"(",
"$",
... | Check if user has given role
@param string $role
@return bool | [
"Check",
"if",
"user",
"has",
"given",
"role"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Model/User.php#L167-L180 |
vi-kon/laravel-auth | src/ViKon/Auth/Model/User.php | User.hasPermission | public function hasPermission($permission)
{
if (!$this->permissions->where('token', $permission)->isEmpty()) {
return true;
}
foreach ($this->groups as $group) {
foreach ($group->roles as $role) {
if (!$role->permissions->where('token', $permission)-... | php | public function hasPermission($permission)
{
if (!$this->permissions->where('token', $permission)->isEmpty()) {
return true;
}
foreach ($this->groups as $group) {
foreach ($group->roles as $role) {
if (!$role->permissions->where('token', $permission)-... | [
"public",
"function",
"hasPermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"permissions",
"->",
"where",
"(",
"'token'",
",",
"$",
"permission",
")",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"f... | Check if user has given permission
@param string $permission
@return bool | [
"Check",
"if",
"user",
"has",
"given",
"permission"
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/ViKon/Auth/Model/User.php#L189-L210 |
nguyenanhung/nusoap | src/soap_transport_http.php | soap_transport_http.setCredentials | function setCredentials($username, $password, $authtype = 'basic', $digestRequest = [], $certRequest = [])
{
$this->debug("setCredentials username=$username authtype=$authtype digestRequest=");
$this->appendDebug($this->varDump($digestRequest));
$this->debug("certRequest=");
$th... | php | function setCredentials($username, $password, $authtype = 'basic', $digestRequest = [], $certRequest = [])
{
$this->debug("setCredentials username=$username authtype=$authtype digestRequest=");
$this->appendDebug($this->varDump($digestRequest));
$this->debug("certRequest=");
$th... | [
"function",
"setCredentials",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"authtype",
"=",
"'basic'",
",",
"$",
"digestRequest",
"=",
"[",
"]",
",",
"$",
"certRequest",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"debug",
"(",
"\"setCredentia... | if authenticating, set user credentials here
@param string $username
@param string $password
@param string $authtype (basic|digest|certificate|ntlm)
@param array $digestRequest (keys must be nonce, nc, realm, qop)
@param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile,... | [
"if",
"authenticating",
"set",
"user",
"credentials",
"here"
] | train | https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/soap_transport_http.php#L494-L561 |
nguyenanhung/nusoap | src/soap_transport_http.php | soap_transport_http.usePersistentConnection | function usePersistentConnection()
{
if (isset($this->outgoing_headers['Accept-Encoding'])) {
return FALSE;
}
$this->protocol_version = '1.1';
$this->persistentConnection = TRUE;
$this->setHeader('Connection', 'Keep-Alive');
return TRUE;
... | php | function usePersistentConnection()
{
if (isset($this->outgoing_headers['Accept-Encoding'])) {
return FALSE;
}
$this->protocol_version = '1.1';
$this->persistentConnection = TRUE;
$this->setHeader('Connection', 'Keep-Alive');
return TRUE;
... | [
"function",
"usePersistentConnection",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"outgoing_headers",
"[",
"'Accept-Encoding'",
"]",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"$",
"this",
"->",
"protocol_version",
"=",
"'1.1'",
";",
"$",
... | specifies that an HTTP persistent connection should be used
@return boolean whether the request was honored by this method.
@access public | [
"specifies",
"that",
"an",
"HTTP",
"persistent",
"connection",
"should",
"be",
"used"
] | train | https://github.com/nguyenanhung/nusoap/blob/a9b4d98f4f3fe748f8e5d9f8091dfc53585d2556/src/soap_transport_http.php#L1244-L1254 |
jenwachter/html-form | src/Elements/Parents/Field.php | Field.extractArgs | public function extractArgs($args)
{
foreach ($args as $k => $v) {
if (property_exists($this, $k)) {
$this->$k = $v;
} else {
throw new \InvalidArgumentException("{$k} is not a valid option.");
}
}
} | php | public function extractArgs($args)
{
foreach ($args as $k => $v) {
if (property_exists($this, $k)) {
$this->$k = $v;
} else {
throw new \InvalidArgumentException("{$k} is not a valid option.");
}
}
} | [
"public",
"function",
"extractArgs",
"(",
"$",
"args",
")",
"{",
"foreach",
"(",
"$",
"args",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"k",
")",
")",
"{",
"$",
"this",
"->",
"$",
"k",
... | Loops through a given array and it the key
exists as a property on this object, it is
assigned.
@param array $args Associative array
@return self | [
"Loops",
"through",
"a",
"given",
"array",
"and",
"it",
"the",
"key",
"exists",
"as",
"a",
"property",
"on",
"this",
"object",
"it",
"is",
"assigned",
"."
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Field.php#L125-L134 |
jenwachter/html-form | src/Elements/Parents/Field.php | Field.getRawValue | public function getRawValue()
{
$name = $this->name;
return !empty($_POST[$name]) ? $_POST[$name] : null;
} | php | public function getRawValue()
{
$name = $this->name;
return !empty($_POST[$name]) ? $_POST[$name] : null;
} | [
"public",
"function",
"getRawValue",
"(",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"name",
";",
"return",
"!",
"empty",
"(",
"$",
"_POST",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"_POST",
"[",
"$",
"name",
"]",
":",
"null",
";",
"}"
] | Get the raw $_POST value of a field
@return string | [
"Get",
"the",
"raw",
"$_POST",
"value",
"of",
"a",
"field"
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Field.php#L152-L156 |
jenwachter/html-form | src/Elements/Parents/Field.php | Field.getDisplayValue | public function getDisplayValue($formid = null)
{
if ($formid && isset($_SESSION[$formid][$this->name])) {
$value = $_SESSION[$formid][$this->name];
} else if (isset($_POST[$this->name])) {
$value = $_POST[$this->name];
} else {
$value = $this->defaultValue;
}
return $this->cleanValue($value);
} | php | public function getDisplayValue($formid = null)
{
if ($formid && isset($_SESSION[$formid][$this->name])) {
$value = $_SESSION[$formid][$this->name];
} else if (isset($_POST[$this->name])) {
$value = $_POST[$this->name];
} else {
$value = $this->defaultValue;
}
return $this->cleanValue($value);
} | [
"public",
"function",
"getDisplayValue",
"(",
"$",
"formid",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"formid",
"&&",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"formid",
"]",
"[",
"$",
"this",
"->",
"name",
"]",
")",
")",
"{",
"$",
"value",
"=",
"$"... | Get the value to display in the form field.
Either the value in the session, post data,
the default value, or nothing.
@param string Form ID
@return [type] [description] | [
"Get",
"the",
"value",
"to",
"display",
"in",
"the",
"form",
"field",
".",
"Either",
"the",
"value",
"in",
"the",
"session",
"post",
"data",
"the",
"default",
"value",
"or",
"nothing",
"."
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Field.php#L165-L176 |
jenwachter/html-form | src/Elements/Parents/Field.php | Field.cleanValue | protected function cleanValue($value)
{
if (is_array($value)) {
return array_map(function ($v) {
return $this->cleanValue($v);
}, $value);
} else {
return stripslashes($value);
}
} | php | protected function cleanValue($value)
{
if (is_array($value)) {
return array_map(function ($v) {
return $this->cleanValue($v);
}, $value);
} else {
return stripslashes($value);
}
} | [
"protected",
"function",
"cleanValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"v",
")",
"{",
"return",
"$",
"this",
"->",
"cleanValue",
"(",
"$",
"v",
... | Clean a value up for repopulation in a form field
@param mixed $value String or array
@return mixed | [
"Clean",
"a",
"value",
"up",
"for",
"repopulation",
"in",
"a",
"form",
"field"
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Field.php#L183-L192 |
jenwachter/html-form | src/Elements/Parents/Field.php | Field.validate | public function validate()
{
$this->errors = array();
$value = $this->getRawValue();
if ($this->required) {
$passed = $this->validateRequired($value);
// don't do anymore validation until it passes the required validation
if (!$passed) return $this->errors;
// validate by field type
$this->val... | php | public function validate()
{
$this->errors = array();
$value = $this->getRawValue();
if ($this->required) {
$passed = $this->validateRequired($value);
// don't do anymore validation until it passes the required validation
if (!$passed) return $this->errors;
// validate by field type
$this->val... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"this",
"->",
"errors",
"=",
"array",
"(",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getRawValue",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"required",
")",
"{",
"$",
"passed",
"=",... | Validate a field
@return boolean TRUE is valid; FALSE if invalid | [
"Validate",
"a",
"field"
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Field.php#L198-L224 |
jenwachter/html-form | src/Elements/Parents/Field.php | Field.validateMaxLength | public function validateMaxLength($value)
{
if (!isset($this->attr["maxlength"])) return true;
$maxlength = trim($this->attr["maxlength"]);
$length = strlen($value);
if ($length > $maxlength) {
$this->errors[] = "\"{$this->label}\" contains {$length} characters, but it is limited to {$maxlength... | php | public function validateMaxLength($value)
{
if (!isset($this->attr["maxlength"])) return true;
$maxlength = trim($this->attr["maxlength"]);
$length = strlen($value);
if ($length > $maxlength) {
$this->errors[] = "\"{$this->label}\" contains {$length} characters, but it is limited to {$maxlength... | [
"public",
"function",
"validateMaxLength",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"\"maxlength\"",
"]",
")",
")",
"return",
"true",
";",
"$",
"maxlength",
"=",
"trim",
"(",
"$",
"this",
"->",
"attr"... | Validates the maximum length of a form element.
@param string $value Current value of form field
@return boolean | [
"Validates",
"the",
"maximum",
"length",
"of",
"a",
"form",
"element",
"."
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Field.php#L248-L261 |
jenwachter/html-form | src/Elements/Parents/Field.php | Field.validatePattern | public function validatePattern($value)
{
if (!isset($this->attr["pattern"])) return true;
$pattern = trim($this->attr["pattern"], "/");
if (!preg_match("/{$pattern}/", $value)) {
$this->errors[] = "\"{$this->label}\" must match the specified pattern.";
return false;
}
return true;
} | php | public function validatePattern($value)
{
if (!isset($this->attr["pattern"])) return true;
$pattern = trim($this->attr["pattern"], "/");
if (!preg_match("/{$pattern}/", $value)) {
$this->errors[] = "\"{$this->label}\" must match the specified pattern.";
return false;
}
return true;
} | [
"public",
"function",
"validatePattern",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"\"pattern\"",
"]",
")",
")",
"return",
"true",
";",
"$",
"pattern",
"=",
"trim",
"(",
"$",
"this",
"->",
"attr",
"[... | Validates a form element with a pattern attribute.
@param string $label Form element label
@param string $value Current value of form field
@param string $element Form element object
@return boolean TRUE if passed validation; FALSE if failed validation | [
"Validates",
"a",
"form",
"element",
"with",
"a",
"pattern",
"attribute",
"."
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Field.php#L282-L294 |
Double-Opt-in/php-client-api | src/Client/Commands/ActionsCommand.php | ActionsCommand.uri | public function uri(CryptographyEngine $cryptographyEngine)
{
$uri = parent::uri($cryptographyEngine);
$params = array(
'hash' => $cryptographyEngine->hash($this->email),
);
if (null !== $this->action)
$params['action'] = $this->action;
if (null !== $this->scope)
$params['scope'] = $this->scope;
... | php | public function uri(CryptographyEngine $cryptographyEngine)
{
$uri = parent::uri($cryptographyEngine);
$params = array(
'hash' => $cryptographyEngine->hash($this->email),
);
if (null !== $this->action)
$params['action'] = $this->action;
if (null !== $this->scope)
$params['scope'] = $this->scope;
... | [
"public",
"function",
"uri",
"(",
"CryptographyEngine",
"$",
"cryptographyEngine",
")",
"{",
"$",
"uri",
"=",
"parent",
"::",
"uri",
"(",
"$",
"cryptographyEngine",
")",
";",
"$",
"params",
"=",
"array",
"(",
"'hash'",
"=>",
"$",
"cryptographyEngine",
"->",
... | returns query parameter
hash: email will be hashed before requesting the server
action: optional action will be transmitted in plain text
scope: optional scope will be transmitted in plain text
@param CryptographyEngine $cryptographyEngine
@return string | [
"returns",
"query",
"parameter"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/ActionsCommand.php#L74-L91 |
Double-Opt-in/php-client-api | src/Client/Commands/ActionsCommand.php | ActionsCommand.response | public function response(Response $response, CryptographyEngine $cryptographyEngine)
{
$decryptedResponse = new DecryptedCommandResponse($response);
$decryptedResponse->assignCryptographyEngine($cryptographyEngine, $this->email);
return $decryptedResponse;
} | php | public function response(Response $response, CryptographyEngine $cryptographyEngine)
{
$decryptedResponse = new DecryptedCommandResponse($response);
$decryptedResponse->assignCryptographyEngine($cryptographyEngine, $this->email);
return $decryptedResponse;
} | [
"public",
"function",
"response",
"(",
"Response",
"$",
"response",
",",
"CryptographyEngine",
"$",
"cryptographyEngine",
")",
"{",
"$",
"decryptedResponse",
"=",
"new",
"DecryptedCommandResponse",
"(",
"$",
"response",
")",
";",
"$",
"decryptedResponse",
"->",
"a... | creates a response from http response
@param Response $response
@param CryptographyEngine $cryptographyEngine
@return DecryptedCommandResponse | [
"creates",
"a",
"response",
"from",
"http",
"response"
] | train | https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Client/Commands/ActionsCommand.php#L113-L120 |
userfriendly/SocialUserBundle | Controller/ProfileController.php | ProfileController.usernameAvailableAction | public function usernameAvailableAction( Request $request )
{
$response = array(
'cssClass' => 'success',
'text' => 'username is available',
);
$user = $this->get( 'userfriendly_social_user.oauth_user_provider' )
->findOneByUsernameSlug( $request-... | php | public function usernameAvailableAction( Request $request )
{
$response = array(
'cssClass' => 'success',
'text' => 'username is available',
);
$user = $this->get( 'userfriendly_social_user.oauth_user_provider' )
->findOneByUsernameSlug( $request-... | [
"public",
"function",
"usernameAvailableAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"array",
"(",
"'cssClass'",
"=>",
"'success'",
",",
"'text'",
"=>",
"'username is available'",
",",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->"... | AJAX action for checking username availability
@param \Symfony\Component\HttpFoundation\Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"AJAX",
"action",
"for",
"checking",
"username",
"availability"
] | train | https://github.com/userfriendly/SocialUserBundle/blob/1dfcf76af2bc639901c471e6f28b04d73fb65452/Controller/ProfileController.php#L131-L156 |
userfriendly/SocialUserBundle | Controller/ProfileController.php | ProfileController.showAndEdit | private function showAndEdit( Request $request, $action )
{
$user = $this->get( 'userfriendly_social_user.oauth_user_provider' )
->findOneByUsernameSlug( $request->get( 'username_slug' ));
if ( $user )
{
$currentUser = $this->get( 'security.context' )->getTok... | php | private function showAndEdit( Request $request, $action )
{
$user = $this->get( 'userfriendly_social_user.oauth_user_provider' )
->findOneByUsernameSlug( $request->get( 'username_slug' ));
if ( $user )
{
$currentUser = $this->get( 'security.context' )->getTok... | [
"private",
"function",
"showAndEdit",
"(",
"Request",
"$",
"request",
",",
"$",
"action",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"get",
"(",
"'userfriendly_social_user.oauth_user_provider'",
")",
"->",
"findOneByUsernameSlug",
"(",
"$",
"request",
"->",
... | Private methods for use in this Controller's public methods | [
"Private",
"methods",
"for",
"use",
"in",
"this",
"Controller",
"s",
"public",
"methods"
] | train | https://github.com/userfriendly/SocialUserBundle/blob/1dfcf76af2bc639901c471e6f28b04d73fb65452/Controller/ProfileController.php#L162-L182 |
yuncms/framework | src/user/migrations/m180223_102826Create_user_profile_table.php | m180223_102826Create_user_profile_table.safeUp | public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=Inn... | php | public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=Inn... | [
"public",
"function",
"safeUp",
"(",
")",
"{",
"$",
"tableOptions",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"db",
"->",
"driverName",
"===",
"'mysql'",
")",
"{",
"// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-... | {@inheritdoc} | [
"{"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/user/migrations/m180223_102826Create_user_profile_table.php#L12-L50 |
FuriosoJack/LaraException | src/Controllers/BasicController.php | BasicController.laraException | public function laraException(Request $request)
{
$storage = Storage::disk('local');
$fileName = base64_decode(urldecode($request->get('errors')));
if(!$storage->exists($fileName)){
$info = null;
}else{
$info = $storage->get($fileName);
}
$... | php | public function laraException(Request $request)
{
$storage = Storage::disk('local');
$fileName = base64_decode(urldecode($request->get('errors')));
if(!$storage->exists($fileName)){
$info = null;
}else{
$info = $storage->get($fileName);
}
$... | [
"public",
"function",
"laraException",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"storage",
"=",
"Storage",
"::",
"disk",
"(",
"'local'",
")",
";",
"$",
"fileName",
"=",
"base64_decode",
"(",
"urldecode",
"(",
"$",
"request",
"->",
"get",
"(",
"'err... | Controlador encargado de validar que debe retornar si la vista o el response JSON
@return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View | [
"Controlador",
"encargado",
"de",
"validar",
"que",
"debe",
"retornar",
"si",
"la",
"vista",
"o",
"el",
"response",
"JSON"
] | train | https://github.com/FuriosoJack/LaraException/blob/b30ec2ed3331d99fca4d0ae47c8710a522bd0c19/src/Controllers/BasicController.php#L31-L67 |
CakeCMS/Core | src/ORM/Behavior/CachedBehavior.php | CachedBehavior.initialize | public function initialize(array $config)
{
$config = Hash::merge($this->_defaultConfig, $config);
$this->setConfig($config);
} | php | public function initialize(array $config)
{
$config = Hash::merge($this->_defaultConfig, $config);
$this->setConfig($config);
} | [
"public",
"function",
"initialize",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"config",
"=",
"Hash",
"::",
"merge",
"(",
"$",
"this",
"->",
"_defaultConfig",
",",
"$",
"config",
")",
";",
"$",
"this",
"->",
"setConfig",
"(",
"$",
"config",
")",
";"... | Initialize hook.
@param array $config The config for this behavior.
@return void | [
"Initialize",
"hook",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/ORM/Behavior/CachedBehavior.php#L49-L53 |
CakeCMS/Core | src/ORM/Behavior/CachedBehavior.php | CachedBehavior._clearCacheGroup | protected function _clearCacheGroup()
{
$cacheGroups = (array) $this->getConfig('groups');
foreach ($cacheGroups as $group) {
Cache::clearGroup($group, $this->getConfig('config'));
}
} | php | protected function _clearCacheGroup()
{
$cacheGroups = (array) $this->getConfig('groups');
foreach ($cacheGroups as $group) {
Cache::clearGroup($group, $this->getConfig('config'));
}
} | [
"protected",
"function",
"_clearCacheGroup",
"(",
")",
"{",
"$",
"cacheGroups",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"getConfig",
"(",
"'groups'",
")",
";",
"foreach",
"(",
"$",
"cacheGroups",
"as",
"$",
"group",
")",
"{",
"Cache",
"::",
"clearGrou... | Clear cache group.
@return void | [
"Clear",
"cache",
"group",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/ORM/Behavior/CachedBehavior.php#L86-L92 |
Kylob/Bootstrap | src/Common.php | Common.row | public function row($size, $columns)
{
$html = '';
$prefix = array();
for ($i = 1; $i <= 12; ++$i) {
$prefix[] = 'offset-'.$i;
$prefix[] = 'push-'.$i;
$prefix[] = 'pull-'.$i;
$prefix[] = $i;
}
$sizes = func_get_args();
$... | php | public function row($size, $columns)
{
$html = '';
$prefix = array();
for ($i = 1; $i <= 12; ++$i) {
$prefix[] = 'offset-'.$i;
$prefix[] = 'push-'.$i;
$prefix[] = 'pull-'.$i;
$prefix[] = $i;
}
$sizes = func_get_args();
$... | [
"public",
"function",
"row",
"(",
"$",
"size",
",",
"$",
"columns",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"prefix",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"12",
";",
"++",
"$",
"i",
")",
"{... | This method works in conjunction with ``$bp->col()`` below. It makes things a little less verbose, but much easier to edit, modify, and see at a glance what in the world is going on.
@param string $size This value can be either '**xs**' < 768px, '**sm**' >= 768px, '**md**' >= 992 , or '**lg**' >= 1200. This is the... | [
"This",
"method",
"works",
"in",
"conjunction",
"with",
"$bp",
"-",
">",
"col",
"()",
"below",
".",
"It",
"makes",
"things",
"a",
"little",
"less",
"verbose",
"but",
"much",
"easier",
"to",
"edit",
"modify",
"and",
"see",
"at",
"a",
"glance",
"what",
"... | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L82-L107 |
Kylob/Bootstrap | src/Common.php | Common.lister | public function lister($tag, array $list)
{
$html = '';
$class = '';
if ($space = strpos($tag, ' ')) {
$class = trim(substr($tag, $space));
$tag = substr($tag, 0, $space);
}
foreach ($list as $key => $value) {
if ($tag == 'dl') {
... | php | public function lister($tag, array $list)
{
$html = '';
$class = '';
if ($space = strpos($tag, ' ')) {
$class = trim(substr($tag, $space));
$tag = substr($tag, 0, $space);
}
foreach ($list as $key => $value) {
if ($tag == 'dl') {
... | [
"public",
"function",
"lister",
"(",
"$",
"tag",
",",
"array",
"$",
"list",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"class",
"=",
"''",
";",
"if",
"(",
"$",
"space",
"=",
"strpos",
"(",
"$",
"tag",
",",
"' '",
")",
")",
"{",
"$",
"class",... | This assists you in making Ordered, Unordered, and Definition lists. It is especially useful when you are nesting lists within lists. Your code almost looks exactly like you would expect to see it on the big screen. It would have been nice if we could have named this method 'list', but someone has taken that already.
... | [
"This",
"assists",
"you",
"in",
"making",
"Ordered",
"Unordered",
"and",
"Definition",
"lists",
".",
"It",
"is",
"especially",
"useful",
"when",
"you",
"are",
"nesting",
"lists",
"within",
"lists",
".",
"Your",
"code",
"almost",
"looks",
"exactly",
"like",
"... | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L172-L190 |
Kylob/Bootstrap | src/Common.php | Common.search | public function search($url, array $form = array())
{
$html = '';
$form = array_merge(array(
'name' => 'search',
'role' => 'search',
'class' => 'form-horizontal',
'placeholder' => 'Search',
'button' => $this->icon('search'),
'si... | php | public function search($url, array $form = array())
{
$html = '';
$form = array_merge(array(
'name' => 'search',
'role' => 'search',
'class' => 'form-horizontal',
'placeholder' => 'Search',
'button' => $this->icon('search'),
'si... | [
"public",
"function",
"search",
"(",
"$",
"url",
",",
"array",
"$",
"form",
"=",
"array",
"(",
")",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"form",
"=",
"array_merge",
"(",
"array",
"(",
"'name'",
"=>",
"'search'",
",",
"'role'",
"=>",
"'search... | This will assist you in creating a search bar for your site.
@param string $url This is the url that you would like the search term to be sent to
@param array $form To customize the form, you can submit an array with any of the following keys:
- '**name**' - The name of the input field. The default is '**search**'.... | [
"This",
"will",
"assist",
"you",
"in",
"creating",
"a",
"search",
"bar",
"for",
"your",
"site",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L213-L248 |
Kylob/Bootstrap | src/Common.php | Common.icon | public function icon($symbol, $prefix = 'glyphicon', $tag = 'i')
{
$base = $prefix;
$classes = explode(' ', $symbol);
$prefix = array($classes[0]); // ie. only prefix the first class
$params = '';
if ($space = strpos($tag, ' ')) {
$params = ' '.trim(substr($tag, $... | php | public function icon($symbol, $prefix = 'glyphicon', $tag = 'i')
{
$base = $prefix;
$classes = explode(' ', $symbol);
$prefix = array($classes[0]); // ie. only prefix the first class
$params = '';
if ($space = strpos($tag, ' ')) {
$params = ' '.trim(substr($tag, $... | [
"public",
"function",
"icon",
"(",
"$",
"symbol",
",",
"$",
"prefix",
"=",
"'glyphicon'",
",",
"$",
"tag",
"=",
"'i'",
")",
"{",
"$",
"base",
"=",
"$",
"prefix",
";",
"$",
"classes",
"=",
"explode",
"(",
"' '",
",",
"$",
"symbol",
")",
";",
"$",
... | Create an icon without the verbosity.
@param string $symbol The icon you would like to display without the base and icon class prefix.
@param string $prefix The base and icon class prefix. The default is a Bootstrap icon, but this can be used with any icon font by simply entering their prefix value here.
@param string... | [
"Create",
"an",
"icon",
"without",
"the",
"verbosity",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L309-L326 |
Kylob/Bootstrap | src/Common.php | Common.button | public function button($class, $name, array $options = array())
{
$attributes = array('type' => 'button');
foreach ($options as $key => $value) {
if (!in_array($key, array('dropdown', 'dropup', 'active', 'disabled', 'pull'))) {
$attributes[$key] = $value;
}
... | php | public function button($class, $name, array $options = array())
{
$attributes = array('type' => 'button');
foreach ($options as $key => $value) {
if (!in_array($key, array('dropdown', 'dropup', 'active', 'disabled', 'pull'))) {
$attributes[$key] = $value;
}
... | [
"public",
"function",
"button",
"(",
"$",
"class",
",",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
"'type'",
"=>",
"'button'",
")",
";",
"foreach",
"(",
"$",
"options",
"as",
"... | A button by itself is easy enough, but when you start including dropdowns and groups your markup can get ugly quick. Follow the examples. We'll start simple and go from there.
@param string $class The classes: '**xs**', '**sm**', '**lg**', '**block**', '**default**', '**primary**', '**success**', '**info**', '**warn... | [
"A",
"button",
"by",
"itself",
"is",
"easy",
"enough",
"but",
"when",
"you",
"start",
"including",
"dropdowns",
"and",
"groups",
"your",
"markup",
"can",
"get",
"ugly",
"quick",
".",
"Follow",
"the",
"examples",
".",
"We",
"ll",
"start",
"simple",
"and",
... | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L366-L409 |
Kylob/Bootstrap | src/Common.php | Common.group | public function group($class, array $buttons, $form = '')
{
$attributes = array('class' => $this->prefixClasses('btn-group', array('xs', 'sm', 'lg', 'justified', 'vertical'), $class));
if ($form == 'checkbox' || $form == 'radio') {
$attributes['data-toggle'] = 'buttons-'.$form;
}... | php | public function group($class, array $buttons, $form = '')
{
$attributes = array('class' => $this->prefixClasses('btn-group', array('xs', 'sm', 'lg', 'justified', 'vertical'), $class));
if ($form == 'checkbox' || $form == 'radio') {
$attributes['data-toggle'] = 'buttons-'.$form;
}... | [
"public",
"function",
"group",
"(",
"$",
"class",
",",
"array",
"$",
"buttons",
",",
"$",
"form",
"=",
"''",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
"'class'",
"=>",
"$",
"this",
"->",
"prefixClasses",
"(",
"'btn-group'",
",",
"array",
"(",
"... | Group your buttons together.
@param string $class The classes: '**xs**', '**sm**', '**lg**', '**justified**', and '**vertical**' will all be prefixed with '**btn-group-...**', and we include the '**btn-group**' class too. When you size a group up, then don't size the individual buttons.
@param array $buttons An ``a... | [
"Group",
"your",
"buttons",
"together",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L437-L451 |
Kylob/Bootstrap | src/Common.php | Common.links | public function links($tag, array $links, array $options = array())
{
$html = '';
$class = null;
if ($space = strpos($tag, ' ')) {
$class = ' '.trim(substr($tag, $space));
$tag = substr($tag, 0, $space);
}
if ($tag != 'li') {
$tag = 'a';
... | php | public function links($tag, array $links, array $options = array())
{
$html = '';
$class = null;
if ($space = strpos($tag, ' ')) {
$class = ' '.trim(substr($tag, $space));
$tag = substr($tag, 0, $space);
}
if ($tag != 'li') {
$tag = 'a';
... | [
"public",
"function",
"links",
"(",
"$",
"tag",
",",
"array",
"$",
"links",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"class",
"=",
"null",
";",
"if",
"(",
"$",
"space",
"=",
"strpos",
"("... | This used to be a private method that we only used internally for tabs and pills and buttons and so forth, but it is just so useful. Now you can make your own dropdowns with regular ``<a>`` links as well.
@param string $tag If this isn't 'li', then it will be an '**a**'. If you specify 'li' tags then you will need... | [
"This",
"used",
"to",
"be",
"a",
"private",
"method",
"that",
"we",
"only",
"used",
"internally",
"for",
"tabs",
"and",
"pills",
"and",
"buttons",
"and",
"so",
"forth",
"but",
"it",
"is",
"just",
"so",
"useful",
".",
"Now",
"you",
"can",
"make",
"your"... | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L481-L557 |
Kylob/Bootstrap | src/Common.php | Common.tabs | public function tabs(array $links, array $options = array())
{
$class = 'nav nav-tabs';
if (isset($options['align'])) {
switch ($options['align']) {
case 'justified':
$class .= ' nav-justified';
break;
case 'left':
... | php | public function tabs(array $links, array $options = array())
{
$class = 'nav nav-tabs';
if (isset($options['align'])) {
switch ($options['align']) {
case 'justified':
$class .= ' nav-justified';
break;
case 'left':
... | [
"public",
"function",
"tabs",
"(",
"array",
"$",
"links",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"class",
"=",
"'nav nav-tabs'",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'align'",
"]",
")",
")",
"{",
"switch... | Creates a Bootstrap tabs nav menu.
@param array $links An ``array($name => $href, ...)`` of links. If **$href** is an array unto itself, then it will be turned into a dropdown menu with the same header and divider rules applied as with ``$bp->buttons()``.
@param array $options The available options are:
- '**active... | [
"Creates",
"a",
"Bootstrap",
"tabs",
"nav",
"menu",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L586-L602 |
Kylob/Bootstrap | src/Common.php | Common.pills | public function pills(array $links, array $options = array())
{
$class = 'nav nav-pills';
if (isset($options['align'])) {
switch ($options['align']) {
case 'justified':
$class .= ' nav-justified';
break;
case 'vertic... | php | public function pills(array $links, array $options = array())
{
$class = 'nav nav-pills';
if (isset($options['align'])) {
switch ($options['align']) {
case 'justified':
$class .= ' nav-justified';
break;
case 'vertic... | [
"public",
"function",
"pills",
"(",
"array",
"$",
"links",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"class",
"=",
"'nav nav-pills'",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'align'",
"]",
")",
")",
"{",
"swit... | Creates a Bootstrap pills nav menu.
@param array $links An ``array($name => $href, ...)`` of links. If **$href** is an array unto itself, then it will be turned into a dropdown menu with the same header and divider rules applied as with ``$bp->buttons()``.
@param array $options The available options are:
- '**activ... | [
"Creates",
"a",
"Bootstrap",
"pills",
"nav",
"menu",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L637-L657 |
Kylob/Bootstrap | src/Common.php | Common.breadcrumbs | public function breadcrumbs(array $links)
{
if (empty($links)) {
return '';
}
foreach ($links as $name => $href) {
if (is_array($href)) {
list($dropdown, $id) = $this->dropdown($href);
$link = $this->page->tag('a', array('href' => '#', ... | php | public function breadcrumbs(array $links)
{
if (empty($links)) {
return '';
}
foreach ($links as $name => $href) {
if (is_array($href)) {
list($dropdown, $id) = $this->dropdown($href);
$link = $this->page->tag('a', array('href' => '#', ... | [
"public",
"function",
"breadcrumbs",
"(",
"array",
"$",
"links",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"links",
")",
")",
"{",
"return",
"''",
";",
"}",
"foreach",
"(",
"$",
"links",
"as",
"$",
"name",
"=>",
"$",
"href",
")",
"{",
"if",
"(",
... | Creates a Bootstrap styled breadcrumb trail. The last link is automatically activated.
@param array $links An ``array($name => $href)`` of links to display. The **$href** may also be another ``array($name => $href)`` of dropdown links.
@return string
@example
```php
$bp->breadcrumbs(array(
'Home' => '#',
'Library' ... | [
"Creates",
"a",
"Bootstrap",
"styled",
"breadcrumb",
"trail",
".",
"The",
"last",
"link",
"is",
"automatically",
"activated",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L676-L696 |
Kylob/Bootstrap | src/Common.php | Common.badge | public function badge($count, $align = '')
{
return $this->page->tag('span', array(
'class' => !empty($align) ? 'badge pull-'.$align : 'badge',
), (is_numeric($count) && $count == 0) ? '' : $count);
} | php | public function badge($count, $align = '')
{
return $this->page->tag('span', array(
'class' => !empty($align) ? 'badge pull-'.$align : 'badge',
), (is_numeric($count) && $count == 0) ? '' : $count);
} | [
"public",
"function",
"badge",
"(",
"$",
"count",
",",
"$",
"align",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"page",
"->",
"tag",
"(",
"'span'",
",",
"array",
"(",
"'class'",
"=>",
"!",
"empty",
"(",
"$",
"align",
")",
"?",
"'badge pull-'... | Creates a Bootstrap badge, and is a bit more useful than ``$bp->label()``. If **$count** equals 0, or if it's not numeric (null?), then it still includes the tag, but leaves the value empty.
@param int $count The number you would like to display.
@param string $align This will pull your badge '**right**' or '**left... | [
"Creates",
"a",
"Bootstrap",
"badge",
"and",
"is",
"a",
"bit",
"more",
"useful",
"than",
"$bp",
"-",
">",
"label",
"()",
".",
"If",
"**",
"$count",
"**",
"equals",
"0",
"or",
"if",
"it",
"s",
"not",
"numeric",
"(",
"null?",
")",
"then",
"it",
"stil... | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L733-L738 |
Kylob/Bootstrap | src/Common.php | Common.alert | public function alert($type, $alert, $dismissable = true)
{
$html = '';
$class = 'alert alert-'.$type;
if ($dismissable) {
$class .= ' alert-dismissable';
}
$html .= '<div class="'.$class.'" role="alert">';
if ($dismissable) {
$html .= '<button... | php | public function alert($type, $alert, $dismissable = true)
{
$html = '';
$class = 'alert alert-'.$type;
if ($dismissable) {
$class .= ' alert-dismissable';
}
$html .= '<div class="'.$class.'" role="alert">';
if ($dismissable) {
$html .= '<button... | [
"public",
"function",
"alert",
"(",
"$",
"type",
",",
"$",
"alert",
",",
"$",
"dismissable",
"=",
"true",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"class",
"=",
"'alert alert-'",
".",
"$",
"type",
";",
"if",
"(",
"$",
"dismissable",
")",
"{",
... | Creates Bootstrap alert messages.
@param string $type Either '**success**', '**info**', '**warning**', or '**danger**'.
@param string $alert The status message. All ``<h1-6>`` headers and ``<a>`` links will be classed appropriately.
@param bool $dismissable If you set this to false, then the alert will ... | [
"Creates",
"Bootstrap",
"alert",
"messages",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L757-L772 |
Kylob/Bootstrap | src/Common.php | Common.progress | public function progress($percent, $class = '', $display = false)
{
$html = '';
$classes = (array) $class;
foreach ((array) $percent as $key => $progress) {
$class = (isset($classes[$key])) ? $classes[$key] : '';
$class = $this->prefixClasses('progress-bar', array('su... | php | public function progress($percent, $class = '', $display = false)
{
$html = '';
$classes = (array) $class;
foreach ((array) $percent as $key => $progress) {
$class = (isset($classes[$key])) ? $classes[$key] : '';
$class = $this->prefixClasses('progress-bar', array('su... | [
"public",
"function",
"progress",
"(",
"$",
"percent",
",",
"$",
"class",
"=",
"''",
",",
"$",
"display",
"=",
"false",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"classes",
"=",
"(",
"array",
")",
"$",
"class",
";",
"foreach",
"(",
"(",
"array"... | Creates every flavor of progress bar that Bootstrap has to offer.
@param int $percent The amount of progress from 0 to 100. In order to stack multiple values then turn this into an array.
@param string $class You can include one of the four contextual classes: '**success**', '**info**', '**warning**' or '**danger... | [
"Creates",
"every",
"flavor",
"of",
"progress",
"bar",
"that",
"Bootstrap",
"has",
"to",
"offer",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L791-L809 |
Kylob/Bootstrap | src/Common.php | Common.media | public function media(array $list, $parent = 0)
{
if (is_numeric($parent) && isset($list[0]) && is_array($list[0])) {
$media = array();
foreach ($list[$parent] as $child => $display) {
if (isset($list[$child])) {
$display[] = $this->media($list, $c... | php | public function media(array $list, $parent = 0)
{
if (is_numeric($parent) && isset($list[0]) && is_array($list[0])) {
$media = array();
foreach ($list[$parent] as $child => $display) {
if (isset($list[$child])) {
$display[] = $this->media($list, $c... | [
"public",
"function",
"media",
"(",
"array",
"$",
"list",
",",
"$",
"parent",
"=",
"0",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"parent",
")",
"&&",
"isset",
"(",
"$",
"list",
"[",
"0",
"]",
")",
"&&",
"is_array",
"(",
"$",
"list",
"[",
"0... | This is the easiest way I could devise of making Bootstrap media objects as manageable as possible. ``<h1-6>`` headers and ``<img>``es will automatically be classed appropriately.
@param array $list A media array row that looks like this: ``array($left, $body, $right)``.
- If you don't have an image or whatever for t... | [
"This",
"is",
"the",
"easiest",
"way",
"I",
"could",
"devise",
"of",
"making",
"Bootstrap",
"media",
"objects",
"as",
"manageable",
"as",
"possible",
".",
"<h1",
"-",
"6",
">",
"headers",
"and",
"<img",
">",
"es",
"will",
"automatically",
"be",
"classed",
... | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L857-L909 |
Kylob/Bootstrap | src/Common.php | Common.listGroup | public function listGroup(array $links, $active = false)
{
$html = '';
$tag = 'a';
$count = 1;
foreach ($links as $name => $href) {
if (empty($html) && empty($name)) {
$tag = 'li';
}
$attributes = array('class' => 'list-group-item')... | php | public function listGroup(array $links, $active = false)
{
$html = '';
$tag = 'a';
$count = 1;
foreach ($links as $name => $href) {
if (empty($html) && empty($name)) {
$tag = 'li';
}
$attributes = array('class' => 'list-group-item')... | [
"public",
"function",
"listGroup",
"(",
"array",
"$",
"links",
",",
"$",
"active",
"=",
"false",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"tag",
"=",
"'a'",
";",
"$",
"count",
"=",
"1",
";",
"foreach",
"(",
"$",
"links",
"as",
"$",
"name",
"... | Creates a Bootstrap list group. ``<h1-6>`` Headers and ``<p>`` paragraphs will automatically be classed appropriately.
@param array $links If you would like to create an unordered list, then this is just an array of values. Otherwise this will be an ``array($name => $href, ...)`` of links. **$name** badges will autom... | [
"Creates",
"a",
"Bootstrap",
"list",
"group",
".",
"<h1",
"-",
"6",
">",
"Headers",
"and",
"<p",
">",
"paragraphs",
"will",
"automatically",
"be",
"classed",
"appropriately",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L940-L966 |
Kylob/Bootstrap | src/Common.php | Common.panel | public function panel($class, array $sections)
{
$html = '';
foreach ($sections as $panel => $content) {
if (!is_numeric($panel)) {
$panel = substr($panel, 0, 4);
}
switch ((string) $panel) {
case 'head':
$html .... | php | public function panel($class, array $sections)
{
$html = '';
foreach ($sections as $panel => $content) {
if (!is_numeric($panel)) {
$panel = substr($panel, 0, 4);
}
switch ((string) $panel) {
case 'head':
$html .... | [
"public",
"function",
"panel",
"(",
"$",
"class",
",",
"array",
"$",
"sections",
")",
"{",
"$",
"html",
"=",
"''",
";",
"foreach",
"(",
"$",
"sections",
"as",
"$",
"panel",
"=>",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"... | Creates a Bootstrap panel component.
@param string $class Either '**default**', '**primary**', '**success**', '**info**', '**warning**', or '**danger**'. The '**panel**' class and prefix are automatically included. You can add more classes to it if you like.
@param array $sections An ``array($panel => $content, ..... | [
"Creates",
"a",
"Bootstrap",
"panel",
"component",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L1000-L1026 |
Kylob/Bootstrap | src/Common.php | Common.toggle | public function toggle($type, array $links, array $options = array())
{
$count = 1;
$toggle = array();
$content = '';
$class = (in_array('fade', $options)) ? 'tab-pane fade' : 'tab-pane';
$active = (isset($options['active'])) ? $options['active'] : '';
$disabled = (is... | php | public function toggle($type, array $links, array $options = array())
{
$count = 1;
$toggle = array();
$content = '';
$class = (in_array('fade', $options)) ? 'tab-pane fade' : 'tab-pane';
$active = (isset($options['active'])) ? $options['active'] : '';
$disabled = (is... | [
"public",
"function",
"toggle",
"(",
"$",
"type",
",",
"array",
"$",
"links",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"count",
"=",
"1",
";",
"$",
"toggle",
"=",
"array",
"(",
")",
";",
"$",
"content",
"=",
"''",
";... | Creates toggleable tabs and pills for transitioning through panes of local content.
@param string $type Specify either '**tabs**' or '**pills**'.
@param array $links An ``array($name => $html, ...)`` of content to toggle through. If **$html** is an array unto itself, then it will be turned into a dropdown menu w... | [
"Creates",
"toggleable",
"tabs",
"and",
"pills",
"for",
"transitioning",
"through",
"panes",
"of",
"local",
"content",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L1058-L1118 |
Kylob/Bootstrap | src/Common.php | Common.accordion | public function accordion($class, array $sections, $open = 1)
{
$html = '';
$count = 0;
$id = $this->page->id('accordion');
foreach ($sections as $head => $body) {
++$count;
$heading = $this->page->id('heading');
$collapse = $this->page->id('collap... | php | public function accordion($class, array $sections, $open = 1)
{
$html = '';
$count = 0;
$id = $this->page->id('accordion');
foreach ($sections as $head => $body) {
++$count;
$heading = $this->page->id('heading');
$collapse = $this->page->id('collap... | [
"public",
"function",
"accordion",
"(",
"$",
"class",
",",
"array",
"$",
"sections",
",",
"$",
"open",
"=",
"1",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"count",
"=",
"0",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"page",
"->",
"id",
"(",
"... | Bootstrap accordions are basically collapsible panels. That is essentially what you are creating here.
@param string $class Either '**default**', '**primary**', '**success**', '**info**', '**warning**', or '**danger**'. These only apply to the head section, and are passed directly by us into ``$bp->panel()``.
@para... | [
"Bootstrap",
"accordions",
"are",
"basically",
"collapsible",
"panels",
".",
"That",
"is",
"essentially",
"what",
"you",
"are",
"creating",
"here",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L1139-L1177 |
Kylob/Bootstrap | src/Common.php | Common.carousel | public function carousel(array $images, array $options = array())
{
$html = '';
$id = $this->page->id('carousel');
$options = array_merge(array(
'interval' => 5000, // ie. 5 seconds in between frame changes
'indicators' => true, // set to false if you don't want them
... | php | public function carousel(array $images, array $options = array())
{
$html = '';
$id = $this->page->id('carousel');
$options = array_merge(array(
'interval' => 5000, // ie. 5 seconds in between frame changes
'indicators' => true, // set to false if you don't want them
... | [
"public",
"function",
"carousel",
"(",
"array",
"$",
"images",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"page",
"->",
"id",
"(",
"'carousel'",
")",
";",
"$",
... | Creates a Bootstrap carousel for cycling through elements. Those elements don't necessarily need to be images, but pretty much they always are.
@param array $images An ``array($image, ...)`` of images to cycle through, starting with the first (logically). To get fancy and add captions, then make this an ``array($imag... | [
"Creates",
"a",
"Bootstrap",
"carousel",
"for",
"cycling",
"through",
"elements",
".",
"Those",
"elements",
"don",
"t",
"necessarily",
"need",
"to",
"be",
"images",
"but",
"pretty",
"much",
"they",
"always",
"are",
"."
] | train | https://github.com/Kylob/Bootstrap/blob/0d7677a90656fbc461eabb5512ab16f9d5f728c6/src/Common.php#L1205-L1264 |
userfriendly/SocialUserBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root( 'userfriendly_social_user' );
$supportedDrivers = array( 'orm' );
//$supportedDrivers = array( 'orm', 'mongodb' );
$rootNode
->children()
-... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root( 'userfriendly_social_user' );
$supportedDrivers = array( 'orm' );
//$supportedDrivers = array( 'orm', 'mongodb' );
$rootNode
->children()
-... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'userfriendly_social_user'",
")",
";",
"$",
"supportedDrivers",
"=",
"array... | Generates the configuration tree.
@return TreeBuilder | [
"Generates",
"the",
"configuration",
"tree",
"."
] | train | https://github.com/userfriendly/SocialUserBundle/blob/1dfcf76af2bc639901c471e6f28b04d73fb65452/DependencyInjection/Configuration.php#L39-L70 |
webforge-labs/psc-cms | lib/Psc/Data/Crypt/AES.php | AES.encrypt | public function encrypt($clearText) {
return base64_encode(
mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
$this->password,
$clearText,
MCRYPT_MODE_ECB,
... | php | public function encrypt($clearText) {
return base64_encode(
mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
$this->password,
$clearText,
MCRYPT_MODE_ECB,
... | [
"public",
"function",
"encrypt",
"(",
"$",
"clearText",
")",
"{",
"return",
"base64_encode",
"(",
"mcrypt_encrypt",
"(",
"MCRYPT_RIJNDAEL_256",
",",
"$",
"this",
"->",
"password",
",",
"$",
"clearText",
",",
"MCRYPT_MODE_ECB",
",",
"mcrypt_create_iv",
"(",
"mcry... | Gibt das encryptete in base64 zurück | [
"Gibt",
"das",
"encryptete",
"in",
"base64",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/Crypt/AES.php#L16-L28 |
webforge-labs/psc-cms | lib/Psc/Data/Crypt/AES.php | AES.decrypt | public function decrypt($encrypted) {
return trim(
mcrypt_decrypt(
MCRYPT_RIJNDAEL_256,
$this->password,
base64_decode($encrypted),
MCRYPT_MODE_ECB,
... | php | public function decrypt($encrypted) {
return trim(
mcrypt_decrypt(
MCRYPT_RIJNDAEL_256,
$this->password,
base64_decode($encrypted),
MCRYPT_MODE_ECB,
... | [
"public",
"function",
"decrypt",
"(",
"$",
"encrypted",
")",
"{",
"return",
"trim",
"(",
"mcrypt_decrypt",
"(",
"MCRYPT_RIJNDAEL_256",
",",
"$",
"this",
"->",
"password",
",",
"base64_decode",
"(",
"$",
"encrypted",
")",
",",
"MCRYPT_MODE_ECB",
",",
"mcrypt_cr... | Gibt das decryptete in Klartext zurück
@param string $encrypted in base64 | [
"Gibt",
"das",
"decryptete",
"in",
"Klartext",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/Crypt/AES.php#L35-L48 |
steeffeen/FancyManiaLinks | FML/Script/Features/KeyAction.php | KeyAction.setKeyName | public function setKeyName($keyName)
{
$this->keyName = (string)$keyName;
$this->keyCode = null;
$this->charPressed = null;
return $this;
} | php | public function setKeyName($keyName)
{
$this->keyName = (string)$keyName;
$this->keyCode = null;
$this->charPressed = null;
return $this;
} | [
"public",
"function",
"setKeyName",
"(",
"$",
"keyName",
")",
"{",
"$",
"this",
"->",
"keyName",
"=",
"(",
"string",
")",
"$",
"keyName",
";",
"$",
"this",
"->",
"keyCode",
"=",
"null",
";",
"$",
"this",
"->",
"charPressed",
"=",
"null",
";",
"return... | Set the key name for triggering the action
@api
@param string $keyName Key Name
@return static | [
"Set",
"the",
"key",
"name",
"for",
"triggering",
"the",
"action"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/KeyAction.php#L99-L105 |
steeffeen/FancyManiaLinks | FML/Script/Features/KeyAction.php | KeyAction.setCharPressed | public function setCharPressed($charPressed)
{
$this->keyName = null;
$this->keyCode = null;
$this->charPressed = (string)$charPressed;
return $this;
} | php | public function setCharPressed($charPressed)
{
$this->keyName = null;
$this->keyCode = null;
$this->charPressed = (string)$charPressed;
return $this;
} | [
"public",
"function",
"setCharPressed",
"(",
"$",
"charPressed",
")",
"{",
"$",
"this",
"->",
"keyName",
"=",
"null",
";",
"$",
"this",
"->",
"keyCode",
"=",
"null",
";",
"$",
"this",
"->",
"charPressed",
"=",
"(",
"string",
")",
"$",
"charPressed",
";... | Set the character to press for triggering the action
@api
@param string $charPressed Pressed character
@return static | [
"Set",
"the",
"character",
"to",
"press",
"for",
"triggering",
"the",
"action"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/KeyAction.php#L151-L157 |
steeffeen/FancyManiaLinks | FML/Script/Features/KeyAction.php | KeyAction.getScriptText | protected function getScriptText()
{
$actionName = Builder::escapeText($this->actionName);
$key = null;
$value = null;
if ($this->keyName !== null) {
$key = "KeyName";
$value = $this->keyName;
} else if ($this->keyCode !== null) {
... | php | protected function getScriptText()
{
$actionName = Builder::escapeText($this->actionName);
$key = null;
$value = null;
if ($this->keyName !== null) {
$key = "KeyName";
$value = $this->keyName;
} else if ($this->keyCode !== null) {
... | [
"protected",
"function",
"getScriptText",
"(",
")",
"{",
"$",
"actionName",
"=",
"Builder",
"::",
"escapeText",
"(",
"$",
"this",
"->",
"actionName",
")",
";",
"$",
"key",
"=",
"null",
";",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->"... | Get the script text
@return string | [
"Get",
"the",
"script",
"text"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/KeyAction.php#L173-L193 |
parsnick/steak | src/Boot/ConfigureViewEngines.php | ConfigureViewEngines.boot | public function boot(Container $app)
{
$app->afterResolving(function (Factory $factory, $app) {
$factory->addExtension('php', 'php', function () {
return new PhpEngine();
});
$factory->addExtension('blade.php', 'blade', function () use ($app) {
... | php | public function boot(Container $app)
{
$app->afterResolving(function (Factory $factory, $app) {
$factory->addExtension('php', 'php', function () {
return new PhpEngine();
});
$factory->addExtension('blade.php', 'blade', function () use ($app) {
... | [
"public",
"function",
"boot",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"app",
"->",
"afterResolving",
"(",
"function",
"(",
"Factory",
"$",
"factory",
",",
"$",
"app",
")",
"{",
"$",
"factory",
"->",
"addExtension",
"(",
"'php'",
",",
"'php'",
",",... | Set up the various view engines.
@param Container $app | [
"Set",
"up",
"the",
"various",
"view",
"engines",
"."
] | train | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Boot/ConfigureViewEngines.php#L20-L41 |
vorbind/influx-analytics | src/Analytics.php | Analytics.getData | public function getData($rp, $metric, $tags, $granularity = 'daily', $startDt = null, $endDt = '2100-12-01T00:00:00Z', $timezone = 'UTC') {
$points = [];
try {
$pointsRp = $this->mapper->getRpPoints($rp, $metric, $tags, $granularity, $startDt, $endDt, $timezone);
$poi... | php | public function getData($rp, $metric, $tags, $granularity = 'daily', $startDt = null, $endDt = '2100-12-01T00:00:00Z', $timezone = 'UTC') {
$points = [];
try {
$pointsRp = $this->mapper->getRpPoints($rp, $metric, $tags, $granularity, $startDt, $endDt, $timezone);
$poi... | [
"public",
"function",
"getData",
"(",
"$",
"rp",
",",
"$",
"metric",
",",
"$",
"tags",
",",
"$",
"granularity",
"=",
"'daily'",
",",
"$",
"startDt",
"=",
"null",
",",
"$",
"endDt",
"=",
"'2100-12-01T00:00:00Z'",
",",
"$",
"timezone",
"=",
"'UTC'",
")",... | Get analytics data in right time zone by period and granularity
@param string $rp
@param string $metric
@param array $tags
@param string $granularity
@param string $startDt
@param string $endDt
@param string $timezone
@return int
@throws AnalyticsException | [
"Get",
"analytics",
"data",
"in",
"right",
"time",
"zone",
"by",
"period",
"and",
"granularity"
] | train | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L57-L72 |
vorbind/influx-analytics | src/Analytics.php | Analytics.getTotal | public function getTotal($rp, $metric, $tags) {
try {
$todayDt = date("Y-m-d") . "T00:00:00Z";
return $this->mapper->getRpSum('forever', $metric, $tags) +
$this->mapper->getRpSum($rp, $metric, $tags, $todayDt) +
$this->mapper->getSum(... | php | public function getTotal($rp, $metric, $tags) {
try {
$todayDt = date("Y-m-d") . "T00:00:00Z";
return $this->mapper->getRpSum('forever', $metric, $tags) +
$this->mapper->getRpSum($rp, $metric, $tags, $todayDt) +
$this->mapper->getSum(... | [
"public",
"function",
"getTotal",
"(",
"$",
"rp",
",",
"$",
"metric",
",",
"$",
"tags",
")",
"{",
"try",
"{",
"$",
"todayDt",
"=",
"date",
"(",
"\"Y-m-d\"",
")",
".",
"\"T00:00:00Z\"",
";",
"return",
"$",
"this",
"->",
"mapper",
"->",
"getRpSum",
"("... | Returns analytics total for right metric
@param string $rp
@param string $metric
@param array $tags
@return int
@throws AnalyticsException | [
"Returns",
"analytics",
"total",
"for",
"right",
"metric"
] | train | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L83-L93 |
vorbind/influx-analytics | src/Analytics.php | Analytics.save | public function save($metric, $tags = array(), $value = 1, $date = null, $rp = null) {
try {
return $this->mapper->save($metric, $tags, $value, $date, $rp);
} catch (Exception $e) {
throw new AnalyticsException("Analytics client save exception", 0, $e);
}
} | php | public function save($metric, $tags = array(), $value = 1, $date = null, $rp = null) {
try {
return $this->mapper->save($metric, $tags, $value, $date, $rp);
} catch (Exception $e) {
throw new AnalyticsException("Analytics client save exception", 0, $e);
}
} | [
"public",
"function",
"save",
"(",
"$",
"metric",
",",
"$",
"tags",
"=",
"array",
"(",
")",
",",
"$",
"value",
"=",
"1",
",",
"$",
"date",
"=",
"null",
",",
"$",
"rp",
"=",
"null",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"mapper",
... | Save analytics
@param string $metric
@param array $tags
@param int $value
@param string $date
@param string $rp
@throws AnalyticsException | [
"Save",
"analytics"
] | train | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L105-L111 |
vorbind/influx-analytics | src/Analytics.php | Analytics.fixTimeForGranularity | private function fixTimeForGranularity($points, $granularity) {
if ($granularity != $this->mapper::GRANULARITY_DAILY) {
return $points;
}
foreach ($points as &$value) {
$date = substr($value['time'],0, 10); // get date (2017-08-29)
$offset = substr($value['tim... | php | private function fixTimeForGranularity($points, $granularity) {
if ($granularity != $this->mapper::GRANULARITY_DAILY) {
return $points;
}
foreach ($points as &$value) {
$date = substr($value['time'],0, 10); // get date (2017-08-29)
$offset = substr($value['tim... | [
"private",
"function",
"fixTimeForGranularity",
"(",
"$",
"points",
",",
"$",
"granularity",
")",
"{",
"if",
"(",
"$",
"granularity",
"!=",
"$",
"this",
"->",
"mapper",
"::",
"GRANULARITY_DAILY",
")",
"{",
"return",
"$",
"points",
";",
"}",
"foreach",
"(",... | Fix time part for non-downsampled data
@param array $points
@param string $granularity
@return array | [
"Fix",
"time",
"part",
"for",
"non",
"-",
"downsampled",
"data"
] | train | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L122-L132 |
vorbind/influx-analytics | src/Analytics.php | Analytics.combineSumPoints | private function combineSumPoints($points1, $points2) {
$pointsCount = count($points1);
$currPoint = 0;
foreach ($points2 as $point2) {
$pointFound = false;
//leverage the fact that points are sorted and improve O(n^2)
while ($currPoint < $pointsCount) {
... | php | private function combineSumPoints($points1, $points2) {
$pointsCount = count($points1);
$currPoint = 0;
foreach ($points2 as $point2) {
$pointFound = false;
//leverage the fact that points are sorted and improve O(n^2)
while ($currPoint < $pointsCount) {
... | [
"private",
"function",
"combineSumPoints",
"(",
"$",
"points1",
",",
"$",
"points2",
")",
"{",
"$",
"pointsCount",
"=",
"count",
"(",
"$",
"points1",
")",
";",
"$",
"currPoint",
"=",
"0",
";",
"foreach",
"(",
"$",
"points2",
"as",
"$",
"point2",
")",
... | Combine downsampled and non-downsampled points
@param array $points1
@param array $points2
@return array | [
"Combine",
"downsampled",
"and",
"non",
"-",
"downsampled",
"points"
] | train | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Analytics.php#L141-L164 |
factorio-item-browser/export-data | src/Entity/Recipe/Product.php | Product.writeData | public function writeData(): array
{
$dataBuilder = new DataBuilder();
$dataBuilder->setString('t', $this->type, '')
->setString('n', $this->name, '')
->setFloat('i', $this->amountMin, 1.)
->setFloat('a', $this->amountMax, 1.)
... | php | public function writeData(): array
{
$dataBuilder = new DataBuilder();
$dataBuilder->setString('t', $this->type, '')
->setString('n', $this->name, '')
->setFloat('i', $this->amountMin, 1.)
->setFloat('a', $this->amountMax, 1.)
... | [
"public",
"function",
"writeData",
"(",
")",
":",
"array",
"{",
"$",
"dataBuilder",
"=",
"new",
"DataBuilder",
"(",
")",
";",
"$",
"dataBuilder",
"->",
"setString",
"(",
"'t'",
",",
"$",
"this",
"->",
"type",
",",
"''",
")",
"->",
"setString",
"(",
"... | Writes the entity data to an array.
@return array | [
"Writes",
"the",
"entity",
"data",
"to",
"an",
"array",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe/Product.php#L180-L190 |
factorio-item-browser/export-data | src/Entity/Recipe/Product.php | Product.readData | public function readData(DataContainer $data)
{
$this->type = $data->getString('t', '');
$this->name = $data->getString('n', '');
$this->amountMin = $data->getFloat('i', 1.);
$this->amountMax = $data->getFloat('a', 1.);
$this->probability = $data->getFloat('p', 1.);
$... | php | public function readData(DataContainer $data)
{
$this->type = $data->getString('t', '');
$this->name = $data->getString('n', '');
$this->amountMin = $data->getFloat('i', 1.);
$this->amountMax = $data->getFloat('a', 1.);
$this->probability = $data->getFloat('p', 1.);
$... | [
"public",
"function",
"readData",
"(",
"DataContainer",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"type",
"=",
"$",
"data",
"->",
"getString",
"(",
"'t'",
",",
"''",
")",
";",
"$",
"this",
"->",
"name",
"=",
"$",
"data",
"->",
"getString",
"(",
"'n... | Reads the entity data.
@param DataContainer $data
@return $this | [
"Reads",
"the",
"entity",
"data",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe/Product.php#L197-L206 |
factorio-item-browser/export-data | src/Entity/Recipe/Product.php | Product.calculateHash | public function calculateHash(): string
{
return EntityUtils::calculateHashOfArray([
$this->type,
$this->name,
$this->amountMin,
$this->amountMax,
$this->probability,
$this->order,
]);
} | php | public function calculateHash(): string
{
return EntityUtils::calculateHashOfArray([
$this->type,
$this->name,
$this->amountMin,
$this->amountMax,
$this->probability,
$this->order,
]);
} | [
"public",
"function",
"calculateHash",
"(",
")",
":",
"string",
"{",
"return",
"EntityUtils",
"::",
"calculateHashOfArray",
"(",
"[",
"$",
"this",
"->",
"type",
",",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"amountMin",
",",
"$",
"this",
"->",
... | Calculates a hash value representing the entity.
@return string | [
"Calculates",
"a",
"hash",
"value",
"representing",
"the",
"entity",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Recipe/Product.php#L212-L222 |
phpmob/changmin | src/PhpMob/MediaBundle/PhpMobMediaBundle.php | PhpMobMediaBundle.build | public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new Compiler\RegisterImageTypesPass());
} | php | public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new Compiler\RegisterImageTypesPass());
} | [
"public",
"function",
"build",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"parent",
"::",
"build",
"(",
"$",
"container",
")",
";",
"$",
"container",
"->",
"addCompilerPass",
"(",
"new",
"Compiler",
"\\",
"RegisterImageTypesPass",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/PhpMobMediaBundle.php#L36-L41 |
vi-kon/laravel-auth | src/database/migrations/2014_08_27_000004_create_user_groups_table.php | CreateUserGroupsTable.up | public function up()
{
$schema = app()->make('db')->connection()->getSchemaBuilder();
$schema->create(config('vi-kon.auth.table.user_groups'), function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('token');
... | php | public function up()
{
$schema = app()->make('db')->connection()->getSchemaBuilder();
$schema->create(config('vi-kon.auth.table.user_groups'), function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->string('token');
... | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"schema",
"=",
"app",
"(",
")",
"->",
"make",
"(",
"'db'",
")",
"->",
"connection",
"(",
")",
"->",
"getSchemaBuilder",
"(",
")",
";",
"$",
"schema",
"->",
"create",
"(",
"config",
"(",
"'vi-kon.auth.ta... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/database/migrations/2014_08_27_000004_create_user_groups_table.php#L18-L32 |
xinix-technology/norm | src/Norm/Filter/FilterException.php | FilterException.context | public function context($context = null)
{
if (is_null($context)) {
return $this->context;
}
$this->context = $context;
return $this;
} | php | public function context($context = null)
{
if (is_null($context)) {
return $this->context;
}
$this->context = $context;
return $this;
} | [
"public",
"function",
"context",
"(",
"$",
"context",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"context",
")",
")",
"{",
"return",
"$",
"this",
"->",
"context",
";",
"}",
"$",
"this",
"->",
"context",
"=",
"$",
"context",
";",
"return... | Set field context of exception
@param string $context The field context
@return FilterException return self object to be chained | [
"Set",
"field",
"context",
"of",
"exception"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Filter/FilterException.php#L113-L122 |
xinix-technology/norm | src/Norm/Filter/FilterException.php | FilterException.args | public function args()
{
$this->args = func_get_args();
$params = array_merge(array($this->formatMessage), $this->args);
$this->message = call_user_func_array('sprintf', $params);
return $this;
} | php | public function args()
{
$this->args = func_get_args();
$params = array_merge(array($this->formatMessage), $this->args);
$this->message = call_user_func_array('sprintf', $params);
return $this;
} | [
"public",
"function",
"args",
"(",
")",
"{",
"$",
"this",
"->",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"params",
"=",
"array_merge",
"(",
"array",
"(",
"$",
"this",
"->",
"formatMessage",
")",
",",
"$",
"this",
"->",
"args",
")",
";",
"$... | Get the arrguments passed and build message by them.
@return Norm\Filter\FilterException | [
"Get",
"the",
"arrguments",
"passed",
"and",
"build",
"message",
"by",
"them",
"."
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Filter/FilterException.php#L129-L137 |
mgallegos/decima-file | src/migrations/2016_09_21_201625_create_file_table.php | CreateFileTable.up | public function up()
{
Schema::create('FILE_File', function (Blueprint $table) {
$table->increments('id');
$table->string('name' , 100);
$table->char('type' , 1);
$table->string('system_type', 100)->nullable();
$table->string('system_route')->nulla... | php | public function up()
{
Schema::create('FILE_File', function (Blueprint $table) {
$table->increments('id');
$table->string('name' , 100);
$table->char('type' , 1);
$table->string('system_type', 100)->nullable();
$table->string('system_route')->nulla... | [
"public",
"function",
"up",
"(",
")",
"{",
"Schema",
"::",
"create",
"(",
"'FILE_File'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"increments",
"(",
"'id'",
")",
";",
"$",
"table",
"->",
"string",
"(",
"'name'",
... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/migrations/2016_09_21_201625_create_file_table.php#L13-L46 |
simple-php-mvc/simple-php-mvc | src/MVC/File/Explorer.php | Explorer.copy | public function copy($sourceDir, $destinyDir)
{
$dir = opendir($sourceDir);
$this->mkdir($destinyDir);
while (false !== ( $file = readdir($dir))) {
if (( $file != '.' ) && ( $file != '..' )) {
if (is_dir($sourceDir . '/' . $file)) {
$this->copy... | php | public function copy($sourceDir, $destinyDir)
{
$dir = opendir($sourceDir);
$this->mkdir($destinyDir);
while (false !== ( $file = readdir($dir))) {
if (( $file != '.' ) && ( $file != '..' )) {
if (is_dir($sourceDir . '/' . $file)) {
$this->copy... | [
"public",
"function",
"copy",
"(",
"$",
"sourceDir",
",",
"$",
"destinyDir",
")",
"{",
"$",
"dir",
"=",
"opendir",
"(",
"$",
"sourceDir",
")",
";",
"$",
"this",
"->",
"mkdir",
"(",
"$",
"destinyDir",
")",
";",
"while",
"(",
"false",
"!==",
"(",
"$"... | Copy directory to destiny directory
@param string $sourceDir
@param string $destinyDir | [
"Copy",
"directory",
"to",
"destiny",
"directory"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/File/Explorer.php#L41-L55 |
simple-php-mvc/simple-php-mvc | src/MVC/File/Explorer.php | Explorer.getFiles | public function getFiles()
{
$files = array();
while ($this->valid() && $this->isFile()) {
if (!$this->searchPattern) {
$files[] = $this->current();
} elseif(preg_match($this->searchPattern, $this->getFilename())) {
$files[] = $this->current();... | php | public function getFiles()
{
$files = array();
while ($this->valid() && $this->isFile()) {
if (!$this->searchPattern) {
$files[] = $this->current();
} elseif(preg_match($this->searchPattern, $this->getFilename())) {
$files[] = $this->current();... | [
"public",
"function",
"getFiles",
"(",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"while",
"(",
"$",
"this",
"->",
"valid",
"(",
")",
"&&",
"$",
"this",
"->",
"isFile",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"searchPat... | Get files
@return Explorer | [
"Get",
"files"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/File/Explorer.php#L62-L74 |
simple-php-mvc/simple-php-mvc | src/MVC/File/Explorer.php | Explorer.rmdir | public function rmdir($path)
{
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file) {
(is_dir("$path/$file")) ? $this->rmdir("$path/$file") : unlink("$path/$file");
}
return rmdir($path);
} | php | public function rmdir($path)
{
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file) {
(is_dir("$path/$file")) ? $this->rmdir("$path/$file") : unlink("$path/$file");
}
return rmdir($path);
} | [
"public",
"function",
"rmdir",
"(",
"$",
"path",
")",
"{",
"$",
"files",
"=",
"array_diff",
"(",
"scandir",
"(",
"$",
"path",
")",
",",
"array",
"(",
"'.'",
",",
"'..'",
")",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
... | Remove dir
@param string $path
@return boolean | [
"Remove",
"dir"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/File/Explorer.php#L94-L101 |
seeruo/framework | src/Service/PushService.php | PushService.pushServer | public function pushServer()
{
if (!isset($this->config['ssh_user'])) {
Log::info( 'SSH账户没有配置,请在Config.php文件参照如下方式配置:' );
Log::info( '$config[\'ssh_user\']=\'root\';' );
die();
}
if (!isset($this->config['ssh_address'])) {
Log::info( 'SSH地址没有配置... | php | public function pushServer()
{
if (!isset($this->config['ssh_user'])) {
Log::info( 'SSH账户没有配置,请在Config.php文件参照如下方式配置:' );
Log::info( '$config[\'ssh_user\']=\'root\';' );
die();
}
if (!isset($this->config['ssh_address'])) {
Log::info( 'SSH地址没有配置... | [
"public",
"function",
"pushServer",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'ssh_user'",
"]",
")",
")",
"{",
"Log",
"::",
"info",
"(",
"'SSH账户没有配置,请在Config.php文件参照如下方式配置:' );",
"",
"",
"Log",
"::",
"info",
"(",
"... | [Git推送方式]
@return [type] [description] | [
"[",
"Git推送方式",
"]"
] | train | https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Service/PushService.php#L53-L87 |
seeruo/framework | src/Service/PushService.php | PushService.pushGit | public function pushGit()
{
if (!isset($this->config['git_address'])) {
Log::info('Git地址没有配置,请在Config.php文件参照如下方式配置:' );
Log::info('$config[\'git_address\']=\'git@github.com:seeruo/seeruo.github.io.git\';','error');
}
$Git = new GitService($this->config);
... | php | public function pushGit()
{
if (!isset($this->config['git_address'])) {
Log::info('Git地址没有配置,请在Config.php文件参照如下方式配置:' );
Log::info('$config[\'git_address\']=\'git@github.com:seeruo/seeruo.github.io.git\';','error');
}
$Git = new GitService($this->config);
... | [
"public",
"function",
"pushGit",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'git_address'",
"]",
")",
")",
"{",
"Log",
"::",
"info",
"(",
"'Git地址没有配置,请在Config.php文件参照如下方式配置:' );",
"",
"",
"Log",
"::",
"info",
"(",
"... | [Git推送方式]
@return [type] [description] | [
"[",
"Git推送方式",
"]"
] | train | https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Service/PushService.php#L92-L104 |
seeruo/framework | src/Service/PushService.php | PushService.pushGitInit | public function pushGitInit()
{
if (!isset($this->config['git_address'])) {
Log::info('Git地址没有配置,请在Config.php文件参照如下方式配置:' );
Log::info('$config[\'git_address\']=\'git@github.com:seeruo/seeruo.github.io.git\';','error');
}
$Git = new GitService($this->config);
... | php | public function pushGitInit()
{
if (!isset($this->config['git_address'])) {
Log::info('Git地址没有配置,请在Config.php文件参照如下方式配置:' );
Log::info('$config[\'git_address\']=\'git@github.com:seeruo/seeruo.github.io.git\';','error');
}
$Git = new GitService($this->config);
... | [
"public",
"function",
"pushGitInit",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"'git_address'",
"]",
")",
")",
"{",
"Log",
"::",
"info",
"(",
"'Git地址没有配置,请在Config.php文件参照如下方式配置:' );",
"",
"",
"Log",
"::",
"info",
"(",... | [Git仓库初始化]
@return [type] [description] | [
"[",
"Git仓库初始化",
"]"
] | train | https://github.com/seeruo/framework/blob/689c6e95bc95fe2ae037e056d8228820dd08d7e9/src/Service/PushService.php#L110-L125 |
Lansoweb/LosBase | src/LosBase/Document/DocumentManagerAwareTrait.php | DocumentManagerAwareTrait.getDocumentManager | public function getDocumentManager()
{
if (null === $this->dm) {
$this->dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');
}
return $this->dm;
} | php | public function getDocumentManager()
{
if (null === $this->dm) {
$this->dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');
}
return $this->dm;
} | [
"public",
"function",
"getDocumentManager",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"dm",
")",
"{",
"$",
"this",
"->",
"dm",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'doctrine.documentmanager.odm_default... | Retorna o DocumentManager.
@return \Doctrine\ODM\MongoDb\DocumentManager | [
"Retorna",
"o",
"DocumentManager",
"."
] | train | https://github.com/Lansoweb/LosBase/blob/90e18a53d29c1bd841c149dca43aa365eecc656d/src/LosBase/Document/DocumentManagerAwareTrait.php#L29-L36 |
linkorb/graphael | src/AbstractPdoObjectType.php | AbstractPdoObjectType.getBy | protected function getBy($key, $value)
{
$stmt = $this->pdo->prepare('SELECT * FROM ' . $this->tableName . ' WHERE ' . $key . ' = :value');
$result = $stmt->execute(['value'=>$value]);
return $this->processRow($stmt->fetch(PDO::FETCH_ASSOC));
} | php | protected function getBy($key, $value)
{
$stmt = $this->pdo->prepare('SELECT * FROM ' . $this->tableName . ' WHERE ' . $key . ' = :value');
$result = $stmt->execute(['value'=>$value]);
return $this->processRow($stmt->fetch(PDO::FETCH_ASSOC));
} | [
"protected",
"function",
"getBy",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"pdo",
"->",
"prepare",
"(",
"'SELECT * FROM '",
".",
"$",
"this",
"->",
"tableName",
".",
"' WHERE '",
".",
"$",
"key",
".",
"' = :v... | TODO: rename to getOneBy | [
"TODO",
":",
"rename",
"to",
"getOneBy"
] | train | https://github.com/linkorb/graphael/blob/ce79b58d31f6703f23db36475e971080ff7f2a1f/src/AbstractPdoObjectType.php#L21-L26 |
ClanCats/Core | src/bundles/UI/HTML.php | HTML.maker | public static function maker( $param, $param2 = null )
{
if ( !is_null( $param2 ) )
{
return static::create( $param, $param2 );
}
$param = explode( ' ', $param );
$element = array_shift( $param );
return static::create( $element, implode( ' ', $param ) );
} | php | public static function maker( $param, $param2 = null )
{
if ( !is_null( $param2 ) )
{
return static::create( $param, $param2 );
}
$param = explode( ' ', $param );
$element = array_shift( $param );
return static::create( $element, implode( ' ', $param ) );
} | [
"public",
"static",
"function",
"maker",
"(",
"$",
"param",
",",
"$",
"param2",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"param2",
")",
")",
"{",
"return",
"static",
"::",
"create",
"(",
"$",
"param",
",",
"$",
"param2",
")",
"... | The maker is like a development shortcut to create
html elements on the go
If param2 is set it wil be used as the content otherwise
the the first parameter will be splittet by the first space.
@param string $param
@param string $param2 | [
"The",
"maker",
"is",
"like",
"a",
"development",
"shortcut",
"to",
"create",
"html",
"elements",
"on",
"the",
"go"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L23-L35 |
ClanCats/Core | src/bundles/UI/HTML.php | HTML.attr | public static function attr( $attr = array() ) {
$buffer = " ";
foreach( $attr as $key => $value ) {
switch( $key ) {
case 'class':
if ( is_array( $value ) ) { $value = implode( ' ', $value ); }
break;
case 'style':
if ( is_array( $value ) ) {
$style = $value; $value = "";
... | php | public static function attr( $attr = array() ) {
$buffer = " ";
foreach( $attr as $key => $value ) {
switch( $key ) {
case 'class':
if ( is_array( $value ) ) { $value = implode( ' ', $value ); }
break;
case 'style':
if ( is_array( $value ) ) {
$style = $value; $value = "";
... | [
"public",
"static",
"function",
"attr",
"(",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"$",
"buffer",
"=",
"\" \"",
";",
"foreach",
"(",
"$",
"attr",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"key",
")",
"{",
"cas... | generates html attribute string
@param array $attr | [
"generates",
"html",
"attribute",
"string"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L42-L66 |
ClanCats/Core | src/bundles/UI/HTML.php | HTML.tag | public static function tag( $name, $param1 = null, $param2 = null )
{
return static::create( $name, $param1, $param2 );
} | php | public static function tag( $name, $param1 = null, $param2 = null )
{
return static::create( $name, $param1, $param2 );
} | [
"public",
"static",
"function",
"tag",
"(",
"$",
"name",
",",
"$",
"param1",
"=",
"null",
",",
"$",
"param2",
"=",
"null",
")",
"{",
"return",
"static",
"::",
"create",
"(",
"$",
"name",
",",
"$",
"param1",
",",
"$",
"param2",
")",
";",
"}"
] | generates an html tag
@param string $name
@param mixed $param1
@param mixed $param2 | [
"generates",
"an",
"html",
"tag"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L75-L78 |
ClanCats/Core | src/bundles/UI/HTML.php | HTML.add_class | public function add_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
if ( strpos( $class, ' ' ) !== false ) {
$class = explode( ' ', $class );
}
if ( is_string( $class ) ) {
$class = array( $class );
}
foreach ( $class as $... | php | public function add_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
if ( strpos( $class, ' ' ) !== false ) {
$class = explode( ' ', $class );
}
if ( is_string( $class ) ) {
$class = array( $class );
}
foreach ( $class as $... | [
"public",
"function",
"add_class",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"... | add html class
@param string $class | [
"add",
"html",
"class"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L95-L109 |
ClanCats/Core | src/bundles/UI/HTML.php | HTML.remove_class | public function remove_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
$this->attr['class'] = array_diff( $this->attr['class'], array( $class ) );
return $this;
} | php | public function remove_class( $class ) {
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->_sanitize_class();
}
$this->attr['class'] = array_diff( $this->attr['class'], array( $class ) );
return $this;
} | [
"public",
"function",
"remove_class",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
"||",
"!",
"is_array",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
... | remove html class
@param string $class | [
"remove",
"html",
"class"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L116-L122 |
ClanCats/Core | src/bundles/UI/HTML.php | HTML._sanitize_class | private function _sanitize_class() {
if ( isset( $this->attr['class'] ) && is_string( $this->attr['class'] ) ) {
$this->attr['class'] = explode( ' ', $this->attr['class'] );
}
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->attr['class'] = array();
}
} | php | private function _sanitize_class() {
if ( isset( $this->attr['class'] ) && is_string( $this->attr['class'] ) ) {
$this->attr['class'] = explode( ' ', $this->attr['class'] );
}
if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
$this->attr['class'] = array();
}
} | [
"private",
"function",
"_sanitize_class",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
"&&",
"is_string",
"(",
"$",
"this",
"->",
"attr",
"[",
"'class'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"attr",... | clean the classes attribute | [
"clean",
"the",
"classes",
"attribute"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/HTML.php#L127-L134 |
inpsyde/inpsyde-filter | src/WordPress/SanitizeTitleWithDashes.php | SanitizeTitleWithDashes.filter | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
$raw_title = (string) $this->options[ 'raw_title' ];
$context = (string) ... | php | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
$raw_title = (string) $this->options[ 'raw_title' ];
$context = (string) ... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"do_action",
"(",
"'inpsyde.filter.error'",
",",
"'The given value is not string or empty.'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/WordPress/SanitizeTitleWithDashes.php#L25-L36 |
webforge-labs/psc-cms | lib/Psc/TPL/Template.php | Template.validate | public function validate() {
if (!isset($this->fileName)) {
throw new Exception('fileName muss gesetzt sein');
}
$file = (string) $this->getDirectory().implode(DIRECTORY_SEPARATOR,(array) $this->fileName).$this->extension;
$file = new File($file);
if (!$file->getDirectory()->isSubdir... | php | public function validate() {
if (!isset($this->fileName)) {
throw new Exception('fileName muss gesetzt sein');
}
$file = (string) $this->getDirectory().implode(DIRECTORY_SEPARATOR,(array) $this->fileName).$this->extension;
$file = new File($file);
if (!$file->getDirectory()->isSubdir... | [
"public",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fileName",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'fileName muss gesetzt sein'",
")",
";",
"}",
"$",
"file",
"=",
"(",
"string",
")",
"$",
"... | Überprüft die Sicherheit des Templates
z.b. darf keine Datei includiert werden die außerhalb des tpl Verzeichnisses liegt ($this->getDirectory())
@return bool | [
"Überprüft",
"die",
"Sicherheit",
"des",
"Templates"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/Template.php#L102-L117 |
webforge-labs/psc-cms | lib/Psc/TPL/Template.php | Template.get | public function get() {
$__html = NULL;
if ($this->validate()) {
/* dies ersetzt variablen die durch das template verändert werden können: $$__varName */
extract((array)$this->vars);
$tpl = $this;
/* get as String */
try {
ob_start();
require $this... | php | public function get() {
$__html = NULL;
if ($this->validate()) {
/* dies ersetzt variablen die durch das template verändert werden können: $$__varName */
extract((array)$this->vars);
$tpl = $this;
/* get as String */
try {
ob_start();
require $this... | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"__html",
"=",
"NULL",
";",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"/* dies ersetzt variablen die durch das template verändert werden können: $$__varName */",
"extract",
"(",
"(",
"array",
")"... | Gibt das Template als String zurück
@return string | [
"Gibt",
"das",
"Template",
"als",
"String",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/TPL/Template.php#L124-L162 |
php-rise/rise | src/Database.php | Database.getConnectionConfig | public function getConnectionConfig($name = null) {
if (is_null($name)) {
$name = $this->defaultConfigName;
}
if (isset($this->connectionConfigs[$name])) {
return $this->connectionConfigs[$name];
}
return null;
} | php | public function getConnectionConfig($name = null) {
if (is_null($name)) {
$name = $this->defaultConfigName;
}
if (isset($this->connectionConfigs[$name])) {
return $this->connectionConfigs[$name];
}
return null;
} | [
"public",
"function",
"getConnectionConfig",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"defaultConfigName",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"... | Get connection config.
@param string $name
@return array|null | [
"Get",
"connection",
"config",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Database.php#L48-L58 |
php-rise/rise | src/Database.php | Database.getConnection | public function getConnection($name = null, $forceNew = false) {
if (!$forceNew && isset($this->connections[$name])) {
return $this->connections[$name];
}
$config = $this->getConnectionConfig($name);
if (!$config) {
return null;
}
$pdoArgs = [$config['dsn'], $config['username'], $config['password']... | php | public function getConnection($name = null, $forceNew = false) {
if (!$forceNew && isset($this->connections[$name])) {
return $this->connections[$name];
}
$config = $this->getConnectionConfig($name);
if (!$config) {
return null;
}
$pdoArgs = [$config['dsn'], $config['username'], $config['password']... | [
"public",
"function",
"getConnection",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"forceNew",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"forceNew",
"&&",
"isset",
"(",
"$",
"this",
"->",
"connections",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return... | Get a connection by name.
@param string $name Optional. Connection name.
@param bool $forceNew Optional. Create a new connection or reuse the old one if exists.
@return \PDO|null | [
"Get",
"a",
"connection",
"by",
"name",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Database.php#L79-L101 |
php-rise/rise | src/Database.php | Database.readConfig | public function readConfig() {
$file = $this->path->getConfigPath() . '/database.php';
if (file_exists($file)) {
$config = require($file);
$this->defaultConfigName = $config['default'];
$this->connectionConfigs = $config['connections'];
}
} | php | public function readConfig() {
$file = $this->path->getConfigPath() . '/database.php';
if (file_exists($file)) {
$config = require($file);
$this->defaultConfigName = $config['default'];
$this->connectionConfigs = $config['connections'];
}
} | [
"public",
"function",
"readConfig",
"(",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"path",
"->",
"getConfigPath",
"(",
")",
".",
"'/database.php'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"$",
"config",
"=",
"require",
"(... | Read configuration file. | [
"Read",
"configuration",
"file",
"."
] | train | https://github.com/php-rise/rise/blob/cd14ef9956f1b6875b7bcd642545dcef6a9152b7/src/Database.php#L118-L125 |
Chill-project/Main | Search/AbstractSearch.php | AbstractSearch.parseDate | public function parseDate($string)
{
try {
return new \DateTime($string);
} catch (ParsingException $ex) {
$exception = new ParsingException('The date is '
. 'not parsable', 0, $ex);
throw $exception;
}
} | php | public function parseDate($string)
{
try {
return new \DateTime($string);
} catch (ParsingException $ex) {
$exception = new ParsingException('The date is '
. 'not parsable', 0, $ex);
throw $exception;
}
} | [
"public",
"function",
"parseDate",
"(",
"$",
"string",
")",
"{",
"try",
"{",
"return",
"new",
"\\",
"DateTime",
"(",
"$",
"string",
")",
";",
"}",
"catch",
"(",
"ParsingException",
"$",
"ex",
")",
"{",
"$",
"exception",
"=",
"new",
"ParsingException",
... | parse string expected to be a date and transform to a DateTime object
@param type $string
@return \DateTime
@throws ParsingException if the date is not parseable | [
"parse",
"string",
"expected",
"to",
"be",
"a",
"date",
"and",
"transform",
"to",
"a",
"DateTime",
"object"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/AbstractSearch.php#L45-L55 |
Chill-project/Main | Search/AbstractSearch.php | AbstractSearch.recomposePattern | protected function recomposePattern(array $terms, array $supportedTerms, $domain = NULL)
{
$recomposed = '';
if ($domain !== NULL)
{
$recomposed .= '@'.$domain.' ';
}
foreach ($supportedTerms as $term) {
if (array_key_exists($term, $t... | php | protected function recomposePattern(array $terms, array $supportedTerms, $domain = NULL)
{
$recomposed = '';
if ($domain !== NULL)
{
$recomposed .= '@'.$domain.' ';
}
foreach ($supportedTerms as $term) {
if (array_key_exists($term, $t... | [
"protected",
"function",
"recomposePattern",
"(",
"array",
"$",
"terms",
",",
"array",
"$",
"supportedTerms",
",",
"$",
"domain",
"=",
"NULL",
")",
"{",
"$",
"recomposed",
"=",
"''",
";",
"if",
"(",
"$",
"domain",
"!==",
"NULL",
")",
"{",
"$",
"recompo... | recompose a pattern, retaining only supported terms
the outputted string should be used to show users their search
@param array $terms
@param array $supportedTerms
@param string $domain if your domain is NULL, you should set NULL. You should set used domain instead
@return string | [
"recompose",
"a",
"pattern",
"retaining",
"only",
"supported",
"terms"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Search/AbstractSearch.php#L67-L93 |
webforge-labs/psc-cms | lib/Psc/CMS/Item/ButtonableValueObject.php | ButtonableValueObject.copyFromButtonable | public static function copyFromButtonable(Buttonable $tabButtonable) {
$valueObject = new static();
// ugly, but fast
$valueObject->setButtonLabel($tabButtonable->getButtonLabel());
$valueObject->setFullButtonLabel($tabButtonable->getFullButtonLabel());
$valueObject->setButtonLeftIcon($tabButto... | php | public static function copyFromButtonable(Buttonable $tabButtonable) {
$valueObject = new static();
// ugly, but fast
$valueObject->setButtonLabel($tabButtonable->getButtonLabel());
$valueObject->setFullButtonLabel($tabButtonable->getFullButtonLabel());
$valueObject->setButtonLeftIcon($tabButto... | [
"public",
"static",
"function",
"copyFromButtonable",
"(",
"Buttonable",
"$",
"tabButtonable",
")",
"{",
"$",
"valueObject",
"=",
"new",
"static",
"(",
")",
";",
"// ugly, but fast",
"$",
"valueObject",
"->",
"setButtonLabel",
"(",
"$",
"tabButtonable",
"->",
"g... | Creates a copy of an Buttonable
use this to have a modified Version of the interface
@return ButtonableValueObject | [
"Creates",
"a",
"copy",
"of",
"an",
"Buttonable"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Item/ButtonableValueObject.php#L25-L36 |
terion-name/package-installer | src/Terion/PackageInstaller/PackageInstallCommand.php | PackageInstallCommand.fire | public function fire()
{
$packageName = $this->argument('packageName');
if (strpos($packageName, '/') !== false) {
$this->getPackage($packageName);
} else {
$this->searchPackage($packageName);
}
} | php | public function fire()
{
$packageName = $this->argument('packageName');
if (strpos($packageName, '/') !== false) {
$this->getPackage($packageName);
} else {
$this->searchPackage($packageName);
}
} | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"packageName",
"=",
"$",
"this",
"->",
"argument",
"(",
"'packageName'",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"packageName",
",",
"'/'",
")",
"!==",
"false",
")",
"{",
"$",
"this",
"->",
"getPacka... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L74-L82 |
terion-name/package-installer | src/Terion/PackageInstaller/PackageInstallCommand.php | PackageInstallCommand.getPackage | protected function getPackage($packageName)
{
try {
$package = $this->packagist->get($packageName);
$this->getOutput()->writeln(sprintf(
'Package to install: <info>%s</info> (%s)',
$package->getName(),
$package->getDescription()
... | php | protected function getPackage($packageName)
{
try {
$package = $this->packagist->get($packageName);
$this->getOutput()->writeln(sprintf(
'Package to install: <info>%s</info> (%s)',
$package->getName(),
$package->getDescription()
... | [
"protected",
"function",
"getPackage",
"(",
"$",
"packageName",
")",
"{",
"try",
"{",
"$",
"package",
"=",
"$",
"this",
"->",
"packagist",
"->",
"get",
"(",
"$",
"packageName",
")",
";",
"$",
"this",
"->",
"getOutput",
"(",
")",
"->",
"writeln",
"(",
... | Try to get a package by name. If not present — search it.
@param $packageName | [
"Try",
"to",
"get",
"a",
"package",
"by",
"name",
".",
"If",
"not",
"present",
"—",
"search",
"it",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/PackageInstallCommand.php#L89-L102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.