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 |
|---|---|---|---|---|---|---|---|---|---|---|
simple-php-mvc/simple-php-mvc | src/MVC/Server/Route.php | Route.setMethods | public function setMethods($methods)
{
if (is_string($methods)) {
if (!isset(self::$validMethods[strtolower($methods)])) {
throw new \LogicException(sprintf('Route method "%s" is invalid. Params expected "%s"', $methods, implode(', ', array_keys(self::$validMethods))));
... | php | public function setMethods($methods)
{
if (is_string($methods)) {
if (!isset(self::$validMethods[strtolower($methods)])) {
throw new \LogicException(sprintf('Route method "%s" is invalid. Params expected "%s"', $methods, implode(', ', array_keys(self::$validMethods))));
... | [
"public",
"function",
"setMethods",
"(",
"$",
"methods",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"methods",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"validMethods",
"[",
"strtolower",
"(",
"$",
"methods",
")",
"]",
")",
"... | Set methods
@param string|array $methods
@return Route
@throws \LogicException | [
"Set",
"methods"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/Route.php#L161-L175 |
simple-php-mvc/simple-php-mvc | src/MVC/Server/Route.php | Route.setName | public function setName($name)
{
if (!is_string($name)) {
throw new \LogicException(sprintf('Route name given "%s" is invalid. String expected.', gettype($name)));
}
$this->name = $name;
return $this;
} | php | public function setName($name)
{
if (!is_string($name)) {
throw new \LogicException(sprintf('Route name given "%s" is invalid. String expected.', gettype($name)));
}
$this->name = $name;
return $this;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'Route name given \"%s\" is invalid. String expected.'",
",",
"gettype",
"(... | Set name
@param string $name
@return Route
@throws \LogicException | [
"Set",
"name"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/Route.php#L184-L192 |
simple-php-mvc/simple-php-mvc | src/MVC/Server/Route.php | Route.setPatternUri | public function setPatternUri($patternUri)
{
if (!is_string($patternUri)) {
throw new \LogicException(sprintf('Route pattern given "%s" is invalid. String expected.', gettype($patternUri)));
}
$this->patternUri = $patternUri;
return $this;
} | php | public function setPatternUri($patternUri)
{
if (!is_string($patternUri)) {
throw new \LogicException(sprintf('Route pattern given "%s" is invalid. String expected.', gettype($patternUri)));
}
$this->patternUri = $patternUri;
return $this;
} | [
"public",
"function",
"setPatternUri",
"(",
"$",
"patternUri",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"patternUri",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'Route pattern given \"%s\" is invalid. String expected.'",
"... | Set patternUri
@param string $patternUri
@return Route
@throws \LogicException | [
"Set",
"patternUri"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Server/Route.php#L201-L209 |
aalfiann/parallel-request-php | src/ParallelRequest.php | ParallelRequest.addRequest | public function addRequest($url,$params=array(),$formdata=true){
if(!empty($params)){
if ($formdata){
$this->request[] = [
'url' => $url,
'post' => $params
];
} else {
... | php | public function addRequest($url,$params=array(),$formdata=true){
if(!empty($params)){
if ($formdata){
$this->request[] = [
'url' => $url,
'post' => $params
];
} else {
... | [
"public",
"function",
"addRequest",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"formdata",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"params",
")",
")",
"{",
"if",
"(",
"$",
"formdata",
")",
"{",
"$",... | Add request
@param url = input the request url here (string only)
@param params = is the array parameter data to be send for the request (array). This is optional and default is empty.
@param formdata = if set to false then will convert params array to url parameter. Default is true means as form-data.
@return this | [
"Add",
"request"
] | train | https://github.com/aalfiann/parallel-request-php/blob/2b36485215b9004d0c12422b6f0afb0b9419d6c1/src/ParallelRequest.php#L32-L46 |
aalfiann/parallel-request-php | src/ParallelRequest.php | ParallelRequest.send | public function send() {
if(!extension_loaded('curl')) throw new Exception('CURL library not loaded!');
// cleanup any response
$this->response = array();
// array of curl handles
$curly = array();
// data to be returned
... | php | public function send() {
if(!extension_loaded('curl')) throw new Exception('CURL library not loaded!');
// cleanup any response
$this->response = array();
// array of curl handles
$curly = array();
// data to be returned
... | [
"public",
"function",
"send",
"(",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'curl'",
")",
")",
"throw",
"new",
"Exception",
"(",
"'CURL library not loaded!'",
")",
";",
"// cleanup any response",
"$",
"this",
"->",
"response",
"=",
"array",
"(",
"... | Send a parallel request with using curl_multi_exec
@return this for chaining purpose | [
"Send",
"a",
"parallel",
"request",
"with",
"using",
"curl_multi_exec"
] | train | https://github.com/aalfiann/parallel-request-php/blob/2b36485215b9004d0c12422b6f0afb0b9419d6c1/src/ParallelRequest.php#L116-L234 |
inblank/yii2-transliter | src/Transliter.php | Transliter.translate | public function translate($str, $spacer = null, $toLower = null)
{
if ($spacer === null) {
$spacer = $this->spacer;
}
if ($toLower === null) {
$toLower = $this->toLower;
}
$str = strtr($str, $this->table);
if (is_callable($this->after)) {
... | php | public function translate($str, $spacer = null, $toLower = null)
{
if ($spacer === null) {
$spacer = $this->spacer;
}
if ($toLower === null) {
$toLower = $this->toLower;
}
$str = strtr($str, $this->table);
if (is_callable($this->after)) {
... | [
"public",
"function",
"translate",
"(",
"$",
"str",
",",
"$",
"spacer",
"=",
"null",
",",
"$",
"toLower",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"spacer",
"===",
"null",
")",
"{",
"$",
"spacer",
"=",
"$",
"this",
"->",
"spacer",
";",
"}",
"if",
... | Transliterate method
@param string $str input string
@param null|string $spacer space replacer. If null uses Transliter::$spacer
@param null|bool $toLower convert result to lowercase. If null uses Transliter::$toLower
@return string | [
"Transliterate",
"method"
] | train | https://github.com/inblank/yii2-transliter/blob/9b66651b533f940cc9f7c5d34518ec2222708c92/src/Transliter.php#L73-L93 |
slashworks/control-bundle | src/Slashworks/AppBundle/Command/ApiCommand.php | ApiCommand.configure | protected function configure()
{
// get systemname
$sAppName = SystemSettings::get('app_name');
// set cli options
$this->setName($sAppName . ':remote:cron')->addOption('app', null, InputOption::VALUE_REQUIRED, 'run only for specific remote app', false)->addOpti... | php | protected function configure()
{
// get systemname
$sAppName = SystemSettings::get('app_name');
// set cli options
$this->setName($sAppName . ':remote:cron')->addOption('app', null, InputOption::VALUE_REQUIRED, 'run only for specific remote app', false)->addOpti... | [
"protected",
"function",
"configure",
"(",
")",
"{",
"// get systemname",
"$",
"sAppName",
"=",
"SystemSettings",
"::",
"get",
"(",
"'app_name'",
")",
";",
"// set cli options",
"$",
"this",
"->",
"setName",
"(",
"$",
"sAppName",
".",
"':remote:cron'",
")",
"-... | configure cli command for making api calls | [
"configure",
"cli",
"command",
"for",
"making",
"api",
"calls"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/ApiCommand.php#L45-L53 |
slashworks/control-bundle | src/Slashworks/AppBundle/Command/ApiCommand.php | ApiCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
// define colors if verbose
if ($input->hasOption('verbose')) {
if ($input->getOption('verbose')) {
$oErrStyle = new OutputFormatterStyle('red', null, array('bold'));
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
// define colors if verbose
if ($input->hasOption('verbose')) {
if ($input->getOption('verbose')) {
$oErrStyle = new OutputFormatterStyle('red', null, array('bold'));
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"// define colors if verbose",
"if",
"(",
"$",
"input",
"->",
"hasOption",
"(",
"'verbose'",
")",
")",
"{",
"if",
"(",
"$",
"input",
"->... | execute api command
@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return void | [
"execute",
"api",
"command"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/ApiCommand.php#L64-L169 |
slashworks/control-bundle | src/Slashworks/AppBundle/Command/ApiCommand.php | ApiCommand._parseCrontab | private function _parseCrontab($sDatetime, $sCrontab)
{
$aTime = explode(' ', date('i G j n w', strtotime($sDatetime)));
$sCrontab = explode(' ', $sCrontab);
foreach ($sCrontab as $k => &$v) {
$v = explode(',', $v);
foreach ($v as &$v1) {
... | php | private function _parseCrontab($sDatetime, $sCrontab)
{
$aTime = explode(' ', date('i G j n w', strtotime($sDatetime)));
$sCrontab = explode(' ', $sCrontab);
foreach ($sCrontab as $k => &$v) {
$v = explode(',', $v);
foreach ($v as &$v1) {
... | [
"private",
"function",
"_parseCrontab",
"(",
"$",
"sDatetime",
",",
"$",
"sCrontab",
")",
"{",
"$",
"aTime",
"=",
"explode",
"(",
"' '",
",",
"date",
"(",
"'i G j n w'",
",",
"strtotime",
"(",
"$",
"sDatetime",
")",
")",
")",
";",
"$",
"sCrontab",
"=",... | Parse cron time string
@param $sDatetime
@param $sCrontab
@return mixed | [
"Parse",
"cron",
"time",
"string"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/ApiCommand.php#L180-L205 |
slashworks/control-bundle | src/Slashworks/AppBundle/Command/ApiCommand.php | ApiCommand._makeCall | private function _makeCall($oRemoteApp)
{
// get class
$this->getContainer()->get('API');
// do call
Api::$_container = $this->getContainer();
$aReturn = Api::call('getData', array(
array(
'log' => $oRemoteApp->g... | php | private function _makeCall($oRemoteApp)
{
// get class
$this->getContainer()->get('API');
// do call
Api::$_container = $this->getContainer();
$aReturn = Api::call('getData', array(
array(
'log' => $oRemoteApp->g... | [
"private",
"function",
"_makeCall",
"(",
"$",
"oRemoteApp",
")",
"{",
"// get class",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'API'",
")",
";",
"// do call",
"Api",
"::",
"$",
"_container",
"=",
"$",
"this",
"->",
"getContainer",
... | perform api call
@param RemoteApp $oRemoteApp
@return mixed | [
"perform",
"api",
"call"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/ApiCommand.php#L215-L245 |
slashworks/control-bundle | src/Slashworks/AppBundle/Command/ApiCommand.php | ApiCommand._saveResponse | private function _saveResponse($aResponse, $oRemoteApp)
{
// get model by app-type
$sClassName = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst($oRemoteApp->getType());
$sQueryClassName = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst($oRemoteApp->getType(... | php | private function _saveResponse($aResponse, $oRemoteApp)
{
// get model by app-type
$sClassName = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst($oRemoteApp->getType());
$sQueryClassName = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst($oRemoteApp->getType(... | [
"private",
"function",
"_saveResponse",
"(",
"$",
"aResponse",
",",
"$",
"oRemoteApp",
")",
"{",
"// get model by app-type",
"$",
"sClassName",
"=",
"'\\Slashworks\\AppBundle\\Model\\RemoteHistory'",
".",
"ucfirst",
"(",
"$",
"oRemoteApp",
"->",
"getType",
"(",
")",
... | Save response to database
@param array $aResponse
@param RemoteApp $oRemoteApp
@throws \Exception
@return void | [
"Save",
"response",
"to",
"database"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/ApiCommand.php#L258-L331 |
slashworks/control-bundle | src/Slashworks/AppBundle/Command/ApiCommand.php | ApiCommand._sendErrorNotification | private function _sendErrorNotification(&$oRemoteApp, $aResponse)
{
$iStatusCode = $aResponse['statuscode'];
/*
* Parse template by statuscode
*/
if ($iStatusCode === 404) {
$sHtml = $this->getContainer()->get('templating')->render('... | php | private function _sendErrorNotification(&$oRemoteApp, $aResponse)
{
$iStatusCode = $aResponse['statuscode'];
/*
* Parse template by statuscode
*/
if ($iStatusCode === 404) {
$sHtml = $this->getContainer()->get('templating')->render('... | [
"private",
"function",
"_sendErrorNotification",
"(",
"&",
"$",
"oRemoteApp",
",",
"$",
"aResponse",
")",
"{",
"$",
"iStatusCode",
"=",
"$",
"aResponse",
"[",
"'statuscode'",
"]",
";",
"/*\n * Parse template by statuscode\n */",
"if",
"(",
"$",... | Send Error-Notification to user
@param $oRemoteApp
@param $aResponse | [
"Send",
"Error",
"-",
"Notification",
"to",
"user"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/ApiCommand.php#L340-L383 |
slashworks/control-bundle | src/Slashworks/AppBundle/Command/ApiCommand.php | ApiCommand._sendNotification | private function _sendNotification($aDiff, &$oRemoteApp, $aNewHistory)
{
// parse template
$sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_notification.html.twig', array(
'diff' => $aDiff,
'log' => $a... | php | private function _sendNotification($aDiff, &$oRemoteApp, $aNewHistory)
{
// parse template
$sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_notification.html.twig', array(
'diff' => $aDiff,
'log' => $a... | [
"private",
"function",
"_sendNotification",
"(",
"$",
"aDiff",
",",
"&",
"$",
"oRemoteApp",
",",
"$",
"aNewHistory",
")",
"{",
"// parse template",
"$",
"sHtml",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'templating'",
")",
"->",... | Send Notification to user
@param array $aDiff
@param RemoteApp $oRemoteApp
@param RemoteHistoryContao $aNewHistory
@return void | [
"Send",
"Notification",
"to",
"user"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Command/ApiCommand.php#L395-L416 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Section/MemoryImage.php | PHPWord_Section_MemoryImage._setFunctions | private function _setFunctions() {
switch($this->_imageType) {
case 'image/png':
$this->_imageCreateFunc = 'imagecreatefrompng';
$this->_imageFunc = 'imagepng';
$this->_imageExtension = 'png';
break;
case 'image/gif':
$this->_imageCreateFunc = 'imagecreatefromgif';
$this->_image... | php | private function _setFunctions() {
switch($this->_imageType) {
case 'image/png':
$this->_imageCreateFunc = 'imagecreatefrompng';
$this->_imageFunc = 'imagepng';
$this->_imageExtension = 'png';
break;
case 'image/gif':
$this->_imageCreateFunc = 'imagecreatefromgif';
$this->_image... | [
"private",
"function",
"_setFunctions",
"(",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"_imageType",
")",
"{",
"case",
"'image/png'",
":",
"$",
"this",
"->",
"_imageCreateFunc",
"=",
"'imagecreatefrompng'",
";",
"$",
"this",
"->",
"_imageFunc",
"=",
"'imag... | Set Functions | [
"Set",
"Functions"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Section/MemoryImage.php#L129-L147 |
JBZoo/Less | src/Cache.php | Cache.isExpired | public function isExpired()
{
if (!FS::isFile($this->_resultFile)) {
return true;
}
$fileAge = abs(time() - filemtime($this->_resultFile));
if ($fileAge >= $this->_cache_ttl) {
return true;
}
$firstLine = trim(FS::firstLine($this->_resultFile... | php | public function isExpired()
{
if (!FS::isFile($this->_resultFile)) {
return true;
}
$fileAge = abs(time() - filemtime($this->_resultFile));
if ($fileAge >= $this->_cache_ttl) {
return true;
}
$firstLine = trim(FS::firstLine($this->_resultFile... | [
"public",
"function",
"isExpired",
"(",
")",
"{",
"if",
"(",
"!",
"FS",
"::",
"isFile",
"(",
"$",
"this",
"->",
"_resultFile",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"fileAge",
"=",
"abs",
"(",
"time",
"(",
")",
"-",
"filemtime",
"(",
"$... | Check is current cache is expired | [
"Check",
"is",
"current",
"cache",
"is",
"expired"
] | train | https://github.com/JBZoo/Less/blob/9e9c41e3c7b76222c0d81379dead222413f2f042/src/Cache.php#L86-L104 |
JBZoo/Less | src/Cache.php | Cache.save | public function save($content)
{
$content = $this->_getHeader() . $content;
$result = file_put_contents($this->_resultFile, $content);
if (!$result) {
throw new Exception('JBZoo/Less: File not save - ' . $this->_resultFile); // @codeCoverageIgnore
}
} | php | public function save($content)
{
$content = $this->_getHeader() . $content;
$result = file_put_contents($this->_resultFile, $content);
if (!$result) {
throw new Exception('JBZoo/Less: File not save - ' . $this->_resultFile); // @codeCoverageIgnore
}
} | [
"public",
"function",
"save",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"_getHeader",
"(",
")",
".",
"$",
"content",
";",
"$",
"result",
"=",
"file_put_contents",
"(",
"$",
"this",
"->",
"_resultFile",
",",
"$",
"content",
... | Save result to cache
@param string $content
@throws Exception | [
"Save",
"result",
"to",
"cache"
] | train | https://github.com/JBZoo/Less/blob/9e9c41e3c7b76222c0d81379dead222413f2f042/src/Cache.php#L169-L177 |
claroline/ForumBundle | Manager/Manager.php | Manager.subscribe | public function subscribe(Forum $forum, User $user, $selfActivation = true)
{
$this->om->startFlushSuite();
$notification = new Notification();
$notification->setUser($user);
$notification->setForum($forum);
$notification->setSelfActivation($selfActivation);
$this->om... | php | public function subscribe(Forum $forum, User $user, $selfActivation = true)
{
$this->om->startFlushSuite();
$notification = new Notification();
$notification->setUser($user);
$notification->setForum($forum);
$notification->setSelfActivation($selfActivation);
$this->om... | [
"public",
"function",
"subscribe",
"(",
"Forum",
"$",
"forum",
",",
"User",
"$",
"user",
",",
"$",
"selfActivation",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"notification",
"=",
"new",
"Notification",
... | Subscribe a user to a forum. A mail will be sent to the user each time
a message is posted.
@param \Claroline\ForumBundle\Entity\Forum $forum
@param \Claroline\CoreBundle\Entity\User $user | [
"Subscribe",
"a",
"user",
"to",
"a",
"forum",
".",
"A",
"mail",
"will",
"be",
"sent",
"to",
"the",
"user",
"each",
"time",
"a",
"message",
"is",
"posted",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L133-L143 |
claroline/ForumBundle | Manager/Manager.php | Manager.unsubscribe | public function unsubscribe(Forum $forum, User $user)
{
$this->om->startFlushSuite();
$notification = $this->notificationRepo->findOneBy(array('forum' => $forum, 'user' => $user));
$this->om->remove($notification);
$this->dispatch(new UnsubscribeForumEvent($forum));
$this->om... | php | public function unsubscribe(Forum $forum, User $user)
{
$this->om->startFlushSuite();
$notification = $this->notificationRepo->findOneBy(array('forum' => $forum, 'user' => $user));
$this->om->remove($notification);
$this->dispatch(new UnsubscribeForumEvent($forum));
$this->om... | [
"public",
"function",
"unsubscribe",
"(",
"Forum",
"$",
"forum",
",",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"notification",
"=",
"$",
"this",
"->",
"notificationRepo",
"->",
"findOneBy",
"(",... | Unsubscribe a user from a forum.
@param \Claroline\ForumBundle\Entity\Forum $forum
@param \Claroline\CoreBundle\Entity\User $user | [
"Unsubscribe",
"a",
"user",
"from",
"a",
"forum",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L151-L158 |
claroline/ForumBundle | Manager/Manager.php | Manager.createCategory | public function createCategory(Forum $forum, $name, $autolog = true)
{
$this->om->startFlushSuite();
$category = new Category();
$category->setName($name);
$category->setForum($forum);
$this->om->persist($category);
//required for the default category
$this->... | php | public function createCategory(Forum $forum, $name, $autolog = true)
{
$this->om->startFlushSuite();
$category = new Category();
$category->setName($name);
$category->setForum($forum);
$this->om->persist($category);
//required for the default category
$this->... | [
"public",
"function",
"createCategory",
"(",
"Forum",
"$",
"forum",
",",
"$",
"name",
",",
"$",
"autolog",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"category",
"=",
"new",
"Category",
"(",
")",
";",... | Create a category.
@param \Claroline\ForumBundle\Entity\Forum $forum
@param string $name The category name
@param boolean $autolog
@return \Claroline\ForumBundle\Entity\Category | [
"Create",
"a",
"category",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L169-L188 |
claroline/ForumBundle | Manager/Manager.php | Manager.createMessage | public function createMessage(Message $message, Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->sc->isGranted('post', $collection)) {
throw new AccessDeniedHttpException($collectio... | php | public function createMessage(Message $message, Subject $subject)
{
$forum = $subject->getCategory()->getForum();
$collection = new ResourceCollection(array($forum->getResourceNode()));
if (!$this->sc->isGranted('post', $collection)) {
throw new AccessDeniedHttpException($collectio... | [
"public",
"function",
"createMessage",
"(",
"Message",
"$",
"message",
",",
"Subject",
"$",
"subject",
")",
"{",
"$",
"forum",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"collection",
"=",
"new",
"ResourceCo... | @param \Claroline\ForumBundle\Entity\Message $message
@param \Claroline\ForumBundle\Entity\Subject $subject
@throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
@return \Claroline\ForumBundle\Entity\Message | [
"@param",
"\\",
"Claroline",
"\\",
"ForumBundle",
"\\",
"Entity",
"\\",
"Message",
"$message"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L208-L227 |
claroline/ForumBundle | Manager/Manager.php | Manager.createSubject | public function createSubject(Subject $subject)
{
$this->om->startFlushSuite();
$this->om->persist($subject);
$this->dispatch(new CreateSubjectEvent($subject));
$this->om->endFlushSuite();
return $subject;
} | php | public function createSubject(Subject $subject)
{
$this->om->startFlushSuite();
$this->om->persist($subject);
$this->dispatch(new CreateSubjectEvent($subject));
$this->om->endFlushSuite();
return $subject;
} | [
"public",
"function",
"createSubject",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"this",
"->",
"om",
"->",
"persist",
"(",
"$",
"subject",
")",
";",
"$",
"this",
"->",
"dispatch",
... | @param \Claroline\ForumBundle\Entity\Subject $subject
@return \Claroline\ForumBundle\Entity\Subject $subject | [
"@param",
"\\",
"Claroline",
"\\",
"ForumBundle",
"\\",
"Entity",
"\\",
"Subject",
"$subject"
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L256-L264 |
claroline/ForumBundle | Manager/Manager.php | Manager.sendMessageNotification | public function sendMessageNotification(Message $message, User $user)
{
$forum = $message->getSubject()->getCategory()->getForum();
$notifications = $this->notificationRepo->findBy(array('forum' => $forum));
$users = array();
foreach ($notifications as $notification) {
$... | php | public function sendMessageNotification(Message $message, User $user)
{
$forum = $message->getSubject()->getCategory()->getForum();
$notifications = $this->notificationRepo->findBy(array('forum' => $forum));
$users = array();
foreach ($notifications as $notification) {
$... | [
"public",
"function",
"sendMessageNotification",
"(",
"Message",
"$",
"message",
",",
"User",
"$",
"user",
")",
"{",
"$",
"forum",
"=",
"$",
"message",
"->",
"getSubject",
"(",
")",
"->",
"getCategory",
"(",
")",
"->",
"getForum",
"(",
")",
";",
"$",
"... | Send a notification to a user about a message.
@param \Claroline\ForumBundle\Entity\Message $message
@param \Claroline\CoreBundle\Entity\User $user | [
"Send",
"a",
"notification",
"to",
"a",
"user",
"about",
"a",
"message",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L284-L307 |
claroline/ForumBundle | Manager/Manager.php | Manager.moveMessage | public function moveMessage(Message $message, Subject $newSubject)
{
$this->om->startFlushSuite();
$oldSubject = $message->getSubject();
$message->setSubject($newSubject);
$this->om->persist($message);
$this->dispatch(new MoveMessageEvent($message, $oldSubject, $newSubject));... | php | public function moveMessage(Message $message, Subject $newSubject)
{
$this->om->startFlushSuite();
$oldSubject = $message->getSubject();
$message->setSubject($newSubject);
$this->om->persist($message);
$this->dispatch(new MoveMessageEvent($message, $oldSubject, $newSubject));... | [
"public",
"function",
"moveMessage",
"(",
"Message",
"$",
"message",
",",
"Subject",
"$",
"newSubject",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"oldSubject",
"=",
"$",
"message",
"->",
"getSubject",
"(",
")",
";",
... | Move a message to an other subject.
@param \Claroline\ForumBundle\Entity\Message $message
@param \Claroline\ForumBundle\Entity\Subject $newSubject | [
"Move",
"a",
"message",
"to",
"an",
"other",
"subject",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L342-L350 |
claroline/ForumBundle | Manager/Manager.php | Manager.moveSubject | public function moveSubject(Subject $subject, Category $newCategory)
{
$this->om->startFlushSuite();
$oldCategory = $subject->getCategory();
$subject->setCategory($newCategory);
$this->om->persist($subject);
$this->dispatch(new MoveSubjectEvent($subject, $oldCategory, $newCat... | php | public function moveSubject(Subject $subject, Category $newCategory)
{
$this->om->startFlushSuite();
$oldCategory = $subject->getCategory();
$subject->setCategory($newCategory);
$this->om->persist($subject);
$this->dispatch(new MoveSubjectEvent($subject, $oldCategory, $newCat... | [
"public",
"function",
"moveSubject",
"(",
"Subject",
"$",
"subject",
",",
"Category",
"$",
"newCategory",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"oldCategory",
"=",
"$",
"subject",
"->",
"getCategory",
"(",
")",
"... | Move a subject to an other category.
@param \Claroline\ForumBundle\Entity\Subject $subject
@param \Claroline\ForumBundle\Entity\Category $newCategory | [
"Move",
"a",
"subject",
"to",
"an",
"other",
"category",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L358-L366 |
claroline/ForumBundle | Manager/Manager.php | Manager.stickSubject | public function stickSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsSticked(true);
$this->om->persist($subject);
$this->dispatch(new StickSubjectEvent($subject));
$this->om->endFlushSuite();
} | php | public function stickSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsSticked(true);
$this->om->persist($subject);
$this->dispatch(new StickSubjectEvent($subject));
$this->om->endFlushSuite();
} | [
"public",
"function",
"stickSubject",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"subject",
"->",
"setIsSticked",
"(",
"true",
")",
";",
"$",
"this",
"->",
"om",
"->",
"persist",
"(",... | Stick a subject at the top of the subject list.
@param \Claroline\ForumBundle\Entity\Subject $subject | [
"Stick",
"a",
"subject",
"at",
"the",
"top",
"of",
"the",
"subject",
"list",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L373-L380 |
claroline/ForumBundle | Manager/Manager.php | Manager.unstickSubject | public function unstickSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsSticked(false);
$this->om->persist($subject);
$this->dispatch(new UnstickSubjectEvent($subject));
$this->om->endFlushSuite();
} | php | public function unstickSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsSticked(false);
$this->om->persist($subject);
$this->dispatch(new UnstickSubjectEvent($subject));
$this->om->endFlushSuite();
} | [
"public",
"function",
"unstickSubject",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"subject",
"->",
"setIsSticked",
"(",
"false",
")",
";",
"$",
"this",
"->",
"om",
"->",
"persist",
"... | Unstick a subject from the top of the subject list.
@param \Claroline\ForumBundle\Entity\Subject $subject | [
"Unstick",
"a",
"subject",
"from",
"the",
"top",
"of",
"the",
"subject",
"list",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L387-L394 |
claroline/ForumBundle | Manager/Manager.php | Manager.closeSubject | public function closeSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsClosed(true);
$this->om->persist($subject);
$this->dispatch(new CloseSubjectEvent($subject));
$this->om->endFlushSuite();
} | php | public function closeSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsClosed(true);
$this->om->persist($subject);
$this->dispatch(new CloseSubjectEvent($subject));
$this->om->endFlushSuite();
} | [
"public",
"function",
"closeSubject",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"subject",
"->",
"setIsClosed",
"(",
"true",
")",
";",
"$",
"this",
"->",
"om",
"->",
"persist",
"(",
... | Close a subject and no one can write in it.
@param \Claroline\ForumBundle\Entity\Subject $subject | [
"Close",
"a",
"subject",
"and",
"no",
"one",
"can",
"write",
"in",
"it",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L401-L408 |
claroline/ForumBundle | Manager/Manager.php | Manager.openSubject | public function openSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsClosed(false);
$this->om->persist($subject);
$this->dispatch(new OpenSubjectEvent($subject));
$this->om->endFlushSuite();
} | php | public function openSubject(Subject $subject)
{
$this->om->startFlushSuite();
$subject->setIsClosed(false);
$this->om->persist($subject);
$this->dispatch(new OpenSubjectEvent($subject));
$this->om->endFlushSuite();
} | [
"public",
"function",
"openSubject",
"(",
"Subject",
"$",
"subject",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"subject",
"->",
"setIsClosed",
"(",
"false",
")",
";",
"$",
"this",
"->",
"om",
"->",
"persist",
"(",
... | Open a subject.
@param \Claroline\ForumBundle\Entity\Subject $subject | [
"Open",
"a",
"subject",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L415-L422 |
claroline/ForumBundle | Manager/Manager.php | Manager.getSubjectsPager | public function getSubjectsPager(Category $category, $page = 1, $max = 20)
{
$subjects = $this->forumRepo->findSubjects($category);
return $this->pagerFactory->createPagerFromArray($subjects, $page, $max);
} | php | public function getSubjectsPager(Category $category, $page = 1, $max = 20)
{
$subjects = $this->forumRepo->findSubjects($category);
return $this->pagerFactory->createPagerFromArray($subjects, $page, $max);
} | [
"public",
"function",
"getSubjectsPager",
"(",
"Category",
"$",
"category",
",",
"$",
"page",
"=",
"1",
",",
"$",
"max",
"=",
"20",
")",
"{",
"$",
"subjects",
"=",
"$",
"this",
"->",
"forumRepo",
"->",
"findSubjects",
"(",
"$",
"category",
")",
";",
... | Get the pager for the subject list of a category.
@param \Claroline\ForumBundle\Entity\Category $category
@param integer $page
@param integer $max
@return \Pagerfanta\Pagerfanta | [
"Get",
"the",
"pager",
"for",
"the",
"subject",
"list",
"of",
"a",
"category",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L433-L438 |
claroline/ForumBundle | Manager/Manager.php | Manager.getMessagesPager | public function getMessagesPager(Subject $subject, $page = 1, $max = 20)
{
$messages = $this->messageRepo->findBySubject($subject);
return $this->pagerFactory->createPagerFromArray($messages, $page, $max);
} | php | public function getMessagesPager(Subject $subject, $page = 1, $max = 20)
{
$messages = $this->messageRepo->findBySubject($subject);
return $this->pagerFactory->createPagerFromArray($messages, $page, $max);
} | [
"public",
"function",
"getMessagesPager",
"(",
"Subject",
"$",
"subject",
",",
"$",
"page",
"=",
"1",
",",
"$",
"max",
"=",
"20",
")",
"{",
"$",
"messages",
"=",
"$",
"this",
"->",
"messageRepo",
"->",
"findBySubject",
"(",
"$",
"subject",
")",
";",
... | Get the pager for the message list of a subject.
@param \Claroline\ForumBundle\Entity\Subject $subject
@param integer $page
@param integer $max
@return \Pagerfanta\Pagerfanta | [
"Get",
"the",
"pager",
"for",
"the",
"message",
"list",
"of",
"a",
"subject",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L449-L454 |
claroline/ForumBundle | Manager/Manager.php | Manager.searchPager | public function searchPager(Forum $forum, $search, $page)
{
$query = $this->forumRepo->search($forum, $search);
return $this->pagerFactory->createPager($query, $page);
} | php | public function searchPager(Forum $forum, $search, $page)
{
$query = $this->forumRepo->search($forum, $search);
return $this->pagerFactory->createPager($query, $page);
} | [
"public",
"function",
"searchPager",
"(",
"Forum",
"$",
"forum",
",",
"$",
"search",
",",
"$",
"page",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"forumRepo",
"->",
"search",
"(",
"$",
"forum",
",",
"$",
"search",
")",
";",
"return",
"$",
"thi... | Get the pager for the forum search.
@param \Claroline\ForumBundle\Entity\Forum $forum
@param string $search
@param integer $page
@return \Pagerfanta\Pagerfanta | [
"Get",
"the",
"pager",
"for",
"the",
"forum",
"search",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L465-L470 |
claroline/ForumBundle | Manager/Manager.php | Manager.removeNotification | private function removeNotification(Forum $forum, Notification $notification)
{
$this->om->startFlushSuite();
$this->om->remove($notification);
$this->dispatch(new UnsubscribeForumEvent($forum));
$this->om->endFlushSuite();
} | php | private function removeNotification(Forum $forum, Notification $notification)
{
$this->om->startFlushSuite();
$this->om->remove($notification);
$this->dispatch(new UnsubscribeForumEvent($forum));
$this->om->endFlushSuite();
} | [
"private",
"function",
"removeNotification",
"(",
"Forum",
"$",
"forum",
",",
"Notification",
"$",
"notification",
")",
"{",
"$",
"this",
"->",
"om",
"->",
"startFlushSuite",
"(",
")",
";",
"$",
"this",
"->",
"om",
"->",
"remove",
"(",
"$",
"notification",... | Unsubscribe a user from a forum.
@param \Claroline\ForumBundle\Entity\Forum $forum
@param \Claroline\ForumBundle\Entity\Notification $notification | [
"Unsubscribe",
"a",
"user",
"from",
"a",
"forum",
"."
] | train | https://github.com/claroline/ForumBundle/blob/bd85dfd870cacee541ea94fec8e59744bf90eaf4/Manager/Manager.php#L634-L640 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Client.php | Zend_Http_Client._setParameter | protected function _setParameter($type, $name, $value)
{
$parray = array();
$type = strtolower($type);
switch ($type) {
case 'get':
$parray = &$this->paramsGet;
break;
case 'post':
$parray = &$this->paramsPost;
... | php | protected function _setParameter($type, $name, $value)
{
$parray = array();
$type = strtolower($type);
switch ($type) {
case 'get':
$parray = &$this->paramsGet;
break;
case 'post':
$parray = &$this->paramsPost;
... | [
"protected",
"function",
"_setParameter",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"parray",
"=",
"array",
"(",
")",
";",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"type",
")",
";",
"switch",
"(",
"$",
"type",
")",
"{... | Set a GET or POST parameter - used by SetParameterGet and SetParameterPost
@param string $type GET or POST
@param string $name
@param string $value
@return null | [
"Set",
"a",
"GET",
"or",
"POST",
"parameter",
"-",
"used",
"by",
"SetParameterGet",
"and",
"SetParameterPost"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Client.php#L476-L494 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Client.php | Zend_Http_Client.setAuth | public function setAuth($user, $password = '', $type = self::AUTH_BASIC)
{
// If we got false or null, disable authentication
if ($user === false || $user === null) {
$this->auth = null;
// Else, set up authentication
} else {
// Check we got a proper authent... | php | public function setAuth($user, $password = '', $type = self::AUTH_BASIC)
{
// If we got false or null, disable authentication
if ($user === false || $user === null) {
$this->auth = null;
// Else, set up authentication
} else {
// Check we got a proper authent... | [
"public",
"function",
"setAuth",
"(",
"$",
"user",
",",
"$",
"password",
"=",
"''",
",",
"$",
"type",
"=",
"self",
"::",
"AUTH_BASIC",
")",
"{",
"// If we got false or null, disable authentication",
"if",
"(",
"$",
"user",
"===",
"false",
"||",
"$",
"user",
... | Set HTTP authentication parameters
$type should be one of the supported types - see the self::AUTH_*
constants.
To enable authentication:
<code>
$this->setAuth('shahar', 'secret', Zend_Http_Client::AUTH_BASIC);
</code>
To disable authentication:
<code>
$this->setAuth(false);
</code>
@see http://www.faqs.org/rfcs/rf... | [
"Set",
"HTTP",
"authentication",
"parameters"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Client.php#L529-L552 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Client.php | Zend_Http_Client.setCookieJar | public function setCookieJar($cookiejar = true)
{
if (! class_exists('Zend_Http_CookieJar')) {
require_once 'Zend/Http/CookieJar.php';
}
if ($cookiejar instanceof Zend_Http_CookieJar) {
$this->cookiejar = $cookiejar;
} elseif ($cookiejar === true) {
... | php | public function setCookieJar($cookiejar = true)
{
if (! class_exists('Zend_Http_CookieJar')) {
require_once 'Zend/Http/CookieJar.php';
}
if ($cookiejar instanceof Zend_Http_CookieJar) {
$this->cookiejar = $cookiejar;
} elseif ($cookiejar === true) {
... | [
"public",
"function",
"setCookieJar",
"(",
"$",
"cookiejar",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'Zend_Http_CookieJar'",
")",
")",
"{",
"require_once",
"'Zend/Http/CookieJar.php'",
";",
"}",
"if",
"(",
"$",
"cookiejar",
"instanceof",
"... | Set the HTTP client's cookie jar.
A cookie jar is an object that holds and maintains cookies across HTTP requests
and responses.
@param Zend_Http_CookieJar|boolean $cookiejar Existing cookiejar object, true to create a new one, false to disable
@return Zend_Http_Client
@throws Zend_Http_Client_Exception | [
"Set",
"the",
"HTTP",
"client",
"s",
"cookie",
"jar",
"."
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Client.php#L564-L583 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Client.php | Zend_Http_Client.resetParameters | public function resetParameters()
{
// Reset parameter data
$this->paramsGet = array();
$this->paramsPost = array();
$this->files = array();
$this->raw_post_data = null;
// Clear outdated headers
if (isset($this->headers[strtolower(self::CONTEN... | php | public function resetParameters()
{
// Reset parameter data
$this->paramsGet = array();
$this->paramsPost = array();
$this->files = array();
$this->raw_post_data = null;
// Clear outdated headers
if (isset($this->headers[strtolower(self::CONTEN... | [
"public",
"function",
"resetParameters",
"(",
")",
"{",
"// Reset parameter data",
"$",
"this",
"->",
"paramsGet",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"paramsPost",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"files",
"=",
"array",
"(",
... | Clear all GET and POST parameters
Should be used to reset the request parameters if the client is
used for several concurrent requests.
@return Zend_Http_Client | [
"Clear",
"all",
"GET",
"and",
"POST",
"parameters"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Client.php#L740-L757 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Client.php | Zend_Http_Client._prepareHeaders | protected function _prepareHeaders()
{
$headers = array();
// Set the host header
if (! isset($this->headers['host'])) {
$host = $this->uri->getHost();
// If the port is not default, add it
if (! (($this->uri->getScheme() == 'http' && $this->uri->getPort... | php | protected function _prepareHeaders()
{
$headers = array();
// Set the host header
if (! isset($this->headers['host'])) {
$host = $this->uri->getHost();
// If the port is not default, add it
if (! (($this->uri->getScheme() == 'http' && $this->uri->getPort... | [
"protected",
"function",
"_prepareHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"// Set the host header",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"'host'",
"]",
")",
")",
"{",
"$",
"host",
"=",
"$",
"t... | Prepare the request headers
@return array | [
"Prepare",
"the",
"request",
"headers"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Client.php#L942-L1015 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Http/Client.php | Zend_Http_Client._prepareBody | protected function _prepareBody()
{
// According to RFC2616, a TRACE request should not have a body.
if ($this->method == self::TRACE) {
return '';
}
// If we have raw_post_data set, just use it as the body.
if (isset($this->raw_post_data)) {
$this->s... | php | protected function _prepareBody()
{
// According to RFC2616, a TRACE request should not have a body.
if ($this->method == self::TRACE) {
return '';
}
// If we have raw_post_data set, just use it as the body.
if (isset($this->raw_post_data)) {
$this->s... | [
"protected",
"function",
"_prepareBody",
"(",
")",
"{",
"// According to RFC2616, a TRACE request should not have a body.",
"if",
"(",
"$",
"this",
"->",
"method",
"==",
"self",
"::",
"TRACE",
")",
"{",
"return",
"''",
";",
"}",
"// If we have raw_post_data set, just us... | Prepare the request body (for POST and PUT requests)
@return string
@throws Zend_Http_Client_Exception | [
"Prepare",
"the",
"request",
"body",
"(",
"for",
"POST",
"and",
"PUT",
"requests",
")"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Http/Client.php#L1023-L1087 |
PeekAndPoke/psi | src/Operation/FullSet/ReverseOperation.php | ReverseOperation.apply | public function apply(\Iterator $set)
{
$data = iterator_to_array($set);
$reversed = array_reverse($data);
return new \ArrayIterator($reversed);
} | php | public function apply(\Iterator $set)
{
$data = iterator_to_array($set);
$reversed = array_reverse($data);
return new \ArrayIterator($reversed);
} | [
"public",
"function",
"apply",
"(",
"\\",
"Iterator",
"$",
"set",
")",
"{",
"$",
"data",
"=",
"iterator_to_array",
"(",
"$",
"set",
")",
";",
"$",
"reversed",
"=",
"array_reverse",
"(",
"$",
"data",
")",
";",
"return",
"new",
"\\",
"ArrayIterator",
"("... | {@inheritdoc} | [
"{"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/FullSet/ReverseOperation.php#L22-L29 |
fyuze/framework | src/Fyuze/Http/Kernel.php | Kernel.resolve | protected function resolve($action, $params)
{
if ($action instanceof Closure) {
return $action($params);
}
list($controller, $method) = $action;
$reflect = new ReflectionClass($controller);
foreach (array_filter($reflect->getMethod($method)->getParameters(), ... | php | protected function resolve($action, $params)
{
if ($action instanceof Closure) {
return $action($params);
}
list($controller, $method) = $action;
$reflect = new ReflectionClass($controller);
foreach (array_filter($reflect->getMethod($method)->getParameters(), ... | [
"protected",
"function",
"resolve",
"(",
"$",
"action",
",",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"action",
"instanceof",
"Closure",
")",
"{",
"return",
"$",
"action",
"(",
"$",
"params",
")",
";",
"}",
"list",
"(",
"$",
"controller",
",",
"$",
... | Method injection resolver
@param $action
@param $params
@return mixed | [
"Method",
"injection",
"resolver"
] | train | https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Http/Kernel.php#L76-L97 |
ufocoder/yii2-SyncSocial | src/components/services/Twitter.php | Twitter.publishPost | public function publishPost( $message, $url = null ) {
return $this->parsePublishPost(
$this->service->api( 'statuses/update.json', 'POST', [
'status' => $message
] ),
'id',
[
'service_id_author' => 'user.id',
'serv... | php | public function publishPost( $message, $url = null ) {
return $this->parsePublishPost(
$this->service->api( 'statuses/update.json', 'POST', [
'status' => $message
] ),
'id',
[
'service_id_author' => 'user.id',
'serv... | [
"public",
"function",
"publishPost",
"(",
"$",
"message",
",",
"$",
"url",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"parsePublishPost",
"(",
"$",
"this",
"->",
"service",
"->",
"api",
"(",
"'statuses/update.json'",
",",
"'POST'",
",",
"[",
"'s... | @param $message
@param null $url
@return array
@throws \yii\base\Exception | [
"@param",
"$message",
"@param",
"null",
"$url"
] | train | https://github.com/ufocoder/yii2-SyncSocial/blob/2dbaaec2dad782c52fdd5b648a31ba7fe2a75e1b/src/components/services/Twitter.php#L37-L49 |
ufocoder/yii2-SyncSocial | src/components/services/Twitter.php | Twitter.deletePost | public function deletePost( $id ) {
$response = $this->service->api( 'statuses/destroy/' . $id . '.json', 'POST' );
return isset( $response['id'] ) && $response['id'] == $id;
} | php | public function deletePost( $id ) {
$response = $this->service->api( 'statuses/destroy/' . $id . '.json', 'POST' );
return isset( $response['id'] ) && $response['id'] == $id;
} | [
"public",
"function",
"deletePost",
"(",
"$",
"id",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"service",
"->",
"api",
"(",
"'statuses/destroy/'",
".",
"$",
"id",
".",
"'.json'",
",",
"'POST'",
")",
";",
"return",
"isset",
"(",
"$",
"response",... | @param $id
@return bool | [
"@param",
"$id"
] | train | https://github.com/ufocoder/yii2-SyncSocial/blob/2dbaaec2dad782c52fdd5b648a31ba7fe2a75e1b/src/components/services/Twitter.php#L56-L60 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Validate/Sitemap/Lastmod.php | Zend_Validate_Sitemap_Lastmod.isValid | public function isValid($value)
{
$this->_setValue($value);
if (!is_string($value)) {
return false;
}
return @preg_match(self::LASTMOD_REGEX, $value) == 1;
} | php | public function isValid($value)
{
$this->_setValue($value);
if (!is_string($value)) {
return false;
}
return @preg_match(self::LASTMOD_REGEX, $value) == 1;
} | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_setValue",
"(",
"$",
"value",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"@",
"preg_match",
"(",... | Validates if a string is valid as a sitemap lastmod
@link http://www.sitemaps.org/protocol.php#lastmoddef <lastmod>
@param string $value value to validate
@return boolean | [
"Validates",
"if",
"a",
"string",
"is",
"valid",
"as",
"a",
"sitemap",
"lastmod"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Validate/Sitemap/Lastmod.php#L69-L78 |
yuncms/framework | src/sphinx/ActiveRecord.php | ActiveRecord.create | public static function create(array $attributes, $runValidation = true)
{
$model = new static();
$model->load($attributes, '');
if ($model->save($runValidation)) {
return $model;
}
return null;
} | php | public static function create(array $attributes, $runValidation = true)
{
$model = new static();
$model->load($attributes, '');
if ($model->save($runValidation)) {
return $model;
}
return null;
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"attributes",
",",
"$",
"runValidation",
"=",
"true",
")",
"{",
"$",
"model",
"=",
"new",
"static",
"(",
")",
";",
"$",
"model",
"->",
"load",
"(",
"$",
"attributes",
",",
"''",
")",
";",
... | 快速创建实例
@param array $attributes
@param boolean $runValidation
@return null|ActiveRecord | [
"快速创建实例"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/sphinx/ActiveRecord.php#L95-L103 |
simplisti/jasper-starter | src/Starter.php | Starter.compile | public function compile (Report $report, bool $skipExec = false)
{
$sourceFullPath = $report->getSourceFile(); // $this->sourcePath . DIRECTORY_SEPARATOR . $report->getSourceFile();
$compiledPath = $this->compiledPath;
$this->shellCommand = $this->executablePath . " cp -o $compiledP... | php | public function compile (Report $report, bool $skipExec = false)
{
$sourceFullPath = $report->getSourceFile(); // $this->sourcePath . DIRECTORY_SEPARATOR . $report->getSourceFile();
$compiledPath = $this->compiledPath;
$this->shellCommand = $this->executablePath . " cp -o $compiledP... | [
"public",
"function",
"compile",
"(",
"Report",
"$",
"report",
",",
"bool",
"$",
"skipExec",
"=",
"false",
")",
"{",
"$",
"sourceFullPath",
"=",
"$",
"report",
"->",
"getSourceFile",
"(",
")",
";",
"// $this->sourcePath . DIRECTORY_SEPARATOR . $report->getSourceFile... | Compile JRXML files into JASPER for processing.
@return self | [
"Compile",
"JRXML",
"files",
"into",
"JASPER",
"for",
"processing",
"."
] | train | https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/Starter.php#L75-L95 |
simplisti/jasper-starter | src/Starter.php | Starter.process | public function process (Report $report, bool $skipExec = false)
{
$compiledFullPath = $this->compiledPath . DIRECTORY_SEPARATOR . pathinfo($report->getSourceFile(), PATHINFO_FILENAME) . '.jasper';
$processedFullPath = $this->processedPath . DIRECTORY_SEPARATOR . uniqid('ASB');
$format... | php | public function process (Report $report, bool $skipExec = false)
{
$compiledFullPath = $this->compiledPath . DIRECTORY_SEPARATOR . pathinfo($report->getSourceFile(), PATHINFO_FILENAME) . '.jasper';
$processedFullPath = $this->processedPath . DIRECTORY_SEPARATOR . uniqid('ASB');
$format... | [
"public",
"function",
"process",
"(",
"Report",
"$",
"report",
",",
"bool",
"$",
"skipExec",
"=",
"false",
")",
"{",
"$",
"compiledFullPath",
"=",
"$",
"this",
"->",
"compiledPath",
".",
"DIRECTORY_SEPARATOR",
".",
"pathinfo",
"(",
"$",
"report",
"->",
"ge... | Process JASPER file into PDF or similar output format.
@return $this | [
"Process",
"JASPER",
"file",
"into",
"PDF",
"or",
"similar",
"output",
"format",
"."
] | train | https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/Starter.php#L102-L134 |
simplisti/jasper-starter | src/Starter.php | Starter.processCsvFileOptions | protected function processCsvFileOptions (Report $report)
{
$value = $report->getFile('file');
$csvSwitch = "--data-file $value ";
// NOTE: If column headers array is empty than we assume CSV first row
$value = $report->getCsvfile('columnHeaderNames');
if (empty($valu... | php | protected function processCsvFileOptions (Report $report)
{
$value = $report->getFile('file');
$csvSwitch = "--data-file $value ";
// NOTE: If column headers array is empty than we assume CSV first row
$value = $report->getCsvfile('columnHeaderNames');
if (empty($valu... | [
"protected",
"function",
"processCsvFileOptions",
"(",
"Report",
"$",
"report",
")",
"{",
"$",
"value",
"=",
"$",
"report",
"->",
"getFile",
"(",
"'file'",
")",
";",
"$",
"csvSwitch",
"=",
"\"--data-file $value \"",
";",
"// NOTE: If column headers array is empty th... | Process CSV file details
@return $this | [
"Process",
"CSV",
"file",
"details"
] | train | https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/Starter.php#L141-L165 |
simplisti/jasper-starter | src/Starter.php | Starter.processDatabaseOptions | protected function processDatabaseOptions (Report $report)
{
// NOTE: Check whether database connection details have been set
if (false === $this->getDatabase('name') && false === $report->getDatabase('name')) {
return '';
}
// NOTE: Initialize $value for each com... | php | protected function processDatabaseOptions (Report $report)
{
// NOTE: Check whether database connection details have been set
if (false === $this->getDatabase('name') && false === $report->getDatabase('name')) {
return '';
}
// NOTE: Initialize $value for each com... | [
"protected",
"function",
"processDatabaseOptions",
"(",
"Report",
"$",
"report",
")",
"{",
"// NOTE: Check whether database connection details have been set\r",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"getDatabase",
"(",
"'name'",
")",
"&&",
"false",
"===",
"$",... | Process RDBMS file details (ie: mysql, etc)
@return $this | [
"Process",
"RDBMS",
"file",
"details",
"(",
"ie",
":",
"mysql",
"etc",
")"
] | train | https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/Starter.php#L172-L213 |
simplisti/jasper-starter | src/Starter.php | Starter.processReportParameters | protected function processReportParameters (Report $report)
{
// NOTE: Remove parameters which have NULL values, etc
$globalParameters = $this->resetEmptyParameters();
$reportParameters = $report->resetEmptyParameters();
// NOTE: Report parameters will over-write the global St... | php | protected function processReportParameters (Report $report)
{
// NOTE: Remove parameters which have NULL values, etc
$globalParameters = $this->resetEmptyParameters();
$reportParameters = $report->resetEmptyParameters();
// NOTE: Report parameters will over-write the global St... | [
"protected",
"function",
"processReportParameters",
"(",
"Report",
"$",
"report",
")",
"{",
"// NOTE: Remove parameters which have NULL values, etc\r",
"$",
"globalParameters",
"=",
"$",
"this",
"->",
"resetEmptyParameters",
"(",
")",
";",
"$",
"reportParameters",
"=",
... | Process parameters
@return $this | [
"Process",
"parameters"
] | train | https://github.com/simplisti/jasper-starter/blob/e03e24663e983710fb4f1afad6c85bde8553de65/src/Starter.php#L220-L239 |
crypto-markets/common | src/Common/Client.php | Client.createRequest | public function createRequest($method, $uri, array $headers = [], $body = null, $protocol = '1.1')
{
if (is_array($body)) {
$body = http_build_query($body, '', '&');
}
if ($method == 'GET') {
$uri .= ((strpos('?', $uri) === false) ? '?' : '&').$body;
$bod... | php | public function createRequest($method, $uri, array $headers = [], $body = null, $protocol = '1.1')
{
if (is_array($body)) {
$body = http_build_query($body, '', '&');
}
if ($method == 'GET') {
$uri .= ((strpos('?', $uri) === false) ? '?' : '&').$body;
$bod... | [
"public",
"function",
"createRequest",
"(",
"$",
"method",
",",
"$",
"uri",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"body",
"=",
"null",
",",
"$",
"protocol",
"=",
"'1.1'",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"body",
")",
")... | Creates a new PSR-7 request.
@param string $method
@param mixed $uri
@param array $headers
@param mixed $body
@param string $protocol
@return \Psr\Http\Message\RequestInterface | [
"Creates",
"a",
"new",
"PSR",
"-",
"7",
"request",
"."
] | train | https://github.com/crypto-markets/common/blob/206b1d9b88502d3fb73cef1323cd086156d3e633/src/Common/Client.php#L47-L59 |
webforge-labs/psc-cms | lib/Psc/PSC.php | PSC.getRoot | public static function getRoot() {
if (!isset(self::$root)) {
try {
$root = getenv('PSC_CMS');
if (!empty($root)) {
return self::$root = new Dir($root);
}
} catch (\Webforge\Common\System\Exception $e) {}
throw MissingEnvironmentVariableException::factory('P... | php | public static function getRoot() {
if (!isset(self::$root)) {
try {
$root = getenv('PSC_CMS');
if (!empty($root)) {
return self::$root = new Dir($root);
}
} catch (\Webforge\Common\System\Exception $e) {}
throw MissingEnvironmentVariableException::factory('P... | [
"public",
"static",
"function",
"getRoot",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"root",
")",
")",
"{",
"try",
"{",
"$",
"root",
"=",
"getenv",
"(",
"'PSC_CMS'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"root",
")"... | Returns the root directory of the host where the host-config lives
@return Psc\System\Directory
@throws Psc\MissingEnvironmentVariableException | [
"Returns",
"the",
"root",
"directory",
"of",
"the",
"host",
"where",
"the",
"host",
"-",
"config",
"lives"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PSC.php#L90-L106 |
webforge-labs/psc-cms | lib/Psc/PSC.php | PSC.getFullClassName | public static function getFullClassName(File $classFile, Dir $classPath = NULL) {
$classPath = $classPath ?: self::getProject()->getClassPath()->up();
try {
$parts = $classFile->getDirectory()->makeRelativeTo($classPath)->getPathArray();
} catch (\Webforge\Common\System\Exception $e) {
throw ... | php | public static function getFullClassName(File $classFile, Dir $classPath = NULL) {
$classPath = $classPath ?: self::getProject()->getClassPath()->up();
try {
$parts = $classFile->getDirectory()->makeRelativeTo($classPath)->getPathArray();
} catch (\Webforge\Common\System\Exception $e) {
throw ... | [
"public",
"static",
"function",
"getFullClassName",
"(",
"File",
"$",
"classFile",
",",
"Dir",
"$",
"classPath",
"=",
"NULL",
")",
"{",
"$",
"classPath",
"=",
"$",
"classPath",
"?",
":",
"self",
"::",
"getProject",
"(",
")",
"->",
"getClassPath",
"(",
")... | Gibt den vollen Namen der Klasse aus der Datei zurück
dies parsed nicht den Code der Datei, sondern geht von der Klassen-Struktur wie in Konventionen beschrieben aus
@return string | [
"Gibt",
"den",
"vollen",
"Namen",
"der",
"Klasse",
"aus",
"der",
"Datei",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PSC.php#L224-L237 |
geekwright/Po | src/PoFile.php | PoFile.createKey | public static function createKey(?string $msgid, ?string $msgctxt = null, ?string $msgid_plural = null): string
{
$key = '';
if (!empty($msgctxt)) {
$key .= $msgctxt . '|';
}
$key .= (string) $msgid;
if (!empty($msgid_plural)) {
$key .= '|' . $msgid_pl... | php | public static function createKey(?string $msgid, ?string $msgctxt = null, ?string $msgid_plural = null): string
{
$key = '';
if (!empty($msgctxt)) {
$key .= $msgctxt . '|';
}
$key .= (string) $msgid;
if (!empty($msgid_plural)) {
$key .= '|' . $msgid_pl... | [
"public",
"static",
"function",
"createKey",
"(",
"?",
"string",
"$",
"msgid",
",",
"?",
"string",
"$",
"msgctxt",
"=",
"null",
",",
"?",
"string",
"$",
"msgid_plural",
"=",
"null",
")",
":",
"string",
"{",
"$",
"key",
"=",
"''",
";",
"if",
"(",
"!... | Build the internal entries array key from id, context and plural id
@param string|null $msgid the untranslated message of the entry
@param string|null $msgctxt the context of the entry, if any
@param string|null $msgid_plural the untranslated plural message of the entry, if any
@return string | [
"Build",
"the",
"internal",
"entries",
"array",
"key",
"from",
"id",
"context",
"and",
"plural",
"id"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L72-L83 |
geekwright/Po | src/PoFile.php | PoFile.createKeyFromEntry | public function createKeyFromEntry(PoEntry $entry): string
{
return $this->createKey(
$entry->getAsString(PoTokens::MESSAGE),
$entry->getAsString(PoTokens::CONTEXT),
$entry->getAsString(PoTokens::PLURAL)
);
} | php | public function createKeyFromEntry(PoEntry $entry): string
{
return $this->createKey(
$entry->getAsString(PoTokens::MESSAGE),
$entry->getAsString(PoTokens::CONTEXT),
$entry->getAsString(PoTokens::PLURAL)
);
} | [
"public",
"function",
"createKeyFromEntry",
"(",
"PoEntry",
"$",
"entry",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"createKey",
"(",
"$",
"entry",
"->",
"getAsString",
"(",
"PoTokens",
"::",
"MESSAGE",
")",
",",
"$",
"entry",
"->",
"getAsStrin... | Build an internal entries array key from a PoEntry
@param PoEntry $entry the PoEntry to build key from
@return string | [
"Build",
"an",
"internal",
"entries",
"array",
"key",
"from",
"a",
"PoEntry"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L92-L99 |
geekwright/Po | src/PoFile.php | PoFile.addEntry | public function addEntry(PoEntry $entry, bool $replace = true): bool
{
$key = $this->createKeyFromEntry($entry);
// some entires, such as obsolete entries, have no key
// for some uses, these are dead weight - need better strategy for that case
if (empty($key)) {
$this->... | php | public function addEntry(PoEntry $entry, bool $replace = true): bool
{
$key = $this->createKeyFromEntry($entry);
// some entires, such as obsolete entries, have no key
// for some uses, these are dead weight - need better strategy for that case
if (empty($key)) {
$this->... | [
"public",
"function",
"addEntry",
"(",
"PoEntry",
"$",
"entry",
",",
"bool",
"$",
"replace",
"=",
"true",
")",
":",
"bool",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"createKeyFromEntry",
"(",
"$",
"entry",
")",
";",
"// some entires, such as obsolete entries... | Add an entry to the PoFile using internal key
@param PoEntry $entry the PoEntry to add
@param boolean $replace true to replace any existing entry matching this key,
false to not change the PoFile for a duplicated key
@return boolean true if added, false if not | [
"Add",
"an",
"entry",
"to",
"the",
"PoFile",
"using",
"internal",
"key"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L164-L181 |
geekwright/Po | src/PoFile.php | PoFile.mergeEntry | public function mergeEntry(PoEntry $newEntry): bool
{
$key = $this->createKeyFromEntry($newEntry);
// keyed entries only
if (empty($key)) {
return false;
}
if (isset($this->entries[$key])) {
$existingEntry = $this->entries[$key];
$mergeTo... | php | public function mergeEntry(PoEntry $newEntry): bool
{
$key = $this->createKeyFromEntry($newEntry);
// keyed entries only
if (empty($key)) {
return false;
}
if (isset($this->entries[$key])) {
$existingEntry = $this->entries[$key];
$mergeTo... | [
"public",
"function",
"mergeEntry",
"(",
"PoEntry",
"$",
"newEntry",
")",
":",
"bool",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"createKeyFromEntry",
"(",
"$",
"newEntry",
")",
";",
"// keyed entries only",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
")",
... | Merge an entry with any existing entry with the same key. If the key does
not exist, add the entry, otherwise merge comments, references, and flags.
This is intended for use in building a POT, where the handling of translated
strings is not a factor.
@param PoEntry $newEntry the PoEntry to merge
@return boolean true... | [
"Merge",
"an",
"entry",
"with",
"any",
"existing",
"entry",
"with",
"the",
"same",
"key",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"add",
"the",
"entry",
"otherwise",
"merge",
"comments",
"references",
"and",
"flags",
"."
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L194-L219 |
geekwright/Po | src/PoFile.php | PoFile.findEntry | public function findEntry(string $msgid, ?string $msgctxt = null, ?string $msgid_plural = null): ?PoEntry
{
$key = $this->createKey($msgid, $msgctxt, $msgid_plural);
$entry = null;
if (!empty($key) && isset($this->entries[$key])) {
$entry = $this->entries[$key];
}
... | php | public function findEntry(string $msgid, ?string $msgctxt = null, ?string $msgid_plural = null): ?PoEntry
{
$key = $this->createKey($msgid, $msgctxt, $msgid_plural);
$entry = null;
if (!empty($key) && isset($this->entries[$key])) {
$entry = $this->entries[$key];
}
... | [
"public",
"function",
"findEntry",
"(",
"string",
"$",
"msgid",
",",
"?",
"string",
"$",
"msgctxt",
"=",
"null",
",",
"?",
"string",
"$",
"msgid_plural",
"=",
"null",
")",
":",
"?",
"PoEntry",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"createKey",
"("... | Get an entry based on key values - msgid, msgctxt and msgid_plural
@param string $msgid the untranslated message of the entry
@param string|null $msgctxt the context of the entry, if any
@param string|null $msgid_plural the untranslated plural message of the entry, if any
@return PoEntry|null matchin... | [
"Get",
"an",
"entry",
"based",
"on",
"key",
"values",
"-",
"msgid",
"msgctxt",
"and",
"msgid_plural"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L230-L240 |
geekwright/Po | src/PoFile.php | PoFile.removeEntry | public function removeEntry(PoEntry $entry): bool
{
$key = $this->createKeyFromEntry($entry);
// try by the key first.
if (!empty($key) && isset($this->entries[$key])) {
if ($entry === $this->entries[$key]) {
unset($this->entries[$key]);
return tr... | php | public function removeEntry(PoEntry $entry): bool
{
$key = $this->createKeyFromEntry($entry);
// try by the key first.
if (!empty($key) && isset($this->entries[$key])) {
if ($entry === $this->entries[$key]) {
unset($this->entries[$key]);
return tr... | [
"public",
"function",
"removeEntry",
"(",
"PoEntry",
"$",
"entry",
")",
":",
"bool",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"createKeyFromEntry",
"(",
"$",
"entry",
")",
";",
"// try by the key first.",
"if",
"(",
"!",
"empty",
"(",
"$",
"key",
")",
... | Remove an entry from the PoFile
In simple cases, the entry can be found by key. There are several cases
where it is not that easy to locate the PoEntry to be removed:
- the PoEntry was altered, making the generated and stored key different
- the entry is not keyed and is in unkeyedEntries
In any of these cases, we mu... | [
"Remove",
"an",
"entry",
"from",
"the",
"PoFile"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L257-L286 |
geekwright/Po | src/PoFile.php | PoFile.writePoFile | public function writePoFile(string $file): void
{
$source = $this->dumpString();
$testName = file_exists($file) ? $file : dirname($file);
$status = is_writable($testName);
if ($status === true) {
$status = file_put_contents($file, $source);
}
if (false ===... | php | public function writePoFile(string $file): void
{
$source = $this->dumpString();
$testName = file_exists($file) ? $file : dirname($file);
$status = is_writable($testName);
if ($status === true) {
$status = file_put_contents($file, $source);
}
if (false ===... | [
"public",
"function",
"writePoFile",
"(",
"string",
"$",
"file",
")",
":",
"void",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"dumpString",
"(",
")",
";",
"$",
"testName",
"=",
"file_exists",
"(",
"$",
"file",
")",
"?",
"$",
"file",
":",
"dirname",
... | Write any current contents to a po file
@param string $file po file to write
@return void
@throws FileNotWritableException | [
"Write",
"any",
"current",
"contents",
"to",
"a",
"po",
"file"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L297-L308 |
geekwright/Po | src/PoFile.php | PoFile.dumpString | public function dumpString(): string
{
if ($this->header === null) {
$this->header = new PoHeader;
$this->header->buildDefaultHeader();
}
$output = '';
$output .= $this->header->dumpEntry();
foreach ($this->entries as $entry) {
$output .= ... | php | public function dumpString(): string
{
if ($this->header === null) {
$this->header = new PoHeader;
$this->header->buildDefaultHeader();
}
$output = '';
$output .= $this->header->dumpEntry();
foreach ($this->entries as $entry) {
$output .= ... | [
"public",
"function",
"dumpString",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"header",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"header",
"=",
"new",
"PoHeader",
";",
"$",
"this",
"->",
"header",
"->",
"buildDefaultHeader",
"(",
... | Dump the current contents in PO format to a string
@return string | [
"Dump",
"the",
"current",
"contents",
"in",
"PO",
"format",
"to",
"a",
"string"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L315-L333 |
geekwright/Po | src/PoFile.php | PoFile.readPoFile | public function readPoFile(string $file, ?resource $context = null): void
{
$oldEr = error_reporting(E_ALL ^ E_WARNING);
$source = file_get_contents($file, false, $context);
error_reporting($oldEr);
if (false===$source) {
throw new FileNotReadableException($file);
... | php | public function readPoFile(string $file, ?resource $context = null): void
{
$oldEr = error_reporting(E_ALL ^ E_WARNING);
$source = file_get_contents($file, false, $context);
error_reporting($oldEr);
if (false===$source) {
throw new FileNotReadableException($file);
... | [
"public",
"function",
"readPoFile",
"(",
"string",
"$",
"file",
",",
"?",
"resource",
"$",
"context",
"=",
"null",
")",
":",
"void",
"{",
"$",
"oldEr",
"=",
"error_reporting",
"(",
"E_ALL",
"^",
"E_WARNING",
")",
";",
"$",
"source",
"=",
"file_get_conten... | Replace any current contents with entries from a file
@param string $file po file/stream to read
@param resource|null $context context for stream if required
@return void
@throws FileNotReadableException | [
"Replace",
"any",
"current",
"contents",
"with",
"entries",
"from",
"a",
"file"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L346-L355 |
geekwright/Po | src/PoFile.php | PoFile.parsePoSource | public function parsePoSource(string $source): void
{
/**
* This is an incredibly ugly regex pattern that breaks a line of a po file into
* pieces that can be analyzed and acted upon.
*
* The matches array in preg_match will break out like this:
* [0] full strin... | php | public function parsePoSource(string $source): void
{
/**
* This is an incredibly ugly regex pattern that breaks a line of a po file into
* pieces that can be analyzed and acted upon.
*
* The matches array in preg_match will break out like this:
* [0] full strin... | [
"public",
"function",
"parsePoSource",
"(",
"string",
"$",
"source",
")",
":",
"void",
"{",
"/**\n * This is an incredibly ugly regex pattern that breaks a line of a po file into\n * pieces that can be analyzed and acted upon.\n *\n * The matches array in preg_m... | Replace any current contents with header and entries from PO souce string
@param string $source po formatted string to parse
@return void
@throws UnrecognizedInputException | [
"Replace",
"any",
"current",
"contents",
"with",
"header",
"and",
"entries",
"from",
"PO",
"souce",
"string"
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoFile.php#L366-L476 |
simple-php-mvc/simple-php-mvc | src/MVC/View.php | View.addTemplatePath | public function addTemplatePath($path)
{
if (is_array($this->templatesPath)) {
if (array_search($path, $this->templatesPath)) {
throw new \LogicException(sprintf('Templates path "%s" exists.', $path));
} else {
$this->templatesPath[] = $path;
... | php | public function addTemplatePath($path)
{
if (is_array($this->templatesPath)) {
if (array_search($path, $this->templatesPath)) {
throw new \LogicException(sprintf('Templates path "%s" exists.', $path));
} else {
$this->templatesPath[] = $path;
... | [
"public",
"function",
"addTemplatePath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"templatesPath",
")",
")",
"{",
"if",
"(",
"array_search",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"templatesPath",
")",
")",
"{",
"... | Add Template Path
@param string $path Templates path | [
"Add",
"Template",
"Path"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/View.php#L26-L40 |
simple-php-mvc/simple-php-mvc | src/MVC/View.php | View.render | public function render($file, $vars = null)
{
$template = '';
if (is_null($this->templatesPath)) {
throw new \LogicException('Variable "templatesPath" can\'t be NULL.');
} else if (is_string($this->templatesPath) && !file_exists($this->templatesPath)) {
throw new \L... | php | public function render($file, $vars = null)
{
$template = '';
if (is_null($this->templatesPath)) {
throw new \LogicException('Variable "templatesPath" can\'t be NULL.');
} else if (is_string($this->templatesPath) && !file_exists($this->templatesPath)) {
throw new \L... | [
"public",
"function",
"render",
"(",
"$",
"file",
",",
"$",
"vars",
"=",
"null",
")",
"{",
"$",
"template",
"=",
"''",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"templatesPath",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"... | Renders a given file with the supplied variables.
@access public
@param string $file The file to be rendered.
@param mixed $vars The variables to be substituted in the view.
@return string
@throws \LogicException | [
"Renders",
"a",
"given",
"file",
"with",
"the",
"supplied",
"variables",
"."
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/View.php#L76-L110 |
whisller/IrcBotBundle | Connection/Socket.php | Socket.connect | public function connect()
{
$this->socket = stream_socket_client($this->server.':'.$this->port);
if (!$this->isConnected()) {
throw new Exception('Unable to connect to server via fsockopen with server: "'.$this->server.'" and port: "'.$this->port.'".');
}
$this->dispatch... | php | public function connect()
{
$this->socket = stream_socket_client($this->server.':'.$this->port);
if (!$this->isConnected()) {
throw new Exception('Unable to connect to server via fsockopen with server: "'.$this->server.'" and port: "'.$this->port.'".');
}
$this->dispatch... | [
"public",
"function",
"connect",
"(",
")",
"{",
"$",
"this",
"->",
"socket",
"=",
"stream_socket_client",
"(",
"$",
"this",
"->",
"server",
".",
"':'",
".",
"$",
"this",
"->",
"port",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isConnected",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/whisller/IrcBotBundle/blob/d8bcafc1599cbbc7756b0a59f51ee988a2de0f2e/Connection/Socket.php#L85-L93 |
zodream/thirdparty | src/OAuth/PayPal.php | PayPal.setMode | public function setMode($arg) {
$this->mode = strtolower($arg) == self::LIVE ? self::LIVE : self::SANDBOX;
return $this;
} | php | public function setMode($arg) {
$this->mode = strtolower($arg) == self::LIVE ? self::LIVE : self::SANDBOX;
return $this;
} | [
"public",
"function",
"setMode",
"(",
"$",
"arg",
")",
"{",
"$",
"this",
"->",
"mode",
"=",
"strtolower",
"(",
"$",
"arg",
")",
"==",
"self",
"::",
"LIVE",
"?",
"self",
"::",
"LIVE",
":",
"self",
"::",
"SANDBOX",
";",
"return",
"$",
"this",
";",
... | IS TEST OR LIVE
@param string $arg
@return $this | [
"IS",
"TEST",
"OR",
"LIVE"
] | train | https://github.com/zodream/thirdparty/blob/b9d39087913850f1c5c7c9165105fec22a128f8f/src/OAuth/PayPal.php#L95-L98 |
anime-db/app-bundle | src/Service/WidgetsContainer.php | WidgetsContainer.getWidgetsForPlace | public function getWidgetsForPlace($place)
{
// send the event to those who did not add widgets could do it
$this->dispatcher->dispatch(StoreEvents::GET, new Get($this, $place));
return isset($this->widgets[$place]) ? $this->widgets[$place] : [];
} | php | public function getWidgetsForPlace($place)
{
// send the event to those who did not add widgets could do it
$this->dispatcher->dispatch(StoreEvents::GET, new Get($this, $place));
return isset($this->widgets[$place]) ? $this->widgets[$place] : [];
} | [
"public",
"function",
"getWidgetsForPlace",
"(",
"$",
"place",
")",
"{",
"// send the event to those who did not add widgets could do it",
"$",
"this",
"->",
"dispatcher",
"->",
"dispatch",
"(",
"StoreEvents",
"::",
"GET",
",",
"new",
"Get",
"(",
"$",
"this",
",",
... | @param string $place
@return array | [
"@param",
"string",
"$place"
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Service/WidgetsContainer.php#L40-L46 |
anime-db/app-bundle | src/Service/WidgetsContainer.php | WidgetsContainer.registr | public function registr($place, $controller)
{
if (preg_match('/^[a-z0-9]+:[a-z0-9]+:[_a-z0-9]+$/i', $controller)) {
if (!isset($this->widgets[$place])) {
$this->widgets[$place][] = $controller;
} elseif (!in_array($controller, $this->widgets[$place])) {
... | php | public function registr($place, $controller)
{
if (preg_match('/^[a-z0-9]+:[a-z0-9]+:[_a-z0-9]+$/i', $controller)) {
if (!isset($this->widgets[$place])) {
$this->widgets[$place][] = $controller;
} elseif (!in_array($controller, $this->widgets[$place])) {
... | [
"public",
"function",
"registr",
"(",
"$",
"place",
",",
"$",
"controller",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^[a-z0-9]+:[a-z0-9]+:[_a-z0-9]+$/i'",
",",
"$",
"controller",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"widgets",
... | Regist widget.
Controller example:
AcmeDemoBundle:Welcome:index
AcmeArticleBundle:Article:show
@param string $place
@param string $controller
@return bool | [
"Regist",
"widget",
"."
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Service/WidgetsContainer.php#L60-L73 |
anime-db/app-bundle | src/Service/WidgetsContainer.php | WidgetsContainer.unregistr | public function unregistr($place, $controller)
{
if (isset($this->widgets[$place]) &&
($key = array_search($controller, $this->widgets[$place])) !== false
) {
unset($this->widgets[$place][$key]);
return true;
}
return false;
} | php | public function unregistr($place, $controller)
{
if (isset($this->widgets[$place]) &&
($key = array_search($controller, $this->widgets[$place])) !== false
) {
unset($this->widgets[$place][$key]);
return true;
}
return false;
} | [
"public",
"function",
"unregistr",
"(",
"$",
"place",
",",
"$",
"controller",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"widgets",
"[",
"$",
"place",
"]",
")",
"&&",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"controller",
",",
"$"... | @param string $place
@param string $controller
@return bool | [
"@param",
"string",
"$place",
"@param",
"string",
"$controller"
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Service/WidgetsContainer.php#L81-L92 |
redaigbaria/oauth2 | src/TokenType/MAC.php | MAC.generateResponse | public function generateResponse()
{
$macKey = SecureKey::generate();
$this->server->getMacStorage()->create($macKey, $this->getParam('access_token'));
$response = [
'access_token' => $this->getParam('access_token'),
'token_type' => 'mac',
'expires_... | php | public function generateResponse()
{
$macKey = SecureKey::generate();
$this->server->getMacStorage()->create($macKey, $this->getParam('access_token'));
$response = [
'access_token' => $this->getParam('access_token'),
'token_type' => 'mac',
'expires_... | [
"public",
"function",
"generateResponse",
"(",
")",
"{",
"$",
"macKey",
"=",
"SecureKey",
"::",
"generate",
"(",
")",
";",
"$",
"this",
"->",
"server",
"->",
"getMacStorage",
"(",
")",
"->",
"create",
"(",
"$",
"macKey",
",",
"$",
"this",
"->",
"getPar... | {@inheritdoc} | [
"{"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/TokenType/MAC.php#L26-L44 |
redaigbaria/oauth2 | src/TokenType/MAC.php | MAC.determineAccessTokenInHeader | public function determineAccessTokenInHeader(Request $request)
{
if ($request->headers->has('Authorization') === false) {
return;
}
$header = $request->headers->get('Authorization');
if (substr($header, 0, 4) !== 'MAC ') {
return;
}
// Find ... | php | public function determineAccessTokenInHeader(Request $request)
{
if ($request->headers->has('Authorization') === false) {
return;
}
$header = $request->headers->get('Authorization');
if (substr($header, 0, 4) !== 'MAC ') {
return;
}
// Find ... | [
"public",
"function",
"determineAccessTokenInHeader",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"headers",
"->",
"has",
"(",
"'Authorization'",
")",
"===",
"false",
")",
"{",
"return",
";",
"}",
"$",
"header",
"=",
"$",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/TokenType/MAC.php#L49-L132 |
redaigbaria/oauth2 | src/TokenType/MAC.php | MAC.hash_equals | private function hash_equals($knownString, $userString)
{
if (function_exists('\hash_equals')) {
return \hash_equals($knownString, $userString);
}
if (strlen($knownString) !== strlen($userString)) {
return false;
}
$len = strlen($knownString);
... | php | private function hash_equals($knownString, $userString)
{
if (function_exists('\hash_equals')) {
return \hash_equals($knownString, $userString);
}
if (strlen($knownString) !== strlen($userString)) {
return false;
}
$len = strlen($knownString);
... | [
"private",
"function",
"hash_equals",
"(",
"$",
"knownString",
",",
"$",
"userString",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'\\hash_equals'",
")",
")",
"{",
"return",
"\\",
"hash_equals",
"(",
"$",
"knownString",
",",
"$",
"userString",
")",
";",
... | Prevent timing attack
@param string $knownString
@param string $userString
@return bool | [
"Prevent",
"timing",
"attack"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/TokenType/MAC.php#L140-L155 |
aedart/config-loader | src/Traits/ParserFactoryTrait.php | ParserFactoryTrait.getParserFactory | public function getParserFactory(): ?ParserFactory
{
if (!$this->hasParserFactory()) {
$this->setParserFactory($this->getDefaultParserFactory());
}
return $this->parserFactory;
} | php | public function getParserFactory(): ?ParserFactory
{
if (!$this->hasParserFactory()) {
$this->setParserFactory($this->getDefaultParserFactory());
}
return $this->parserFactory;
} | [
"public",
"function",
"getParserFactory",
"(",
")",
":",
"?",
"ParserFactory",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasParserFactory",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setParserFactory",
"(",
"$",
"this",
"->",
"getDefaultParserFactory",
"(",
")... | Get parser factory
If no parser factory has been set, this method will
set and return a default parser factory, if any such
value is available
@see getDefaultParserFactory()
@return ParserFactory|null parser factory or null if none parser factory has been set | [
"Get",
"parser",
"factory"
] | train | https://github.com/aedart/config-loader/blob/9e1cf592bee46ba4930bb9c352aaf475d81266ea/src/Traits/ParserFactoryTrait.php#L53-L59 |
CakeCMS/Core | src/View/Helper/FilterHelper.php | FilterHelper.render | public function render($model, array $fields = [], $element = self::DEFAULT_ELEMENT, array $data = [])
{
$data = Hash::merge([
'clearUrl' => [],
'model' => $model,
'formFields' => $fields,
], $data);
return $this->_View->element($element, $data);
... | php | public function render($model, array $fields = [], $element = self::DEFAULT_ELEMENT, array $data = [])
{
$data = Hash::merge([
'clearUrl' => [],
'model' => $model,
'formFields' => $fields,
], $data);
return $this->_View->element($element, $data);
... | [
"public",
"function",
"render",
"(",
"$",
"model",
",",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"$",
"element",
"=",
"self",
"::",
"DEFAULT_ELEMENT",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"Hash",
"::",
"merge",
... | Render filter element.
@param string $model
@param array $fields
@param string $element
@param array $data
@return string | [
"Render",
"filter",
"element",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/FilterHelper.php#L39-L48 |
qcubed/orm | src/Database/Mysqli5/Database.php | Database.executeProcedure | public function executeProcedure($strProcName, $params = null)
{
$strParams = '';
if ($params) {
$a = array_map(function ($val) {
return $this->sqlVariable($val);
}, $params);
$strParams = implode(',', $a);
}
$strSql = "call {$strPr... | php | public function executeProcedure($strProcName, $params = null)
{
$strParams = '';
if ($params) {
$a = array_map(function ($val) {
return $this->sqlVariable($val);
}, $params);
$strParams = implode(',', $a);
}
$strSql = "call {$strPr... | [
"public",
"function",
"executeProcedure",
"(",
"$",
"strProcName",
",",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"strParams",
"=",
"''",
";",
"if",
"(",
"$",
"params",
")",
"{",
"$",
"a",
"=",
"array_map",
"(",
"function",
"(",
"$",
"val",
")",
"... | Generic stored procedure executor. For Mysql 5, you can have your stored procedure return results by
"SELECT"ing the results. The results will be returned as an array.
@param string $strProcName Name of stored procedure
@param array|null $params
@return Result[]
@throws MysqliException | [
"Generic",
"stored",
"procedure",
"executor",
".",
"For",
"Mysql",
"5",
"you",
"can",
"have",
"your",
"stored",
"procedure",
"return",
"results",
"by",
"SELECT",
"ing",
"the",
"results",
".",
"The",
"results",
"will",
"be",
"returned",
"as",
"an",
"array",
... | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/Mysqli5/Database.php#L122-L133 |
phrest/sdk | src/Generator/Helper/ClassGen.php | ClassGen.classGen | public static function classGen(
$name,
$namespace,
$uses = [],
$extends = '',
$implements = []
)
{
$class = new ClassGenerator();
$class
->setName($name)
->setNamespaceName($namespace)
->setExtendedClass($extends)
->setImplementedInterfaces($implements)
->setIndenta... | php | public static function classGen(
$name,
$namespace,
$uses = [],
$extends = '',
$implements = []
)
{
$class = new ClassGenerator();
$class
->setName($name)
->setNamespaceName($namespace)
->setExtendedClass($extends)
->setImplementedInterfaces($implements)
->setIndenta... | [
"public",
"static",
"function",
"classGen",
"(",
"$",
"name",
",",
"$",
"namespace",
",",
"$",
"uses",
"=",
"[",
"]",
",",
"$",
"extends",
"=",
"''",
",",
"$",
"implements",
"=",
"[",
"]",
")",
"{",
"$",
"class",
"=",
"new",
"ClassGenerator",
"(",
... | @param $name
@param $namespace
@param $uses
@param string $extends
@param array $implements
@return ClassGenerator | [
"@param",
"$name",
"@param",
"$namespace",
"@param",
"$uses",
"@param",
"string",
"$extends",
"@param",
"array",
"$implements"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Helper/ClassGen.php#L26-L49 |
phrest/sdk | src/Generator/Helper/ClassGen.php | ClassGen.property | public static function property(
$name,
$visibility = 'public',
$default = null,
$type = 'mixed'
)
{
$property = (new PropertyGenerator($name, $default))
->setVisibility($visibility);
$property->setIndentation(Generator::$indentation);
$docBlock = new DocBlockGenerator();
$docB... | php | public static function property(
$name,
$visibility = 'public',
$default = null,
$type = 'mixed'
)
{
$property = (new PropertyGenerator($name, $default))
->setVisibility($visibility);
$property->setIndentation(Generator::$indentation);
$docBlock = new DocBlockGenerator();
$docB... | [
"public",
"static",
"function",
"property",
"(",
"$",
"name",
",",
"$",
"visibility",
"=",
"'public'",
",",
"$",
"default",
"=",
"null",
",",
"$",
"type",
"=",
"'mixed'",
")",
"{",
"$",
"property",
"=",
"(",
"new",
"PropertyGenerator",
"(",
"$",
"name"... | @param $name
@param $visibility
@param $default
@param $type
@return PropertyGenerator | [
"@param",
"$name",
"@param",
"$visibility",
"@param",
"$default",
"@param",
"$type"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Helper/ClassGen.php#L59-L84 |
phrest/sdk | src/Generator/Helper/ClassGen.php | ClassGen.method | public static function method(
$name,
$params = [],
$visibility = 'public',
$body = '//todo',
$docblock = ''
)
{
if (empty($docblock))
{
if (!empty($params))
{
$docblock = new DocBlockGenerator();
foreach ($params as $param)
{
$tag = new Tag(... | php | public static function method(
$name,
$params = [],
$visibility = 'public',
$body = '//todo',
$docblock = ''
)
{
if (empty($docblock))
{
if (!empty($params))
{
$docblock = new DocBlockGenerator();
foreach ($params as $param)
{
$tag = new Tag(... | [
"public",
"static",
"function",
"method",
"(",
"$",
"name",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"visibility",
"=",
"'public'",
",",
"$",
"body",
"=",
"'//todo'",
",",
"$",
"docblock",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"d... | @param $name
@param ParameterGenerator[] $params
@param string $visibility
@param string $body
@param string|DocBlockGenerator $docblock
@return \Zend\Code\Generator\MethodGenerator | [
"@param",
"$name",
"@param",
"ParameterGenerator",
"[]",
"$params",
"@param",
"string",
"$visibility",
"@param",
"string",
"$body",
"@param",
"string|DocBlockGenerator",
"$docblock"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Helper/ClassGen.php#L95-L121 |
phrest/sdk | src/Generator/Helper/ClassGen.php | ClassGen.constructor | public static function constructor($params)
{
$constructor = self::method('__construct', $params);
$body = '';
foreach ($params as $param)
{
$body .= "\$this->{$param->getName()} = \${$param->getName()};" . PHP_EOL;
}
$constructor->setBody($body);
return $constructor;
} | php | public static function constructor($params)
{
$constructor = self::method('__construct', $params);
$body = '';
foreach ($params as $param)
{
$body .= "\$this->{$param->getName()} = \${$param->getName()};" . PHP_EOL;
}
$constructor->setBody($body);
return $constructor;
} | [
"public",
"static",
"function",
"constructor",
"(",
"$",
"params",
")",
"{",
"$",
"constructor",
"=",
"self",
"::",
"method",
"(",
"'__construct'",
",",
"$",
"params",
")",
";",
"$",
"body",
"=",
"''",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"... | @param ParameterGenerator[] $params
@return MethodGenerator | [
"@param",
"ParameterGenerator",
"[]",
"$params"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Helper/ClassGen.php#L128-L142 |
phrest/sdk | src/Generator/Helper/ClassGen.php | ClassGen.setter | public static function setter($name, $type)
{
$setter = self::method(
'set' . ucfirst($name),
[
new ParameterGenerator($name, $type)
]
);
$setter->getDocBlock()->setTag(new GenericTag('return', 'static'));
$body = "\$this->{$name} = \${$name};" . PHP_EOL
. "return \$thi... | php | public static function setter($name, $type)
{
$setter = self::method(
'set' . ucfirst($name),
[
new ParameterGenerator($name, $type)
]
);
$setter->getDocBlock()->setTag(new GenericTag('return', 'static'));
$body = "\$this->{$name} = \${$name};" . PHP_EOL
. "return \$thi... | [
"public",
"static",
"function",
"setter",
"(",
"$",
"name",
",",
"$",
"type",
")",
"{",
"$",
"setter",
"=",
"self",
"::",
"method",
"(",
"'set'",
".",
"ucfirst",
"(",
"$",
"name",
")",
",",
"[",
"new",
"ParameterGenerator",
"(",
"$",
"name",
",",
"... | @param string $name
@param string $type
@return MethodGenerator | [
"@param",
"string",
"$name",
"@param",
"string",
"$type"
] | train | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator/Helper/ClassGen.php#L150-L167 |
boekkooi/tactician-amqp | src/Middleware/MessageCapturingMiddleware.php | MessageCapturingMiddleware.execute | public function execute($command, callable $next)
{
if (!$command instanceof Message) {
return $next($command);
}
$this->capturer->publish($command);
return null;
} | php | public function execute($command, callable $next)
{
if (!$command instanceof Message) {
return $next($command);
}
$this->capturer->publish($command);
return null;
} | [
"public",
"function",
"execute",
"(",
"$",
"command",
",",
"callable",
"$",
"next",
")",
"{",
"if",
"(",
"!",
"$",
"command",
"instanceof",
"Message",
")",
"{",
"return",
"$",
"next",
"(",
"$",
"command",
")",
";",
"}",
"$",
"this",
"->",
"capturer",... | {@inheritdoc} | [
"{"
] | train | https://github.com/boekkooi/tactician-amqp/blob/55cbb8b9e20aab7891e6a6090b248377c599360e/src/Middleware/MessageCapturingMiddleware.php#L29-L38 |
webforge-labs/psc-cms | lib/Psc/CMS/ContactFormMailer.php | ContactFormMailer.setAutoReply | public function setAutoReply($emailFieldName, $text, $subject = NULL) {
$this->autoReply = (object) array(
'emailField'=>$emailFieldName,
'subject'=>$subject,
'text'=>$text
);
} | php | public function setAutoReply($emailFieldName, $text, $subject = NULL) {
$this->autoReply = (object) array(
'emailField'=>$emailFieldName,
'subject'=>$subject,
'text'=>$text
);
} | [
"public",
"function",
"setAutoReply",
"(",
"$",
"emailFieldName",
",",
"$",
"text",
",",
"$",
"subject",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"autoReply",
"=",
"(",
"object",
")",
"array",
"(",
"'emailField'",
"=>",
"$",
"emailFieldName",
",",
"'sub... | You can use %xx% variables from your fields in $data
for the template text | [
"You",
"can",
"use",
"%xx%",
"variables",
"from",
"your",
"fields",
"in",
"$data",
"for",
"the",
"template",
"text"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/ContactFormMailer.php#L188-L194 |
spiral-modules/scaffolder | source/Scaffolder/Declarations/EntityDeclaration.php | EntityDeclaration.addField | public function addField(string $name, $value)
{
$schema = $this->constant('SCHEMA')->getValue();
$schema[$name] = $value;
$this->constant('SCHEMA')->setValue($schema);
} | php | public function addField(string $name, $value)
{
$schema = $this->constant('SCHEMA')->getValue();
$schema[$name] = $value;
$this->constant('SCHEMA')->setValue($schema);
} | [
"public",
"function",
"addField",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"constant",
"(",
"'SCHEMA'",
")",
"->",
"getValue",
"(",
")",
";",
"$",
"schema",
"[",
"$",
"name",
"]",
"=",
"$",
"... | Add field into schema.
@param string $name
@param mixed $value | [
"Add",
"field",
"into",
"schema",
"."
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Declarations/EntityDeclaration.php#L44-L49 |
echo58/sms | src/AbstractProvider.php | AbstractProvider.assertRequiredOptions | protected function assertRequiredOptions($key, array $options)
{
$missing = array_diff_key(array_flip($this->getRequiredOptions($key)), $options);
if (!empty($missing)) {
throw new \InvalidArgumentException(
'参数不完整,请指定'.$key.'参数: '.implode(', ', array_keys($missing))
... | php | protected function assertRequiredOptions($key, array $options)
{
$missing = array_diff_key(array_flip($this->getRequiredOptions($key)), $options);
if (!empty($missing)) {
throw new \InvalidArgumentException(
'参数不完整,请指定'.$key.'参数: '.implode(', ', array_keys($missing))
... | [
"protected",
"function",
"assertRequiredOptions",
"(",
"$",
"key",
",",
"array",
"$",
"options",
")",
"{",
"$",
"missing",
"=",
"array_diff_key",
"(",
"array_flip",
"(",
"$",
"this",
"->",
"getRequiredOptions",
"(",
"$",
"key",
")",
")",
",",
"$",
"options... | 验证是否必须的参数都存在
@param string $key
@param array $options
@return void
@throws \InvalidArgumentException | [
"验证是否必须的参数都存在"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/AbstractProvider.php#L135-L143 |
echo58/sms | src/AbstractProvider.php | AbstractProvider.createRequest | protected function createRequest($method, $url, $requestHeaders, $requestPayload, $protocolVersion)
{
$request = new Request(
$method,
$url,
$requestHeaders,
$requestPayload,
$protocolVersion
);
return $request;
} | php | protected function createRequest($method, $url, $requestHeaders, $requestPayload, $protocolVersion)
{
$request = new Request(
$method,
$url,
$requestHeaders,
$requestPayload,
$protocolVersion
);
return $request;
} | [
"protected",
"function",
"createRequest",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"requestHeaders",
",",
"$",
"requestPayload",
",",
"$",
"protocolVersion",
")",
"{",
"$",
"request",
"=",
"new",
"Request",
"(",
"$",
"method",
",",
"$",
"url",
",",... | 创建向短信接口的发送请求
@param null|string $method
@param null|string $url
@param array $requestHeaders
@param $requestPayload
@param string $protocolVersion
@return Request
@throws \InvalidArgumentException | [
"创建向短信接口的发送请求"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/AbstractProvider.php#L253-L264 |
echo58/sms | src/AbstractProvider.php | AbstractProvider.parseJson | protected function parseJson($content)
{
$content = json_decode($content, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \UnexpectedValueException(sprintf(
"JSON 解析失败: %s",
json_last_error_msg()
));
}
return $con... | php | protected function parseJson($content)
{
$content = json_decode($content, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \UnexpectedValueException(sprintf(
"JSON 解析失败: %s",
json_last_error_msg()
));
}
return $con... | [
"protected",
"function",
"parseJson",
"(",
"$",
"content",
")",
"{",
"$",
"content",
"=",
"json_decode",
"(",
"$",
"content",
",",
"true",
")",
";",
"if",
"(",
"json_last_error",
"(",
")",
"!==",
"JSON_ERROR_NONE",
")",
"{",
"throw",
"new",
"\\",
"Unexpe... | 解析 JSON 格式的字符串
@param string $content
@return array
@throws \UnexpectedValueException | [
"解析",
"JSON",
"格式的字符串"
] | train | https://github.com/echo58/sms/blob/2921c4137edf8f21b1cee29ff1b48cd1a0810f40/src/AbstractProvider.php#L282-L293 |
tbreuss/pvc | src/View/View.php | View.registerHelper | public function registerHelper(string $name, callable $callback): self
{
$this->helpers->add($name, $callback);
return $this;
} | php | public function registerHelper(string $name, callable $callback): self
{
$this->helpers->add($name, $callback);
return $this;
} | [
"public",
"function",
"registerHelper",
"(",
"string",
"$",
"name",
",",
"callable",
"$",
"callback",
")",
":",
"self",
"{",
"$",
"this",
"->",
"helpers",
"->",
"add",
"(",
"$",
"name",
",",
"$",
"callback",
")",
";",
"return",
"$",
"this",
";",
"}"
... | Register a new template function.
@param string $name;
@param callback $callback;
@return $this | [
"Register",
"a",
"new",
"template",
"function",
"."
] | train | https://github.com/tbreuss/pvc/blob/ae100351010a8c9f645ccb918f70a26e167de7a7/src/View/View.php#L123-L127 |
meccado/acl-admin-control-panel | src/Http/Controllers/Admin/PermissionController.php | PermissionController.store | public function store(Request $request)
{
Permission::create($request->all());
\Session::flash('flash_message', 'Permission added!');
return \Redirect::route('api.v1.permissions.index', [
])->withMessage(trans('acl::permission.permissions-controller-successfully_created'));
} | php | public function store(Request $request)
{
Permission::create($request->all());
\Session::flash('flash_message', 'Permission added!');
return \Redirect::route('api.v1.permissions.index', [
])->withMessage(trans('acl::permission.permissions-controller-successfully_created'));
} | [
"public",
"function",
"store",
"(",
"Request",
"$",
"request",
")",
"{",
"Permission",
"::",
"create",
"(",
"$",
"request",
"->",
"all",
"(",
")",
")",
";",
"\\",
"Session",
"::",
"flash",
"(",
"'flash_message'",
",",
"'Permission added!'",
")",
";",
"re... | Store a newly created resource in storage.
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\RedirectResponse | [
"Store",
"a",
"newly",
"created",
"resource",
"in",
"storage",
"."
] | train | https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/PermissionController.php#L57-L63 |
meccado/acl-admin-control-panel | src/Http/Controllers/Admin/PermissionController.php | PermissionController.update | public function update(Request $request, $id)
{
$permission = Permission::findOrFail($id)->update($request->only('name', 'label'));
\Session::flash('flash_message', 'Permission updated!');
return \Redirect::route('admin.permissions.index', [
])->withMessage(trans('acl::permission.permissio... | php | public function update(Request $request, $id)
{
$permission = Permission::findOrFail($id)->update($request->only('name', 'label'));
\Session::flash('flash_message', 'Permission updated!');
return \Redirect::route('admin.permissions.index', [
])->withMessage(trans('acl::permission.permissio... | [
"public",
"function",
"update",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"permission",
"=",
"Permission",
"::",
"findOrFail",
"(",
"$",
"id",
")",
"->",
"update",
"(",
"$",
"request",
"->",
"only",
"(",
"'name'",
",",
"'label'",
... | Update the specified resource in storage.
@param \Illuminate\Http\Request $request
@param int $id
@return \Illuminate\Http\RedirectResponse | [
"Update",
"the",
"specified",
"resource",
"in",
"storage",
"."
] | train | https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/PermissionController.php#L99-L105 |
meccado/acl-admin-control-panel | src/Http/Controllers/Admin/PermissionController.php | PermissionController.destroy | public function destroy($id)
{
Permission::destroy($id);
\Session::flash('flash_message', 'Permission deleted!');
return \Redirect::route('admin.permissions.index', [
])->withMessage(trans('acl::permission.permissions-controller-successfully_deleted'));
} | php | public function destroy($id)
{
Permission::destroy($id);
\Session::flash('flash_message', 'Permission deleted!');
return \Redirect::route('admin.permissions.index', [
])->withMessage(trans('acl::permission.permissions-controller-successfully_deleted'));
} | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"Permission",
"::",
"destroy",
"(",
"$",
"id",
")",
";",
"\\",
"Session",
"::",
"flash",
"(",
"'flash_message'",
",",
"'Permission deleted!'",
")",
";",
"return",
"\\",
"Redirect",
"::",
"route",
... | Remove the specified resource from storage.
@param int $id
@return \Illuminate\Http\RedirectResponse | [
"Remove",
"the",
"specified",
"resource",
"from",
"storage",
"."
] | train | https://github.com/meccado/acl-admin-control-panel/blob/50ac4c0dbf8bd49944ecad6a70708a70411b7378/src/Http/Controllers/Admin/PermissionController.php#L113-L119 |
jenwachter/html-form | src/Elements/Parents/Textbox.php | Textbox.compile | public function compile($value = "")
{
$html = $this->compiledLabel;
if (!empty($this->help)) {
$html .= "<div class='help'>{$this->help}</div>";
}
$html .= "<input type=\"{$this->type}\" name=\"{$this->name}\" {$this->compiledAttr} value=\"{$value}\" />";
return $html;
} | php | public function compile($value = "")
{
$html = $this->compiledLabel;
if (!empty($this->help)) {
$html .= "<div class='help'>{$this->help}</div>";
}
$html .= "<input type=\"{$this->type}\" name=\"{$this->name}\" {$this->compiledAttr} value=\"{$value}\" />";
return $html;
} | [
"public",
"function",
"compile",
"(",
"$",
"value",
"=",
"\"\"",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"compiledLabel",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"help",
")",
")",
"{",
"$",
"html",
".=",
"\"<div class='help'>{$th... | Builds the HTML of the form field.
@param string $value Value of the form field
@return null | [
"Builds",
"the",
"HTML",
"of",
"the",
"form",
"field",
"."
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Textbox.php#L19-L30 |
spiral-modules/scaffolder | source/ScaffolderModule.php | ScaffolderModule.publish | public function publish(PublisherInterface $publisher, DirectoriesInterface $directories)
{
$publisher->publish(
__DIR__ . '/../resources/config.php',
$directories->directory('config') . ScaffolderConfig::CONFIG . '.php'
);
} | php | public function publish(PublisherInterface $publisher, DirectoriesInterface $directories)
{
$publisher->publish(
__DIR__ . '/../resources/config.php',
$directories->directory('config') . ScaffolderConfig::CONFIG . '.php'
);
} | [
"public",
"function",
"publish",
"(",
"PublisherInterface",
"$",
"publisher",
",",
"DirectoriesInterface",
"$",
"directories",
")",
"{",
"$",
"publisher",
"->",
"publish",
"(",
"__DIR__",
".",
"'/../resources/config.php'",
",",
"$",
"directories",
"->",
"directory",... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/ScaffolderModule.php#L33-L39 |
parsnick/steak | src/Boot/RunBootstrapsFromConfig.php | RunBootstrapsFromConfig.boot | public function boot(Container $app)
{
$toBoot = (array) $app['config']->get('bootstrap', []);
foreach ($toBoot as $bootstrapClass) {
$app->make($bootstrapClass)->boot($app);
}
} | php | public function boot(Container $app)
{
$toBoot = (array) $app['config']->get('bootstrap', []);
foreach ($toBoot as $bootstrapClass) {
$app->make($bootstrapClass)->boot($app);
}
} | [
"public",
"function",
"boot",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"toBoot",
"=",
"(",
"array",
")",
"$",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'bootstrap'",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"toBoot",
"as",
"$",
"bo... | Call any other bootstraps defined by config.
@param Container $app | [
"Call",
"any",
"other",
"bootstraps",
"defined",
"by",
"config",
"."
] | train | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Boot/RunBootstrapsFromConfig.php#L14-L21 |
afrittella/back-project | src/app/Console/Commands/SeedDefaultMenus.php | SeedDefaultMenus.handle | public function handle()
{
$nodes = [
'name' => 'admin-menu',
'title' => 'Administrator Menu',
'description' => 'A default menu you can use for back office purposes',
'route' => null,
'icon' => null,
'is_active' => 1,
'is_protected' => 1,
'chi... | php | public function handle()
{
$nodes = [
'name' => 'admin-menu',
'title' => 'Administrator Menu',
'description' => 'A default menu you can use for back office purposes',
'route' => null,
'icon' => null,
'is_active' => 1,
'is_protected' => 1,
'chi... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"nodes",
"=",
"[",
"'name'",
"=>",
"'admin-menu'",
",",
"'title'",
"=>",
"'Administrator Menu'",
",",
"'description'",
"=>",
"'A default menu you can use for back office purposes'",
",",
"'route'",
"=>",
"null",
",... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/afrittella/back-project/blob/e1aa2e3ee03d453033f75a4b16f073c60b5f32d1/src/app/Console/Commands/SeedDefaultMenus.php#L26-L144 |
phpmob/changmin | src/PhpMob/CoreBundle/Context/WebUserBasedLocaleContext.php | WebUserBasedLocaleContext.getLocaleCode | public function getLocaleCode(): string
{
$token = $this->tokenStorage->getToken();
if (null === $token) {
throw new LocaleNotFoundException();
}
$user = $token->getUser();
if (!$user instanceof WebUserInterface) {
throw new LocaleNotFoundException(... | php | public function getLocaleCode(): string
{
$token = $this->tokenStorage->getToken();
if (null === $token) {
throw new LocaleNotFoundException();
}
$user = $token->getUser();
if (!$user instanceof WebUserInterface) {
throw new LocaleNotFoundException(... | [
"public",
"function",
"getLocaleCode",
"(",
")",
":",
"string",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"tokenStorage",
"->",
"getToken",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"token",
")",
"{",
"throw",
"new",
"LocaleNotFoundException",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/Context/WebUserBasedLocaleContext.php#L42-L61 |
afrittella/back-project | src/app/Listeners/SendRegistrationEmail.php | SendRegistrationEmail.handle | public function handle(UserRegistered $event)
{
//try {
$user = $this->users->findBy('id', $event->user_id);
$user->notify(new RegistrationEmail($user));
//} catch(\Exception $e) {
//Log::error('lavoro fallito');
//}
} | php | public function handle(UserRegistered $event)
{
//try {
$user = $this->users->findBy('id', $event->user_id);
$user->notify(new RegistrationEmail($user));
//} catch(\Exception $e) {
//Log::error('lavoro fallito');
//}
} | [
"public",
"function",
"handle",
"(",
"UserRegistered",
"$",
"event",
")",
"{",
"//try {",
"$",
"user",
"=",
"$",
"this",
"->",
"users",
"->",
"findBy",
"(",
"'id'",
",",
"$",
"event",
"->",
"user_id",
")",
";",
"$",
"user",
"->",
"notify",
"(",
"new"... | Handle the event.
@param UserRegistered $event
@return void
@internal param $Event =UserRegistered $event | [
"Handle",
"the",
"event",
"."
] | train | https://github.com/afrittella/back-project/blob/e1aa2e3ee03d453033f75a4b16f073c60b5f32d1/src/app/Listeners/SendRegistrationEmail.php#L30-L39 |
2amigos/yiifoundation | widgets/Pager.php | Pager.run | public function run()
{
$this->registerClientScript();
$buttons = $this->createPageButtons();
if (empty($buttons))
return true;
if ($this->centered) {
echo \CHtml::openTag('div', array('class' => Enum::PAGINATION_CENTERED));
}
echo \CHtml::tag... | php | public function run()
{
$this->registerClientScript();
$buttons = $this->createPageButtons();
if (empty($buttons))
return true;
if ($this->centered) {
echo \CHtml::openTag('div', array('class' => Enum::PAGINATION_CENTERED));
}
echo \CHtml::tag... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"registerClientScript",
"(",
")",
";",
"$",
"buttons",
"=",
"$",
"this",
"->",
"createPageButtons",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"buttons",
")",
")",
"return",
"true",
";"... | Runs the widget. | [
"Runs",
"the",
"widget",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/Pager.php#L69-L83 |
2amigos/yiifoundation | widgets/Pager.php | Pager.registerCssFile | public static function registerCssFile($url = null)
{
if ($url !== null) {
\Yii::app()->getClientScript()->registerCssFile($url);
} else {
Foundation::registerCoreCss();
}
} | php | public static function registerCssFile($url = null)
{
if ($url !== null) {
\Yii::app()->getClientScript()->registerCssFile($url);
} else {
Foundation::registerCoreCss();
}
} | [
"public",
"static",
"function",
"registerCssFile",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"url",
"!==",
"null",
")",
"{",
"\\",
"Yii",
"::",
"app",
"(",
")",
"->",
"getClientScript",
"(",
")",
"->",
"registerCssFile",
"(",
"$",
"url"... | Registers the needed CSS file.
@param string $url the CSS URL. If null, a default CSS URL will be used. | [
"Registers",
"the",
"needed",
"CSS",
"file",
"."
] | train | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/Pager.php#L90-L98 |
lootils/archiver | src/Lootils/Archiver/TarArchive.php | TarArchive.add | public function add($file, $entry_name = null)
{
$result = $this->tar->addModify($file, '', dirname($file));
if ($result === false) {
throw new ArchiveException('Error adding file ' . $file);
}
return $this;
} | php | public function add($file, $entry_name = null)
{
$result = $this->tar->addModify($file, '', dirname($file));
if ($result === false) {
throw new ArchiveException('Error adding file ' . $file);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"file",
",",
"$",
"entry_name",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"tar",
"->",
"addModify",
"(",
"$",
"file",
",",
"''",
",",
"dirname",
"(",
"$",
"file",
")",
")",
";",
"if",
"... | Add the given file to the file archive. | [
"Add",
"the",
"given",
"file",
"to",
"the",
"file",
"archive",
"."
] | train | https://github.com/lootils/archiver/blob/5b801bddfe15f7378a118c4094f04b37abb5a53e/src/Lootils/Archiver/TarArchive.php#L33-L41 |
lootils/archiver | src/Lootils/Archiver/TarArchive.php | TarArchive.extractTo | public function extractTo($destination, $entries = array())
{
$result = false;
if (!empty($entries)) {
$result = $this->tar->extractList($entries, $destination);
} else {
$result = $this->tar->extract($destination, true);
}
if ($result === false) {
... | php | public function extractTo($destination, $entries = array())
{
$result = false;
if (!empty($entries)) {
$result = $this->tar->extractList($entries, $destination);
} else {
$result = $this->tar->extract($destination, true);
}
if ($result === false) {
... | [
"public",
"function",
"extractTo",
"(",
"$",
"destination",
",",
"$",
"entries",
"=",
"array",
"(",
")",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"entries",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->... | Extract the given files to the destination. | [
"Extract",
"the",
"given",
"files",
"to",
"the",
"destination",
"."
] | train | https://github.com/lootils/archiver/blob/5b801bddfe15f7378a118c4094f04b37abb5a53e/src/Lootils/Archiver/TarArchive.php#L54-L67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.