id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
18,500 | slashworks/control-bundle | src/Slashworks/AppBundle/Controller/RemoteAppController.php | RemoteAppController.createAction | public function createAction(Request $request)
{
$oRemoteApp = new RemoteApp();
$form = $this->createCreateForm($oRemoteApp);
$form->handleRequest($request);
if ($form->isValid()) {
$sDomain = $oRemoteApp->getDomain();
if(s... | php | public function createAction(Request $request)
{
$oRemoteApp = new RemoteApp();
$form = $this->createCreateForm($oRemoteApp);
$form->handleRequest($request);
if ($form->isValid()) {
$sDomain = $oRemoteApp->getDomain();
if(s... | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"oRemoteApp",
"=",
"new",
"RemoteApp",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"oRemoteApp",
")",
";",
"$",
"form",
"->",
"ha... | Create new remote app
@param \Symfony\Component\HttpFoundation\Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
@throws \Exception
@throws \PropelException | [
"Create",
"new",
"remote",
"app"
] | 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/RemoteAppController.php#L424-L454 |
18,501 | slashworks/control-bundle | src/Slashworks/AppBundle/Controller/RemoteAppController.php | RemoteAppController.newAction | public function newAction()
{
$oRemoteApp = new RemoteApp();
$oRemoteApp->setApiUrl("swControl/");
$oRemoteApp->setActivated(true);
$oRemoteApp->setIncludelog(true);
$oRemoteApp->setNotificationRecipient($this->getUser()->getEmail());
$oRe... | php | public function newAction()
{
$oRemoteApp = new RemoteApp();
$oRemoteApp->setApiUrl("swControl/");
$oRemoteApp->setActivated(true);
$oRemoteApp->setIncludelog(true);
$oRemoteApp->setNotificationRecipient($this->getUser()->getEmail());
$oRe... | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"oRemoteApp",
"=",
"new",
"RemoteApp",
"(",
")",
";",
"$",
"oRemoteApp",
"->",
"setApiUrl",
"(",
"\"swControl/\"",
")",
";",
"$",
"oRemoteApp",
"->",
"setActivated",
"(",
"true",
")",
";",
"$",
"oRem... | Displays a form to create a new RemoteApp entity.
@return \Symfony\Component\HttpFoundation\Response | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"RemoteApp",
"entity",
"."
] | 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/RemoteAppController.php#L462-L479 |
18,502 | slashworks/control-bundle | src/Slashworks/AppBundle/Controller/RemoteAppController.php | RemoteAppController.updateAction | public function updateAction(Request $request, $id)
{
/** @var RemoteApp $oRemoteApp */
$oRemoteApp = RemoteAppQuery::create()->findOneById($id);
if (count($oRemoteApp) === 0) {
throw $this->createNotFoundException('Unable to find RemoteApp entity.');
... | php | public function updateAction(Request $request, $id)
{
/** @var RemoteApp $oRemoteApp */
$oRemoteApp = RemoteAppQuery::create()->findOneById($id);
if (count($oRemoteApp) === 0) {
throw $this->createNotFoundException('Unable to find RemoteApp entity.');
... | [
"public",
"function",
"updateAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"/** @var RemoteApp $oRemoteApp */",
"$",
"oRemoteApp",
"=",
"RemoteAppQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",... | Update existing remote app
@param \Symfony\Component\HttpFoundation\Request $request
@param $id
@return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
@throws \Exception
@throws \PropelException | [
"Update",
"existing",
"remote",
"app"
] | 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/RemoteAppController.php#L520-L558 |
18,503 | slashworks/control-bundle | src/Slashworks/AppBundle/Controller/RemoteAppController.php | RemoteAppController.deleteAction | public function deleteAction(Request $request, $id)
{
/** @var RemoteApp $oRemoteApp */
$oRemoteApp = RemoteAppQuery::create()->findOneById($id);
if ($oRemoteApp === null) {
throw $this->createNotFoundException('Unable to find RemoteApp entity.');
... | php | public function deleteAction(Request $request, $id)
{
/** @var RemoteApp $oRemoteApp */
$oRemoteApp = RemoteAppQuery::create()->findOneById($id);
if ($oRemoteApp === null) {
throw $this->createNotFoundException('Unable to find RemoteApp entity.');
... | [
"public",
"function",
"deleteAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"/** @var RemoteApp $oRemoteApp */",
"$",
"oRemoteApp",
"=",
"RemoteAppQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$",
"id",
")",
";",
"if",
"(",... | Delete remote app
@param \Symfony\Component\HttpFoundation\Request $request
@param $id
@return \Symfony\Component\HttpFoundation\RedirectResponse
@throws \Exception
@throws \PropelException | [
"Delete",
"remote",
"app"
] | 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/RemoteAppController.php#L571-L590 |
18,504 | slashworks/control-bundle | src/Slashworks/AppBundle/Controller/RemoteAppController.php | RemoteAppController.lastLogAction | public function lastLogAction($id)
{
$oLog = ApiLogQuery::create()->findOneByRemoteAppId($id);
$oRemoteApp = RemoteAppQuery::create()->findOneById($id);
return $this->render('SlashworksAppBundle:RemoteApp:log.html.twig', array(
'oLog' => $oLog,
... | php | public function lastLogAction($id)
{
$oLog = ApiLogQuery::create()->findOneByRemoteAppId($id);
$oRemoteApp = RemoteAppQuery::create()->findOneById($id);
return $this->render('SlashworksAppBundle:RemoteApp:log.html.twig', array(
'oLog' => $oLog,
... | [
"public",
"function",
"lastLogAction",
"(",
"$",
"id",
")",
"{",
"$",
"oLog",
"=",
"ApiLogQuery",
"::",
"create",
"(",
")",
"->",
"findOneByRemoteAppId",
"(",
"$",
"id",
")",
";",
"$",
"oRemoteApp",
"=",
"RemoteAppQuery",
"::",
"create",
"(",
")",
"->",
... | Shows last api-log entry
@param $id
@return \Symfony\Component\HttpFoundation\Response | [
"Shows",
"last",
"api",
"-",
"log",
"entry"
] | 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/RemoteAppController.php#L600-L610 |
18,505 | slashworks/control-bundle | src/Slashworks/AppBundle/Controller/RemoteAppController.php | RemoteAppController.createCreateForm | private function createCreateForm(RemoteApp $oRemoteApp)
{
$form = $this->createForm(new RemoteAppType(), $oRemoteApp, array(
'action' => $this->generateUrl('remote_app_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('l... | php | private function createCreateForm(RemoteApp $oRemoteApp)
{
$form = $this->createForm(new RemoteAppType(), $oRemoteApp, array(
'action' => $this->generateUrl('remote_app_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('l... | [
"private",
"function",
"createCreateForm",
"(",
"RemoteApp",
"$",
"oRemoteApp",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"RemoteAppType",
"(",
")",
",",
"$",
"oRemoteApp",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
... | Creates a form to create a RemoteApp entity.
@param RemoteApp $oRemoteApp The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"a",
"RemoteApp",
"entity",
"."
] | 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/RemoteAppController.php#L620-L631 |
18,506 | Chill-project/Main | DataFixtures/ORM/LoadLanguages.php | LoadLanguages.prepareName | private function prepareName($languageCode) {
foreach ($this->container->getParameter('chill_main.available_languages') as $lang) {
$names[$lang] = Intl::getLanguageBundle()->getLanguageName($languageCode);
}
return $names;
} | php | private function prepareName($languageCode) {
foreach ($this->container->getParameter('chill_main.available_languages') as $lang) {
$names[$lang] = Intl::getLanguageBundle()->getLanguageName($languageCode);
}
return $names;
} | [
"private",
"function",
"prepareName",
"(",
"$",
"languageCode",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"container",
"->",
"getParameter",
"(",
"'chill_main.available_languages'",
")",
"as",
"$",
"lang",
")",
"{",
"$",
"names",
"[",
"$",
"lang",
"]",
... | prepare names for languages
@param string $languageCode
@return string[] languages name indexed by available language code | [
"prepare",
"names",
"for",
"languages"
] | 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/DataFixtures/ORM/LoadLanguages.php#L71-L77 |
18,507 | lode/fem | src/email.php | email.send | public static function send($recipient, $subject, $body, $options=[]) {
if (empty(self::$mailer)) {
self::login();
}
if (ENVIRONMENT != 'production') {
$recipient = self::protect_emailaddress($recipient);
if (isset($options['cc'])) {
$options['cc'] = self::protect_emailaddress($options['cc']);
}
if (i... | php | public static function send($recipient, $subject, $body, $options=[]) {
if (empty(self::$mailer)) {
self::login();
}
if (ENVIRONMENT != 'production') {
$recipient = self::protect_emailaddress($recipient);
if (isset($options['cc'])) {
$options['cc'] = self::protect_emailaddress($options['cc']);
}
if (i... | [
"public",
"static",
"function",
"send",
"(",
"$",
"recipient",
",",
"$",
"subject",
",",
"$",
"body",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"mailer",
")",
")",
"{",
"self",
"::",
"login",
"(",
... | sends an email directly
@todo allow for html emails as well
@param mixed $recipient string or [email => name]
@param string $subject
@param string $message plain text only for now
@param array $options array with optional 'cc', 'bcc', 'reply_to', 'attachment' options
'attachment' is expected to be an array ... | [
"sends",
"an",
"email",
"directly"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/email.php#L41-L84 |
18,508 | lode/fem | src/email.php | email.validate | public static function validate($emailaddress) {
try {
$message = new \Swift_Message();
$message->setTo($emailaddress);
}
catch (\Swift_RfcComplianceException $e) {
return false;
}
return true;
} | php | public static function validate($emailaddress) {
try {
$message = new \Swift_Message();
$message->setTo($emailaddress);
}
catch (\Swift_RfcComplianceException $e) {
return false;
}
return true;
} | [
"public",
"static",
"function",
"validate",
"(",
"$",
"emailaddress",
")",
"{",
"try",
"{",
"$",
"message",
"=",
"new",
"\\",
"Swift_Message",
"(",
")",
";",
"$",
"message",
"->",
"setTo",
"(",
"$",
"emailaddress",
")",
";",
"}",
"catch",
"(",
"\\",
... | check email addresses validity
@param string $emailaddress
@return boolean | [
"check",
"email",
"addresses",
"validity"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/email.php#L92-L102 |
18,509 | lode/fem | src/email.php | email.protect_emailaddress | public static function protect_emailaddress($emailaddress, $catchall_address=null) {
if (empty($catchall_address)) {
if (empty(self::$config)) {
self::load_config();
}
$catchall_address = self::$config['from'];
}
$recipient_name = null;
if (is_array($emailaddress)) {
$recipient_name = current($email... | php | public static function protect_emailaddress($emailaddress, $catchall_address=null) {
if (empty($catchall_address)) {
if (empty(self::$config)) {
self::load_config();
}
$catchall_address = self::$config['from'];
}
$recipient_name = null;
if (is_array($emailaddress)) {
$recipient_name = current($email... | [
"public",
"static",
"function",
"protect_emailaddress",
"(",
"$",
"emailaddress",
",",
"$",
"catchall_address",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"catchall_address",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"config",
... | protect email addresses from going to real people on non-production environments
it returns the website's sender address with the original one as '+alias'
@param string $emailaddress i.e. user@company.com
@param string $catchall_address i.e. development@project.com
@return string i.e. developm... | [
"protect",
"email",
"addresses",
"from",
"going",
"to",
"real",
"people",
"on",
"non",
"-",
"production",
"environments"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/email.php#L113-L142 |
18,510 | lode/fem | src/email.php | email.load_config | protected static function load_config($config=null) {
if ($config) {
self::$config = $config;
return;
}
$config_file = ROOT_DIR.'config/email.ini';
if (file_exists($config_file) == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('no email config found');
}
self::$config... | php | protected static function load_config($config=null) {
if ($config) {
self::$config = $config;
return;
}
$config_file = ROOT_DIR.'config/email.ini';
if (file_exists($config_file) == false) {
$exception = bootstrap::get_library('exception');
throw new $exception('no email config found');
}
self::$config... | [
"protected",
"static",
"function",
"load_config",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"config",
")",
"{",
"self",
"::",
"$",
"config",
"=",
"$",
"config",
";",
"return",
";",
"}",
"$",
"config_file",
"=",
"ROOT_DIR",
".",
"'con... | collects the config for connecting from a ini file
@note the password is expected to be in a base64 encoded format
to help against shoulder surfing
@note sets self::$config with 'host', 'port', 'ssl', 'user', 'pass', 'from', 'name' values | [
"collects",
"the",
"config",
"for",
"connecting",
"from",
"a",
"ini",
"file"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/email.php#L152-L168 |
18,511 | ClanCats/Core | src/classes/CCHTTP.php | CCHTTP.header | public function header( $key, $value = null ) {
$key = explode( '-', $key );
foreach( $key as $k => $v ) {
$key[$k] = ucfirst( strtolower($v));
}
$key = implode( '-', $key );
if ( !is_null( $value ) ) {
$this->_headers[$key] = $value;
}
return $this->_headers[$key];
} | php | public function header( $key, $value = null ) {
$key = explode( '-', $key );
foreach( $key as $k => $v ) {
$key[$k] = ucfirst( strtolower($v));
}
$key = implode( '-', $key );
if ( !is_null( $value ) ) {
$this->_headers[$key] = $value;
}
return $this->_headers[$key];
} | [
"public",
"function",
"header",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"key",
"=",
"explode",
"(",
"'-'",
",",
"$",
"key",
")",
";",
"foreach",
"(",
"$",
"key",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"key",
... | header getter and setter
@param string $key
@param mixed $value | [
"header",
"getter",
"and",
"setter"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCHTTP.php#L134-L147 |
18,512 | ClanCats/Core | src/classes/CCHTTP.php | CCHTTP.request | public function request( $what = 'both' ) {
/*
* prepare curl
*/
$ch = curl_init( $this->url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
//curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
curl_setopt( $ch, CURLOPT_HEADER, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
/*
* prepare the heade... | php | public function request( $what = 'both' ) {
/*
* prepare curl
*/
$ch = curl_init( $this->url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
//curl_setopt( $ch, CURLOPT_VERBOSE, 1 );
curl_setopt( $ch, CURLOPT_HEADER, 1 );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
/*
* prepare the heade... | [
"public",
"function",
"request",
"(",
"$",
"what",
"=",
"'both'",
")",
"{",
"/*\n\t\t * prepare curl\n\t\t */",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"this",
"->",
"url",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_RETURNTRANSFER",
",",
"1",
")... | and finally execute the request
returns false if the request fails
@param string $what | both, header, body
@return mixed | [
"and",
"finally",
"execute",
"the",
"request"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCHTTP.php#L157-L231 |
18,513 | vorbind/influx-analytics | src/Import/ImportAnalytics.php | ImportAnalytics.isUtcValid | protected function isUtcValid($utc, $now, $rp) {
if( 'forever' == $rp) {
$nowDate = date('Y-m-d', strtotime($now));
if(strtotime($utc) >= strtotime($nowDate)) {
return false;
}
}
if( 'years_5' == $rp) {
$min = date('i', strtotime($... | php | protected function isUtcValid($utc, $now, $rp) {
if( 'forever' == $rp) {
$nowDate = date('Y-m-d', strtotime($now));
if(strtotime($utc) >= strtotime($nowDate)) {
return false;
}
}
if( 'years_5' == $rp) {
$min = date('i', strtotime($... | [
"protected",
"function",
"isUtcValid",
"(",
"$",
"utc",
",",
"$",
"now",
",",
"$",
"rp",
")",
"{",
"if",
"(",
"'forever'",
"==",
"$",
"rp",
")",
"{",
"$",
"nowDate",
"=",
"date",
"(",
"'Y-m-d'",
",",
"strtotime",
"(",
"$",
"now",
")",
")",
";",
... | Is valid utc
@param string $utc
@param string $now
@param string $rp
@return boolean | [
"Is",
"valid",
"utc"
] | 8c0c150351f045ccd3d57063f2b3b50a2c926e3e | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Import/ImportAnalytics.php#L124-L140 |
18,514 | vorbind/influx-analytics | src/Import/ImportAnalytics.php | ImportAnalytics.isMetricValid | protected function isMetricValid($metric) {
if (!isset($metric) || !is_array($metric)
|| !isset($metric["influx"]) || !isset($metric["influx"]["tags"])
|| !isset($metric["mysql"]) || !isset($metric["mysql"]["query"])) {
return false;
}
return... | php | protected function isMetricValid($metric) {
if (!isset($metric) || !is_array($metric)
|| !isset($metric["influx"]) || !isset($metric["influx"]["tags"])
|| !isset($metric["mysql"]) || !isset($metric["mysql"]["query"])) {
return false;
}
return... | [
"protected",
"function",
"isMetricValid",
"(",
"$",
"metric",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"metric",
")",
"||",
"!",
"is_array",
"(",
"$",
"metric",
")",
"||",
"!",
"isset",
"(",
"$",
"metric",
"[",
"\"influx\"",
"]",
")",
"||",
"!"... | Check if metric is valid
@param array $metric
@return boolean | [
"Check",
"if",
"metric",
"is",
"valid"
] | 8c0c150351f045ccd3d57063f2b3b50a2c926e3e | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Import/ImportAnalytics.php#L148-L155 |
18,515 | maximebf/events | src/Events/EventDispatcher.php | EventDispatcher.addListener | public function addListener(EventListener $listener, $priority = 0, $important = false)
{
if ($listener === $this) {
throw new EventException("Adding self as listener in 'Events\EventDispatcher' would cause an infinite loop");
}
$priority = -$priority;
while (isset($this-... | php | public function addListener(EventListener $listener, $priority = 0, $important = false)
{
if ($listener === $this) {
throw new EventException("Adding self as listener in 'Events\EventDispatcher' would cause an infinite loop");
}
$priority = -$priority;
while (isset($this-... | [
"public",
"function",
"addListener",
"(",
"EventListener",
"$",
"listener",
",",
"$",
"priority",
"=",
"0",
",",
"$",
"important",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"listener",
"===",
"$",
"this",
")",
"{",
"throw",
"new",
"EventException",
"(",
... | Adds a new listener
@param EventListener $listener
@param integer $priority Listener's priority, higher is more important
@param boolean $important Whether this listener is more important than other ones of the same priority | [
"Adds",
"a",
"new",
"listener"
] | b9861c260ee9eaabb9aa986bab76a2e039eb871f | https://github.com/maximebf/events/blob/b9861c260ee9eaabb9aa986bab76a2e039eb871f/src/Events/EventDispatcher.php#L76-L89 |
18,516 | maximebf/events | src/Events/EventDispatcher.php | EventDispatcher.removeListener | public function removeListener(EventListener $listener)
{
if (($i = array_search($listener, $this->listeners)) !== false) {
unset($this->listeners[$i]);
}
return $this;
} | php | public function removeListener(EventListener $listener)
{
if (($i = array_search($listener, $this->listeners)) !== false) {
unset($this->listeners[$i]);
}
return $this;
} | [
"public",
"function",
"removeListener",
"(",
"EventListener",
"$",
"listener",
")",
"{",
"if",
"(",
"(",
"$",
"i",
"=",
"array_search",
"(",
"$",
"listener",
",",
"$",
"this",
"->",
"listeners",
")",
")",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
... | Removes a listener
@param EventListener $listener
@return EventDispatcher | [
"Removes",
"a",
"listener"
] | b9861c260ee9eaabb9aa986bab76a2e039eb871f | https://github.com/maximebf/events/blob/b9861c260ee9eaabb9aa986bab76a2e039eb871f/src/Events/EventDispatcher.php#L109-L115 |
18,517 | maximebf/events | src/Events/EventDispatcher.php | EventDispatcher.notify | public function notify(Event $event)
{
$processed = false;
foreach ($this->listeners as $listener) {
if ($listener->match($event)) {
$listener->handle($event);
$processed = true;
if ($event->isPropagationStopped()) {
bre... | php | public function notify(Event $event)
{
$processed = false;
foreach ($this->listeners as $listener) {
if ($listener->match($event)) {
$listener->handle($event);
$processed = true;
if ($event->isPropagationStopped()) {
bre... | [
"public",
"function",
"notify",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"processed",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"listeners",
"as",
"$",
"listener",
")",
"{",
"if",
"(",
"$",
"listener",
"->",
"match",
"(",
"$",
"event",
... | Notifies the listeners of an event
@param Event $event
@return boolean Whether a listener handled the event | [
"Notifies",
"the",
"listeners",
"of",
"an",
"event"
] | b9861c260ee9eaabb9aa986bab76a2e039eb871f | https://github.com/maximebf/events/blob/b9861c260ee9eaabb9aa986bab76a2e039eb871f/src/Events/EventDispatcher.php#L160-L173 |
18,518 | maximebf/events | src/Events/EventDispatcher.php | EventDispatcher.notifyUntil | public function notifyUntil(Event $event, $callback = null)
{
if ($this->notify($event)) {
if ($callback) {
$callback();
}
return true;
}
$this->stackedEvents[] = array($event, $callback);
return false;
} | php | public function notifyUntil(Event $event, $callback = null)
{
if ($this->notify($event)) {
if ($callback) {
$callback();
}
return true;
}
$this->stackedEvents[] = array($event, $callback);
return false;
} | [
"public",
"function",
"notifyUntil",
"(",
"Event",
"$",
"event",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"notify",
"(",
"$",
"event",
")",
")",
"{",
"if",
"(",
"$",
"callback",
")",
"{",
"$",
"callback",
"(",
")... | Notifies the listeners of an event. Won't stop until the event has been handled by a listener.
@param Event $event
@param callback $callback Will be called once the event has been processed
@return bool | [
"Notifies",
"the",
"listeners",
"of",
"an",
"event",
".",
"Won",
"t",
"stop",
"until",
"the",
"event",
"has",
"been",
"handled",
"by",
"a",
"listener",
"."
] | b9861c260ee9eaabb9aa986bab76a2e039eb871f | https://github.com/maximebf/events/blob/b9861c260ee9eaabb9aa986bab76a2e039eb871f/src/Events/EventDispatcher.php#L182-L192 |
18,519 | simple-php-mvc/simple-php-mvc | src/MVC/Module/Module.php | Module.getModuleExtension | public function getModuleExtension()
{
if (null === $this->extension) {
$class = $this->getModuleExtensionClass();
if (class_exists($class)) {
$extension = new $class();
// check naming convention
$basename = preg_replace('/Module$/', ... | php | public function getModuleExtension()
{
if (null === $this->extension) {
$class = $this->getModuleExtensionClass();
if (class_exists($class)) {
$extension = new $class();
// check naming convention
$basename = preg_replace('/Module$/', ... | [
"public",
"function",
"getModuleExtension",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"extension",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getModuleExtensionClass",
"(",
")",
";",
"if",
"(",
"class_exists",
"(",
"$",
"class",
... | Returns the module's extension.
@return ExtensionInterface|null The container extension
@throws \LogicException | [
"Returns",
"the",
"module",
"s",
"extension",
"."
] | e319eb09d29afad6993acb4a7e35f32a87dd0841 | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Module/Module.php#L34-L60 |
18,520 | simple-php-mvc/simple-php-mvc | src/MVC/Module/Module.php | Module.registerTemplatesPathTwig | public function registerTemplatesPathTwig(MVC $mvc)
{
$viewsPath = $this->getPath() . '/Resources/views';
if (file_exists(dirname($viewsPath)) && file_exists($viewsPath)) {
$mvc->getCvpp('twig.loader.filesystem')->addPath($viewsPath);
}
} | php | public function registerTemplatesPathTwig(MVC $mvc)
{
$viewsPath = $this->getPath() . '/Resources/views';
if (file_exists(dirname($viewsPath)) && file_exists($viewsPath)) {
$mvc->getCvpp('twig.loader.filesystem')->addPath($viewsPath);
}
} | [
"public",
"function",
"registerTemplatesPathTwig",
"(",
"MVC",
"$",
"mvc",
")",
"{",
"$",
"viewsPath",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
".",
"'/Resources/views'",
";",
"if",
"(",
"file_exists",
"(",
"dirname",
"(",
"$",
"viewsPath",
")",
")",
... | Register Templates Path Twig
@param MVC $mvc | [
"Register",
"Templates",
"Path",
"Twig"
] | e319eb09d29afad6993acb4a7e35f32a87dd0841 | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Module/Module.php#L161-L167 |
18,521 | qcubed/orm | src/Query/Node/NodeBase.php | NodeBase._MergeExpansionNode | public function _MergeExpansionNode(NodeBase $objNewNode)
{
if (!$objNewNode || empty($objNewNode->objChildNodeArray)) {
return;
}
if ($objNewNode->strName != $this->strName) {
throw new Caller('Expansion node tables must match.');
}
if (!$this->objCh... | php | public function _MergeExpansionNode(NodeBase $objNewNode)
{
if (!$objNewNode || empty($objNewNode->objChildNodeArray)) {
return;
}
if ($objNewNode->strName != $this->strName) {
throw new Caller('Expansion node tables must match.');
}
if (!$this->objCh... | [
"public",
"function",
"_MergeExpansionNode",
"(",
"NodeBase",
"$",
"objNewNode",
")",
"{",
"if",
"(",
"!",
"$",
"objNewNode",
"||",
"empty",
"(",
"$",
"objNewNode",
"->",
"objChildNodeArray",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"objNewNode",... | Merges a node tree into this node, building the child nodes. The node being received
is assumed to be specially built node such that only one child node exists, if any,
and the last node in the chain is designated as array expansion. The goal of all of this
is to set up a node chain where intermediate nodes can be desi... | [
"Merges",
"a",
"node",
"tree",
"into",
"this",
"node",
"building",
"the",
"child",
"nodes",
".",
"The",
"node",
"being",
"received",
"is",
"assumed",
"to",
"be",
"specially",
"built",
"node",
"such",
"that",
"only",
"one",
"child",
"node",
"exists",
"if",
... | f320eba671f20874b1f3809c5293f8c02d5b1204 | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/Node/NodeBase.php#L163-L187 |
18,522 | qcubed/orm | src/Query/Node/NodeBase.php | NodeBase.putSelectFields | public function putSelectFields($objBuilder, $strPrefix = null, $objSelect = null)
{
if ($strPrefix) {
$strTableName = $strPrefix;
$strAliasPrefix = $strPrefix . '__';
} else {
$strTableName = $this->strTableName;
$strAliasPrefix = '';
}
... | php | public function putSelectFields($objBuilder, $strPrefix = null, $objSelect = null)
{
if ($strPrefix) {
$strTableName = $strPrefix;
$strAliasPrefix = $strPrefix . '__';
} else {
$strTableName = $this->strTableName;
$strAliasPrefix = '';
}
... | [
"public",
"function",
"putSelectFields",
"(",
"$",
"objBuilder",
",",
"$",
"strPrefix",
"=",
"null",
",",
"$",
"objSelect",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"strPrefix",
")",
"{",
"$",
"strTableName",
"=",
"$",
"strPrefix",
";",
"$",
"strAliasPrefi... | Puts the "Select" clause fields for this node into builder.
@param Builder $objBuilder
@param null|string $strPrefix
@param null|Select $objSelect | [
"Puts",
"the",
"Select",
"clause",
"fields",
"for",
"this",
"node",
"into",
"builder",
"."
] | f320eba671f20874b1f3809c5293f8c02d5b1204 | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Query/Node/NodeBase.php#L196-L220 |
18,523 | phore/phore-micro-app | src/Type/Request.php | Request.getJsonBody | public function getJsonBody($json_options=null) : array
{
try {
return phore_json_decode($bodyRaw = $this->getBody());
} catch (\InvalidArgumentException $e) {
throw new \InvalidArgumentException("Cannot json-decode body: '$bodyRaw'", 0, $e);
}
} | php | public function getJsonBody($json_options=null) : array
{
try {
return phore_json_decode($bodyRaw = $this->getBody());
} catch (\InvalidArgumentException $e) {
throw new \InvalidArgumentException("Cannot json-decode body: '$bodyRaw'", 0, $e);
}
} | [
"public",
"function",
"getJsonBody",
"(",
"$",
"json_options",
"=",
"null",
")",
":",
"array",
"{",
"try",
"{",
"return",
"phore_json_decode",
"(",
"$",
"bodyRaw",
"=",
"$",
"this",
"->",
"getBody",
"(",
")",
")",
";",
"}",
"catch",
"(",
"\\",
"Invalid... | json-decode the body
@return array | [
"json",
"-",
"decode",
"the",
"body"
] | 6cf87a647b8b0be05afbfe6bd020650e98558c23 | https://github.com/phore/phore-micro-app/blob/6cf87a647b8b0be05afbfe6bd020650e98558c23/src/Type/Request.php#L74-L81 |
18,524 | maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaHome.php | ManiaHome.postNotification | function postNotification(Notification $n)
{
if($n->receiverName)
{
if($n->isPrivate)
{
return $this->manialinkPublisher->postPrivateNotification($n->message, $n->receiverName);
}
return $this->manialinkPublisher->postPersonalNotification($n->message, $n->link, $n->iconStyle, $n->iconSubStyle);
}... | php | function postNotification(Notification $n)
{
if($n->receiverName)
{
if($n->isPrivate)
{
return $this->manialinkPublisher->postPrivateNotification($n->message, $n->receiverName);
}
return $this->manialinkPublisher->postPersonalNotification($n->message, $n->link, $n->iconStyle, $n->iconSubStyle);
}... | [
"function",
"postNotification",
"(",
"Notification",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"n",
"->",
"receiverName",
")",
"{",
"if",
"(",
"$",
"n",
"->",
"isPrivate",
")",
"{",
"return",
"$",
"this",
"->",
"manialinkPublisher",
"->",
"postPrivateNotificatio... | Please use the other methods which are more robust
@deprecated since version 3.1.0 | [
"Please",
"use",
"the",
"other",
"methods",
"which",
"are",
"more",
"robust"
] | 027a458388035fe66f2f56ff3ea1f85eff2a5a4e | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome.php#L47-L58 |
18,525 | maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaHome.php | ManiaHome.postPublicNotification | function postPublicNotification(Notification $n)
{
return $this->manialinkPublisher->postPublicNotification($n->message, $n->link, $n->iconStyle, $n->iconSubStyle);
} | php | function postPublicNotification(Notification $n)
{
return $this->manialinkPublisher->postPublicNotification($n->message, $n->link, $n->iconStyle, $n->iconSubStyle);
} | [
"function",
"postPublicNotification",
"(",
"Notification",
"$",
"n",
")",
"{",
"return",
"$",
"this",
"->",
"manialinkPublisher",
"->",
"postPublicNotification",
"(",
"$",
"n",
"->",
"message",
",",
"$",
"n",
"->",
"link",
",",
"$",
"n",
"->",
"iconStyle",
... | Send a public notification to every player that bookmarked your Manialink.
@param Notification $n
@deprecated since version 3.1.0 | [
"Send",
"a",
"public",
"notification",
"to",
"every",
"player",
"that",
"bookmarked",
"your",
"Manialink",
"."
] | 027a458388035fe66f2f56ff3ea1f85eff2a5a4e | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome.php#L65-L68 |
18,526 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.getLobby | function getLobby($lobbyLogin)
{
return $this->db->execute(
'SELECT * FROM LobbyServers '.
'WHERE login = %s', $this->db->quote($lobbyLogin)
)->fetchObject(__NAMESPACE__.'\Lobby');
} | php | function getLobby($lobbyLogin)
{
return $this->db->execute(
'SELECT * FROM LobbyServers '.
'WHERE login = %s', $this->db->quote($lobbyLogin)
)->fetchObject(__NAMESPACE__.'\Lobby');
} | [
"function",
"getLobby",
"(",
"$",
"lobbyLogin",
")",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'SELECT * FROM LobbyServers '",
".",
"'WHERE login = %s'",
",",
"$",
"this",
"->",
"db",
"->",
"quote",
"(",
"$",
"lobbyLogin",
")",
")",
"-... | Get lobby information
@param string $lobbyLogin
@return Lobby | [
"Get",
"lobby",
"information"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L40-L46 |
18,527 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.getMatch | function getMatch($matchId)
{
$match = $this->db->execute(
'SELECT id, matchServerLogin, scriptName, titleIdString, state, matchPointsTeam1, matchPointsTeam2, mapPointsTeam1, mapPointsTeam2 '.
'FROM Matches '.
'WHERE id = %d ',
$matchId
)->fetchObject(__NAMESPACE__.'\\Match');
if(!$match)
ret... | php | function getMatch($matchId)
{
$match = $this->db->execute(
'SELECT id, matchServerLogin, scriptName, titleIdString, state, matchPointsTeam1, matchPointsTeam2, mapPointsTeam1, mapPointsTeam2 '.
'FROM Matches '.
'WHERE id = %d ',
$matchId
)->fetchObject(__NAMESPACE__.'\\Match');
if(!$match)
ret... | [
"function",
"getMatch",
"(",
"$",
"matchId",
")",
"{",
"$",
"match",
"=",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'SELECT id, matchServerLogin, scriptName, titleIdString, state, matchPointsTeam1, matchPointsTeam2, mapPointsTeam1, mapPointsTeam2 '",
".",
"'FROM Matches '... | Get matchServer information
@param string $serverLogin
@param string $scriptName
@param string $titleIdString
@return Match | [
"Get",
"matchServer",
"information"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L55-L111 |
18,528 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.getPlayersPlayingCount | function getPlayersPlayingCount($lobbyLogin)
{
return $this->db->execute(
'SELECT COUNT(*) '.
'FROM Players P '.
'INNER JOIN Matches M ON P.matchId = M.id '.
'INNER JOIN MatchServers MS ON MS.matchId = M.id '.
'WHERE M.`state` >= %d AND P.state >= %d '.
'AND MS.lobbyLogin = %s',
Match::PR... | php | function getPlayersPlayingCount($lobbyLogin)
{
return $this->db->execute(
'SELECT COUNT(*) '.
'FROM Players P '.
'INNER JOIN Matches M ON P.matchId = M.id '.
'INNER JOIN MatchServers MS ON MS.matchId = M.id '.
'WHERE M.`state` >= %d AND P.state >= %d '.
'AND MS.lobbyLogin = %s',
Match::PR... | [
"function",
"getPlayersPlayingCount",
"(",
"$",
"lobbyLogin",
")",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'SELECT COUNT(*) '",
".",
"'FROM Players P '",
".",
"'INNER JOIN Matches M ON P.matchId = M.id '",
".",
"'INNER JOIN MatchServers MS ON MS.match... | Return the number of match currently played for the lobby
@param string $lobbyLogin
@return int | [
"Return",
"the",
"number",
"of",
"match",
"currently",
"played",
"for",
"the",
"lobby"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L254-L266 |
18,529 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.getLiveMatchServersCount | function getLiveMatchServersCount($lobbyLogin, $scriptName, $titleIdString)
{
return $this->db->execute(
'SELECT COUNT(*) FROM MatchServers '.
'WHERE DATE_ADD(lastLive, INTERVAL 15 MINUTE) > NOW() '.
'AND lobbyLogin = %s AND scriptName = %s AND titleIdString = %s',
$this->db->quote($lobbyLogin), $thi... | php | function getLiveMatchServersCount($lobbyLogin, $scriptName, $titleIdString)
{
return $this->db->execute(
'SELECT COUNT(*) FROM MatchServers '.
'WHERE DATE_ADD(lastLive, INTERVAL 15 MINUTE) > NOW() '.
'AND lobbyLogin = %s AND scriptName = %s AND titleIdString = %s',
$this->db->quote($lobbyLogin), $thi... | [
"function",
"getLiveMatchServersCount",
"(",
"$",
"lobbyLogin",
",",
"$",
"scriptName",
",",
"$",
"titleIdString",
")",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'SELECT COUNT(*) FROM MatchServers '",
".",
"'WHERE DATE_ADD(lastLive, INTERVAL 15 MINU... | Get the number of server the lobby can use
@param string $lobbyLogin
@param string $scriptName
@param string $titleIdString
@return int | [
"Get",
"the",
"number",
"of",
"server",
"the",
"lobby",
"can",
"use"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L289-L297 |
18,530 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.getLeaveCount | function getLeaveCount($playerLogin, $lobbyLogin)
{
return $this->db->query(
'SELECT count(*) FROM Players P '.
'INNER JOIN Matches M ON P.matchId = M.id '.
'WHERE P.login = %s AND P.`state` IN (%s) AND M.lobbyLogin = %s '.
'AND M.state NOT IN (%s) '.
'AND DATE_ADD(M.creationDate, INTERVAL 1 HOUR... | php | function getLeaveCount($playerLogin, $lobbyLogin)
{
return $this->db->query(
'SELECT count(*) FROM Players P '.
'INNER JOIN Matches M ON P.matchId = M.id '.
'WHERE P.login = %s AND P.`state` IN (%s) AND M.lobbyLogin = %s '.
'AND M.state NOT IN (%s) '.
'AND DATE_ADD(M.creationDate, INTERVAL 1 HOUR... | [
"function",
"getLeaveCount",
"(",
"$",
"playerLogin",
",",
"$",
"lobbyLogin",
")",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"query",
"(",
"'SELECT count(*) FROM Players P '",
".",
"'INNER JOIN Matches M ON P.matchId = M.id '",
".",
"'WHERE P.login = %s AND P.`state` ... | Get the number of time the player quit a match for this lobby
@param string $playerLogin
@return int | [
"Get",
"the",
"number",
"of",
"time",
"the",
"player",
"quit",
"a",
"match",
"for",
"this",
"lobby"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L304-L317 |
18,531 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.countAvailableServer | function countAvailableServer($lobbyLogin, $scriptName, $titleIdString)
{
return $this->db->execute(
'SELECT count(MS.login) FROM MatchServers MS '.
'WHERE MS.lobbyLogin = %s AND MS.scriptName = %s AND MS.titleIdString = %s '.
'AND MS.`state` = %d AND matchId IS NULL '.
'AND DATE_ADD(MS.lastLive, INT... | php | function countAvailableServer($lobbyLogin, $scriptName, $titleIdString)
{
return $this->db->execute(
'SELECT count(MS.login) FROM MatchServers MS '.
'WHERE MS.lobbyLogin = %s AND MS.scriptName = %s AND MS.titleIdString = %s '.
'AND MS.`state` = %d AND matchId IS NULL '.
'AND DATE_ADD(MS.lastLive, INT... | [
"function",
"countAvailableServer",
"(",
"$",
"lobbyLogin",
",",
"$",
"scriptName",
",",
"$",
"titleIdString",
")",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'SELECT count(MS.login) FROM MatchServers MS '",
".",
"'WHERE MS.lobbyLogin = %s AND MS.scr... | Get number of server available to host a match
for the lobby
@param string $lobbyLogin
@param string $scriptName
@param string $titleIdString
@return string the match server login | [
"Get",
"number",
"of",
"server",
"available",
"to",
"host",
"a",
"match",
"for",
"the",
"lobby"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L335-L345 |
18,532 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.getAverageTimeBetweenMatches | function getAverageTimeBetweenMatches($lobbyLogin, $scriptName, $titleIdString)
{
$creationTimestamps = $this->db->execute(
'SELECT UNIX_TIMESTAMP(creationDate) '.
'FROM Matches m '.
'WHERE m.lobbyLogin = %s '.
'AND m.scriptName = %s '.
'AND m.titleIdString = %s '.
'AND m.state NOT IN (%s) AND m.cr... | php | function getAverageTimeBetweenMatches($lobbyLogin, $scriptName, $titleIdString)
{
$creationTimestamps = $this->db->execute(
'SELECT UNIX_TIMESTAMP(creationDate) '.
'FROM Matches m '.
'WHERE m.lobbyLogin = %s '.
'AND m.scriptName = %s '.
'AND m.titleIdString = %s '.
'AND m.state NOT IN (%s) AND m.cr... | [
"function",
"getAverageTimeBetweenMatches",
"(",
"$",
"lobbyLogin",
",",
"$",
"scriptName",
",",
"$",
"titleIdString",
")",
"{",
"$",
"creationTimestamps",
"=",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'SELECT UNIX_TIMESTAMP(creationDate) '",
".",
"'FROM Matc... | Get average time between two match. This time is compute with matches over the last hour
If there is not anough matches in database, it returns -1
@param string $lobbyLogin
@param string $scriptName
@param string $titleIdString
@return float Number of seconds | [
"Get",
"average",
"time",
"between",
"two",
"match",
".",
"This",
"time",
"is",
"compute",
"with",
"matches",
"over",
"the",
"last",
"hour",
"If",
"there",
"is",
"not",
"anough",
"matches",
"in",
"database",
"it",
"returns",
"-",
"1"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L477-L501 |
18,533 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.registerMatch | function registerMatch($serverLogin, Match $match, $scriptName, $titleIdString, $lobbyLogin)
{
$this->db->execute('BEGIN');
try
{
$this->db->execute(
'INSERT INTO Matches (creationDate, state, matchServerLogin, scriptName, titleIdString, lobbyLogin) '.
'VALUES (NOW(), -1, %s, %s, %s, %s)',
$this->... | php | function registerMatch($serverLogin, Match $match, $scriptName, $titleIdString, $lobbyLogin)
{
$this->db->execute('BEGIN');
try
{
$this->db->execute(
'INSERT INTO Matches (creationDate, state, matchServerLogin, scriptName, titleIdString, lobbyLogin) '.
'VALUES (NOW(), -1, %s, %s, %s, %s)',
$this->... | [
"function",
"registerMatch",
"(",
"$",
"serverLogin",
",",
"Match",
"$",
"match",
",",
"$",
"scriptName",
",",
"$",
"titleIdString",
",",
"$",
"lobbyLogin",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'BEGIN'",
")",
";",
"try",
"{",
"$",
... | Register a match in database, the match Server will use this to ready up
@param string $serverLogin
@param \ManiaLivePlugins\MatchMakingLobby\Services\Match $match
@param string $scriptName
@param string $titleIdString
@return int $matchId | [
"Register",
"a",
"match",
"in",
"database",
"the",
"match",
"Server",
"will",
"use",
"this",
"to",
"ready",
"up"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L523-L553 |
18,534 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.updatePlayerState | function updatePlayerState($playerLogin, $matchId, $state)
{
$this->db->execute(
'UPDATE Players SET state = %d WHERE login = %s AND matchId = %d',
$state,
$this->db->quote($playerLogin),
$matchId
);
} | php | function updatePlayerState($playerLogin, $matchId, $state)
{
$this->db->execute(
'UPDATE Players SET state = %d WHERE login = %s AND matchId = %d',
$state,
$this->db->quote($playerLogin),
$matchId
);
} | [
"function",
"updatePlayerState",
"(",
"$",
"playerLogin",
",",
"$",
"matchId",
",",
"$",
"state",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'UPDATE Players SET state = %d WHERE login = %s AND matchId = %d'",
",",
"$",
"state",
",",
"$",
"this",
"... | Set the new player state
@param string $playerLogin
@param int $matchId
@param int $state | [
"Set",
"the",
"new",
"player",
"state"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L594-L602 |
18,535 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.updatePlayerRank | function updatePlayerRank($playerLogin, $matchId, $rank)
{
$this->db->execute(
'UPDATE Players SET rank = %d WHERE login = %s AND matchId = %d',
$rank,
$this->db->quote($playerLogin),
$matchId
);
} | php | function updatePlayerRank($playerLogin, $matchId, $rank)
{
$this->db->execute(
'UPDATE Players SET rank = %d WHERE login = %s AND matchId = %d',
$rank,
$this->db->quote($playerLogin),
$matchId
);
} | [
"function",
"updatePlayerRank",
"(",
"$",
"playerLogin",
",",
"$",
"matchId",
",",
"$",
"rank",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'UPDATE Players SET rank = %d WHERE login = %s AND matchId = %d'",
",",
"$",
"rank",
",",
"$",
"this",
"->",... | Register the player rank on his match
@param string $playerLogin
@param int $matchId
@param int $rank | [
"Register",
"the",
"player",
"rank",
"on",
"his",
"match"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L610-L618 |
18,536 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.registerMatchServer | function registerMatchServer($serverLogin, $lobbyLogin, $state, $scriptName, $titleIdString, $currentMap)
{
$this->db->execute(
'INSERT INTO MatchServers (login, lobbyLogin, state, lastLive, scriptName, titleIdString, currentMap) '.
'VALUES(%s, %s, %d, NOW(), %s, %s, %s) '.
'ON DUPLICATE KEY UPDATE state=VA... | php | function registerMatchServer($serverLogin, $lobbyLogin, $state, $scriptName, $titleIdString, $currentMap)
{
$this->db->execute(
'INSERT INTO MatchServers (login, lobbyLogin, state, lastLive, scriptName, titleIdString, currentMap) '.
'VALUES(%s, %s, %d, NOW(), %s, %s, %s) '.
'ON DUPLICATE KEY UPDATE state=VA... | [
"function",
"registerMatchServer",
"(",
"$",
"serverLogin",
",",
"$",
"lobbyLogin",
",",
"$",
"state",
",",
"$",
"scriptName",
",",
"$",
"titleIdString",
",",
"$",
"currentMap",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'INSERT INTO MatchServ... | Register a server as match server
@param string $serverLogin
@param string $lobbyLogin
@param string $state | [
"Register",
"a",
"server",
"as",
"match",
"server"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L626-L639 |
18,537 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/MatchMakingService.php | MatchMakingService.registerLobby | function registerLobby($lobbyLogin, $readyPlayersCount, $connectedPlayersCount, $serverName, $backLink)
{
$this->db->execute(
'INSERT INTO LobbyServers VALUES (%s, %s, %s, %d, %d) '.
'ON DUPLICATE KEY UPDATE '.
'name = VALUES(name), '.
'backLink = VALUES(backLink), '.
'readyPlayers = VALUES(readyPlaye... | php | function registerLobby($lobbyLogin, $readyPlayersCount, $connectedPlayersCount, $serverName, $backLink)
{
$this->db->execute(
'INSERT INTO LobbyServers VALUES (%s, %s, %s, %d, %d) '.
'ON DUPLICATE KEY UPDATE '.
'name = VALUES(name), '.
'backLink = VALUES(backLink), '.
'readyPlayers = VALUES(readyPlaye... | [
"function",
"registerLobby",
"(",
"$",
"lobbyLogin",
",",
"$",
"readyPlayersCount",
",",
"$",
"connectedPlayersCount",
",",
"$",
"serverName",
",",
"$",
"backLink",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"execute",
"(",
"'INSERT INTO LobbyServers VALUES (%s, %s,... | Register a lobby server in the system
@param string $lobbyLogin
@param int $readyPlayersCount
@param int $connectedPlayersCount
@param string $serverName
@param string $backLink | [
"Register",
"a",
"lobby",
"server",
"in",
"the",
"system"
] | 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/MatchMakingService.php#L663-L675 |
18,538 | yuncms/framework | src/web/UploadedFile.php | UploadedFile.saveAsTempFile | public function saveAsTempFile(bool $deleteTempFile = true)
{
if ($this->error != UPLOAD_ERR_OK) {
return false;
}
$tempPath = FileHelper::getTempFilePath($this->name);
if (!$this->saveAs($tempPath, $deleteTempFile)) {
return false;
}
return $t... | php | public function saveAsTempFile(bool $deleteTempFile = true)
{
if ($this->error != UPLOAD_ERR_OK) {
return false;
}
$tempPath = FileHelper::getTempFilePath($this->name);
if (!$this->saveAs($tempPath, $deleteTempFile)) {
return false;
}
return $t... | [
"public",
"function",
"saveAsTempFile",
"(",
"bool",
"$",
"deleteTempFile",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"error",
"!=",
"UPLOAD_ERR_OK",
")",
"{",
"return",
"false",
";",
"}",
"$",
"tempPath",
"=",
"FileHelper",
"::",
"getTempFilePa... | Saves the uploaded file to a temp location.
@param bool $deleteTempFile whether to delete the temporary file after saving.
If true, you will not be able to save the uploaded file again in the current request.
@return string|false the path to the temp file, or false if the file wasn't saved successfully
@see error
@thr... | [
"Saves",
"the",
"uploaded",
"file",
"to",
"a",
"temp",
"location",
"."
] | af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/web/UploadedFile.php#L193-L203 |
18,539 | TypistTech/wp-kses-view | src/ViewAwareTrait.php | ViewAwareTrait.getView | public function getView(): ViewInterface
{
if (null === $this->view) {
$this->setView(
$this->getDefaultView()
);
}
return $this->view;
} | php | public function getView(): ViewInterface
{
if (null === $this->view) {
$this->setView(
$this->getDefaultView()
);
}
return $this->view;
} | [
"public",
"function",
"getView",
"(",
")",
":",
"ViewInterface",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"view",
")",
"{",
"$",
"this",
"->",
"setView",
"(",
"$",
"this",
"->",
"getDefaultView",
"(",
")",
")",
";",
"}",
"return",
"$",
"th... | View getter.
@throws UnexpectedValueException If view is null.
@throws UnexpectedValueException If view is not an instance of ViewInterface.
@return ViewInterface | [
"View",
"getter",
"."
] | 6a5e5a34b81c6387d1c5356c9e42166daec9225f | https://github.com/TypistTech/wp-kses-view/blob/6a5e5a34b81c6387d1c5356c9e42166daec9225f/src/ViewAwareTrait.php#L51-L60 |
18,540 | Craftsware/scissor | src/Module.php | Module.model | public function model($name, $inject = null) {
// Model instance
$instance = function($path) use ($inject) {
if(class_exists($namespace = 'App\\Modules\\' . str_replace('/', '\\', $path))) {
return new $namespace($inject);
}
};
// Split module... | php | public function model($name, $inject = null) {
// Model instance
$instance = function($path) use ($inject) {
if(class_exists($namespace = 'App\\Modules\\' . str_replace('/', '\\', $path))) {
return new $namespace($inject);
}
};
// Split module... | [
"public",
"function",
"model",
"(",
"$",
"name",
",",
"$",
"inject",
"=",
"null",
")",
"{",
"// Model instance",
"$",
"instance",
"=",
"function",
"(",
"$",
"path",
")",
"use",
"(",
"$",
"inject",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"names... | Get model from it's module and other modules
@param string $name | [
"Get",
"model",
"from",
"it",
"s",
"module",
"and",
"other",
"modules"
] | 644e4a8ea9859fc30fee36705e54784acd8d43e2 | https://github.com/Craftsware/scissor/blob/644e4a8ea9859fc30fee36705e54784acd8d43e2/src/Module.php#L181-L212 |
18,541 | LUSHDigital/microservice-model-utils | src/Traits/MicroServiceCacheTrait.php | MicroServiceCacheTrait.getModelCacheKeys | public function getModelCacheKeys(Cacheable $model)
{
// Build list of cache keys we need to clear.
$cacheKeys = [
implode(':', [$model->getTable(), 'index']),
];
// If the model has an primary key add the cache key.
if (!empty($model->getPrimaryKeyValue())) {
... | php | public function getModelCacheKeys(Cacheable $model)
{
// Build list of cache keys we need to clear.
$cacheKeys = [
implode(':', [$model->getTable(), 'index']),
];
// If the model has an primary key add the cache key.
if (!empty($model->getPrimaryKeyValue())) {
... | [
"public",
"function",
"getModelCacheKeys",
"(",
"Cacheable",
"$",
"model",
")",
"{",
"// Build list of cache keys we need to clear.",
"$",
"cacheKeys",
"=",
"[",
"implode",
"(",
"':'",
",",
"[",
"$",
"model",
"->",
"getTable",
"(",
")",
",",
"'index'",
"]",
")... | Get an array of possible cache keys for the given model.
@param Cacheable $model
@return array|bool | [
"Get",
"an",
"array",
"of",
"possible",
"cache",
"keys",
"for",
"the",
"given",
"model",
"."
] | 37a6e3b5f326ab120bb31262fa596e6e3cc20832 | https://github.com/LUSHDigital/microservice-model-utils/blob/37a6e3b5f326ab120bb31262fa596e6e3cc20832/src/Traits/MicroServiceCacheTrait.php#L27-L43 |
18,542 | LUSHDigital/microservice-model-utils | src/Traits/MicroServiceCacheTrait.php | MicroServiceCacheTrait.cacheForget | public function cacheForget(Cacheable $model)
{
// Clear the cache for each key.
foreach ($this->getModelCacheKeys($model) as $cacheKey) {
Cache::forget($cacheKey);
}
return true;
} | php | public function cacheForget(Cacheable $model)
{
// Clear the cache for each key.
foreach ($this->getModelCacheKeys($model) as $cacheKey) {
Cache::forget($cacheKey);
}
return true;
} | [
"public",
"function",
"cacheForget",
"(",
"Cacheable",
"$",
"model",
")",
"{",
"// Clear the cache for each key.",
"foreach",
"(",
"$",
"this",
"->",
"getModelCacheKeys",
"(",
"$",
"model",
")",
"as",
"$",
"cacheKey",
")",
"{",
"Cache",
"::",
"forget",
"(",
... | Attempt to forget items from the cache for a given model.
@param Cacheable $model
@return bool | [
"Attempt",
"to",
"forget",
"items",
"from",
"the",
"cache",
"for",
"a",
"given",
"model",
"."
] | 37a6e3b5f326ab120bb31262fa596e6e3cc20832 | https://github.com/LUSHDigital/microservice-model-utils/blob/37a6e3b5f326ab120bb31262fa596e6e3cc20832/src/Traits/MicroServiceCacheTrait.php#L51-L59 |
18,543 | LUSHDigital/microservice-model-utils | src/Traits/MicroServiceCacheTrait.php | MicroServiceCacheTrait.addAttributeCacheKeys | protected function addAttributeCacheKeys(array &$cacheKeys, Cacheable $model)
{
// Add a cache key for each attribute marked as a cache key.
foreach ($model->getAttributeCacheKeys() as $attributeCacheKey) {
$origAttributeValue = $this->getOriginalCacheKeyValue($model, $attributeCacheKey)... | php | protected function addAttributeCacheKeys(array &$cacheKeys, Cacheable $model)
{
// Add a cache key for each attribute marked as a cache key.
foreach ($model->getAttributeCacheKeys() as $attributeCacheKey) {
$origAttributeValue = $this->getOriginalCacheKeyValue($model, $attributeCacheKey)... | [
"protected",
"function",
"addAttributeCacheKeys",
"(",
"array",
"&",
"$",
"cacheKeys",
",",
"Cacheable",
"$",
"model",
")",
"{",
"// Add a cache key for each attribute marked as a cache key.",
"foreach",
"(",
"$",
"model",
"->",
"getAttributeCacheKeys",
"(",
")",
"as",
... | Add cache keys for each attribute of a given model.
@param array $cacheKeys
@param Cacheable $model | [
"Add",
"cache",
"keys",
"for",
"each",
"attribute",
"of",
"a",
"given",
"model",
"."
] | 37a6e3b5f326ab120bb31262fa596e6e3cc20832 | https://github.com/LUSHDigital/microservice-model-utils/blob/37a6e3b5f326ab120bb31262fa596e6e3cc20832/src/Traits/MicroServiceCacheTrait.php#L67-L90 |
18,544 | LUSHDigital/microservice-model-utils | src/Traits/MicroServiceCacheTrait.php | MicroServiceCacheTrait.getCollectionAttributeCacheKeys | protected function getCollectionAttributeCacheKeys(array &$cacheKeys, Cacheable $model, $attribute, $collection)
{
foreach ($collection as $item) {
if (isset($item->id)) {
$cacheKeys[] = implode(':', [$model->getTable(), $attribute, $item->id]);
}
}
} | php | protected function getCollectionAttributeCacheKeys(array &$cacheKeys, Cacheable $model, $attribute, $collection)
{
foreach ($collection as $item) {
if (isset($item->id)) {
$cacheKeys[] = implode(':', [$model->getTable(), $attribute, $item->id]);
}
}
} | [
"protected",
"function",
"getCollectionAttributeCacheKeys",
"(",
"array",
"&",
"$",
"cacheKeys",
",",
"Cacheable",
"$",
"model",
",",
"$",
"attribute",
",",
"$",
"collection",
")",
"{",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"item",
")",
"{",
"if",
... | Get the attribute cache keys from a collection attribute.
@param array $cacheKeys
@param Cacheable $model
@param $attribute
@param $collection | [
"Get",
"the",
"attribute",
"cache",
"keys",
"from",
"a",
"collection",
"attribute",
"."
] | 37a6e3b5f326ab120bb31262fa596e6e3cc20832 | https://github.com/LUSHDigital/microservice-model-utils/blob/37a6e3b5f326ab120bb31262fa596e6e3cc20832/src/Traits/MicroServiceCacheTrait.php#L100-L107 |
18,545 | LUSHDigital/microservice-model-utils | src/Traits/MicroServiceCacheTrait.php | MicroServiceCacheTrait.getOriginalCacheKeyValue | protected function getOriginalCacheKeyValue(Cacheable $model, $attributeCacheKey)
{
// Bail out if the model is not an eloquent model.
if (!$model instanceof Model) {
return null;
}
return empty($model->getOriginal($attributeCacheKey)) ? null : $model->getOriginal($attri... | php | protected function getOriginalCacheKeyValue(Cacheable $model, $attributeCacheKey)
{
// Bail out if the model is not an eloquent model.
if (!$model instanceof Model) {
return null;
}
return empty($model->getOriginal($attributeCacheKey)) ? null : $model->getOriginal($attri... | [
"protected",
"function",
"getOriginalCacheKeyValue",
"(",
"Cacheable",
"$",
"model",
",",
"$",
"attributeCacheKey",
")",
"{",
"// Bail out if the model is not an eloquent model.",
"if",
"(",
"!",
"$",
"model",
"instanceof",
"Model",
")",
"{",
"return",
"null",
";",
... | Get original cache key value.
@param Cacheable $model
@param $attributeCacheKey
@return mixed|null | [
"Get",
"original",
"cache",
"key",
"value",
"."
] | 37a6e3b5f326ab120bb31262fa596e6e3cc20832 | https://github.com/LUSHDigital/microservice-model-utils/blob/37a6e3b5f326ab120bb31262fa596e6e3cc20832/src/Traits/MicroServiceCacheTrait.php#L116-L124 |
18,546 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.getName | public function getName()
{
$fqdnClassName = get_class($this);
$className = substr($fqdnClassName, strrpos($fqdnClassName, '\\') + 1);
return str_replace("Service", "", $className);
} | php | public function getName()
{
$fqdnClassName = get_class($this);
$className = substr($fqdnClassName, strrpos($fqdnClassName, '\\') + 1);
return str_replace("Service", "", $className);
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"$",
"fqdnClassName",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"className",
"=",
"substr",
"(",
"$",
"fqdnClassName",
",",
"strrpos",
"(",
"$",
"fqdnClassName",
",",
"'\\\\'",
")",
"+",
"1",
")"... | Returns base entity name
@return string | [
"Returns",
"base",
"entity",
"name"
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L58-L63 |
18,547 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.findEntities | public function findEntities(Request $request, $filters = array(), $addPagination = false)
{
$options = $this->getOptions($request, $filters, $addPagination);
if (!$addPagination) {
return array(
'entities' => $this->getRepository()->getEntities($options),
... | php | public function findEntities(Request $request, $filters = array(), $addPagination = false)
{
$options = $this->getOptions($request, $filters, $addPagination);
if (!$addPagination) {
return array(
'entities' => $this->getRepository()->getEntities($options),
... | [
"public",
"function",
"findEntities",
"(",
"Request",
"$",
"request",
",",
"$",
"filters",
"=",
"array",
"(",
")",
",",
"$",
"addPagination",
"=",
"false",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
"$",
"request",
",",
"$",
... | Returns a list of entities.
@param \Symfony\Component\HttpFoundation\Request $request
@param array $filters
@param bool $addPagination
@return array | [
"Returns",
"a",
"list",
"of",
"entities",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L115-L133 |
18,548 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.saveEntity | public function saveEntity($entity)
{
if (!$this->entityManager->contains($entity)) {
$this->entityManager->persist($entity);
}
$this->entityManager->flush();
return true;
} | php | public function saveEntity($entity)
{
if (!$this->entityManager->contains($entity)) {
$this->entityManager->persist($entity);
}
$this->entityManager->flush();
return true;
} | [
"public",
"function",
"saveEntity",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"entityManager",
"->",
"contains",
"(",
"$",
"entity",
")",
")",
"{",
"$",
"this",
"->",
"entityManager",
"->",
"persist",
"(",
"$",
"entity",
")",
"... | Saves the entity.
@param object $entity
@return bool | [
"Saves",
"the",
"entity",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L169-L177 |
18,549 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.removeEntity | public function removeEntity($entity)
{
$this->entityManager->remove($entity);
$this->entityManager->flush();
return true;
} | php | public function removeEntity($entity)
{
$this->entityManager->remove($entity);
$this->entityManager->flush();
return true;
} | [
"public",
"function",
"removeEntity",
"(",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"entityManager",
"->",
"remove",
"(",
"$",
"entity",
")",
";",
"$",
"this",
"->",
"entityManager",
"->",
"flush",
"(",
")",
";",
"return",
"true",
";",
"}"
] | Removes the entity.
@param object $entity
@return bool | [
"Removes",
"the",
"entity",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L185-L190 |
18,550 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.removeEntities | public function removeEntities(array $ids)
{
foreach ($this->getRepository()->getEntitiesById($ids) as $entity) {
$this->entityManager->remove($entity);
}
$this->entityManager->flush();
return true;
} | php | public function removeEntities(array $ids)
{
foreach ($this->getRepository()->getEntitiesById($ids) as $entity) {
$this->entityManager->remove($entity);
}
$this->entityManager->flush();
return true;
} | [
"public",
"function",
"removeEntities",
"(",
"array",
"$",
"ids",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"getEntitiesById",
"(",
"$",
"ids",
")",
"as",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"entityManager",
... | Removes a list of entities.
@param array $ids
@return bool | [
"Removes",
"a",
"list",
"of",
"entities",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L198-L207 |
18,551 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.getFilters | public function getFilters(Request $request, $overrideFilters = array(), $ignoreSession = false)
{
if ($ignoreSession) {
return array_replace(
$this->getFiltersFromRequest($request),
$overrideFilters
);
}
$filters = array_replace(
... | php | public function getFilters(Request $request, $overrideFilters = array(), $ignoreSession = false)
{
if ($ignoreSession) {
return array_replace(
$this->getFiltersFromRequest($request),
$overrideFilters
);
}
$filters = array_replace(
... | [
"public",
"function",
"getFilters",
"(",
"Request",
"$",
"request",
",",
"$",
"overrideFilters",
"=",
"array",
"(",
")",
",",
"$",
"ignoreSession",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"ignoreSession",
")",
"{",
"return",
"array_replace",
"(",
"$",
"t... | Returns the current filters for the entity, if any.
@param \Symfony\Component\HttpFoundation\Request $request
@param array $overrideFilters
@param bool $ignoreSession
@return array | [
"Returns",
"the",
"current",
"filters",
"for",
"the",
"entity",
"if",
"any",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L217-L234 |
18,552 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.getSorting | public function getSorting(Request $request, $ignoreSession = false)
{
if ($ignoreSession) {
return $this->getSortingFromRequest($request);
}
$sorting = array_replace(
$this->getSortingFromSession($request->getSession()),
$this->getSortingFromRequest($req... | php | public function getSorting(Request $request, $ignoreSession = false)
{
if ($ignoreSession) {
return $this->getSortingFromRequest($request);
}
$sorting = array_replace(
$this->getSortingFromSession($request->getSession()),
$this->getSortingFromRequest($req... | [
"public",
"function",
"getSorting",
"(",
"Request",
"$",
"request",
",",
"$",
"ignoreSession",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"ignoreSession",
")",
"{",
"return",
"$",
"this",
"->",
"getSortingFromRequest",
"(",
"$",
"request",
")",
";",
"}",
"$... | Returns the current sorting options for the entity.
@param \Symfony\Component\HttpFoundation\Request $request
@param bool $ignoreSession
@return array | [
"Returns",
"the",
"current",
"sorting",
"options",
"for",
"the",
"entity",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L243-L256 |
18,553 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.addFilter | public function addFilter(SessionInterface $session, $filterName, $filterValue, $overwrite = true)
{
if (!$overwrite && $this->hasFilter($session, $filterName)) {
return;
}
$session->set($this->getFilterPrefix() . $filterName, $filterValue);
} | php | public function addFilter(SessionInterface $session, $filterName, $filterValue, $overwrite = true)
{
if (!$overwrite && $this->hasFilter($session, $filterName)) {
return;
}
$session->set($this->getFilterPrefix() . $filterName, $filterValue);
} | [
"public",
"function",
"addFilter",
"(",
"SessionInterface",
"$",
"session",
",",
"$",
"filterName",
",",
"$",
"filterValue",
",",
"$",
"overwrite",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"overwrite",
"&&",
"$",
"this",
"->",
"hasFilter",
"(",
"$",
... | Adds a single filter to the session; set the `overwrite` flag to `false`
if you want to preserve an already existing value.
@param \Symfony\Component\HttpFoundation\Session\SessionInterface $session
@param string $filterName
@param mixed $filterValue
@param boolean $overwrite | [
"Adds",
"a",
"single",
"filter",
"to",
"the",
"session",
";",
"set",
"the",
"overwrite",
"flag",
"to",
"false",
"if",
"you",
"want",
"to",
"preserve",
"an",
"already",
"existing",
"value",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L279-L286 |
18,554 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.saveFilters | protected function saveFilters(SessionInterface $session, array $filters)
{
$this->saveValues($filters, $this->getFilterPrefix(), $session);
} | php | protected function saveFilters(SessionInterface $session, array $filters)
{
$this->saveValues($filters, $this->getFilterPrefix(), $session);
} | [
"protected",
"function",
"saveFilters",
"(",
"SessionInterface",
"$",
"session",
",",
"array",
"$",
"filters",
")",
"{",
"$",
"this",
"->",
"saveValues",
"(",
"$",
"filters",
",",
"$",
"this",
"->",
"getFilterPrefix",
"(",
")",
",",
"$",
"session",
")",
... | Saves the filters inside the session.
@param \Symfony\Component\HttpFoundation\Session\SessionInterface $session
@param array $filters | [
"Saves",
"the",
"filters",
"inside",
"the",
"session",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L305-L308 |
18,555 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.getFiltersFromRequest | protected function getFiltersFromRequest(Request $request)
{
return $this->extractValues($this->getValuesFromRequest($request), $this->getFilterPrefix());
} | php | protected function getFiltersFromRequest(Request $request)
{
return $this->extractValues($this->getValuesFromRequest($request), $this->getFilterPrefix());
} | [
"protected",
"function",
"getFiltersFromRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"return",
"$",
"this",
"->",
"extractValues",
"(",
"$",
"this",
"->",
"getValuesFromRequest",
"(",
"$",
"request",
")",
",",
"$",
"this",
"->",
"getFilterPrefix",
"(",
... | Returns the filters from the request.
@param \Symfony\Component\HttpFoundation\Request $request
@return array | [
"Returns",
"the",
"filters",
"from",
"the",
"request",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L347-L350 |
18,556 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.getSortingFromRequest | protected function getSortingFromRequest(Request $request)
{
return $this->extractValues($this->getValuesFromRequest($request), $this->getSortingPrefix());
} | php | protected function getSortingFromRequest(Request $request)
{
return $this->extractValues($this->getValuesFromRequest($request), $this->getSortingPrefix());
} | [
"protected",
"function",
"getSortingFromRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"return",
"$",
"this",
"->",
"extractValues",
"(",
"$",
"this",
"->",
"getValuesFromRequest",
"(",
"$",
"request",
")",
",",
"$",
"this",
"->",
"getSortingPrefix",
"(",... | Returns the sorting options from the request.
@param \Symfony\Component\HttpFoundation\Request $request
@return array | [
"Returns",
"the",
"sorting",
"options",
"from",
"the",
"request",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L369-L372 |
18,557 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.getValuesFromRequest | private function getValuesFromRequest(Request $request)
{
$values = array_merge($request->query->all(), $request->request->all());
$contentValues = json_decode($request->getContent(), true);
if (is_array($contentValues)) {
$values = array_merge($values, $contentValues);
}... | php | private function getValuesFromRequest(Request $request)
{
$values = array_merge($request->query->all(), $request->request->all());
$contentValues = json_decode($request->getContent(), true);
if (is_array($contentValues)) {
$values = array_merge($values, $contentValues);
}... | [
"private",
"function",
"getValuesFromRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"values",
"=",
"array_merge",
"(",
"$",
"request",
"->",
"query",
"->",
"all",
"(",
")",
",",
"$",
"request",
"->",
"request",
"->",
"all",
"(",
")",
")",
";"... | Returns the values of the options from the request.
@param \Symfony\Component\HttpFoundation\Request $request
@return array | [
"Returns",
"the",
"values",
"of",
"the",
"options",
"from",
"the",
"request",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L423-L432 |
18,558 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.extractValues | private function extractValues(array $values, $prefix, $removePrefixFromKeys = true)
{
if (empty($values)) {
return array();
}
$validKeys = array_filter(array_keys($values), function($name) use ($prefix) {
return (0 === strpos($name, $prefix));
});
$... | php | private function extractValues(array $values, $prefix, $removePrefixFromKeys = true)
{
if (empty($values)) {
return array();
}
$validKeys = array_filter(array_keys($values), function($name) use ($prefix) {
return (0 === strpos($name, $prefix));
});
$... | [
"private",
"function",
"extractValues",
"(",
"array",
"$",
"values",
",",
"$",
"prefix",
",",
"$",
"removePrefixFromKeys",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"values",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"vali... | Returns all the key-value pairs from the array whose key has the specified prefix.
@param array $values
@param string $prefix
@param bool $removePrefixFromKeys
@return array | [
"Returns",
"all",
"the",
"key",
"-",
"value",
"pairs",
"from",
"the",
"array",
"whose",
"key",
"has",
"the",
"specified",
"prefix",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L442-L462 |
18,559 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.saveValues | private function saveValues(array $values, $prefix, SessionInterface $session)
{
foreach ($values as $name => $value) {
$session->set($prefix . $name, $value);
}
} | php | private function saveValues(array $values, $prefix, SessionInterface $session)
{
foreach ($values as $name => $value) {
$session->set($prefix . $name, $value);
}
} | [
"private",
"function",
"saveValues",
"(",
"array",
"$",
"values",
",",
"$",
"prefix",
",",
"SessionInterface",
"$",
"session",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"session",
"->",
"set",
"(",
... | Saves into the session all the key-value pairs from the array, adding to their keys the specified prefix.
@param array $values
@param string $prefix
@param \Symfony\Component\HttpFoundation\Session\SessionInterface $session | [
"Saves",
"into",
"the",
"session",
"all",
"the",
"key",
"-",
"value",
"pairs",
"from",
"the",
"array",
"adding",
"to",
"their",
"keys",
"the",
"specified",
"prefix",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L471-L476 |
18,560 | gibilogic/crud-bundle | Entity/EntityService.php | EntityService.removeValues | private function removeValues($prefix, SessionInterface $session)
{
foreach ($session->all() as $key => $value) {
if (0 === strpos($key, $prefix)) {
$session->remove($key);
}
}
} | php | private function removeValues($prefix, SessionInterface $session)
{
foreach ($session->all() as $key => $value) {
if (0 === strpos($key, $prefix)) {
$session->remove($key);
}
}
} | [
"private",
"function",
"removeValues",
"(",
"$",
"prefix",
",",
"SessionInterface",
"$",
"session",
")",
"{",
"foreach",
"(",
"$",
"session",
"->",
"all",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"0",
"===",
"strpos",
"(",... | Removes from the session all the key-value pairs whose key has the specified prefix.
@param string $prefix
@param \Symfony\Component\HttpFoundation\Session\SessionInterface $session | [
"Removes",
"from",
"the",
"session",
"all",
"the",
"key",
"-",
"value",
"pairs",
"whose",
"key",
"has",
"the",
"specified",
"prefix",
"."
] | 847e7c7bee4016026411eb230154f24986335633 | https://github.com/gibilogic/crud-bundle/blob/847e7c7bee4016026411eb230154f24986335633/Entity/EntityService.php#L484-L491 |
18,561 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.setCommandTimeout | public function setCommandTimeout($commandTimeout)
{
if ($commandTimeout !== null && ! is_numeric($commandTimeout)) {
throw new InvalidArgumentException('Timeout must be an integer.');
}
if (is_string($commandTimeout)) {
$commandTimeout = (int) $commandTimeout;
... | php | public function setCommandTimeout($commandTimeout)
{
if ($commandTimeout !== null && ! is_numeric($commandTimeout)) {
throw new InvalidArgumentException('Timeout must be an integer.');
}
if (is_string($commandTimeout)) {
$commandTimeout = (int) $commandTimeout;
... | [
"public",
"function",
"setCommandTimeout",
"(",
"$",
"commandTimeout",
")",
"{",
"if",
"(",
"$",
"commandTimeout",
"!==",
"null",
"&&",
"!",
"is_numeric",
"(",
"$",
"commandTimeout",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Timeout must ... | Set the command timeout.
@param int $commandTimeout
@return $this | [
"Set",
"the",
"command",
"timeout",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L165-L178 |
18,562 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.setRetryLimit | public function setRetryLimit($retryLimit = null)
{
if (! is_numeric($retryLimit) && ! is_null($retryLimit)) {
throw new InvalidArgumentException('Retry limit must be a number or null.');
}
if (is_string($retryLimit)) {
$retryLimit = (int) $retryLimit;
}
... | php | public function setRetryLimit($retryLimit = null)
{
if (! is_numeric($retryLimit) && ! is_null($retryLimit)) {
throw new InvalidArgumentException('Retry limit must be a number or null.');
}
if (is_string($retryLimit)) {
$retryLimit = (int) $retryLimit;
}
... | [
"public",
"function",
"setRetryLimit",
"(",
"$",
"retryLimit",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"retryLimit",
")",
"&&",
"!",
"is_null",
"(",
"$",
"retryLimit",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
... | Set the number of times to retry a command if it fails.
Set the limit to null to retry forever.
@param int|null $retryLimit
@return $this | [
"Set",
"the",
"number",
"of",
"times",
"to",
"retry",
"a",
"command",
"if",
"it",
"fails",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L199-L212 |
18,563 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.argument | final public function argument($key)
{
$result = null;
foreach ($this->shellArguments as $shellArgument) {
if ($shellArgument['key'] === $key) {
$result = $shellArgument;
break;
}
}
return $result;
} | php | final public function argument($key)
{
$result = null;
foreach ($this->shellArguments as $shellArgument) {
if ($shellArgument['key'] === $key) {
$result = $shellArgument;
break;
}
}
return $result;
} | [
"final",
"public",
"function",
"argument",
"(",
"$",
"key",
")",
"{",
"$",
"result",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"shellArguments",
"as",
"$",
"shellArgument",
")",
"{",
"if",
"(",
"$",
"shellArgument",
"[",
"'key'",
"]",
"===",... | Get a specific argument.
Return null if the argument isn't found.
@param $key
@return mixed | [
"Get",
"a",
"specific",
"argument",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L264-L277 |
18,564 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.updateArgument | final protected function updateArgument($key, $value)
{
foreach ($this->shellArguments as &$shellArgument) {
if ($shellArgument['key'] === $key) {
$shellArgument['value'] = $value;
break;
}
}
unset($shellArgument);
return $thi... | php | final protected function updateArgument($key, $value)
{
foreach ($this->shellArguments as &$shellArgument) {
if ($shellArgument['key'] === $key) {
$shellArgument['value'] = $value;
break;
}
}
unset($shellArgument);
return $thi... | [
"final",
"protected",
"function",
"updateArgument",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"shellArguments",
"as",
"&",
"$",
"shellArgument",
")",
"{",
"if",
"(",
"$",
"shellArgument",
"[",
"'key'",
"]",
"===",
... | Update the specific argument.
@param string $key
@param bool $value
@return $this | [
"Update",
"the",
"specific",
"argument",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L426-L438 |
18,565 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.updateOption | final protected function updateOption($flag, $enabled, $value = null, $remove = false)
{
$shellOption = $this->option($flag);
$shellOption->enable($enabled);
if ($shellOption->canHaveValue()) {
$this->updateOptionValue($shellOption, $value, $remove);
}
return $t... | php | final protected function updateOption($flag, $enabled, $value = null, $remove = false)
{
$shellOption = $this->option($flag);
$shellOption->enable($enabled);
if ($shellOption->canHaveValue()) {
$this->updateOptionValue($shellOption, $value, $remove);
}
return $t... | [
"final",
"protected",
"function",
"updateOption",
"(",
"$",
"flag",
",",
"$",
"enabled",
",",
"$",
"value",
"=",
"null",
",",
"$",
"remove",
"=",
"false",
")",
"{",
"$",
"shellOption",
"=",
"$",
"this",
"->",
"option",
"(",
"$",
"flag",
")",
";",
"... | Update an option.
@param string $flag
@param bool $enabled
@param bool $value
@param bool $remove
@return $this | [
"Update",
"an",
"option",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L450-L460 |
18,566 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.setShellCommand | private function setShellCommand($command)
{
if (! isset($command)) {
throw new InvalidArgumentException('Must define a command.');
}
if (isset($this->shellCommand) && $this->shellCommand !== $command) {
throw new LogicException('Cannot redefine command once set!');
... | php | private function setShellCommand($command)
{
if (! isset($command)) {
throw new InvalidArgumentException('Must define a command.');
}
if (isset($this->shellCommand) && $this->shellCommand !== $command) {
throw new LogicException('Cannot redefine command once set!');
... | [
"private",
"function",
"setShellCommand",
"(",
"$",
"command",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"command",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Must define a command.'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
... | Set the command to execute.
The command can only be set once.
@param $command
@return $this | [
"Set",
"the",
"command",
"to",
"execute",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L481-L494 |
18,567 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.defineArgument | private function defineArgument($key)
{
$shellArgumentFound = false;
foreach ($this->shellArguments as $shellArgument) {
if ($shellArgument['key'] === $key) {
$shellArgumentFound = true;
}
}
if (! $shellArgumentFound) {
array_push(... | php | private function defineArgument($key)
{
$shellArgumentFound = false;
foreach ($this->shellArguments as $shellArgument) {
if ($shellArgument['key'] === $key) {
$shellArgumentFound = true;
}
}
if (! $shellArgumentFound) {
array_push(... | [
"private",
"function",
"defineArgument",
"(",
"$",
"key",
")",
"{",
"$",
"shellArgumentFound",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"shellArguments",
"as",
"$",
"shellArgument",
")",
"{",
"if",
"(",
"$",
"shellArgument",
"[",
"'key'",
"]",... | Set an argument for the command.
@param string $key
@return $this | [
"Set",
"an",
"argument",
"for",
"the",
"command",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L527-L541 |
18,568 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.updateOptionValue | private function updateOptionValue(ShellOption $shellOption, $value = null, $remove = false)
{
if ($remove) {
$shellOption->removeValue($value);
} else {
$shellOption->addValue($value);
}
} | php | private function updateOptionValue(ShellOption $shellOption, $value = null, $remove = false)
{
if ($remove) {
$shellOption->removeValue($value);
} else {
$shellOption->addValue($value);
}
} | [
"private",
"function",
"updateOptionValue",
"(",
"ShellOption",
"$",
"shellOption",
",",
"$",
"value",
"=",
"null",
",",
"$",
"remove",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"remove",
")",
"{",
"$",
"shellOption",
"->",
"removeValue",
"(",
"$",
"value"... | Update the value for an option.
@param ShellOption $shellOption
@param mixed|null $value
@param bool|false $remove | [
"Update",
"the",
"value",
"for",
"an",
"option",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L564-L571 |
18,569 | trafficgate/shell-command | src/ShellCommand.php | ShellCommand.compile | private function compile()
{
$shellOptions = [];
/** @var ShellOption $shellOption */
foreach ($this->shellOptions as $shellOption) {
$shellOptions = array_merge($shellOptions, $shellOption->getArray());
}
$shellArguments = [];
foreach ($this->shellArgume... | php | private function compile()
{
$shellOptions = [];
/** @var ShellOption $shellOption */
foreach ($this->shellOptions as $shellOption) {
$shellOptions = array_merge($shellOptions, $shellOption->getArray());
}
$shellArguments = [];
foreach ($this->shellArgume... | [
"private",
"function",
"compile",
"(",
")",
"{",
"$",
"shellOptions",
"=",
"[",
"]",
";",
"/** @var ShellOption $shellOption */",
"foreach",
"(",
"$",
"this",
"->",
"shellOptions",
"as",
"$",
"shellOption",
")",
"{",
"$",
"shellOptions",
"=",
"array_merge",
"(... | Compile the parts of the command.
@return Process | [
"Compile",
"the",
"parts",
"of",
"the",
"command",
"."
] | 1a5f3fcf689f33098b192c34839effe309202c0e | https://github.com/trafficgate/shell-command/blob/1a5f3fcf689f33098b192c34839effe309202c0e/src/ShellCommand.php#L578-L600 |
18,570 | forxer/tao | src/Tao/Templating/Helpers/Modifier.php | Modifier.nlToP | public function nlToP($string)
{
$string = trim($string);
$string = Modifiers::linebreaks($string);
$string = str_replace("\n", "</p>\n<p>", $string);
$string = str_replace('<p></p>', '', $string);
return '<p>' . $string . '</p>' . PHP_EOL;
} | php | public function nlToP($string)
{
$string = trim($string);
$string = Modifiers::linebreaks($string);
$string = str_replace("\n", "</p>\n<p>", $string);
$string = str_replace('<p></p>', '', $string);
return '<p>' . $string . '</p>' . PHP_EOL;
} | [
"public",
"function",
"nlToP",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"trim",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"Modifiers",
"::",
"linebreaks",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"str_replace",
"(",
"\"\\n\"... | Converts text line breaks into HTML paragraphs.
@param string $string String to transform
@return string | [
"Converts",
"text",
"line",
"breaks",
"into",
"HTML",
"paragraphs",
"."
] | b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/Modifier.php#L29-L36 |
18,571 | forxer/tao | src/Tao/Templating/Helpers/Modifier.php | Modifier.nlToPbr | public function nlToPbr($string)
{
$string = trim($string);
$string = Modifiers::linebreaks($string);
$string = str_replace("\n", '<br />', $string);
$string = str_replace('<br /><br />', "</p>\n<p>", $string);
$string = str_replace('<p></p>', '', $string);
return '<p>' . $string . '</p>' . PHP_EOL;
} | php | public function nlToPbr($string)
{
$string = trim($string);
$string = Modifiers::linebreaks($string);
$string = str_replace("\n", '<br />', $string);
$string = str_replace('<br /><br />', "</p>\n<p>", $string);
$string = str_replace('<p></p>', '', $string);
return '<p>' . $string . '</p>' . PHP_EOL;
} | [
"public",
"function",
"nlToPbr",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"trim",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"Modifiers",
"::",
"linebreaks",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"str_replace",
"(",
"\"\\n... | Converts text line breaks into HTML paragraphs and HTML line breaks.
@param string $string String to transform
@return string | [
"Converts",
"text",
"line",
"breaks",
"into",
"HTML",
"paragraphs",
"and",
"HTML",
"line",
"breaks",
"."
] | b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/Modifier.php#L44-L52 |
18,572 | forxer/tao | src/Tao/Templating/Helpers/Modifier.php | Modifier.emailEncode | public static function emailEncode($sEmail)
{
$sEmail = bin2hex($sEmail);
$sEmail = chunk_split($sEmail, 2, '%');
$sEmail = '%' . substr($sEmail, 0, strlen($sEmail) - 1);
return $sEmail;
} | php | public static function emailEncode($sEmail)
{
$sEmail = bin2hex($sEmail);
$sEmail = chunk_split($sEmail, 2, '%');
$sEmail = '%' . substr($sEmail, 0, strlen($sEmail) - 1);
return $sEmail;
} | [
"public",
"static",
"function",
"emailEncode",
"(",
"$",
"sEmail",
")",
"{",
"$",
"sEmail",
"=",
"bin2hex",
"(",
"$",
"sEmail",
")",
";",
"$",
"sEmail",
"=",
"chunk_split",
"(",
"$",
"sEmail",
",",
"2",
",",
"'%'",
")",
";",
"$",
"sEmail",
"=",
"'%... | Encode an email address for HTML.
@param string $sEmail
@return string encoded email | [
"Encode",
"an",
"email",
"address",
"for",
"HTML",
"."
] | b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/Modifier.php#L60-L66 |
18,573 | jenwachter/html-form | src/Abstracts/Addable.php | Addable.findClass | protected function findClass($method)
{
if (!preg_match("/^add([a-zA-Z]+)/", $method, $matches)) {
return false;
}
$className = "\\HtmlForm\\Elements\\{$matches[1]}";
if (!class_exists($className)) {
return false;
}
return $className;
} | php | protected function findClass($method)
{
if (!preg_match("/^add([a-zA-Z]+)/", $method, $matches)) {
return false;
}
$className = "\\HtmlForm\\Elements\\{$matches[1]}";
if (!class_exists($className)) {
return false;
}
return $className;
} | [
"protected",
"function",
"findClass",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"\"/^add([a-zA-Z]+)/\"",
",",
"$",
"method",
",",
"$",
"matches",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"className",
"=",
"\"\\\\HtmlForm\\\\E... | Based on a passed method name, figure out
if there is a cooresponding HtmlForm element.
@param string $method Called method
@return string Class name (if there is one) | [
"Based",
"on",
"a",
"passed",
"method",
"name",
"figure",
"out",
"if",
"there",
"is",
"a",
"cooresponding",
"HtmlForm",
"element",
"."
] | eaece87d474f7da5c25679548fb8f1608a94303c | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Abstracts/Addable.php#L40-L53 |
18,574 | atkrad/data-tables | src/Table.php | Table.setDataSource | public function setDataSource(DataSourceInterface $dataSource)
{
$this->dataSource = $dataSource;
$this->dataSource->initialize($this);
} | php | public function setDataSource(DataSourceInterface $dataSource)
{
$this->dataSource = $dataSource;
$this->dataSource->initialize($this);
} | [
"public",
"function",
"setDataSource",
"(",
"DataSourceInterface",
"$",
"dataSource",
")",
"{",
"$",
"this",
"->",
"dataSource",
"=",
"$",
"dataSource",
";",
"$",
"this",
"->",
"dataSource",
"->",
"initialize",
"(",
"$",
"this",
")",
";",
"}"
] | Set Table data source
@param DataSourceInterface $dataSource DataSource object | [
"Set",
"Table",
"data",
"source"
] | 5afcc337ab624ca626e29d9674459c5105982b16 | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Table.php#L101-L105 |
18,575 | atkrad/data-tables | src/Table.php | Table.addColumn | public function addColumn(Column $column)
{
$this->columns[] = $column;
if ($column instanceof ColumnInterface) {
$column->initialize($this);
}
return $this;
} | php | public function addColumn(Column $column)
{
$this->columns[] = $column;
if ($column instanceof ColumnInterface) {
$column->initialize($this);
}
return $this;
} | [
"public",
"function",
"addColumn",
"(",
"Column",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"columns",
"[",
"]",
"=",
"$",
"column",
";",
"if",
"(",
"$",
"column",
"instanceof",
"ColumnInterface",
")",
"{",
"$",
"column",
"->",
"initialize",
"(",
"$"... | Add column to table
@param \DataTable\Column $column Column object
@return Table | [
"Add",
"column",
"to",
"table"
] | 5afcc337ab624ca626e29d9674459c5105982b16 | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Table.php#L161-L170 |
18,576 | atkrad/data-tables | src/Table.php | Table.setAjax | public function setAjax($ajax)
{
if (is_string($ajax)) {
$pattern = '/^(\s+)*(function)(\s+)*\(/i';
if (preg_match($pattern, $ajax, $matches) && strtolower($matches[2]) == 'function') {
$hash = sha1($ajax);
$this->properties['ajax'] = $hash;
... | php | public function setAjax($ajax)
{
if (is_string($ajax)) {
$pattern = '/^(\s+)*(function)(\s+)*\(/i';
if (preg_match($pattern, $ajax, $matches) && strtolower($matches[2]) == 'function') {
$hash = sha1($ajax);
$this->properties['ajax'] = $hash;
... | [
"public",
"function",
"setAjax",
"(",
"$",
"ajax",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"ajax",
")",
")",
"{",
"$",
"pattern",
"=",
"'/^(\\s+)*(function)(\\s+)*\\(/i'",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
"ajax",
",",
"$... | DataTables can obtain the data it is to display in the table table's body from a number of sources,
including from an Ajax data source, using this initialisation parameter. As with other dynamic data
sources, arrays or objects can be used for the data source for each row, with columns.dataDT
employed to read from speci... | [
"DataTables",
"can",
"obtain",
"the",
"data",
"it",
"is",
"to",
"display",
"in",
"the",
"table",
"table",
"s",
"body",
"from",
"a",
"number",
"of",
"sources",
"including",
"from",
"an",
"Ajax",
"data",
"source",
"using",
"this",
"initialisation",
"parameter"... | 5afcc337ab624ca626e29d9674459c5105982b16 | https://github.com/atkrad/data-tables/blob/5afcc337ab624ca626e29d9674459c5105982b16/src/Table.php#L513-L530 |
18,577 | freyo/flysystem-qcloud-cos-v3 | src/Client/Http.php | Http.send | public static function send($rq)
{
if (self::$_curlHandler) {
if (function_exists('curl_reset')) {
curl_reset(self::$_curlHandler);
} else {
my_curl_reset(self::$_curlHandler);
}
} else {
self::$_curlHandler = curl_init(... | php | public static function send($rq)
{
if (self::$_curlHandler) {
if (function_exists('curl_reset')) {
curl_reset(self::$_curlHandler);
} else {
my_curl_reset(self::$_curlHandler);
}
} else {
self::$_curlHandler = curl_init(... | [
"public",
"static",
"function",
"send",
"(",
"$",
"rq",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_curlHandler",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'curl_reset'",
")",
")",
"{",
"curl_reset",
"(",
"self",
"::",
"$",
"_curlHandler",
")",
";",
... | send http request.
@param array $rq http请求信息
url : 请求的url地址
method : 请求方法,'get', 'post', 'put', 'delete', 'head'
data : 请求数据,如有设置,则method为post
header : 需要设置的http头部
host : 请求头部host
timeout : 请求超时时间
cert : ca文件路径
ssl_version: SSL版本号
@return string http请求响应 | [
"send",
"http",
"request",
"."
] | 6bddbc22396aa1228942ec4c0ce46935d415f3b4 | https://github.com/freyo/flysystem-qcloud-cos-v3/blob/6bddbc22396aa1228942ec4c0ce46935d415f3b4/src/Client/Http.php#L34-L85 |
18,578 | praxisnetau/silverware-spam-guard | src/Extensions/UserFormExtension.php | UserFormExtension.updateForm | public function updateForm()
{
if ($userDefinedForm = $this->owner->getController()->data()) {
if ($userDefinedForm->EnableSpamGuard) {
$this->owner->enableSpamProtection();
}
}
} | php | public function updateForm()
{
if ($userDefinedForm = $this->owner->getController()->data()) {
if ($userDefinedForm->EnableSpamGuard) {
$this->owner->enableSpamProtection();
}
}
} | [
"public",
"function",
"updateForm",
"(",
")",
"{",
"if",
"(",
"$",
"userDefinedForm",
"=",
"$",
"this",
"->",
"owner",
"->",
"getController",
"(",
")",
"->",
"data",
"(",
")",
")",
"{",
"if",
"(",
"$",
"userDefinedForm",
"->",
"EnableSpamGuard",
")",
"... | Updates the extended user form instance.
@return void | [
"Updates",
"the",
"extended",
"user",
"form",
"instance",
"."
] | c5f8836a09141bd675173892a1e3d8c8cc8c1886 | https://github.com/praxisnetau/silverware-spam-guard/blob/c5f8836a09141bd675173892a1e3d8c8cc8c1886/src/Extensions/UserFormExtension.php#L38-L47 |
18,579 | narrowspark/http-status | src/HttpStatus.php | HttpStatus.getReasonMessage | public static function getReasonMessage(int $code): string
{
$code = static::filterStatusCode($code);
if (! isset(self::$errorPhrases[$code])) {
throw new OutOfBoundsException(\sprintf('Unknown http status code: `%s`.', $code));
}
return self::$errorPhrases[$code];
... | php | public static function getReasonMessage(int $code): string
{
$code = static::filterStatusCode($code);
if (! isset(self::$errorPhrases[$code])) {
throw new OutOfBoundsException(\sprintf('Unknown http status code: `%s`.', $code));
}
return self::$errorPhrases[$code];
... | [
"public",
"static",
"function",
"getReasonMessage",
"(",
"int",
"$",
"code",
")",
":",
"string",
"{",
"$",
"code",
"=",
"static",
"::",
"filterStatusCode",
"(",
"$",
"code",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"errorPhrases",
"["... | Get the message for a given status code.
@param int $code http status code
@throws \Narrowspark\HttpStatus\Exception\InvalidArgumentException If the requested $code is not valid
@throws \Narrowspark\HttpStatus\Exception\OutOfBoundsException If the requested $code is not found
@return string Returns message for t... | [
"Get",
"the",
"message",
"for",
"a",
"given",
"status",
"code",
"."
] | 127dcbf1fd02ca9c2a7451da7e3c4dd98c508cde | https://github.com/narrowspark/http-status/blob/127dcbf1fd02ca9c2a7451da7e3c4dd98c508cde/src/HttpStatus.php#L271-L280 |
18,580 | narrowspark/http-status | src/HttpStatus.php | HttpStatus.getReasonPhrase | public static function getReasonPhrase(int $code): string
{
$code = static::filterStatusCode($code);
if (! isset(self::$statusNames[$code])) {
throw new OutOfBoundsException(\sprintf('Unknown http status code: `%s`.', $code));
}
return self::$statusNames[$code];
} | php | public static function getReasonPhrase(int $code): string
{
$code = static::filterStatusCode($code);
if (! isset(self::$statusNames[$code])) {
throw new OutOfBoundsException(\sprintf('Unknown http status code: `%s`.', $code));
}
return self::$statusNames[$code];
} | [
"public",
"static",
"function",
"getReasonPhrase",
"(",
"int",
"$",
"code",
")",
":",
"string",
"{",
"$",
"code",
"=",
"static",
"::",
"filterStatusCode",
"(",
"$",
"code",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"statusNames",
"[",
... | Get the name for a given status code.
@param int $code http status code
@throws \Narrowspark\HttpStatus\Exception\InvalidArgumentException If the requested $code is not valid
@throws \Narrowspark\HttpStatus\Exception\OutOfBoundsException If the requested $code is not found
@return string Returns name for the giv... | [
"Get",
"the",
"name",
"for",
"a",
"given",
"status",
"code",
"."
] | 127dcbf1fd02ca9c2a7451da7e3c4dd98c508cde | https://github.com/narrowspark/http-status/blob/127dcbf1fd02ca9c2a7451da7e3c4dd98c508cde/src/HttpStatus.php#L292-L301 |
18,581 | GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.getLogCollection | public function getLogCollection($now, $then)
{
if (!file_exists($this->fileName)) {
throw new Exception("Access log file is not present - no traffic to report.", 1);
}
$collection = [];
$lines = file($this->fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
... | php | public function getLogCollection($now, $then)
{
if (!file_exists($this->fileName)) {
throw new Exception("Access log file is not present - no traffic to report.", 1);
}
$collection = [];
$lines = file($this->fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
... | [
"public",
"function",
"getLogCollection",
"(",
"$",
"now",
",",
"$",
"then",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"fileName",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Access log file is not present - no traffic to report.\"... | Get the log collection based on time
@param int $now
@param int $then
@return Illuminate\Support\Collection | [
"Get",
"the",
"log",
"collection",
"based",
"on",
"time"
] | 4e85f0b729329783b34e35d90abba2807899ff58 | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L42-L59 |
18,582 | GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.processLogStats | public function processLogStats($collection)
{
$validLogs = $collection->filter(function ($line) {
return $this->validateLine($line);
});
$sentBytes = $validLogs->pluck('sentBytes');
$stats = [
'hits' => $validLogs->count(),
'total_data_sent' => ... | php | public function processLogStats($collection)
{
$validLogs = $collection->filter(function ($line) {
return $this->validateLine($line);
});
$sentBytes = $validLogs->pluck('sentBytes');
$stats = [
'hits' => $validLogs->count(),
'total_data_sent' => ... | [
"public",
"function",
"processLogStats",
"(",
"$",
"collection",
")",
"{",
"$",
"validLogs",
"=",
"$",
"collection",
"->",
"filter",
"(",
"function",
"(",
"$",
"line",
")",
"{",
"return",
"$",
"this",
"->",
"validateLine",
"(",
"$",
"line",
")",
";",
"... | Process the log stats
@param Collection $collection
@return array | [
"Process",
"the",
"log",
"stats"
] | 4e85f0b729329783b34e35d90abba2807899ff58 | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L68-L85 |
18,583 | GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.sortByField | public function sortByField($field, $collection)
{
if ($collection->isEmpty()) {
return 'N/A';
}
return $collection->groupBy($field)->sortByDesc(function ($logs) {
return count($logs);
})->first()->pluck($field)->first();
} | php | public function sortByField($field, $collection)
{
if ($collection->isEmpty()) {
return 'N/A';
}
return $collection->groupBy($field)->sortByDesc(function ($logs) {
return count($logs);
})->first()->pluck($field)->first();
} | [
"public",
"function",
"sortByField",
"(",
"$",
"field",
",",
"$",
"collection",
")",
"{",
"if",
"(",
"$",
"collection",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"'N/A'",
";",
"}",
"return",
"$",
"collection",
"->",
"groupBy",
"(",
"$",
"field",
... | Sort data by field
@param string $field
@param Collection $collection
@return Collection | [
"Sort",
"data",
"by",
"field"
] | 4e85f0b729329783b34e35d90abba2807899ff58 | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L95-L104 |
18,584 | GrafiteInc/Mission-Control-Package | src/Analyzers/TrafficAnalyzer.php | TrafficAnalyzer.validateLine | public function validateLine($line)
{
$invalidExtensions = [
'.jpg',
'.js',
'.css',
'.sass',
'.scss',
'.png',
'.svg',
'.ico',
'.jpeg',
'.gif',
'.mp4',
];
forea... | php | public function validateLine($line)
{
$invalidExtensions = [
'.jpg',
'.js',
'.css',
'.sass',
'.scss',
'.png',
'.svg',
'.ico',
'.jpeg',
'.gif',
'.mp4',
];
forea... | [
"public",
"function",
"validateLine",
"(",
"$",
"line",
")",
"{",
"$",
"invalidExtensions",
"=",
"[",
"'.jpg'",
",",
"'.js'",
",",
"'.css'",
",",
"'.sass'",
",",
"'.scss'",
",",
"'.png'",
",",
"'.svg'",
",",
"'.ico'",
",",
"'.jpeg'",
",",
"'.gif'",
",",
... | Line object from logs
@param object $line
@return bool | [
"Line",
"object",
"from",
"logs"
] | 4e85f0b729329783b34e35d90abba2807899ff58 | https://github.com/GrafiteInc/Mission-Control-Package/blob/4e85f0b729329783b34e35d90abba2807899ff58/src/Analyzers/TrafficAnalyzer.php#L113-L140 |
18,585 | lode/fem | src/response.php | response.send_status | public static function send_status($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
http_response_code($code);
} | php | public static function send_status($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
http_response_code($code);
} | [
"public",
"static",
"function",
"send_status",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"status_messages",
"[",
"$",
"code",
"]",
")",
")",
"{",
"$",
"code",
"=",
"self",
"::",
"STATUS_INTERNAL_SERVER_ERROR",
";",
... | send a status code to the browser
@param int $code
@return void | [
"send",
"a",
"status",
"code",
"to",
"the",
"browser"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/response.php#L48-L54 |
18,586 | lode/fem | src/response.php | response.get_status_message | public static function get_status_message($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
$message = static::$status_messages[$code];
return $message;
} | php | public static function get_status_message($code) {
if (!isset(static::$status_messages[$code])) {
$code = self::STATUS_INTERNAL_SERVER_ERROR;
}
$message = static::$status_messages[$code];
return $message;
} | [
"public",
"static",
"function",
"get_status_message",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"status_messages",
"[",
"$",
"code",
"]",
")",
")",
"{",
"$",
"code",
"=",
"self",
"::",
"STATUS_INTERNAL_SERVER_ERROR",
... | get the describing message of the status code
@param int $code i.e. 404
@return string i.e. 'Not found' | [
"get",
"the",
"describing",
"message",
"of",
"the",
"status",
"code"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/response.php#L62-L69 |
18,587 | lode/fem | src/response.php | response.download | public static function download($output, $content_type='text/plain', $filename=null) {
$filename_postfix = ($filename) ? '; filename="'.$filename.'"' : '';
// force download
header('Content-Type: '.$content_type.'; charset=utf-8');
header('Content-Disposition: attachment'.$filename_postfix);
// write to browse... | php | public static function download($output, $content_type='text/plain', $filename=null) {
$filename_postfix = ($filename) ? '; filename="'.$filename.'"' : '';
// force download
header('Content-Type: '.$content_type.'; charset=utf-8');
header('Content-Disposition: attachment'.$filename_postfix);
// write to browse... | [
"public",
"static",
"function",
"download",
"(",
"$",
"output",
",",
"$",
"content_type",
"=",
"'text/plain'",
",",
"$",
"filename",
"=",
"null",
")",
"{",
"$",
"filename_postfix",
"=",
"(",
"$",
"filename",
")",
"?",
"'; filename=\"'",
".",
"$",
"filename... | force the user to download certain output
@param string $output
@param string $content_type optional, defaults to 'text/plain'
@param string $filename optional, suggested filename when saving downloaded content
@return void | [
"force",
"the",
"user",
"to",
"download",
"certain",
"output"
] | c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/response.php#L79-L88 |
18,588 | praxisnetau/silverware-spam-guard | src/Extensions/FormExtension.php | FormExtension.enableSpamProtection | public function enableSpamProtection($args = [])
{
// Obtain Spam Guard Instance:
if ($guard = $this->getSpamGuardInstance($args)) {
// Define Field Name and Title:
$name = isset($args['name']) ? $args['name'] : $guard->getDefaultName();
... | php | public function enableSpamProtection($args = [])
{
// Obtain Spam Guard Instance:
if ($guard = $this->getSpamGuardInstance($args)) {
// Define Field Name and Title:
$name = isset($args['name']) ? $args['name'] : $guard->getDefaultName();
... | [
"public",
"function",
"enableSpamProtection",
"(",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"// Obtain Spam Guard Instance:",
"if",
"(",
"$",
"guard",
"=",
"$",
"this",
"->",
"getSpamGuardInstance",
"(",
"$",
"args",
")",
")",
"{",
"// Define Field Name and Title:"... | Enables spam guard protection for the extended form.
@param array $args
@return Form | [
"Enables",
"spam",
"guard",
"protection",
"for",
"the",
"extended",
"form",
"."
] | c5f8836a09141bd675173892a1e3d8c8cc8c1886 | https://github.com/praxisnetau/silverware-spam-guard/blob/c5f8836a09141bd675173892a1e3d8c8cc8c1886/src/Extensions/FormExtension.php#L41-L89 |
18,589 | ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.fields | public function fields( $fields )
{
if ( !is_array( $fields ) && !is_null( $fields ) )
{
$fields = array( $fields );
}
// do nothing if we get nothing
if ( empty( $fields ) || $fields == array( '*' ) )
{
$this->fields = array(); return $this;
}
$this->fields = $fields;
// return self so ... | php | public function fields( $fields )
{
if ( !is_array( $fields ) && !is_null( $fields ) )
{
$fields = array( $fields );
}
// do nothing if we get nothing
if ( empty( $fields ) || $fields == array( '*' ) )
{
$this->fields = array(); return $this;
}
$this->fields = $fields;
// return self so ... | [
"public",
"function",
"fields",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
"&&",
"!",
"is_null",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"$",
"fields",
")",
";",
"}",
"// do not... | Set the select fields
@param array $values
@return self | [
"Set",
"the",
"select",
"fields"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L87-L104 |
18,590 | ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.add_fields | public function add_fields( $fields )
{
if ( !is_array( $fields ) )
{
$fields = array( $fields );
}
// merge the new values with the existing ones.
$this->fields = array_merge( $this->fields, $fields );
// return self so we can continue running the next function
return $this;
} | php | public function add_fields( $fields )
{
if ( !is_array( $fields ) )
{
$fields = array( $fields );
}
// merge the new values with the existing ones.
$this->fields = array_merge( $this->fields, $fields );
// return self so we can continue running the next function
return $this;
} | [
"public",
"function",
"add_fields",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
"=",
"array",
"(",
"$",
"fields",
")",
";",
"}",
"// merge the new values with the existing ones.",
"$",
"this",... | Add select fields
@param array $values
@return self | [
"Add",
"select",
"fields"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L112-L124 |
18,591 | ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.order_by | public function order_by( $cols, $order = 'asc' )
{
if ( !is_array( $cols ) )
{
$this->orders[] = array( $cols, $order ); return $this;
}
else
{
foreach( $cols as $key => $col )
{
if ( is_numeric( $key ) )
{
$this->orders[] = array( $col, $order );
}
else
{
$this... | php | public function order_by( $cols, $order = 'asc' )
{
if ( !is_array( $cols ) )
{
$this->orders[] = array( $cols, $order ); return $this;
}
else
{
foreach( $cols as $key => $col )
{
if ( is_numeric( $key ) )
{
$this->orders[] = array( $col, $order );
}
else
{
$this... | [
"public",
"function",
"order_by",
"(",
"$",
"cols",
",",
"$",
"order",
"=",
"'asc'",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"cols",
")",
")",
"{",
"$",
"this",
"->",
"orders",
"[",
"]",
"=",
"array",
"(",
"$",
"cols",
",",
"$",
"order"... | Set the order parameters
@param mixed $cols
@param string $order
@return self | [
"Set",
"the",
"order",
"parameters"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L133-L155 |
18,592 | ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.group_by | public function group_by( $key )
{
if ( !is_array( $key ) )
{
$key = array( $key );
}
foreach( $key as $group_key )
{
$this->groups[] = $group_key;
}
return $this;
} | php | public function group_by( $key )
{
if ( !is_array( $key ) )
{
$key = array( $key );
}
foreach( $key as $group_key )
{
$this->groups[] = $group_key;
}
return $this;
} | [
"public",
"function",
"group_by",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"key",
"=",
"array",
"(",
"$",
"key",
")",
";",
"}",
"foreach",
"(",
"$",
"key",
"as",
"$",
"group_key",
")",
"{",
"... | Add group by stuff
@param mixed $key By passing an array you can add multiple groups
@return self | [
"Add",
"group",
"by",
"stuff"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L163-L176 |
18,593 | ClanCats/Core | src/bundles/Database/Query/Select.php | Query_Select.column | public function column( $column, $name = null )
{
return $this->fields( $column )->one( $name )->$column;
} | php | public function column( $column, $name = null )
{
return $this->fields( $column )->one( $name )->$column;
} | [
"public",
"function",
"column",
"(",
"$",
"column",
",",
"$",
"name",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
"(",
"$",
"column",
")",
"->",
"one",
"(",
"$",
"name",
")",
"->",
"$",
"column",
";",
"}"
] | Just get a single value from the db
@param string $column
@param string $name
@return mixed | [
"Just",
"get",
"a",
"single",
"value",
"from",
"the",
"db"
] | 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Query/Select.php#L421-L424 |
18,594 | bosha/PTel | src/PTel.php | PTel.login | public function login($user, $pass, $maxtimeout = 10) {
try {
$this->expect('((U|u)ser|(L|l)ogin)((N|n)ame|)(:|)', $user);
$this->expect('(P|p)ass((W|w)ord|)(:|)', $pass);
} catch (TelnetException $e) {
throw new TelnetException('Could not find password request. Login... | php | public function login($user, $pass, $maxtimeout = 10) {
try {
$this->expect('((U|u)ser|(L|l)ogin)((N|n)ame|)(:|)', $user);
$this->expect('(P|p)ass((W|w)ord|)(:|)', $pass);
} catch (TelnetException $e) {
throw new TelnetException('Could not find password request. Login... | [
"public",
"function",
"login",
"(",
"$",
"user",
",",
"$",
"pass",
",",
"$",
"maxtimeout",
"=",
"10",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"expect",
"(",
"'((U|u)ser|(L|l)ogin)((N|n)ame|)(:|)'",
",",
"$",
"user",
")",
";",
"$",
"this",
"->",
"expec... | Login to device.
@param string $user Username
@param string $pass Password
@throws TelnetException On wrong username/password
@throws SocketClientException On socket communication error
@return $this Current instance on success | [
"Login",
"to",
"device",
"."
] | 049d72f8faaf6c2548353e715e06ad1f28c756b5 | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L180-L212 |
18,595 | bosha/PTel | src/PTel.php | PTel.send | public function send($data, $newline = true) {
if (!$this->_sock) { throw new SocketClientException("Connection unexpectedly closed!"); }
if ($newline) { $data = $data.$this->retcarriage; }
if (! $wr = fwrite($this->_sock, $data)) {
throw new SocketClientException('Error while sendin... | php | public function send($data, $newline = true) {
if (!$this->_sock) { throw new SocketClientException("Connection unexpectedly closed!"); }
if ($newline) { $data = $data.$this->retcarriage; }
if (! $wr = fwrite($this->_sock, $data)) {
throw new SocketClientException('Error while sendin... | [
"public",
"function",
"send",
"(",
"$",
"data",
",",
"$",
"newline",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sock",
")",
"{",
"throw",
"new",
"SocketClientException",
"(",
"\"Connection unexpectedly closed!\"",
")",
";",
"}",
"if",
"(... | Send data to socket
@param $data mixed Can be anything: string, int, hex, binary
@param $newline bool Determines send or not carriage return
@throws SocketClientException On socket communication error
@return int Bytes written | [
"Send",
"data",
"to",
"socket"
] | 049d72f8faaf6c2548353e715e06ad1f28c756b5 | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L224-L231 |
18,596 | bosha/PTel | src/PTel.php | PTel.recvChr | public function recvChr() {
if (!$this->_sock) { throw new SocketClientException("Connection gone!"); }
$char = fgetc($this->_sock);
if ($this->stream_eof()) { return false; }
if ($char === TEL_IAC && $this->negotiation_enabled) {
$this->_negotiate(fgetc($this->_sock));
... | php | public function recvChr() {
if (!$this->_sock) { throw new SocketClientException("Connection gone!"); }
$char = fgetc($this->_sock);
if ($this->stream_eof()) { return false; }
if ($char === TEL_IAC && $this->negotiation_enabled) {
$this->_negotiate(fgetc($this->_sock));
... | [
"public",
"function",
"recvChr",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_sock",
")",
"{",
"throw",
"new",
"SocketClientException",
"(",
"\"Connection gone!\"",
")",
";",
"}",
"$",
"char",
"=",
"fgetc",
"(",
"$",
"this",
"->",
"_sock",
")",
... | Get char from socket or call negotiation method if found telnet
negotiaton command.
@throws SocketClientException On socket communication error
@return char Char from socket connection | [
"Get",
"char",
"from",
"socket",
"or",
"call",
"negotiation",
"method",
"if",
"found",
"telnet",
"negotiaton",
"command",
"."
] | 049d72f8faaf6c2548353e715e06ad1f28c756b5 | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L240-L250 |
18,597 | bosha/PTel | src/PTel.php | PTel.recvLine | public function recvLine($delimiter = "\n") {
$str = '';
while (!$this->stream_eof()) {
$char = $this->recvChr();
$str .= $char;
if ($char === false) { return $str; }
if (strpos($str, $delimiter) !== false) { return $str; }
}
return $str;
... | php | public function recvLine($delimiter = "\n") {
$str = '';
while (!$this->stream_eof()) {
$char = $this->recvChr();
$str .= $char;
if ($char === false) { return $str; }
if (strpos($str, $delimiter) !== false) { return $str; }
}
return $str;
... | [
"public",
"function",
"recvLine",
"(",
"$",
"delimiter",
"=",
"\"\\n\"",
")",
"{",
"$",
"str",
"=",
"''",
";",
"while",
"(",
"!",
"$",
"this",
"->",
"stream_eof",
"(",
")",
")",
"{",
"$",
"char",
"=",
"$",
"this",
"->",
"recvChr",
"(",
")",
";",
... | Receive line from connection
@param string $delimiter Line delimiter
@throws SocketClientException On socket communication error
@return string String from socket connection | [
"Receive",
"line",
"from",
"connection"
] | 049d72f8faaf6c2548353e715e06ad1f28c756b5 | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L260-L269 |
18,598 | bosha/PTel | src/PTel.php | PTel.findAll | public function findAll($str) {
$this->recvAll();
$output_as_array = explode($this->retcarriage, $this->getBuffer());
foreach ($output_as_array as $line) {
if (preg_match("/{$str}/", $line, $matches)) {
return $matches[0];
}
}
return false;... | php | public function findAll($str) {
$this->recvAll();
$output_as_array = explode($this->retcarriage, $this->getBuffer());
foreach ($output_as_array as $line) {
if (preg_match("/{$str}/", $line, $matches)) {
return $matches[0];
}
}
return false;... | [
"public",
"function",
"findAll",
"(",
"$",
"str",
")",
"{",
"$",
"this",
"->",
"recvAll",
"(",
")",
";",
"$",
"output_as_array",
"=",
"explode",
"(",
"$",
"this",
"->",
"retcarriage",
",",
"$",
"this",
"->",
"getBuffer",
"(",
")",
")",
";",
"foreach"... | Receive all data, and search through global buffer
@param string $str String to search (regex supported)
@return bool|string False if not found, string contains search | [
"Receive",
"all",
"data",
"and",
"search",
"through",
"global",
"buffer"
] | 049d72f8faaf6c2548353e715e06ad1f28c756b5 | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L309-L318 |
18,599 | bosha/PTel | src/PTel.php | PTel.expect | public function expect($str, $cmd, $newline = true, $maxtimeout = 10) {
if ($this->waitFor($str, $maxtimeout)) {
$this->send($cmd, $newline);
return true;
}
} | php | public function expect($str, $cmd, $newline = true, $maxtimeout = 10) {
if ($this->waitFor($str, $maxtimeout)) {
$this->send($cmd, $newline);
return true;
}
} | [
"public",
"function",
"expect",
"(",
"$",
"str",
",",
"$",
"cmd",
",",
"$",
"newline",
"=",
"true",
",",
"$",
"maxtimeout",
"=",
"10",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"waitFor",
"(",
"$",
"str",
",",
"$",
"maxtimeout",
")",
")",
"{",
"$... | Search for given occurance and send given command if found
@param string $str String/regexp for search
@param string $cmd Command to send
@param bool $newline Send new line character
@param int $maxtimeout Maximum timeout for waiting sought string
@throws SocketClientException ... | [
"Search",
"for",
"given",
"occurance",
"and",
"send",
"given",
"command",
"if",
"found"
] | 049d72f8faaf6c2548353e715e06ad1f28c756b5 | https://github.com/bosha/PTel/blob/049d72f8faaf6c2548353e715e06ad1f28c756b5/src/PTel.php#L332-L337 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.