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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
192,400 | leighmacdonald/php_rbac | src/RBAC/Manager/RoleManager.php | RoleManager.roleLoadPermissions | public function roleLoadPermissions($roles)
{
if (!$roles) {
return false;
}
$multi = is_array($roles);
if (!$multi) {
$roles = [$roles];
}
$permissions_ids = [];
foreach ($roles as $role) {
if (!is_array($role->_permission... | php | public function roleLoadPermissions($roles)
{
if (!$roles) {
return false;
}
$multi = is_array($roles);
if (!$multi) {
$roles = [$roles];
}
$permissions_ids = [];
foreach ($roles as $role) {
if (!is_array($role->_permission... | [
"public",
"function",
"roleLoadPermissions",
"(",
"$",
"roles",
")",
"{",
"if",
"(",
"!",
"$",
"roles",
")",
"{",
"return",
"false",
";",
"}",
"$",
"multi",
"=",
"is_array",
"(",
"$",
"roles",
")",
";",
"if",
"(",
"!",
"$",
"multi",
")",
"{",
"$"... | Load the full permission set into the role instance
@param $roles
@return bool|Role|Role[] | [
"Load",
"the",
"full",
"permission",
"set",
"into",
"the",
"role",
"instance"
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Manager/RoleManager.php#L105-L132 |
192,401 | leighmacdonald/php_rbac | src/RBAC/Manager/RoleManager.php | RoleManager.rolePermissionAdd | public function rolePermissionAdd(Role $role, Permission $permission)
{
return $this->storage->rolePermissionAdd($role, $permission);
} | php | public function rolePermissionAdd(Role $role, Permission $permission)
{
return $this->storage->rolePermissionAdd($role, $permission);
} | [
"public",
"function",
"rolePermissionAdd",
"(",
"Role",
"$",
"role",
",",
"Permission",
"$",
"permission",
")",
"{",
"return",
"$",
"this",
"->",
"storage",
"->",
"rolePermissionAdd",
"(",
"$",
"role",
",",
"$",
"permission",
")",
";",
"}"
] | Add a permission to the provided role.
@param Role $role Role to be updated
@param Permission $permission Permission to be added
@throws \RBAC\Exception\ValidationError
@return bool Add success status | [
"Add",
"a",
"permission",
"to",
"the",
"provided",
"role",
"."
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Manager/RoleManager.php#L197-L200 |
192,402 | leighmacdonald/php_rbac | src/RBAC/Manager/RoleManager.php | RoleManager.roleFetch | public function roleFetch($permissions = true)
{
$roles = $this->storage->roleFetch();
if ($roles and $permissions) {
$this->roleLoadPermissions($roles);
}
return $roles;
} | php | public function roleFetch($permissions = true)
{
$roles = $this->storage->roleFetch();
if ($roles and $permissions) {
$this->roleLoadPermissions($roles);
}
return $roles;
} | [
"public",
"function",
"roleFetch",
"(",
"$",
"permissions",
"=",
"true",
")",
"{",
"$",
"roles",
"=",
"$",
"this",
"->",
"storage",
"->",
"roleFetch",
"(",
")",
";",
"if",
"(",
"$",
"roles",
"and",
"$",
"permissions",
")",
"{",
"$",
"this",
"->",
"... | Fetch all currently defined roles from the database.
@param bool $permissions
@return Role[] | [
"Fetch",
"all",
"currently",
"defined",
"roles",
"from",
"the",
"database",
"."
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Manager/RoleManager.php#L223-L230 |
192,403 | leighmacdonald/php_rbac | src/RBAC/Manager/RoleManager.php | RoleManager.roleFetchByName | public function roleFetchByName($role_name, $permissions = true)
{
$role = $this->storage->roleFetchByName($role_name);
if ($role and $permissions) {
$this->roleLoadPermissions($role);
}
return $role;
} | php | public function roleFetchByName($role_name, $permissions = true)
{
$role = $this->storage->roleFetchByName($role_name);
if ($role and $permissions) {
$this->roleLoadPermissions($role);
}
return $role;
} | [
"public",
"function",
"roleFetchByName",
"(",
"$",
"role_name",
",",
"$",
"permissions",
"=",
"true",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"storage",
"->",
"roleFetchByName",
"(",
"$",
"role_name",
")",
";",
"if",
"(",
"$",
"role",
"and",
"$"... | Fetch a role from the database via its unique name.
@param string $role_name Role name
@param bool $permissions
@return bool|Role | [
"Fetch",
"a",
"role",
"from",
"the",
"database",
"via",
"its",
"unique",
"name",
"."
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Manager/RoleManager.php#L239-L246 |
192,404 | leighmacdonald/php_rbac | src/RBAC/Role/Role.php | Role.hasPermission | public function hasPermission($permission)
{
if (!$permission) {
return false;
}
foreach ($this->permissions as $perm) {
if ($perm->name == $permission) {
return true;
}
}
return false;
} | php | public function hasPermission($permission)
{
if (!$permission) {
return false;
}
foreach ($this->permissions as $perm) {
if ($perm->name == $permission) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasPermission",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"!",
"$",
"permission",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"permissions",
"as",
"$",
"perm",
")",
"{",
"if",
"(",
"$",
"perm",
... | Check if the role allows the permission being requested.
@param string $permission Name of Permission being checked
@return bool Does this role has the permission | [
"Check",
"if",
"the",
"role",
"allows",
"the",
"permission",
"being",
"requested",
"."
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Role/Role.php#L51-L62 |
192,405 | leighmacdonald/php_rbac | src/RBAC/Role/Role.php | Role.addPermission | public function addPermission(Permission $permission)
{
if (!$permission->permission_id) {
throw new ValidationError("Permission has invalid state");
}
if (!in_array($permission, $this->permissions)) {
$this->permissions[] = $permission;
return true;
... | php | public function addPermission(Permission $permission)
{
if (!$permission->permission_id) {
throw new ValidationError("Permission has invalid state");
}
if (!in_array($permission, $this->permissions)) {
$this->permissions[] = $permission;
return true;
... | [
"public",
"function",
"addPermission",
"(",
"Permission",
"$",
"permission",
")",
"{",
"if",
"(",
"!",
"$",
"permission",
"->",
"permission_id",
")",
"{",
"throw",
"new",
"ValidationError",
"(",
"\"Permission has invalid state\"",
")",
";",
"}",
"if",
"(",
"!"... | Add a permission to the roles current permissions if it does not already exist
@param Permission $permission
@return bool
@throws \RBAC\Exception\ValidationError Permission has no ID set | [
"Add",
"a",
"permission",
"to",
"the",
"roles",
"current",
"permissions",
"if",
"it",
"does",
"not",
"already",
"exist"
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Role/Role.php#L71-L81 |
192,406 | leighmacdonald/php_rbac | src/RBAC/Role/Role.php | Role.create | public static function create($name, $description = "", $permissions = [])
{
$role = new self();
$role->name = $name;
$role->description = $description;
foreach ($permissions as $permission) {
$role->addPermission($permission);
}
return $role;
} | php | public static function create($name, $description = "", $permissions = [])
{
$role = new self();
$role->name = $name;
$role->description = $description;
foreach ($permissions as $permission) {
$role->addPermission($permission);
}
return $role;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"description",
"=",
"\"\"",
",",
"$",
"permissions",
"=",
"[",
"]",
")",
"{",
"$",
"role",
"=",
"new",
"self",
"(",
")",
";",
"$",
"role",
"->",
"name",
"=",
"$",
"name",
";",
... | Generate a new Permission instance to be saved to the data store.
@param string $name Unique name of the role
@param string $description Optional description of this role
@param Permission[] $permissions Array of initial permissions to add to the role
@return Role | [
"Generate",
"a",
"new",
"Permission",
"instance",
"to",
"be",
"saved",
"to",
"the",
"data",
"store",
"."
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/Role/Role.php#L91-L100 |
192,407 | tillkruss/laravel-phpredis | src/RedisServiceProvider.php | RedisServiceProvider.boot | public function boot()
{
Cache::extend('redis', function ($app, $config) {
$store = new RedisStore(
$app['redis'],
Arr::get($config, 'prefix', $this->app['config']['cache.prefix']),
Arr::get($config, 'connection', 'default')
);
... | php | public function boot()
{
Cache::extend('redis', function ($app, $config) {
$store = new RedisStore(
$app['redis'],
Arr::get($config, 'prefix', $this->app['config']['cache.prefix']),
Arr::get($config, 'connection', 'default')
);
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"Cache",
"::",
"extend",
"(",
"'redis'",
",",
"function",
"(",
"$",
"app",
",",
"$",
"config",
")",
"{",
"$",
"store",
"=",
"new",
"RedisStore",
"(",
"$",
"app",
"[",
"'redis'",
"]",
",",
"Arr",
"::",
... | Register custom Redis cache driver.
@return void | [
"Register",
"custom",
"Redis",
"cache",
"driver",
"."
] | b410aeafa60aece0bea40566f0bcb80b417b1f7a | https://github.com/tillkruss/laravel-phpredis/blob/b410aeafa60aece0bea40566f0bcb80b417b1f7a/src/RedisServiceProvider.php#L21-L40 |
192,408 | ARCANEDEV/LaravelTracker | src/Exceptions/Handler.php | Handler.handleError | public function handleError($err_severity, $err_msg, $err_file, $err_line, array $err_context)
{
try {
$this->manager->trackException(
ExceptionFactory::make($err_severity, $err_msg)
);
}
catch (Exception $e) {
// Ignore Tracker exceptions
... | php | public function handleError($err_severity, $err_msg, $err_file, $err_line, array $err_context)
{
try {
$this->manager->trackException(
ExceptionFactory::make($err_severity, $err_msg)
);
}
catch (Exception $e) {
// Ignore Tracker exceptions
... | [
"public",
"function",
"handleError",
"(",
"$",
"err_severity",
",",
"$",
"err_msg",
",",
"$",
"err_file",
",",
"$",
"err_line",
",",
"array",
"$",
"err_context",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"manager",
"->",
"trackException",
"(",
"ExceptionFac... | Handle the error.
@param int $err_severity
@param string $err_msg
@param mixed $err_file
@param mixed $err_line
@param array $err_context
@return mixed | [
"Handle",
"the",
"error",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Exceptions/Handler.php#L126-L139 |
192,409 | ARCANEDEV/LaravelTracker | src/Parsers/RefererParser.php | RefererParser.parseUrl | public function parseUrl($referer)
{
if (is_null($referer)) return null;
$parsed = parse_url($referer);
$parts = explode('.', $parsed['host']);
$domain = array_pop($parts);
if (count($parts) > 0)
$domain = array_pop($parts).'.'.$domain;
return [
... | php | public function parseUrl($referer)
{
if (is_null($referer)) return null;
$parsed = parse_url($referer);
$parts = explode('.', $parsed['host']);
$domain = array_pop($parts);
if (count($parts) > 0)
$domain = array_pop($parts).'.'.$domain;
return [
... | [
"public",
"function",
"parseUrl",
"(",
"$",
"referer",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"referer",
")",
")",
"return",
"null",
";",
"$",
"parsed",
"=",
"parse_url",
"(",
"$",
"referer",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"'.'",
"... | Parse the referer url.
@param string $referer
@return array | [
"Parse",
"the",
"referer",
"url",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Parsers/RefererParser.php#L133-L149 |
192,410 | bgultekin/laravel-to-jquery-validation | src/Bllim/LaravelToJqueryValidation/FormBuilder.php | FormBuilder.open | public function open(array $options = array(), $rules = null)
{
$this->setValidation($rules);
return parent::open($options);
} | php | public function open(array $options = array(), $rules = null)
{
$this->setValidation($rules);
return parent::open($options);
} | [
"public",
"function",
"open",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"rules",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setValidation",
"(",
"$",
"rules",
")",
";",
"return",
"parent",
"::",
"open",
"(",
"$",
"options",
")... | Opens form, set rules
@param array $rules Laravel validation rules
@see Illuminate\Html\FormBuilder | [
"Opens",
"form",
"set",
"rules"
] | 60f6eef8d37609e79b6b3bf430868ab784087e61 | https://github.com/bgultekin/laravel-to-jquery-validation/blob/60f6eef8d37609e79b6b3bf430868ab784087e61/src/Bllim/LaravelToJqueryValidation/FormBuilder.php#L90-L95 |
192,411 | bgultekin/laravel-to-jquery-validation | src/Bllim/LaravelToJqueryValidation/FormBuilder.php | FormBuilder.convertRule | protected function convertRule($rule, $attribute, $type)
{
$parsedRule = $this->parseValidationRule($rule);
$jqueryAttrs = [];
$ruleMethodName = $this->getRuleMethodName($parsedRule['name']);
// if method not exists that means it is not implemented yet so return empty array
if(!method_exists($this, $ruleMet... | php | protected function convertRule($rule, $attribute, $type)
{
$parsedRule = $this->parseValidationRule($rule);
$jqueryAttrs = [];
$ruleMethodName = $this->getRuleMethodName($parsedRule['name']);
// if method not exists that means it is not implemented yet so return empty array
if(!method_exists($this, $ruleMet... | [
"protected",
"function",
"convertRule",
"(",
"$",
"rule",
",",
"$",
"attribute",
",",
"$",
"type",
")",
"{",
"$",
"parsedRule",
"=",
"$",
"this",
"->",
"parseValidationRule",
"(",
"$",
"rule",
")",
";",
"$",
"jqueryAttrs",
"=",
"[",
"]",
";",
"$",
"r... | Converts laravel rules to jquery validation rules
@param array $rules Laravel validation rule | [
"Converts",
"laravel",
"rules",
"to",
"jquery",
"validation",
"rules"
] | 60f6eef8d37609e79b6b3bf430868ab784087e61 | https://github.com/bgultekin/laravel-to-jquery-validation/blob/60f6eef8d37609e79b6b3bf430868ab784087e61/src/Bllim/LaravelToJqueryValidation/FormBuilder.php#L184-L215 |
192,412 | bgultekin/laravel-to-jquery-validation | src/Bllim/LaravelToJqueryValidation/FormBuilder.php | FormBuilder.getErrorMessage | protected function getErrorMessage($laravelRule, $attribute)
{
// getting user friendly attribute name
$attribute = $this->getAttributeName($attribute);
$message = Lang::get('validation.'.$laravelRule, ['attribute' => $attribute]);
return ['data-msg-'.$laravelRule => $message];
} | php | protected function getErrorMessage($laravelRule, $attribute)
{
// getting user friendly attribute name
$attribute = $this->getAttributeName($attribute);
$message = Lang::get('validation.'.$laravelRule, ['attribute' => $attribute]);
return ['data-msg-'.$laravelRule => $message];
} | [
"protected",
"function",
"getErrorMessage",
"(",
"$",
"laravelRule",
",",
"$",
"attribute",
")",
"{",
"// getting user friendly attribute name",
"$",
"attribute",
"=",
"$",
"this",
"->",
"getAttributeName",
"(",
"$",
"attribute",
")",
";",
"$",
"message",
"=",
"... | Sets error message
@return string | [
"Sets",
"error",
"message"
] | 60f6eef8d37609e79b6b3bf430868ab784087e61 | https://github.com/bgultekin/laravel-to-jquery-validation/blob/60f6eef8d37609e79b6b3bf430868ab784087e61/src/Bllim/LaravelToJqueryValidation/FormBuilder.php#L222-L229 |
192,413 | bgultekin/laravel-to-jquery-validation | src/Bllim/LaravelToJqueryValidation/FormBuilder.php | FormBuilder.getType | protected function getType($rules)
{
foreach ($rules as $key => $rule) {
$parsedRule = $this->parseValidationRule($rule);
if(in_array($parsedRule['name'], $this->numericRules))
{
return 'numeric';
}
}
return 'string';
} | php | protected function getType($rules)
{
foreach ($rules as $key => $rule) {
$parsedRule = $this->parseValidationRule($rule);
if(in_array($parsedRule['name'], $this->numericRules))
{
return 'numeric';
}
}
return 'string';
} | [
"protected",
"function",
"getType",
"(",
"$",
"rules",
")",
"{",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"key",
"=>",
"$",
"rule",
")",
"{",
"$",
"parsedRule",
"=",
"$",
"this",
"->",
"parseValidationRule",
"(",
"$",
"rule",
")",
";",
"if",
"(",
"... | Get all rules and return type of input if rule specifies type
Now, just for numeric
@return string | [
"Get",
"all",
"rules",
"and",
"return",
"type",
"of",
"input",
"if",
"rule",
"specifies",
"type",
"Now",
"just",
"for",
"numeric"
] | 60f6eef8d37609e79b6b3bf430868ab784087e61 | https://github.com/bgultekin/laravel-to-jquery-validation/blob/60f6eef8d37609e79b6b3bf430868ab784087e61/src/Bllim/LaravelToJqueryValidation/FormBuilder.php#L247-L258 |
192,414 | bgultekin/laravel-to-jquery-validation | src/Bllim/LaravelToJqueryValidation/FormBuilder.php | FormBuilder.parseValidationRule | protected function parseValidationRule($rule)
{
$ruleArray = ['name' => '', 'parameters' => []];
$explodedRule = explode(':', $rule);
$ruleArray['name'] = array_shift($explodedRule);
$ruleArray['parameters'] = explode(',', array_shift($explodedRule));
return $ruleArray;
} | php | protected function parseValidationRule($rule)
{
$ruleArray = ['name' => '', 'parameters' => []];
$explodedRule = explode(':', $rule);
$ruleArray['name'] = array_shift($explodedRule);
$ruleArray['parameters'] = explode(',', array_shift($explodedRule));
return $ruleArray;
} | [
"protected",
"function",
"parseValidationRule",
"(",
"$",
"rule",
")",
"{",
"$",
"ruleArray",
"=",
"[",
"'name'",
"=>",
"''",
",",
"'parameters'",
"=>",
"[",
"]",
"]",
";",
"$",
"explodedRule",
"=",
"explode",
"(",
"':'",
",",
"$",
"rule",
")",
";",
... | Parses validition rule of laravel
@return array | [
"Parses",
"validition",
"rule",
"of",
"laravel"
] | 60f6eef8d37609e79b6b3bf430868ab784087e61 | https://github.com/bgultekin/laravel-to-jquery-validation/blob/60f6eef8d37609e79b6b3bf430868ab784087e61/src/Bllim/LaravelToJqueryValidation/FormBuilder.php#L306-L315 |
192,415 | bgultekin/laravel-to-jquery-validation | src/Bllim/LaravelToJqueryValidation/FormBuilder.php | FormBuilder._convertMessageIp | protected function _convertMessageIp($parsedRule, $attribute, $type)
{
$message = Lang::get('validation.'.$parsedRule['name'], ['attribute' => $attribute]);
return ['data-msg-ipv4' => $message];
} | php | protected function _convertMessageIp($parsedRule, $attribute, $type)
{
$message = Lang::get('validation.'.$parsedRule['name'], ['attribute' => $attribute]);
return ['data-msg-ipv4' => $message];
} | [
"protected",
"function",
"_convertMessageIp",
"(",
"$",
"parsedRule",
",",
"$",
"attribute",
",",
"$",
"type",
")",
"{",
"$",
"message",
"=",
"Lang",
"::",
"get",
"(",
"'validation.'",
".",
"$",
"parsedRule",
"[",
"'name'",
"]",
",",
"[",
"'attribute'",
... | Message convertions which returns attributes as an array
@param array ['name' => '', 'parameters' => []]
@param array
@param array type of input
@return array | [
"Message",
"convertions",
"which",
"returns",
"attributes",
"as",
"an",
"array"
] | 60f6eef8d37609e79b6b3bf430868ab784087e61 | https://github.com/bgultekin/laravel-to-jquery-validation/blob/60f6eef8d37609e79b6b3bf430868ab784087e61/src/Bllim/LaravelToJqueryValidation/FormBuilder.php#L445-L449 |
192,416 | ARCANEDEV/LaravelTracker | src/Tracker.php | Tracker.setRequest | private function setRequest(Request $request)
{
$this->mergeVisitorActivityData([
'method' => $request->method(),
'is_ajax' => $request->ajax(),
'is_secure' => $request->isSecure(),
'is_json' => $request->isJson(),
'wants_json' => $... | php | private function setRequest(Request $request)
{
$this->mergeVisitorActivityData([
'method' => $request->method(),
'is_ajax' => $request->ajax(),
'is_secure' => $request->isSecure(),
'is_json' => $request->isJson(),
'wants_json' => $... | [
"private",
"function",
"setRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"mergeVisitorActivityData",
"(",
"[",
"'method'",
"=>",
"$",
"request",
"->",
"method",
"(",
")",
",",
"'is_ajax'",
"=>",
"$",
"request",
"->",
"ajax",
"(",
... | Set the request.
@param \Illuminate\Http\Request $request
@return self | [
"Set",
"the",
"request",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Tracker.php#L155-L168 |
192,417 | ARCANEDEV/LaravelTracker | src/Tracker.php | Tracker.trackRequest | public function trackRequest(Request $request)
{
if ($this->isEnabled()) {
$this->setRequest($request);
$this->mergeVisitorActivityData([
'visitor_id' => $this->getVisitorId(),
'path_id' => $this->getPathId(),
'query_id' => $this-... | php | public function trackRequest(Request $request)
{
if ($this->isEnabled()) {
$this->setRequest($request);
$this->mergeVisitorActivityData([
'visitor_id' => $this->getVisitorId(),
'path_id' => $this->getPathId(),
'query_id' => $this-... | [
"public",
"function",
"trackRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setRequest",
"(",
"$",
"request",
")",
";",
"$",
"this",
"->",
"mergeVisitorActivityData",
... | Start the tracking.
@param \Illuminate\Http\Request $request | [
"Start",
"the",
"tracking",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Tracker.php#L180-L194 |
192,418 | ARCANEDEV/LaravelTracker | src/Tracker.php | Tracker.trackIfEnabled | private function trackIfEnabled($key, \Closure $callback, $default = null)
{
return $this->isEnabled()
? ($this->getConfig("tracking.$key", false) ? $callback() : $default)
: $default;
} | php | private function trackIfEnabled($key, \Closure $callback, $default = null)
{
return $this->isEnabled()
? ($this->getConfig("tracking.$key", false) ? $callback() : $default)
: $default;
} | [
"private",
"function",
"trackIfEnabled",
"(",
"$",
"key",
",",
"\\",
"Closure",
"$",
"callback",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"isEnabled",
"(",
")",
"?",
"(",
"$",
"this",
"->",
"getConfig",
"(",
"\"tracking.... | Track the trackable if enabled.
@param string $key
@param \Closure $callback
@param mixed|null $default
@return mixed | [
"Track",
"the",
"trackable",
"if",
"enabled",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Tracker.php#L271-L276 |
192,419 | ARCANEDEV/LaravelTracker | src/Tracker.php | Tracker.getVisitorId | private function getVisitorId()
{
$tracker = $this->getVisitorTracker();
$data = $tracker->checkData($this->visitorData, [
'user_id' => $this->getUserId(),
'device_id' => $this->getDeviceId(),
'client_ip' => $this->request->getClientIp(),
'g... | php | private function getVisitorId()
{
$tracker = $this->getVisitorTracker();
$data = $tracker->checkData($this->visitorData, [
'user_id' => $this->getUserId(),
'device_id' => $this->getDeviceId(),
'client_ip' => $this->request->getClientIp(),
'g... | [
"private",
"function",
"getVisitorId",
"(",
")",
"{",
"$",
"tracker",
"=",
"$",
"this",
"->",
"getVisitorTracker",
"(",
")",
";",
"$",
"data",
"=",
"$",
"tracker",
"->",
"checkData",
"(",
"$",
"this",
"->",
"visitorData",
",",
"[",
"'user_id'",
"=>",
"... | Get the stored visitor id.
@return int | [
"Get",
"the",
"stored",
"visitor",
"id",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Tracker.php#L316-L335 |
192,420 | ARCANEDEV/LaravelTracker | src/Tracker.php | Tracker.getRefererId | private function getRefererId()
{
return $this->trackIfEnabled('referers', function () {
return $this->getRefererTracker()->track(
$this->request->headers->get('referer'),
$this->request->url()
);
});
} | php | private function getRefererId()
{
return $this->trackIfEnabled('referers', function () {
return $this->getRefererTracker()->track(
$this->request->headers->get('referer'),
$this->request->url()
);
});
} | [
"private",
"function",
"getRefererId",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"trackIfEnabled",
"(",
"'referers'",
",",
"function",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"getRefererTracker",
"(",
")",
"->",
"track",
"(",
"$",
"this",
"->",
"re... | Get the tracked referer id.
@return int|null | [
"Get",
"the",
"tracked",
"referer",
"id",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Tracker.php#L420-L428 |
192,421 | ARCANEDEV/LaravelTracker | src/Tracker.php | Tracker.getCookieId | private function getCookieId()
{
return $this->trackIfEnabled('cookies', function () {
return ! is_null($name = $this->getConfig('cookie.name'))
? $this->getCookieTracker()->track($this->request->cookie($name))
: null;
});
} | php | private function getCookieId()
{
return $this->trackIfEnabled('cookies', function () {
return ! is_null($name = $this->getConfig('cookie.name'))
? $this->getCookieTracker()->track($this->request->cookie($name))
: null;
});
} | [
"private",
"function",
"getCookieId",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"trackIfEnabled",
"(",
"'cookies'",
",",
"function",
"(",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"name",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"'cookie.name'",
"... | Get the tracked cookie id.
@return int|null | [
"Get",
"the",
"tracked",
"cookie",
"id",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Tracker.php#L435-L442 |
192,422 | tillkruss/laravel-phpredis | src/Database.php | Database.buildClusterSeed | protected function buildClusterSeed($server)
{
$parameters = [];
foreach (['database', 'timeout', 'prefix'] as $parameter) {
if (! empty($server[$parameter])) {
$parameters[$parameter] = $server[$parameter];
}
}
if (! empty($server['password'... | php | protected function buildClusterSeed($server)
{
$parameters = [];
foreach (['database', 'timeout', 'prefix'] as $parameter) {
if (! empty($server[$parameter])) {
$parameters[$parameter] = $server[$parameter];
}
}
if (! empty($server['password'... | [
"protected",
"function",
"buildClusterSeed",
"(",
"$",
"server",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"foreach",
"(",
"[",
"'database'",
",",
"'timeout'",
",",
"'prefix'",
"]",
"as",
"$",
"parameter",
")",
"{",
"if",
"(",
"!",
"empty",
"(",... | Build a cluster seed string.
@param array $server
@return string | [
"Build",
"a",
"cluster",
"seed",
"string",
"."
] | b410aeafa60aece0bea40566f0bcb80b417b1f7a | https://github.com/tillkruss/laravel-phpredis/blob/b410aeafa60aece0bea40566f0bcb80b417b1f7a/src/Database.php#L77-L92 |
192,423 | leighmacdonald/php_rbac | src/RBAC/DataStore/Adapter/BaseSQLAdapter.php | BaseSQLAdapter.permissionFetchById | public function permissionFetchById($permission_id)
{
$multi = is_array($permission_id);
if (!$multi) {
$permission_id = [$permission_id];
}
$in_query = join(',', $permission_id);
$query = "
SELECT
permission_id, `name`, description, ad... | php | public function permissionFetchById($permission_id)
{
$multi = is_array($permission_id);
if (!$multi) {
$permission_id = [$permission_id];
}
$in_query = join(',', $permission_id);
$query = "
SELECT
permission_id, `name`, description, ad... | [
"public",
"function",
"permissionFetchById",
"(",
"$",
"permission_id",
")",
"{",
"$",
"multi",
"=",
"is_array",
"(",
"$",
"permission_id",
")",
";",
"if",
"(",
"!",
"$",
"multi",
")",
"{",
"$",
"permission_id",
"=",
"[",
"$",
"permission_id",
"]",
";",
... | Fetch a permission by is ID, returning false if it doesn't exist.
@param $permission_id
@return bool|Permission|Permission[] | [
"Fetch",
"a",
"permission",
"by",
"is",
"ID",
"returning",
"false",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 8855d6bbfa29e0a5d89f2911d552bc2ab394cf52 | https://github.com/leighmacdonald/php_rbac/blob/8855d6bbfa29e0a5d89f2911d552bc2ab394cf52/src/RBAC/DataStore/Adapter/BaseSQLAdapter.php#L109-L139 |
192,424 | ARCANEDEV/LaravelTracker | src/Trackers/UserAgentTracker.php | UserAgentTracker.prepareData | private function prepareData()
{
$parser = $this->getUserAgentParser();
return [
'name' => $parser->getOriginalUserAgent() ?: 'Other',
'browser' => $parser->getBrowser(),
'browser_version' => $parser->getUserAgentVersion(),
];
} | php | private function prepareData()
{
$parser = $this->getUserAgentParser();
return [
'name' => $parser->getOriginalUserAgent() ?: 'Other',
'browser' => $parser->getBrowser(),
'browser_version' => $parser->getUserAgentVersion(),
];
} | [
"private",
"function",
"prepareData",
"(",
")",
"{",
"$",
"parser",
"=",
"$",
"this",
"->",
"getUserAgentParser",
"(",
")",
";",
"return",
"[",
"'name'",
"=>",
"$",
"parser",
"->",
"getOriginalUserAgent",
"(",
")",
"?",
":",
"'Other'",
",",
"'browser'",
... | Prepare the data.
@return array | [
"Prepare",
"the",
"data",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/UserAgentTracker.php#L68-L77 |
192,425 | ARCANEDEV/LaravelTracker | src/Trackers/ErrorTracker.php | ErrorTracker.track | public function track(Exception $exception)
{
return $this->getModel()->newQuery()->firstOrCreate([
'code' => $this->getCode($exception),
'message' => $exception->getMessage(),
])->getKey();
} | php | public function track(Exception $exception)
{
return $this->getModel()->newQuery()->firstOrCreate([
'code' => $this->getCode($exception),
'message' => $exception->getMessage(),
])->getKey();
} | [
"public",
"function",
"track",
"(",
"Exception",
"$",
"exception",
")",
"{",
"return",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"newQuery",
"(",
")",
"->",
"firstOrCreate",
"(",
"[",
"'code'",
"=>",
"$",
"this",
"->",
"getCode",
"(",
"$",
"except... | Track the exception error.
@param \Exception $exception
@return int | [
"Track",
"the",
"exception",
"error",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/ErrorTracker.php#L42-L48 |
192,426 | ARCANEDEV/LaravelTracker | src/Trackers/ErrorTracker.php | ErrorTracker.getCode | public function getCode(Exception $exception)
{
if (method_exists($exception, 'getCode') && $code = $exception->getCode())
return $code;
if (method_exists($exception, 'getStatusCode') && $code = $exception->getStatusCode())
return $code;
return null;
} | php | public function getCode(Exception $exception)
{
if (method_exists($exception, 'getCode') && $code = $exception->getCode())
return $code;
if (method_exists($exception, 'getStatusCode') && $code = $exception->getStatusCode())
return $code;
return null;
} | [
"public",
"function",
"getCode",
"(",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"exception",
",",
"'getCode'",
")",
"&&",
"$",
"code",
"=",
"$",
"exception",
"->",
"getCode",
"(",
")",
")",
"return",
"$",
"code",
";... | Get the code from the exception.
@param \Exception $exception
@return int|mixed|null | [
"Get",
"the",
"code",
"from",
"the",
"exception",
"."
] | 9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6 | https://github.com/ARCANEDEV/LaravelTracker/blob/9bd728dd89ea7e10ea8b92efa2af9ab9d99dcab6/src/Trackers/ErrorTracker.php#L62-L71 |
192,427 | thedevsaddam/lumen-route-list | src/Console/Commands/RouteListCommand.php | RouteListCommand.displayRoutes | public function displayRoutes()
{
$headers = ['Method', 'URI', 'Name', 'Action', 'Middleware', 'Map To'];
$this->generateRoutes();
$this->applyFilters();
if (!$this->routes) {
$this->warn('No routes found!');
return false;
}
//change the revers... | php | public function displayRoutes()
{
$headers = ['Method', 'URI', 'Name', 'Action', 'Middleware', 'Map To'];
$this->generateRoutes();
$this->applyFilters();
if (!$this->routes) {
$this->warn('No routes found!');
return false;
}
//change the revers... | [
"public",
"function",
"displayRoutes",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"'Method'",
",",
"'URI'",
",",
"'Name'",
",",
"'Action'",
",",
"'Middleware'",
",",
"'Map To'",
"]",
";",
"$",
"this",
"->",
"generateRoutes",
"(",
")",
";",
"$",
"this",
"... | Display the routes in console
@return bool | [
"Display",
"the",
"routes",
"in",
"console"
] | 9954e2e1a6c2afdea9d577107555ab437b371e22 | https://github.com/thedevsaddam/lumen-route-list/blob/9954e2e1a6c2afdea9d577107555ab437b371e22/src/Console/Commands/RouteListCommand.php#L50-L67 |
192,428 | thedevsaddam/lumen-route-list | src/Console/Commands/RouteListCommand.php | RouteListCommand.generateRoutes | public function generateRoutes()
{
$routes = property_exists(app(), 'router')? app()->router->getRoutes() : app()->getRoutes();
foreach ($routes as $route) {
array_push($this->routes, [
'method' => $route['method'],
'uri' => $route['uri'],
... | php | public function generateRoutes()
{
$routes = property_exists(app(), 'router')? app()->router->getRoutes() : app()->getRoutes();
foreach ($routes as $route) {
array_push($this->routes, [
'method' => $route['method'],
'uri' => $route['uri'],
... | [
"public",
"function",
"generateRoutes",
"(",
")",
"{",
"$",
"routes",
"=",
"property_exists",
"(",
"app",
"(",
")",
",",
"'router'",
")",
"?",
"app",
"(",
")",
"->",
"router",
"->",
"getRoutes",
"(",
")",
":",
"app",
"(",
")",
"->",
"getRoutes",
"(",... | Generate the formatted routes array
@return bool | [
"Generate",
"the",
"formatted",
"routes",
"array"
] | 9954e2e1a6c2afdea9d577107555ab437b371e22 | https://github.com/thedevsaddam/lumen-route-list/blob/9954e2e1a6c2afdea9d577107555ab437b371e22/src/Console/Commands/RouteListCommand.php#L73-L86 |
192,429 | thedevsaddam/lumen-route-list | src/Console/Commands/RouteListCommand.php | RouteListCommand.applyFilters | private function applyFilters()
{
$availableOptions = ['name', 'method', 'uri', 'action', 'middleware'];
foreach ($this->options() as $key => $option) {
if (in_array($key, $availableOptions) && null != $option) {
foreach ($this->routes as $index => $route) {
... | php | private function applyFilters()
{
$availableOptions = ['name', 'method', 'uri', 'action', 'middleware'];
foreach ($this->options() as $key => $option) {
if (in_array($key, $availableOptions) && null != $option) {
foreach ($this->routes as $index => $route) {
... | [
"private",
"function",
"applyFilters",
"(",
")",
"{",
"$",
"availableOptions",
"=",
"[",
"'name'",
",",
"'method'",
",",
"'uri'",
",",
"'action'",
",",
"'middleware'",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"options",
"(",
")",
"as",
"$",
"key",
... | Apply filters on routes if user provide | [
"Apply",
"filters",
"on",
"routes",
"if",
"user",
"provide"
] | 9954e2e1a6c2afdea9d577107555ab437b371e22 | https://github.com/thedevsaddam/lumen-route-list/blob/9954e2e1a6c2afdea9d577107555ab437b371e22/src/Console/Commands/RouteListCommand.php#L91-L102 |
192,430 | nicmart/DomainSpecificQuery | src/Lucene/TreeExpression.php | TreeExpression.setExpressions | public function setExpressions(array $expressions)
{
$this->expressions = array();
foreach ($expressions as $expression) {
$this->addExpression($expression);
}
return $this;
} | php | public function setExpressions(array $expressions)
{
$this->expressions = array();
foreach ($expressions as $expression) {
$this->addExpression($expression);
}
return $this;
} | [
"public",
"function",
"setExpressions",
"(",
"array",
"$",
"expressions",
")",
"{",
"$",
"this",
"->",
"expressions",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"expressions",
"as",
"$",
"expression",
")",
"{",
"$",
"this",
"->",
"addExpression",
... | Set the set of subexpressions
@param LuceneExpression[] $expressions The array of expressions
@return $this | [
"Set",
"the",
"set",
"of",
"subexpressions"
] | 7c01fe94337afdfae5884809e8b5487127a63ac3 | https://github.com/nicmart/DomainSpecificQuery/blob/7c01fe94337afdfae5884809e8b5487127a63ac3/src/Lucene/TreeExpression.php#L65-L74 |
192,431 | Dhii/placeholder-template-abstract | src/DefaultPlaceholderValueAwareTrait.php | DefaultPlaceholderValueAwareTrait._setDefaultPlaceholderValue | protected function _setDefaultPlaceholderValue($value)
{
if (!is_null($value)) {
$value = $this->_normalizeStringable($value);
}
$this->defaultPlaceholderValue = $value;
} | php | protected function _setDefaultPlaceholderValue($value)
{
if (!is_null($value)) {
$value = $this->_normalizeStringable($value);
}
$this->defaultPlaceholderValue = $value;
} | [
"protected",
"function",
"_setDefaultPlaceholderValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"_normalizeStringable",
"(",
"$",
"value",
")",
";",
"}",
"$",
"this... | Assigns a default placeholder value to this instance.
@since [*next-version*]
@param Stringable|string|int|float|bool $value The default value.
@throws InvalidArgumentException If value is invalid. | [
"Assigns",
"a",
"default",
"placeholder",
"value",
"to",
"this",
"instance",
"."
] | bfa7cea3b1e078b19bcf59d9a3da63b8c12ed03b | https://github.com/Dhii/placeholder-template-abstract/blob/bfa7cea3b1e078b19bcf59d9a3da63b8c12ed03b/src/DefaultPlaceholderValueAwareTrait.php#L45-L52 |
192,432 | sil-project/SeedBatchBundle | src/Admin/PlotAdmin.php | PlotAdmin.validateCode | public function validateCode(ErrorElement $errorElement, $object)
{
$code = $object->getCode();
$registry = $this->getConfigurationPool()->getContainer()->get('blast_core.code_generators');
$codeGenerator = $registry->getCodeGenerator(Plot::class);
if (!empty($code) && !$codeGenerato... | php | public function validateCode(ErrorElement $errorElement, $object)
{
$code = $object->getCode();
$registry = $this->getConfigurationPool()->getContainer()->get('blast_core.code_generators');
$codeGenerator = $registry->getCodeGenerator(Plot::class);
if (!empty($code) && !$codeGenerato... | [
"public",
"function",
"validateCode",
"(",
"ErrorElement",
"$",
"errorElement",
",",
"$",
"object",
")",
"{",
"$",
"code",
"=",
"$",
"object",
"->",
"getCode",
"(",
")",
";",
"$",
"registry",
"=",
"$",
"this",
"->",
"getConfigurationPool",
"(",
")",
"->"... | Plot code validator.
@param ErrorElement $errorElement
@param Plot $object | [
"Plot",
"code",
"validator",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Admin/PlotAdmin.php#L53-L66 |
192,433 | miaoxing/plugin | src/BasePlugin.php | BasePlugin.display | protected function display($data = [])
{
// eg onScript
$function = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['function'];
$event = lcfirst(substr($function, 2));
$id = $this->getId();
// eg @plugin/plugin/script.php
$name = '@' . $id . '/' . $id . '/' . $ev... | php | protected function display($data = [])
{
// eg onScript
$function = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['function'];
$event = lcfirst(substr($function, 2));
$id = $this->getId();
// eg @plugin/plugin/script.php
$name = '@' . $id . '/' . $id . '/' . $ev... | [
"protected",
"function",
"display",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"// eg onScript",
"$",
"function",
"=",
"debug_backtrace",
"(",
"DEBUG_BACKTRACE_IGNORE_ARGS",
",",
"2",
")",
"[",
"1",
"]",
"[",
"'function'",
"]",
";",
"$",
"event",
"=",
"l... | Output a rendered template by current event template
@param array $data | [
"Output",
"a",
"rendered",
"template",
"by",
"current",
"event",
"template"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BasePlugin.php#L137-L148 |
192,434 | miaoxing/plugin | src/BasePlugin.php | BasePlugin.getBasePath | public function getBasePath()
{
if (!$this->basePath) {
$class = new \ReflectionClass($this);
$this->basePath = substr(dirname($class->getFileName()), strlen(getcwd()) + 1);
// TODO 改为默认
if (substr($class->getName(), 0, 8) == 'Miaoxing') {
$th... | php | public function getBasePath()
{
if (!$this->basePath) {
$class = new \ReflectionClass($this);
$this->basePath = substr(dirname($class->getFileName()), strlen(getcwd()) + 1);
// TODO 改为默认
if (substr($class->getName(), 0, 8) == 'Miaoxing') {
$th... | [
"public",
"function",
"getBasePath",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"basePath",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"basePath",
"=",
"substr",
"(",
"dirname",
... | Returns the web path for this plugin
@return string | [
"Returns",
"the",
"web",
"path",
"for",
"this",
"plugin"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/BasePlugin.php#L155-L168 |
192,435 | stubbles/stubbles-peer | src/main/php/IpAddress.php | IpAddress.isInCidrRange | public function isInCidrRange(string $cidrIpShort, $cidrMask): bool
{
if (is_string($cidrMask) && !ctype_digit($cidrMask)) {
throw new \InvalidArgumentException(
'cidrMask must be of type int or a string losslessly'
. ' convertible to int.'
);
... | php | public function isInCidrRange(string $cidrIpShort, $cidrMask): bool
{
if (is_string($cidrMask) && !ctype_digit($cidrMask)) {
throw new \InvalidArgumentException(
'cidrMask must be of type int or a string losslessly'
. ' convertible to int.'
);
... | [
"public",
"function",
"isInCidrRange",
"(",
"string",
"$",
"cidrIpShort",
",",
"$",
"cidrMask",
")",
":",
"bool",
"{",
"if",
"(",
"is_string",
"(",
"$",
"cidrMask",
")",
"&&",
"!",
"ctype_digit",
"(",
"$",
"cidrMask",
")",
")",
"{",
"throw",
"new",
"\\... | checks if IP address is in given CIDR range
A cidr range is commonly notated as 10.16/13. From this, $cidrIpShort
would be 10.16 and $cidrMask would be 13 or 47.
Please note that this method currently supports IPv4 only.
@param string $cidrIpShort
@param int|string $cidrMask
@return bool
@throws \Invalid... | [
"checks",
"if",
"IP",
"address",
"is",
"in",
"given",
"CIDR",
"range"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/IpAddress.php#L185-L199 |
192,436 | stubbles/stubbles-peer | src/main/php/IpAddress.php | IpAddress.calculateIpRange | private function calculateIpRange(int $cidrIpLong, int $cidrMask): array
{
$netWork = $cidrIpLong & $this->netMask($cidrMask);
$lower = $netWork + 1; // ignore network ID (eg: 192.168.1.0)
$upper = ($netWork | $this->inverseNetMask($cidrMask)) - 1 ; // ignore broadcast IP (eg: 192.168.1... | php | private function calculateIpRange(int $cidrIpLong, int $cidrMask): array
{
$netWork = $cidrIpLong & $this->netMask($cidrMask);
$lower = $netWork + 1; // ignore network ID (eg: 192.168.1.0)
$upper = ($netWork | $this->inverseNetMask($cidrMask)) - 1 ; // ignore broadcast IP (eg: 192.168.1... | [
"private",
"function",
"calculateIpRange",
"(",
"int",
"$",
"cidrIpLong",
",",
"int",
"$",
"cidrMask",
")",
":",
"array",
"{",
"$",
"netWork",
"=",
"$",
"cidrIpLong",
"&",
"$",
"this",
"->",
"netMask",
"(",
"$",
"cidrMask",
")",
";",
"$",
"lower",
"=",... | returns lower and upper ip for IP range as long
@param int $cidrIpLong
@param int $cidrMask
@return int[] | [
"returns",
"lower",
"and",
"upper",
"ip",
"for",
"IP",
"range",
"as",
"long"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/IpAddress.php#L208-L214 |
192,437 | stubbles/stubbles-peer | src/main/php/IpAddress.php | IpAddress.openSocket | public function openSocket(int $port, int $timeout = 5, callable $openWith = null): Stream
{
$socket = new Socket($this->ip, $port, null);
if (null !== $openWith) {
$socket->openWith($openWith);
}
return $socket->connect()->setTimeout($timeout);
} | php | public function openSocket(int $port, int $timeout = 5, callable $openWith = null): Stream
{
$socket = new Socket($this->ip, $port, null);
if (null !== $openWith) {
$socket->openWith($openWith);
}
return $socket->connect()->setTimeout($timeout);
} | [
"public",
"function",
"openSocket",
"(",
"int",
"$",
"port",
",",
"int",
"$",
"timeout",
"=",
"5",
",",
"callable",
"$",
"openWith",
"=",
"null",
")",
":",
"Stream",
"{",
"$",
"socket",
"=",
"new",
"Socket",
"(",
"$",
"this",
"->",
"ip",
",",
"$",
... | opens socket to this ip address
@param int $port port to connect to
@param int $timeout optional connection timeout
@param callable $openWith optional open port with this function
@return \stubbles\peer\Stream | [
"opens",
"socket",
"to",
"this",
"ip",
"address"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/IpAddress.php#L289-L297 |
192,438 | pryley/castor-framework | src/Services/Normalizer.php | Normalizer.form | public function form( array $args = [], $implode = false )
{
$attributes = $this->parseAttributes( self::FORM_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | php | public function form( array $args = [], $implode = false )
{
$attributes = $this->parseAttributes( self::FORM_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | [
"public",
"function",
"form",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
",",
"$",
"implode",
"=",
"false",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"parseAttributes",
"(",
"self",
"::",
"FORM_ATTRIBUTES",
",",
"$",
"args",
")",
";",
"retu... | Normalize form attributes
@return array|string | [
"Normalize",
"form",
"attributes"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Normalizer.php#L67-L72 |
192,439 | pryley/castor-framework | src/Services/Normalizer.php | Normalizer.input | public function input( array $args = [], $implode = false )
{
$this->filterInputType();
$attributes = $this->parseAttributes( self::INPUT_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | php | public function input( array $args = [], $implode = false )
{
$this->filterInputType();
$attributes = $this->parseAttributes( self::INPUT_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | [
"public",
"function",
"input",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
",",
"$",
"implode",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"filterInputType",
"(",
")",
";",
"$",
"attributes",
"=",
"$",
"this",
"->",
"parseAttributes",
"(",
"self",
"::"... | Normalize input attributes
@return array|string | [
"Normalize",
"input",
"attributes"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Normalizer.php#L79-L86 |
192,440 | pryley/castor-framework | src/Services/Normalizer.php | Normalizer.maybeImplode | public function maybeImplode( array $attributes, $implode = true )
{
if( !$implode || $implode !== 'implode' ) {
return $attributes;
}
$results = [];
foreach( $attributes as $key => $value ) {
// if data attributes, use single quotes in case of json encoded values
$quotes = false !== stripos( $key, 'd... | php | public function maybeImplode( array $attributes, $implode = true )
{
if( !$implode || $implode !== 'implode' ) {
return $attributes;
}
$results = [];
foreach( $attributes as $key => $value ) {
// if data attributes, use single quotes in case of json encoded values
$quotes = false !== stripos( $key, 'd... | [
"public",
"function",
"maybeImplode",
"(",
"array",
"$",
"attributes",
",",
"$",
"implode",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"implode",
"||",
"$",
"implode",
"!==",
"'implode'",
")",
"{",
"return",
"$",
"attributes",
";",
"}",
"$",
"results"... | Possibly implode attributes into a string
@param bool|string $implode
@return array|string | [
"Possibly",
"implode",
"attributes",
"into",
"a",
"string"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Normalizer.php#L95-L113 |
192,441 | pryley/castor-framework | src/Services/Normalizer.php | Normalizer.select | public function select( array $args = [], $implode = false )
{
$attributes = $this->parseAttributes( self::SELECT_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | php | public function select( array $args = [], $implode = false )
{
$attributes = $this->parseAttributes( self::SELECT_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | [
"public",
"function",
"select",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
",",
"$",
"implode",
"=",
"false",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"parseAttributes",
"(",
"self",
"::",
"SELECT_ATTRIBUTES",
",",
"$",
"args",
")",
";",
"... | Normalize select attributes
@return array|string | [
"Normalize",
"select",
"attributes"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Normalizer.php#L120-L125 |
192,442 | pryley/castor-framework | src/Services/Normalizer.php | Normalizer.textarea | public function textarea( array $args = [], $implode = false )
{
$attributes = $this->parseAttributes( self::TEXTAREA_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | php | public function textarea( array $args = [], $implode = false )
{
$attributes = $this->parseAttributes( self::TEXTAREA_ATTRIBUTES, $args );
return $this->maybeImplode( $attributes, $implode );
} | [
"public",
"function",
"textarea",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
",",
"$",
"implode",
"=",
"false",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"parseAttributes",
"(",
"self",
"::",
"TEXTAREA_ATTRIBUTES",
",",
"$",
"args",
")",
";",... | Normalize textarea attributes
@return array|string | [
"Normalize",
"textarea",
"attributes"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Normalizer.php#L132-L137 |
192,443 | pryley/castor-framework | src/Services/Normalizer.php | Normalizer.filterAttributes | protected function filterAttributes( array $attributeKeys )
{
$filtered = array_intersect_key( $this->args, array_flip( $attributeKeys ));
// normalize truthy boolean attributes
foreach( $filtered as $key => $value ) {
if( !in_array( $key, self::BOOLEAN_ATTRIBUTES ))continue;
if( $value !== false ) {
... | php | protected function filterAttributes( array $attributeKeys )
{
$filtered = array_intersect_key( $this->args, array_flip( $attributeKeys ));
// normalize truthy boolean attributes
foreach( $filtered as $key => $value ) {
if( !in_array( $key, self::BOOLEAN_ATTRIBUTES ))continue;
if( $value !== false ) {
... | [
"protected",
"function",
"filterAttributes",
"(",
"array",
"$",
"attributeKeys",
")",
"{",
"$",
"filtered",
"=",
"array_intersect_key",
"(",
"$",
"this",
"->",
"args",
",",
"array_flip",
"(",
"$",
"attributeKeys",
")",
")",
";",
"// normalize truthy boolean attrib... | Filter attributes by the provided attrribute keys and remove any non-boolean keys
with empty values
@return array | [
"Filter",
"attributes",
"by",
"the",
"provided",
"attrribute",
"keys",
"and",
"remove",
"any",
"non",
"-",
"boolean",
"keys",
"with",
"empty",
"values"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Normalizer.php#L145-L170 |
192,444 | SlabPHP/cache-manager | src/Driver.php | Driver.requireProvider | private function requireProvider($message = '')
{
if (empty($this->cacheProvider)) {
if (!empty($this->log)) $this->log->notice("Cache provider is not available. " . $message);
return false;
}
return true;
} | php | private function requireProvider($message = '')
{
if (empty($this->cacheProvider)) {
if (!empty($this->log)) $this->log->notice("Cache provider is not available. " . $message);
return false;
}
return true;
} | [
"private",
"function",
"requireProvider",
"(",
"$",
"message",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"cacheProvider",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"log",
")",
")",
"$",
"this",
"->",
"... | Require a provider
@param string $message
@return boolean | [
"Require",
"a",
"provider"
] | 7bbf9fe6519071fe14d382e98925cd3e10010a3a | https://github.com/SlabPHP/cache-manager/blob/7bbf9fe6519071fe14d382e98925cd3e10010a3a/src/Driver.php#L55-L64 |
192,445 | SlabPHP/cache-manager | src/Driver.php | Driver.execute | public function execute(Request $request)
{
if (!$this->requireProvider("Executing cache request")) return null;
$cacheKey = $request->getCacheKey();
if (empty($cacheKey)) {
if (!empty($this->log)) $this->log->error("Invalid or missing cache key.");
return null;
... | php | public function execute(Request $request)
{
if (!$this->requireProvider("Executing cache request")) return null;
$cacheKey = $request->getCacheKey();
if (empty($cacheKey)) {
if (!empty($this->log)) $this->log->error("Invalid or missing cache key.");
return null;
... | [
"public",
"function",
"execute",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"requireProvider",
"(",
"\"Executing cache request\"",
")",
")",
"return",
"null",
";",
"$",
"cacheKey",
"=",
"$",
"request",
"->",
"getCacheKey",
... | Do a cache request
@param Request $request
@return mixed | [
"Do",
"a",
"cache",
"request"
] | 7bbf9fe6519071fe14d382e98925cd3e10010a3a | https://github.com/SlabPHP/cache-manager/blob/7bbf9fe6519071fe14d382e98925cd3e10010a3a/src/Driver.php#L132-L164 |
192,446 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/FieldMetadata.php | FieldMetadata.validateKey | protected function validateKey($key)
{
$reserved = ['type', 'id'];
if (in_array(strtolower($key), $reserved)) {
throw MetadataException::reservedFieldKey($key, $reserved);
}
} | php | protected function validateKey($key)
{
$reserved = ['type', 'id'];
if (in_array(strtolower($key), $reserved)) {
throw MetadataException::reservedFieldKey($key, $reserved);
}
} | [
"protected",
"function",
"validateKey",
"(",
"$",
"key",
")",
"{",
"$",
"reserved",
"=",
"[",
"'type'",
",",
"'id'",
"]",
";",
"if",
"(",
"in_array",
"(",
"strtolower",
"(",
"$",
"key",
")",
",",
"$",
"reserved",
")",
")",
"{",
"throw",
"MetadataExce... | Validates that the field key is not reserved.
@param string $key
@throws MetadataException | [
"Validates",
"that",
"the",
"field",
"key",
"is",
"not",
"reserved",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/FieldMetadata.php#L49-L55 |
192,447 | bit55/midcore | src/Middleware/RouteActionHandler.php | RouteActionHandler.executeHandler | public function executeHandler($request, $handler)
{
// execute actions as middleware
if (!is_array($handler) || is_callable($handler)) {
$handler = [$handler, \Bit55\Midcore\Middleware\NotFoundHandler::class];
}
$dispatcher = new Dispatcher($handler, $this->container);
... | php | public function executeHandler($request, $handler)
{
// execute actions as middleware
if (!is_array($handler) || is_callable($handler)) {
$handler = [$handler, \Bit55\Midcore\Middleware\NotFoundHandler::class];
}
$dispatcher = new Dispatcher($handler, $this->container);
... | [
"public",
"function",
"executeHandler",
"(",
"$",
"request",
",",
"$",
"handler",
")",
"{",
"// execute actions as middleware",
"if",
"(",
"!",
"is_array",
"(",
"$",
"handler",
")",
"||",
"is_callable",
"(",
"$",
"handler",
")",
")",
"{",
"$",
"handler",
"... | Executing application action.
@param string|callable|array $handler | [
"Executing",
"application",
"action",
"."
] | 53f96a82e709918b4691372f0554a6e6f6ba2ae3 | https://github.com/bit55/midcore/blob/53f96a82e709918b4691372f0554a6e6f6ba2ae3/src/Middleware/RouteActionHandler.php#L44-L53 |
192,448 | agentmedia/phine-core | src/Core/Modules/Backend/LayoutList.php | LayoutList.RemovalObject | protected function RemovalObject()
{
$id = Request::PostData('delete');
return $id ? Layout::Schema()->ByID($id) : null;
} | php | protected function RemovalObject()
{
$id = Request::PostData('delete');
return $id ? Layout::Schema()->ByID($id) : null;
} | [
"protected",
"function",
"RemovalObject",
"(",
")",
"{",
"$",
"id",
"=",
"Request",
"::",
"PostData",
"(",
"'delete'",
")",
";",
"return",
"$",
"id",
"?",
"Layout",
"::",
"Schema",
"(",
")",
"->",
"ByID",
"(",
"$",
"id",
")",
":",
"null",
";",
"}"
... | Gets the layout that is requested to be removed
@return Layout The removal layout | [
"Gets",
"the",
"layout",
"that",
"is",
"requested",
"to",
"be",
"removed"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/LayoutList.php#L68-L72 |
192,449 | agentmedia/phine-core | src/Core/Modules/Backend/LayoutList.php | LayoutList.CanDelete | protected function CanDelete(Layout $layout)
{
return self::Guard()->Allow(BackendAction::Delete(), $layout)
&& self::Guard()->Allow(BackendAction::UseIt(), new LayoutForm());
} | php | protected function CanDelete(Layout $layout)
{
return self::Guard()->Allow(BackendAction::Delete(), $layout)
&& self::Guard()->Allow(BackendAction::UseIt(), new LayoutForm());
} | [
"protected",
"function",
"CanDelete",
"(",
"Layout",
"$",
"layout",
")",
"{",
"return",
"self",
"::",
"Guard",
"(",
")",
"->",
"Allow",
"(",
"BackendAction",
"::",
"Delete",
"(",
")",
",",
"$",
"layout",
")",
"&&",
"self",
"::",
"Guard",
"(",
")",
"-... | True if layout can be deleted
@param Layout $layout The layout
@return boo | [
"True",
"if",
"layout",
"can",
"be",
"deleted"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/LayoutList.php#L120-L124 |
192,450 | zapheus/zapheus | src/Routing/Resolver.php | Resolver.resolve | public function resolve(RouteInterface $route)
{
if (is_string($handler = $route->handler()))
{
$handler = explode('@', $handler);
}
$parameters = (array) $route->parameters();
list($handler, $reflection) = $this->reflection($handler);
$parameters = $th... | php | public function resolve(RouteInterface $route)
{
if (is_string($handler = $route->handler()))
{
$handler = explode('@', $handler);
}
$parameters = (array) $route->parameters();
list($handler, $reflection) = $this->reflection($handler);
$parameters = $th... | [
"public",
"function",
"resolve",
"(",
"RouteInterface",
"$",
"route",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"handler",
"=",
"$",
"route",
"->",
"handler",
"(",
")",
")",
")",
"{",
"$",
"handler",
"=",
"explode",
"(",
"'@'",
",",
"$",
"handler",... | Resolves the specified route instance.
@param \Zapheus\Routing\RouteInterface $route
@return mixed | [
"Resolves",
"the",
"specified",
"route",
"instance",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Routing/Resolver.php#L36-L50 |
192,451 | zapheus/zapheus | src/Routing/Resolver.php | Resolver.instance | protected function instance($class)
{
$reflection = new \ReflectionClass($class);
$arguments = array();
$constructor = $reflection->getConstructor();
if ($this->container->has($class))
{
return $this->container->get($class);
}
if ($constructor ... | php | protected function instance($class)
{
$reflection = new \ReflectionClass($class);
$arguments = array();
$constructor = $reflection->getConstructor();
if ($this->container->has($class))
{
return $this->container->get($class);
}
if ($constructor ... | [
"protected",
"function",
"instance",
"(",
"$",
"class",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"arguments",
"=",
"array",
"(",
")",
";",
"$",
"constructor",
"=",
"$",
"reflection",
"->",
"get... | Returns the instance of the identifier from the container.
@param string $class
@return mixed | [
"Returns",
"the",
"instance",
"of",
"the",
"identifier",
"from",
"the",
"container",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Routing/Resolver.php#L99-L118 |
192,452 | zapheus/zapheus | src/Routing/Resolver.php | Resolver.reflection | protected function reflection($handler)
{
if (! is_array($handler))
{
$instance = new \ReflectionFunction($handler);
return array($handler, $instance);
}
list($class, $method) = (array) $handler;
$instance = new \ReflectionMethod($class, $method);
... | php | protected function reflection($handler)
{
if (! is_array($handler))
{
$instance = new \ReflectionFunction($handler);
return array($handler, $instance);
}
list($class, $method) = (array) $handler;
$instance = new \ReflectionMethod($class, $method);
... | [
"protected",
"function",
"reflection",
"(",
"$",
"handler",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"handler",
")",
")",
"{",
"$",
"instance",
"=",
"new",
"\\",
"ReflectionFunction",
"(",
"$",
"handler",
")",
";",
"return",
"array",
"(",
"$",
... | Returns a ReflectionFunctionAbstract instance.
@param array|callable $handler
@return \ReflectionFunctionAbstract | [
"Returns",
"a",
"ReflectionFunctionAbstract",
"instance",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Routing/Resolver.php#L126-L142 |
192,453 | Ydle/HubBundle | Controller/LogsController.php | LogsController.indexAction | public function indexAction(Request $request)
{
$query = $this->get('ydle.logger')->createViewLogQuery();
$paginator = $this->get('knp_paginator');
$pagination = $paginator->paginate(
$query,
$this->get('request')->query->get('page', 1)/*page number*/,
2... | php | public function indexAction(Request $request)
{
$query = $this->get('ydle.logger')->createViewLogQuery();
$paginator = $this->get('knp_paginator');
$pagination = $paginator->paginate(
$query,
$this->get('request')->query->get('page', 1)/*page number*/,
2... | [
"public",
"function",
"indexAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"get",
"(",
"'ydle.logger'",
")",
"->",
"createViewLogQuery",
"(",
")",
";",
"$",
"paginator",
"=",
"$",
"this",
"->",
"get",
"(",
"'kn... | Homepage for logs
@param \Symfony\Component\HttpFoundation\Request $request
@return type | [
"Homepage",
"for",
"logs"
] | 7fa423241246bcfd115f2ed3ad3997b4b63adb01 | https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Controller/LogsController.php#L34-L52 |
192,454 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Schema/Index/Index.php | Index.getDefinition | public function getDefinition()
{
$definition['KeySchema'] = $this->getDefinitionKeySchema();
if ($this->isPrimary()) {
$definition['AttributeDefinitions'] = $this->getDefinitionAttributes();
} else {
$definition['IndexName'] = $this->getName();
$definit... | php | public function getDefinition()
{
$definition['KeySchema'] = $this->getDefinitionKeySchema();
if ($this->isPrimary()) {
$definition['AttributeDefinitions'] = $this->getDefinitionAttributes();
} else {
$definition['IndexName'] = $this->getName();
$definit... | [
"public",
"function",
"getDefinition",
"(",
")",
"{",
"$",
"definition",
"[",
"'KeySchema'",
"]",
"=",
"$",
"this",
"->",
"getDefinitionKeySchema",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isPrimary",
"(",
")",
")",
"{",
"$",
"definition",
"[",
"'... | Return the index definition, formatted for AWS SDK.
@return array | [
"Return",
"the",
"index",
"definition",
"formatted",
"for",
"AWS",
"SDK",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Index/Index.php#L114-L131 |
192,455 | jenskooij/cloudcontrol | src/storage/factories/BrickFactory.php | BrickFactory.createBrickFromPostValues | public static function createBrickFromPostValues($postValues)
{
if (isset($postValues['title'])) {
$brickObject = new \stdClass();
$brickObject->title = $postValues['title'];
$brickObject->slug = StringUtil::slugify($postValues['title']);
$brickObject->fields ... | php | public static function createBrickFromPostValues($postValues)
{
if (isset($postValues['title'])) {
$brickObject = new \stdClass();
$brickObject->title = $postValues['title'];
$brickObject->slug = StringUtil::slugify($postValues['title']);
$brickObject->fields ... | [
"public",
"static",
"function",
"createBrickFromPostValues",
"(",
"$",
"postValues",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"postValues",
"[",
"'title'",
"]",
")",
")",
"{",
"$",
"brickObject",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"brickObj... | Create a brick from post values
@param $postValues
@return \stdClass
@throws \Exception | [
"Create",
"a",
"brick",
"from",
"post",
"values"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/factories/BrickFactory.php#L23-L42 |
192,456 | jamset/process-load-manager | src/Pm.php | Pm.manage | public function manage()
{
if (!($this->processManagerDto instanceof ProcessManagerDto)) {
throw new ProcessManagerException("ProcessManagerDto wasn't set.");
}
$this->executionDto = new ExecutionDto();
$this->reactControlDto = $this->processManagerDto;
$this->in... | php | public function manage()
{
if (!($this->processManagerDto instanceof ProcessManagerDto)) {
throw new ProcessManagerException("ProcessManagerDto wasn't set.");
}
$this->executionDto = new ExecutionDto();
$this->reactControlDto = $this->processManagerDto;
$this->in... | [
"public",
"function",
"manage",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"processManagerDto",
"instanceof",
"ProcessManagerDto",
")",
")",
"{",
"throw",
"new",
"ProcessManagerException",
"(",
"\"ProcessManagerDto wasn't set.\"",
")",
";",
"}",
"$",... | Manage processes creation and termination during to load manager info and tasks number
@param ProcessManagerDto $processManagerDto | [
"Manage",
"processes",
"creation",
"and",
"termination",
"during",
"to",
"load",
"manager",
"info",
"and",
"tasks",
"number"
] | cffed6ff73bf66617565707ec4f2c9251a497cc6 | https://github.com/jamset/process-load-manager/blob/cffed6ff73bf66617565707ec4f2c9251a497cc6/src/Pm.php#L189-L214 |
192,457 | pMatviienko/zf2-common | SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/Captcha/Image.php | Image.render | public function render(ElementInterface $element)
{
$captcha = $element->getCaptcha();
if ($captcha === null || !$captcha instanceof CaptchaAdapter) {
throw new Exception\DomainException(sprintf(
'%s requires that the element has a "captcha" attribute of type Zend\Captch... | php | public function render(ElementInterface $element)
{
$captcha = $element->getCaptcha();
if ($captcha === null || !$captcha instanceof CaptchaAdapter) {
throw new Exception\DomainException(sprintf(
'%s requires that the element has a "captcha" attribute of type Zend\Captch... | [
"public",
"function",
"render",
"(",
"ElementInterface",
"$",
"element",
")",
"{",
"$",
"captcha",
"=",
"$",
"element",
"->",
"getCaptcha",
"(",
")",
";",
"if",
"(",
"$",
"captcha",
"===",
"null",
"||",
"!",
"$",
"captcha",
"instanceof",
"CaptchaAdapter",
... | Render the captcha
@param ElementInterface $element
@throws Exception\DomainException
@return string | [
"Render",
"the",
"captcha"
] | e59aa9b1eece72437cf0fd7c8466c0daeffcc481 | https://github.com/pMatviienko/zf2-common/blob/e59aa9b1eece72437cf0fd7c8466c0daeffcc481/SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/Captcha/Image.php#L18-L58 |
192,458 | koolkode/view-express | src/ExpressViewFactory.php | ExpressViewFactory.createView | public function createView(ExpressViewRenderer $renderer, $resource)
{
$resource = (string)$resource;
if(!is_file($resource))
{
throw new \RuntimeException(sprintf('Express view not found: "%s"', $resource));
}
$key = $this->createKey($resource);
$typeName = $this->createTypeName($resource);
... | php | public function createView(ExpressViewRenderer $renderer, $resource)
{
$resource = (string)$resource;
if(!is_file($resource))
{
throw new \RuntimeException(sprintf('Express view not found: "%s"', $resource));
}
$key = $this->createKey($resource);
$typeName = $this->createTypeName($resource);
... | [
"public",
"function",
"createView",
"(",
"ExpressViewRenderer",
"$",
"renderer",
",",
"$",
"resource",
")",
"{",
"$",
"resource",
"=",
"(",
"string",
")",
"$",
"resource",
";",
"if",
"(",
"!",
"is_file",
"(",
"$",
"resource",
")",
")",
"{",
"throw",
"n... | Create an express view from the given XML view, will utilize the cache directory
to dump and load a template compiled into plain PHP code.
@param ExpressViewRenderer $renderer
@param string $resource The resource to be compiled into a view.
@return string The fully-qualified name of the compiled view.
@throws \Runtim... | [
"Create",
"an",
"express",
"view",
"from",
"the",
"given",
"XML",
"view",
"will",
"utilize",
"the",
"cache",
"directory",
"to",
"dump",
"and",
"load",
"a",
"template",
"compiled",
"into",
"plain",
"PHP",
"code",
"."
] | a8ebe6f373b6bfe8b8818d6264535e8fe063a596 | https://github.com/koolkode/view-express/blob/a8ebe6f373b6bfe8b8818d6264535e8fe063a596/src/ExpressViewFactory.php#L77-L127 |
192,459 | koolkode/view-express | src/ExpressViewFactory.php | ExpressViewFactory.parseView | protected function parseView(ExpressViewRenderer $renderer, $data, $resource = '')
{
try
{
// This ugly pre-processing is neccessary due to DOM XML forgetting about self-closing elements.
$reader = new XmlStreamReader();
$reader->XML($data);
$buffer = '<?xml version="1.0"?>' . "\n";
while($r... | php | protected function parseView(ExpressViewRenderer $renderer, $data, $resource = '')
{
try
{
// This ugly pre-processing is neccessary due to DOM XML forgetting about self-closing elements.
$reader = new XmlStreamReader();
$reader->XML($data);
$buffer = '<?xml version="1.0"?>' . "\n";
while($r... | [
"protected",
"function",
"parseView",
"(",
"ExpressViewRenderer",
"$",
"renderer",
",",
"$",
"data",
",",
"$",
"resource",
"=",
"''",
")",
"{",
"try",
"{",
"// This ugly pre-processing is neccessary due to DOM XML forgetting about self-closing elements.",
"$",
"reader",
"... | Compile the given XML source and return a compiler object.
@param string $data
@return ExpressCompiler | [
"Compile",
"the",
"given",
"XML",
"source",
"and",
"return",
"a",
"compiler",
"object",
"."
] | a8ebe6f373b6bfe8b8818d6264535e8fe063a596 | https://github.com/koolkode/view-express/blob/a8ebe6f373b6bfe8b8818d6264535e8fe063a596/src/ExpressViewFactory.php#L135-L234 |
192,460 | agentmedia/phine-core | src/Core/Modules/Backend/MembergroupList.php | MembergroupList.Init | protected function Init()
{
$sql = Access::SqlBuilder();
$tbl = Membergroup::Schema()->Table();
$order = $sql->OrderList($sql->OrderAsc($tbl->Field('Name')));
$this->groups = Membergroup::Schema()->Fetch(false, null, $order);
return parent::Init();
} | php | protected function Init()
{
$sql = Access::SqlBuilder();
$tbl = Membergroup::Schema()->Table();
$order = $sql->OrderList($sql->OrderAsc($tbl->Field('Name')));
$this->groups = Membergroup::Schema()->Fetch(false, null, $order);
return parent::Init();
} | [
"protected",
"function",
"Init",
"(",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tbl",
"=",
"Membergroup",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$",
"order",
"=",
"$",
"sql",
"->",
"OrderList",
... | Initiaizes the set of groups | [
"Initiaizes",
"the",
"set",
"of",
"groups"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/MembergroupList.php#L31-L38 |
192,461 | Finesse/QueryScribe | src/QueryBricks/ResolvesClosuresTrait.php | ResolvesClosuresTrait.resolveSubQueryClosure | protected function resolveSubQueryClosure(\Closure $callback): Query
{
if ($this->closureResolver === null) {
return $this->makeCopyForSubQuery()->apply($callback);
} else {
return $this->closureResolver->resolveSubQueryClosure($callback);
}
} | php | protected function resolveSubQueryClosure(\Closure $callback): Query
{
if ($this->closureResolver === null) {
return $this->makeCopyForSubQuery()->apply($callback);
} else {
return $this->closureResolver->resolveSubQueryClosure($callback);
}
} | [
"protected",
"function",
"resolveSubQueryClosure",
"(",
"\\",
"Closure",
"$",
"callback",
")",
":",
"Query",
"{",
"if",
"(",
"$",
"this",
"->",
"closureResolver",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"makeCopyForSubQuery",
"(",
")",
"->",
... | Retrieves the query object from a closure given instead of a subquery.
@param \Closure $callback
@return Query Retrieved query
@throws InvalidReturnValueException | [
"Retrieves",
"the",
"query",
"object",
"from",
"a",
"closure",
"given",
"instead",
"of",
"a",
"subquery",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/ResolvesClosuresTrait.php#L40-L47 |
192,462 | Finesse/QueryScribe | src/QueryBricks/ResolvesClosuresTrait.php | ResolvesClosuresTrait.resolveCriteriaGroupClosure | protected function resolveCriteriaGroupClosure(\Closure $callback): Query
{
if ($this->closureResolver === null) {
return $this->makeCopyForCriteriaGroup()->apply($callback);
} else {
return $this->closureResolver->resolveCriteriaGroupClosure($callback);
}
} | php | protected function resolveCriteriaGroupClosure(\Closure $callback): Query
{
if ($this->closureResolver === null) {
return $this->makeCopyForCriteriaGroup()->apply($callback);
} else {
return $this->closureResolver->resolveCriteriaGroupClosure($callback);
}
} | [
"protected",
"function",
"resolveCriteriaGroupClosure",
"(",
"\\",
"Closure",
"$",
"callback",
")",
":",
"Query",
"{",
"if",
"(",
"$",
"this",
"->",
"closureResolver",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"makeCopyForCriteriaGroup",
"(",
")",
... | Retrieves the query object from a closure given instead of a criteria group query.
@param \Closure $callback
@return Query Retrieved query
@throws InvalidReturnValueException | [
"Retrieves",
"the",
"query",
"object",
"from",
"a",
"closure",
"given",
"instead",
"of",
"a",
"criteria",
"group",
"query",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/ResolvesClosuresTrait.php#L56-L63 |
192,463 | kaiohken1982/NeobazaarMailerModule | src/Mailer/Mail/ExpiredClassified.php | ExpiredClassified.configure | public function configure(array $data)
{
$this->checkData($data);
$body = new MimeMessage();
$body->addPart($this->getPart($data));
$this->setBody($body);
$this->addTo($data['to']);
//$this->addReplyTo($data['from']);
$this->setSubject(utf8_decode($this->subject));
return $this;
} | php | public function configure(array $data)
{
$this->checkData($data);
$body = new MimeMessage();
$body->addPart($this->getPart($data));
$this->setBody($body);
$this->addTo($data['to']);
//$this->addReplyTo($data['from']);
$this->setSubject(utf8_decode($this->subject));
return $this;
} | [
"public",
"function",
"configure",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"checkData",
"(",
"$",
"data",
")",
";",
"$",
"body",
"=",
"new",
"MimeMessage",
"(",
")",
";",
"$",
"body",
"->",
"addPart",
"(",
"$",
"this",
"->",
"getPar... | Configure amil message with passed data
@throws \Exception
@param array $data
@return \Mailer\Mail\ClassifiedAnswer | [
"Configure",
"amil",
"message",
"with",
"passed",
"data"
] | 0afc66196a0a392ecb4f052f483f2b5ff606bd8f | https://github.com/kaiohken1982/NeobazaarMailerModule/blob/0afc66196a0a392ecb4f052f483f2b5ff606bd8f/src/Mailer/Mail/ExpiredClassified.php#L80-L92 |
192,464 | theopera/framework | src/Component/Http/HttpClient.php | HttpClient.execute | public function execute(Request $request) : Response
{
$host = $request->getHost();
$socket = new ClientSocket($host, 80);
$socket->connect();
$communicator = $socket->getCommunicator();
$communicator->write($request);
$communicator->writeLine('');$communicator->write... | php | public function execute(Request $request) : Response
{
$host = $request->getHost();
$socket = new ClientSocket($host, 80);
$socket->connect();
$communicator = $socket->getCommunicator();
$communicator->write($request);
$communicator->writeLine('');$communicator->write... | [
"public",
"function",
"execute",
"(",
"Request",
"$",
"request",
")",
":",
"Response",
"{",
"$",
"host",
"=",
"$",
"request",
"->",
"getHost",
"(",
")",
";",
"$",
"socket",
"=",
"new",
"ClientSocket",
"(",
"$",
"host",
",",
"80",
")",
";",
"$",
"so... | Executes a http request
on success a Response object will be returned
@param Request $request
@return Response | [
"Executes",
"a",
"http",
"request",
"on",
"success",
"a",
"Response",
"object",
"will",
"be",
"returned"
] | fa6165d3891a310faa580c81dee49a63c150c711 | https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Http/HttpClient.php#L38-L73 |
192,465 | naucon/Utility | src/IteratorDecoratorLimit.php | IteratorDecoratorLimit.hasNext | public function hasNext()
{
if (parent::hasNext()
&& ($this->getItemPosition() < ($this->getItemOffset() + $this->getItemCount()) - 1)
) {
return true;
}
return false;
} | php | public function hasNext()
{
if (parent::hasNext()
&& ($this->getItemPosition() < ($this->getItemOffset() + $this->getItemCount()) - 1)
) {
return true;
}
return false;
} | [
"public",
"function",
"hasNext",
"(",
")",
"{",
"if",
"(",
"parent",
"::",
"hasNext",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"getItemPosition",
"(",
")",
"<",
"(",
"$",
"this",
"->",
"getItemOffset",
"(",
")",
"+",
"$",
"this",
"->",
"getItemCount",... | return true if iterator has a next items
@return bool has next item | [
"return",
"true",
"if",
"iterator",
"has",
"a",
"next",
"items"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/IteratorDecoratorLimit.php#L101-L109 |
192,466 | naucon/Utility | src/IteratorDecoratorLimit.php | IteratorDecoratorLimit.valid | public function valid()
{
if ($this->getItemPosition() >= $this->getItemOffset()
&& $this->getItemPosition() < ($this->getItemOffset() + $this->getItemCount())
) {
return parent::valid();
}
return false;
} | php | public function valid()
{
if ($this->getItemPosition() >= $this->getItemOffset()
&& $this->getItemPosition() < ($this->getItemOffset() + $this->getItemCount())
) {
return parent::valid();
}
return false;
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getItemPosition",
"(",
")",
">=",
"$",
"this",
"->",
"getItemOffset",
"(",
")",
"&&",
"$",
"this",
"->",
"getItemPosition",
"(",
")",
"<",
"(",
"$",
"this",
"->",
"getItemOf... | return true if current item is valid
@return bool current item is valid | [
"return",
"true",
"if",
"current",
"item",
"is",
"valid"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/IteratorDecoratorLimit.php#L131-L139 |
192,467 | naucon/Utility | src/IteratorDecoratorLimit.php | IteratorDecoratorLimit.count | public function count()
{
$countItems = $this->countItems() - $this->getItemOffset();
if ($countItems >= $this->getItemCount()) {
$countItems = $this->getItemCount();
}
return $countItems;
} | php | public function count()
{
$countItems = $this->countItems() - $this->getItemOffset();
if ($countItems >= $this->getItemCount()) {
$countItems = $this->getItemCount();
}
return $countItems;
} | [
"public",
"function",
"count",
"(",
")",
"{",
"$",
"countItems",
"=",
"$",
"this",
"->",
"countItems",
"(",
")",
"-",
"$",
"this",
"->",
"getItemOffset",
"(",
")",
";",
"if",
"(",
"$",
"countItems",
">=",
"$",
"this",
"->",
"getItemCount",
"(",
")",
... | return the number of items in the subset
@return int number of items | [
"return",
"the",
"number",
"of",
"items",
"in",
"the",
"subset"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/IteratorDecoratorLimit.php#L180-L187 |
192,468 | FuzeWorks/Core | src/FuzeWorks/Plugins.php | Plugins.loadHeaders | public function loadHeaders()
{
// Cycle through all pluginPaths
$this->headers = array();
foreach ($this->pluginPaths as $pluginPath) {
// If directory does not exist, skip it
if (!file_exists($pluginPath) || !is_dir($pluginPath))
{
continue;
}
// Fetch the contents of the path
$plugi... | php | public function loadHeaders()
{
// Cycle through all pluginPaths
$this->headers = array();
foreach ($this->pluginPaths as $pluginPath) {
// If directory does not exist, skip it
if (!file_exists($pluginPath) || !is_dir($pluginPath))
{
continue;
}
// Fetch the contents of the path
$plugi... | [
"public",
"function",
"loadHeaders",
"(",
")",
"{",
"// Cycle through all pluginPaths",
"$",
"this",
"->",
"headers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"pluginPaths",
"as",
"$",
"pluginPath",
")",
"{",
"// If directory does not exis... | Load the header files of all plugins. | [
"Load",
"the",
"header",
"files",
"of",
"all",
"plugins",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Plugins.php#L103-L152 |
192,469 | FuzeWorks/Core | src/FuzeWorks/Plugins.php | Plugins.removePluginPath | public function removePluginPath($directory)
{
if (($key = array_search($directory, $this->pluginPaths)) !== false)
{
unset($this->pluginPaths[$key]);
}
} | php | public function removePluginPath($directory)
{
if (($key = array_search($directory, $this->pluginPaths)) !== false)
{
unset($this->pluginPaths[$key]);
}
} | [
"public",
"function",
"removePluginPath",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"(",
"$",
"key",
"=",
"array_search",
"(",
"$",
"directory",
",",
"$",
"this",
"->",
"pluginPaths",
")",
")",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"... | Remove a path where plugins can be found
@param string $directory The directory
@return void | [
"Remove",
"a",
"path",
"where",
"plugins",
"can",
"be",
"found"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Plugins.php#L271-L277 |
192,470 | pframework/p | source/P/AutoFactory.php | AutoFactory.create | static public function create(ServiceLocator $serviceLocator, $requestedClass, array $options = null)
{
if (class_exists($requestedClass)) {
$reflection = new \ReflectionClass($requestedClass);
$arguments = [];
$constructor = $reflection->getConstructor();
if... | php | static public function create(ServiceLocator $serviceLocator, $requestedClass, array $options = null)
{
if (class_exists($requestedClass)) {
$reflection = new \ReflectionClass($requestedClass);
$arguments = [];
$constructor = $reflection->getConstructor();
if... | [
"static",
"public",
"function",
"create",
"(",
"ServiceLocator",
"$",
"serviceLocator",
",",
"$",
"requestedClass",
",",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"requestedClass",
")",
")",
"{",
"$",
"reflection",
... | Attempts to create a new class based on constructor typehints and parameter names
@param ServiceLocator $serviceLocator
@param string $requestedClass
@return object
@throws \Exception | [
"Attempts",
"to",
"create",
"a",
"new",
"class",
"based",
"on",
"constructor",
"typehints",
"and",
"parameter",
"names"
] | 925e3748b4b52fe1139f25ead9e10f30ebb85b79 | https://github.com/pframework/p/blob/925e3748b4b52fe1139f25ead9e10f30ebb85b79/source/P/AutoFactory.php#L21-L70 |
192,471 | bkstg/resource-bundle | Repository/ResourceRepository.php | ResourceRepository.findAllByGroupQuery | public function findAllByGroupQuery(GroupInterface $group, bool $active = true): Query
{
$qb = $this->createQueryBuilder('r');
return $qb
->join('r.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('g', ':group'))
->andWhere($qb->expr()->eq... | php | public function findAllByGroupQuery(GroupInterface $group, bool $active = true): Query
{
$qb = $this->createQueryBuilder('r');
return $qb
->join('r.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('g', ':group'))
->andWhere($qb->expr()->eq... | [
"public",
"function",
"findAllByGroupQuery",
"(",
"GroupInterface",
"$",
"group",
",",
"bool",
"$",
"active",
"=",
"true",
")",
":",
"Query",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'r'",
")",
";",
"return",
"$",
"qb",
"->",
... | Get the query to find all resources by group.
@param GroupInterface $group The group to search in.
@param bool $active The active state to search.
@return Query | [
"Get",
"the",
"query",
"to",
"find",
"all",
"resources",
"by",
"group",
"."
] | 9d094366799a4df117a1dd747af9bb6debe14325 | https://github.com/bkstg/resource-bundle/blob/9d094366799a4df117a1dd747af9bb6debe14325/Repository/ResourceRepository.php#L28-L47 |
192,472 | spoom-php/core | src/extension/Storage/File.php | File.file | protected function file( string $namespace ): FileInterface {
$meta = $this->getNamespace( $namespace );
return $this->path->get( $namespace . '.' . $meta[ 'format' ] );
} | php | protected function file( string $namespace ): FileInterface {
$meta = $this->getNamespace( $namespace );
return $this->path->get( $namespace . '.' . $meta[ 'format' ] );
} | [
"protected",
"function",
"file",
"(",
"string",
"$",
"namespace",
")",
":",
"FileInterface",
"{",
"$",
"meta",
"=",
"$",
"this",
"->",
"getNamespace",
"(",
"$",
"namespace",
")",
";",
"return",
"$",
"this",
"->",
"path",
"->",
"get",
"(",
"$",
"namespa... | Get storage file for the given namespace
@param string $namespace
@return FileInterface
@throws \LogicException | [
"Get",
"storage",
"file",
"for",
"the",
"given",
"namespace"
] | ea7184213352fa2fad7636927a019e5798734e04 | https://github.com/spoom-php/core/blob/ea7184213352fa2fad7636927a019e5798734e04/src/extension/Storage/File.php#L123-L127 |
192,473 | pipaslot/forms | src/Forms/Controls/DatePicker.php | DatePicker.register | public static function register()
{
Container::extensionMethod('addDate', function ($container, $name, $label = NULL) {
$picker = $container[$name] = new DatePicker($label);
return $picker;
});
} | php | public static function register()
{
Container::extensionMethod('addDate', function ($container, $name, $label = NULL) {
$picker = $container[$name] = new DatePicker($label);
return $picker;
});
} | [
"public",
"static",
"function",
"register",
"(",
")",
"{",
"Container",
"::",
"extensionMethod",
"(",
"'addDate'",
",",
"function",
"(",
"$",
"container",
",",
"$",
"name",
",",
"$",
"label",
"=",
"NULL",
")",
"{",
"$",
"picker",
"=",
"$",
"container",
... | Registers this control
@return DatePicker | [
"Registers",
"this",
"control"
] | 9e1d48db512f843270fd4079ed3ff1b1729c951b | https://github.com/pipaslot/forms/blob/9e1d48db512f843270fd4079ed3ff1b1729c951b/src/Forms/Controls/DatePicker.php#L41-L47 |
192,474 | ScaraMVC/Framework | src/Scara/Utils/Benchmark.php | Benchmark.check | public function check($name)
{
if (array_key_exists($name, static::$marks)) {
return number_format((microtime(true) - static::$marks[$name]) * 1000, 2);
}
return 0.0;
} | php | public function check($name)
{
if (array_key_exists($name, static::$marks)) {
return number_format((microtime(true) - static::$marks[$name]) * 1000, 2);
}
return 0.0;
} | [
"public",
"function",
"check",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"static",
"::",
"$",
"marks",
")",
")",
"{",
"return",
"number_format",
"(",
"(",
"microtime",
"(",
"true",
")",
"-",
"static",
"::",
"$"... | Gets elapsed time in milliseconds for given benchmark.
@param string $name
@return float | [
"Gets",
"elapsed",
"time",
"in",
"milliseconds",
"for",
"given",
"benchmark",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Utils/Benchmark.php#L36-L43 |
192,475 | JoeBengalen/Assert | src/Helper.php | Helper.valueToString | public static function valueToString($value)
{
if (null === $value) {
return 'null';
}
if (true === $value) {
return 'true';
}
if (false === $value) {
return 'false';
}
if (is_array($value)) {
return 'array(' ... | php | public static function valueToString($value)
{
if (null === $value) {
return 'null';
}
if (true === $value) {
return 'true';
}
if (false === $value) {
return 'false';
}
if (is_array($value)) {
return 'array(' ... | [
"public",
"static",
"function",
"valueToString",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"'null'",
";",
"}",
"if",
"(",
"true",
"===",
"$",
"value",
")",
"{",
"return",
"'true'",
";",
"}",
"if",
"(",... | Transform a value into a user friendly string.
@param mixed $value
@return string | [
"Transform",
"a",
"value",
"into",
"a",
"user",
"friendly",
"string",
"."
] | 022b3f698d6bb94bda10a3e5f2f9f2219796c233 | https://github.com/JoeBengalen/Assert/blob/022b3f698d6bb94bda10a3e5f2f9f2219796c233/src/Helper.php#L43-L74 |
192,476 | RichardTrujilloTorres/validators | src/Validators/Types/PrimitiveType.php | PrimitiveType.checkType | public function checkType($value)
{
if (isset($this->name) && null !== $this->name) {
$fn = 'is_'.$this->name;
return $fn($value);
}
throw new \Exception('Invalid name or name not defined for primitive type.');
} | php | public function checkType($value)
{
if (isset($this->name) && null !== $this->name) {
$fn = 'is_'.$this->name;
return $fn($value);
}
throw new \Exception('Invalid name or name not defined for primitive type.');
} | [
"public",
"function",
"checkType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"name",
")",
"&&",
"null",
"!==",
"$",
"this",
"->",
"name",
")",
"{",
"$",
"fn",
"=",
"'is_'",
".",
"$",
"this",
"->",
"name",
";",
"re... | Is the value type the same of this object?
@param mixed $value The value to check
@return bool | [
"Is",
"the",
"value",
"type",
"the",
"same",
"of",
"this",
"object?"
] | e29ff479d816c3f8a931bfbefedd0642dc50ea91 | https://github.com/RichardTrujilloTorres/validators/blob/e29ff479d816c3f8a931bfbefedd0642dc50ea91/src/Validators/Types/PrimitiveType.php#L40-L49 |
192,477 | SysControllers/Admin | public/assets/global/plugins/kcfinder/lib/class_gd.php | gd.get_prop_width | public function get_prop_width($resized_height) {
$width = intval(($this->width * $resized_height) / $this->height);
if (!$width) $width = 1;
return $width;
} | php | public function get_prop_width($resized_height) {
$width = intval(($this->width * $resized_height) / $this->height);
if (!$width) $width = 1;
return $width;
} | [
"public",
"function",
"get_prop_width",
"(",
"$",
"resized_height",
")",
"{",
"$",
"width",
"=",
"intval",
"(",
"(",
"$",
"this",
"->",
"width",
"*",
"$",
"resized_height",
")",
"/",
"$",
"this",
"->",
"height",
")",
";",
"if",
"(",
"!",
"$",
"width"... | Returns calculated proportional width from the given height
@param integer $resized_height
@return integer | [
"Returns",
"calculated",
"proportional",
"width",
"from",
"the",
"given",
"height"
] | 8f1df46aca422b87f2f522fbba610dcfa0c5f7f3 | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/public/assets/global/plugins/kcfinder/lib/class_gd.php#L153-L157 |
192,478 | SysControllers/Admin | public/assets/global/plugins/kcfinder/lib/class_gd.php | gd.get_prop_height | public function get_prop_height($resized_width) {
$height = intval(($this->height * $resized_width) / $this->width);
if (!$height) $height = 1;
return $height;
} | php | public function get_prop_height($resized_width) {
$height = intval(($this->height * $resized_width) / $this->width);
if (!$height) $height = 1;
return $height;
} | [
"public",
"function",
"get_prop_height",
"(",
"$",
"resized_width",
")",
"{",
"$",
"height",
"=",
"intval",
"(",
"(",
"$",
"this",
"->",
"height",
"*",
"$",
"resized_width",
")",
"/",
"$",
"this",
"->",
"width",
")",
";",
"if",
"(",
"!",
"$",
"height... | Returns calculated proportional height from the given width
@param integer $resized_width
@return integer | [
"Returns",
"calculated",
"proportional",
"height",
"from",
"the",
"given",
"width"
] | 8f1df46aca422b87f2f522fbba610dcfa0c5f7f3 | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/public/assets/global/plugins/kcfinder/lib/class_gd.php#L163-L167 |
192,479 | SysControllers/Admin | public/assets/global/plugins/kcfinder/lib/class_gd.php | gd.resize | public function resize($width, $height) {
if (!$width) $width = 1;
if (!$height) $height = 1;
return (
(false !== ($img = new gd(array($width, $height)))) &&
$img->imagecopyresampled($this) &&
(false !== ($this->image = $img->get_image())) &&
(fals... | php | public function resize($width, $height) {
if (!$width) $width = 1;
if (!$height) $height = 1;
return (
(false !== ($img = new gd(array($width, $height)))) &&
$img->imagecopyresampled($this) &&
(false !== ($this->image = $img->get_image())) &&
(fals... | [
"public",
"function",
"resize",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"if",
"(",
"!",
"$",
"width",
")",
"$",
"width",
"=",
"1",
";",
"if",
"(",
"!",
"$",
"height",
")",
"$",
"height",
"=",
"1",
";",
"return",
"(",
"(",
"false",
"!... | Resize image. Returns TRUE on success or FALSE on failure
@param integer $width
@param integer $height
@return bool | [
"Resize",
"image",
".",
"Returns",
"TRUE",
"on",
"success",
"or",
"FALSE",
"on",
"failure"
] | 8f1df46aca422b87f2f522fbba610dcfa0c5f7f3 | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/public/assets/global/plugins/kcfinder/lib/class_gd.php#L196-L206 |
192,480 | SysControllers/Admin | public/assets/global/plugins/kcfinder/lib/class_gd.php | gd.resize_fit | public function resize_fit($width, $height) {
if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height)))
return true;
if (!$width || (($height / $width) < ($this->height / $this->width)))
$width = intval(($this->width * $height) / $this->height);
... | php | public function resize_fit($width, $height) {
if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height)))
return true;
if (!$width || (($height / $width) < ($this->height / $this->width)))
$width = intval(($this->width * $height) / $this->height);
... | [
"public",
"function",
"resize_fit",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"if",
"(",
"(",
"!",
"$",
"width",
"&&",
"!",
"$",
"height",
")",
"||",
"(",
"(",
"$",
"width",
"==",
"$",
"this",
"->",
"width",
")",
"&&",
"(",
"$",
"height"... | Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure
@param integer $width
@param integer $height
@return bool | [
"Resize",
"image",
"to",
"fit",
"in",
"given",
"resolution",
".",
"Returns",
"TRUE",
"on",
"success",
"or",
"FALSE",
"on",
"failure"
] | 8f1df46aca422b87f2f522fbba610dcfa0c5f7f3 | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/public/assets/global/plugins/kcfinder/lib/class_gd.php#L243-L253 |
192,481 | AnonymPHP/Anonym-Cookie | src/Anonym/Components/UseCookieHeaders.php | UseCookieHeaders.useCookies | public function useCookies()
{
if (!headers_sent()) {
if (count($this->getCookies())) {
foreach ($this->getCookies() as $cookie) {
header($cookie);
}
}
return $this;
} else {
throw new HeadersAlrea... | php | public function useCookies()
{
if (!headers_sent()) {
if (count($this->getCookies())) {
foreach ($this->getCookies() as $cookie) {
header($cookie);
}
}
return $this;
} else {
throw new HeadersAlrea... | [
"public",
"function",
"useCookies",
"(",
")",
"{",
"if",
"(",
"!",
"headers_sent",
"(",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getCookies",
"(",
")",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getCookies",
"(",
")",
"... | Cookie leri header olarak atar
@throws HeadersAlreadySendedException
@return $this | [
"Cookie",
"leri",
"header",
"olarak",
"atar"
] | 7e02403f76fab42355f02326c5589d3fca271e3b | https://github.com/AnonymPHP/Anonym-Cookie/blob/7e02403f76fab42355f02326c5589d3fca271e3b/src/Anonym/Components/UseCookieHeaders.php#L39-L58 |
192,482 | managlea/EntityManager | src/EntityManager/DoctrineEntityManager.php | DoctrineEntityManager.createDetachedEntity | public static function createDetachedEntity(string $objectName, array $data)
{
$detachedEntity = new $objectName;
self::updateEntityFromArray($detachedEntity, $data);
return $detachedEntity;
} | php | public static function createDetachedEntity(string $objectName, array $data)
{
$detachedEntity = new $objectName;
self::updateEntityFromArray($detachedEntity, $data);
return $detachedEntity;
} | [
"public",
"static",
"function",
"createDetachedEntity",
"(",
"string",
"$",
"objectName",
",",
"array",
"$",
"data",
")",
"{",
"$",
"detachedEntity",
"=",
"new",
"$",
"objectName",
";",
"self",
"::",
"updateEntityFromArray",
"(",
"$",
"detachedEntity",
",",
"$... | Creates new entity based on object name sets object
parameter from data
@param string $objectName
@param array $data
@return mixed | [
"Creates",
"new",
"entity",
"based",
"on",
"object",
"name",
"sets",
"object",
"parameter",
"from",
"data"
] | b5dc5d8786779ebafebaf5fa2c7d80d268417fef | https://github.com/managlea/EntityManager/blob/b5dc5d8786779ebafebaf5fa2c7d80d268417fef/src/EntityManager/DoctrineEntityManager.php#L118-L125 |
192,483 | managlea/EntityManager | src/EntityManager/DoctrineEntityManager.php | DoctrineEntityManager.updateEntityFromArray | public static function updateEntityFromArray($entity, array $data)
{
foreach ($data as $field => $value) {
$method = 'set' . self::formatStringToMethodName($field);
if (method_exists($entity, $method)) {
$entity->$method($value);
}
}
retur... | php | public static function updateEntityFromArray($entity, array $data)
{
foreach ($data as $field => $value) {
$method = 'set' . self::formatStringToMethodName($field);
if (method_exists($entity, $method)) {
$entity->$method($value);
}
}
retur... | [
"public",
"static",
"function",
"updateEntityFromArray",
"(",
"$",
"entity",
",",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"method",
"=",
"'set'",
".",
"self",
"::",
"formatStri... | Updates Entity from data calling setters based
on data keys
@param object $entity
@param array $data
@return mixed | [
"Updates",
"Entity",
"from",
"data",
"calling",
"setters",
"based",
"on",
"data",
"keys"
] | b5dc5d8786779ebafebaf5fa2c7d80d268417fef | https://github.com/managlea/EntityManager/blob/b5dc5d8786779ebafebaf5fa2c7d80d268417fef/src/EntityManager/DoctrineEntityManager.php#L134-L144 |
192,484 | managlea/EntityManager | src/EntityManager/DoctrineEntityManager.php | DoctrineEntityManager.formatStringToMethodName | public static function formatStringToMethodName(string $input) : string
{
$methodName = implode('', array_map('ucfirst', explode('_', strtolower($input))));
return $methodName;
} | php | public static function formatStringToMethodName(string $input) : string
{
$methodName = implode('', array_map('ucfirst', explode('_', strtolower($input))));
return $methodName;
} | [
"public",
"static",
"function",
"formatStringToMethodName",
"(",
"string",
"$",
"input",
")",
":",
"string",
"{",
"$",
"methodName",
"=",
"implode",
"(",
"''",
",",
"array_map",
"(",
"'ucfirst'",
",",
"explode",
"(",
"'_'",
",",
"strtolower",
"(",
"$",
"in... | Generates camel-case method names from string
@param string $input
@return string | [
"Generates",
"camel",
"-",
"case",
"method",
"names",
"from",
"string"
] | b5dc5d8786779ebafebaf5fa2c7d80d268417fef | https://github.com/managlea/EntityManager/blob/b5dc5d8786779ebafebaf5fa2c7d80d268417fef/src/EntityManager/DoctrineEntityManager.php#L151-L156 |
192,485 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php | XmlDumper.dump | public function dump(array $options = array())
{
$this->document = new \DOMDocument('1.0', 'utf-8');
$this->document->formatOutput = true;
$container = $this->document->createElementNS('http://symfony.com/schema/dic/services', 'container');
$container->setAttribute('xmlns:xsi', 'htt... | php | public function dump(array $options = array())
{
$this->document = new \DOMDocument('1.0', 'utf-8');
$this->document->formatOutput = true;
$container = $this->document->createElementNS('http://symfony.com/schema/dic/services', 'container');
$container->setAttribute('xmlns:xsi', 'htt... | [
"public",
"function",
"dump",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"document",
"=",
"new",
"\\",
"DOMDocument",
"(",
"'1.0'",
",",
"'utf-8'",
")",
";",
"$",
"this",
"->",
"document",
"->",
"formatOutput",
... | Dumps the service container as an XML string.
@return string An xml string representing of the service container | [
"Dumps",
"the",
"service",
"container",
"as",
"an",
"XML",
"string",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php#L43-L60 |
192,486 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php | XmlDumper.escape | private function escape(array $arguments)
{
$args = array();
foreach ($arguments as $k => $v) {
if (is_array($v)) {
$args[$k] = $this->escape($v);
} elseif (is_string($v)) {
$args[$k] = str_replace('%', '%%', $v);
} else {
... | php | private function escape(array $arguments)
{
$args = array();
foreach ($arguments as $k => $v) {
if (is_array($v)) {
$args[$k] = $this->escape($v);
} elseif (is_string($v)) {
$args[$k] = str_replace('%', '%%', $v);
} else {
... | [
"private",
"function",
"escape",
"(",
"array",
"$",
"arguments",
")",
"{",
"$",
"args",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"arguments",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"v",
")",
")",
"{"... | Escapes arguments.
@return array | [
"Escapes",
"arguments",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php#L324-L338 |
192,487 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php | XmlDumper.phpToXml | public static function phpToXml($value)
{
switch (true) {
case null === $value:
return 'null';
case true === $value:
return 'true';
case false === $value:
return 'false';
case $value instanceof Parameter:
... | php | public static function phpToXml($value)
{
switch (true) {
case null === $value:
return 'null';
case true === $value:
return 'true';
case false === $value:
return 'false';
case $value instanceof Parameter:
... | [
"public",
"static",
"function",
"phpToXml",
"(",
"$",
"value",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"null",
"===",
"$",
"value",
":",
"return",
"'null'",
";",
"case",
"true",
"===",
"$",
"value",
":",
"return",
"'true'",
";",
"case",
"f... | Converts php types to xml types.
@param mixed $value Value to convert
@return string
@throws RuntimeException When trying to dump object or resource | [
"Converts",
"php",
"types",
"to",
"xml",
"types",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php#L349-L365 |
192,488 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/ReferencePrimer.php | ReferencePrimer.primeReferences | public function primeReferences(ClassMetadata $class, $documents, $attributeName, $refresh, $readOnly, $primer = null)
{
$data = $this->parseDotSyntaxForPrimer($attributeName, $class, $documents);
$mapping = $data['mapping'];
$attributeName = $data['attributeName'];
$c... | php | public function primeReferences(ClassMetadata $class, $documents, $attributeName, $refresh, $readOnly, $primer = null)
{
$data = $this->parseDotSyntaxForPrimer($attributeName, $class, $documents);
$mapping = $data['mapping'];
$attributeName = $data['attributeName'];
$c... | [
"public",
"function",
"primeReferences",
"(",
"ClassMetadata",
"$",
"class",
",",
"$",
"documents",
",",
"$",
"attributeName",
",",
"$",
"refresh",
",",
"$",
"readOnly",
",",
"$",
"primer",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"p... | Prime references within a mapped attribute of one or more documents.
If a $primer callable is provided, it should have the same signature as
the default primer defined in the constructor. If $primer is not
callable, the default primer will be used.
@param ClassMetadata $class Class metadata for the docum... | [
"Prime",
"references",
"within",
"a",
"mapped",
"attribute",
"of",
"one",
"or",
"more",
"documents",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/ReferencePrimer.php#L195-L242 |
192,489 | Innmind/Math | src/Geometry/Angle.php | Angle.sum | public function sum(): Segment
{
return AlKashi::side(
$this->firstSegment,
$this->degree,
$this->secondSegment
);
} | php | public function sum(): Segment
{
return AlKashi::side(
$this->firstSegment,
$this->degree,
$this->secondSegment
);
} | [
"public",
"function",
"sum",
"(",
")",
":",
"Segment",
"{",
"return",
"AlKashi",
"::",
"side",
"(",
"$",
"this",
"->",
"firstSegment",
",",
"$",
"this",
"->",
"degree",
",",
"$",
"this",
"->",
"secondSegment",
")",
";",
"}"
] | It sums the segments like we would sum vectors, except here we don't use
vectors as it would need a plan to express a direction | [
"It",
"sums",
"the",
"segments",
"like",
"we",
"would",
"sum",
"vectors",
"except",
"here",
"we",
"don",
"t",
"use",
"vectors",
"as",
"it",
"would",
"need",
"a",
"plan",
"to",
"express",
"a",
"direction"
] | ac9ad4dd1852c145e90f5edc0f38a873b125a50b | https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Geometry/Angle.php#L51-L58 |
192,490 | Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Loader/Bridge/Form/DataTransformerLoaderTrait.php | DataTransformerLoaderTrait.transform | public function transform($entity)
{
if (null === $entity) {
return '';
}
if (!is_subclass_of($entity, $this->entityClass)) {
throw new \InvalidArgumentException(sprintf(
'Unsupported entity "%s" into "%s" loader.',
get_class($entity),
... | php | public function transform($entity)
{
if (null === $entity) {
return '';
}
if (!is_subclass_of($entity, $this->entityClass)) {
throw new \InvalidArgumentException(sprintf(
'Unsupported entity "%s" into "%s" loader.',
get_class($entity),
... | [
"public",
"function",
"transform",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"entity",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"!",
"is_subclass_of",
"(",
"$",
"entity",
",",
"$",
"this",
"->",
"entityClass",
")",
")",
"{"... | Model -> View
@see DataTransformerInterface::transform() | [
"Model",
"-",
">",
"View"
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/Bridge/Form/DataTransformerLoaderTrait.php#L22-L36 |
192,491 | Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Loader/Bridge/Form/DataTransformerLoaderTrait.php | DataTransformerLoaderTrait.reverseTransform | public function reverseTransform($id)
{
if (!$id) {
return null;
}
if (!$entity = $this->retrieve($id)) {
throw new TransformationFailedException(sprintf(
'%s#%s cannot be found.',
$this->entityClass,
$id
));... | php | public function reverseTransform($id)
{
if (!$id) {
return null;
}
if (!$entity = $this->retrieve($id)) {
throw new TransformationFailedException(sprintf(
'%s#%s cannot be found.',
$this->entityClass,
$id
));... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"$",
"entity",
"=",
"$",
"this",
"->",
"retrieve",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new... | View -> Model
@see DataTransformerInterface::reverseTransform() | [
"View",
"-",
">",
"Model"
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Loader/Bridge/Form/DataTransformerLoaderTrait.php#L43-L57 |
192,492 | praxigento/mobi_mod_downline | Cli/Tree/Clean.php | Clean.execute | protected function execute(
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
) {
/* bind $output context to log-methods. */
$this->setOut($output);
$this->logInfo("Command '" . $this->getName() . "' is started."... | php | protected function execute(
\Symfony\Component\Console\Input\InputInterface $input,
\Symfony\Component\Console\Output\OutputInterface $output
) {
/* bind $output context to log-methods. */
$this->setOut($output);
$this->logInfo("Command '" . $this->getName() . "' is started."... | [
"protected",
"function",
"execute",
"(",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Input",
"\\",
"InputInterface",
"$",
"input",
",",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Console",
"\\",
"Output",
"\\",
"OutputInterface",
"$",
"output",... | Override 'execute' method to prevent "DDL statements are not allowed in transactions" error.
@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int|void|null | [
"Override",
"execute",
"method",
"to",
"prevent",
"DDL",
"statements",
"are",
"not",
"allowed",
"in",
"transactions",
"error",
"."
] | 0f3c276dfff1aa029f9fd205ccfc56f207a2e75b | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Cli/Tree/Clean.php#L37-L52 |
192,493 | ekyna/Table | Context/ActiveFilter.php | ActiveFilter.toArray | public function toArray()
{
return [
$this->id,
$this->filterName,
$this->operator,
serialize($this->value),
];
} | php | public function toArray()
{
return [
$this->id,
$this->filterName,
$this->operator,
serialize($this->value),
];
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"[",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"filterName",
",",
"$",
"this",
"->",
"operator",
",",
"serialize",
"(",
"$",
"this",
"->",
"value",
")",
",",
"]",
";",
"}"
] | Returns the array representation of the active filter.
@return array | [
"Returns",
"the",
"array",
"representation",
"of",
"the",
"active",
"filter",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Context/ActiveFilter.php#L113-L121 |
192,494 | ekyna/Table | Context/ActiveFilter.php | ActiveFilter.createFromArray | static public function createFromArray(array $data)
{
if (4 != count($data)) {
throw new InvalidArgumentException("Expected data as a 4 length array.");
}
$filter = new static($data[0], $data[1]);
$filter->setOperator($data[2]);
$filter->setValue(unserialize($dat... | php | static public function createFromArray(array $data)
{
if (4 != count($data)) {
throw new InvalidArgumentException("Expected data as a 4 length array.");
}
$filter = new static($data[0], $data[1]);
$filter->setOperator($data[2]);
$filter->setValue(unserialize($dat... | [
"static",
"public",
"function",
"createFromArray",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"4",
"!=",
"count",
"(",
"$",
"data",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Expected data as a 4 length array.\"",
")",
";",
"}",
... | Creates the active filter from the given data array.
@param array $data
@return ActiveFilter | [
"Creates",
"the",
"active",
"filter",
"from",
"the",
"given",
"data",
"array",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Context/ActiveFilter.php#L130-L141 |
192,495 | mtils/file-db | src/FileDB/Model/DummyRepository.php | DummyRepository.getFromPath | public function getFromPath($path, $depth=0, $withParents=false)
{
if(isset($this->fs[$path])){
return $this->fs[$path];
}
} | php | public function getFromPath($path, $depth=0, $withParents=false)
{
if(isset($this->fs[$path])){
return $this->fs[$path];
}
} | [
"public",
"function",
"getFromPath",
"(",
"$",
"path",
",",
"$",
"depth",
"=",
"0",
",",
"$",
"withParents",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fs",
"[",
"$",
"path",
"]",
")",
")",
"{",
"return",
"$",
"this",
... | Get a file object by the given path
@param string $path
@return \FileDB\Contracts\Model\File | [
"Get",
"a",
"file",
"object",
"by",
"the",
"given",
"path"
] | 270ebc26b0fa3d2c996ca8861507fa63d2db6814 | https://github.com/mtils/file-db/blob/270ebc26b0fa3d2c996ca8861507fa63d2db6814/src/FileDB/Model/DummyRepository.php#L80-L87 |
192,496 | mtils/file-db | src/FileDB/Model/DummyRepository.php | DummyRepository.getById | public function getById($id, $depth=0, $withParents=false)
{
foreach($this->fs as $file){
if($file->getId() == $id){
return $file;
}
}
} | php | public function getById($id, $depth=0, $withParents=false)
{
foreach($this->fs as $file){
if($file->getId() == $id){
return $file;
}
}
} | [
"public",
"function",
"getById",
"(",
"$",
"id",
",",
"$",
"depth",
"=",
"0",
",",
"$",
"withParents",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fs",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"->",
"getId",
"(",
")"... | Get a file by its unique id. In normal filesystems its unique
id is the path. In Database driven filesystems its easier to
work with primary keys etc.
@param mixed $id
@param int $depth
@return \FileDB\Contracts\Model\File | [
"Get",
"a",
"file",
"by",
"its",
"unique",
"id",
".",
"In",
"normal",
"filesystems",
"its",
"unique",
"id",
"is",
"the",
"path",
".",
"In",
"Database",
"driven",
"filesystems",
"its",
"easier",
"to",
"work",
"with",
"primary",
"keys",
"etc",
"."
] | 270ebc26b0fa3d2c996ca8861507fa63d2db6814 | https://github.com/mtils/file-db/blob/270ebc26b0fa3d2c996ca8861507fa63d2db6814/src/FileDB/Model/DummyRepository.php#L98-L107 |
192,497 | mtils/file-db | src/FileDB/Model/DummyRepository.php | DummyRepository.getByHash | public function getByHash($hash)
{
foreach($this->fs as $file){
if($file->getHash() == $hash){
return $file;
}
}
} | php | public function getByHash($hash)
{
foreach($this->fs as $file){
if($file->getHash() == $hash){
return $file;
}
}
} | [
"public",
"function",
"getByHash",
"(",
"$",
"hash",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fs",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"->",
"getHash",
"(",
")",
"==",
"$",
"hash",
")",
"{",
"return",
"$",
"file",
";",
"}"... | Get a file by its hash
@param string $hash
@return \FileDB\Contracts\Model\File | [
"Get",
"a",
"file",
"by",
"its",
"hash"
] | 270ebc26b0fa3d2c996ca8861507fa63d2db6814 | https://github.com/mtils/file-db/blob/270ebc26b0fa3d2c996ca8861507fa63d2db6814/src/FileDB/Model/DummyRepository.php#L115-L124 |
192,498 | mtils/file-db | src/FileDB/Model/DummyRepository.php | DummyRepository.delete | public function delete(FileInterface $file)
{
if(isset($this->fs[$file->getPath()])){
unset($this->fs[$file->getPath()]);
}
if($dir = $file->getDir()){
$dir->removeChild($file);
}
return $this;
} | php | public function delete(FileInterface $file)
{
if(isset($this->fs[$file->getPath()])){
unset($this->fs[$file->getPath()]);
}
if($dir = $file->getDir()){
$dir->removeChild($file);
}
return $this;
} | [
"public",
"function",
"delete",
"(",
"FileInterface",
"$",
"file",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fs",
"[",
"$",
"file",
"->",
"getPath",
"(",
")",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"fs",
"[",
"$",
"fi... | Delete the file. If it is a directory recursively delete it
@param \FileDB\Contracts\Model\File $file
@return self | [
"Delete",
"the",
"file",
".",
"If",
"it",
"is",
"a",
"directory",
"recursively",
"delete",
"it"
] | 270ebc26b0fa3d2c996ca8861507fa63d2db6814 | https://github.com/mtils/file-db/blob/270ebc26b0fa3d2c996ca8861507fa63d2db6814/src/FileDB/Model/DummyRepository.php#L172-L183 |
192,499 | praxigento/mobi_mod_downline | Plugin/Magento/Customer/Model/ResourceModel/CustomerRepository.php | CustomerRepository.beforeDeleteById | public function beforeDeleteById(
\Magento\Customer\Api\CustomerRepositoryInterface $subject,
$customerId
) {
$this->deleteSnaps($customerId);
$this->deleteChange($customerId);
$result = [$customerId];
return $result;
} | php | public function beforeDeleteById(
\Magento\Customer\Api\CustomerRepositoryInterface $subject,
$customerId
) {
$this->deleteSnaps($customerId);
$this->deleteChange($customerId);
$result = [$customerId];
return $result;
} | [
"public",
"function",
"beforeDeleteById",
"(",
"\\",
"Magento",
"\\",
"Customer",
"\\",
"Api",
"\\",
"CustomerRepositoryInterface",
"$",
"subject",
",",
"$",
"customerId",
")",
"{",
"$",
"this",
"->",
"deleteSnaps",
"(",
"$",
"customerId",
")",
";",
"$",
"th... | Remove customer related data from Downline on customer delete from adminhtml.
@param \Magento\Customer\Api\CustomerRepositoryInterface $subject
@param $customerId
@return array | [
"Remove",
"customer",
"related",
"data",
"from",
"Downline",
"on",
"customer",
"delete",
"from",
"adminhtml",
"."
] | 0f3c276dfff1aa029f9fd205ccfc56f207a2e75b | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Plugin/Magento/Customer/Model/ResourceModel/CustomerRepository.php#L37-L45 |
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.