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 |
|---|---|---|---|---|---|---|---|---|---|---|
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.filter | public function filter($value)
{
//translitere specific chars
$value = $this->transliterateCzech($value);
$value = $this->transliterateSlovak($value);
$value = $this->transliterateRussian($value);
$value = $this->transliterateGerman($value);
$value = $this->transliter... | php | public function filter($value)
{
//translitere specific chars
$value = $this->transliterateCzech($value);
$value = $this->transliterateSlovak($value);
$value = $this->transliterateRussian($value);
$value = $this->transliterateGerman($value);
$value = $this->transliter... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"//translitere specific chars",
"$",
"value",
"=",
"$",
"this",
"->",
"transliterateCzech",
"(",
"$",
"value",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"transliterateSlovak",
"(",
"$",
"va... | Defined by Zend_Filter_Interface
Returns $value translitered to ASCII
@param string $value
@return string | [
"Defined",
"by",
"Zend_Filter_Interface"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L37-L66 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliterateRussian | private function transliterateRussian($s)
{
$table = array(
"А" => "A",
"Б" => "B",
"В" => "V",
"Г" => "G",
"Д" => "D",
"Є" => "E",
"Е" => "JE",
"Ё" => "JO",
"Ж" => "ZH",
"З" => "Z",
... | php | private function transliterateRussian($s)
{
$table = array(
"А" => "A",
"Б" => "B",
"В" => "V",
"Г" => "G",
"Д" => "D",
"Є" => "E",
"Е" => "JE",
"Ё" => "JO",
"Ж" => "ZH",
"З" => "Z",
... | [
"private",
"function",
"transliterateRussian",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"\"А\" ",
"> ",
"A\",",
"",
"\"Б\" ",
"> ",
"B\",",
"",
"\"В\" ",
"> ",
"V\",",
"",
"\"Г\" ",
"> ",
"G\",",
"",
"\"Д\" ",
"> ",
"D\",",
"",
"\"Є\... | Transliterate Russian chars (Cyrillic)
@param string $s
@return string | [
"Transliterate",
"Russian",
"chars",
"(",
"Cyrillic",
")"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L74-L151 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliterateCzech | private function transliterateCzech($s)
{
$table = array(
'á' => 'a',
'č' => 'c',
'ď' => 'd',
'é' => 'e',
'ě' => 'e',
'í' => 'i',
'ň' => 'n',
'ó' => 'o',
'ř' => 'r',
'š' => 's',
... | php | private function transliterateCzech($s)
{
$table = array(
'á' => 'a',
'č' => 'c',
'ď' => 'd',
'é' => 'e',
'ě' => 'e',
'í' => 'i',
'ň' => 'n',
'ó' => 'o',
'ř' => 'r',
'š' => 's',
... | [
"private",
"function",
"transliterateCzech",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"'á' ",
"> ",
"a',",
"",
"'č' ",
"> ",
"c',",
"",
"'ď' ",
"> ",
"d',",
"",
"'é' ",
"> ",
"e',",
"",
"'ě' ",
"> ",
"e',",
"",
"'í' ",
"> ",
"i',... | Transliterate Czech chars
@param string $s
@return string | [
"Transliterate",
"Czech",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L159-L194 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliterateGerman | private function transliterateGerman($s)
{
$table = array(
//'ä' => 'ae', //messes up with slovak -> they have ä -> a
'ë' => 'e',
'ï' => 'i',
'ö' => 'oe',
'ü' => 'ue',
'Ä' => 'Ae',
'Ë' => 'E',
'Ï' => 'I',
... | php | private function transliterateGerman($s)
{
$table = array(
//'ä' => 'ae', //messes up with slovak -> they have ä -> a
'ë' => 'e',
'ï' => 'i',
'ö' => 'oe',
'ü' => 'ue',
'Ä' => 'Ae',
'Ë' => 'E',
'Ï' => 'I',
... | [
"private",
"function",
"transliterateGerman",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"//'ä' => 'ae', //messes up with slovak -> they have ä -> a",
"'ë' ",
"> ",
"e',",
"",
"'ï' ",
"> ",
"i',",
"",
"'ö' ",
"> ",
"oe',",
"",
"'ü' ",
"> ",
"ue'... | Transliterate German chars
@param string $s
@return string | [
"Transliterate",
"German",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L202-L218 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliterateHungarian | private function transliterateHungarian($s)
{
$table = array(
'á' => 'a',
'é' => 'e',
'í' => 'i',
'ó' => 'o',
'ö' => 'o',
'ő' => 'o',
'ú' => 'u',
'ü' => 'u',
'ű' => 'u',
);
return strt... | php | private function transliterateHungarian($s)
{
$table = array(
'á' => 'a',
'é' => 'e',
'í' => 'i',
'ó' => 'o',
'ö' => 'o',
'ő' => 'o',
'ú' => 'u',
'ü' => 'u',
'ű' => 'u',
);
return strt... | [
"private",
"function",
"transliterateHungarian",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"'á' ",
"> ",
"a',",
"",
"'é' ",
"> ",
"e',",
"",
"'í' ",
"> ",
"i',",
"",
"'ó' ",
"> ",
"o',",
"",
"'ö' ",
"> ",
"o',",
"",
"'ő' ",
"> ",
... | Transliterate Hungarian chars
@param string $s
@return string | [
"Transliterate",
"Hungarian",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L254-L268 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliteratePolish | private function transliteratePolish($s)
{
$table = array(
'ą' => 'a',
'ę' => 'e',
'ó' => 'o',
'ć' => 'c',
'ł' => 'l',
'ń' => 'n',
'ś' => 's',
'ż' => 'z',
'ź' => 'z',
'Ó' => 'O',
'Ć' => 'C',
'Ł' => 'L',
'... | php | private function transliteratePolish($s)
{
$table = array(
'ą' => 'a',
'ę' => 'e',
'ó' => 'o',
'ć' => 'c',
'ł' => 'l',
'ń' => 'n',
'ś' => 's',
'ż' => 'z',
'ź' => 'z',
'Ó' => 'O',
'Ć' => 'C',
'Ł' => 'L',
'... | [
"private",
"function",
"transliteratePolish",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"'ą' ",
"> ",
"a',",
"",
"'ę' ",
"> ",
"e',",
"",
"'ó' ",
"> ",
"o',",
"",
"'ć' ",
"> ",
"c',",
"",
"'ł' ",
"> ",
"l',",
"",
"'ń' ",
"> ",
"n'... | Transliterate Polish chars
@param string $s
@return string | [
"Transliterate",
"Polish",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L276-L296 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliterateDanish | private function transliterateDanish($s)
{
$table = array(
'æ' => 'ae',
'ø' => 'oe',
'å' => 'aa',
'Æ' => 'Ae',
'Ø' => 'Oe',
'Å' => 'Aa'
);
return strtr($s, $table);
} | php | private function transliterateDanish($s)
{
$table = array(
'æ' => 'ae',
'ø' => 'oe',
'å' => 'aa',
'Æ' => 'Ae',
'Ø' => 'Oe',
'Å' => 'Aa'
);
return strtr($s, $table);
} | [
"private",
"function",
"transliterateDanish",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"'æ' ",
"> ",
"ae',",
"",
"'ø' ",
"> ",
"oe',",
"",
"'å' ",
"> ",
"aa',",
"",
"'Æ' ",
"> ",
"Ae',",
"",
"'Ø' ",
"> ",
"Oe',",
"",
"'Å' ",
"> ",
... | Transliterate Danish chars
@param string $s
@return string | [
"Transliterate",
"Danish",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L304-L315 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliterateCroatian | private function transliterateCroatian($s)
{
$table = array(
'Č' => 'C',
'Ć' => 'C',
'Ž' => 'Z',
'Š' => 'S',
'Đ' => 'D',
'č' => 'c',
'ć' => 'c',
'ž' => 'z',
'š' => 's',
'đ' => 'd',
... | php | private function transliterateCroatian($s)
{
$table = array(
'Č' => 'C',
'Ć' => 'C',
'Ž' => 'Z',
'Š' => 'S',
'Đ' => 'D',
'č' => 'c',
'ć' => 'c',
'ž' => 'z',
'š' => 's',
'đ' => 'd',
... | [
"private",
"function",
"transliterateCroatian",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"'Č' ",
"> ",
"C',",
"",
"'Ć' ",
"> ",
"C',",
"",
"'Ž' ",
"> ",
"Z',",
"",
"'Š' ",
"> ",
"S',",
"",
"'Đ' ",
"> ",
"D',",
"",
"'č' ",
"> ",
"... | Transliterate Croatian chars
@param string $s
@return string | [
"Transliterate",
"Croatian",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L323-L338 |
gregorybesson/PlaygroundCore | src/Filter/Transliteration.php | Transliteration.transliterateSlovak | private function transliterateSlovak($s)
{
$table = array(
'á' => 'a',
'Á' => 'A',
'ä' => 'a',
'Ä' => 'A',
'č' => 'c',
'Č' => 'C',
'ď' => 'd',
'Ď' => 'D',
'é' => 'e',
'É' => 'E',
... | php | private function transliterateSlovak($s)
{
$table = array(
'á' => 'a',
'Á' => 'A',
'ä' => 'a',
'Ä' => 'A',
'č' => 'c',
'Č' => 'C',
'ď' => 'd',
'Ď' => 'D',
'é' => 'e',
'É' => 'E',
... | [
"private",
"function",
"transliterateSlovak",
"(",
"$",
"s",
")",
"{",
"$",
"table",
"=",
"array",
"(",
"'á' ",
"> ",
"a',",
"",
"'Á' ",
"> ",
"A',",
"",
"'ä' ",
"> ",
"a',",
"",
"'Ä' ",
"> ",
"A',",
"",
"'č' ",
"> ",
"c',",
"",
"'Č' ",
"> ",
"C'... | Transliterate Slovak chars
@param string $s
@return string | [
"Transliterate",
"Slovak",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Transliteration.php#L346-L385 |
huasituo/hstcms | src/Providers/MiddlewareServiceProvider.php | MiddlewareServiceProvider.register | public function register()
{
$this->app->singleton('manage.request.log', function ($app) {
return new \Huasituo\Hstcms\Http\Middleware\RequestLog($app['hstcms']);
});
$this->app->singleton('manage.auth.check', function ($app) {
return new \Huasituo\Hstcms\Http\Middlew... | php | public function register()
{
$this->app->singleton('manage.request.log', function ($app) {
return new \Huasituo\Hstcms\Http\Middleware\RequestLog($app['hstcms']);
});
$this->app->singleton('manage.auth.check', function ($app) {
return new \Huasituo\Hstcms\Http\Middlew... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'manage.request.log'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"\\",
"Huasituo",
"\\",
"Hstcms",
"\\",
"Http",
"\\",
"Middleware",
"\... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/MiddlewareServiceProvider.php#L24-L47 |
edmondscommerce/behat-faker-context | src/FakerContext.php | FakerContext.fillForm | protected function fillForm(Element\NodeElement $form)
{
$inputs = $form->findAll('css', 'input[type="text"]');
foreach ($inputs as $i)
{
/** @var Element\NodeElement $i */
if ($i->isVisible())
{
if ($i->hasAttribute('name'))
... | php | protected function fillForm(Element\NodeElement $form)
{
$inputs = $form->findAll('css', 'input[type="text"]');
foreach ($inputs as $i)
{
/** @var Element\NodeElement $i */
if ($i->isVisible())
{
if ($i->hasAttribute('name'))
... | [
"protected",
"function",
"fillForm",
"(",
"Element",
"\\",
"NodeElement",
"$",
"form",
")",
"{",
"$",
"inputs",
"=",
"$",
"form",
"->",
"findAll",
"(",
"'css'",
",",
"'input[type=\"text\"]'",
")",
";",
"foreach",
"(",
"$",
"inputs",
"as",
"$",
"i",
")",
... | Fuzz fill all form fields with random data
@param Element\NodeElement $form | [
"Fuzz",
"fill",
"all",
"form",
"fields",
"with",
"random",
"data"
] | train | https://github.com/edmondscommerce/behat-faker-context/blob/7c616daf7a8bab9093a1b8a3c608d644a929f715/src/FakerContext.php#L63-L135 |
Srokap/code_review | classes/CodeReview/CodeFixer.php | CodeFixer.getBasicFunctionRenames | public function getBasicFunctionRenames($maxVersion = '') {
$data = array(
'1.7' => array(
'elgg_validate_action_url' => 'elgg_add_action_tokens_to_url',
'menu_item' => 'make_register_object',
'extend_view' => 'elgg_extend_view',
'get_views' => 'elgg_get_views',
),
'1.8' => array(
'regist... | php | public function getBasicFunctionRenames($maxVersion = '') {
$data = array(
'1.7' => array(
'elgg_validate_action_url' => 'elgg_add_action_tokens_to_url',
'menu_item' => 'make_register_object',
'extend_view' => 'elgg_extend_view',
'get_views' => 'elgg_get_views',
),
'1.8' => array(
'regist... | [
"public",
"function",
"getBasicFunctionRenames",
"(",
"$",
"maxVersion",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'1.7'",
"=>",
"array",
"(",
"'elgg_validate_action_url'",
"=>",
"'elgg_add_action_tokens_to_url'",
",",
"'menu_item'",
"=>",
"'make_registe... | Just basic function renames from A to B
@param string $maxVersion Maximum Elgg version to support
@return array | [
"Just",
"basic",
"function",
"renames",
"from",
"A",
"to",
"B"
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/CodeReview/CodeFixer.php#L12-L97 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Ext/ResponseGenerator.php | ResponseGenerator.fromException | public function fromException( Exception $exception )
{
return $this->generateResponse(
xmlrpc_encode_request(
null,
array(
'faultCode' => $exception->getCode(),
'faultString' => $exception->getMessage()
)
... | php | public function fromException( Exception $exception )
{
return $this->generateResponse(
xmlrpc_encode_request(
null,
array(
'faultCode' => $exception->getCode(),
'faultString' => $exception->getMessage()
)
... | [
"public",
"function",
"fromException",
"(",
"Exception",
"$",
"exception",
")",
"{",
"return",
"$",
"this",
"->",
"generateResponse",
"(",
"xmlrpc_encode_request",
"(",
"null",
",",
"array",
"(",
"'faultCode'",
"=>",
"$",
"exception",
"->",
"getCode",
"(",
")"... | Generates an XMLRPC HTTP response for the Exception $e
@param \Exception $e
@return \Symfony\Component\HttpFoundation\Response | [
"Generates",
"an",
"XMLRPC",
"HTTP",
"response",
"for",
"the",
"Exception",
"$e"
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Ext/ResponseGenerator.php#L31-L42 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Ext/ResponseGenerator.php | ResponseGenerator.fixUpTypes | protected function fixUpTypes( $response )
{
if ( is_array( $response ) )
{
foreach ( $response as &$value )
{
$value = $this->fixUpTypes( $value );
}
}
if ( $response instanceof DateTime )
{
$response = $respon... | php | protected function fixUpTypes( $response )
{
if ( is_array( $response ) )
{
foreach ( $response as &$value )
{
$value = $this->fixUpTypes( $value );
}
}
if ( $response instanceof DateTime )
{
$response = $respon... | [
"protected",
"function",
"fixUpTypes",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"response",
")",
")",
"{",
"foreach",
"(",
"$",
"response",
"as",
"&",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"fixUpTypes",... | Fixes up | [
"Fixes",
"up"
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Ext/ResponseGenerator.php#L64-L81 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderEmailManager.php | OrderEmailManager.sendConfirmationEmail | public function sendConfirmationEmail(
$recipient,
ApiOrderInterface $apiOrder,
$templatePath,
ContactInterface $customerContact = null
) {
if (empty($recipient)) {
$this->writeLog('No recipient specified.');
return false;
}
$tmplData... | php | public function sendConfirmationEmail(
$recipient,
ApiOrderInterface $apiOrder,
$templatePath,
ContactInterface $customerContact = null
) {
if (empty($recipient)) {
$this->writeLog('No recipient specified.');
return false;
}
$tmplData... | [
"public",
"function",
"sendConfirmationEmail",
"(",
"$",
"recipient",
",",
"ApiOrderInterface",
"$",
"apiOrder",
",",
"$",
"templatePath",
",",
"ContactInterface",
"$",
"customerContact",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"recipient",
")",
"... | @param string $recipient The email-address of the customer
@param ApiOrderInterface $apiOrder
@param string $templatePath Template to render
@param ContactInterface|null $customerContact
@return bool | [
"@param",
"string",
"$recipient",
"The",
"email",
"-",
"address",
"of",
"the",
"customer",
"@param",
"ApiOrderInterface",
"$apiOrder",
"@param",
"string",
"$templatePath",
"Template",
"to",
"render",
"@param",
"ContactInterface|null",
"$customerContact"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderEmailManager.php#L151-L169 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderEmailManager.php | OrderEmailManager.sendOrderMail | public function sendOrderMail(
$recipient,
$templatePath,
$data = array(),
ApiOrderInterface $apiOrder = null,
$blindCopyRecipients = array()
) {
$tmplData = array_merge(
$data,
array(
'footerTxt' => $this->templateFooterTxtPath... | php | public function sendOrderMail(
$recipient,
$templatePath,
$data = array(),
ApiOrderInterface $apiOrder = null,
$blindCopyRecipients = array()
) {
$tmplData = array_merge(
$data,
array(
'footerTxt' => $this->templateFooterTxtPath... | [
"public",
"function",
"sendOrderMail",
"(",
"$",
"recipient",
",",
"$",
"templatePath",
",",
"$",
"data",
"=",
"array",
"(",
")",
",",
"ApiOrderInterface",
"$",
"apiOrder",
"=",
"null",
",",
"$",
"blindCopyRecipients",
"=",
"array",
"(",
")",
")",
"{",
"... | Sends an email
@param string $recipient
@param string $templatePath
@param array $data
@param ApiOrderInterface $apiOrder
@param array $blindCopyRecipients Recipients to send bcc
@return bool | [
"Sends",
"an",
"email"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderEmailManager.php#L182-L238 |
tequila/mongodb-php-lib | src/Index.php | Index.generateIndexName | public static function generateIndexName(array $key)
{
$nameParts = [];
foreach ($key as $fieldName => $direction) {
$nameParts[] = $fieldName;
$nameParts[] = (string) $direction;
}
return implode('_', $nameParts);
} | php | public static function generateIndexName(array $key)
{
$nameParts = [];
foreach ($key as $fieldName => $direction) {
$nameParts[] = $fieldName;
$nameParts[] = (string) $direction;
}
return implode('_', $nameParts);
} | [
"public",
"static",
"function",
"generateIndexName",
"(",
"array",
"$",
"key",
")",
"{",
"$",
"nameParts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"key",
"as",
"$",
"fieldName",
"=>",
"$",
"direction",
")",
"{",
"$",
"nameParts",
"[",
"]",
"=",
"$",... | @param array $key
@return string | [
"@param",
"array",
"$key"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Index.php#L85-L94 |
GokulSrinivas/Sangria | src/Sangria/IMAPAuth.php | IMAPAuth.tauth | public static function tauth($user_name, $user_pass)
{
$imap_server_address=__SANGRIA_IMAP_SERVER_ADDR__;
$imap_port=__SANGRIA_IMAP_SERVER_PORT__;
try
{
$imap_stream = \fsockopen($imap_server_address,$imap_port);
if ( !$imap_stream )
{
... | php | public static function tauth($user_name, $user_pass)
{
$imap_server_address=__SANGRIA_IMAP_SERVER_ADDR__;
$imap_port=__SANGRIA_IMAP_SERVER_PORT__;
try
{
$imap_stream = \fsockopen($imap_server_address,$imap_port);
if ( !$imap_stream )
{
... | [
"public",
"static",
"function",
"tauth",
"(",
"$",
"user_name",
",",
"$",
"user_pass",
")",
"{",
"$",
"imap_server_address",
"=",
"__SANGRIA_IMAP_SERVER_ADDR__",
";",
"$",
"imap_port",
"=",
"__SANGRIA_IMAP_SERVER_PORT__",
";",
"try",
"{",
"$",
"imap_stream",
"=",
... | [tauth Tries to authenticate by telnet]
@param string $user_name [User name]
@param string $user_pass [Password]
@return boolean [true if authenticated, false otherwise] | [
"[",
"tauth",
"Tries",
"to",
"authenticate",
"by",
"telnet",
"]"
] | train | https://github.com/GokulSrinivas/Sangria/blob/e69076655da30ef74b9b6f4a7b7317b3d37d5710/src/Sangria/IMAPAuth.php#L25-L62 |
GokulSrinivas/Sangria | src/Sangria/IMAPAuth.php | IMAPAuth.auth | public static function auth($user_name,$user_pass,$imap_option = "/imap/ssl/novalidate-cert",$imap_retries = 0)
{
$imap_server_address = __SANGRIA_IMAP_SERVER_ADDR__;
$imap_port = __SANGRIA_IMAP_SERVER_PORT__;
try
{
$mbox = \imap_open("{".$imap_server_address.":".$imap_... | php | public static function auth($user_name,$user_pass,$imap_option = "/imap/ssl/novalidate-cert",$imap_retries = 0)
{
$imap_server_address = __SANGRIA_IMAP_SERVER_ADDR__;
$imap_port = __SANGRIA_IMAP_SERVER_PORT__;
try
{
$mbox = \imap_open("{".$imap_server_address.":".$imap_... | [
"public",
"static",
"function",
"auth",
"(",
"$",
"user_name",
",",
"$",
"user_pass",
",",
"$",
"imap_option",
"=",
"\"/imap/ssl/novalidate-cert\"",
",",
"$",
"imap_retries",
"=",
"0",
")",
"{",
"$",
"imap_server_address",
"=",
"__SANGRIA_IMAP_SERVER_ADDR__",
";",... | [auth Authentication via]
@param string $user_name [username]
@param string $user_pass [password]
@param string $imap_option [options as given in php.net]
@param integer $imap_retries [number of retries]
@return boolean [true if authenticated, false otherwise] | [
"[",
"auth",
"Authentication",
"via",
"]"
] | train | https://github.com/GokulSrinivas/Sangria/blob/e69076655da30ef74b9b6f4a7b7317b3d37d5710/src/Sangria/IMAPAuth.php#L72-L97 |
esperecyan/dictionary-php | src/parser/AbstractParser.php | AbstractParser.logInconvertibleError | protected function logInconvertibleError(
string $line,
\esperecyan\dictionary_php\exception\SyntaxException $exception = null
) {
$this->logger->error(
// TRANSLATORS: %s は例外メッセージ。空文字列の場合もある。
sprintf(_('以下の行は汎用辞書のお題に変換できません: %s'), $exception ? $exception->getMessage(... | php | protected function logInconvertibleError(
string $line,
\esperecyan\dictionary_php\exception\SyntaxException $exception = null
) {
$this->logger->error(
// TRANSLATORS: %s は例外メッセージ。空文字列の場合もある。
sprintf(_('以下の行は汎用辞書のお題に変換できません: %s'), $exception ? $exception->getMessage(... | [
"protected",
"function",
"logInconvertibleError",
"(",
"string",
"$",
"line",
",",
"\\",
"esperecyan",
"\\",
"dictionary_php",
"\\",
"exception",
"\\",
"SyntaxException",
"$",
"exception",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",... | 汎用辞書に変換できないお題があったことを、「error」レベルで記録します。
@param string $line
@param \esperecyan\dictionary_php\exception\SyntaxException $exception | [
"汎用辞書に変換できないお題があったことを、「error」レベルで記録します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/AbstractParser.php#L36-L46 |
esperecyan/dictionary-php | src/parser/AbstractParser.php | AbstractParser.generateRegard | protected function generateRegard(): string
{
$unique = $this->eliminateDuplicateCharacters($this->unity($this->wholeText));
foreach (self::FREQUENT_REGARDS as $i => $regard) {
if (preg_match("/$regard/u", $unique) === 1) {
return $i === 0 ? '' : $regard;
}
... | php | protected function generateRegard(): string
{
$unique = $this->eliminateDuplicateCharacters($this->unity($this->wholeText));
foreach (self::FREQUENT_REGARDS as $i => $regard) {
if (preg_match("/$regard/u", $unique) === 1) {
return $i === 0 ? '' : $regard;
}
... | [
"protected",
"function",
"generateRegard",
"(",
")",
":",
"string",
"{",
"$",
"unique",
"=",
"$",
"this",
"->",
"eliminateDuplicateCharacters",
"(",
"$",
"this",
"->",
"unity",
"(",
"$",
"this",
"->",
"wholeText",
")",
")",
";",
"foreach",
"(",
"self",
"... | $wholeText から @regard メタフィールドの内容を生成します。
@return string 既定値になる場合は空文字列を返します。 | [
"$wholeText",
"から"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/AbstractParser.php#L52-L61 |
esperecyan/dictionary-php | src/parser/AbstractParser.php | AbstractParser.unity | protected function unity(string $input): string
{
return strtr(mb_convert_kana(strtolower($input), 'c', 'UTF-8'), self::EQUIVALENT);
} | php | protected function unity(string $input): string
{
return strtr(mb_convert_kana(strtolower($input), 'c', 'UTF-8'), self::EQUIVALENT);
} | [
"protected",
"function",
"unity",
"(",
"string",
"$",
"input",
")",
":",
"string",
"{",
"return",
"strtr",
"(",
"mb_convert_kana",
"(",
"strtolower",
"(",
"$",
"input",
")",
",",
"'c'",
",",
"'UTF-8'",
")",
",",
"self",
"::",
"EQUIVALENT",
")",
";",
"}... | ASCII小文字化、カタカナをひらがな化などを行います。 | [
"ASCII小文字化、カタカナをひらがな化などを行います。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/parser/AbstractParser.php#L66-L69 |
blackprism/serializer | src/Blackprism/Serializer/Configuration.php | Configuration.addConfigurationObject | public function addConfigurationObject(ClassName $className, ObjectInterface $configurationObject): self
{
$this->objects[$className->getIdentifier()] = $configurationObject;
return $this;
} | php | public function addConfigurationObject(ClassName $className, ObjectInterface $configurationObject): self
{
$this->objects[$className->getIdentifier()] = $configurationObject;
return $this;
} | [
"public",
"function",
"addConfigurationObject",
"(",
"ClassName",
"$",
"className",
",",
"ObjectInterface",
"$",
"configurationObject",
")",
":",
"self",
"{",
"$",
"this",
"->",
"objects",
"[",
"$",
"className",
"->",
"getIdentifier",
"(",
")",
"]",
"=",
"$",
... | @param ClassName $className
@param ObjectInterface $configurationObject
@return Configuration | [
"@param",
"ClassName",
"$className",
"@param",
"ObjectInterface",
"$configurationObject"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Configuration.php#L61-L66 |
blackprism/serializer | src/Blackprism/Serializer/Configuration.php | Configuration.addConfigurationObjectWithIdentifier | public function addConfigurationObjectWithIdentifier(
ClassName $className,
ObjectInterface $configurationObject,
$identifier
): self {
$this->identifiers[$identifier] = $configurationObject;
$this->objects[$className->getIdentifier()] = $configurationObject;
return ... | php | public function addConfigurationObjectWithIdentifier(
ClassName $className,
ObjectInterface $configurationObject,
$identifier
): self {
$this->identifiers[$identifier] = $configurationObject;
$this->objects[$className->getIdentifier()] = $configurationObject;
return ... | [
"public",
"function",
"addConfigurationObjectWithIdentifier",
"(",
"ClassName",
"$",
"className",
",",
"ObjectInterface",
"$",
"configurationObject",
",",
"$",
"identifier",
")",
":",
"self",
"{",
"$",
"this",
"->",
"identifiers",
"[",
"$",
"identifier",
"]",
"=",... | @param ClassName $className
@param ObjectInterface $configurationObject
@param string $identifier
@return Configuration | [
"@param",
"ClassName",
"$className",
"@param",
"ObjectInterface",
"$configurationObject",
"@param",
"string",
"$identifier"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Configuration.php#L75-L84 |
blackprism/serializer | src/Blackprism/Serializer/Configuration.php | Configuration.getConfigurationObjectForClass | public function getConfigurationObjectForClass(ClassName $className): ObjectInterface
{
if (isset($this->objects[$className->getIdentifier()]) === true) {
return $this->objects[$className->getIdentifier()];
}
return new Blackhole();
} | php | public function getConfigurationObjectForClass(ClassName $className): ObjectInterface
{
if (isset($this->objects[$className->getIdentifier()]) === true) {
return $this->objects[$className->getIdentifier()];
}
return new Blackhole();
} | [
"public",
"function",
"getConfigurationObjectForClass",
"(",
"ClassName",
"$",
"className",
")",
":",
"ObjectInterface",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"className",
"->",
"getIdentifier",
"(",
")",
"]",
")",
"===",
"tru... | @param ClassName $className
@return ObjectInterface | [
"@param",
"ClassName",
"$className"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Configuration.php#L91-L98 |
blackprism/serializer | src/Blackprism/Serializer/Configuration.php | Configuration.getConfigurationObjectForIdentifier | public function getConfigurationObjectForIdentifier(string $identifier): ObjectInterface
{
if (isset($this->identifiers[$identifier]) === true) {
return $this->identifiers[$identifier];
}
return new Blackhole();
} | php | public function getConfigurationObjectForIdentifier(string $identifier): ObjectInterface
{
if (isset($this->identifiers[$identifier]) === true) {
return $this->identifiers[$identifier];
}
return new Blackhole();
} | [
"public",
"function",
"getConfigurationObjectForIdentifier",
"(",
"string",
"$",
"identifier",
")",
":",
"ObjectInterface",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"identifiers",
"[",
"$",
"identifier",
"]",
")",
"===",
"true",
")",
"{",
"return",
"... | @param string $identifier
@return ObjectInterface | [
"@param",
"string",
"$identifier"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Configuration.php#L105-L112 |
bocharsky-bw/FileNamingResolver | src/NamingStrategy/AbstractHashNamingStrategy.php | AbstractHashNamingStrategy.provideNameByHash | public function provideNameByHash(FileInfo $srcFileInfo, $hash)
{
$pathSuffixParts = array();
for ($i = 0; $i < $this->partCount; $i++) {
$pathSuffixParts[] = substr($hash, $i * $this->partLength, $this->partLength);
}
if ($this->shouldFullFilenameBeKept) {
$n... | php | public function provideNameByHash(FileInfo $srcFileInfo, $hash)
{
$pathSuffixParts = array();
for ($i = 0; $i < $this->partCount; $i++) {
$pathSuffixParts[] = substr($hash, $i * $this->partLength, $this->partLength);
}
if ($this->shouldFullFilenameBeKept) {
$n... | [
"public",
"function",
"provideNameByHash",
"(",
"FileInfo",
"$",
"srcFileInfo",
",",
"$",
"hash",
")",
"{",
"$",
"pathSuffixParts",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"partCount",
";",
... | @param FileInfo $srcFileInfo
@param string $hash
@return FileInfo | [
"@param",
"FileInfo",
"$srcFileInfo",
"@param",
"string",
"$hash"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/NamingStrategy/AbstractHashNamingStrategy.php#L55-L73 |
stubbles/stubbles-webapp-core | src/main/php/auth/TokenAwareUser.php | TokenAwareUser.createToken | public function createToken(string $tokenSalt): Token
{
$this->setToken(Token::create($this, $tokenSalt));
return $this->token();
} | php | public function createToken(string $tokenSalt): Token
{
$this->setToken(Token::create($this, $tokenSalt));
return $this->token();
} | [
"public",
"function",
"createToken",
"(",
"string",
"$",
"tokenSalt",
")",
":",
"Token",
"{",
"$",
"this",
"->",
"setToken",
"(",
"Token",
"::",
"create",
"(",
"$",
"this",
",",
"$",
"tokenSalt",
")",
")",
";",
"return",
"$",
"this",
"->",
"token",
"... | creates new token for the user with given token salt
The token is already stored in the user afterwards, any further request
to token() will yield the same token.
@param string $tokenSalt
@return \stubbles\webapp\auth\Token | [
"creates",
"new",
"token",
"for",
"the",
"user",
"with",
"given",
"token",
"salt"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/TokenAwareUser.php#L47-L51 |
drpdigital/json-api-parser | src/ResourceResolver.php | ResourceResolver.bindFetcher | public function bindFetcher($fetcherKey, $relationshipName, $callback = null)
{
if ($callback !== null) {
$this->fetcherRelationships[$fetcherKey][] = $relationshipName;
}
$callback = $callback ?: $relationshipName;
$this->fetchers[$fetcherKey] = $callback;
} | php | public function bindFetcher($fetcherKey, $relationshipName, $callback = null)
{
if ($callback !== null) {
$this->fetcherRelationships[$fetcherKey][] = $relationshipName;
}
$callback = $callback ?: $relationshipName;
$this->fetchers[$fetcherKey] = $callback;
} | [
"public",
"function",
"bindFetcher",
"(",
"$",
"fetcherKey",
",",
"$",
"relationshipName",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"callback",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"fetcherRelationships",
"[",
"$",
"fetcherKey",
... | Adds the callback to fetch a resolved relationship for a parameter on a resolver.
@param string $fetcherKey
@param string|callable $relationshipName
@param callable|string $callback
@return void | [
"Adds",
"the",
"callback",
"to",
"fetch",
"a",
"resolved",
"relationship",
"for",
"a",
"parameter",
"on",
"a",
"resolver",
"."
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/ResourceResolver.php#L109-L118 |
drpdigital/json-api-parser | src/ResourceResolver.php | ResourceResolver.buildParametersForResolver | protected function buildParametersForResolver($resolver, array $parents, array $defaultParameters)
{
$reflector = $this->getCallReflector($resolver);
$parameters = $reflector->getParameters();
$defaultParameters = array_reverse($defaultParameters);
return array_map(function (\Refle... | php | protected function buildParametersForResolver($resolver, array $parents, array $defaultParameters)
{
$reflector = $this->getCallReflector($resolver);
$parameters = $reflector->getParameters();
$defaultParameters = array_reverse($defaultParameters);
return array_map(function (\Refle... | [
"protected",
"function",
"buildParametersForResolver",
"(",
"$",
"resolver",
",",
"array",
"$",
"parents",
",",
"array",
"$",
"defaultParameters",
")",
"{",
"$",
"reflector",
"=",
"$",
"this",
"->",
"getCallReflector",
"(",
"$",
"resolver",
")",
";",
"$",
"p... | Build the parameters needed for the function given
@param callable|string $resolver
@param array $parents
@param array $defaultParameters
@return array
@throws \Psr\Container\NotFoundExceptionInterface
@throws \Psr\Container\ContainerExceptionInterface
@throws \ReflectionException | [
"Build",
"the",
"parameters",
"needed",
"for",
"the",
"function",
"given"
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/ResourceResolver.php#L205-L256 |
drpdigital/json-api-parser | src/ResourceResolver.php | ResourceResolver.findParent | protected function findParent(\ReflectionClass $class, $parents)
{
$parents = array_reverse($parents);
foreach (array_reverse($parents) as $parent) {
if ($class->getName() === get_class($parent)) {
return $parent;
}
}
foreach (array_reverse($... | php | protected function findParent(\ReflectionClass $class, $parents)
{
$parents = array_reverse($parents);
foreach (array_reverse($parents) as $parent) {
if ($class->getName() === get_class($parent)) {
return $parent;
}
}
foreach (array_reverse($... | [
"protected",
"function",
"findParent",
"(",
"\\",
"ReflectionClass",
"$",
"class",
",",
"$",
"parents",
")",
"{",
"$",
"parents",
"=",
"array_reverse",
"(",
"$",
"parents",
")",
";",
"foreach",
"(",
"array_reverse",
"(",
"$",
"parents",
")",
"as",
"$",
"... | Try to find a parent that matches the class
@param \ReflectionClass $class
@param array $parents
@return mixed|null | [
"Try",
"to",
"find",
"a",
"parent",
"that",
"matches",
"the",
"class"
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/ResourceResolver.php#L285-L302 |
drpdigital/json-api-parser | src/ResourceResolver.php | ResourceResolver.getResolverForType | private function getResolverForType($type)
{
$resolver = Arr::get($this->resolvers, $type);
if ($resolver !== null) {
return $resolver;
}
$parts = explode('.', $type);
if (count($parts) > 1) {
array_shift($parts);
return $this->getResolv... | php | private function getResolverForType($type)
{
$resolver = Arr::get($this->resolvers, $type);
if ($resolver !== null) {
return $resolver;
}
$parts = explode('.', $type);
if (count($parts) > 1) {
array_shift($parts);
return $this->getResolv... | [
"private",
"function",
"getResolverForType",
"(",
"$",
"type",
")",
"{",
"$",
"resolver",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"resolvers",
",",
"$",
"type",
")",
";",
"if",
"(",
"$",
"resolver",
"!==",
"null",
")",
"{",
"return",
"$",
... | Find the resolver for the type given
Fallback the specificity of the type until we find a match. For example
if a type of customer.products.customer_product is passed we first check
for that, then products.customer_product and then customer_product.
@param string $type
@return mixed | [
"Find",
"the",
"resolver",
"for",
"the",
"type",
"given"
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/ResourceResolver.php#L314-L330 |
drpdigital/json-api-parser | src/ResourceResolver.php | ResourceResolver.remove | public function remove($resolverType)
{
$resolverType = Arr::wrap($resolverType);
foreach ($resolverType as $type) {
unset($this->resolvers[$type]);
}
} | php | public function remove($resolverType)
{
$resolverType = Arr::wrap($resolverType);
foreach ($resolverType as $type) {
unset($this->resolvers[$type]);
}
} | [
"public",
"function",
"remove",
"(",
"$",
"resolverType",
")",
"{",
"$",
"resolverType",
"=",
"Arr",
"::",
"wrap",
"(",
"$",
"resolverType",
")",
";",
"foreach",
"(",
"$",
"resolverType",
"as",
"$",
"type",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
... | Remove a resolver(s)
@param string|array $resolverType
@return void | [
"Remove",
"a",
"resolver",
"(",
"s",
")"
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/ResourceResolver.php#L338-L345 |
drpdigital/json-api-parser | src/ResourceResolver.php | ResourceResolver.callResolver | protected function callResolver($resolver, $parameters)
{
if (is_string($resolver)) {
return call_user_func_array($resolver, $parameters);
}
if (count($parameters) === 0) {
return $resolver();
}
if (count($parameters) === 1) {
return $res... | php | protected function callResolver($resolver, $parameters)
{
if (is_string($resolver)) {
return call_user_func_array($resolver, $parameters);
}
if (count($parameters) === 0) {
return $resolver();
}
if (count($parameters) === 1) {
return $res... | [
"protected",
"function",
"callResolver",
"(",
"$",
"resolver",
",",
"$",
"parameters",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"resolver",
")",
")",
"{",
"return",
"call_user_func_array",
"(",
"$",
"resolver",
",",
"$",
"parameters",
")",
";",
"}",
"... | Call the resolver with the given parameters.
@param callable $resolver
@param array $parameters
@return mixed | [
"Call",
"the",
"resolver",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/ResourceResolver.php#L354-L381 |
drpdigital/json-api-parser | src/ResourceResolver.php | ResourceResolver.recordFetchedRelationship | protected function recordFetchedRelationship(RelationshipResource $relationship)
{
$this->fetchedRelationships[] = $this->resource['type'] .
'.' . $relationship->getName() .
'.' . $relationship->getType();
} | php | protected function recordFetchedRelationship(RelationshipResource $relationship)
{
$this->fetchedRelationships[] = $this->resource['type'] .
'.' . $relationship->getName() .
'.' . $relationship->getType();
} | [
"protected",
"function",
"recordFetchedRelationship",
"(",
"RelationshipResource",
"$",
"relationship",
")",
"{",
"$",
"this",
"->",
"fetchedRelationships",
"[",
"]",
"=",
"$",
"this",
"->",
"resource",
"[",
"'type'",
"]",
".",
"'.'",
".",
"$",
"relationship",
... | Save that a resource has been fetched.
@param \Drp\JsonApiParser\RelationshipResource $relationship
@return void | [
"Save",
"that",
"a",
"resource",
"has",
"been",
"fetched",
"."
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/ResourceResolver.php#L447-L452 |
mayoturis/properties-ini | src/Repository.php | Repository.set | public function set($key, $value) {
$this->loadIfNeeded();
$this->array[$key] = $value;
$this->saver->save($this->fileName, $this->array, $this->fileMap);
} | php | public function set($key, $value) {
$this->loadIfNeeded();
$this->array[$key] = $value;
$this->saver->save($this->fileName, $this->array, $this->fileMap);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"loadIfNeeded",
"(",
")",
";",
"$",
"this",
"->",
"array",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"saver",
"->",
"save",
"("... | Set a given configuration value and save file
@param string $key
@param mixed $value
@return void | [
"Set",
"a",
"given",
"configuration",
"value",
"and",
"save",
"file"
] | train | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/Repository.php#L44-L50 |
mayoturis/properties-ini | src/Repository.php | Repository.setAll | public function setAll($array) {
$this->array = $array;
$this->fileMap = null;
$this->saver->save($this->fileName, $this->array, $this->fileMap);
} | php | public function setAll($array) {
$this->array = $array;
$this->fileMap = null;
$this->saver->save($this->fileName, $this->array, $this->fileMap);
} | [
"public",
"function",
"setAll",
"(",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"array",
"=",
"$",
"array",
";",
"$",
"this",
"->",
"fileMap",
"=",
"null",
";",
"$",
"this",
"->",
"saver",
"->",
"save",
"(",
"$",
"this",
"->",
"fileName",
",",
"$... | Change all configuration values and save file
@param array $array Associative array with key and value
@return void | [
"Change",
"all",
"configuration",
"values",
"and",
"save",
"file"
] | train | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/Repository.php#L58-L63 |
mayoturis/properties-ini | src/Repository.php | Repository.get | public function get($key, $default = null) {
$this->loadIfNeeded();
return isset($this->array[$key]) ? $this->array[$key] : $default;
} | php | public function get($key, $default = null) {
$this->loadIfNeeded();
return isset($this->array[$key]) ? $this->array[$key] : $default;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"loadIfNeeded",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"array",
"[",
"$",
"key",
"]",
")",
"?",
"$",
"this",
"->",
"... | Return configuration value
@param string $key
@param string|null $default
@return mixed | [
"Return",
"configuration",
"value"
] | train | https://github.com/mayoturis/properties-ini/blob/79d56d8174637b1124eb90a41ffa3dca4c4a4e93/src/Repository.php#L72-L76 |
stubbles/stubbles-webapp-core | src/main/php/response/mimetypes/PassThrough.php | PassThrough.serialize | public function serialize($resource, OutputStream $out): OutputStream
{
$out->write((string) $resource);
return $out;
} | php | public function serialize($resource, OutputStream $out): OutputStream
{
$out->write((string) $resource);
return $out;
} | [
"public",
"function",
"serialize",
"(",
"$",
"resource",
",",
"OutputStream",
"$",
"out",
")",
":",
"OutputStream",
"{",
"$",
"out",
"->",
"write",
"(",
"(",
"string",
")",
"$",
"resource",
")",
";",
"return",
"$",
"out",
";",
"}"
] | serializes resource to output stream
@param mixed $resource
@param \stubbles\streams\OutputStream $out
@return \stubbles\streams\OutputStream | [
"serializes",
"resource",
"to",
"output",
"stream"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/mimetypes/PassThrough.php#L37-L41 |
huasituo/hstcms | src/Database/Migrations/2016_11_23_152536_create_sms_code_table.php | CreateSmsCodeTable.up | public function up()
{
//
Schema::create('sms_code', function (Blueprint $table)
{
$table->string('mobile', 30)->default('')->comment(hst_lang('hstcms::public.mobile'));
$table->string('type', 30)->default('')->comment(hst_lang('hstcms::public.type'));
$t... | php | public function up()
{
//
Schema::create('sms_code', function (Blueprint $table)
{
$table->string('mobile', 30)->default('')->comment(hst_lang('hstcms::public.mobile'));
$table->string('type', 30)->default('')->comment(hst_lang('hstcms::public.type'));
$t... | [
"public",
"function",
"up",
"(",
")",
"{",
"//",
"Schema",
"::",
"create",
"(",
"'sms_code'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"string",
"(",
"'mobile'",
",",
"30",
")",
"->",
"default",
"(",
"''",
")",
... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Database/Migrations/2016_11_23_152536_create_sms_code_table.php#L18-L31 |
esperecyan/dictionary-php | src/validator/SpecificsValidator.php | SpecificsValidator.parse | protected function parse(string $urlencoded): array
{
$specifics = [];
foreach (new URLSearchParams($urlencoded) as $name => $value) {
$specifics[$name][] = $value;
}
return $specifics;
} | php | protected function parse(string $urlencoded): array
{
$specifics = [];
foreach (new URLSearchParams($urlencoded) as $name => $value) {
$specifics[$name][] = $value;
}
return $specifics;
} | [
"protected",
"function",
"parse",
"(",
"string",
"$",
"urlencoded",
")",
":",
"array",
"{",
"$",
"specifics",
"=",
"[",
"]",
";",
"foreach",
"(",
"new",
"URLSearchParams",
"(",
"$",
"urlencoded",
")",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
... | フィールドを解析し、同名の値の配列を値に持つ連想配列として返します。
@param string $urlencoded
@return string[][] | [
"フィールドを解析し、同名の値の配列を値に持つ連想配列として返します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/SpecificsValidator.php#L22-L29 |
tonicospinelli/class-generation | src/ClassGeneration/ArgumentCollection.php | ArgumentCollection.add | public function add($argument)
{
if (!$argument instanceof ArgumentInterface) {
throw new \InvalidArgumentException(
'This Argument must be a instance of \ClassGeneration\ArgumentInterface'
);
}
if ($argument->getName() === null) {
$argumen... | php | public function add($argument)
{
if (!$argument instanceof ArgumentInterface) {
throw new \InvalidArgumentException(
'This Argument must be a instance of \ClassGeneration\ArgumentInterface'
);
}
if ($argument->getName() === null) {
$argumen... | [
"public",
"function",
"add",
"(",
"$",
"argument",
")",
"{",
"if",
"(",
"!",
"$",
"argument",
"instanceof",
"ArgumentInterface",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'This Argument must be a instance of \\ClassGeneration\\ArgumentInterface'",
... | Add a Argument on collection.<br />
The index is a argument name, then will replace
if exist a index with the same name.
@param ArgumentInterface $argument
@throws \InvalidArgumentException
@return boolean | [
"Add",
"a",
"Argument",
"on",
"collection",
".",
"<br",
"/",
">",
"The",
"index",
"is",
"a",
"argument",
"name",
"then",
"will",
"replace",
"if",
"exist",
"a",
"index",
"with",
"the",
"same",
"name",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/ArgumentCollection.php#L33-L47 |
tonicospinelli/class-generation | src/ClassGeneration/ArgumentCollection.php | ArgumentCollection.toString | public function toString()
{
$arguments = $this->getIterator();
$params = array();
$optionals = array();
foreach ($arguments as $argument) {
if ($argument->isOptional()) {
$optionals[] = $argument->toString();
} else {
$params[]... | php | public function toString()
{
$arguments = $this->getIterator();
$params = array();
$optionals = array();
foreach ($arguments as $argument) {
if ($argument->isOptional()) {
$optionals[] = $argument->toString();
} else {
$params[]... | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"arguments",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"$",
"params",
"=",
"array",
"(",
")",
";",
"$",
"optionals",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"arguments",
"a... | Returns the arguments in string.
@return string | [
"Returns",
"the",
"arguments",
"in",
"string",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/ArgumentCollection.php#L62-L76 |
tonicospinelli/class-generation | src/ClassGeneration/ArgumentCollection.php | ArgumentCollection.removeByName | public function removeByName($argumentName)
{
$removedList = new self();
$list = $this->getIterator();
foreach ($list as $index => $argument) {
if (($argumentName instanceof Argument && $argumentName->getName() != $argument->getName())
|| (is_string($argumentName)... | php | public function removeByName($argumentName)
{
$removedList = new self();
$list = $this->getIterator();
foreach ($list as $index => $argument) {
if (($argumentName instanceof Argument && $argumentName->getName() != $argument->getName())
|| (is_string($argumentName)... | [
"public",
"function",
"removeByName",
"(",
"$",
"argumentName",
")",
"{",
"$",
"removedList",
"=",
"new",
"self",
"(",
")",
";",
"$",
"list",
"=",
"$",
"this",
"->",
"getIterator",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"index",
"=>",... | Removes tags by name.
@param string|array|Argument $argumentName
@return \ClassGeneration\ArgumentCollection | [
"Removes",
"tags",
"by",
"name",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/ArgumentCollection.php#L85-L100 |
vincentchalamon/VinceCmsSonataAdminBundle | Form/Type/MetaGroupType.php | MetaGroupType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->addViewTransformer(new MetaTransformer($this->repository, $this->class));
$list = $this->repository->findAll();
$groups = array();
foreach ($list as $meta) {
/** @var Meta $meta */
... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->addViewTransformer(new MetaTransformer($this->repository, $this->class));
$list = $this->repository->findAll();
$groups = array();
foreach ($list as $meta) {
/** @var Meta $meta */
... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"addViewTransformer",
"(",
"new",
"MetaTransformer",
"(",
"$",
"this",
"->",
"repository",
",",
"$",
"this",
"->",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Form/Type/MetaGroupType.php#L75-L94 |
acasademont/wurfl | WURFL/CapabilitiesHolder.php | WURFL_CapabilitiesHolder.getCapability | public function getCapability($capabilityName)
{
if (isset($this->_device->capabilities[$capabilityName])) {
return $this->_device->capabilities[$capabilityName];
}
$key = $this->_device->id . "_" . $capabilityName;
$capabilityValue = $this->_cacheProvide... | php | public function getCapability($capabilityName)
{
if (isset($this->_device->capabilities[$capabilityName])) {
return $this->_device->capabilities[$capabilityName];
}
$key = $this->_device->id . "_" . $capabilityName;
$capabilityValue = $this->_cacheProvide... | [
"public",
"function",
"getCapability",
"(",
"$",
"capabilityName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_device",
"->",
"capabilities",
"[",
"$",
"capabilityName",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_device",
"->",
"capab... | Returns the value of a given capability name
@param string $capabilityName
@return string Capability value
@throws WURFLException if the value of the $capability name is illegal | [
"Returns",
"the",
"value",
"of",
"a",
"given",
"capability",
"name"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/CapabilitiesHolder.php#L56-L74 |
Wonail/wocenter | helpers/SecurityHelper.php | SecurityHelper.markEmail | public static function markEmail($str): string
{
list($first, $second) = explode('@', $str);
$a = strlen($first) - 3;
return preg_replace('|(?<=.{1})(.{' . $a . '}).*?|', str_pad('', $a, '*'), $first, 1) . '@' . $second;
} | php | public static function markEmail($str): string
{
list($first, $second) = explode('@', $str);
$a = strlen($first) - 3;
return preg_replace('|(?<=.{1})(.{' . $a . '}).*?|', str_pad('', $a, '*'), $first, 1) . '@' . $second;
} | [
"public",
"static",
"function",
"markEmail",
"(",
"$",
"str",
")",
":",
"string",
"{",
"list",
"(",
"$",
"first",
",",
"$",
"second",
")",
"=",
"explode",
"(",
"'@'",
",",
"$",
"str",
")",
";",
"$",
"a",
"=",
"strlen",
"(",
"$",
"first",
")",
"... | 保密邮箱地址
@param string $str 邮箱地址
@return string | [
"保密邮箱地址"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/SecurityHelper.php#L20-L26 |
Wonail/wocenter | helpers/SecurityHelper.php | SecurityHelper.markString | public static function markString($str): string
{
$str_len = strlen($str);
$start = 6 < $str_len ? intval($str_len / 5) : $str_len - 4;
$end = $str_len - $start * 3;
return preg_replace('|(?<=.{' . $start . '})(.{' . $end . '}).*?|', str_pad('', $end, '*'), $str, 1);
} | php | public static function markString($str): string
{
$str_len = strlen($str);
$start = 6 < $str_len ? intval($str_len / 5) : $str_len - 4;
$end = $str_len - $start * 3;
return preg_replace('|(?<=.{' . $start . '})(.{' . $end . '}).*?|', str_pad('', $end, '*'), $str, 1);
} | [
"public",
"static",
"function",
"markString",
"(",
"$",
"str",
")",
":",
"string",
"{",
"$",
"str_len",
"=",
"strlen",
"(",
"$",
"str",
")",
";",
"$",
"start",
"=",
"6",
"<",
"$",
"str_len",
"?",
"intval",
"(",
"$",
"str_len",
"/",
"5",
")",
":",... | 保密字符串
@param string $str
@return string | [
"保密字符串"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/SecurityHelper.php#L51-L58 |
Wonail/wocenter | helpers/SecurityHelper.php | SecurityHelper.decrypt | public static function decrypt($data = '', $key = ''): string
{
$key = md5(empty($key) ? \Yii::$app->getRequest()->cookieValidationKey : $key);
$data = str_replace(['-', '_'], ['+', '/'], $data);
$mod4 = strlen($data) % 4;
if ($mod4) {
$data .= substr('====', $mod4);
... | php | public static function decrypt($data = '', $key = ''): string
{
$key = md5(empty($key) ? \Yii::$app->getRequest()->cookieValidationKey : $key);
$data = str_replace(['-', '_'], ['+', '/'], $data);
$mod4 = strlen($data) % 4;
if ($mod4) {
$data .= substr('====', $mod4);
... | [
"public",
"static",
"function",
"decrypt",
"(",
"$",
"data",
"=",
"''",
",",
"$",
"key",
"=",
"''",
")",
":",
"string",
"{",
"$",
"key",
"=",
"md5",
"(",
"empty",
"(",
"$",
"key",
")",
"?",
"\\",
"Yii",
"::",
"$",
"app",
"->",
"getRequest",
"("... | 系统解密方法
@param string $data 要解密的字符串
@param string $key 加密密钥
@return string | [
"系统解密方法"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/SecurityHelper.php#L79-L116 |
Wonail/wocenter | helpers/SecurityHelper.php | SecurityHelper.encrypt | public static function encrypt($data = '', $key = '', $expire = 0): string
{
$key = md5(empty($key) ? \Yii::$app->getRequest()->cookieValidationKey : $key);
$data = base64_encode($data);
$x = 0;
$len = strlen($data);
$l = strlen($key);
$char = '';
for... | php | public static function encrypt($data = '', $key = '', $expire = 0): string
{
$key = md5(empty($key) ? \Yii::$app->getRequest()->cookieValidationKey : $key);
$data = base64_encode($data);
$x = 0;
$len = strlen($data);
$l = strlen($key);
$char = '';
for... | [
"public",
"static",
"function",
"encrypt",
"(",
"$",
"data",
"=",
"''",
",",
"$",
"key",
"=",
"''",
",",
"$",
"expire",
"=",
"0",
")",
":",
"string",
"{",
"$",
"key",
"=",
"md5",
"(",
"empty",
"(",
"$",
"key",
")",
"?",
"\\",
"Yii",
"::",
"$"... | 系统加密方法
@param string $data 要加密的字符串
@param string $key 加密密钥
@param integer $expire 过期时间 单位 秒
@return string | [
"系统加密方法"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/SecurityHelper.php#L127-L151 |
datasift/datasift-php | lib/DataSift/Account/Identity/Limit.php | DataSift_Account_Identity_Limit.getAll | public function getAll($service, $page = 1, $perPage = 25)
{
$params = array(
'page' => $page,
'per_page' => $perPage
);
return $this->_user->get('account/identity/limit/' . $service, $params);
} | php | public function getAll($service, $page = 1, $perPage = 25)
{
$params = array(
'page' => $page,
'per_page' => $perPage
);
return $this->_user->get('account/identity/limit/' . $service, $params);
} | [
"public",
"function",
"getAll",
"(",
"$",
"service",
",",
"$",
"page",
"=",
"1",
",",
"$",
"perPage",
"=",
"25",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'page'",
"=>",
"$",
"page",
",",
"'per_page'",
"=>",
"$",
"perPage",
")",
";",
"return",
... | Get all the limits for a service
@param string $service
@param integer $page
@param integer $per_page
@return mixed | [
"Get",
"all",
"the",
"limits",
"for",
"a",
"service"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity/Limit.php#L50-L58 |
datasift/datasift-php | lib/DataSift/Account/Identity/Limit.php | DataSift_Account_Identity_Limit.create | public function create($identity, $service, $total_allowance = false, $analyze_queries = false)
{
$params = array(
'service' => $service,
);
if ($total_allowance) {
$params['total_allowance'] = $total_allowance;
}
if ($analyze_queries) {
... | php | public function create($identity, $service, $total_allowance = false, $analyze_queries = false)
{
$params = array(
'service' => $service,
);
if ($total_allowance) {
$params['total_allowance'] = $total_allowance;
}
if ($analyze_queries) {
... | [
"public",
"function",
"create",
"(",
"$",
"identity",
",",
"$",
"service",
",",
"$",
"total_allowance",
"=",
"false",
",",
"$",
"analyze_queries",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'service'",
"=>",
"$",
"service",
",",
")",
";... | Create a limit for a service
@param string $identity
@param string $service
@param integer $total_allowance
@param integer $analyze_queries
@return mixed | [
"Create",
"a",
"limit",
"for",
"a",
"service"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity/Limit.php#L70-L85 |
datasift/datasift-php | lib/DataSift/Account/Identity/Limit.php | DataSift_Account_Identity_Limit.update | public function update($identity, $service, $total_allowance = false, $analyze_queries = false)
{
$params = array();
if ($total_allowance) {
$params['total_allowance'] = $total_allowance;
}
if ($analyze_queries) {
$params['analyze_queries'] = $analyze_queries... | php | public function update($identity, $service, $total_allowance = false, $analyze_queries = false)
{
$params = array();
if ($total_allowance) {
$params['total_allowance'] = $total_allowance;
}
if ($analyze_queries) {
$params['analyze_queries'] = $analyze_queries... | [
"public",
"function",
"update",
"(",
"$",
"identity",
",",
"$",
"service",
",",
"$",
"total_allowance",
"=",
"false",
",",
"$",
"analyze_queries",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"total_allowance",
")... | Update the limit for an service
@param string $identity
@param string $service
@param integer $total_allowance
@param integer $analyze_queries
@return mixed | [
"Update",
"the",
"limit",
"for",
"an",
"service"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity/Limit.php#L97-L109 |
datasift/datasift-php | lib/DataSift/Account/Identity.php | DataSift_Account_Identity.getAll | public function getAll($label = null, $page = 1, $perPage = 25)
{
$params = array(
'page' => $page,
'per_page' => $perPage
);
if ($label !== null) {
$params['label'] = $label;
}
return $this->_user->get('account/identity', $params);
} | php | public function getAll($label = null, $page = 1, $perPage = 25)
{
$params = array(
'page' => $page,
'per_page' => $perPage
);
if ($label !== null) {
$params['label'] = $label;
}
return $this->_user->get('account/identity', $params);
} | [
"public",
"function",
"getAll",
"(",
"$",
"label",
"=",
"null",
",",
"$",
"page",
"=",
"1",
",",
"$",
"perPage",
"=",
"25",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'page'",
"=>",
"$",
"page",
",",
"'per_page'",
"=>",
"$",
"perPage",
")",
";"... | Gets all the identities
@param string $label
@param integer $page
@param integer $perPage
@return mixed | [
"Gets",
"all",
"the",
"identities"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity.php#L49-L61 |
datasift/datasift-php | lib/DataSift/Account/Identity.php | DataSift_Account_Identity.create | public function create($label, $master = false, $status = 'active')
{
$params = array(
'label' => $label,
'master' => $master,
'status' => $status
);
return $this->_user->post('account/identity', $params);
} | php | public function create($label, $master = false, $status = 'active')
{
$params = array(
'label' => $label,
'master' => $master,
'status' => $status
);
return $this->_user->post('account/identity', $params);
} | [
"public",
"function",
"create",
"(",
"$",
"label",
",",
"$",
"master",
"=",
"false",
",",
"$",
"status",
"=",
"'active'",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'label'",
"=>",
"$",
"label",
",",
"'master'",
"=>",
"$",
"master",
",",
"'status'"... | Creates an identity
@param string $label
@param string $master
@param string $status
@return mixed | [
"Creates",
"an",
"identity"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity.php#L72-L82 |
datasift/datasift-php | lib/DataSift/Account/Identity.php | DataSift_Account_Identity.update | public function update($identity, $label = null, $master = null, $status = null)
{
$params = array();
if (! is_null($label)) {
$params['label'] = $label;
}
if (! is_null($master)) {
$params['master'] = $master;
}
if (! is_null($status)) {
... | php | public function update($identity, $label = null, $master = null, $status = null)
{
$params = array();
if (! is_null($label)) {
$params['label'] = $label;
}
if (! is_null($master)) {
$params['master'] = $master;
}
if (! is_null($status)) {
... | [
"public",
"function",
"update",
"(",
"$",
"identity",
",",
"$",
"label",
"=",
"null",
",",
"$",
"master",
"=",
"null",
",",
"$",
"status",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"... | Updates an identity
@param string $identity
@param string $master
@param string $label
@param string $status
@return mixed | [
"Updates",
"an",
"identity"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Account/Identity.php#L94-L109 |
tonicospinelli/class-generation | src/ClassGeneration/Argument.php | Argument.hasType | public function hasType()
{
return (!is_null($this->type) || !empty($this->type))
&& !in_array(mb_strtolower($this->type), $this->primitiveTypes);
} | php | public function hasType()
{
return (!is_null($this->type) || !empty($this->type))
&& !in_array(mb_strtolower($this->type), $this->primitiveTypes);
} | [
"public",
"function",
"hasType",
"(",
")",
"{",
"return",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"type",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"type",
")",
")",
"&&",
"!",
"in_array",
"(",
"mb_strtolower",
"(",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Argument.php#L149-L154 |
tonicospinelli/class-generation | src/ClassGeneration/Argument.php | Argument.toString | public function toString()
{
$type = '';
if ($this->hasType()) {
$type = $this->getType() . ' ';
}
$value = '';
if ($this->isOptional()) {
$value = ' = ' . var_export($this->getValue(), true);
}
$argument = trim(
$type
... | php | public function toString()
{
$type = '';
if ($this->hasType()) {
$type = $this->getType() . ' ';
}
$value = '';
if ($this->isOptional()) {
$value = ' = ' . var_export($this->getValue(), true);
}
$argument = trim(
$type
... | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"type",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"hasType",
"(",
")",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"getType",
"(",
")",
".",
"' '",
";",
"}",
"$",
"value",
"=",
"''"... | {@inheritdoc} | [
"{"
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Argument.php#L187-L204 |
tonicospinelli/class-generation | src/ClassGeneration/Argument.php | Argument.createFromProperty | public static function createFromProperty(PropertyInterface $property)
{
$argument = new self();
$argument
->setName($property->getName())
->setType($property->getType());
return $argument;
} | php | public static function createFromProperty(PropertyInterface $property)
{
$argument = new self();
$argument
->setName($property->getName())
->setType($property->getType());
return $argument;
} | [
"public",
"static",
"function",
"createFromProperty",
"(",
"PropertyInterface",
"$",
"property",
")",
"{",
"$",
"argument",
"=",
"new",
"self",
"(",
")",
";",
"$",
"argument",
"->",
"setName",
"(",
"$",
"property",
"->",
"getName",
"(",
")",
")",
"->",
"... | Creates Argument from Property Object.
@param PropertyInterface $property
@return Argument | [
"Creates",
"Argument",
"from",
"Property",
"Object",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Argument.php#L213-L221 |
crossjoin/Css | src/Crossjoin/Css/Reader/HtmlString.php | HtmlString.getCssContent | protected function getCssContent()
{
$styleString = "";
if (class_exists("\\DOMDocument")) {
$doc = new \DOMDocument();
$doc->loadHTML($this->getHtmlContent());
// Extract styles from the HTML file
foreach($doc->getElementsByTagName('style') as $styl... | php | protected function getCssContent()
{
$styleString = "";
if (class_exists("\\DOMDocument")) {
$doc = new \DOMDocument();
$doc->loadHTML($this->getHtmlContent());
// Extract styles from the HTML file
foreach($doc->getElementsByTagName('style') as $styl... | [
"protected",
"function",
"getCssContent",
"(",
")",
"{",
"$",
"styleString",
"=",
"\"\"",
";",
"if",
"(",
"class_exists",
"(",
"\"\\\\DOMDocument\"",
")",
")",
"{",
"$",
"doc",
"=",
"new",
"\\",
"DOMDocument",
"(",
")",
";",
"$",
"doc",
"->",
"loadHTML",... | Gets the CSS content extracted from the HTML source content.
@return string | [
"Gets",
"the",
"CSS",
"content",
"extracted",
"from",
"the",
"HTML",
"source",
"content",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Reader/HtmlString.php#L54-L71 |
iter8-au/builder | src/Builder/Traits/BuilderFilesTrait.php | BuilderFilesTrait.getCacheName | public function getCacheName(): string
{
if (null === $this->cacheName) {
$this->cacheName = sprintf(
'%s/%s.xlsx',
$this->cacheDir,
md5(microtime() . random_int(0, mt_getrandmax()))
);
}
return $this->cacheName;
} | php | public function getCacheName(): string
{
if (null === $this->cacheName) {
$this->cacheName = sprintf(
'%s/%s.xlsx',
$this->cacheDir,
md5(microtime() . random_int(0, mt_getrandmax()))
);
}
return $this->cacheName;
} | [
"public",
"function",
"getCacheName",
"(",
")",
":",
"string",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"cacheName",
")",
"{",
"$",
"this",
"->",
"cacheName",
"=",
"sprintf",
"(",
"'%s/%s.xlsx'",
",",
"$",
"this",
"->",
"cacheDir",
",",
"md5",... | {@inheritdoc} | [
"{"
] | train | https://github.com/iter8-au/builder/blob/95105636c2490c5c7a88da466702c523a9d0901c/src/Builder/Traits/BuilderFilesTrait.php#L36-L47 |
corllete/silex-mongodb-provider | src/Provider/MongoDBServiceProvider.php | MongoDBServiceProvider.register | public function register(Container $app)
{
$ns = $this->namespace;
$mns = $this->multiNamespace;
$app[$ns.'.default_options'] = isset($app[$ns.'.default_options']) ? $app[$ns.'.default_options'] : [];
$app[$ns.'.default_options'] += self::$defaultOptions;
$app[$ns.'.factor... | php | public function register(Container $app)
{
$ns = $this->namespace;
$mns = $this->multiNamespace;
$app[$ns.'.default_options'] = isset($app[$ns.'.default_options']) ? $app[$ns.'.default_options'] : [];
$app[$ns.'.default_options'] += self::$defaultOptions;
$app[$ns.'.factor... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"ns",
"=",
"$",
"this",
"->",
"namespace",
";",
"$",
"mns",
"=",
"$",
"this",
"->",
"multiNamespace",
";",
"$",
"app",
"[",
"$",
"ns",
".",
"'.default_options'",
"]",
"=",... | {@inheritdoc} | [
"{"
] | train | https://github.com/corllete/silex-mongodb-provider/blob/1e5b1a6aab1657eb3964caefe0c8604629587c47/src/Provider/MongoDBServiceProvider.php#L77-L160 |
corllete/silex-mongodb-provider | src/Provider/MongoDBServiceProvider.php | MongoDBServiceProvider.assembleUri | private function assembleUri($host, $port, $db = null, $username = null, $password = null)
{
if (!empty($db)) {
$db = '/'.$db;
}
$cred = '';
if ($username !== null && $password !== null) {
$cred = sprintf('%s:%s@', rawurlencode($username), rawurlencode($passw... | php | private function assembleUri($host, $port, $db = null, $username = null, $password = null)
{
if (!empty($db)) {
$db = '/'.$db;
}
$cred = '';
if ($username !== null && $password !== null) {
$cred = sprintf('%s:%s@', rawurlencode($username), rawurlencode($passw... | [
"private",
"function",
"assembleUri",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"db",
"=",
"null",
",",
"$",
"username",
"=",
"null",
",",
"$",
"password",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"db",
")",
")",
"{",
"$",
... | @link http://php.net/manual/en/mongodb-driver-manager.construct.php
@param string $host
@param string $port
@param string|null $db
@param string|null $username
@param string|null $password
@return string | [
"@link",
"http",
":",
"//",
"php",
".",
"net",
"/",
"manual",
"/",
"en",
"/",
"mongodb",
"-",
"driver",
"-",
"manager",
".",
"construct",
".",
"php"
] | train | https://github.com/corllete/silex-mongodb-provider/blob/1e5b1a6aab1657eb3964caefe0c8604629587c47/src/Provider/MongoDBServiceProvider.php#L172-L184 |
rozdol/bi | src/Utils/Crypt.php | Crypt.create_hash | function create_hash($password)
{
// format: algorithm:iterations:salt:hash
//$salt = base64_encode(mcrypt_create_iv(PBKDF2_SALT_BYTES, MCRYPT_DEV_URANDOM));
$encrypt_method = "AES-256-CBC";
$key = hash('sha256', $secret_key);
$iv = substr(hash('sha256', $secret_iv)... | php | function create_hash($password)
{
// format: algorithm:iterations:salt:hash
//$salt = base64_encode(mcrypt_create_iv(PBKDF2_SALT_BYTES, MCRYPT_DEV_URANDOM));
$encrypt_method = "AES-256-CBC";
$key = hash('sha256', $secret_key);
$iv = substr(hash('sha256', $secret_iv)... | [
"function",
"create_hash",
"(",
"$",
"password",
")",
"{",
"// format: algorithm:iterations:salt:hash",
"//$salt = base64_encode(mcrypt_create_iv(PBKDF2_SALT_BYTES, MCRYPT_DEV_URANDOM));",
"$",
"encrypt_method",
"=",
"\"AES-256-CBC\"",
";",
"$",
"key",
"=",
"hash",
"(",
"'sha25... | These constants may be changed without breaking existing hashes. | [
"These",
"constants",
"may",
"be",
"changed",
"without",
"breaking",
"existing",
"hashes",
"."
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Utils/Crypt.php#L43-L63 |
rozdol/bi | src/Utils/Crypt.php | Crypt.slow_equals | function slow_equals($a, $b)
{
$diff = strlen($a) ^ strlen($b);
for ($i = 0; $i < strlen($a) && $i < strlen($b); $i++) {
$diff |= ord($a[$i]) ^ ord($b[$i]);
}
return $diff === 0;
} | php | function slow_equals($a, $b)
{
$diff = strlen($a) ^ strlen($b);
for ($i = 0; $i < strlen($a) && $i < strlen($b); $i++) {
$diff |= ord($a[$i]) ^ ord($b[$i]);
}
return $diff === 0;
} | [
"function",
"slow_equals",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"$",
"diff",
"=",
"strlen",
"(",
"$",
"a",
")",
"^",
"strlen",
"(",
"$",
"b",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"strlen",
"(",
"$",
"a",
")",
... | Compares two strings $a and $b in length-constant time. | [
"Compares",
"two",
"strings",
"$a",
"and",
"$b",
"in",
"length",
"-",
"constant",
"time",
"."
] | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Utils/Crypt.php#L86-L93 |
rozdol/bi | src/Utils/Crypt.php | Crypt.pbkdf2 | function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)
{
$algorithm = strtolower($algorithm);
if (!in_array($algorithm, hash_algos(), true)) {
die('PBKDF2 ERROR: Invalid hash algorithm.');
}
if ($count <= 0 || $key_length <= 0) {
... | php | function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)
{
$algorithm = strtolower($algorithm);
if (!in_array($algorithm, hash_algos(), true)) {
die('PBKDF2 ERROR: Invalid hash algorithm.');
}
if ($count <= 0 || $key_length <= 0) {
... | [
"function",
"pbkdf2",
"(",
"$",
"algorithm",
",",
"$",
"password",
",",
"$",
"salt",
",",
"$",
"count",
",",
"$",
"key_length",
",",
"$",
"raw_output",
"=",
"false",
")",
"{",
"$",
"algorithm",
"=",
"strtolower",
"(",
"$",
"algorithm",
")",
";",
"if"... | /*
PBKDF2 key derivation function as defined by RSA's PKCS #5: https://www.ietf.org/rfc/rfc2898.txt
$algorithm - The hash algorithm to use. Recommended: SHA256
$password - The password.
$salt - A salt that is unique to the password.
$count - Iteration count. Higher is better, but slower. Recommended: At least 1000.
$ke... | [
"/",
"*",
"PBKDF2",
"key",
"derivation",
"function",
"as",
"defined",
"by",
"RSA",
"s",
"PKCS",
"#5",
":",
"https",
":",
"//",
"www",
".",
"ietf",
".",
"org",
"/",
"rfc",
"/",
"rfc2898",
".",
"txt",
"$algorithm",
"-",
"The",
"hash",
"algorithm",
"to"... | train | https://github.com/rozdol/bi/blob/f63d6b219cc4a7bb25b1865905a2a888ce6ce855/src/Utils/Crypt.php#L110-L141 |
jelix/version | lib/Version.php | Version.getNextTailVersion | public function getNextTailVersion()
{
if (count($this->stabilityVersion) && $this->stabilityVersion[0] != 'stable') {
return implode('.', $this->version);
}
$v = $this->version;
$last = count($v) - 1;
if ($v[$last] !== '*') {
++$v[$last];
}
... | php | public function getNextTailVersion()
{
if (count($this->stabilityVersion) && $this->stabilityVersion[0] != 'stable') {
return implode('.', $this->version);
}
$v = $this->version;
$last = count($v) - 1;
if ($v[$last] !== '*') {
++$v[$last];
}
... | [
"public",
"function",
"getNextTailVersion",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"stabilityVersion",
")",
"&&",
"$",
"this",
"->",
"stabilityVersion",
"[",
"0",
"]",
"!=",
"'stable'",
")",
"{",
"return",
"implode",
"(",
"'.'",
",",
... | returns the next version, by incrementing the last
number, whatever it is.
If the version has a stability information (alpha, beta etc..),
it returns only the version without stability version.
@return string the next version | [
"returns",
"the",
"next",
"version",
"by",
"incrementing",
"the",
"last",
"number",
"whatever",
"it",
"is",
".",
"If",
"the",
"version",
"has",
"a",
"stability",
"information",
"(",
"alpha",
"beta",
"etc",
"..",
")",
"it",
"returns",
"only",
"the",
"versio... | train | https://github.com/jelix/version/blob/1bdcea2beb7943f347fb453e3106702a460d51c2/lib/Version.php#L229-L241 |
cronario/cronario | src/Logger/Journal.php | Journal.log | public function log($level, $message, array $context = array())
{
if (!in_array($level, $this->journalRecord)) {
return null;
}
$line = sprintf("%s: %s %s %s",
$this->getCurrentDate(),
str_repeat('. ', $this->levelToPoints[$level]),
... | php | public function log($level, $message, array $context = array())
{
if (!in_array($level, $this->journalRecord)) {
return null;
}
$line = sprintf("%s: %s %s %s",
$this->getCurrentDate(),
str_repeat('. ', $this->levelToPoints[$level]),
... | [
"public",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"level",
",",
"$",
"this",
"->",
"journalRecord",
")",
")",
"{",
"return",
... | @param mixed $level
@param string $message
@param array $context
@return null | [
"@param",
"mixed",
"$level",
"@param",
"string",
"$message",
"@param",
"array",
"$context"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Logger/Journal.php#L30-L47 |
phpmob/twig-modify-bundle | Twig/TokenParser.php | TokenParser.parse | public function parse(Twig_Token $token)
{
$lineNumber = $token->getLine();
$type = strtolower($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue());
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
$body = $this->parser->subparse(
funct... | php | public function parse(Twig_Token $token)
{
$lineNumber = $token->getLine();
$type = strtolower($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue());
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
$body = $this->parser->subparse(
funct... | [
"public",
"function",
"parse",
"(",
"Twig_Token",
"$",
"token",
")",
"{",
"$",
"lineNumber",
"=",
"$",
"token",
"->",
"getLine",
"(",
")",
";",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"parser",
"->",
"getStream",
"(",
")",
"->",
"expe... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/twig-modify-bundle/blob/30b70ca3ea7b902f2f29c8457cd4f8da45b1d29e/Twig/TokenParser.php#L52-L74 |
acasademont/wurfl | WURFL/WURFLManager.php | WURFL_WURFLManager.getDeviceForRequest | public function getDeviceForRequest(WURFL_Request_GenericRequest $request)
{
if (!isset($request)) {
throw new Exception("The request parameter must be set.");
}
WURFL_Handlers_Utils::reset();
return $this->_wurflService->getDeviceForRequest($request);
} | php | public function getDeviceForRequest(WURFL_Request_GenericRequest $request)
{
if (!isset($request)) {
throw new Exception("The request parameter must be set.");
}
WURFL_Handlers_Utils::reset();
return $this->_wurflService->getDeviceForRequest($request);
} | [
"public",
"function",
"getDeviceForRequest",
"(",
"WURFL_Request_GenericRequest",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"request",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"The request parameter must be set.\"",
")",
";",
"}",
"W... | Return a device the given WURFL_Request_GenericRequest request(user-agent..)
@param WURFL_Request_GenericRequest $request
@return WURFL_CustomDevice device
@throws Exception if the $request parameter is not set | [
"Return",
"a",
"device",
"the",
"given",
"WURFL_Request_GenericRequest",
"request",
"(",
"user",
"-",
"agent",
"..",
")"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLManager.php#L87-L94 |
acasademont/wurfl | WURFL/WURFLManager.php | WURFL_WURFLManager.getDeviceForHttpRequest | public function getDeviceForHttpRequest($httpRequest, $override_sideloaded_browser_ua = true)
{
if (!isset($httpRequest)) {
throw new Exception("The $httpRequest parameter must be set.");
}
$request = $this->_requestFactory->createRequest($httpRequest, $override_sideloaded_browse... | php | public function getDeviceForHttpRequest($httpRequest, $override_sideloaded_browser_ua = true)
{
if (!isset($httpRequest)) {
throw new Exception("The $httpRequest parameter must be set.");
}
$request = $this->_requestFactory->createRequest($httpRequest, $override_sideloaded_browse... | [
"public",
"function",
"getDeviceForHttpRequest",
"(",
"$",
"httpRequest",
",",
"$",
"override_sideloaded_browser_ua",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"httpRequest",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"The $httpRequest pa... | Return a device for the given http request(user-agent..)
@param array $httpRequest HTTP Request array (normally $_SERVER)
@param bool $override_sideloaded_browser_ua
@return WURFL_CustomDevice device
@throws Exception if $httpRequest is not set | [
"Return",
"a",
"device",
"for",
"the",
"given",
"http",
"request",
"(",
"user",
"-",
"agent",
"..",
")"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLManager.php#L104-L111 |
acasademont/wurfl | WURFL/WURFLManager.php | WURFL_WURFLManager.getDeviceForUserAgent | public function getDeviceForUserAgent($userAgent)
{
if (!isset($userAgent)) {
$userAgent = '';
}
$request = $this->_requestFactory->createRequestForUserAgent($userAgent);
return $this->getDeviceForRequest($request);
} | php | public function getDeviceForUserAgent($userAgent)
{
if (!isset($userAgent)) {
$userAgent = '';
}
$request = $this->_requestFactory->createRequestForUserAgent($userAgent);
return $this->getDeviceForRequest($request);
} | [
"public",
"function",
"getDeviceForUserAgent",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"userAgent",
")",
")",
"{",
"$",
"userAgent",
"=",
"''",
";",
"}",
"$",
"request",
"=",
"$",
"this",
"->",
"_requestFactory",
"->",
"crea... | Returns a device for the given user-agent
@param string $userAgent
@return WURFL_CustomDevice device
@throws Exception if $userAgent is not set | [
"Returns",
"a",
"device",
"for",
"the",
"given",
"user",
"-",
"agent"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLManager.php#L120-L128 |
cronario/cronario | src/Facade.php | Facade.addProducer | public static function addProducer(Producer $producer)
{
$appId = $producer->getAppId();
if (array_key_exists($appId, static::$producers)) {
throw new Exception\FacadeException("Producer with {$appId} already exists!");
}
static::$producers[$appId] = $producer;
... | php | public static function addProducer(Producer $producer)
{
$appId = $producer->getAppId();
if (array_key_exists($appId, static::$producers)) {
throw new Exception\FacadeException("Producer with {$appId} already exists!");
}
static::$producers[$appId] = $producer;
... | [
"public",
"static",
"function",
"addProducer",
"(",
"Producer",
"$",
"producer",
")",
"{",
"$",
"appId",
"=",
"$",
"producer",
"->",
"getAppId",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"appId",
",",
"static",
"::",
"$",
"producers",
")",
... | Add producer to facade
@param Producer $producer
@return boolean
@throws Exception\FacadeException | [
"Add",
"producer",
"to",
"facade"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Facade.php#L34-L45 |
cronario/cronario | src/Facade.php | Facade.addBuilder | public static function addBuilder($appId, $builderFunction)
{
if (array_key_exists($appId, static::$builders)) {
throw new Exception\FacadeException("Builder with {$appId} already exists!");
}
if (!is_callable($builderFunction)) {
throw new Exception\FacadeException(... | php | public static function addBuilder($appId, $builderFunction)
{
if (array_key_exists($appId, static::$builders)) {
throw new Exception\FacadeException("Builder with {$appId} already exists!");
}
if (!is_callable($builderFunction)) {
throw new Exception\FacadeException(... | [
"public",
"static",
"function",
"addBuilder",
"(",
"$",
"appId",
",",
"$",
"builderFunction",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"appId",
",",
"static",
"::",
"$",
"builders",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"FacadeExcepti... | Add Builder to facade builder scope
@param $appId
@param $builderFunction
@return boolean
@throws Exception\FacadeException | [
"Add",
"Builder",
"to",
"facade",
"builder",
"scope"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Facade.php#L56-L69 |
cronario/cronario | src/Facade.php | Facade.getProducer | public static function getProducer($appId = Producer::DEFAULT_APP_ID)
{
if (null === $appId) {
$appId = Producer::DEFAULT_APP_ID;
}
if (!array_key_exists($appId, static::$producers)) {
if (array_key_exists($appId, static::$builders)) {
$func = static... | php | public static function getProducer($appId = Producer::DEFAULT_APP_ID)
{
if (null === $appId) {
$appId = Producer::DEFAULT_APP_ID;
}
if (!array_key_exists($appId, static::$producers)) {
if (array_key_exists($appId, static::$builders)) {
$func = static... | [
"public",
"static",
"function",
"getProducer",
"(",
"$",
"appId",
"=",
"Producer",
"::",
"DEFAULT_APP_ID",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"appId",
")",
"{",
"$",
"appId",
"=",
"Producer",
"::",
"DEFAULT_APP_ID",
";",
"}",
"if",
"(",
"!",
"arr... | Get producer by id
@param string $appId
@return Producer|null
@throws Exception\FacadeException | [
"Get",
"producer",
"by",
"id"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Facade.php#L79-L99 |
cronario/cronario | src/Facade.php | Facade.getProducersStats | public static function getProducersStats()
{
$producersStats = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$producersStats[$appId] = $producer->getStats();
}
return $producersStats;
} | php | public static function getProducersStats()
{
$producersStats = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$producersStats[$appId] = $producer->getStats();
}
return $producersStats;
} | [
"public",
"static",
"function",
"getProducersStats",
"(",
")",
"{",
"$",
"producersStats",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"$",
"producers",
"as",
"$",
"appId",
"=>",
"$",
"producer",
")",
"{",
"/** @var $producer Producer */",
"$",
"prod... | Get producer statistic
@return array | [
"Get",
"producer",
"statistic"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Facade.php#L134-L143 |
cronario/cronario | src/Facade.php | Facade.getQueuesStats | public static function getQueuesStats()
{
$queuesStats = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$queuesStats[$appId] = $producer->getQueue()->getStats();
}
return $queuesStats;
} | php | public static function getQueuesStats()
{
$queuesStats = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$queuesStats[$appId] = $producer->getQueue()->getStats();
}
return $queuesStats;
} | [
"public",
"static",
"function",
"getQueuesStats",
"(",
")",
"{",
"$",
"queuesStats",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"$",
"producers",
"as",
"$",
"appId",
"=>",
"$",
"producer",
")",
"{",
"/** @var $producer Producer */",
"$",
"queuesStat... | Get queues statistic
@return array | [
"Get",
"queues",
"statistic"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Facade.php#L150-L159 |
cronario/cronario | src/Facade.php | Facade.getJobsReserved | public static function getJobsReserved()
{
$jobsReserved = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$jobsReserved[$appId] = $producer->getQueue()->getJobReserved();
}
return $jobsReserved;
} | php | public static function getJobsReserved()
{
$jobsReserved = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$jobsReserved[$appId] = $producer->getQueue()->getJobReserved();
}
return $jobsReserved;
} | [
"public",
"static",
"function",
"getJobsReserved",
"(",
")",
"{",
"$",
"jobsReserved",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"$",
"producers",
"as",
"$",
"appId",
"=>",
"$",
"producer",
")",
"{",
"/** @var $producer Producer */",
"$",
"jobsRese... | Get all reserved jobs
@return array | [
"Get",
"all",
"reserved",
"jobs"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Facade.php#L166-L175 |
cronario/cronario | src/Facade.php | Facade.getManagersStats | public static function getManagersStats()
{
$managersStats = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$redis = $producer->getRedis();
$keys = [
'stat' => $redis->keys(Manager::REDIS_NS_STATS . '*'),... | php | public static function getManagersStats()
{
$managersStats = [];
foreach (static::$producers as $appId => $producer) {
/** @var $producer Producer */
$redis = $producer->getRedis();
$keys = [
'stat' => $redis->keys(Manager::REDIS_NS_STATS . '*'),... | [
"public",
"static",
"function",
"getManagersStats",
"(",
")",
"{",
"$",
"managersStats",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"$",
"producers",
"as",
"$",
"appId",
"=>",
"$",
"producer",
")",
"{",
"/** @var $producer Producer */",
"$",
"redis"... | Get all managers statistic
@return array | [
"Get",
"all",
"managers",
"statistic"
] | train | https://github.com/cronario/cronario/blob/954df60e95efd3085269331d435e8ce6f4980441/src/Facade.php#L183-L213 |
FrenchFrogs/framework | src/Form/Renderer/Bootstrap.php | Bootstrap.link | public function link(Form\Element\Link $element)
{
$html = '<label>' . $element->getLabel() . '</label>';
$html .= '<p>' . html('a', ['href' => $element->getValue(), 'target' => '_blank'], $element->getValue()) . '</p>';
$class = Style::FORM_GROUP_CLASS;
$html = html('div', compact... | php | public function link(Form\Element\Link $element)
{
$html = '<label>' . $element->getLabel() . '</label>';
$html .= '<p>' . html('a', ['href' => $element->getValue(), 'target' => '_blank'], $element->getValue()) . '</p>';
$class = Style::FORM_GROUP_CLASS;
$html = html('div', compact... | [
"public",
"function",
"link",
"(",
"Form",
"\\",
"Element",
"\\",
"Link",
"$",
"element",
")",
"{",
"$",
"html",
"=",
"'<label>'",
".",
"$",
"element",
"->",
"getLabel",
"(",
")",
".",
"'</label>'",
";",
"$",
"html",
".=",
"'<p>'",
".",
"html",
"(",
... | Render a link element
@param \FrenchFrogs\Form\Element\Link $element
@return string | [
"Render",
"a",
"link",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Bootstrap.php#L274-L284 |
FrenchFrogs/framework | src/Form/Renderer/Bootstrap.php | Bootstrap.date | public function date(Form\Element\Date $element)
{
// Error
if($hasError = !$element->getValidator()->isValid()){
$element->removeAttribute('data-trigger');//Si il y avait un popoover au départ on le surcharge par un tooltip
if(empty($element->getAttribute('data-placement')))... | php | public function date(Form\Element\Date $element)
{
// Error
if($hasError = !$element->getValidator()->isValid()){
$element->removeAttribute('data-trigger');//Si il y avait un popoover au départ on le surcharge par un tooltip
if(empty($element->getAttribute('data-placement')))... | [
"public",
"function",
"date",
"(",
"Form",
"\\",
"Element",
"\\",
"Date",
"$",
"element",
")",
"{",
"// Error",
"if",
"(",
"$",
"hasError",
"=",
"!",
"$",
"element",
"->",
"getValidator",
"(",
")",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"element",... | Render a date element
@param \FrenchFrogs\Form\Element\Date $element
@return string | [
"Render",
"a",
"date",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Bootstrap.php#L465-L499 |
dengyongbin/loopeer-lib | src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/utils.php | PushUtils.getDayTimestamp | public static function getDayTimestamp($now = null, $offset = 8) {
$now = $now === null ? time() : $now;
$gtm0 = $now - ($now % 86400); // GTM 0
$dayline = ($now - $gtm0) / 3600;
// 时差跨天
if ($dayline + $offset > 23) {
return $gtm0 + 86400 + ... | php | public static function getDayTimestamp($now = null, $offset = 8) {
$now = $now === null ? time() : $now;
$gtm0 = $now - ($now % 86400); // GTM 0
$dayline = ($now - $gtm0) / 3600;
// 时差跨天
if ($dayline + $offset > 23) {
return $gtm0 + 86400 + ... | [
"public",
"static",
"function",
"getDayTimestamp",
"(",
"$",
"now",
"=",
"null",
",",
"$",
"offset",
"=",
"8",
")",
"{",
"$",
"now",
"=",
"$",
"now",
"===",
"null",
"?",
"time",
"(",
")",
":",
"$",
"now",
";",
"$",
"gtm0",
"=",
"$",
"now",
"-",... | get the timestamp at current dat start
NOTE: the result start at the timezone (GTM +8) 00:00:00, not the GTM 0.
@param
{number} offset, offset of timezone;
@return number | [
"get",
"the",
"timestamp",
"at",
"current",
"dat",
"start"
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/utils.php#L29-L42 |
dengyongbin/loopeer-lib | src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/utils.php | PushUtils.getHourTimestamp | public static function getHourTimestamp($now = null) {
$now = $now === null ? time() : $now;
$diff = $now % 3600; // 1 * 60 * 60;
return $now - $diff;
} | php | public static function getHourTimestamp($now = null) {
$now = $now === null ? time() : $now;
$diff = $now % 3600; // 1 * 60 * 60;
return $now - $diff;
} | [
"public",
"static",
"function",
"getHourTimestamp",
"(",
"$",
"now",
"=",
"null",
")",
"{",
"$",
"now",
"=",
"$",
"now",
"===",
"null",
"?",
"time",
"(",
")",
":",
"$",
"now",
";",
"$",
"diff",
"=",
"$",
"now",
"%",
"3600",
";",
"// 1 * 60 * 60;",
... | get the timestamp at current hour start
@param int $num 指定时间
@return number | [
"get",
"the",
"timestamp",
"at",
"current",
"hour",
"start"
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/utils.php#L48-L52 |
dengyongbin/loopeer-lib | src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/utils.php | PushUtils.getMinuteTimestamp | public static function getMinuteTimestamp($now = null) {
$now = $now === null ? time() : $now;
$diff = $now % 60;
return $now - $diff;
} | php | public static function getMinuteTimestamp($now = null) {
$now = $now === null ? time() : $now;
$diff = $now % 60;
return $now - $diff;
} | [
"public",
"static",
"function",
"getMinuteTimestamp",
"(",
"$",
"now",
"=",
"null",
")",
"{",
"$",
"now",
"=",
"$",
"now",
"===",
"null",
"?",
"time",
"(",
")",
":",
"$",
"now",
";",
"$",
"diff",
"=",
"$",
"now",
"%",
"60",
";",
"return",
"$",
... | get the timestamp at current minute start
@param int $num 指定时间
@return number | [
"get",
"the",
"timestamp",
"at",
"current",
"minute",
"start"
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/utils.php#L58-L62 |
bfitech/zapcore | src/Common.php | Common.exec | final public static function exec(string $cmd, array $args=[]) {
foreach ($args as $key => $val)
$args[$key] = escapeshellarg($val);
$cmd = vsprintf($cmd, $args);
exec($cmd, $output, $retcode);
if ($retcode !== 0)
return false;
return $output;
} | php | final public static function exec(string $cmd, array $args=[]) {
foreach ($args as $key => $val)
$args[$key] = escapeshellarg($val);
$cmd = vsprintf($cmd, $args);
exec($cmd, $output, $retcode);
if ($retcode !== 0)
return false;
return $output;
} | [
"final",
"public",
"static",
"function",
"exec",
"(",
"string",
"$",
"cmd",
",",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"args",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"$",
"args",
"[",
"$",
"key",
"]",
"=",
"escap... | Execute arbitrary shell commands. Use with care.
@param string $cmd Command with '%s' as parameter placeholders.
@param array $args List of parameters to replace the
placeholders in command.
@return bool|array False on failure, stdout lines otherwise. | [
"Execute",
"arbitrary",
"shell",
"commands",
".",
"Use",
"with",
"care",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L28-L36 |
bfitech/zapcore | src/Common.php | Common.get_mimetype | final public static function get_mimetype(
string $fname, string $path_to_file=null
) {
if (null === $mime = self::_mime_extension($fname))
return self::_mime_magic($fname, $path_to_file);
return $mime;
} | php | final public static function get_mimetype(
string $fname, string $path_to_file=null
) {
if (null === $mime = self::_mime_extension($fname))
return self::_mime_magic($fname, $path_to_file);
return $mime;
} | [
"final",
"public",
"static",
"function",
"get_mimetype",
"(",
"string",
"$",
"fname",
",",
"string",
"$",
"path_to_file",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"mime",
"=",
"self",
"::",
"_mime_extension",
"(",
"$",
"fname",
")",
")",
"... | Find a mime type.
@param string $fname The file name.
@param string $path_to_file Path to `file`. Useful if
you have it outside PATH.
@return string The MIME type or application/octet-stream. | [
"Find",
"a",
"mime",
"type",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L46-L53 |
bfitech/zapcore | src/Common.php | Common._mime_extension | private static function _mime_extension(string $fname) {
$pinfo = pathinfo($fname);
// @codeCoverageIgnoreStart
if (!isset($pinfo['extension']))
return null;
// @codeCoverageIgnoreEnd
# Because these things are magically ambiguous, we'll
# resort to extension.
switch (strtolower($pinfo['extension'])) {... | php | private static function _mime_extension(string $fname) {
$pinfo = pathinfo($fname);
// @codeCoverageIgnoreStart
if (!isset($pinfo['extension']))
return null;
// @codeCoverageIgnoreEnd
# Because these things are magically ambiguous, we'll
# resort to extension.
switch (strtolower($pinfo['extension'])) {... | [
"private",
"static",
"function",
"_mime_extension",
"(",
"string",
"$",
"fname",
")",
"{",
"$",
"pinfo",
"=",
"pathinfo",
"(",
"$",
"fname",
")",
";",
"// @codeCoverageIgnoreStart",
"if",
"(",
"!",
"isset",
"(",
"$",
"pinfo",
"[",
"'extension'",
"]",
")",
... | Get MIME by extension.
Useful for serving typical text files that don't have unique
magic numbers. | [
"Get",
"MIME",
"by",
"extension",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L61-L82 |
bfitech/zapcore | src/Common.php | Common._mime_magic | private static function _mime_magic(
string $fname, string $path_to_file=null
) {
# with builtin
if (
function_exists('mime_content_type') &&
($mime = @mime_content_type($fname)) &&
$mime != 'application/octet-stream'
)
return $mime;
# with `file`, skip coverage because `file` is usually
# not... | php | private static function _mime_magic(
string $fname, string $path_to_file=null
) {
# with builtin
if (
function_exists('mime_content_type') &&
($mime = @mime_content_type($fname)) &&
$mime != 'application/octet-stream'
)
return $mime;
# with `file`, skip coverage because `file` is usually
# not... | [
"private",
"static",
"function",
"_mime_magic",
"(",
"string",
"$",
"fname",
",",
"string",
"$",
"path_to_file",
"=",
"null",
")",
"{",
"# with builtin",
"if",
"(",
"function_exists",
"(",
"'mime_content_type'",
")",
"&&",
"(",
"$",
"mime",
"=",
"@",
"mime_c... | Get MIME type with `mime_content_type` or `file`. | [
"Get",
"MIME",
"type",
"with",
"mime_content_type",
"or",
"file",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L87-L116 |
bfitech/zapcore | src/Common.php | Common.http_client | public static function http_client(array $kwargs) {
$url = $method = null;
$headers = $get = $post = $custom_opts = [];
$expect_json = false;
extract(self::extract_kwargs($kwargs, [
'url' => null,
'method' => 'GET',
'headers'=> [],
'get' => [],
'post' => [],
'custom_opts' => [],
'expect_jso... | php | public static function http_client(array $kwargs) {
$url = $method = null;
$headers = $get = $post = $custom_opts = [];
$expect_json = false;
extract(self::extract_kwargs($kwargs, [
'url' => null,
'method' => 'GET',
'headers'=> [],
'get' => [],
'post' => [],
'custom_opts' => [],
'expect_jso... | [
"public",
"static",
"function",
"http_client",
"(",
"array",
"$",
"kwargs",
")",
"{",
"$",
"url",
"=",
"$",
"method",
"=",
"null",
";",
"$",
"headers",
"=",
"$",
"get",
"=",
"$",
"post",
"=",
"$",
"custom_opts",
"=",
"[",
"]",
";",
"$",
"expect_jso... | cURL-based HTTP client.
@param array $kwargs Dict with key-value:
- `url` : (string) the URL
- `method` : (string) HTTP request method
- `headers` : (array) optional request headers, useful for
setting MIME type, user agent, etc.
- `get` : (dict) query string will be built off of
this; leave empty if you alre... | [
"cURL",
"-",
"based",
"HTTP",
"client",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L150-L225 |
bfitech/zapcore | src/Common.php | Common.check_dict | final public static function check_dict(
array $array, array $keys, bool $trim=false
) {
$checked = [];
foreach ($keys as $key) {
if (!isset($array[$key]))
return false;
$val = $array[$key];
if ($trim) {
if (!is_string($val))
return false;
$val = trim($val);
if (!$val)
return f... | php | final public static function check_dict(
array $array, array $keys, bool $trim=false
) {
$checked = [];
foreach ($keys as $key) {
if (!isset($array[$key]))
return false;
$val = $array[$key];
if ($trim) {
if (!is_string($val))
return false;
$val = trim($val);
if (!$val)
return f... | [
"final",
"public",
"static",
"function",
"check_dict",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"keys",
",",
"bool",
"$",
"trim",
"=",
"false",
")",
"{",
"$",
"checked",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
... | Check if a dict contains all necessary keys.
@param array $array Dict to verify.
@param array $keys List of keys to verify against.
@param bool $trim Whether it should treat everything as string
and trim the values and drop keys of those with empty values.
@return bool|array False on failure, filtered dict otherwise. | [
"Check",
"if",
"a",
"dict",
"contains",
"all",
"necessary",
"keys",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L236-L254 |
bfitech/zapcore | src/Common.php | Common.check_idict | final public static function check_idict(
array $array, array $keys, bool $trim=false
) {
if (false === $array = self::check_dict($array, $keys, $trim))
return false;
foreach ($array as $val) {
if (!is_numeric($val) && !is_string($val))
return false;
}
return $array;
} | php | final public static function check_idict(
array $array, array $keys, bool $trim=false
) {
if (false === $array = self::check_dict($array, $keys, $trim))
return false;
foreach ($array as $val) {
if (!is_numeric($val) && !is_string($val))
return false;
}
return $array;
} | [
"final",
"public",
"static",
"function",
"check_idict",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"keys",
",",
"bool",
"$",
"trim",
"=",
"false",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"array",
"=",
"self",
"::",
"check_dict",
"(",
"$",
"arra... | Check if a dict contains all necessary keys with elements being
immutables, i.e. numeric or string.
@param array $array Dict to verify.
@param array $keys List of keys to verify against.
@param bool $trim Whether it should treat everything as string
and trim the values and drop keys of those with empty values.
@return... | [
"Check",
"if",
"a",
"dict",
"contains",
"all",
"necessary",
"keys",
"with",
"elements",
"being",
"immutables",
"i",
".",
"e",
".",
"numeric",
"or",
"string",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L266-L276 |
bfitech/zapcore | src/Common.php | Common.extract_kwargs | final public static function extract_kwargs(
array $input_array, array $init_array
) {
foreach (array_keys($init_array) as $key) {
if (isset($input_array[$key]))
$init_array[$key] = $input_array[$key];
}
return $init_array;
} | php | final public static function extract_kwargs(
array $input_array, array $init_array
) {
foreach (array_keys($init_array) as $key) {
if (isset($input_array[$key]))
$init_array[$key] = $input_array[$key];
}
return $init_array;
} | [
"final",
"public",
"static",
"function",
"extract_kwargs",
"(",
"array",
"$",
"input_array",
",",
"array",
"$",
"init_array",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"init_array",
")",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
... | Initiate a kwargs array for safe extraction.
This will remove keys not available in $init_array instead
of filling in holes in input array.
@param array $input_array Input array, typically first
parameter in a method.
@param array $init_array Fallback array when input array
is not complete, of the form: `key => defau... | [
"Initiate",
"a",
"kwargs",
"array",
"for",
"safe",
"extraction",
"."
] | train | https://github.com/bfitech/zapcore/blob/0ae4cb9370876ab3583556bf272063685ec57948/src/Common.php#L290-L298 |
tonicospinelli/class-generation | src/ClassGeneration/Visibility.php | Visibility.isValid | public static function isValid($visibility)
{
switch ($visibility) {
case Visibility::TYPE_PRIVATE:
case Visibility::TYPE_PROTECTED:
case Visibility::TYPE_PUBLIC:
return true;
}
throw new \InvalidArgumentException('The ' . $visibility . ' i... | php | public static function isValid($visibility)
{
switch ($visibility) {
case Visibility::TYPE_PRIVATE:
case Visibility::TYPE_PROTECTED:
case Visibility::TYPE_PUBLIC:
return true;
}
throw new \InvalidArgumentException('The ' . $visibility . ' i... | [
"public",
"static",
"function",
"isValid",
"(",
"$",
"visibility",
")",
"{",
"switch",
"(",
"$",
"visibility",
")",
"{",
"case",
"Visibility",
"::",
"TYPE_PRIVATE",
":",
"case",
"Visibility",
"::",
"TYPE_PROTECTED",
":",
"case",
"Visibility",
"::",
"TYPE_PUBLI... | Validate visiblity.
@param string $visibility
@throws \InvalidArgumentException
@return bool | [
"Validate",
"visiblity",
"."
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Visibility.php#L34-L43 |
ua1-labs/firebug | Fire/Bug/Panel/Debugger.php | Debugger.render | public function render() {
if (!$this->_enableXDebugOverlay) {
ini_set('xdebug.overload_var_dump', 'off');
}
$debuggerCount = count($this->_debuggers);
$this->setName(str_replace('{count}', '{' . $debuggerCount . '}', self::NAME));
parent::render();
} | php | public function render() {
if (!$this->_enableXDebugOverlay) {
ini_set('xdebug.overload_var_dump', 'off');
}
$debuggerCount = count($this->_debuggers);
$this->setName(str_replace('{count}', '{' . $debuggerCount . '}', self::NAME));
parent::render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_enableXDebugOverlay",
")",
"{",
"ini_set",
"(",
"'xdebug.overload_var_dump'",
",",
"'off'",
")",
";",
"}",
"$",
"debuggerCount",
"=",
"count",
"(",
"$",
"this",
"->",
"_d... | Renders the panel HTML.
@return void | [
"Renders",
"the",
"panel",
"HTML",
"."
] | train | https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug/Panel/Debugger.php#L89-L96 |
BugBuster1701/banner | classes/BannerCheckHelper.php | BannerCheckHelper.checkExtensions | public function checkExtensions($strContent, $strTemplate)
{
if ($strTemplate == 'be_main')
{
if (!is_array($_SESSION["TL_INFO"]))
{
$_SESSION["TL_INFO"] = array();
}
// required extensions
$arrRequiredExtensions = arra... | php | public function checkExtensions($strContent, $strTemplate)
{
if ($strTemplate == 'be_main')
{
if (!is_array($_SESSION["TL_INFO"]))
{
$_SESSION["TL_INFO"] = array();
}
// required extensions
$arrRequiredExtensions = arra... | [
"public",
"function",
"checkExtensions",
"(",
"$",
"strContent",
",",
"$",
"strTemplate",
")",
"{",
"if",
"(",
"$",
"strTemplate",
"==",
"'be_main'",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"_SESSION",
"[",
"\"TL_INFO\"",
"]",
")",
")",
"{",
"$... | Hook: Check the required extensions and files for Banner
@param string $strContent
@param string $strTemplate
@return string | [
"Hook",
":",
"Check",
"the",
"required",
"extensions",
"and",
"files",
"for",
"Banner"
] | train | https://github.com/BugBuster1701/banner/blob/3ffac36837923194ab0ebaf308c0b23a3684b005/classes/BannerCheckHelper.php#L68-L102 |
bocharsky-bw/FileNamingResolver | src/FileNamingResolver.php | FileNamingResolver.resolve | public function resolve(FileInfo $srcFileInfo)
{
$dstFileInfo = $this->namingStrategy->provideName($srcFileInfo);
if (!$dstFileInfo instanceof FileInfo) {
throw new \RuntimeException(
sprintf(
'Specified naming strategy should return an instance of "%s... | php | public function resolve(FileInfo $srcFileInfo)
{
$dstFileInfo = $this->namingStrategy->provideName($srcFileInfo);
if (!$dstFileInfo instanceof FileInfo) {
throw new \RuntimeException(
sprintf(
'Specified naming strategy should return an instance of "%s... | [
"public",
"function",
"resolve",
"(",
"FileInfo",
"$",
"srcFileInfo",
")",
"{",
"$",
"dstFileInfo",
"=",
"$",
"this",
"->",
"namingStrategy",
"->",
"provideName",
"(",
"$",
"srcFileInfo",
")",
";",
"if",
"(",
"!",
"$",
"dstFileInfo",
"instanceof",
"FileInfo"... | @param FileInfo $srcFileInfo The source FileInfo
@return FileInfo The destination FileInfo
@throws \RuntimeException If specified naming strategy returns not FileNamingResolver\FileInfo instance | [
"@param",
"FileInfo",
"$srcFileInfo",
"The",
"source",
"FileInfo"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileNamingResolver.php#L32-L45 |
blast-project/CoreBundle | src/Controller/CRUDController.php | CRUDController.generateEntityCodeAction | public function generateEntityCodeAction($id = null)
{
$request = $this->getRequest();
$id = $request->get($this->admin->getIdParameter());
if ($id) {
$subject = $this->admin->getObject($id);
if (!$subject) {
$error = sprintf('unable to find the objec... | php | public function generateEntityCodeAction($id = null)
{
$request = $this->getRequest();
$id = $request->get($this->admin->getIdParameter());
if ($id) {
$subject = $this->admin->getObject($id);
if (!$subject) {
$error = sprintf('unable to find the objec... | [
"public",
"function",
"generateEntityCodeAction",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"id",
"=",
"$",
"request",
"->",
"get",
"(",
"$",
"this",
"->",
"admin",
"->",
"getIdPa... | Generate Entity Code action.
@param int|string|null $id
@return JsonResponse | [
"Generate",
"Entity",
"Code",
"action",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Controller/CRUDController.php#L174-L216 |
baleen/cli | src/CommandBus/Config/StatusHandler.php | StatusHandler.handle | public function handle(StatusMessage $message)
{
$this->message = $message;
$this->output = $message->getOutput();
$output = $this->output;
$repository = $message->getRepository();
$storage = $message->getStorage();
$availableMigrations = $repository->fetchAll();
... | php | public function handle(StatusMessage $message)
{
$this->message = $message;
$this->output = $message->getOutput();
$output = $this->output;
$repository = $message->getRepository();
$storage = $message->getStorage();
$availableMigrations = $repository->fetchAll();
... | [
"public",
"function",
"handle",
"(",
"StatusMessage",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"message",
"=",
"$",
"message",
";",
"$",
"this",
"->",
"output",
"=",
"$",
"message",
"->",
"getOutput",
"(",
")",
";",
"$",
"output",
"=",
"$",
"this... | Handles a StatusMessage, which prints the status of the migrations system in a developer-friendly format
(inspired by "git status").
@param StatusMessage $message | [
"Handles",
"a",
"StatusMessage",
"which",
"prints",
"the",
"status",
"of",
"the",
"migrations",
"system",
"in",
"a",
"developer",
"-",
"friendly",
"format",
"(",
"inspired",
"by",
"git",
"status",
")",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Config/StatusHandler.php#L47-L99 |
baleen/cli | src/CommandBus/Config/StatusHandler.php | StatusHandler.printPendingVersion | protected function printPendingVersion(Version $version, $style)
{
/** @var Version $version */
$id = $version->getId();
$reflectionClass = new \ReflectionClass($version->getMigration());
$absolutePath = $reflectionClass->getFileName();
$fileName = $absolutePath ? $this->getR... | php | protected function printPendingVersion(Version $version, $style)
{
/** @var Version $version */
$id = $version->getId();
$reflectionClass = new \ReflectionClass($version->getMigration());
$absolutePath = $reflectionClass->getFileName();
$fileName = $absolutePath ? $this->getR... | [
"protected",
"function",
"printPendingVersion",
"(",
"Version",
"$",
"version",
",",
"$",
"style",
")",
"{",
"/** @var Version $version */",
"$",
"id",
"=",
"$",
"version",
"->",
"getId",
"(",
")",
";",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClas... | Formats and prints a pending version with the given style.
@param Version $version The Version to print.
@param string $style One of the STYLE_* constants. | [
"Formats",
"and",
"prints",
"a",
"pending",
"version",
"with",
"the",
"given",
"style",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Config/StatusHandler.php#L107-L115 |
baleen/cli | src/CommandBus/Config/StatusHandler.php | StatusHandler.printDiff | protected function printDiff(array $versions, $message, $style = self::STYLE_INFO)
{
if (empty($versions)) {
return;
}
$this->output->writeln($message);
$this->output->writeln('');
foreach ($versions as $version) {
$this->printPendingVersion($version,... | php | protected function printDiff(array $versions, $message, $style = self::STYLE_INFO)
{
if (empty($versions)) {
return;
}
$this->output->writeln($message);
$this->output->writeln('');
foreach ($versions as $version) {
$this->printPendingVersion($version,... | [
"protected",
"function",
"printDiff",
"(",
"array",
"$",
"versions",
",",
"$",
"message",
",",
"$",
"style",
"=",
"self",
"::",
"STYLE_INFO",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"versions",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
... | Prints an array (group) of Versions all with the given style. If the array is empty then it prints nothing.
@param array $versions
@param string|string[] $message Message(s) to print before the group of versions.
@param string $style One of the STYLE_* constants. | [
"Prints",
"an",
"array",
"(",
"group",
")",
"of",
"Versions",
"all",
"with",
"the",
"given",
"style",
".",
"If",
"the",
"array",
"is",
"empty",
"then",
"it",
"prints",
"nothing",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/CommandBus/Config/StatusHandler.php#L165-L179 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.