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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5,400 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.NoMobile | public function NoMobile($Unset = 0) {
if ($Unset == 1) {
// Allow mobile again
Gdn_CookieIdentity::DeleteCookie('VanillaNoMobile');
}
else {
// Set 48-hour "no mobile" cookie
$Expiration = time() + 172800;
$Expire = 0;
$UserID = ((Gdn::Session()->... | php | public function NoMobile($Unset = 0) {
if ($Unset == 1) {
// Allow mobile again
Gdn_CookieIdentity::DeleteCookie('VanillaNoMobile');
}
else {
// Set 48-hour "no mobile" cookie
$Expiration = time() + 172800;
$Expire = 0;
$UserID = ((Gdn::Session()->... | [
"public",
"function",
"NoMobile",
"(",
"$",
"Unset",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"Unset",
"==",
"1",
")",
"{",
"// Allow mobile again",
"Gdn_CookieIdentity",
"::",
"DeleteCookie",
"(",
"'VanillaNoMobile'",
")",
";",
"}",
"else",
"{",
"// Set 48-hour ... | Set 'NoMobile' cookie for current user to prevent use of mobile theme.
@since 2.0.?
@access public | [
"Set",
"NoMobile",
"cookie",
"for",
"current",
"user",
"to",
"prevent",
"use",
"of",
"mobile",
"theme",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L482-L497 |
5,401 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.Notifications | public function Notifications($Page = FALSE) {
$this->Permission('Garden.SignIn.Allow');
$this->EditMode(FALSE);
list($Offset, $Limit) = OffsetLimit($Page, 30);
$this->GetUserInfo();
$this->_SetBreadcrumbs(T('Notifications'), '/profile/notifications');
$this->SetTabVi... | php | public function Notifications($Page = FALSE) {
$this->Permission('Garden.SignIn.Allow');
$this->EditMode(FALSE);
list($Offset, $Limit) = OffsetLimit($Page, 30);
$this->GetUserInfo();
$this->_SetBreadcrumbs(T('Notifications'), '/profile/notifications');
$this->SetTabVi... | [
"public",
"function",
"Notifications",
"(",
"$",
"Page",
"=",
"FALSE",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.SignIn.Allow'",
")",
";",
"$",
"this",
"->",
"EditMode",
"(",
"FALSE",
")",
";",
"list",
"(",
"$",
"Offset",
",",
"$",
"Limi... | Show notifications for current user.
@since 2.0.0
@access public
@param int $Page Number to skip (paging). | [
"Show",
"notifications",
"for",
"current",
"user",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L506-L552 |
5,402 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.Password | public function Password() {
$this->Permission('Garden.SignIn.Allow');
// Don't allow password editing if using SSO Connect ONLY.
// This is for security. We encountered the case where a customer charges
// for membership using their external application and use SSO to let
// the... | php | public function Password() {
$this->Permission('Garden.SignIn.Allow');
// Don't allow password editing if using SSO Connect ONLY.
// This is for security. We encountered the case where a customer charges
// for membership using their external application and use SSO to let
// the... | [
"public",
"function",
"Password",
"(",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.SignIn.Allow'",
")",
";",
"// Don't allow password editing if using SSO Connect ONLY. ",
"// This is for security. We encountered the case where a customer charges ",
"// for membership us... | Set new password for current user.
@since 2.0.0
@access public | [
"Set",
"new",
"password",
"for",
"current",
"user",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L577-L623 |
5,403 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.Preference | public function Preference($Key = FALSE) {
$this->Permission('Garden.SignIn.Allow');
$this->Form->InputPrefix = '';
if ($this->Form->IsPostBack()) {
$Data = $this->Form->FormValues();
Gdn::UserModel()->SavePreference(Gdn::Session()->UserID, $Data);
} else {
... | php | public function Preference($Key = FALSE) {
$this->Permission('Garden.SignIn.Allow');
$this->Form->InputPrefix = '';
if ($this->Form->IsPostBack()) {
$Data = $this->Form->FormValues();
Gdn::UserModel()->SavePreference(Gdn::Session()->UserID, $Data);
} else {
... | [
"public",
"function",
"Preference",
"(",
"$",
"Key",
"=",
"FALSE",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.SignIn.Allow'",
")",
";",
"$",
"this",
"->",
"Form",
"->",
"InputPrefix",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"Form",
... | Gets or sets a user's preference. This method is meant for ajax calls.
@since 2.1
@param string $Key The name of the preference. | [
"Gets",
"or",
"sets",
"a",
"user",
"s",
"preference",
".",
"This",
"method",
"is",
"meant",
"for",
"ajax",
"calls",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L733-L749 |
5,404 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.RemovePicture | public function RemovePicture($UserReference = '', $Username = '', $TransientKey = '') {
$this->Permission('Garden.SignIn.Allow');
$Session = Gdn::Session();
if (!$Session->IsValid())
$this->Form->AddError('You must be authenticated in order to use this form.');
// Get user data ... | php | public function RemovePicture($UserReference = '', $Username = '', $TransientKey = '') {
$this->Permission('Garden.SignIn.Allow');
$Session = Gdn::Session();
if (!$Session->IsValid())
$this->Form->AddError('You must be authenticated in order to use this form.');
// Get user data ... | [
"public",
"function",
"RemovePicture",
"(",
"$",
"UserReference",
"=",
"''",
",",
"$",
"Username",
"=",
"''",
",",
"$",
"TransientKey",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.SignIn.Allow'",
")",
";",
"$",
"Session",
"=",
"Gd... | Remove the user's photo.
@since 2.0.0
@access public
@param mixed $UserReference Unique identifier, possibly username or ID.
@param string $Username.
@param string $TransientKey Security token. | [
"Remove",
"the",
"user",
"s",
"photo",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L922-L950 |
5,405 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.SendInvite | public function SendInvite($InvitationID = '', $TransientKey = '') {
$this->Permission('Garden.SignIn.Allow');
$InvitationModel = new InvitationModel();
$Session = Gdn::Session();
if ($Session->ValidateTransientKey($TransientKey)) {
try {
$Email = new Gdn_Email();
... | php | public function SendInvite($InvitationID = '', $TransientKey = '') {
$this->Permission('Garden.SignIn.Allow');
$InvitationModel = new InvitationModel();
$Session = Gdn::Session();
if ($Session->ValidateTransientKey($TransientKey)) {
try {
$Email = new Gdn_Email();
... | [
"public",
"function",
"SendInvite",
"(",
"$",
"InvitationID",
"=",
"''",
",",
"$",
"TransientKey",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.SignIn.Allow'",
")",
";",
"$",
"InvitationModel",
"=",
"new",
"InvitationModel",
"(",
")",
... | Let user send an invitation.
@since 2.0.0
@access public
@param int $InvitationID Unique identifier.
@param string $TransientKey Security token. | [
"Let",
"user",
"send",
"an",
"invitation",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L960-L978 |
5,406 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.UnInvite | public function UnInvite($InvitationID = '', $TransientKey = '') {
$this->Permission('Garden.SignIn.Allow');
$InvitationModel = new InvitationModel();
$Session = Gdn::Session();
if ($Session->ValidateTransientKey($TransientKey)) {
try {
$InvitationModel->Delete($InvitationID... | php | public function UnInvite($InvitationID = '', $TransientKey = '') {
$this->Permission('Garden.SignIn.Allow');
$InvitationModel = new InvitationModel();
$Session = Gdn::Session();
if ($Session->ValidateTransientKey($TransientKey)) {
try {
$InvitationModel->Delete($InvitationID... | [
"public",
"function",
"UnInvite",
"(",
"$",
"InvitationID",
"=",
"''",
",",
"$",
"TransientKey",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.SignIn.Allow'",
")",
";",
"$",
"InvitationModel",
"=",
"new",
"InvitationModel",
"(",
")",
... | Revoke an invitation.
@since 2.0.0
@access public
@param int $InvitationID Unique identifier.
@param string $TransientKey Security token. | [
"Revoke",
"an",
"invitation",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L1109-L1127 |
5,407 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.AddSideMenu | public function AddSideMenu($CurrentUrl = '') {
if (!$this->User)
return;
// Make sure to add the "Edit Profile" buttons.
$this->AddModule('ProfileOptionsModule');
// Show edit menu if in edit mode
// Show profile pic & filter menu otherwise
$SideMenu = new Sid... | php | public function AddSideMenu($CurrentUrl = '') {
if (!$this->User)
return;
// Make sure to add the "Edit Profile" buttons.
$this->AddModule('ProfileOptionsModule');
// Show edit menu if in edit mode
// Show profile pic & filter menu otherwise
$SideMenu = new Sid... | [
"public",
"function",
"AddSideMenu",
"(",
"$",
"CurrentUrl",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"User",
")",
"return",
";",
"// Make sure to add the \"Edit Profile\" buttons.",
"$",
"this",
"->",
"AddModule",
"(",
"'ProfileOptionsModule'",
"... | Adds the option menu to the panel asset.
@since 2.0.0
@access public
@param string $CurrentUrl Path to highlight. | [
"Adds",
"the",
"option",
"menu",
"to",
"the",
"panel",
"asset",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L1171-L1195 |
5,408 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.BuildProfile | public function BuildProfile() {
if (!is_object($this->User))
throw new Exception(T('Cannot build profile information if user is not defined.'));
$Session = Gdn::Session();
if (strpos($this->CssClass, 'Profile') === FALSE)
$this->CssClass .= ' Profile';
$this->Title(Gdn_... | php | public function BuildProfile() {
if (!is_object($this->User))
throw new Exception(T('Cannot build profile information if user is not defined.'));
$Session = Gdn::Session();
if (strpos($this->CssClass, 'Profile') === FALSE)
$this->CssClass .= ' Profile';
$this->Title(Gdn_... | [
"public",
"function",
"BuildProfile",
"(",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"this",
"->",
"User",
")",
")",
"throw",
"new",
"Exception",
"(",
"T",
"(",
"'Cannot build profile information if user is not defined.'",
")",
")",
";",
"$",
"Session",... | Build the user profile.
Set the page title, add data to page modules, add modules to assets,
add tabs to tab menu. $this->User must be defined, or this method will throw an exception.
@since 2.0.0
@access public
@return bool Always true. | [
"Build",
"the",
"user",
"profile",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L1287-L1331 |
5,409 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.Get | public function Get($UserID = FALSE) {
if (!$UserID)
$UserID = Gdn::Session()->UserID;
if (($UserID != Gdn::Session()->UserID || !Gdn::Session()->UserID) && !Gdn::Session()->CheckPermission('Garden.Users.Edit')) {
throw new Exception(T('You do not have permission to view other profiles.')... | php | public function Get($UserID = FALSE) {
if (!$UserID)
$UserID = Gdn::Session()->UserID;
if (($UserID != Gdn::Session()->UserID || !Gdn::Session()->UserID) && !Gdn::Session()->CheckPermission('Garden.Users.Edit')) {
throw new Exception(T('You do not have permission to view other profiles.')... | [
"public",
"function",
"Get",
"(",
"$",
"UserID",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"$",
"UserID",
")",
"$",
"UserID",
"=",
"Gdn",
"::",
"Session",
"(",
")",
"->",
"UserID",
";",
"if",
"(",
"(",
"$",
"UserID",
"!=",
"Gdn",
"::",
"Session",
... | Render basic data about user.
@since 2.0.?
@access public
@param int $UserID Unique ID. | [
"Render",
"basic",
"data",
"about",
"user",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L1340-L1366 |
5,410 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.GetUserInfo | public function GetUserInfo($UserReference = '', $Username = '', $UserID = '', $CheckPermissions = FALSE) {
if ($this->_UserInfoRetrieved)
return;
if (!C('Garden.Profile.Public') && !Gdn::Session()->IsValid())
throw PermissionException();
// If a UserID was provided as ... | php | public function GetUserInfo($UserReference = '', $Username = '', $UserID = '', $CheckPermissions = FALSE) {
if ($this->_UserInfoRetrieved)
return;
if (!C('Garden.Profile.Public') && !Gdn::Session()->IsValid())
throw PermissionException();
// If a UserID was provided as ... | [
"public",
"function",
"GetUserInfo",
"(",
"$",
"UserReference",
"=",
"''",
",",
"$",
"Username",
"=",
"''",
",",
"$",
"UserID",
"=",
"''",
",",
"$",
"CheckPermissions",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_UserInfoRetrieved",
")",
"r... | Retrieve the user to be manipulated. Defaults to current user.
@since 2.0.0
@access public
@param mixed $User Unique identifier, possibly username or ID.
@param string $Username.
@param int $UserID Unique ID.
@param bool $CheckPermissions Whether or not to check user permissions.
@return bool Always true. | [
"Retrieve",
"the",
"user",
"to",
"be",
"manipulated",
".",
"Defaults",
"to",
"current",
"user",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L1379-L1435 |
5,411 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.ProfileUrl | public function ProfileUrl($UserReference = NULL, $UserID = NULL) {
if (!property_exists($this, 'User'))
$this->GetUserInfo();
if ($UserReference === NULL)
$UserReference = $this->User->Name;
if ($UserID === NULL)
$UserID = $this->User->UserID;
$UserReferenc... | php | public function ProfileUrl($UserReference = NULL, $UserID = NULL) {
if (!property_exists($this, 'User'))
$this->GetUserInfo();
if ($UserReference === NULL)
$UserReference = $this->User->Name;
if ($UserID === NULL)
$UserID = $this->User->UserID;
$UserReferenc... | [
"public",
"function",
"ProfileUrl",
"(",
"$",
"UserReference",
"=",
"NULL",
",",
"$",
"UserID",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"this",
",",
"'User'",
")",
")",
"$",
"this",
"->",
"GetUserInfo",
"(",
")",
";",
"if"... | Build URL to user's profile.
@since 2.0.0
@access public
@param mixed $UserReference Unique identifier, possibly username or ID.
@param string $UserID Unique ID.
@return string Relative URL path. | [
"Build",
"URL",
"to",
"user",
"s",
"profile",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L1446-L1460 |
5,412 | bishopb/vanilla | applications/dashboard/controllers/class.profilecontroller.php | ProfileController.Multi | public function Multi($UserID) {
$this->Permission('Garden.Settings.Manage');
$this->DeliveryMethod(DELIVERY_METHOD_JSON);
$this->DeliveryType(DELIVERY_TYPE_DATA);
// Get rid of Reactions busybody data
unset($this->Data['Counts']);
$UserID = (array)$UserID;
$Users... | php | public function Multi($UserID) {
$this->Permission('Garden.Settings.Manage');
$this->DeliveryMethod(DELIVERY_METHOD_JSON);
$this->DeliveryType(DELIVERY_TYPE_DATA);
// Get rid of Reactions busybody data
unset($this->Data['Counts']);
$UserID = (array)$UserID;
$Users... | [
"public",
"function",
"Multi",
"(",
"$",
"UserID",
")",
"{",
"$",
"this",
"->",
"Permission",
"(",
"'Garden.Settings.Manage'",
")",
";",
"$",
"this",
"->",
"DeliveryMethod",
"(",
"DELIVERY_METHOD_JSON",
")",
";",
"$",
"this",
"->",
"DeliveryType",
"(",
"DELI... | Fetch multiple users
Note: API only
@param type $UserID | [
"Fetch",
"multiple",
"users"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/applications/dashboard/controllers/class.profilecontroller.php#L1521-L1540 |
5,413 | Dhii/i18n-helper-base | src/StringTranslatingTrait.php | StringTranslatingTrait.__ | protected function __($string, $args = array(), $context = null)
{
$string = $this->_translate($string, $context);
array_unshift($args, $string);
$result = call_user_func_array('sprintf', $args);
return $result;
} | php | protected function __($string, $args = array(), $context = null)
{
$string = $this->_translate($string, $context);
array_unshift($args, $string);
$result = call_user_func_array('sprintf', $args);
return $result;
} | [
"protected",
"function",
"__",
"(",
"$",
"string",
",",
"$",
"args",
"=",
"array",
"(",
")",
",",
"$",
"context",
"=",
"null",
")",
"{",
"$",
"string",
"=",
"$",
"this",
"->",
"_translate",
"(",
"$",
"string",
",",
"$",
"context",
")",
";",
"arra... | Translates a string, and replaces placeholders.
@since [*next-version*]
@see sprintf()
@see _translate()
@param string $string The format string to translate.
@param array $args Placeholder values to replace in the string.
@param mixed $context The context for translation.
@return string The translated string. | [
"Translates",
"a",
"string",
"and",
"replaces",
"placeholders",
"."
] | fc4c881f3e528ea918588831ebeffb92738f8dd5 | https://github.com/Dhii/i18n-helper-base/blob/fc4c881f3e528ea918588831ebeffb92738f8dd5/src/StringTranslatingTrait.php#L25-L32 |
5,414 | liip/LiipDrupalEventManagerModule | src/Liip/Drupal/Modules/EventManager/EventSubject.php | EventSubject.attach | public function attach(EventObserverInterface $observer)
{
$key = $this->getRegistrationKey($observer);
if (empty($this->observers[$key])) {
$this->observers[$key] = $observer;
}
} | php | public function attach(EventObserverInterface $observer)
{
$key = $this->getRegistrationKey($observer);
if (empty($this->observers[$key])) {
$this->observers[$key] = $observer;
}
} | [
"public",
"function",
"attach",
"(",
"EventObserverInterface",
"$",
"observer",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getRegistrationKey",
"(",
"$",
"observer",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"observers",
"[",
"$",
"key",
... | Attach an EventObserver
@param \Liip\Drupal\Modules\EventManager\EventObserverInterface $observer
@link http://php.net/manual/en/splsubject.attach.php | [
"Attach",
"an",
"EventObserver"
] | c049662aa1efaab1149d7edb0cb7bca265983571 | https://github.com/liip/LiipDrupalEventManagerModule/blob/c049662aa1efaab1149d7edb0cb7bca265983571/src/Liip/Drupal/Modules/EventManager/EventSubject.php#L37-L44 |
5,415 | liip/LiipDrupalEventManagerModule | src/Liip/Drupal/Modules/EventManager/EventSubject.php | EventSubject.detach | public function detach(EventObserverInterface $observer)
{
$key = $this->getRegistrationKey($observer);
if (array_key_exists($key, $this->observers)){
unset($this->observers[$key]);
}
} | php | public function detach(EventObserverInterface $observer)
{
$key = $this->getRegistrationKey($observer);
if (array_key_exists($key, $this->observers)){
unset($this->observers[$key]);
}
} | [
"public",
"function",
"detach",
"(",
"EventObserverInterface",
"$",
"observer",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getRegistrationKey",
"(",
"$",
"observer",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"o... | Detach an EventObserver
@param \Liip\Drupal\Modules\EventManager\EventObserverInterface $observer
@link http://php.net/manual/en/splsubject.detach.php | [
"Detach",
"an",
"EventObserver"
] | c049662aa1efaab1149d7edb0cb7bca265983571 | https://github.com/liip/LiipDrupalEventManagerModule/blob/c049662aa1efaab1149d7edb0cb7bca265983571/src/Liip/Drupal/Modules/EventManager/EventSubject.php#L53-L60 |
5,416 | liip/LiipDrupalEventManagerModule | src/Liip/Drupal/Modules/EventManager/EventSubject.php | EventSubject.notify | public function notify()
{
if (0 < count($this->observers)) {
foreach ($this->observers as $observer) {
/** @var \Liip\Drupal\Modules\EventManager\EventObserverInterface $observer */
$observer->update($this);
}
}
} | php | public function notify()
{
if (0 < count($this->observers)) {
foreach ($this->observers as $observer) {
/** @var \Liip\Drupal\Modules\EventManager\EventObserverInterface $observer */
$observer->update($this);
}
}
} | [
"public",
"function",
"notify",
"(",
")",
"{",
"if",
"(",
"0",
"<",
"count",
"(",
"$",
"this",
"->",
"observers",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"observers",
"as",
"$",
"observer",
")",
"{",
"/** @var \\Liip\\Drupal\\Modules\\EventManage... | Notify every attached observer
@link http://php.net/manual/en/splsubject.notify.php | [
"Notify",
"every",
"attached",
"observer"
] | c049662aa1efaab1149d7edb0cb7bca265983571 | https://github.com/liip/LiipDrupalEventManagerModule/blob/c049662aa1efaab1149d7edb0cb7bca265983571/src/Liip/Drupal/Modules/EventManager/EventSubject.php#L67-L75 |
5,417 | spipremix/facteur | phpmailer-php5/class.phpmailer.php | PHPMailer.addAnAddress | protected function addAnAddress($kind, $address, $name = '')
{
if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
$error_message = $this->lang('Invalid recipient kind: ') . $kind;
$this->setError($error_message);
$this->edebug($error_message);
if ($... | php | protected function addAnAddress($kind, $address, $name = '')
{
if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
$error_message = $this->lang('Invalid recipient kind: ') . $kind;
$this->setError($error_message);
$this->edebug($error_message);
if ($... | [
"protected",
"function",
"addAnAddress",
"(",
"$",
"kind",
",",
"$",
"address",
",",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"kind",
",",
"array",
"(",
"'to'",
",",
"'cc'",
",",
"'bcc'",
",",
"'Reply-To'",
")",
")",
... | Add an address to one of the recipient arrays or to the ReplyTo array.
Addresses that have been added already return false, but do not throw exceptions.
@param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
@param string $address The email address to send, resp. to reply to
@param string $name
@throws phpmailerExc... | [
"Add",
"an",
"address",
"to",
"one",
"of",
"the",
"recipient",
"arrays",
"or",
"to",
"the",
"ReplyTo",
"array",
".",
"Addresses",
"that",
"have",
"been",
"added",
"already",
"return",
"false",
"but",
"do",
"not",
"throw",
"exceptions",
"."
] | 9cdca595d1f8f9a66c29e5c74e8666d81ebc65ca | https://github.com/spipremix/facteur/blob/9cdca595d1f8f9a66c29e5c74e8666d81ebc65ca/phpmailer-php5/class.phpmailer.php#L915-L948 |
5,418 | spipremix/facteur | phpmailer-php5/class.phpmailer.php | PHPMailer.clearAddresses | public function clearAddresses()
{
foreach ($this->to as $to) {
unset($this->all_recipients[strtolower($to[0])]);
}
$this->to = array();
$this->clearQueuedAddresses('to');
} | php | public function clearAddresses()
{
foreach ($this->to as $to) {
unset($this->all_recipients[strtolower($to[0])]);
}
$this->to = array();
$this->clearQueuedAddresses('to');
} | [
"public",
"function",
"clearAddresses",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"to",
"as",
"$",
"to",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"all_recipients",
"[",
"strtolower",
"(",
"$",
"to",
"[",
"0",
"]",
")",
"]",
")",
";",
"}... | Clear all To recipients.
@return void | [
"Clear",
"all",
"To",
"recipients",
"."
] | 9cdca595d1f8f9a66c29e5c74e8666d81ebc65ca | https://github.com/spipremix/facteur/blob/9cdca595d1f8f9a66c29e5c74e8666d81ebc65ca/phpmailer-php5/class.phpmailer.php#L3166-L3173 |
5,419 | bytepark/lib-migration | src/Repository/Filesystem/Grouped.php | Grouped.buildFilePath | private function buildFilePath($fileName)
{
$digest = md5($fileName);
$path = $this->basePath . '/' . substr($digest, 0, 1) . '/' . substr($digest, 1, 1);
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
return $path . '/' . $fileName;
} | php | private function buildFilePath($fileName)
{
$digest = md5($fileName);
$path = $this->basePath . '/' . substr($digest, 0, 1) . '/' . substr($digest, 1, 1);
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
return $path . '/' . $fileName;
} | [
"private",
"function",
"buildFilePath",
"(",
"$",
"fileName",
")",
"{",
"$",
"digest",
"=",
"md5",
"(",
"$",
"fileName",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"basePath",
".",
"'/'",
".",
"substr",
"(",
"$",
"digest",
",",
"0",
",",
"1",
... | Generates a subdirectory path for the given file
@param string $fileName
@return string | [
"Generates",
"a",
"subdirectory",
"path",
"for",
"the",
"given",
"file"
] | 14d75f6978e257f456493c673175ca5d07b28c84 | https://github.com/bytepark/lib-migration/blob/14d75f6978e257f456493c673175ca5d07b28c84/src/Repository/Filesystem/Grouped.php#L82-L93 |
5,420 | bytepark/lib-migration | src/Repository/Filesystem/Grouped.php | Grouped.buildFromSubDirectory | private function buildFromSubDirectory(\FilesystemIterator $directory)
{
/* @var $fileInfo \SplFileInfo */
foreach ($directory as $fileInfo) {
if ($fileInfo->isDir()) {
$subDirectory = new \FilesystemIterator($fileInfo->getRealPath());
$this->buildFromSubD... | php | private function buildFromSubDirectory(\FilesystemIterator $directory)
{
/* @var $fileInfo \SplFileInfo */
foreach ($directory as $fileInfo) {
if ($fileInfo->isDir()) {
$subDirectory = new \FilesystemIterator($fileInfo->getRealPath());
$this->buildFromSubD... | [
"private",
"function",
"buildFromSubDirectory",
"(",
"\\",
"FilesystemIterator",
"$",
"directory",
")",
"{",
"/* @var $fileInfo \\SplFileInfo */",
"foreach",
"(",
"$",
"directory",
"as",
"$",
"fileInfo",
")",
"{",
"if",
"(",
"$",
"fileInfo",
"->",
"isDir",
"(",
... | Recursive build of the migrations
Recursion ends when files are located in the given filesystem iterator.
Otherwise the recursion steps into the directory.
@param \FilesystemIterator $directory The directory to build from
@throws \Bytepark\Component\Migration\Exception\UnitIsAlreadyPresentException
@throws \InvalidA... | [
"Recursive",
"build",
"of",
"the",
"migrations"
] | 14d75f6978e257f456493c673175ca5d07b28c84 | https://github.com/bytepark/lib-migration/blob/14d75f6978e257f456493c673175ca5d07b28c84/src/Repository/Filesystem/Grouped.php#L107-L119 |
5,421 | thienhungho/yii2-term-management | src/modules/TermManage/controllers/TermController.php | TermController.findModel | protected function findModel($id)
{
if (($model = Term::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
}
} | php | protected function findModel($id)
{
if (($model = Term::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
}
} | [
"protected",
"function",
"findModel",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"(",
"$",
"model",
"=",
"Term",
"::",
"findOne",
"(",
"$",
"id",
")",
")",
"!==",
"null",
")",
"{",
"return",
"$",
"model",
";",
"}",
"else",
"{",
"throw",
"new",
"NotFoun... | Finds the Term model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param integer $id
@return Term the loaded model
@throws NotFoundHttpException if the model cannot be found | [
"Finds",
"the",
"Term",
"model",
"based",
"on",
"its",
"primary",
"key",
"value",
".",
"If",
"the",
"model",
"is",
"not",
"found",
"a",
"404",
"HTTP",
"exception",
"will",
"be",
"thrown",
"."
] | 9bbc4f4de3837f30e8f968f7d9b6f8d892610270 | https://github.com/thienhungho/yii2-term-management/blob/9bbc4f4de3837f30e8f968f7d9b6f8d892610270/src/modules/TermManage/controllers/TermController.php#L280-L287 |
5,422 | kgilden/pager | src/Page.php | Page.getItemsWithOneExtra | private function getItemsWithOneExtra()
{
if (null === $this->itemsWithOneExtra) {
$this->itemsWithOneExtra = $this
->adapter
->getItems($this->getOffset(), $this->getLength() + 1)
;
}
return $this->itemsWithOneExtra;
} | php | private function getItemsWithOneExtra()
{
if (null === $this->itemsWithOneExtra) {
$this->itemsWithOneExtra = $this
->adapter
->getItems($this->getOffset(), $this->getLength() + 1)
;
}
return $this->itemsWithOneExtra;
} | [
"private",
"function",
"getItemsWithOneExtra",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"itemsWithOneExtra",
")",
"{",
"$",
"this",
"->",
"itemsWithOneExtra",
"=",
"$",
"this",
"->",
"adapter",
"->",
"getItems",
"(",
"$",
"this",
"->",
... | Gets items of this page as well as the 1-st item from the next page.
Doing it this way keeps us from having to run the expensive total item
count query in some scenarios.
@return array | [
"Gets",
"items",
"of",
"this",
"page",
"as",
"well",
"as",
"the",
"1",
"-",
"st",
"item",
"from",
"the",
"next",
"page",
".",
"Doing",
"it",
"this",
"way",
"keeps",
"us",
"from",
"having",
"to",
"run",
"the",
"expensive",
"total",
"item",
"count",
"q... | 50e25d4a208922077b174bec5f1b8e60630f9fff | https://github.com/kgilden/pager/blob/50e25d4a208922077b174bec5f1b8e60630f9fff/src/Page.php#L232-L242 |
5,423 | kgilden/pager | src/Page.php | Page.getPage | private function getPage($number)
{
return new self($this->adapter, $this->strategy, $this->perPage, $number);
} | php | private function getPage($number)
{
return new self($this->adapter, $this->strategy, $this->perPage, $number);
} | [
"private",
"function",
"getPage",
"(",
"$",
"number",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"this",
"->",
"adapter",
",",
"$",
"this",
"->",
"strategy",
",",
"$",
"this",
"->",
"perPage",
",",
"$",
"number",
")",
";",
"}"
] | Creates a new page with the given number.
@param integer $number
@return Page | [
"Creates",
"a",
"new",
"page",
"with",
"the",
"given",
"number",
"."
] | 50e25d4a208922077b174bec5f1b8e60630f9fff | https://github.com/kgilden/pager/blob/50e25d4a208922077b174bec5f1b8e60630f9fff/src/Page.php#L251-L254 |
5,424 | HeroicTeam/m | Foundation/Collection.php | Collection.set | public function set($key, $value, $dot_syntax = true)
{
if ($dot_syntax === true) {
$paths = explode('.', $key);
$pathCount = count($paths);
$currentIteration = 0;
$node =& $this->_data;
foreach ($paths as $path) {
if (isset($node[... | php | public function set($key, $value, $dot_syntax = true)
{
if ($dot_syntax === true) {
$paths = explode('.', $key);
$pathCount = count($paths);
$currentIteration = 0;
$node =& $this->_data;
foreach ($paths as $path) {
if (isset($node[... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"dot_syntax",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"dot_syntax",
"===",
"true",
")",
"{",
"$",
"paths",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"$",
"pa... | Stores an item in the collection at the designated key.
Dot syntax can be used to nest data in the array.
@param string $key
@param mixed $value
@return \m\Foundation\Collection | [
"Stores",
"an",
"item",
"in",
"the",
"collection",
"at",
"the",
"designated",
"key",
".",
"Dot",
"syntax",
"can",
"be",
"used",
"to",
"nest",
"data",
"in",
"the",
"array",
"."
] | daa6d5956ee6c989379fe5fae39feccc59cf4add | https://github.com/HeroicTeam/m/blob/daa6d5956ee6c989379fe5fae39feccc59cf4add/Foundation/Collection.php#L38-L66 |
5,425 | HeroicTeam/m | Foundation/Collection.php | Collection.setMany | public function setMany(array $data)
{
foreach($data as $key => $value) {
$this->_data[$key] = $value;
}
return $this;
} | php | public function setMany(array $data)
{
foreach($data as $key => $value) {
$this->_data[$key] = $value;
}
return $this;
} | [
"public",
"function",
"setMany",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"$",
"th... | Merges the given array of data with the collection data.
@param array $data
@return \m\Foundation\Collection | [
"Merges",
"the",
"given",
"array",
"of",
"data",
"with",
"the",
"collection",
"data",
"."
] | daa6d5956ee6c989379fe5fae39feccc59cf4add | https://github.com/HeroicTeam/m/blob/daa6d5956ee6c989379fe5fae39feccc59cf4add/Foundation/Collection.php#L74-L81 |
5,426 | HeroicTeam/m | Foundation/Collection.php | Collection.get | public function get($key, $default = null, $dot_syntax = true)
{
if ($dot_syntax === true) {
$paths = explode('.', $key);
$node =& $this->_data;
foreach ($paths as $path) {
if (!is_array($node) || !isset($node[$path])) {
//... | php | public function get($key, $default = null, $dot_syntax = true)
{
if ($dot_syntax === true) {
$paths = explode('.', $key);
$node =& $this->_data;
foreach ($paths as $path) {
if (!is_array($node) || !isset($node[$path])) {
//... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
",",
"$",
"dot_syntax",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"dot_syntax",
"===",
"true",
")",
"{",
"$",
"paths",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
... | Returns a single item from the collection data.
@param string $key
@return mixed | [
"Returns",
"a",
"single",
"item",
"from",
"the",
"collection",
"data",
"."
] | daa6d5956ee6c989379fe5fae39feccc59cf4add | https://github.com/HeroicTeam/m/blob/daa6d5956ee6c989379fe5fae39feccc59cf4add/Foundation/Collection.php#L101-L122 |
5,427 | chesszebra/standard-algebraic-notation | src/Notation.php | Notation.withTargetColumnIndex | public function withTargetColumnIndex(int $index): Notation
{
if (!$this->getTargetRow()) {
throw new RuntimeException('No row has been set.');
}
$notation = chr(97 + $index) . $this->getTargetRow();
return new self($notation);
} | php | public function withTargetColumnIndex(int $index): Notation
{
if (!$this->getTargetRow()) {
throw new RuntimeException('No row has been set.');
}
$notation = chr(97 + $index) . $this->getTargetRow();
return new self($notation);
} | [
"public",
"function",
"withTargetColumnIndex",
"(",
"int",
"$",
"index",
")",
":",
"Notation",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getTargetRow",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'No row has been set.'",
")",
";",
"}",
"$"... | Duplicates the notation with a column based on an index from 0 to 7.
@param int $index The index of the column to use.
@return Notation
@throws InvalidArgumentException Thrown when an invalid SAN value is created.
@throws RuntimeException Thrown when no target row is set. | [
"Duplicates",
"the",
"notation",
"with",
"a",
"column",
"based",
"on",
"an",
"index",
"from",
"0",
"to",
"7",
"."
] | c09113b78117a878f8daa735abe30f4913769d51 | https://github.com/chesszebra/standard-algebraic-notation/blob/c09113b78117a878f8daa735abe30f4913769d51/src/Notation.php#L419-L428 |
5,428 | chesszebra/standard-algebraic-notation | src/Notation.php | Notation.withTargetRow | public function withTargetRow(int $row): Notation
{
$notation = $this->getTargetColumn() . $row;
return new self($notation);
} | php | public function withTargetRow(int $row): Notation
{
$notation = $this->getTargetColumn() . $row;
return new self($notation);
} | [
"public",
"function",
"withTargetRow",
"(",
"int",
"$",
"row",
")",
":",
"Notation",
"{",
"$",
"notation",
"=",
"$",
"this",
"->",
"getTargetColumn",
"(",
")",
".",
"$",
"row",
";",
"return",
"new",
"self",
"(",
"$",
"notation",
")",
";",
"}"
] | Duplicates the notation with a new row.
@param int $row A value between 1 and 8.
@return Notation
@throws InvalidArgumentException Thrown when an invalid SAN value is created. | [
"Duplicates",
"the",
"notation",
"with",
"a",
"new",
"row",
"."
] | c09113b78117a878f8daa735abe30f4913769d51 | https://github.com/chesszebra/standard-algebraic-notation/blob/c09113b78117a878f8daa735abe30f4913769d51/src/Notation.php#L447-L452 |
5,429 | franckysolo/octopush-sdk | src/Octopush/Api.php | Api.getCredit | public function getCredit()
{
$this->client->request('credit');
$response = $this->getResponse();
if ($response['error_code'] !== '000') {
return 0.00;
}
return (float) $response['credit'];
} | php | public function getCredit()
{
$this->client->request('credit');
$response = $this->getResponse();
if ($response['error_code'] !== '000') {
return 0.00;
}
return (float) $response['credit'];
} | [
"public",
"function",
"getCredit",
"(",
")",
"{",
"$",
"this",
"->",
"client",
"->",
"request",
"(",
"'credit'",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
";",
"if",
"(",
"$",
"response",
"[",
"'error_code'",
"]",
"!... | Retourne le solde sms en Euros.
@return float | [
"Retourne",
"le",
"solde",
"sms",
"en",
"Euros",
"."
] | 3797e53d51474a64b65fbf437e5dd46e288f2ef8 | https://github.com/franckysolo/octopush-sdk/blob/3797e53d51474a64b65fbf437e5dd46e288f2ef8/src/Octopush/Api.php#L64-L74 |
5,430 | kaecyra/app-common | src/Log/FilesystemLogger.php | FilesystemLogger.openLog | public function openLog() {
if ($this->file) {
$logDir = dirname($this->file);
if (!is_dir($logDir) || !file_exists($logDir)) {
@mkdir($logDir, 0755, true);
}
if (!file_exists($this->file)) {
$touched = touch($this->file);
... | php | public function openLog() {
if ($this->file) {
$logDir = dirname($this->file);
if (!is_dir($logDir) || !file_exists($logDir)) {
@mkdir($logDir, 0755, true);
}
if (!file_exists($this->file)) {
$touched = touch($this->file);
... | [
"public",
"function",
"openLog",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"file",
")",
"{",
"$",
"logDir",
"=",
"dirname",
"(",
"$",
"this",
"->",
"file",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"logDir",
")",
"||",
"!",
"file_exists",
... | Open log file for writing
Also closes currently open log file if needed.
@return void | [
"Open",
"log",
"file",
"for",
"writing"
] | 8dbcf70c575fb587614b45da8ec02d098e3e843b | https://github.com/kaecyra/app-common/blob/8dbcf70c575fb587614b45da8ec02d098e3e843b/src/Log/FilesystemLogger.php#L59-L79 |
5,431 | monomelodies/ornament | src/Annotate.php | Annotate.annotations | public function annotations()
{
static $annotations;
if (!isset($annotations)) {
$annotator = get_class($this);
if (strpos($annotator, '@anonymous')) {
$annotator = (new ReflectionClass($this))
->getParentClass()->name;
}
... | php | public function annotations()
{
static $annotations;
if (!isset($annotations)) {
$annotator = get_class($this);
if (strpos($annotator, '@anonymous')) {
$annotator = (new ReflectionClass($this))
->getParentClass()->name;
}
... | [
"public",
"function",
"annotations",
"(",
")",
"{",
"static",
"$",
"annotations",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"annotations",
")",
")",
"{",
"$",
"annotator",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"... | Helper method to get this object's annotations. The annotations are
cached for speed.
@return array An array with `class`, `methods` and `properties` entries
containing an Annotations object (for classes) or a hash of
name/Annotations object pairs (for methods/properties).
@see zpt\anno\Annotations | [
"Helper",
"method",
"to",
"get",
"this",
"object",
"s",
"annotations",
".",
"The",
"annotations",
"are",
"cached",
"for",
"speed",
"."
] | d7d070ad11f5731be141cf55c2756accaaf51402 | https://github.com/monomelodies/ornament/blob/d7d070ad11f5731be141cf55c2756accaaf51402/src/Annotate.php#L19-L41 |
5,432 | PSESD/chms-common | lib/Auth/Acl.php | Acl.isAllowedModel | public function isAllowedModel($modelClass, $privilege = null)
{
return $this->isAllowed($this->modelResourceGenerator($modelClass), $privilege);
} | php | public function isAllowedModel($modelClass, $privilege = null)
{
return $this->isAllowed($this->modelResourceGenerator($modelClass), $privilege);
} | [
"public",
"function",
"isAllowedModel",
"(",
"$",
"modelClass",
",",
"$",
"privilege",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"isAllowed",
"(",
"$",
"this",
"->",
"modelResourceGenerator",
"(",
"$",
"modelClass",
")",
",",
"$",
"privilege",
")... | Check for access to a model
@param string $modelClass
@param string|array $privilege
@return boolean | [
"Check",
"for",
"access",
"to",
"a",
"model"
] | dba29f95de57cb6b1113c169ccb911152b18e288 | https://github.com/PSESD/chms-common/blob/dba29f95de57cb6b1113c169ccb911152b18e288/lib/Auth/Acl.php#L122-L125 |
5,433 | PSESD/chms-common | lib/Auth/Acl.php | Acl.isAllowedField | public function isAllowedField($modelClass, $fieldName, $privilege = null)
{
return $this->isAllowed($this->fieldResourceGenerator($modelClass, $fieldName), $privilege);
} | php | public function isAllowedField($modelClass, $fieldName, $privilege = null)
{
return $this->isAllowed($this->fieldResourceGenerator($modelClass, $fieldName), $privilege);
} | [
"public",
"function",
"isAllowedField",
"(",
"$",
"modelClass",
",",
"$",
"fieldName",
",",
"$",
"privilege",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"isAllowed",
"(",
"$",
"this",
"->",
"fieldResourceGenerator",
"(",
"$",
"modelClass",
",",
"$... | Check for access to a model's field
@param string $modelClass
@param string $fieldName
@param string|array $privilege
@return boolean | [
"Check",
"for",
"access",
"to",
"a",
"model",
"s",
"field"
] | dba29f95de57cb6b1113c169ccb911152b18e288 | https://github.com/PSESD/chms-common/blob/dba29f95de57cb6b1113c169ccb911152b18e288/lib/Auth/Acl.php#L135-L138 |
5,434 | PSESD/chms-common | lib/Auth/Acl.php | Acl.isAllowed | public function isAllowed($resource = null, $privilege = null)
{
if (is_array($privilege)) {
foreach ($privilege as $privilegeSingular) {
if ($this->isAllowed($resource, $privilegeSingular)) {
return true;
}
}
return fal... | php | public function isAllowed($resource = null, $privilege = null)
{
if (is_array($privilege)) {
foreach ($privilege as $privilegeSingular) {
if ($this->isAllowed($resource, $privilegeSingular)) {
return true;
}
}
return fal... | [
"public",
"function",
"isAllowed",
"(",
"$",
"resource",
"=",
"null",
",",
"$",
"privilege",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"privilege",
")",
")",
"{",
"foreach",
"(",
"$",
"privilege",
"as",
"$",
"privilegeSingular",
")",
"{",... | Check for a access to a resource
@param Zend\Permissions\Acl\Resource\ResourceInterface|string $resource
@param string|array $privilege
@return boolean | [
"Check",
"for",
"a",
"access",
"to",
"a",
"resource"
] | dba29f95de57cb6b1113c169ccb911152b18e288 | https://github.com/PSESD/chms-common/blob/dba29f95de57cb6b1113c169ccb911152b18e288/lib/Auth/Acl.php#L147-L163 |
5,435 | PSESD/chms-common | lib/Auth/Acl.php | Acl.getContextualAcl | public function getContextualAcl()
{
$acl = $this->getRules();
if (!$acl->hasRole($this->getContextId())) {
$contextRoles = $this->getContext()->getRoles();
if ($contextRoles instanceof RoleBucket) {
$contextRoles = $contextRoles->toArray();
}
... | php | public function getContextualAcl()
{
$acl = $this->getRules();
if (!$acl->hasRole($this->getContextId())) {
$contextRoles = $this->getContext()->getRoles();
if ($contextRoles instanceof RoleBucket) {
$contextRoles = $contextRoles->toArray();
}
... | [
"public",
"function",
"getContextualAcl",
"(",
")",
"{",
"$",
"acl",
"=",
"$",
"this",
"->",
"getRules",
"(",
")",
";",
"if",
"(",
"!",
"$",
"acl",
"->",
"hasRole",
"(",
"$",
"this",
"->",
"getContextId",
"(",
")",
")",
")",
"{",
"$",
"contextRoles... | Set up ACL rules with the current context
@return AclRules | [
"Set",
"up",
"ACL",
"rules",
"with",
"the",
"current",
"context"
] | dba29f95de57cb6b1113c169ccb911152b18e288 | https://github.com/PSESD/chms-common/blob/dba29f95de57cb6b1113c169ccb911152b18e288/lib/Auth/Acl.php#L171-L182 |
5,436 | PSESD/chms-common | lib/Auth/Acl.php | Acl.getContext | public function getContext()
{
if (!isset($this->currentContext)) {
$this->initiateContext();
}
return $this->contexts[$this->currentContext];
} | php | public function getContext()
{
if (!isset($this->currentContext)) {
$this->initiateContext();
}
return $this->contexts[$this->currentContext];
} | [
"public",
"function",
"getContext",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"currentContext",
")",
")",
"{",
"$",
"this",
"->",
"initiateContext",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"contexts",
"[",
"$",
"this",
... | Get the current context
@return AclContextContract | [
"Get",
"the",
"current",
"context"
] | dba29f95de57cb6b1113c169ccb911152b18e288 | https://github.com/PSESD/chms-common/blob/dba29f95de57cb6b1113c169ccb911152b18e288/lib/Auth/Acl.php#L223-L229 |
5,437 | PSESD/chms-common | lib/Auth/Acl.php | Acl.initiateContext | private function initiateContext(Model $modelObject = null)
{
$context = $this->getContextFromAuth($modelObject);
$this->registerContext($context);
$this->currentContext = $context->getId();
//\dump($context->getRoles()->toArray());exit;
return $context;
} | php | private function initiateContext(Model $modelObject = null)
{
$context = $this->getContextFromAuth($modelObject);
$this->registerContext($context);
$this->currentContext = $context->getId();
//\dump($context->getRoles()->toArray());exit;
return $context;
} | [
"private",
"function",
"initiateContext",
"(",
"Model",
"$",
"modelObject",
"=",
"null",
")",
"{",
"$",
"context",
"=",
"$",
"this",
"->",
"getContextFromAuth",
"(",
"$",
"modelObject",
")",
";",
"$",
"this",
"->",
"registerContext",
"(",
"$",
"context",
"... | Initiate a context
@param Model $modelObject Optional protected model
@return AclContextContract | [
"Initiate",
"a",
"context"
] | dba29f95de57cb6b1113c169ccb911152b18e288 | https://github.com/PSESD/chms-common/blob/dba29f95de57cb6b1113c169ccb911152b18e288/lib/Auth/Acl.php#L247-L254 |
5,438 | PSESD/chms-common | lib/Auth/Acl.php | Acl.getRules | public function getRules($useCache = true)
{
if (!$useCache) { // || env('APP_ENV') !== 'production'
return $this->loadRules();
}
if ($this->aclRulesCache === null) {
$hash = sha1(serialize($this->config));
$key = md5(__CLASS__.__FUNCTION__);
... | php | public function getRules($useCache = true)
{
if (!$useCache) { // || env('APP_ENV') !== 'production'
return $this->loadRules();
}
if ($this->aclRulesCache === null) {
$hash = sha1(serialize($this->config));
$key = md5(__CLASS__.__FUNCTION__);
... | [
"public",
"function",
"getRules",
"(",
"$",
"useCache",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"useCache",
")",
"{",
"// || env('APP_ENV') !== 'production'",
"return",
"$",
"this",
"->",
"loadRules",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->"... | Get the ACL object; use cache when possible
@param boolean $useCache
@return AclRules | [
"Get",
"the",
"ACL",
"object",
";",
"use",
"cache",
"when",
"possible"
] | dba29f95de57cb6b1113c169ccb911152b18e288 | https://github.com/PSESD/chms-common/blob/dba29f95de57cb6b1113c169ccb911152b18e288/lib/Auth/Acl.php#L294-L313 |
5,439 | wpfulcrum/foundation | src/Foundation/Ajax.php | AJAX.ajaxResponseHandler | protected function ajaxResponseHandler()
{
echo json_encode([
'success' => $this->errorMessage ? 0 : 1,
'errorMessage' => $this->errorMessage,
'errorCode' => $this->errorCode,
'data' => $this->errorMessage ? '' : $this->dataPacket,
]);
... | php | protected function ajaxResponseHandler()
{
echo json_encode([
'success' => $this->errorMessage ? 0 : 1,
'errorMessage' => $this->errorMessage,
'errorCode' => $this->errorCode,
'data' => $this->errorMessage ? '' : $this->dataPacket,
]);
... | [
"protected",
"function",
"ajaxResponseHandler",
"(",
")",
"{",
"echo",
"json_encode",
"(",
"[",
"'success'",
"=>",
"$",
"this",
"->",
"errorMessage",
"?",
"0",
":",
"1",
",",
"'errorMessage'",
"=>",
"$",
"this",
"->",
"errorMessage",
",",
"'errorCode'",
"=>"... | AJAX Response Handler - Builds the response and returns it to the JavaScript
@since 3.0.0
@return null | [
"AJAX",
"Response",
"Handler",
"-",
"Builds",
"the",
"response",
"and",
"returns",
"it",
"to",
"the",
"JavaScript"
] | a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56 | https://github.com/wpfulcrum/foundation/blob/a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56/src/Foundation/Ajax.php#L98-L108 |
5,440 | wpfulcrum/foundation | src/Foundation/Ajax.php | AJAX.initProperties | protected function initProperties()
{
$this->errorMessage = '';
array_walk($this->config->dataPacket, [$this, 'initDataPacket']);
$this->errorCode = 0;
} | php | protected function initProperties()
{
$this->errorMessage = '';
array_walk($this->config->dataPacket, [$this, 'initDataPacket']);
$this->errorCode = 0;
} | [
"protected",
"function",
"initProperties",
"(",
")",
"{",
"$",
"this",
"->",
"errorMessage",
"=",
"''",
";",
"array_walk",
"(",
"$",
"this",
"->",
"config",
"->",
"dataPacket",
",",
"[",
"$",
"this",
",",
"'initDataPacket'",
"]",
")",
";",
"$",
"this",
... | Initialize the properties
@since 3.0.0
@return null | [
"Initialize",
"the",
"properties"
] | a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56 | https://github.com/wpfulcrum/foundation/blob/a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56/src/Foundation/Ajax.php#L131-L136 |
5,441 | wpfulcrum/foundation | src/Foundation/Ajax.php | AJAX.initDataPacket | protected function initDataPacket($filter, $key)
{
if (!array_key_exists($key, $_POST)) {
$this->errorMessage = $this->config->messages[$key];
$this->ajax_response_handler();
}
$this->dataPacket[$key] = $filter($_POST[$key]);
} | php | protected function initDataPacket($filter, $key)
{
if (!array_key_exists($key, $_POST)) {
$this->errorMessage = $this->config->messages[$key];
$this->ajax_response_handler();
}
$this->dataPacket[$key] = $filter($_POST[$key]);
} | [
"protected",
"function",
"initDataPacket",
"(",
"$",
"filter",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"_POST",
")",
")",
"{",
"$",
"this",
"->",
"errorMessage",
"=",
"$",
"this",
"->",
"config",
"->"... | Initialize data packet
@since 3.0.0
@param string $filter
@param string $key
@return null | [
"Initialize",
"data",
"packet"
] | a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56 | https://github.com/wpfulcrum/foundation/blob/a9655d8fa3bcc4b9d99586bb84a9f36dfa63ed56/src/Foundation/Ajax.php#L148-L155 |
5,442 | Celarius/nofuzz-framework | src/Helpers/EWT.php | EWT.decode | public static function decode(string $data, string $secret )
{
# Make a HASH of the secret
$secret = openssl_digest($secret,'sha256');
$b64 = static::base64url_decode($data);
$ewt = json_decode($b64,true);
$payload = openssl_decrypt($ewt['p'], $ewt['a'], $secret, 0, $ewt['i']);
# Verify sig... | php | public static function decode(string $data, string $secret )
{
# Make a HASH of the secret
$secret = openssl_digest($secret,'sha256');
$b64 = static::base64url_decode($data);
$ewt = json_decode($b64,true);
$payload = openssl_decrypt($ewt['p'], $ewt['a'], $secret, 0, $ewt['i']);
# Verify sig... | [
"public",
"static",
"function",
"decode",
"(",
"string",
"$",
"data",
",",
"string",
"$",
"secret",
")",
"{",
"# Make a HASH of the secret",
"$",
"secret",
"=",
"openssl_digest",
"(",
"$",
"secret",
",",
"'sha256'",
")",
";",
"$",
"b64",
"=",
"static",
"::... | Decode an EWT, returning the payload
@param string $data The encrypted EWT base64 string
@param string $secret Secret password used when encrypting
@return string|null | [
"Decode",
"an",
"EWT",
"returning",
"the",
"payload"
] | 867c5150baa431e8f800624a26ba80e95eebd4e5 | https://github.com/Celarius/nofuzz-framework/blob/867c5150baa431e8f800624a26ba80e95eebd4e5/src/Helpers/EWT.php#L109-L125 |
5,443 | Celarius/nofuzz-framework | src/Helpers/EWT.php | EWT.base64url_decode | public static function base64url_decode($input)
{
$remainder = strlen($input) % 4;
if ($remainder) {
$padlen = 4 - $remainder;
$input .= str_repeat('=', $padlen);
}
return base64_decode(strtr($input, '-_', '+/'));
} | php | public static function base64url_decode($input)
{
$remainder = strlen($input) % 4;
if ($remainder) {
$padlen = 4 - $remainder;
$input .= str_repeat('=', $padlen);
}
return base64_decode(strtr($input, '-_', '+/'));
} | [
"public",
"static",
"function",
"base64url_decode",
"(",
"$",
"input",
")",
"{",
"$",
"remainder",
"=",
"strlen",
"(",
"$",
"input",
")",
"%",
"4",
";",
"if",
"(",
"$",
"remainder",
")",
"{",
"$",
"padlen",
"=",
"4",
"-",
"$",
"remainder",
";",
"$"... | URL compatible Base64 Decode
@param string $input A base64 encoded string
@return mixed Decoded data | [
"URL",
"compatible",
"Base64",
"Decode"
] | 867c5150baa431e8f800624a26ba80e95eebd4e5 | https://github.com/Celarius/nofuzz-framework/blob/867c5150baa431e8f800624a26ba80e95eebd4e5/src/Helpers/EWT.php#L146-L155 |
5,444 | pokap/pool-dbm | src/Pok/PoolDBM/Mapping/Driver/AnnotationDriver.php | AnnotationDriver.create | public static function create($paths = array(), Reader $reader = null)
{
if ($reader == null) {
$reader = new AnnotationReader();
}
return new self($reader, $paths);
} | php | public static function create($paths = array(), Reader $reader = null)
{
if ($reader == null) {
$reader = new AnnotationReader();
}
return new self($reader, $paths);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"paths",
"=",
"array",
"(",
")",
",",
"Reader",
"$",
"reader",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"reader",
"==",
"null",
")",
"{",
"$",
"reader",
"=",
"new",
"AnnotationReader",
"(",
")",
";"... | Factory method for the Annotation Driver
@param array|string $paths
@param Reader $reader
@return AnnotationDriver | [
"Factory",
"method",
"for",
"the",
"Annotation",
"Driver"
] | cce32d7cb5f13f42c358c8140b2f97ddf1d9435a | https://github.com/pokap/pool-dbm/blob/cce32d7cb5f13f42c358c8140b2f97ddf1d9435a/src/Pok/PoolDBM/Mapping/Driver/AnnotationDriver.php#L64-L71 |
5,445 | GovTribe/laravel-kinvey | src/GovTribe/LaravelKinvey/LaravelKinveyServiceProvider.php | LaravelKinveyServiceProvider.buildKinveyAPIClient | public function buildKinveyAPIClient()
{
require __DIR__ . '/Client/Service/APIV2Description.php';
require __DIR__ . '/Client/Service/ServiceBuilder.php';
$client = ServiceBuilder::factory($serviceBuilder)->get('KinveyClient');
$client->setDescription(ServiceDescription::factory($APIV2Description));
return... | php | public function buildKinveyAPIClient()
{
require __DIR__ . '/Client/Service/APIV2Description.php';
require __DIR__ . '/Client/Service/ServiceBuilder.php';
$client = ServiceBuilder::factory($serviceBuilder)->get('KinveyClient');
$client->setDescription(ServiceDescription::factory($APIV2Description));
return... | [
"public",
"function",
"buildKinveyAPIClient",
"(",
")",
"{",
"require",
"__DIR__",
".",
"'/Client/Service/APIV2Description.php'",
";",
"require",
"__DIR__",
".",
"'/Client/Service/ServiceBuilder.php'",
";",
"$",
"client",
"=",
"ServiceBuilder",
"::",
"factory",
"(",
"$"... | Build the Kinvey API client.
@return Guzzle\Service\Client | [
"Build",
"the",
"Kinvey",
"API",
"client",
"."
] | 8a25dafdf80a933384dfcfe8b70b0a7663fe9289 | https://github.com/GovTribe/laravel-kinvey/blob/8a25dafdf80a933384dfcfe8b70b0a7663fe9289/src/GovTribe/LaravelKinvey/LaravelKinveyServiceProvider.php#L55-L64 |
5,446 | SocietyCMS/Core | Console/Demo/DemoMode.php | DemoMode.enable | public function enable(Command $command)
{
$command->call('down');
foreach ($this->scripts as $script) {
try {
$this->app->make($script)->fire($command);
} catch (\Exception $e) {
$command->error($e->getMessage());
return fals... | php | public function enable(Command $command)
{
$command->call('down');
foreach ($this->scripts as $script) {
try {
$this->app->make($script)->fire($command);
} catch (\Exception $e) {
$command->error($e->getMessage());
return fals... | [
"public",
"function",
"enable",
"(",
"Command",
"$",
"command",
")",
"{",
"$",
"command",
"->",
"call",
"(",
"'down'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"scripts",
"as",
"$",
"script",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"app",
"->"... | Fire demo scripts.
@param Command $command
@return bool | [
"Fire",
"demo",
"scripts",
"."
] | fb6be1b1dd46c89a976c02feb998e9af01ddca54 | https://github.com/SocietyCMS/Core/blob/fb6be1b1dd46c89a976c02feb998e9af01ddca54/Console/Demo/DemoMode.php#L48-L65 |
5,447 | marando/phpSOFA | src/Marando/IAU/iauPr00.php | iauPr00.Pr00 | public static function Pr00($date1, $date2, &$dpsipr, &$depspr) {
$t;
/* Precession and obliquity corrections (radians per century) */
$PRECOR = -0.29965 * DAS2R;
$OBLCOR = -0.02524 * DAS2R;
/* Interval between fundamental epoch J2000.0 and given date (JC). */
$t = (($date1 - DJ00) + $date2) /... | php | public static function Pr00($date1, $date2, &$dpsipr, &$depspr) {
$t;
/* Precession and obliquity corrections (radians per century) */
$PRECOR = -0.29965 * DAS2R;
$OBLCOR = -0.02524 * DAS2R;
/* Interval between fundamental epoch J2000.0 and given date (JC). */
$t = (($date1 - DJ00) + $date2) /... | [
"public",
"static",
"function",
"Pr00",
"(",
"$",
"date1",
",",
"$",
"date2",
",",
"&",
"$",
"dpsipr",
",",
"&",
"$",
"depspr",
")",
"{",
"$",
"t",
";",
"/* Precession and obliquity corrections (radians per century) */",
"$",
"PRECOR",
"=",
"-",
"0.29965",
"... | - - - - - - - -
i a u P r 0 0
- - - - - - - -
Precession-rate part of the IAU 2000 precession-nutation models
(part of MHB2000).
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: canonical model.
Given:
date1,date2 double TT a... | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"P",
"r",
"0",
"0",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauPr00.php#L83-L98 |
5,448 | seeren/view | src/Template/XMLTemplate.php | XMLTemplate.appendTo | protected final function appendTo(
SimpleXMLElement $parent,
SimpleXMLElement $child): SimpleXMLElement
{
$dom = dom_import_simplexml($parent);
$dom->appendChild(
$dom->ownerDocument->importNode(dom_import_simplexml($child),
true));
return $parent;
... | php | protected final function appendTo(
SimpleXMLElement $parent,
SimpleXMLElement $child): SimpleXMLElement
{
$dom = dom_import_simplexml($parent);
$dom->appendChild(
$dom->ownerDocument->importNode(dom_import_simplexml($child),
true));
return $parent;
... | [
"protected",
"final",
"function",
"appendTo",
"(",
"SimpleXMLElement",
"$",
"parent",
",",
"SimpleXMLElement",
"$",
"child",
")",
":",
"SimpleXMLElement",
"{",
"$",
"dom",
"=",
"dom_import_simplexml",
"(",
"$",
"parent",
")",
";",
"$",
"dom",
"->",
"appendChil... | Append a SimpleXmlElement
@param SimpleXMLElement $parent parent node
@param SimpleXMLElement $child child node
@return SimpleXMLElement parent | [
"Append",
"a",
"SimpleXmlElement"
] | 7c5feb9082d1f0f245ea16789c2bf3790dffe647 | https://github.com/seeren/view/blob/7c5feb9082d1f0f245ea16789c2bf3790dffe647/src/Template/XMLTemplate.php#L55-L64 |
5,449 | seeren/view | src/Template/XMLTemplate.php | XMLTemplate.appendXMLTo | protected final function appendXMLTo(
SimpleXMLElement $parent,
string $child): SimpleXMLElement
{
return $this->appendTo(
$parent,
simplexml_load_string(str_replace("\n", "\n\t", $child)));
} | php | protected final function appendXMLTo(
SimpleXMLElement $parent,
string $child): SimpleXMLElement
{
return $this->appendTo(
$parent,
simplexml_load_string(str_replace("\n", "\n\t", $child)));
} | [
"protected",
"final",
"function",
"appendXMLTo",
"(",
"SimpleXMLElement",
"$",
"parent",
",",
"string",
"$",
"child",
")",
":",
"SimpleXMLElement",
"{",
"return",
"$",
"this",
"->",
"appendTo",
"(",
"$",
"parent",
",",
"simplexml_load_string",
"(",
"str_replace"... | Append an xml string to a SimpleXmlElement
@param SimpleXMLElement $parent parent node
@param string $child child node to string
@return SimpleXMLElement parent | [
"Append",
"an",
"xml",
"string",
"to",
"a",
"SimpleXmlElement"
] | 7c5feb9082d1f0f245ea16789c2bf3790dffe647 | https://github.com/seeren/view/blob/7c5feb9082d1f0f245ea16789c2bf3790dffe647/src/Template/XMLTemplate.php#L73-L80 |
5,450 | seeren/view | src/Template/XMLTemplate.php | XMLTemplate.appendValueTo | protected final function appendValueTo(
SimpleXMLElement $parent,
$key,
$value): SimpleXMLElement
{
$parent->addChild($key);
if (is_object($value) || is_array($value)) {
foreach ($value as $subKey => $subValue) {
$this->appendValueTo($parent->{$key... | php | protected final function appendValueTo(
SimpleXMLElement $parent,
$key,
$value): SimpleXMLElement
{
$parent->addChild($key);
if (is_object($value) || is_array($value)) {
foreach ($value as $subKey => $subValue) {
$this->appendValueTo($parent->{$key... | [
"protected",
"final",
"function",
"appendValueTo",
"(",
"SimpleXMLElement",
"$",
"parent",
",",
"$",
"key",
",",
"$",
"value",
")",
":",
"SimpleXMLElement",
"{",
"$",
"parent",
"->",
"addChild",
"(",
"$",
"key",
")",
";",
"if",
"(",
"is_object",
"(",
"$"... | Append a value to a SimpleXmlElement
@param SimpleXMLElement $parent parent node
@param string $key value key
@param mixed $value value
@return SimpleXMLElement | [
"Append",
"a",
"value",
"to",
"a",
"SimpleXmlElement"
] | 7c5feb9082d1f0f245ea16789c2bf3790dffe647 | https://github.com/seeren/view/blob/7c5feb9082d1f0f245ea16789c2bf3790dffe647/src/Template/XMLTemplate.php#L90-L107 |
5,451 | CableFramework/Annotations | src/Cable/Annotation/Parser/DirectParser.php | DirectParser.findCommand | private function findCommand($i, array $matches)
{
$match = $matches[0][$i];
$cmd = isset($matches['function'][$i]) ? $matches['function'][$i] : '';
return [$match, $cmd];
} | php | private function findCommand($i, array $matches)
{
$match = $matches[0][$i];
$cmd = isset($matches['function'][$i]) ? $matches['function'][$i] : '';
return [$match, $cmd];
} | [
"private",
"function",
"findCommand",
"(",
"$",
"i",
",",
"array",
"$",
"matches",
")",
"{",
"$",
"match",
"=",
"$",
"matches",
"[",
"0",
"]",
"[",
"$",
"i",
"]",
";",
"$",
"cmd",
"=",
"isset",
"(",
"$",
"matches",
"[",
"'function'",
"]",
"[",
... | find command and match string
@param int $i
@param array $matches
@return array | [
"find",
"command",
"and",
"match",
"string"
] | 2fcac6f4e7b1d27655ce87dd82dfb485dcade28e | https://github.com/CableFramework/Annotations/blob/2fcac6f4e7b1d27655ce87dd82dfb485dcade28e/src/Cable/Annotation/Parser/DirectParser.php#L69-L75 |
5,452 | CableFramework/Annotations | src/Cable/Annotation/Parser/DirectParser.php | DirectParser.findString | private function findString($i, array $matches)
{
$string = isset($matches[0][$i]) ? $matches[0][$i] : '';
return substr($string, 1, -1);
} | php | private function findString($i, array $matches)
{
$string = isset($matches[0][$i]) ? $matches[0][$i] : '';
return substr($string, 1, -1);
} | [
"private",
"function",
"findString",
"(",
"$",
"i",
",",
"array",
"$",
"matches",
")",
"{",
"$",
"string",
"=",
"isset",
"(",
"$",
"matches",
"[",
"0",
"]",
"[",
"$",
"i",
"]",
")",
"?",
"$",
"matches",
"[",
"0",
"]",
"[",
"$",
"i",
"]",
":",... | find string and return it
@param int $i
@param array $matches
@return bool|string | [
"find",
"string",
"and",
"return",
"it"
] | 2fcac6f4e7b1d27655ce87dd82dfb485dcade28e | https://github.com/CableFramework/Annotations/blob/2fcac6f4e7b1d27655ce87dd82dfb485dcade28e/src/Cable/Annotation/Parser/DirectParser.php#L84-L90 |
5,453 | quantaphp/class-names | src/VendorDirectory.php | VendorDirectory.isValidNamespace | private function isValidNamespace($namespace, $directories): bool
{
if (is_string($namespace) && is_array($directories)) {
$total = count($directories);
$valid = count(array_filter($directories, 'is_string'));
return $total > 0 && $total == $valid;
}
ret... | php | private function isValidNamespace($namespace, $directories): bool
{
if (is_string($namespace) && is_array($directories)) {
$total = count($directories);
$valid = count(array_filter($directories, 'is_string'));
return $total > 0 && $total == $valid;
}
ret... | [
"private",
"function",
"isValidNamespace",
"(",
"$",
"namespace",
",",
"$",
"directories",
")",
":",
"bool",
"{",
"if",
"(",
"is_string",
"(",
"$",
"namespace",
")",
"&&",
"is_array",
"(",
"$",
"directories",
")",
")",
"{",
"$",
"total",
"=",
"count",
... | Return whether the given values defines a valid namespace.
@param mixed $namespace
@param mixed $directories
@return bool | [
"Return",
"whether",
"the",
"given",
"values",
"defines",
"a",
"valid",
"namespace",
"."
] | 2c0aea13ff82aa70df0fe6f78247415d15a994d1 | https://github.com/quantaphp/class-names/blob/2c0aea13ff82aa70df0fe6f78247415d15a994d1/src/VendorDirectory.php#L39-L49 |
5,454 | quantaphp/class-names | src/VendorDirectory.php | VendorDirectory.namespaces | private function namespaces(): \Generator
{
foreach ($this->map() as $namespace => $directories) {
if ($this->isValidNamespace($namespace, $directories)) {
yield new Psr4Namespace($namespace, ...$directories);
}
}
} | php | private function namespaces(): \Generator
{
foreach ($this->map() as $namespace => $directories) {
if ($this->isValidNamespace($namespace, $directories)) {
yield new Psr4Namespace($namespace, ...$directories);
}
}
} | [
"private",
"function",
"namespaces",
"(",
")",
":",
"\\",
"Generator",
"{",
"foreach",
"(",
"$",
"this",
"->",
"map",
"(",
")",
"as",
"$",
"namespace",
"=>",
"$",
"directories",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isValidNamespace",
"(",
"$",
"n... | Yield an instance of Psr4Namespace for each entry of the autoload map.
@return \Generator | [
"Yield",
"an",
"instance",
"of",
"Psr4Namespace",
"for",
"each",
"entry",
"of",
"the",
"autoload",
"map",
"."
] | 2c0aea13ff82aa70df0fe6f78247415d15a994d1 | https://github.com/quantaphp/class-names/blob/2c0aea13ff82aa70df0fe6f78247415d15a994d1/src/VendorDirectory.php#L70-L77 |
5,455 | jeromeklam/freefw | src/FreeFW/JsonApi/V1/Model/Document.php | Document.getFromObject | protected function getFromObject(\stdClass $p_data = null)
{
if (isset($p_data->data)) {
$data = $p_data->data;
if ($data instanceof \stdClass) {
// Single object
$this->data = $this->getResourceObject($data);
} else {
if (i... | php | protected function getFromObject(\stdClass $p_data = null)
{
if (isset($p_data->data)) {
$data = $p_data->data;
if ($data instanceof \stdClass) {
// Single object
$this->data = $this->getResourceObject($data);
} else {
if (i... | [
"protected",
"function",
"getFromObject",
"(",
"\\",
"stdClass",
"$",
"p_data",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"p_data",
"->",
"data",
")",
")",
"{",
"$",
"data",
"=",
"$",
"p_data",
"->",
"data",
";",
"if",
"(",
"$",
"data",
... | Get from StdClass
@param \stdClass $p_data
@return \FreeFW\JsonApi\V1\Model\Document | [
"Get",
"from",
"StdClass"
] | 16ecf24192375c920a070296f396b9d3fd994a1e | https://github.com/jeromeklam/freefw/blob/16ecf24192375c920a070296f396b9d3fd994a1e/src/FreeFW/JsonApi/V1/Model/Document.php#L155-L171 |
5,456 | jeromeklam/freefw | src/FreeFW/JsonApi/V1/Model/Document.php | Document.isSimpleResource | public function isSimpleResource()
{
if ($this->data instanceof \FreeFW\JsonApi\V1\Model\ResourceObject) {
return true;
}
return false;
} | php | public function isSimpleResource()
{
if ($this->data instanceof \FreeFW\JsonApi\V1\Model\ResourceObject) {
return true;
}
return false;
} | [
"public",
"function",
"isSimpleResource",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"data",
"instanceof",
"\\",
"FreeFW",
"\\",
"JsonApi",
"\\",
"V1",
"\\",
"Model",
"\\",
"ResourceObject",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",... | Simple resource ?
@return boolean | [
"Simple",
"resource",
"?"
] | 16ecf24192375c920a070296f396b9d3fd994a1e | https://github.com/jeromeklam/freefw/blob/16ecf24192375c920a070296f396b9d3fd994a1e/src/FreeFW/JsonApi/V1/Model/Document.php#L193-L199 |
5,457 | jeromeklam/freefw | src/FreeFW/JsonApi/V1/Model/Document.php | Document.getHttpCode | public function getHttpCode()
{
$code= 200;
if ($this->errors) {
/**
* @var \FreeFW\JsonApi\V1\Model\ErrorObject $oneError
*/
foreach ($this->errors as $idx => $oneError) {
if ($oneError->getStatus() > $code) {
$co... | php | public function getHttpCode()
{
$code= 200;
if ($this->errors) {
/**
* @var \FreeFW\JsonApi\V1\Model\ErrorObject $oneError
*/
foreach ($this->errors as $idx => $oneError) {
if ($oneError->getStatus() > $code) {
$co... | [
"public",
"function",
"getHttpCode",
"(",
")",
"{",
"$",
"code",
"=",
"200",
";",
"if",
"(",
"$",
"this",
"->",
"errors",
")",
"{",
"/**\n * @var \\FreeFW\\JsonApi\\V1\\Model\\ErrorObject $oneError\n */",
"foreach",
"(",
"$",
"this",
"->",
"e... | Get Http code
@return int | [
"Get",
"Http",
"code"
] | 16ecf24192375c920a070296f396b9d3fd994a1e | https://github.com/jeromeklam/freefw/blob/16ecf24192375c920a070296f396b9d3fd994a1e/src/FreeFW/JsonApi/V1/Model/Document.php#L216-L230 |
5,458 | emaphp/eMapper | lib/eMapper/Fluent/Query/Clause/ArgumentClause.php | ArgumentClause.build | public function build(Schema &$schema, $alias = null) {
if ($this->clause instanceof SQLPredicate) {
if (!is_null($alias))
$this->clause->setAlias($alias);
return $this->clause->evaluate($this->driver, $schema);
}
return $this->clause;
} | php | public function build(Schema &$schema, $alias = null) {
if ($this->clause instanceof SQLPredicate) {
if (!is_null($alias))
$this->clause->setAlias($alias);
return $this->clause->evaluate($this->driver, $schema);
}
return $this->clause;
} | [
"public",
"function",
"build",
"(",
"Schema",
"&",
"$",
"schema",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"clause",
"instanceof",
"SQLPredicate",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"alias",
")",
")",
"$",... | Builds current clause
@param \eMapper\Query\Schema $schema
@param string alias
@return string | [
"Builds",
"current",
"clause"
] | df7100e601d2a1363d07028a786b6ceb22271829 | https://github.com/emaphp/eMapper/blob/df7100e601d2a1363d07028a786b6ceb22271829/lib/eMapper/Fluent/Query/Clause/ArgumentClause.php#L56-L64 |
5,459 | rseyferth/chickenwire | src/ChickenWire/I18n.php | I18n.setLocale | public static function setLocale($locale)
{
static::$_locale = $locale;
// Apply to PHP locale
$sysLocales = \ChickenWire\Application::getConfiguration()->systemLocales;
if (array_key_exists($locale, $sysLocales)) {
setlocale(LC_ALL, $sysLocales[$locale]);
}
} | php | public static function setLocale($locale)
{
static::$_locale = $locale;
// Apply to PHP locale
$sysLocales = \ChickenWire\Application::getConfiguration()->systemLocales;
if (array_key_exists($locale, $sysLocales)) {
setlocale(LC_ALL, $sysLocales[$locale]);
}
} | [
"public",
"static",
"function",
"setLocale",
"(",
"$",
"locale",
")",
"{",
"static",
"::",
"$",
"_locale",
"=",
"$",
"locale",
";",
"// Apply to PHP locale",
"$",
"sysLocales",
"=",
"\\",
"ChickenWire",
"\\",
"Application",
"::",
"getConfiguration",
"(",
")",
... | Set the current locale
@param string The locale to use | [
"Set",
"the",
"current",
"locale"
] | 74921f0a0d489366602e25df43eda894719e43d3 | https://github.com/rseyferth/chickenwire/blob/74921f0a0d489366602e25df43eda894719e43d3/src/ChickenWire/I18n.php#L80-L90 |
5,460 | rseyferth/chickenwire | src/ChickenWire/I18n.php | I18n.setDefaultLocale | public static function setDefaultLocale($locale)
{
static::$_defaultLocale = $locale;
// Apply to PHP locale
if (is_null(static::$_locale)) {
$sysLocales = \ChickenWire\Application::getConfiguration()->systemLocales;
if (array_key_exists($locale, $sysLocales)) {
setlocale(LC_ALL, $sysLocale... | php | public static function setDefaultLocale($locale)
{
static::$_defaultLocale = $locale;
// Apply to PHP locale
if (is_null(static::$_locale)) {
$sysLocales = \ChickenWire\Application::getConfiguration()->systemLocales;
if (array_key_exists($locale, $sysLocales)) {
setlocale(LC_ALL, $sysLocale... | [
"public",
"static",
"function",
"setDefaultLocale",
"(",
"$",
"locale",
")",
"{",
"static",
"::",
"$",
"_defaultLocale",
"=",
"$",
"locale",
";",
"// Apply to PHP locale",
"if",
"(",
"is_null",
"(",
"static",
"::",
"$",
"_locale",
")",
")",
"{",
"$",
"sysL... | Set the default locale
@param string The default locale | [
"Set",
"the",
"default",
"locale"
] | 74921f0a0d489366602e25df43eda894719e43d3 | https://github.com/rseyferth/chickenwire/blob/74921f0a0d489366602e25df43eda894719e43d3/src/ChickenWire/I18n.php#L106-L118 |
5,461 | rseyferth/chickenwire | src/ChickenWire/I18n.php | I18n.getAll | public static function getAll($prefix = '')
{
// Make backend load all
$backend = static::getBackend();
$backend->loadAll($prefix);
// Now return requested translations
return $backend->translations($prefix);
} | php | public static function getAll($prefix = '')
{
// Make backend load all
$backend = static::getBackend();
$backend->loadAll($prefix);
// Now return requested translations
return $backend->translations($prefix);
} | [
"public",
"static",
"function",
"getAll",
"(",
"$",
"prefix",
"=",
"''",
")",
"{",
"// Make backend load all",
"$",
"backend",
"=",
"static",
"::",
"getBackend",
"(",
")",
";",
"$",
"backend",
"->",
"loadAll",
"(",
"$",
"prefix",
")",
";",
"// Now return r... | Get an array containing all i18n keys for all locales
@param string A prefix filter for the keys to load, e.g.: nl.bmk.
@return array | [
"Get",
"an",
"array",
"containing",
"all",
"i18n",
"keys",
"for",
"all",
"locales"
] | 74921f0a0d489366602e25df43eda894719e43d3 | https://github.com/rseyferth/chickenwire/blob/74921f0a0d489366602e25df43eda894719e43d3/src/ChickenWire/I18n.php#L144-L154 |
5,462 | rseyferth/chickenwire | src/ChickenWire/I18n.php | I18n.parseFloat | public static function parseFloat($floatString){
$LocaleInfo = localeconv();
$floatString = str_replace($LocaleInfo["mon_thousands_sep"] , "", $floatString);
$floatString = str_replace($LocaleInfo["mon_decimal_point"] , ".", $floatString);
return floatval($floatString);
} | php | public static function parseFloat($floatString){
$LocaleInfo = localeconv();
$floatString = str_replace($LocaleInfo["mon_thousands_sep"] , "", $floatString);
$floatString = str_replace($LocaleInfo["mon_decimal_point"] , ".", $floatString);
return floatval($floatString);
} | [
"public",
"static",
"function",
"parseFloat",
"(",
"$",
"floatString",
")",
"{",
"$",
"LocaleInfo",
"=",
"localeconv",
"(",
")",
";",
"$",
"floatString",
"=",
"str_replace",
"(",
"$",
"LocaleInfo",
"[",
"\"mon_thousands_sep\"",
"]",
",",
"\"\"",
",",
"$",
... | Parse a float value with localization in mind
@param string $floatString The string representation of a floating number
@return float The float value | [
"Parse",
"a",
"float",
"value",
"with",
"localization",
"in",
"mind"
] | 74921f0a0d489366602e25df43eda894719e43d3 | https://github.com/rseyferth/chickenwire/blob/74921f0a0d489366602e25df43eda894719e43d3/src/ChickenWire/I18n.php#L173-L178 |
5,463 | tonjoo/almari | src/Container.php | Container.bind | public function bind($name,$params)
{
$this->instances[$name] = $params;
$this->bind[$name] = true;
} | php | public function bind($name,$params)
{
$this->instances[$name] = $params;
$this->bind[$name] = true;
} | [
"public",
"function",
"bind",
"(",
"$",
"name",
",",
"$",
"params",
")",
"{",
"$",
"this",
"->",
"instances",
"[",
"$",
"name",
"]",
"=",
"$",
"params",
";",
"$",
"this",
"->",
"bind",
"[",
"$",
"name",
"]",
"=",
"true",
";",
"}"
] | Register service to the container | [
"Register",
"service",
"to",
"the",
"container"
] | 46cbcf63dab67be544468052b22a325d68c33c79 | https://github.com/tonjoo/almari/blob/46cbcf63dab67be544468052b22a325d68c33c79/src/Container.php#L51-L57 |
5,464 | tonjoo/almari | src/Container.php | Container.resolve | private function resolve($name)
{
// set as resolved
$this->resolved[$name] = true;
// resolve the service
if (is_string($this->instances[$name]) && class_exists($this->instances[$name]))
{
$object = $this->instances[$name];
... | php | private function resolve($name)
{
// set as resolved
$this->resolved[$name] = true;
// resolve the service
if (is_string($this->instances[$name]) && class_exists($this->instances[$name]))
{
$object = $this->instances[$name];
... | [
"private",
"function",
"resolve",
"(",
"$",
"name",
")",
"{",
"// set as resolved",
"$",
"this",
"->",
"resolved",
"[",
"$",
"name",
"]",
"=",
"true",
";",
"// resolve the service",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"instances",
"[",
"$",
"... | Try to resolve the service | [
"Try",
"to",
"resolve",
"the",
"service"
] | 46cbcf63dab67be544468052b22a325d68c33c79 | https://github.com/tonjoo/almari/blob/46cbcf63dab67be544468052b22a325d68c33c79/src/Container.php#L112-L136 |
5,465 | jmpantoja/planb-utils | src/Type/Text/TextAssurance.php | TextAssurance.fromStringifable | public static function fromStringifable(Stringifable $object): self
{
if ($object instanceof Text) {
return self::fromText($object);
}
$text = Text::make($object->stringify());
return new static($text);
} | php | public static function fromStringifable(Stringifable $object): self
{
if ($object instanceof Text) {
return self::fromText($object);
}
$text = Text::make($object->stringify());
return new static($text);
} | [
"public",
"static",
"function",
"fromStringifable",
"(",
"Stringifable",
"$",
"object",
")",
":",
"self",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"Text",
")",
"{",
"return",
"self",
"::",
"fromText",
"(",
"$",
"object",
")",
";",
"}",
"$",
"text",
... | Crea una nueva instancia a partir de un objeto Stringifable
@param \PlanB\Type\Stringifable $object
@return \PlanB\Type\Text\TextAssurance | [
"Crea",
"una",
"nueva",
"instancia",
"a",
"partir",
"de",
"un",
"objeto",
"Stringifable"
] | d17fbced4a285275928f8428ee56e269eb851690 | https://github.com/jmpantoja/planb-utils/blob/d17fbced4a285275928f8428ee56e269eb851690/src/Type/Text/TextAssurance.php#L56-L65 |
5,466 | pletfix/core | src/Services/Collection.php | Collection.last | public function last(callable $callback = null, $default = null)
{
if (is_null($callback)) {
if (!empty($this->items)) {
return end($this->items);
}
}
else {
foreach (array_reverse($this->items, true) as $key => $value) {
if... | php | public function last(callable $callback = null, $default = null)
{
if (is_null($callback)) {
if (!empty($this->items)) {
return end($this->items);
}
}
else {
foreach (array_reverse($this->items, true) as $key => $value) {
if... | [
"public",
"function",
"last",
"(",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"callback",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"items",
")",
")"... | Get the last item from the collection.
@param callable|null $callback
@param mixed $default
@return mixed | [
"Get",
"the",
"last",
"item",
"from",
"the",
"collection",
"."
] | 974945500f278eb6c1779832e08bbfca1007a7b3 | https://github.com/pletfix/core/blob/974945500f278eb6c1779832e08bbfca1007a7b3/src/Services/Collection.php#L303-L319 |
5,467 | indigophp-archive/queue | src/Job.php | Job.createPayload | public function createPayload()
{
$payload = $this->extras;
$payload['job'] = $this->job;
$payload['data'] = $this->data;
// Create special payload if it is a Closure
if ($this->job instanceof \Closure) {
$payload['closure'] = serialize(new SerializableClosure($... | php | public function createPayload()
{
$payload = $this->extras;
$payload['job'] = $this->job;
$payload['data'] = $this->data;
// Create special payload if it is a Closure
if ($this->job instanceof \Closure) {
$payload['closure'] = serialize(new SerializableClosure($... | [
"public",
"function",
"createPayload",
"(",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"extras",
";",
"$",
"payload",
"[",
"'job'",
"]",
"=",
"$",
"this",
"->",
"job",
";",
"$",
"payload",
"[",
"'data'",
"]",
"=",
"$",
"this",
"->",
"data",
... | Creates a serialized payload
@return [] | [
"Creates",
"a",
"serialized",
"payload"
] | d364d5a1fc3b00d59846b19aa472d7f2aa130ff8 | https://github.com/indigophp-archive/queue/blob/d364d5a1fc3b00d59846b19aa472d7f2aa130ff8/src/Job.php#L176-L190 |
5,468 | indigophp-archive/queue | src/Job.php | Job.createFromPayload | public static function createFromPayload(array $payload)
{
$job = $payload['job'];
$data = $payload['data'];
unset($payload['job'], $payload['data']);
return new static($job, $data, [], $payload);
} | php | public static function createFromPayload(array $payload)
{
$job = $payload['job'];
$data = $payload['data'];
unset($payload['job'], $payload['data']);
return new static($job, $data, [], $payload);
} | [
"public",
"static",
"function",
"createFromPayload",
"(",
"array",
"$",
"payload",
")",
"{",
"$",
"job",
"=",
"$",
"payload",
"[",
"'job'",
"]",
";",
"$",
"data",
"=",
"$",
"payload",
"[",
"'data'",
"]",
";",
"unset",
"(",
"$",
"payload",
"[",
"'job'... | Creates a new Job from payload
@param [] $payload
@return self | [
"Creates",
"a",
"new",
"Job",
"from",
"payload"
] | d364d5a1fc3b00d59846b19aa472d7f2aa130ff8 | https://github.com/indigophp-archive/queue/blob/d364d5a1fc3b00d59846b19aa472d7f2aa130ff8/src/Job.php#L199-L207 |
5,469 | MLukman/Securilex | src/Authorization/SecuredAccessTrait.php | SecuredAccessTrait.addAllowedRole | public function addAllowedRole($role, $attribute = 'access')
{
$roleStr = (string) $role;
if (!isset($this->allowedRoles[$roleStr])) {
$this->allowedRoles[$roleStr] = array();
}
$this->allowedRoles[$roleStr][(string) $attribute] = true;
return $this;
} | php | public function addAllowedRole($role, $attribute = 'access')
{
$roleStr = (string) $role;
if (!isset($this->allowedRoles[$roleStr])) {
$this->allowedRoles[$roleStr] = array();
}
$this->allowedRoles[$roleStr][(string) $attribute] = true;
return $this;
} | [
"public",
"function",
"addAllowedRole",
"(",
"$",
"role",
",",
"$",
"attribute",
"=",
"'access'",
")",
"{",
"$",
"roleStr",
"=",
"(",
"string",
")",
"$",
"role",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"allowedRoles",
"[",
"$",
"roleStr... | Allow user role to access
@param string $role User role to allow access
@param string $attribute Attribute
@return self $this object (to allow method chaining) | [
"Allow",
"user",
"role",
"to",
"access"
] | d86ccae6df2ff9029a6d033b20e15f7f48fab79d | https://github.com/MLukman/Securilex/blob/d86ccae6df2ff9029a6d033b20e15f7f48fab79d/src/Authorization/SecuredAccessTrait.php#L39-L47 |
5,470 | MLukman/Securilex | src/Authorization/SecuredAccessTrait.php | SecuredAccessTrait.isRoleAllowed | public function isRoleAllowed($role, $attribute = 'access')
{
if (is_array($role)) {
foreach ($role as $r) {
if ($this->isRoleAllowed($r, $attribute)) {
return true;
}
}
return false;
} else {
$roleSt... | php | public function isRoleAllowed($role, $attribute = 'access')
{
if (is_array($role)) {
foreach ($role as $r) {
if ($this->isRoleAllowed($r, $attribute)) {
return true;
}
}
return false;
} else {
$roleSt... | [
"public",
"function",
"isRoleAllowed",
"(",
"$",
"role",
",",
"$",
"attribute",
"=",
"'access'",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"role",
")",
")",
"{",
"foreach",
"(",
"$",
"role",
"as",
"$",
"r",
")",
"{",
"if",
"(",
"$",
"this",
"->"... | Check if a specific user role is allowed to access
@param string $role User role
@param string $attribute Attribute
@return bool | [
"Check",
"if",
"a",
"specific",
"user",
"role",
"is",
"allowed",
"to",
"access"
] | d86ccae6df2ff9029a6d033b20e15f7f48fab79d | https://github.com/MLukman/Securilex/blob/d86ccae6df2ff9029a6d033b20e15f7f48fab79d/src/Authorization/SecuredAccessTrait.php#L55-L76 |
5,471 | MLukman/Securilex | src/Authorization/SecuredAccessTrait.php | SecuredAccessTrait.addAllowedUsername | public function addAllowedUsername($username, $attribute = 'access')
{
$usernameStr = (string) $username;
if (!isset($this->allowedUsernames[$usernameStr])) {
$this->allowedUsernames[$usernameStr] = array();
}
$this->allowedUsernames[$usernameStr][(string) $attribute] = t... | php | public function addAllowedUsername($username, $attribute = 'access')
{
$usernameStr = (string) $username;
if (!isset($this->allowedUsernames[$usernameStr])) {
$this->allowedUsernames[$usernameStr] = array();
}
$this->allowedUsernames[$usernameStr][(string) $attribute] = t... | [
"public",
"function",
"addAllowedUsername",
"(",
"$",
"username",
",",
"$",
"attribute",
"=",
"'access'",
")",
"{",
"$",
"usernameStr",
"=",
"(",
"string",
")",
"$",
"username",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"allowedUsernames",
"[... | Allow username to access
@param string $username Username to allow access
@param string $attribute Attribute
@return self $this object (to allow method chaining) | [
"Allow",
"username",
"to",
"access"
] | d86ccae6df2ff9029a6d033b20e15f7f48fab79d | https://github.com/MLukman/Securilex/blob/d86ccae6df2ff9029a6d033b20e15f7f48fab79d/src/Authorization/SecuredAccessTrait.php#L84-L92 |
5,472 | MLukman/Securilex | src/Authorization/SecuredAccessTrait.php | SecuredAccessTrait.isUsernameAllowed | public function isUsernameAllowed($username, $attribute = 'access')
{
$usernameStr = (string) $username;
$attrStr = (string) $attribute;
return (isset($this->allowedUsernames[$usernameStr]) && isset($this->allowedUsernames[$usernameStr][$attrStr]))
? $this->allowedUsernam... | php | public function isUsernameAllowed($username, $attribute = 'access')
{
$usernameStr = (string) $username;
$attrStr = (string) $attribute;
return (isset($this->allowedUsernames[$usernameStr]) && isset($this->allowedUsernames[$usernameStr][$attrStr]))
? $this->allowedUsernam... | [
"public",
"function",
"isUsernameAllowed",
"(",
"$",
"username",
",",
"$",
"attribute",
"=",
"'access'",
")",
"{",
"$",
"usernameStr",
"=",
"(",
"string",
")",
"$",
"username",
";",
"$",
"attrStr",
"=",
"(",
"string",
")",
"$",
"attribute",
";",
"return"... | Check if a specific username is allowed to access this context
@param string $username Username
@param string $attribute Attribute
@return bool | [
"Check",
"if",
"a",
"specific",
"username",
"is",
"allowed",
"to",
"access",
"this",
"context"
] | d86ccae6df2ff9029a6d033b20e15f7f48fab79d | https://github.com/MLukman/Securilex/blob/d86ccae6df2ff9029a6d033b20e15f7f48fab79d/src/Authorization/SecuredAccessTrait.php#L100-L106 |
5,473 | fiedsch/datamanagement | src/Fiedsch/Data/File/CsvReader.php | CsvReader.isEmpty | public static function isEmpty($line, $strict = false)
{
if (!is_array($line)) {
throw new \RuntimeException("got a string that should already have been split into an array");
}
$test = array_filter($line, function ($element) use ($strict) {
return !Reader::isEmpty($e... | php | public static function isEmpty($line, $strict = false)
{
if (!is_array($line)) {
throw new \RuntimeException("got a string that should already have been split into an array");
}
$test = array_filter($line, function ($element) use ($strict) {
return !Reader::isEmpty($e... | [
"public",
"static",
"function",
"isEmpty",
"(",
"$",
"line",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"line",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"got a string that should already have been... | Check whether a line is to be considered empty.
@param array $line the line to check.
@param boolean $strict controls how to compare "empty" strings (see also Reader::isEmpty()).
@return boolean | [
"Check",
"whether",
"a",
"line",
"is",
"to",
"be",
"considered",
"empty",
"."
] | 06e8000399d46e83f848944b73afecabf619f52b | https://github.com/fiedsch/datamanagement/blob/06e8000399d46e83f848944b73afecabf619f52b/src/Fiedsch/Data/File/CsvReader.php#L153-L162 |
5,474 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.set_plugin | protected function set_plugin( $the__file__ ) {
if ( ! function_exists( 'get_plugins' ) ) {
/* @noinspection PhpIncludeInspection */
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$this->plugin['fullpath'] = $the__file__;
$this->plugin['basename'] = plugin_basename( $this->plugin['fullpath'] );... | php | protected function set_plugin( $the__file__ ) {
if ( ! function_exists( 'get_plugins' ) ) {
/* @noinspection PhpIncludeInspection */
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$this->plugin['fullpath'] = $the__file__;
$this->plugin['basename'] = plugin_basename( $this->plugin['fullpath'] );... | [
"protected",
"function",
"set_plugin",
"(",
"$",
"the__file__",
")",
"{",
"if",
"(",
"!",
"function_exists",
"(",
"'get_plugins'",
")",
")",
"{",
"/* @noinspection PhpIncludeInspection */",
"require_once",
"ABSPATH",
".",
"'wp-admin/includes/plugin.php'",
";",
"}",
"$... | Set paths, name etc for a plugin
@param string $the__file__ Pass `__FILE__` from the loader through Constructor. | [
"Set",
"paths",
"name",
"etc",
"for",
"a",
"plugin"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L125-L137 |
5,475 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.set_params | protected function set_params( $params ) {
$this->requirements_details_url = ! empty( $params['requirements_details_url'] ) ? esc_url( trim( (string) $params['requirements_details_url'] ) ) : $this->requirements_details_url;
$this->version_compare_operator = ! empty( $params['version_compare_operator'] ) ? (string)... | php | protected function set_params( $params ) {
$this->requirements_details_url = ! empty( $params['requirements_details_url'] ) ? esc_url( trim( (string) $params['requirements_details_url'] ) ) : $this->requirements_details_url;
$this->version_compare_operator = ! empty( $params['version_compare_operator'] ) ? (string)... | [
"protected",
"function",
"set_params",
"(",
"$",
"params",
")",
"{",
"$",
"this",
"->",
"requirements_details_url",
"=",
"!",
"empty",
"(",
"$",
"params",
"[",
"'requirements_details_url'",
"]",
")",
"?",
"esc_url",
"(",
"trim",
"(",
"(",
"string",
")",
"$... | Redefine all params by those that were submitted by a user.
@param array $params The array of parameters. | [
"Redefine",
"all",
"params",
"by",
"those",
"that",
"were",
"submitted",
"by",
"a",
"user",
"."
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L193-L198 |
5,476 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.validate_php | protected function validate_php( $php ) {
$result = $required = array();
foreach ( $php as $type => $data ) {
switch ( $type ) {
case 'version':
$result[ $type ] = version_compare( phpversion(), $data, $this->version_compare_operator );
$required[ $type ] = $data;
break;
case 'extensio... | php | protected function validate_php( $php ) {
$result = $required = array();
foreach ( $php as $type => $data ) {
switch ( $type ) {
case 'version':
$result[ $type ] = version_compare( phpversion(), $data, $this->version_compare_operator );
$required[ $type ] = $data;
break;
case 'extensio... | [
"protected",
"function",
"validate_php",
"(",
"$",
"php",
")",
"{",
"$",
"result",
"=",
"$",
"required",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"php",
"as",
"$",
"type",
"=>",
"$",
"data",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{"... | Check all PHP related data, like version and extensions
@param array $php PHP requirements. | [
"Check",
"all",
"PHP",
"related",
"data",
"like",
"version",
"and",
"extensions"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L205-L230 |
5,477 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.validate_wordpress | protected function validate_wordpress( $wordpress ) {
global $wp_version;
$result = $required = array();
foreach ( $wordpress as $type => $data ) {
switch ( $type ) {
case 'version':
$result[ $type ] = version_compare( $wp_version, $data, '>=' );
$required[ $type ] = $data;
break;
c... | php | protected function validate_wordpress( $wordpress ) {
global $wp_version;
$result = $required = array();
foreach ( $wordpress as $type => $data ) {
switch ( $type ) {
case 'version':
$result[ $type ] = version_compare( $wp_version, $data, '>=' );
$required[ $type ] = $data;
break;
c... | [
"protected",
"function",
"validate_wordpress",
"(",
"$",
"wordpress",
")",
"{",
"global",
"$",
"wp_version",
";",
"$",
"result",
"=",
"$",
"required",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"wordpress",
"as",
"$",
"type",
"=>",
"$",
"data",
... | Check all WordPress related data, like version, plugins and theme
@param array $wordpress WordPress requirements. | [
"Check",
"all",
"WordPress",
"related",
"data",
"like",
"version",
"plugins",
"and",
"theme"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L249-L340 |
5,478 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.process_failure | public function process_failure() {
if ( ! count( $this->results ) || ! count( $this->not_valid_actions ) ) {
return;
}
foreach ( $this->not_valid_actions as $action ) {
switch ( $action ) {
case 'deactivate':
deactivate_plugins( $this->get_plugin( 'basename' ), true );
if ( isset( $_GET['ac... | php | public function process_failure() {
if ( ! count( $this->results ) || ! count( $this->not_valid_actions ) ) {
return;
}
foreach ( $this->not_valid_actions as $action ) {
switch ( $action ) {
case 'deactivate':
deactivate_plugins( $this->get_plugin( 'basename' ), true );
if ( isset( $_GET['ac... | [
"public",
"function",
"process_failure",
"(",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"results",
")",
"||",
"!",
"count",
"(",
"$",
"this",
"->",
"not_valid_actions",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
... | Get the list of registered actions and do everything defined by them | [
"Get",
"the",
"list",
"of",
"registered",
"actions",
"and",
"do",
"everything",
"defined",
"by",
"them"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L356-L376 |
5,479 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.display_admin_notice | public function display_admin_notice() {
echo '<div class="notice is-dismissible error">';
echo '<p>';
printf(
esc_html__( '%s will not function correctly because your site doesn\'t meet some of the requirements:', 'wp-requirements' ),
'<strong>' . esc_html( $this->get_plugin( 'name' ) ) . '</strong>'
)... | php | public function display_admin_notice() {
echo '<div class="notice is-dismissible error">';
echo '<p>';
printf(
esc_html__( '%s will not function correctly because your site doesn\'t meet some of the requirements:', 'wp-requirements' ),
'<strong>' . esc_html( $this->get_plugin( 'name' ) ) . '</strong>'
)... | [
"public",
"function",
"display_admin_notice",
"(",
")",
"{",
"echo",
"'<div class=\"notice is-dismissible error\">'",
";",
"echo",
"'<p>'",
";",
"printf",
"(",
"esc_html__",
"(",
"'%s will not function correctly because your site doesn\\'t meet some of the requirements:'",
",",
"... | Display an admin notice in WordPress admin area | [
"Display",
"an",
"admin",
"notice",
"in",
"WordPress",
"admin",
"area"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L381-L411 |
5,480 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.get_plugin | public function get_plugin( $data = '' ) {
// Get all the data.
if ( ! $data ) {
return $this->plugin;
}
// Get specific plugin data.
if ( ! empty( $this->plugin[ $data ] ) ) {
return $this->plugin[ $data ];
}
return null;
} | php | public function get_plugin( $data = '' ) {
// Get all the data.
if ( ! $data ) {
return $this->plugin;
}
// Get specific plugin data.
if ( ! empty( $this->plugin[ $data ] ) ) {
return $this->plugin[ $data ];
}
return null;
} | [
"public",
"function",
"get_plugin",
"(",
"$",
"data",
"=",
"''",
")",
"{",
"// Get all the data.",
"if",
"(",
"!",
"$",
"data",
")",
"{",
"return",
"$",
"this",
"->",
"plugin",
";",
"}",
"// Get specific plugin data.",
"if",
"(",
"!",
"empty",
"(",
"$",
... | Retrieve current plugin data, like paths, name etc
@param string $data Which data is requested.
@return mixed | [
"Retrieve",
"current",
"plugin",
"data",
"like",
"paths",
"name",
"etc"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L625-L637 |
5,481 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.load_json | protected function load_json() {
$json_file = $this->locate_configuration_file();
$json_data = '{}';
if ( '' !== $json_file ) {
$json_data = file_get_contents( $json_file );
}
return $json_data ? $this->parse_json( $json_data ) : array();
} | php | protected function load_json() {
$json_file = $this->locate_configuration_file();
$json_data = '{}';
if ( '' !== $json_file ) {
$json_data = file_get_contents( $json_file );
}
return $json_data ? $this->parse_json( $json_data ) : array();
} | [
"protected",
"function",
"load_json",
"(",
")",
"{",
"$",
"json_file",
"=",
"$",
"this",
"->",
"locate_configuration_file",
"(",
")",
";",
"$",
"json_data",
"=",
"'{}'",
";",
"if",
"(",
"''",
"!==",
"$",
"json_file",
")",
"{",
"$",
"json_data",
"=",
"f... | Load wp-requirements.json
@return array | [
"Load",
"wp",
"-",
"requirements",
".",
"json"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L644-L653 |
5,482 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.locate_configuration_file | protected function locate_configuration_file() {
$located = '';
// By default, search only in the plugin folder.
$folders = array( dirname( $this->get_plugin( 'fullpath' ) ) );
/**
* Filter to modify the array of configuration folders.
*
* @since 2.0.0
*
* @param string[] $folders The array of... | php | protected function locate_configuration_file() {
$located = '';
// By default, search only in the plugin folder.
$folders = array( dirname( $this->get_plugin( 'fullpath' ) ) );
/**
* Filter to modify the array of configuration folders.
*
* @since 2.0.0
*
* @param string[] $folders The array of... | [
"protected",
"function",
"locate_configuration_file",
"(",
")",
"{",
"$",
"located",
"=",
"''",
";",
"// By default, search only in the plugin folder.",
"$",
"folders",
"=",
"array",
"(",
"dirname",
"(",
"$",
"this",
"->",
"get_plugin",
"(",
"'fullpath'",
")",
")"... | Search for a configuration file.
@return string Path to the file found. Blank string if not found. | [
"Search",
"for",
"a",
"configuration",
"file",
"."
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L660-L685 |
5,483 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.parse_json | protected function parse_json( $json ) {
$data = json_decode( $json, true );
if ( ! is_array( $data ) ) {
$data = array();
}
return $data;
} | php | protected function parse_json( $json ) {
$data = json_decode( $json, true );
if ( ! is_array( $data ) ) {
$data = array();
}
return $data;
} | [
"protected",
"function",
"parse_json",
"(",
"$",
"json",
")",
"{",
"$",
"data",
"=",
"json_decode",
"(",
"$",
"json",
",",
"true",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
... | Parse JSON string to make it an array that is usable for us
@param string $json JSON string.
@return array | [
"Parse",
"JSON",
"string",
"to",
"make",
"it",
"an",
"array",
"that",
"is",
"usable",
"for",
"us"
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L694-L703 |
5,484 | bemailr/wp-requirements | includes/class-wp-requirements.php | WP_Requirements.validate | public static function validate( $the__file__, array $requirements = array() ) {
$_wpr = new WP_Requirements( $the__file__, $requirements );
$is_valid = $_wpr->valid();
if ( ! $is_valid ) {
$_wpr->process_failure();
}
return $is_valid;
} | php | public static function validate( $the__file__, array $requirements = array() ) {
$_wpr = new WP_Requirements( $the__file__, $requirements );
$is_valid = $_wpr->valid();
if ( ! $is_valid ) {
$_wpr->process_failure();
}
return $is_valid;
} | [
"public",
"static",
"function",
"validate",
"(",
"$",
"the__file__",
",",
"array",
"$",
"requirements",
"=",
"array",
"(",
")",
")",
"{",
"$",
"_wpr",
"=",
"new",
"WP_Requirements",
"(",
"$",
"the__file__",
",",
"$",
"requirements",
")",
";",
"$",
"is_va... | Shortcut to construct the object and process the failure actions.
@param string $the__file__ Pass `__FILE__` from the loader.
@param array $requirements The array of requirements.
@return bool True if requirements met. | [
"Shortcut",
"to",
"construct",
"the",
"object",
"and",
"process",
"the",
"failure",
"actions",
"."
] | e903973b0dfc1178f89c757bd205327811ea4658 | https://github.com/bemailr/wp-requirements/blob/e903973b0dfc1178f89c757bd205327811ea4658/includes/class-wp-requirements.php#L713-L723 |
5,485 | Atlantic18/CoralContentBundle | Controller/NodeController.php | NodeController.getTreeQueryAsArray | private function getTreeQueryAsArray(\Doctrine\ORM\Query $query)
{
$items = array();
$index = array();
$nodes = $query->getResult();
$count = count($nodes);
for($i = 0; $i < $count; $i++)
{
$node = $nodes[$i];
$newItem = array(
... | php | private function getTreeQueryAsArray(\Doctrine\ORM\Query $query)
{
$items = array();
$index = array();
$nodes = $query->getResult();
$count = count($nodes);
for($i = 0; $i < $count; $i++)
{
$node = $nodes[$i];
$newItem = array(
... | [
"private",
"function",
"getTreeQueryAsArray",
"(",
"\\",
"Doctrine",
"\\",
"ORM",
"\\",
"Query",
"$",
"query",
")",
"{",
"$",
"items",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"array",
"(",
")",
";",
"$",
"nodes",
"=",
"$",
"query",
"->",
"g... | Returns doctrine query nested set as an array for json
@param DoctrineORMQuery $query Nested set tree query
@return array Result as array for json | [
"Returns",
"doctrine",
"query",
"nested",
"set",
"as",
"an",
"array",
"for",
"json"
] | 26ebc612959ca8ba7d429424c39a9fc5b0778ffc | https://github.com/Atlantic18/CoralContentBundle/blob/26ebc612959ca8ba7d429424c39a9fc5b0778ffc/Controller/NodeController.php#L103-L156 |
5,486 | Atlantic18/CoralContentBundle | Controller/NodeController.php | NodeController.getParentTreeParams | private function getParentTreeParams(\Coral\ContentBundle\Entity\Node $node)
{
$params = $this->getDoctrine()->getManager()->createQuery(
'SELECT n.level, na.name, na.value
FROM CoralContentBundle:NodeAttribute na
INNER JOIN na.node n WITH (n.lft < :lft AND n.... | php | private function getParentTreeParams(\Coral\ContentBundle\Entity\Node $node)
{
$params = $this->getDoctrine()->getManager()->createQuery(
'SELECT n.level, na.name, na.value
FROM CoralContentBundle:NodeAttribute na
INNER JOIN na.node n WITH (n.lft < :lft AND n.... | [
"private",
"function",
"getParentTreeParams",
"(",
"\\",
"Coral",
"\\",
"ContentBundle",
"\\",
"Entity",
"\\",
"Node",
"$",
"node",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
"->",
"createQuery",... | Fetches all parent params and returns as array
@param CoralContentBundleEntityNode $node Child node
@return array param => value | [
"Fetches",
"all",
"parent",
"params",
"and",
"returns",
"as",
"array"
] | 26ebc612959ca8ba7d429424c39a9fc5b0778ffc | https://github.com/Atlantic18/CoralContentBundle/blob/26ebc612959ca8ba7d429424c39a9fc5b0778ffc/Controller/NodeController.php#L164-L188 |
5,487 | fabsgc/framework | Core/Controller/Controller.php | Controller.showDefault | final public function showDefault() {
$request = Request::instance();
$t = new Template('.app/system/default', 'systemDefault');
$t->assign(['action' => $request->src . '::' . $request->controller . '::' . $request->action]);
return $t->show();
} | php | final public function showDefault() {
$request = Request::instance();
$t = new Template('.app/system/default', 'systemDefault');
$t->assign(['action' => $request->src . '::' . $request->controller . '::' . $request->action]);
return $t->show();
} | [
"final",
"public",
"function",
"showDefault",
"(",
")",
"{",
"$",
"request",
"=",
"Request",
"::",
"instance",
"(",
")",
";",
"$",
"t",
"=",
"new",
"Template",
"(",
"'.app/system/default'",
",",
"'systemDefault'",
")",
";",
"$",
"t",
"->",
"assign",
"(",... | display a default template
@access public
@return string
@since 3.0
@package Gcs\Framework\Core\Controller | [
"display",
"a",
"default",
"template"
] | 45e58182aba6a3c6381970a1fd3c17662cff2168 | https://github.com/fabsgc/framework/blob/45e58182aba6a3c6381970a1fd3c17662cff2168/Core/Controller/Controller.php#L133-L139 |
5,488 | jaeger-app/compress | src/Compress.php | Compress.extract | public function extract($file, $destination = false)
{
$archive = $this->getArchiver()->open($file);
if ($archive) {
$this->getArchiver()->extractTo($destination);
return $this->getArchiver()->close();
}
} | php | public function extract($file, $destination = false)
{
$archive = $this->getArchiver()->open($file);
if ($archive) {
$this->getArchiver()->extractTo($destination);
return $this->getArchiver()->close();
}
} | [
"public",
"function",
"extract",
"(",
"$",
"file",
",",
"$",
"destination",
"=",
"false",
")",
"{",
"$",
"archive",
"=",
"$",
"this",
"->",
"getArchiver",
"(",
")",
"->",
"open",
"(",
"$",
"file",
")",
";",
"if",
"(",
"$",
"archive",
")",
"{",
"$... | Extracts a compressed file to the destination
@param string $file
The full path to the file to extract
@param string $destination
The destination to extract to
@return bool | [
"Extracts",
"a",
"compressed",
"file",
"to",
"the",
"destination"
] | 28d0532af7c24ddc1423be8383fa2e4732d8de99 | https://github.com/jaeger-app/compress/blob/28d0532af7c24ddc1423be8383fa2e4732d8de99/src/Compress.php#L69-L76 |
5,489 | jaeger-app/compress | src/Compress.php | Compress.create | public function create($name)
{
$this->setArchiveName($name);
$this->getArchiver()->open($this->getArchiveName(), \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
return $this;
} | php | public function create($name)
{
$this->setArchiveName($name);
$this->getArchiver()->open($this->getArchiveName(), \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
return $this;
} | [
"public",
"function",
"create",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"setArchiveName",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"getArchiver",
"(",
")",
"->",
"open",
"(",
"$",
"this",
"->",
"getArchiveName",
"(",
")",
",",
"\\",
"Z... | Starts the process of creating an archive
@param string $name
@return \mithra62\Compress | [
"Starts",
"the",
"process",
"of",
"creating",
"an",
"archive"
] | 28d0532af7c24ddc1423be8383fa2e4732d8de99 | https://github.com/jaeger-app/compress/blob/28d0532af7c24ddc1423be8383fa2e4732d8de99/src/Compress.php#L106-L111 |
5,490 | jaeger-app/compress | src/Compress.php | Compress.archiveSingle | public function archiveSingle($file, $desination = false)
{
if ($file == '') {
throw new CompressException('__exception_compress_file_value_empty');
}
if (! file_exists($file)) {
throw new CompressException('__exception_compress_file_not_exist');
}
... | php | public function archiveSingle($file, $desination = false)
{
if ($file == '') {
throw new CompressException('__exception_compress_file_value_empty');
}
if (! file_exists($file)) {
throw new CompressException('__exception_compress_file_not_exist');
}
... | [
"public",
"function",
"archiveSingle",
"(",
"$",
"file",
",",
"$",
"desination",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"file",
"==",
"''",
")",
"{",
"throw",
"new",
"CompressException",
"(",
"'__exception_compress_file_value_empty'",
")",
";",
"}",
"if",
... | Compresses a single file
@param string $file
the full path to the file to compress
@param string $desination
optional the full path to the destination. If none is given then $file is used with the extension appended | [
"Compresses",
"a",
"single",
"file"
] | 28d0532af7c24ddc1423be8383fa2e4732d8de99 | https://github.com/jaeger-app/compress/blob/28d0532af7c24ddc1423be8383fa2e4732d8de99/src/Compress.php#L145-L195 |
5,491 | TreasurerPHP/Models | src/models/Invoice.php | Invoice.pay | public function pay($amount, $parameters) {
$payment = new InvoicePayment();
$payment->amount = $amount;
$payment->setPreCommitMetadataArray($parameters['metadata']);
$payment->invoice()->associate($this);
$payment->type()->associate($parameters['type']);
if(isset($par... | php | public function pay($amount, $parameters) {
$payment = new InvoicePayment();
$payment->amount = $amount;
$payment->setPreCommitMetadataArray($parameters['metadata']);
$payment->invoice()->associate($this);
$payment->type()->associate($parameters['type']);
if(isset($par... | [
"public",
"function",
"pay",
"(",
"$",
"amount",
",",
"$",
"parameters",
")",
"{",
"$",
"payment",
"=",
"new",
"InvoicePayment",
"(",
")",
";",
"$",
"payment",
"->",
"amount",
"=",
"$",
"amount",
";",
"$",
"payment",
"->",
"setPreCommitMetadataArray",
"(... | Apply a payment to this invoice.
@param $amount
@param $parameters String[][] Key/value array: type => PaymentType, id => string
@return InvoicePayment Return the invoice payment made. | [
"Apply",
"a",
"payment",
"to",
"this",
"invoice",
"."
] | 614c57b78b313fd88167735fe3f3dc0183ee6bda | https://github.com/TreasurerPHP/Models/blob/614c57b78b313fd88167735fe3f3dc0183ee6bda/src/models/Invoice.php#L44-L59 |
5,492 | Jinxes/layton | Layton/Container.php | Container.offsetGet | public function offsetGet($offset)
{
if (! $this->has($offset)) {
throw new UnknownIdentifierException($offset);
}
if (!isset($this->_frozen[$offset])) {
$entry = &$this->_store[$offset];
if (is_callable($entry)) {
$entry = $entry($this);
... | php | public function offsetGet($offset)
{
if (! $this->has($offset)) {
throw new UnknownIdentifierException($offset);
}
if (!isset($this->_frozen[$offset])) {
$entry = &$this->_store[$offset];
if (is_callable($entry)) {
$entry = $entry($this);
... | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"offset",
")",
")",
"{",
"throw",
"new",
"UnknownIdentifierException",
"(",
"$",
"offset",
")",
";",
"}",
"if",
"(",
"!",
"isset",
... | Retrieve an entry to return.
@param string|integer $offset
@throws UnknownIdentifierException No entry was found for **this** identifier.
@return mixed Entry | [
"Retrieve",
"an",
"entry",
"to",
"return",
"."
] | 27b8eab2c59b9887eb93e40a533eb77cc5690584 | https://github.com/Jinxes/layton/blob/27b8eab2c59b9887eb93e40a533eb77cc5690584/Layton/Container.php#L75-L90 |
5,493 | Jinxes/layton | Layton/Container.php | Container.offsetSet | public function offsetSet($offset, $value)
{
if ($this->has($offset)) {
throw new StoreReattachException('The entry is exists.');
}
$this->_store[$offset] = $value;
} | php | public function offsetSet($offset, $value)
{
if ($this->has($offset)) {
throw new StoreReattachException('The entry is exists.');
}
$this->_store[$offset] = $value;
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"offset",
")",
")",
"{",
"throw",
"new",
"StoreReattachException",
"(",
"'The entry is exists.'",
")",
";",
"}",
"$",
"th... | Assign a value to the specified entry id.
@param string|integer $offset Entry id
@param mixed $value Entry
@throws StoreReattachException When entry is exists. | [
"Assign",
"a",
"value",
"to",
"the",
"specified",
"entry",
"id",
"."
] | 27b8eab2c59b9887eb93e40a533eb77cc5690584 | https://github.com/Jinxes/layton/blob/27b8eab2c59b9887eb93e40a533eb77cc5690584/Layton/Container.php#L100-L107 |
5,494 | Jinxes/layton | Layton/Container.php | Container.offsetUnset | public function offsetUnset($offset)
{
if ($this->has($offset)) {
unset(
$this->_store[$offset],
$this->_frozen[$offset]
);
}
} | php | public function offsetUnset($offset)
{
if ($this->has($offset)) {
unset(
$this->_store[$offset],
$this->_frozen[$offset]
);
}
} | [
"public",
"function",
"offsetUnset",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"offset",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_store",
"[",
"$",
"offset",
"]",
",",
"$",
"this",
"->",
"_frozen",
"[",... | Unset an Entry
@param string|integer $offset Entry id | [
"Unset",
"an",
"Entry"
] | 27b8eab2c59b9887eb93e40a533eb77cc5690584 | https://github.com/Jinxes/layton/blob/27b8eab2c59b9887eb93e40a533eb77cc5690584/Layton/Container.php#L114-L122 |
5,495 | Jinxes/layton | Layton/Container.php | Container.clear | public function clear()
{
foreach ($this->keys() as $key) {
unset($this->_store[$key]);
}
$frozenKeys = \array_keys($this->_frozen);
foreach ($frozenKeys as $key) {
unset($this->_frozen[$key]);
}
} | php | public function clear()
{
foreach ($this->keys() as $key) {
unset($this->_store[$key]);
}
$frozenKeys = \array_keys($this->_frozen);
foreach ($frozenKeys as $key) {
unset($this->_frozen[$key]);
}
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"keys",
"(",
")",
"as",
"$",
"key",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_store",
"[",
"$",
"key",
"]",
")",
";",
"}",
"$",
"frozenKeys",
"=",
"\\",
"array_... | Clear store and frozen entrys | [
"Clear",
"store",
"and",
"frozen",
"entrys"
] | 27b8eab2c59b9887eb93e40a533eb77cc5690584 | https://github.com/Jinxes/layton/blob/27b8eab2c59b9887eb93e40a533eb77cc5690584/Layton/Container.php#L127-L136 |
5,496 | titon/model | src/Titon/Model/Model.php | Model.addRelation | public function addRelation(Relation $relation) {
$relation->setPrimaryModel($this);
$this->_relations[$relation->getAlias()] = $relation;
$this->_aliases[$relation->getRelatedClass()] = $relation->getAlias();
$this->reserved[] = $relation->getAlias();
$this->on('relation', $re... | php | public function addRelation(Relation $relation) {
$relation->setPrimaryModel($this);
$this->_relations[$relation->getAlias()] = $relation;
$this->_aliases[$relation->getRelatedClass()] = $relation->getAlias();
$this->reserved[] = $relation->getAlias();
$this->on('relation', $re... | [
"public",
"function",
"addRelation",
"(",
"Relation",
"$",
"relation",
")",
"{",
"$",
"relation",
"->",
"setPrimaryModel",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"_relations",
"[",
"$",
"relation",
"->",
"getAlias",
"(",
")",
"]",
"=",
"$",
"re... | Add a relation between two models.
@param \Titon\Model\Relation $relation
@return $this | [
"Add",
"a",
"relation",
"between",
"two",
"models",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L285-L295 |
5,497 | titon/model | src/Titon/Model/Model.php | Model.belongsTo | public function belongsTo($alias, $class, $foreignKey = null, Closure $conditions = null) {
$relation = (new ManyToOne($alias, $class))
->setPrimaryForeignKey($foreignKey);
if ($conditions) {
$relation->setConditions($conditions);
}
return $this->addRelation($re... | php | public function belongsTo($alias, $class, $foreignKey = null, Closure $conditions = null) {
$relation = (new ManyToOne($alias, $class))
->setPrimaryForeignKey($foreignKey);
if ($conditions) {
$relation->setConditions($conditions);
}
return $this->addRelation($re... | [
"public",
"function",
"belongsTo",
"(",
"$",
"alias",
",",
"$",
"class",
",",
"$",
"foreignKey",
"=",
"null",
",",
"Closure",
"$",
"conditions",
"=",
"null",
")",
"{",
"$",
"relation",
"=",
"(",
"new",
"ManyToOne",
"(",
"$",
"alias",
",",
"$",
"class... | Add a many-to-one relationship.
@param string $alias
@param string $class
@param string $foreignKey
@param \Closure $conditions
@return $this | [
"Add",
"a",
"many",
"-",
"to",
"-",
"one",
"relationship",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L306-L315 |
5,498 | titon/model | src/Titon/Model/Model.php | Model.belongsToMany | public function belongsToMany($alias, $class, $junction, $foreignKey = null, $relatedKey = null, Closure $conditions = null) {
$relation = (new ManyToMany($alias, $class))
->setJunction($junction)
->setPrimaryForeignKey($foreignKey)
->setRelatedForeignKey($relatedKey);
... | php | public function belongsToMany($alias, $class, $junction, $foreignKey = null, $relatedKey = null, Closure $conditions = null) {
$relation = (new ManyToMany($alias, $class))
->setJunction($junction)
->setPrimaryForeignKey($foreignKey)
->setRelatedForeignKey($relatedKey);
... | [
"public",
"function",
"belongsToMany",
"(",
"$",
"alias",
",",
"$",
"class",
",",
"$",
"junction",
",",
"$",
"foreignKey",
"=",
"null",
",",
"$",
"relatedKey",
"=",
"null",
",",
"Closure",
"$",
"conditions",
"=",
"null",
")",
"{",
"$",
"relation",
"=",... | Add a many-to-many relationship.
@param string $alias
@param string $class
@param string $junction
@param string $foreignKey
@param string $relatedKey
@param \Closure $conditions
@return $this | [
"Add",
"a",
"many",
"-",
"to",
"-",
"many",
"relationship",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L328-L339 |
5,499 | titon/model | src/Titon/Model/Model.php | Model.delete | public function delete(array $options = []) {
$options = $options + ['atomic' => true];
$id = $this->get($this->primaryKey);
if (!$id) {
throw new MissingPrimaryKeyException(sprintf('Cannot delete %s record if no ID is present', get_class($this)));
}
$model = $this;... | php | public function delete(array $options = []) {
$options = $options + ['atomic' => true];
$id = $this->get($this->primaryKey);
if (!$id) {
throw new MissingPrimaryKeyException(sprintf('Cannot delete %s record if no ID is present', get_class($this)));
}
$model = $this;... | [
"public",
"function",
"delete",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"+",
"[",
"'atomic'",
"=>",
"true",
"]",
";",
"$",
"id",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"this",
"->",
"primaryKe... | Delete the record that is currently present in the model instance.
@see \Titon\Db\Repository::delete()
@param array $options {
@type bool $atomic Will wrap the delete query and all nested queries in a transaction
}
@return int
@throws \Titon\Model\Exception\MissingPrimaryKeyException | [
"Delete",
"the",
"record",
"that",
"is",
"currently",
"present",
"in",
"the",
"model",
"instance",
"."
] | 274e3810c2cfbb6818a388daaa462ff05de99cbd | https://github.com/titon/model/blob/274e3810c2cfbb6818a388daaa462ff05de99cbd/src/Titon/Model/Model.php#L370-L401 |
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.