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
sequence | docstring
stringlengths 3
47.2k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 91
247
|
---|---|---|---|---|---|---|---|---|---|---|---|
4,000 | oschildt/SmartFactory | src/SmartFactory/SessionManager.php | SessionManager.& | public function &vars()
{
if (empty($_SESSION[$this->getContext()])) {
$_SESSION[$this->getContext()] = [];
}
return $_SESSION[$this->getContext()];
} | php | public function &vars()
{
if (empty($_SESSION[$this->getContext()])) {
$_SESSION[$this->getContext()] = [];
}
return $_SESSION[$this->getContext()];
} | [
"public",
"function",
"&",
"vars",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"getContext",
"(",
")",
"]",
")",
")",
"{",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"getContext",
"(",
")",
"]",
"=",
"[",
"]",
";",
"}",
"return",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"getContext",
"(",
")",
"]",
";",
"}"
] | Returns the reference to the array of the session variables.
@return array
Returns the reference to the array of the session variables.
The reason of this interacfe is to wrap the standard session
handling to be able to flexibly change the implementation without
any change in the code where it is used.
Thus, we cannot use $_SESSION directly, a new implementation
might not use it at all. But we need a comfort way to set and
get the session variables including the multidimesional arrays.
Operator overloading through ArrayAccess interface supports
only one dimensional arrays, thus, it is not applicable for us.
We return the reference to the internal data. It allows setting
multidimesional arrays as follows:
```php
$smanager->vars()["user"]["name"] = "Alex";
$smanager->vars()["user"]["age"] = "22";
```
@author Oleg Schildt | [
"Returns",
"the",
"reference",
"to",
"the",
"array",
"of",
"the",
"session",
"variables",
"."
] | efd289961a720d5f3103a3c696e2beee16e9644d | https://github.com/oschildt/SmartFactory/blob/efd289961a720d5f3103a3c696e2beee16e9644d/src/SmartFactory/SessionManager.php#L483-L490 |
4,001 | VincentChalnot/SidusEAVDataGridBundle | DependencyInjection/SidusEAVDataGridExtension.php | SidusEAVDataGridExtension.addDataGridServiceDefinition | protected function addDataGridServiceDefinition($code, array $dataGridConfiguration, ContainerBuilder $container)
{
$dataGridConfiguration = $this->finalizeConfiguration($code, $dataGridConfiguration, $container);
$definition = new Definition(
new Parameter('sidus_eav_data_grid.model.datagrid.class'),
[
$code,
$dataGridConfiguration,
new Reference('translator'),
]
);
$definition->addTag('sidus.datagrid');
$definition->setPublic(false);
$container->setDefinition('sidus_eav_data_grid.datagrid.'.$code, $definition);
} | php | protected function addDataGridServiceDefinition($code, array $dataGridConfiguration, ContainerBuilder $container)
{
$dataGridConfiguration = $this->finalizeConfiguration($code, $dataGridConfiguration, $container);
$definition = new Definition(
new Parameter('sidus_eav_data_grid.model.datagrid.class'),
[
$code,
$dataGridConfiguration,
new Reference('translator'),
]
);
$definition->addTag('sidus.datagrid');
$definition->setPublic(false);
$container->setDefinition('sidus_eav_data_grid.datagrid.'.$code, $definition);
} | [
"protected",
"function",
"addDataGridServiceDefinition",
"(",
"$",
"code",
",",
"array",
"$",
"dataGridConfiguration",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"dataGridConfiguration",
"=",
"$",
"this",
"->",
"finalizeConfiguration",
"(",
"$",
"code",
",",
"$",
"dataGridConfiguration",
",",
"$",
"container",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"new",
"Parameter",
"(",
"'sidus_eav_data_grid.model.datagrid.class'",
")",
",",
"[",
"$",
"code",
",",
"$",
"dataGridConfiguration",
",",
"new",
"Reference",
"(",
"'translator'",
")",
",",
"]",
")",
";",
"$",
"definition",
"->",
"addTag",
"(",
"'sidus.datagrid'",
")",
";",
"$",
"definition",
"->",
"setPublic",
"(",
"false",
")",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"'sidus_eav_data_grid.datagrid.'",
".",
"$",
"code",
",",
"$",
"definition",
")",
";",
"}"
] | Add a new Filter service based on the configuration passed inside the datagrid
@param string $code
@param array $dataGridConfiguration
@param ContainerBuilder $container
@throws BadMethodCallException
@throws UnexpectedValueException
@throws InvalidArgumentException | [
"Add",
"a",
"new",
"Filter",
"service",
"based",
"on",
"the",
"configuration",
"passed",
"inside",
"the",
"datagrid"
] | 73c481cb0e3ad435582904c2c219748b70bbec08 | https://github.com/VincentChalnot/SidusEAVDataGridBundle/blob/73c481cb0e3ad435582904c2c219748b70bbec08/DependencyInjection/SidusEAVDataGridExtension.php#L50-L65 |
4,002 | VincentChalnot/SidusEAVDataGridBundle | DependencyInjection/SidusEAVDataGridExtension.php | SidusEAVDataGridExtension.addFilterConfiguration | protected function addFilterConfiguration($code, array $dataGridConfiguration, ContainerBuilder $container)
{
$dataGridConfiguration['filter_config']['family'] = $dataGridConfiguration['family'];
$filterConfig = $this->finalizeFilterConfiguration($code, $dataGridConfiguration['filter_config']);
$definition = new Definition(
new Parameter('sidus_eav_filter.configuration.class'),
[
$code,
new Reference('doctrine'),
new Reference('sidus_filter.filter.factory'),
$filterConfig,
new Reference('sidus_eav_model.family.registry'),
]
);
$definition->setPublic(false);
$serviceId = 'sidus_eav_filter.datagrid.configuration.'.$code;
$container->setDefinition($serviceId, $definition);
return new Reference($serviceId);
} | php | protected function addFilterConfiguration($code, array $dataGridConfiguration, ContainerBuilder $container)
{
$dataGridConfiguration['filter_config']['family'] = $dataGridConfiguration['family'];
$filterConfig = $this->finalizeFilterConfiguration($code, $dataGridConfiguration['filter_config']);
$definition = new Definition(
new Parameter('sidus_eav_filter.configuration.class'),
[
$code,
new Reference('doctrine'),
new Reference('sidus_filter.filter.factory'),
$filterConfig,
new Reference('sidus_eav_model.family.registry'),
]
);
$definition->setPublic(false);
$serviceId = 'sidus_eav_filter.datagrid.configuration.'.$code;
$container->setDefinition($serviceId, $definition);
return new Reference($serviceId);
} | [
"protected",
"function",
"addFilterConfiguration",
"(",
"$",
"code",
",",
"array",
"$",
"dataGridConfiguration",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"dataGridConfiguration",
"[",
"'filter_config'",
"]",
"[",
"'family'",
"]",
"=",
"$",
"dataGridConfiguration",
"[",
"'family'",
"]",
";",
"$",
"filterConfig",
"=",
"$",
"this",
"->",
"finalizeFilterConfiguration",
"(",
"$",
"code",
",",
"$",
"dataGridConfiguration",
"[",
"'filter_config'",
"]",
")",
";",
"$",
"definition",
"=",
"new",
"Definition",
"(",
"new",
"Parameter",
"(",
"'sidus_eav_filter.configuration.class'",
")",
",",
"[",
"$",
"code",
",",
"new",
"Reference",
"(",
"'doctrine'",
")",
",",
"new",
"Reference",
"(",
"'sidus_filter.filter.factory'",
")",
",",
"$",
"filterConfig",
",",
"new",
"Reference",
"(",
"'sidus_eav_model.family.registry'",
")",
",",
"]",
")",
";",
"$",
"definition",
"->",
"setPublic",
"(",
"false",
")",
";",
"$",
"serviceId",
"=",
"'sidus_eav_filter.datagrid.configuration.'",
".",
"$",
"code",
";",
"$",
"container",
"->",
"setDefinition",
"(",
"$",
"serviceId",
",",
"$",
"definition",
")",
";",
"return",
"new",
"Reference",
"(",
"$",
"serviceId",
")",
";",
"}"
] | Handle direct configuration of filters, uses the same logic than the FilterBundle to generate a service
@param $code
@param array $dataGridConfiguration
@param ContainerBuilder $container
@return Reference
@throws BadMethodCallException | [
"Handle",
"direct",
"configuration",
"of",
"filters",
"uses",
"the",
"same",
"logic",
"than",
"the",
"FilterBundle",
"to",
"generate",
"a",
"service"
] | 73c481cb0e3ad435582904c2c219748b70bbec08 | https://github.com/VincentChalnot/SidusEAVDataGridBundle/blob/73c481cb0e3ad435582904c2c219748b70bbec08/DependencyInjection/SidusEAVDataGridExtension.php#L77-L98 |
4,003 | uPaid/contextual-keys | src/ContextualKeysTrait.php | ContextualKeysTrait.generateFullKey | public function generateFullKey(string $key = ''): string
{
if (!$this->context || !$this->identifier) {
throw new \InvalidArgumentException('You have to run setContext and setIdentifier methods first');
}
return implode('_', [
static::class,
$this->context,
$this->identifier,
$key,
]);
} | php | public function generateFullKey(string $key = ''): string
{
if (!$this->context || !$this->identifier) {
throw new \InvalidArgumentException('You have to run setContext and setIdentifier methods first');
}
return implode('_', [
static::class,
$this->context,
$this->identifier,
$key,
]);
} | [
"public",
"function",
"generateFullKey",
"(",
"string",
"$",
"key",
"=",
"''",
")",
":",
"string",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"context",
"||",
"!",
"$",
"this",
"->",
"identifier",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'You have to run setContext and setIdentifier methods first'",
")",
";",
"}",
"return",
"implode",
"(",
"'_'",
",",
"[",
"static",
"::",
"class",
",",
"$",
"this",
"->",
"context",
",",
"$",
"this",
"->",
"identifier",
",",
"$",
"key",
",",
"]",
")",
";",
"}"
] | all examples below are in context of storage keys
generate a full contextual key consisting of:
- caller class name (so in theory the same storage object must read and write this value)
- context (for example PROFILE_EMAIL_CHANGE or PASSWORD_RESET)
- identifier (usually phone number of a given user)
- key (any additional information)
@param string $key
@return string | [
"all",
"examples",
"below",
"are",
"in",
"context",
"of",
"storage",
"keys"
] | ea94361f424876873bd9dcfa9e1caa2d810d1770 | https://github.com/uPaid/contextual-keys/blob/ea94361f424876873bd9dcfa9e1caa2d810d1770/src/ContextualKeysTrait.php#L34-L46 |
4,004 | joffreydemetz/database | src/Table/DataObject.php | DataObject.all | public function all($object=true)
{
$properties = get_object_vars($this);
if ( $object ){
return (object)$properties;
}
return $properties;
} | php | public function all($object=true)
{
$properties = get_object_vars($this);
if ( $object ){
return (object)$properties;
}
return $properties;
} | [
"public",
"function",
"all",
"(",
"$",
"object",
"=",
"true",
")",
"{",
"$",
"properties",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"if",
"(",
"$",
"object",
")",
"{",
"return",
"(",
"object",
")",
"$",
"properties",
";",
"}",
"return",
"$",
"properties",
";",
"}"
] | Returns an associative array of the object properties
@param bool $object True to return a stdClass
@return array|\stdClass | [
"Returns",
"an",
"associative",
"array",
"of",
"the",
"object",
"properties"
] | 627ef404914c06427159322da50700c1f2610a13 | https://github.com/joffreydemetz/database/blob/627ef404914c06427159322da50700c1f2610a13/src/Table/DataObject.php#L35-L44 |
4,005 | DavidFricker/DataAbstracter | example/Provider/AppContentProvider.php | AppContentProvider.validateWhereClause | private function validateWhereClause($table, $where) {
foreach ($where as $column => $value) {
if (!$this->isInputValid($table, $column, $value)) {
return false;
}
}
return true;
} | php | private function validateWhereClause($table, $where) {
foreach ($where as $column => $value) {
if (!$this->isInputValid($table, $column, $value)) {
return false;
}
}
return true;
} | [
"private",
"function",
"validateWhereClause",
"(",
"$",
"table",
",",
"$",
"where",
")",
"{",
"foreach",
"(",
"$",
"where",
"as",
"$",
"column",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isInputValid",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Validate WHERE binding for SQL statement
Checks the type of supplied values for each column against the content contract
@param string $table table name, used to fetch the content contract
@param array $where [description]
@return boolean true if where clause is valid | [
"Validate",
"WHERE",
"binding",
"for",
"SQL",
"statement"
] | d612910cb114ddceb9f4ab1d152d5eb8019e5342 | https://github.com/DavidFricker/DataAbstracter/blob/d612910cb114ddceb9f4ab1d152d5eb8019e5342/example/Provider/AppContentProvider.php#L210-L218 |
4,006 | DavidFricker/DataAbstracter | example/Provider/AppContentProvider.php | AppContentProvider.isValidInput | public function isValidInput ($table, $column, $value) {
$table_object = $this->ContentContract->tables[$table];
$column_type_validator = $table_object::SCHEMA[$column];
return $this->ContentContract->validators[$column_type_validator]($value);
} | php | public function isValidInput ($table, $column, $value) {
$table_object = $this->ContentContract->tables[$table];
$column_type_validator = $table_object::SCHEMA[$column];
return $this->ContentContract->validators[$column_type_validator]($value);
} | [
"public",
"function",
"isValidInput",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"value",
")",
"{",
"$",
"table_object",
"=",
"$",
"this",
"->",
"ContentContract",
"->",
"tables",
"[",
"$",
"table",
"]",
";",
"$",
"column_type_validator",
"=",
"$",
"table_object",
"::",
"SCHEMA",
"[",
"$",
"column",
"]",
";",
"return",
"$",
"this",
"->",
"ContentContract",
"->",
"validators",
"[",
"$",
"column_type_validator",
"]",
"(",
"$",
"value",
")",
";",
"}"
] | Check value against given filter
Checks the type of the supplied value against the validate method supplied in the content contract for the table
@param string $table table name, used to fetch the content contract
@param [type] $column [description]
@param [type] $value [description]
@return boolean true if input is valid for the given column | [
"Check",
"value",
"against",
"given",
"filter"
] | d612910cb114ddceb9f4ab1d152d5eb8019e5342 | https://github.com/DavidFricker/DataAbstracter/blob/d612910cb114ddceb9f4ab1d152d5eb8019e5342/example/Provider/AppContentProvider.php#L230-L235 |
4,007 | DavidFricker/DataAbstracter | example/Provider/AppContentProvider.php | AppContentProvider.isValidColumn | public function isValidColumn ($table, $column) {
$table_object = ($this->ContentContract->tables[$table]);
$schema = $table_object::SCHEMA;
return isset($schema[$column]);
} | php | public function isValidColumn ($table, $column) {
$table_object = ($this->ContentContract->tables[$table]);
$schema = $table_object::SCHEMA;
return isset($schema[$column]);
} | [
"public",
"function",
"isValidColumn",
"(",
"$",
"table",
",",
"$",
"column",
")",
"{",
"$",
"table_object",
"=",
"(",
"$",
"this",
"->",
"ContentContract",
"->",
"tables",
"[",
"$",
"table",
"]",
")",
";",
"$",
"schema",
"=",
"$",
"table_object",
"::",
"SCHEMA",
";",
"return",
"isset",
"(",
"$",
"schema",
"[",
"$",
"column",
"]",
")",
";",
"}"
] | Checks a column exists in a given table
Uses the specific table content contract to check for the columns existence
Assumes a isValidTable() call with be made prior so it may skip it and save many redundant if statements
@param string $table table name, used to fetch the content contract
@param [type] $column [description]
@return boolean true if the column is found in the table contract | [
"Checks",
"a",
"column",
"exists",
"in",
"a",
"given",
"table"
] | d612910cb114ddceb9f4ab1d152d5eb8019e5342 | https://github.com/DavidFricker/DataAbstracter/blob/d612910cb114ddceb9f4ab1d152d5eb8019e5342/example/Provider/AppContentProvider.php#L259-L263 |
4,008 | DavidFricker/DataAbstracter | example/Provider/AppContentProvider.php | AppContentProvider.validateTableAndCol | private function validateTableAndCol ($table, $columns) {
if (!$this->isValidTable($table)) {
return false;
}
foreach ($columns as $column) {
if (!$this->isValidColumn($table, $column)) {
return false;
}
}
return true;
} | php | private function validateTableAndCol ($table, $columns) {
if (!$this->isValidTable($table)) {
return false;
}
foreach ($columns as $column) {
if (!$this->isValidColumn($table, $column)) {
return false;
}
}
return true;
} | [
"private",
"function",
"validateTableAndCol",
"(",
"$",
"table",
",",
"$",
"columns",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidTable",
"(",
"$",
"table",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidColumn",
"(",
"$",
"table",
",",
"$",
"column",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Wrapper function to validate a table and columns
@param string $table table name, used to fetch the content contract
@param array $columns [description]
@return boolean true if the table and column names are correct | [
"Wrapper",
"function",
"to",
"validate",
"a",
"table",
"and",
"columns"
] | d612910cb114ddceb9f4ab1d152d5eb8019e5342 | https://github.com/DavidFricker/DataAbstracter/blob/d612910cb114ddceb9f4ab1d152d5eb8019e5342/example/Provider/AppContentProvider.php#L272-L284 |
4,009 | DavidFricker/DataAbstracter | example/Provider/AppContentProvider.php | AppContentProvider.validateBind | private function validateBind($table, $data) {
foreach ($data as $column => $value) {
if (!$this->isValidInput($table, $column, $value)) {
return false;
}
}
return true;
} | php | private function validateBind($table, $data) {
foreach ($data as $column => $value) {
if (!$this->isValidInput($table, $column, $value)) {
return false;
}
}
return true;
} | [
"private",
"function",
"validateBind",
"(",
"$",
"table",
",",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"column",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidInput",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Validate a set of columns and values
Wraps isValidInput to check an array of column and values against the table content contracts
@param string $table table name, used to fetch the content contract
@param array $data [description]
@return boolean true if the input values in $data are valid for their given columns | [
"Validate",
"a",
"set",
"of",
"columns",
"and",
"values"
] | d612910cb114ddceb9f4ab1d152d5eb8019e5342 | https://github.com/DavidFricker/DataAbstracter/blob/d612910cb114ddceb9f4ab1d152d5eb8019e5342/example/Provider/AppContentProvider.php#L295-L303 |
4,010 | InnoGr/FivePercent-Api | src/Server/Exception/ServerNotFoundException.php | ServerNotFoundException.create | public static function create($key, $code = 0, \Exception $prev = null)
{
$message = sprintf(
'Not found server with key "%s".',
$key
);
return new static($message, $code, $prev);
} | php | public static function create($key, $code = 0, \Exception $prev = null)
{
$message = sprintf(
'Not found server with key "%s".',
$key
);
return new static($message, $code, $prev);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"key",
",",
"$",
"code",
"=",
"0",
",",
"\\",
"Exception",
"$",
"prev",
"=",
"null",
")",
"{",
"$",
"message",
"=",
"sprintf",
"(",
"'Not found server with key \"%s\".'",
",",
"$",
"key",
")",
";",
"return",
"new",
"static",
"(",
"$",
"message",
",",
"$",
"code",
",",
"$",
"prev",
")",
";",
"}"
] | Create new exception instance with key
@param string $key
@param int $code
@param \Exception $prev
@return ServerNotFoundException | [
"Create",
"new",
"exception",
"instance",
"with",
"key"
] | 57b78ddc3c9d91a7139c276711e5792824ceab9c | https://github.com/InnoGr/FivePercent-Api/blob/57b78ddc3c9d91a7139c276711e5792824ceab9c/src/Server/Exception/ServerNotFoundException.php#L30-L38 |
4,011 | stevenberg/responsible-images-php | src/Image.php | Image.source | public function source(Size $size): string
{
return $this->maker()->make($this->name, $this->options($size));
} | php | public function source(Size $size): string
{
return $this->maker()->make($this->name, $this->options($size));
} | [
"public",
"function",
"source",
"(",
"Size",
"$",
"size",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"maker",
"(",
")",
"->",
"make",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"options",
"(",
"$",
"size",
")",
")",
";",
"}"
] | Return the URL for the image resized to the given width. | [
"Return",
"the",
"URL",
"for",
"the",
"image",
"resized",
"to",
"the",
"given",
"width",
"."
] | a890fc2b3d011c660161aae0e18709dadf00e43f | https://github.com/stevenberg/responsible-images-php/blob/a890fc2b3d011c660161aae0e18709dadf00e43f/src/Image.php#L54-L57 |
4,012 | stevenberg/responsible-images-php | src/Image.php | Image.sourceSet | public function sourceSet(SizeRange $range): string
{
return $range->toVector()
->map(function ($size) {
return $this->source($size) . " {$size}w";
})
->join(', ');
} | php | public function sourceSet(SizeRange $range): string
{
return $range->toVector()
->map(function ($size) {
return $this->source($size) . " {$size}w";
})
->join(', ');
} | [
"public",
"function",
"sourceSet",
"(",
"SizeRange",
"$",
"range",
")",
":",
"string",
"{",
"return",
"$",
"range",
"->",
"toVector",
"(",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"size",
")",
"{",
"return",
"$",
"this",
"->",
"source",
"(",
"$",
"size",
")",
".",
"\" {$size}w\"",
";",
"}",
")",
"->",
"join",
"(",
"', '",
")",
";",
"}"
] | Return the contents of a srcset attribute for the given range of widths. | [
"Return",
"the",
"contents",
"of",
"a",
"srcset",
"attribute",
"for",
"the",
"given",
"range",
"of",
"widths",
"."
] | a890fc2b3d011c660161aae0e18709dadf00e43f | https://github.com/stevenberg/responsible-images-php/blob/a890fc2b3d011c660161aae0e18709dadf00e43f/src/Image.php#L62-L69 |
4,013 | stevenberg/responsible-images-php | src/Image.php | Image.tag | public function tag(SizeRange $range, Size $defaultSize, array $attributes = []): string
{
$attributes = new Map($attributes);
$attributes['alt'] = $attributes['alt'] ?? '';
$attributes['sizes'] = $attributes['sizes'] ?? '100vw';
$attributes['src'] = $this->source($defaultSize);
$attributes['srcset'] = $this->sourceSet($range);
$attributeString = $attributes
->ksorted()
->map(function ($key, $value) {
return "$key='$value'";
})
->values()
->join(' ');
return "<img $attributeString>";
} | php | public function tag(SizeRange $range, Size $defaultSize, array $attributes = []): string
{
$attributes = new Map($attributes);
$attributes['alt'] = $attributes['alt'] ?? '';
$attributes['sizes'] = $attributes['sizes'] ?? '100vw';
$attributes['src'] = $this->source($defaultSize);
$attributes['srcset'] = $this->sourceSet($range);
$attributeString = $attributes
->ksorted()
->map(function ($key, $value) {
return "$key='$value'";
})
->values()
->join(' ');
return "<img $attributeString>";
} | [
"public",
"function",
"tag",
"(",
"SizeRange",
"$",
"range",
",",
"Size",
"$",
"defaultSize",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
":",
"string",
"{",
"$",
"attributes",
"=",
"new",
"Map",
"(",
"$",
"attributes",
")",
";",
"$",
"attributes",
"[",
"'alt'",
"]",
"=",
"$",
"attributes",
"[",
"'alt'",
"]",
"??",
"''",
";",
"$",
"attributes",
"[",
"'sizes'",
"]",
"=",
"$",
"attributes",
"[",
"'sizes'",
"]",
"??",
"'100vw'",
";",
"$",
"attributes",
"[",
"'src'",
"]",
"=",
"$",
"this",
"->",
"source",
"(",
"$",
"defaultSize",
")",
";",
"$",
"attributes",
"[",
"'srcset'",
"]",
"=",
"$",
"this",
"->",
"sourceSet",
"(",
"$",
"range",
")",
";",
"$",
"attributeString",
"=",
"$",
"attributes",
"->",
"ksorted",
"(",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"return",
"\"$key='$value'\"",
";",
"}",
")",
"->",
"values",
"(",
")",
"->",
"join",
"(",
"' '",
")",
";",
"return",
"\"<img $attributeString>\"",
";",
"}"
] | Return a responsive HTML `img` tag for the image.
@param string[] $attributes list of attributes to add to the `img` tag | [
"Return",
"a",
"responsive",
"HTML",
"img",
"tag",
"for",
"the",
"image",
"."
] | a890fc2b3d011c660161aae0e18709dadf00e43f | https://github.com/stevenberg/responsible-images-php/blob/a890fc2b3d011c660161aae0e18709dadf00e43f/src/Image.php#L76-L93 |
4,014 | stevenberg/responsible-images-php | src/Image.php | Image.fromShape | public static function fromShape(
Shape $shape,
Name $name,
array $options = [],
Maker $maker = null
): self {
switch ($shape) {
case 'square':
return new Square($name, $options, $maker);
case 'tall':
return new Tall($name, $options, $maker);
case 'wide':
return new Wide($name, $options, $maker);
default:
return new self($name, $options, $maker);
}
} | php | public static function fromShape(
Shape $shape,
Name $name,
array $options = [],
Maker $maker = null
): self {
switch ($shape) {
case 'square':
return new Square($name, $options, $maker);
case 'tall':
return new Tall($name, $options, $maker);
case 'wide':
return new Wide($name, $options, $maker);
default:
return new self($name, $options, $maker);
}
} | [
"public",
"static",
"function",
"fromShape",
"(",
"Shape",
"$",
"shape",
",",
"Name",
"$",
"name",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"Maker",
"$",
"maker",
"=",
"null",
")",
":",
"self",
"{",
"switch",
"(",
"$",
"shape",
")",
"{",
"case",
"'square'",
":",
"return",
"new",
"Square",
"(",
"$",
"name",
",",
"$",
"options",
",",
"$",
"maker",
")",
";",
"case",
"'tall'",
":",
"return",
"new",
"Tall",
"(",
"$",
"name",
",",
"$",
"options",
",",
"$",
"maker",
")",
";",
"case",
"'wide'",
":",
"return",
"new",
"Wide",
"(",
"$",
"name",
",",
"$",
"options",
",",
"$",
"maker",
")",
";",
"default",
":",
"return",
"new",
"self",
"(",
"$",
"name",
",",
"$",
"options",
",",
"$",
"maker",
")",
";",
"}",
"}"
] | Return an `Image` object of the appropriate class based on
a `Shape` value.
@param Values\Value[] $options options to pass to the URL maker class | [
"Return",
"an",
"Image",
"object",
"of",
"the",
"appropriate",
"class",
"based",
"on",
"a",
"Shape",
"value",
"."
] | a890fc2b3d011c660161aae0e18709dadf00e43f | https://github.com/stevenberg/responsible-images-php/blob/a890fc2b3d011c660161aae0e18709dadf00e43f/src/Image.php#L101-L117 |
4,015 | phospr/CoreBundle | Entity/User.php | User.createDefaultOrganization | public function createDefaultOrganization()
{
$organization = new Organization();
$organization->setName($this->getUsername());
$this->organizations[] = $organization;
} | php | public function createDefaultOrganization()
{
$organization = new Organization();
$organization->setName($this->getUsername());
$this->organizations[] = $organization;
} | [
"public",
"function",
"createDefaultOrganization",
"(",
")",
"{",
"$",
"organization",
"=",
"new",
"Organization",
"(",
")",
";",
"$",
"organization",
"->",
"setName",
"(",
"$",
"this",
"->",
"getUsername",
"(",
")",
")",
";",
"$",
"this",
"->",
"organizations",
"[",
"]",
"=",
"$",
"organization",
";",
"}"
] | Create default Organization
@author Tom Haskins-Vaughan <[email protected]>
@since 0.8.0
@ORM\PrePersist | [
"Create",
"default",
"Organization"
] | adfb4485295d1cfb27329f18bca0fe1e80676974 | https://github.com/phospr/CoreBundle/blob/adfb4485295d1cfb27329f18bca0fe1e80676974/Entity/User.php#L99-L105 |
4,016 | CampusUnion/Sked | src/Sked.php | Sked.dates | public function dates(string $strStartDate = null, $mEndDate = null)
{
return new SkeDateIterator(static::$oModel, $strStartDate, $mEndDate);
} | php | public function dates(string $strStartDate = null, $mEndDate = null)
{
return new SkeDateIterator(static::$oModel, $strStartDate, $mEndDate);
} | [
"public",
"function",
"dates",
"(",
"string",
"$",
"strStartDate",
"=",
"null",
",",
"$",
"mEndDate",
"=",
"null",
")",
"{",
"return",
"new",
"SkeDateIterator",
"(",
"static",
"::",
"$",
"oModel",
",",
"$",
"strStartDate",
",",
"$",
"mEndDate",
")",
";",
"}"
] | Get dates iterator.
@param string $strStart Start date YYYY-MM-DD.
@param string|true $mEnd End date YYYY-MM-DD, or "true" to return one full month.
@return CampusUnion\Sked\SkeDateIterator | [
"Get",
"dates",
"iterator",
"."
] | 5b51afdb56c0f607e54364635c4725627b19ecc6 | https://github.com/CampusUnion/Sked/blob/5b51afdb56c0f607e54364635c4725627b19ecc6/src/Sked.php#L38-L41 |
4,017 | CampusUnion/Sked | src/Sked.php | Sked.skeDoosh | public static function skeDoosh(array $aOptions)
{
// Load JS
echo <<<EOD
<script>
if (typeof jQuery == 'undefined') {
skedLoadTag(
'http://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js',
loadSkedJs
);
} else {
loadSkedJs();
}
function skedLoadTag(strSrc, fnOnload)
{
var eHead = document.getElementsByTagName('head')[0];
var e$ = document.createElement('script');
e$.src = strSrc;
if (fnOnload)
e$.onload = fnOnload;
eHead.appendChild(e$);
}
function loadSkedJs()
{
skedLoadTag('https://raw.githubusercontent.com/CampusUnion/Sked-JS/master/sked.js');
}
</script>
EOD;
// Init Sked
$sked = new self($aOptions);
$skeVent = null;
$bSuccess = false;
if ($_REQUEST['sked_form'] ?? null === '1') {
$skeVent = new \CampusUnion\Sked\SkeVent($_REQUEST);
$bSuccess = $sked->save($skeVent);
}
echo $sked->form(['method' => 'get'], $bSuccess ?: $skeVent);
} | php | public static function skeDoosh(array $aOptions)
{
// Load JS
echo <<<EOD
<script>
if (typeof jQuery == 'undefined') {
skedLoadTag(
'http://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js',
loadSkedJs
);
} else {
loadSkedJs();
}
function skedLoadTag(strSrc, fnOnload)
{
var eHead = document.getElementsByTagName('head')[0];
var e$ = document.createElement('script');
e$.src = strSrc;
if (fnOnload)
e$.onload = fnOnload;
eHead.appendChild(e$);
}
function loadSkedJs()
{
skedLoadTag('https://raw.githubusercontent.com/CampusUnion/Sked-JS/master/sked.js');
}
</script>
EOD;
// Init Sked
$sked = new self($aOptions);
$skeVent = null;
$bSuccess = false;
if ($_REQUEST['sked_form'] ?? null === '1') {
$skeVent = new \CampusUnion\Sked\SkeVent($_REQUEST);
$bSuccess = $sked->save($skeVent);
}
echo $sked->form(['method' => 'get'], $bSuccess ?: $skeVent);
} | [
"public",
"static",
"function",
"skeDoosh",
"(",
"array",
"$",
"aOptions",
")",
"{",
"// Load JS",
"echo",
" <<<EOD\n<script>\n if (typeof jQuery == 'undefined') {\n skedLoadTag(\n 'http://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js',\n loadSkedJs\n );\n } else {\n loadSkedJs();\n }\n\n function skedLoadTag(strSrc, fnOnload)\n {\n var eHead = document.getElementsByTagName('head')[0];\n var e$ = document.createElement('script');\n e$.src = strSrc;\n if (fnOnload)\n e$.onload = fnOnload;\n eHead.appendChild(e$);\n }\n\n function loadSkedJs()\n {\n skedLoadTag('https://raw.githubusercontent.com/CampusUnion/Sked-JS/master/sked.js');\n }\n</script>\nEOD",
";",
"// Init Sked",
"$",
"sked",
"=",
"new",
"self",
"(",
"$",
"aOptions",
")",
";",
"$",
"skeVent",
"=",
"null",
";",
"$",
"bSuccess",
"=",
"false",
";",
"if",
"(",
"$",
"_REQUEST",
"[",
"'sked_form'",
"]",
"??",
"null",
"===",
"'1'",
")",
"{",
"$",
"skeVent",
"=",
"new",
"\\",
"CampusUnion",
"\\",
"Sked",
"\\",
"SkeVent",
"(",
"$",
"_REQUEST",
")",
";",
"$",
"bSuccess",
"=",
"$",
"sked",
"->",
"save",
"(",
"$",
"skeVent",
")",
";",
"}",
"echo",
"$",
"sked",
"->",
"form",
"(",
"[",
"'method'",
"=>",
"'get'",
"]",
",",
"$",
"bSuccess",
"?",
":",
"$",
"skeVent",
")",
";",
"}"
] | Do it all in one easy method call.
@param array $aOptions Config options. | [
"Do",
"it",
"all",
"in",
"one",
"easy",
"method",
"call",
"."
] | 5b51afdb56c0f607e54364635c4725627b19ecc6 | https://github.com/CampusUnion/Sked/blob/5b51afdb56c0f607e54364635c4725627b19ecc6/src/Sked.php#L121-L161 |
4,018 | gosizzle/sizzle-php-sdk | src/Token.php | Token.delete | public function delete()
{
$return = false;
if (isset($this->tokenId)) {
$return = $this->apiCall->delete(
$this->endpoint.'/delete',
array('tokenId'=>$this->tokenId)
);
}
return $return;
} | php | public function delete()
{
$return = false;
if (isset($this->tokenId)) {
$return = $this->apiCall->delete(
$this->endpoint.'/delete',
array('tokenId'=>$this->tokenId)
);
}
return $return;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"return",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tokenId",
")",
")",
"{",
"$",
"return",
"=",
"$",
"this",
"->",
"apiCall",
"->",
"delete",
"(",
"$",
"this",
"->",
"endpoint",
".",
"'/delete'",
",",
"array",
"(",
"'tokenId'",
"=>",
"$",
"this",
"->",
"tokenId",
")",
")",
";",
"}",
"return",
"$",
"return",
";",
"}"
] | Deletes a token.
@return boolean - success of deletion | [
"Deletes",
"a",
"token",
"."
] | b9710d8c253e61edd76555765e7b9aa314dd5063 | https://github.com/gosizzle/sizzle-php-sdk/blob/b9710d8c253e61edd76555765e7b9aa314dd5063/src/Token.php#L40-L50 |
4,019 | Silvestra/Silvestra | src/Silvestra/Component/Seo/SeoPresentation.php | SeoPresentation.addMetas | private function addMetas($type, array $values)
{
foreach ($values as $key => $value) {
$this->seoPage->addMeta($type, $key, $value);
}
} | php | private function addMetas($type, array $values)
{
foreach ($values as $key => $value) {
$this->seoPage->addMeta($type, $key, $value);
}
} | [
"private",
"function",
"addMetas",
"(",
"$",
"type",
",",
"array",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"seoPage",
"->",
"addMeta",
"(",
"$",
"type",
",",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] | Add metas.
@param string $type
@param array $values | [
"Add",
"metas",
"."
] | b7367601b01495ae3c492b42042f804dee13ab06 | https://github.com/Silvestra/Silvestra/blob/b7367601b01495ae3c492b42042f804dee13ab06/src/Silvestra/Component/Seo/SeoPresentation.php#L89-L94 |
4,020 | synapsestudios/synapse-base | src/Synapse/SocialLogin/SocialLoginService.php | SocialLoginService.handleLoginRequest | public function handleLoginRequest(LoginRequest $request)
{
$socialLogin = $this->socialLoginMapper->findByProviderUserId(
$request->getProvider(),
$request->getProviderUserId()
);
if ($socialLogin) {
$user = $this->userService->findById(
$socialLogin->getUserId()
);
$this->updateSocialLoginToken($socialLogin, $request);
return $this->handleLogin($user, $request);
}
$userFound = false;
foreach ($request->getEmails() as $email) {
$user = $this->userService->findByEmail($email);
if ($user) {
$userFound = true;
if ($this->userHasSocialLoginWithProvider($request->getProvider(), $user)) {
return $this->handleLogin($user, $request);
}
}
}
if ($userFound) {
throw new NoLinkedAccountException;
}
$result = $this->registerFromSocialLogin($request);
return $this->handleLogin($result['user']);
} | php | public function handleLoginRequest(LoginRequest $request)
{
$socialLogin = $this->socialLoginMapper->findByProviderUserId(
$request->getProvider(),
$request->getProviderUserId()
);
if ($socialLogin) {
$user = $this->userService->findById(
$socialLogin->getUserId()
);
$this->updateSocialLoginToken($socialLogin, $request);
return $this->handleLogin($user, $request);
}
$userFound = false;
foreach ($request->getEmails() as $email) {
$user = $this->userService->findByEmail($email);
if ($user) {
$userFound = true;
if ($this->userHasSocialLoginWithProvider($request->getProvider(), $user)) {
return $this->handleLogin($user, $request);
}
}
}
if ($userFound) {
throw new NoLinkedAccountException;
}
$result = $this->registerFromSocialLogin($request);
return $this->handleLogin($result['user']);
} | [
"public",
"function",
"handleLoginRequest",
"(",
"LoginRequest",
"$",
"request",
")",
"{",
"$",
"socialLogin",
"=",
"$",
"this",
"->",
"socialLoginMapper",
"->",
"findByProviderUserId",
"(",
"$",
"request",
"->",
"getProvider",
"(",
")",
",",
"$",
"request",
"->",
"getProviderUserId",
"(",
")",
")",
";",
"if",
"(",
"$",
"socialLogin",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"findById",
"(",
"$",
"socialLogin",
"->",
"getUserId",
"(",
")",
")",
";",
"$",
"this",
"->",
"updateSocialLoginToken",
"(",
"$",
"socialLogin",
",",
"$",
"request",
")",
";",
"return",
"$",
"this",
"->",
"handleLogin",
"(",
"$",
"user",
",",
"$",
"request",
")",
";",
"}",
"$",
"userFound",
"=",
"false",
";",
"foreach",
"(",
"$",
"request",
"->",
"getEmails",
"(",
")",
"as",
"$",
"email",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"findByEmail",
"(",
"$",
"email",
")",
";",
"if",
"(",
"$",
"user",
")",
"{",
"$",
"userFound",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"userHasSocialLoginWithProvider",
"(",
"$",
"request",
"->",
"getProvider",
"(",
")",
",",
"$",
"user",
")",
")",
"{",
"return",
"$",
"this",
"->",
"handleLogin",
"(",
"$",
"user",
",",
"$",
"request",
")",
";",
"}",
"}",
"}",
"if",
"(",
"$",
"userFound",
")",
"{",
"throw",
"new",
"NoLinkedAccountException",
";",
"}",
"$",
"result",
"=",
"$",
"this",
"->",
"registerFromSocialLogin",
"(",
"$",
"request",
")",
";",
"return",
"$",
"this",
"->",
"handleLogin",
"(",
"$",
"result",
"[",
"'user'",
"]",
")",
";",
"}"
] | Handle a request to log in via a social login provider
@param LoginRequest $request
@return array Access token | [
"Handle",
"a",
"request",
"to",
"log",
"in",
"via",
"a",
"social",
"login",
"provider"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/SocialLogin/SocialLoginService.php#L44-L78 |
4,021 | synapsestudios/synapse-base | src/Synapse/SocialLogin/SocialLoginService.php | SocialLoginService.handleLinkRequest | public function handleLinkRequest(LoginRequest $request, $userId)
{
$socialLogin = $this->socialLoginMapper->findByProviderUserId(
$request->getProvider(),
$request->getProviderUserId()
);
if ($socialLogin) {
throw new LinkedAccountExistsException;
}
$user = $this->userService->findById($userId);
if (! $user) {
throw new OutOfBoundsException('Account not found', self::EXCEPTION_ACCOUNT_NOT_FOUND);
}
$socialLoginEntity = new SocialLoginEntity;
$socialLoginEntity->setUserId($user->getId())
->setProvider($request->getProvider())
->setProviderUserId($request->getProviderUserId())
->setAccessToken($request->getAccessToken())
->setAccessTokenExpires($request->getAccessTokenExpires())
->setRefreshToken($request->getRefreshToken());
$socialLogin = $this->socialLoginMapper->persist($socialLoginEntity);
return $this->handleLogin($user, $request);
} | php | public function handleLinkRequest(LoginRequest $request, $userId)
{
$socialLogin = $this->socialLoginMapper->findByProviderUserId(
$request->getProvider(),
$request->getProviderUserId()
);
if ($socialLogin) {
throw new LinkedAccountExistsException;
}
$user = $this->userService->findById($userId);
if (! $user) {
throw new OutOfBoundsException('Account not found', self::EXCEPTION_ACCOUNT_NOT_FOUND);
}
$socialLoginEntity = new SocialLoginEntity;
$socialLoginEntity->setUserId($user->getId())
->setProvider($request->getProvider())
->setProviderUserId($request->getProviderUserId())
->setAccessToken($request->getAccessToken())
->setAccessTokenExpires($request->getAccessTokenExpires())
->setRefreshToken($request->getRefreshToken());
$socialLogin = $this->socialLoginMapper->persist($socialLoginEntity);
return $this->handleLogin($user, $request);
} | [
"public",
"function",
"handleLinkRequest",
"(",
"LoginRequest",
"$",
"request",
",",
"$",
"userId",
")",
"{",
"$",
"socialLogin",
"=",
"$",
"this",
"->",
"socialLoginMapper",
"->",
"findByProviderUserId",
"(",
"$",
"request",
"->",
"getProvider",
"(",
")",
",",
"$",
"request",
"->",
"getProviderUserId",
"(",
")",
")",
";",
"if",
"(",
"$",
"socialLogin",
")",
"{",
"throw",
"new",
"LinkedAccountExistsException",
";",
"}",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"findById",
"(",
"$",
"userId",
")",
";",
"if",
"(",
"!",
"$",
"user",
")",
"{",
"throw",
"new",
"OutOfBoundsException",
"(",
"'Account not found'",
",",
"self",
"::",
"EXCEPTION_ACCOUNT_NOT_FOUND",
")",
";",
"}",
"$",
"socialLoginEntity",
"=",
"new",
"SocialLoginEntity",
";",
"$",
"socialLoginEntity",
"->",
"setUserId",
"(",
"$",
"user",
"->",
"getId",
"(",
")",
")",
"->",
"setProvider",
"(",
"$",
"request",
"->",
"getProvider",
"(",
")",
")",
"->",
"setProviderUserId",
"(",
"$",
"request",
"->",
"getProviderUserId",
"(",
")",
")",
"->",
"setAccessToken",
"(",
"$",
"request",
"->",
"getAccessToken",
"(",
")",
")",
"->",
"setAccessTokenExpires",
"(",
"$",
"request",
"->",
"getAccessTokenExpires",
"(",
")",
")",
"->",
"setRefreshToken",
"(",
"$",
"request",
"->",
"getRefreshToken",
"(",
")",
")",
";",
"$",
"socialLogin",
"=",
"$",
"this",
"->",
"socialLoginMapper",
"->",
"persist",
"(",
"$",
"socialLoginEntity",
")",
";",
"return",
"$",
"this",
"->",
"handleLogin",
"(",
"$",
"user",
",",
"$",
"request",
")",
";",
"}"
] | Handle a request to link a social account to a non-social account
@param LoginRequest $request
@param string $userId ID of the non-social account to link with the social account
@return array Access token | [
"Handle",
"a",
"request",
"to",
"link",
"a",
"social",
"account",
"to",
"a",
"non",
"-",
"social",
"account"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/SocialLogin/SocialLoginService.php#L87-L115 |
4,022 | synapsestudios/synapse-base | src/Synapse/SocialLogin/SocialLoginService.php | SocialLoginService.registerFromSocialLogin | public function registerFromSocialLogin(LoginRequest $request)
{
$email = $request->getEmails()[0];
$user = $this->userService->registerWithoutPassword(array(
'email' => $email
));
$socialLoginEntity = new SocialLoginEntity;
$socialLoginEntity->setUserId($user->getId())
->setProvider($request->getProvider())
->setProviderUserId($request->getProviderUserId())
->setAccessToken($request->getAccessToken())
->setAccessTokenExpires($request->getAccessTokenExpires())
->setRefreshToken($request->getRefreshToken());
$entity = $this->socialLoginMapper->persist($socialLoginEntity);
return array(
'user' => $user,
'social_login' => $entity
);
} | php | public function registerFromSocialLogin(LoginRequest $request)
{
$email = $request->getEmails()[0];
$user = $this->userService->registerWithoutPassword(array(
'email' => $email
));
$socialLoginEntity = new SocialLoginEntity;
$socialLoginEntity->setUserId($user->getId())
->setProvider($request->getProvider())
->setProviderUserId($request->getProviderUserId())
->setAccessToken($request->getAccessToken())
->setAccessTokenExpires($request->getAccessTokenExpires())
->setRefreshToken($request->getRefreshToken());
$entity = $this->socialLoginMapper->persist($socialLoginEntity);
return array(
'user' => $user,
'social_login' => $entity
);
} | [
"public",
"function",
"registerFromSocialLogin",
"(",
"LoginRequest",
"$",
"request",
")",
"{",
"$",
"email",
"=",
"$",
"request",
"->",
"getEmails",
"(",
")",
"[",
"0",
"]",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"userService",
"->",
"registerWithoutPassword",
"(",
"array",
"(",
"'email'",
"=>",
"$",
"email",
")",
")",
";",
"$",
"socialLoginEntity",
"=",
"new",
"SocialLoginEntity",
";",
"$",
"socialLoginEntity",
"->",
"setUserId",
"(",
"$",
"user",
"->",
"getId",
"(",
")",
")",
"->",
"setProvider",
"(",
"$",
"request",
"->",
"getProvider",
"(",
")",
")",
"->",
"setProviderUserId",
"(",
"$",
"request",
"->",
"getProviderUserId",
"(",
")",
")",
"->",
"setAccessToken",
"(",
"$",
"request",
"->",
"getAccessToken",
"(",
")",
")",
"->",
"setAccessTokenExpires",
"(",
"$",
"request",
"->",
"getAccessTokenExpires",
"(",
")",
")",
"->",
"setRefreshToken",
"(",
"$",
"request",
"->",
"getRefreshToken",
"(",
")",
")",
";",
"$",
"entity",
"=",
"$",
"this",
"->",
"socialLoginMapper",
"->",
"persist",
"(",
"$",
"socialLoginEntity",
")",
";",
"return",
"array",
"(",
"'user'",
"=>",
"$",
"user",
",",
"'social_login'",
"=>",
"$",
"entity",
")",
";",
"}"
] | Register a new user account from a social login provider
@param LoginRequest $request
@return array Array containing user and social login | [
"Register",
"a",
"new",
"user",
"account",
"from",
"a",
"social",
"login",
"provider"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/SocialLogin/SocialLoginService.php#L123-L143 |
4,023 | synapsestudios/synapse-base | src/Synapse/SocialLogin/SocialLoginService.php | SocialLoginService.userHasSocialLoginWithProvider | public function userHasSocialLoginWithProvider($provider, $user)
{
return (bool) $this->socialLoginMapper->findBy([
'provider' => $provider,
'user_id' => $user->getId()
]);
} | php | public function userHasSocialLoginWithProvider($provider, $user)
{
return (bool) $this->socialLoginMapper->findBy([
'provider' => $provider,
'user_id' => $user->getId()
]);
} | [
"public",
"function",
"userHasSocialLoginWithProvider",
"(",
"$",
"provider",
",",
"$",
"user",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"socialLoginMapper",
"->",
"findBy",
"(",
"[",
"'provider'",
"=>",
"$",
"provider",
",",
"'user_id'",
"=>",
"$",
"user",
"->",
"getId",
"(",
")",
"]",
")",
";",
"}"
] | Determine if a given user has a social login linked with a given provider
@param string $provider
@param string $user
@return bool | [
"Determine",
"if",
"a",
"given",
"user",
"has",
"a",
"social",
"login",
"linked",
"with",
"a",
"given",
"provider"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/SocialLogin/SocialLoginService.php#L152-L158 |
4,024 | synapsestudios/synapse-base | src/Synapse/SocialLogin/SocialLoginService.php | SocialLoginService.handleLogin | public function handleLogin(UserEntity $user)
{
$accessToken = new AccessToken($this->tokenStorage, $this->tokenStorage);
$token = $accessToken->createAccessToken('', $user->getId(), null, true);
return $token;
} | php | public function handleLogin(UserEntity $user)
{
$accessToken = new AccessToken($this->tokenStorage, $this->tokenStorage);
$token = $accessToken->createAccessToken('', $user->getId(), null, true);
return $token;
} | [
"public",
"function",
"handleLogin",
"(",
"UserEntity",
"$",
"user",
")",
"{",
"$",
"accessToken",
"=",
"new",
"AccessToken",
"(",
"$",
"this",
"->",
"tokenStorage",
",",
"$",
"this",
"->",
"tokenStorage",
")",
";",
"$",
"token",
"=",
"$",
"accessToken",
"->",
"createAccessToken",
"(",
"''",
",",
"$",
"user",
"->",
"getId",
"(",
")",
",",
"null",
",",
"true",
")",
";",
"return",
"$",
"token",
";",
"}"
] | Create an access token given a user entity
@param UserEntity $user
@return array Access token | [
"Create",
"an",
"access",
"token",
"given",
"a",
"user",
"entity"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/SocialLogin/SocialLoginService.php#L166-L172 |
4,025 | synapsestudios/synapse-base | src/Synapse/SocialLogin/SocialLoginService.php | SocialLoginService.updateSocialLoginToken | protected function updateSocialLoginToken(
SocialLoginEntity $socialLogin,
LoginRequest $request
) {
$socialLogin->setAccessToken($request->getAccessToken())
->setAccessTokenExpires($request->getAccessTokenExpires())
->setRefreshToken($request->getRefreshToken());
$this->socialLoginMapper->persist($socialLogin);
} | php | protected function updateSocialLoginToken(
SocialLoginEntity $socialLogin,
LoginRequest $request
) {
$socialLogin->setAccessToken($request->getAccessToken())
->setAccessTokenExpires($request->getAccessTokenExpires())
->setRefreshToken($request->getRefreshToken());
$this->socialLoginMapper->persist($socialLogin);
} | [
"protected",
"function",
"updateSocialLoginToken",
"(",
"SocialLoginEntity",
"$",
"socialLogin",
",",
"LoginRequest",
"$",
"request",
")",
"{",
"$",
"socialLogin",
"->",
"setAccessToken",
"(",
"$",
"request",
"->",
"getAccessToken",
"(",
")",
")",
"->",
"setAccessTokenExpires",
"(",
"$",
"request",
"->",
"getAccessTokenExpires",
"(",
")",
")",
"->",
"setRefreshToken",
"(",
"$",
"request",
"->",
"getRefreshToken",
"(",
")",
")",
";",
"$",
"this",
"->",
"socialLoginMapper",
"->",
"persist",
"(",
"$",
"socialLogin",
")",
";",
"}"
] | Update a users OAuth token, token expiration and refresh token information
when they log in
@param SocialLoginEntity
@param LoginRequest $request | [
"Update",
"a",
"users",
"OAuth",
"token",
"token",
"expiration",
"and",
"refresh",
"token",
"information",
"when",
"they",
"log",
"in"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/SocialLogin/SocialLoginService.php#L208-L217 |
4,026 | anklimsk/cakephp-extended-test | Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php | AbstractNode.getAncestor | public function getAncestor($id)
{
if ( ! is_null($this->parent)) {
if ($this->parent->id() == $id) {
return $this->parent;
}
return $this->parent->getAncestor($id);
}
return null;
} | php | public function getAncestor($id)
{
if ( ! is_null($this->parent)) {
if ($this->parent->id() == $id) {
return $this->parent;
}
return $this->parent->getAncestor($id);
}
return null;
} | [
"public",
"function",
"getAncestor",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"parent",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parent",
"->",
"id",
"(",
")",
"==",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"parent",
";",
"}",
"return",
"$",
"this",
"->",
"parent",
"->",
"getAncestor",
"(",
"$",
"id",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Attempts to get an ancestor node by the given id.
@param int $id
@return null|AbstractNode | [
"Attempts",
"to",
"get",
"an",
"ancestor",
"node",
"by",
"the",
"given",
"id",
"."
] | 21691a3be8a198419feb92fb6ed3b35a14dc24b1 | https://github.com/anklimsk/cakephp-extended-test/blob/21691a3be8a198419feb92fb6ed3b35a14dc24b1/Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php#L210-L221 |
4,027 | anklimsk/cakephp-extended-test | Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php | AbstractNode.nextSibling | public function nextSibling()
{
if (is_null($this->parent)) {
throw new ParentNotFoundException('Parent is not set for this node.');
}
return $this->parent->nextChild($this->id);
} | php | public function nextSibling()
{
if (is_null($this->parent)) {
throw new ParentNotFoundException('Parent is not set for this node.');
}
return $this->parent->nextChild($this->id);
} | [
"public",
"function",
"nextSibling",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"parent",
")",
")",
"{",
"throw",
"new",
"ParentNotFoundException",
"(",
"'Parent is not set for this node.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"parent",
"->",
"nextChild",
"(",
"$",
"this",
"->",
"id",
")",
";",
"}"
] | Attempts to get the next sibling.
@return AbstractNode
@throws ParentNotFoundException | [
"Attempts",
"to",
"get",
"the",
"next",
"sibling",
"."
] | 21691a3be8a198419feb92fb6ed3b35a14dc24b1 | https://github.com/anklimsk/cakephp-extended-test/blob/21691a3be8a198419feb92fb6ed3b35a14dc24b1/Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php#L229-L236 |
4,028 | anklimsk/cakephp-extended-test | Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php | AbstractNode.previousSibling | public function previousSibling()
{
if (is_null($this->parent)) {
throw new ParentNotFoundException('Parent is not set for this node.');
}
return $this->parent->previousChild($this->id);
} | php | public function previousSibling()
{
if (is_null($this->parent)) {
throw new ParentNotFoundException('Parent is not set for this node.');
}
return $this->parent->previousChild($this->id);
} | [
"public",
"function",
"previousSibling",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"parent",
")",
")",
"{",
"throw",
"new",
"ParentNotFoundException",
"(",
"'Parent is not set for this node.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"parent",
"->",
"previousChild",
"(",
"$",
"this",
"->",
"id",
")",
";",
"}"
] | Attempts to get the previous sibling
@return AbstractNode
@throws ParentNotFoundException | [
"Attempts",
"to",
"get",
"the",
"previous",
"sibling"
] | 21691a3be8a198419feb92fb6ed3b35a14dc24b1 | https://github.com/anklimsk/cakephp-extended-test/blob/21691a3be8a198419feb92fb6ed3b35a14dc24b1/Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php#L244-L251 |
4,029 | anklimsk/cakephp-extended-test | Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php | AbstractNode.ancestorByTag | public function ancestorByTag($tag)
{
// Start by including ourselves in the comparison.
$node = $this;
while ( ! is_null($node)) {
if ($node->tag->name() == $tag) {
return $node;
}
$node = $node->getParent();
}
throw new ParentNotFoundException('Could not find an ancestor with "'.$tag.'" tag');
} | php | public function ancestorByTag($tag)
{
// Start by including ourselves in the comparison.
$node = $this;
while ( ! is_null($node)) {
if ($node->tag->name() == $tag) {
return $node;
}
$node = $node->getParent();
}
throw new ParentNotFoundException('Could not find an ancestor with "'.$tag.'" tag');
} | [
"public",
"function",
"ancestorByTag",
"(",
"$",
"tag",
")",
"{",
"// Start by including ourselves in the comparison.",
"$",
"node",
"=",
"$",
"this",
";",
"while",
"(",
"!",
"is_null",
"(",
"$",
"node",
")",
")",
"{",
"if",
"(",
"$",
"node",
"->",
"tag",
"->",
"name",
"(",
")",
"==",
"$",
"tag",
")",
"{",
"return",
"$",
"node",
";",
"}",
"$",
"node",
"=",
"$",
"node",
"->",
"getParent",
"(",
")",
";",
"}",
"throw",
"new",
"ParentNotFoundException",
"(",
"'Could not find an ancestor with \"'",
".",
"$",
"tag",
".",
"'\" tag'",
")",
";",
"}"
] | Function to locate a specific ancestor tag in the path to the root.
@param string $tag
@return AbstractNode
@throws ParentNotFoundException | [
"Function",
"to",
"locate",
"a",
"specific",
"ancestor",
"tag",
"in",
"the",
"path",
"to",
"the",
"root",
"."
] | 21691a3be8a198419feb92fb6ed3b35a14dc24b1 | https://github.com/anklimsk/cakephp-extended-test/blob/21691a3be8a198419feb92fb6ed3b35a14dc24b1/Vendor/PHPHtmlParser/paquettg/php-html-parser/src/PHPHtmlParser/Dom/AbstractNode.php#L341-L355 |
4,030 | opis-colibri/user-sql | src/Repositories/RoleRepository.php | RoleRepository.getByName | public function getByName(string $role): ?IRole
{
if (null === $this->roles) {
$this->getAll();
}
if (!isset($this->names[$role])) {
return null;
}
return $this->roles[$this->names[$role]];
} | php | public function getByName(string $role): ?IRole
{
if (null === $this->roles) {
$this->getAll();
}
if (!isset($this->names[$role])) {
return null;
}
return $this->roles[$this->names[$role]];
} | [
"public",
"function",
"getByName",
"(",
"string",
"$",
"role",
")",
":",
"?",
"IRole",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"roles",
")",
"{",
"$",
"this",
"->",
"getAll",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"names",
"[",
"$",
"role",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"roles",
"[",
"$",
"this",
"->",
"names",
"[",
"$",
"role",
"]",
"]",
";",
"}"
] | Get a role by its name
@param string $role
@return null|IRole | [
"Get",
"a",
"role",
"by",
"its",
"name"
] | 68c7765cda02992bf2d8302afb2b519b8b0bdf2f | https://github.com/opis-colibri/user-sql/blob/68c7765cda02992bf2d8302afb2b519b8b0bdf2f/src/Repositories/RoleRepository.php#L98-L109 |
4,031 | opis-colibri/user-sql | src/Repositories/RoleRepository.php | RoleRepository.getMultipleByName | public function getMultipleByName(array $roles): iterable
{
if (null === $this->roles) {
$this->getAll();
}
$results = [];
foreach ($roles as $role) {
if (isset($this->names[$role])) {
$results[] = $this->roles[$this->names[$role]];
}
}
return $results;
} | php | public function getMultipleByName(array $roles): iterable
{
if (null === $this->roles) {
$this->getAll();
}
$results = [];
foreach ($roles as $role) {
if (isset($this->names[$role])) {
$results[] = $this->roles[$this->names[$role]];
}
}
return $results;
} | [
"public",
"function",
"getMultipleByName",
"(",
"array",
"$",
"roles",
")",
":",
"iterable",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"roles",
")",
"{",
"$",
"this",
"->",
"getAll",
"(",
")",
";",
"}",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"roles",
"as",
"$",
"role",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"names",
"[",
"$",
"role",
"]",
")",
")",
"{",
"$",
"results",
"[",
"]",
"=",
"$",
"this",
"->",
"roles",
"[",
"$",
"this",
"->",
"names",
"[",
"$",
"role",
"]",
"]",
";",
"}",
"}",
"return",
"$",
"results",
";",
"}"
] | Get roles by their names
@param string[] $roles
@return iterable|IRole[] | [
"Get",
"roles",
"by",
"their",
"names"
] | 68c7765cda02992bf2d8302afb2b519b8b0bdf2f | https://github.com/opis-colibri/user-sql/blob/68c7765cda02992bf2d8302afb2b519b8b0bdf2f/src/Repositories/RoleRepository.php#L117-L132 |
4,032 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addVisitor | public function addVisitor(\BlackForest\PiwikBundle\Entity\PiwikVisitor $visitor)
{
$this->visitor[] = $visitor;
return $this;
} | php | public function addVisitor(\BlackForest\PiwikBundle\Entity\PiwikVisitor $visitor)
{
$this->visitor[] = $visitor;
return $this;
} | [
"public",
"function",
"addVisitor",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikVisitor",
"$",
"visitor",
")",
"{",
"$",
"this",
"->",
"visitor",
"[",
"]",
"=",
"$",
"visitor",
";",
"return",
"$",
"this",
";",
"}"
] | Add visitor.
@param \BlackForest\PiwikBundle\Entity\PiwikVisitor $visitor
@return PiwikSite | [
"Add",
"visitor",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L825-L830 |
4,033 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeVisitor | public function removeVisitor(\BlackForest\PiwikBundle\Entity\PiwikVisitor $visitor)
{
return $this->visitor->removeElement($visitor);
} | php | public function removeVisitor(\BlackForest\PiwikBundle\Entity\PiwikVisitor $visitor)
{
return $this->visitor->removeElement($visitor);
} | [
"public",
"function",
"removeVisitor",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikVisitor",
"$",
"visitor",
")",
"{",
"return",
"$",
"this",
"->",
"visitor",
"->",
"removeElement",
"(",
"$",
"visitor",
")",
";",
"}"
] | Remove visitor.
@param \BlackForest\PiwikBundle\Entity\PiwikVisitor $visitor
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"visitor",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L839-L842 |
4,034 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addVisitorType | public function addVisitorType(\BlackForest\PiwikBundle\Entity\PiwikVisitorType $visitorType)
{
$this->visitorType[] = $visitorType;
return $this;
} | php | public function addVisitorType(\BlackForest\PiwikBundle\Entity\PiwikVisitorType $visitorType)
{
$this->visitorType[] = $visitorType;
return $this;
} | [
"public",
"function",
"addVisitorType",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikVisitorType",
"$",
"visitorType",
")",
"{",
"$",
"this",
"->",
"visitorType",
"[",
"]",
"=",
"$",
"visitorType",
";",
"return",
"$",
"this",
";",
"}"
] | Add visitorType.
@param \BlackForest\PiwikBundle\Entity\PiwikVisitorType $visitorType
@return PiwikSite | [
"Add",
"visitorType",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L861-L866 |
4,035 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeVisitorType | public function removeVisitorType(\BlackForest\PiwikBundle\Entity\PiwikVisitorType $visitorType)
{
return $this->visitorType->removeElement($visitorType);
} | php | public function removeVisitorType(\BlackForest\PiwikBundle\Entity\PiwikVisitorType $visitorType)
{
return $this->visitorType->removeElement($visitorType);
} | [
"public",
"function",
"removeVisitorType",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikVisitorType",
"$",
"visitorType",
")",
"{",
"return",
"$",
"this",
"->",
"visitorType",
"->",
"removeElement",
"(",
"$",
"visitorType",
")",
";",
"}"
] | Remove visitorType.
@param \BlackForest\PiwikBundle\Entity\PiwikVisitorType $visitorType
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"visitorType",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L875-L878 |
4,036 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addReferrerType | public function addReferrerType(\BlackForest\PiwikBundle\Entity\PiwikReferrerType $referrerType)
{
$this->referrerType[] = $referrerType;
return $this;
} | php | public function addReferrerType(\BlackForest\PiwikBundle\Entity\PiwikReferrerType $referrerType)
{
$this->referrerType[] = $referrerType;
return $this;
} | [
"public",
"function",
"addReferrerType",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikReferrerType",
"$",
"referrerType",
")",
"{",
"$",
"this",
"->",
"referrerType",
"[",
"]",
"=",
"$",
"referrerType",
";",
"return",
"$",
"this",
";",
"}"
] | Add referrerType.
@param \BlackForest\PiwikBundle\Entity\PiwikReferrerType $referrerType
@return PiwikSite | [
"Add",
"referrerType",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L897-L902 |
4,037 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeReferrerType | public function removeReferrerType(\BlackForest\PiwikBundle\Entity\PiwikReferrerType $referrerType)
{
return $this->referrerType->removeElement($referrerType);
} | php | public function removeReferrerType(\BlackForest\PiwikBundle\Entity\PiwikReferrerType $referrerType)
{
return $this->referrerType->removeElement($referrerType);
} | [
"public",
"function",
"removeReferrerType",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikReferrerType",
"$",
"referrerType",
")",
"{",
"return",
"$",
"this",
"->",
"referrerType",
"->",
"removeElement",
"(",
"$",
"referrerType",
")",
";",
"}"
] | Remove referrerType.
@param \BlackForest\PiwikBundle\Entity\PiwikReferrerType $referrerType
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"referrerType",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L911-L914 |
4,038 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addSearchEngine | public function addSearchEngine(\BlackForest\PiwikBundle\Entity\PiwikSearchEngine $searchEngine)
{
$this->searchEngine[] = $searchEngine;
return $this;
} | php | public function addSearchEngine(\BlackForest\PiwikBundle\Entity\PiwikSearchEngine $searchEngine)
{
$this->searchEngine[] = $searchEngine;
return $this;
} | [
"public",
"function",
"addSearchEngine",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikSearchEngine",
"$",
"searchEngine",
")",
"{",
"$",
"this",
"->",
"searchEngine",
"[",
"]",
"=",
"$",
"searchEngine",
";",
"return",
"$",
"this",
";",
"}"
] | Add searchEngine.
@param \BlackForest\PiwikBundle\Entity\PiwikSearchEngine $searchEngine
@return PiwikSite | [
"Add",
"searchEngine",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L933-L938 |
4,039 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeSearchEngine | public function removeSearchEngine(\BlackForest\PiwikBundle\Entity\PiwikSearchEngine $searchEngine)
{
return $this->searchEngine->removeElement($searchEngine);
} | php | public function removeSearchEngine(\BlackForest\PiwikBundle\Entity\PiwikSearchEngine $searchEngine)
{
return $this->searchEngine->removeElement($searchEngine);
} | [
"public",
"function",
"removeSearchEngine",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikSearchEngine",
"$",
"searchEngine",
")",
"{",
"return",
"$",
"this",
"->",
"searchEngine",
"->",
"removeElement",
"(",
"$",
"searchEngine",
")",
";",
"}"
] | Remove searchEngine.
@param \BlackForest\PiwikBundle\Entity\PiwikSearchEngine $searchEngine
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"searchEngine",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L947-L950 |
4,040 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addLanguage | public function addLanguage(\BlackForest\PiwikBundle\Entity\PiwikLanguage $language)
{
$this->language[] = $language;
return $this;
} | php | public function addLanguage(\BlackForest\PiwikBundle\Entity\PiwikLanguage $language)
{
$this->language[] = $language;
return $this;
} | [
"public",
"function",
"addLanguage",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikLanguage",
"$",
"language",
")",
"{",
"$",
"this",
"->",
"language",
"[",
"]",
"=",
"$",
"language",
";",
"return",
"$",
"this",
";",
"}"
] | Add language.
@param \BlackForest\PiwikBundle\Entity\PiwikLanguage $language
@return PiwikSite | [
"Add",
"language",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L969-L974 |
4,041 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeLanguage | public function removeLanguage(\BlackForest\PiwikBundle\Entity\PiwikLanguage $language)
{
return $this->language->removeElement($language);
} | php | public function removeLanguage(\BlackForest\PiwikBundle\Entity\PiwikLanguage $language)
{
return $this->language->removeElement($language);
} | [
"public",
"function",
"removeLanguage",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikLanguage",
"$",
"language",
")",
"{",
"return",
"$",
"this",
"->",
"language",
"->",
"removeElement",
"(",
"$",
"language",
")",
";",
"}"
] | Remove language.
@param \BlackForest\PiwikBundle\Entity\PiwikLanguage $language
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"language",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L983-L986 |
4,042 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addDevice | public function addDevice(\BlackForest\PiwikBundle\Entity\PiwikDevice $device)
{
$this->device[] = $device;
return $this;
} | php | public function addDevice(\BlackForest\PiwikBundle\Entity\PiwikDevice $device)
{
$this->device[] = $device;
return $this;
} | [
"public",
"function",
"addDevice",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikDevice",
"$",
"device",
")",
"{",
"$",
"this",
"->",
"device",
"[",
"]",
"=",
"$",
"device",
";",
"return",
"$",
"this",
";",
"}"
] | Add device.
@param \BlackForest\PiwikBundle\Entity\PiwikDevice $device
@return PiwikSite | [
"Add",
"device",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1005-L1010 |
4,043 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeDevice | public function removeDevice(\BlackForest\PiwikBundle\Entity\PiwikDevice $device)
{
return $this->device->removeElement($device);
} | php | public function removeDevice(\BlackForest\PiwikBundle\Entity\PiwikDevice $device)
{
return $this->device->removeElement($device);
} | [
"public",
"function",
"removeDevice",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikDevice",
"$",
"device",
")",
"{",
"return",
"$",
"this",
"->",
"device",
"->",
"removeElement",
"(",
"$",
"device",
")",
";",
"}"
] | Remove device.
@param \BlackForest\PiwikBundle\Entity\PiwikDevice $device
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"device",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1019-L1022 |
4,044 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addOperatingSystem | public function addOperatingSystem(\BlackForest\PiwikBundle\Entity\PiwikOperatingSystem $operatingSystem)
{
$this->operatingSystem[] = $operatingSystem;
return $this;
} | php | public function addOperatingSystem(\BlackForest\PiwikBundle\Entity\PiwikOperatingSystem $operatingSystem)
{
$this->operatingSystem[] = $operatingSystem;
return $this;
} | [
"public",
"function",
"addOperatingSystem",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikOperatingSystem",
"$",
"operatingSystem",
")",
"{",
"$",
"this",
"->",
"operatingSystem",
"[",
"]",
"=",
"$",
"operatingSystem",
";",
"return",
"$",
"this",
";",
"}"
] | Add operatingSystem.
@param \BlackForest\PiwikBundle\Entity\PiwikOperatingSystem $operatingSystem
@return PiwikSite | [
"Add",
"operatingSystem",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1041-L1046 |
4,045 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeOperatingSystem | public function removeOperatingSystem(\BlackForest\PiwikBundle\Entity\PiwikOperatingSystem $operatingSystem)
{
return $this->operatingSystem->removeElement($operatingSystem);
} | php | public function removeOperatingSystem(\BlackForest\PiwikBundle\Entity\PiwikOperatingSystem $operatingSystem)
{
return $this->operatingSystem->removeElement($operatingSystem);
} | [
"public",
"function",
"removeOperatingSystem",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikOperatingSystem",
"$",
"operatingSystem",
")",
"{",
"return",
"$",
"this",
"->",
"operatingSystem",
"->",
"removeElement",
"(",
"$",
"operatingSystem",
")",
";",
"}"
] | Remove operatingSystem.
@param \BlackForest\PiwikBundle\Entity\PiwikOperatingSystem $operatingSystem
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"operatingSystem",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1055-L1058 |
4,046 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addBrowser | public function addBrowser(\BlackForest\PiwikBundle\Entity\PiwikBrowser $browser)
{
$this->browser[] = $browser;
return $this;
} | php | public function addBrowser(\BlackForest\PiwikBundle\Entity\PiwikBrowser $browser)
{
$this->browser[] = $browser;
return $this;
} | [
"public",
"function",
"addBrowser",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikBrowser",
"$",
"browser",
")",
"{",
"$",
"this",
"->",
"browser",
"[",
"]",
"=",
"$",
"browser",
";",
"return",
"$",
"this",
";",
"}"
] | Add browser.
@param \BlackForest\PiwikBundle\Entity\PiwikBrowser $browser
@return PiwikSite | [
"Add",
"browser",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1077-L1082 |
4,047 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeBrowser | public function removeBrowser(\BlackForest\PiwikBundle\Entity\PiwikBrowser $browser)
{
return $this->browser->removeElement($browser);
} | php | public function removeBrowser(\BlackForest\PiwikBundle\Entity\PiwikBrowser $browser)
{
return $this->browser->removeElement($browser);
} | [
"public",
"function",
"removeBrowser",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikBrowser",
"$",
"browser",
")",
"{",
"return",
"$",
"this",
"->",
"browser",
"->",
"removeElement",
"(",
"$",
"browser",
")",
";",
"}"
] | Remove browser.
@param \BlackForest\PiwikBundle\Entity\PiwikBrowser $browser
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"browser",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1091-L1094 |
4,048 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addCountry | public function addCountry(\BlackForest\PiwikBundle\Entity\PiwikCountry $country)
{
$this->country[] = $country;
return $this;
} | php | public function addCountry(\BlackForest\PiwikBundle\Entity\PiwikCountry $country)
{
$this->country[] = $country;
return $this;
} | [
"public",
"function",
"addCountry",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikCountry",
"$",
"country",
")",
"{",
"$",
"this",
"->",
"country",
"[",
"]",
"=",
"$",
"country",
";",
"return",
"$",
"this",
";",
"}"
] | Add country.
@param \BlackForest\PiwikBundle\Entity\PiwikCountry $country
@return PiwikSite | [
"Add",
"country",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1113-L1118 |
4,049 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeCountry | public function removeCountry(\BlackForest\PiwikBundle\Entity\PiwikCountry $country)
{
return $this->country->removeElement($country);
} | php | public function removeCountry(\BlackForest\PiwikBundle\Entity\PiwikCountry $country)
{
return $this->country->removeElement($country);
} | [
"public",
"function",
"removeCountry",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikCountry",
"$",
"country",
")",
"{",
"return",
"$",
"this",
"->",
"country",
"->",
"removeElement",
"(",
"$",
"country",
")",
";",
"}"
] | Remove country.
@param \BlackForest\PiwikBundle\Entity\PiwikCountry $country
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"country",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1127-L1130 |
4,050 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addResolution | public function addResolution(\BlackForest\PiwikBundle\Entity\PiwikResolution $resolution)
{
$this->resolution[] = $resolution;
return $this;
} | php | public function addResolution(\BlackForest\PiwikBundle\Entity\PiwikResolution $resolution)
{
$this->resolution[] = $resolution;
return $this;
} | [
"public",
"function",
"addResolution",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikResolution",
"$",
"resolution",
")",
"{",
"$",
"this",
"->",
"resolution",
"[",
"]",
"=",
"$",
"resolution",
";",
"return",
"$",
"this",
";",
"}"
] | Add resolution.
@param \BlackForest\PiwikBundle\Entity\PiwikResolution $resolution
@return PiwikSite | [
"Add",
"resolution",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1185-L1190 |
4,051 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeResolution | public function removeResolution(\BlackForest\PiwikBundle\Entity\PiwikResolution $resolution)
{
return $this->resolution->removeElement($resolution);
} | php | public function removeResolution(\BlackForest\PiwikBundle\Entity\PiwikResolution $resolution)
{
return $this->resolution->removeElement($resolution);
} | [
"public",
"function",
"removeResolution",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikResolution",
"$",
"resolution",
")",
"{",
"return",
"$",
"this",
"->",
"resolution",
"->",
"removeElement",
"(",
"$",
"resolution",
")",
";",
"}"
] | Remove resolution.
@param \BlackForest\PiwikBundle\Entity\PiwikResolution $resolution
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"resolution",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1199-L1202 |
4,052 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addEcomerceStatus | public function addEcomerceStatus(\BlackForest\PiwikBundle\Entity\PiwikEcomerceStatus $ecomerceStatus)
{
$this->ecomerceStatus[] = $ecomerceStatus;
return $this;
} | php | public function addEcomerceStatus(\BlackForest\PiwikBundle\Entity\PiwikEcomerceStatus $ecomerceStatus)
{
$this->ecomerceStatus[] = $ecomerceStatus;
return $this;
} | [
"public",
"function",
"addEcomerceStatus",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikEcomerceStatus",
"$",
"ecomerceStatus",
")",
"{",
"$",
"this",
"->",
"ecomerceStatus",
"[",
"]",
"=",
"$",
"ecomerceStatus",
";",
"return",
"$",
"this",
";",
"}"
] | Add ecomerceStatus.
@param \BlackForest\PiwikBundle\Entity\PiwikEcomerceStatus $ecomerceStatus
@return PiwikSite | [
"Add",
"ecomerceStatus",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1221-L1226 |
4,053 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeEcomerceStatus | public function removeEcomerceStatus(\BlackForest\PiwikBundle\Entity\PiwikEcomerceStatus $ecomerceStatus)
{
return $this->ecomerceStatus->removeElement($ecomerceStatus);
} | php | public function removeEcomerceStatus(\BlackForest\PiwikBundle\Entity\PiwikEcomerceStatus $ecomerceStatus)
{
return $this->ecomerceStatus->removeElement($ecomerceStatus);
} | [
"public",
"function",
"removeEcomerceStatus",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikEcomerceStatus",
"$",
"ecomerceStatus",
")",
"{",
"return",
"$",
"this",
"->",
"ecomerceStatus",
"->",
"removeElement",
"(",
"$",
"ecomerceStatus",
")",
";",
"}"
] | Remove ecomerceStatus.
@param \BlackForest\PiwikBundle\Entity\PiwikEcomerceStatus $ecomerceStatus
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"ecomerceStatus",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1235-L1238 |
4,054 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addVisitPlugin | public function addVisitPlugin(\BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin)
{
$this->visitPlugin[] = $visitPlugin;
return $this;
} | php | public function addVisitPlugin(\BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin)
{
$this->visitPlugin[] = $visitPlugin;
return $this;
} | [
"public",
"function",
"addVisitPlugin",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikVisitPlugin",
"$",
"visitPlugin",
")",
"{",
"$",
"this",
"->",
"visitPlugin",
"[",
"]",
"=",
"$",
"visitPlugin",
";",
"return",
"$",
"this",
";",
"}"
] | Add visitPlugin.
@param \BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin
@return PiwikSite | [
"Add",
"visitPlugin",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1257-L1262 |
4,055 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeVisitPlugin | public function removeVisitPlugin(\BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin)
{
return $this->visitPlugin->removeElement($visitPlugin);
} | php | public function removeVisitPlugin(\BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin)
{
return $this->visitPlugin->removeElement($visitPlugin);
} | [
"public",
"function",
"removeVisitPlugin",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikVisitPlugin",
"$",
"visitPlugin",
")",
"{",
"return",
"$",
"this",
"->",
"visitPlugin",
"->",
"removeElement",
"(",
"$",
"visitPlugin",
")",
";",
"}"
] | Remove visitPlugin.
@param \BlackForest\PiwikBundle\Entity\PiwikVisitPlugin $visitPlugin
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"visitPlugin",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1271-L1274 |
4,056 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addCurrency | public function addCurrency(\BlackForest\PiwikBundle\Entity\PiwikCurrency $currency)
{
$this->currencies[] = $currency;
return $this;
} | php | public function addCurrency(\BlackForest\PiwikBundle\Entity\PiwikCurrency $currency)
{
$this->currencies[] = $currency;
return $this;
} | [
"public",
"function",
"addCurrency",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikCurrency",
"$",
"currency",
")",
"{",
"$",
"this",
"->",
"currencies",
"[",
"]",
"=",
"$",
"currency",
";",
"return",
"$",
"this",
";",
"}"
] | Add currency.
@param \BlackForest\PiwikBundle\Entity\PiwikCurrency $currency
@return PiwikSite | [
"Add",
"currency",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1293-L1298 |
4,057 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeCurrency | public function removeCurrency(\BlackForest\PiwikBundle\Entity\PiwikCurrency $currency)
{
return $this->currencies->removeElement($currency);
} | php | public function removeCurrency(\BlackForest\PiwikBundle\Entity\PiwikCurrency $currency)
{
return $this->currencies->removeElement($currency);
} | [
"public",
"function",
"removeCurrency",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikCurrency",
"$",
"currency",
")",
"{",
"return",
"$",
"this",
"->",
"currencies",
"->",
"removeElement",
"(",
"$",
"currency",
")",
";",
"}"
] | Remove currency.
@param \BlackForest\PiwikBundle\Entity\PiwikCurrency $currency
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"currency",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1307-L1310 |
4,058 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeAction | public function removeAction(\BlackForest\PiwikBundle\Entity\PiwikAction $action)
{
return $this->action->removeElement($action);
} | php | public function removeAction(\BlackForest\PiwikBundle\Entity\PiwikAction $action)
{
return $this->action->removeElement($action);
} | [
"public",
"function",
"removeAction",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikAction",
"$",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"action",
"->",
"removeElement",
"(",
"$",
"action",
")",
";",
"}"
] | Remove action.
@param \BlackForest\PiwikBundle\Entity\PiwikAction $action
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"action",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1379-L1382 |
4,059 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addActionType | public function addActionType(\BlackForest\PiwikBundle\Entity\PiwikActionType $actionType)
{
$this->actionType[] = $actionType;
return $this;
} | php | public function addActionType(\BlackForest\PiwikBundle\Entity\PiwikActionType $actionType)
{
$this->actionType[] = $actionType;
return $this;
} | [
"public",
"function",
"addActionType",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikActionType",
"$",
"actionType",
")",
"{",
"$",
"this",
"->",
"actionType",
"[",
"]",
"=",
"$",
"actionType",
";",
"return",
"$",
"this",
";",
"}"
] | Add actionType.
@param \BlackForest\PiwikBundle\Entity\PiwikActionType $actionType
@return PiwikSite | [
"Add",
"actionType",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1401-L1406 |
4,060 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removeActionType | public function removeActionType(\BlackForest\PiwikBundle\Entity\PiwikActionType $actionType)
{
return $this->actionType->removeElement($actionType);
} | php | public function removeActionType(\BlackForest\PiwikBundle\Entity\PiwikActionType $actionType)
{
return $this->actionType->removeElement($actionType);
} | [
"public",
"function",
"removeActionType",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikActionType",
"$",
"actionType",
")",
"{",
"return",
"$",
"this",
"->",
"actionType",
"->",
"removeElement",
"(",
"$",
"actionType",
")",
";",
"}"
] | Remove actionType.
@param \BlackForest\PiwikBundle\Entity\PiwikActionType $actionType
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"actionType",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1415-L1418 |
4,061 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.addPlugin | public function addPlugin(\BlackForest\PiwikBundle\Entity\PiwikPlugin $plugin)
{
$this->plugin[] = $plugin;
return $this;
} | php | public function addPlugin(\BlackForest\PiwikBundle\Entity\PiwikPlugin $plugin)
{
$this->plugin[] = $plugin;
return $this;
} | [
"public",
"function",
"addPlugin",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikPlugin",
"$",
"plugin",
")",
"{",
"$",
"this",
"->",
"plugin",
"[",
"]",
"=",
"$",
"plugin",
";",
"return",
"$",
"this",
";",
"}"
] | Add plugin.
@param \BlackForest\PiwikBundle\Entity\PiwikPlugin $plugin
@return PiwikSite | [
"Add",
"plugin",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1437-L1442 |
4,062 | black-forest/piwik-bundle | src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php | PiwikSite.removePlugin | public function removePlugin(\BlackForest\PiwikBundle\Entity\PiwikPlugin $plugin)
{
return $this->plugin->removeElement($plugin);
} | php | public function removePlugin(\BlackForest\PiwikBundle\Entity\PiwikPlugin $plugin)
{
return $this->plugin->removeElement($plugin);
} | [
"public",
"function",
"removePlugin",
"(",
"\\",
"BlackForest",
"\\",
"PiwikBundle",
"\\",
"Entity",
"\\",
"PiwikPlugin",
"$",
"plugin",
")",
"{",
"return",
"$",
"this",
"->",
"plugin",
"->",
"removeElement",
"(",
"$",
"plugin",
")",
";",
"}"
] | Remove plugin.
@param \BlackForest\PiwikBundle\Entity\PiwikPlugin $plugin
@return boolean TRUE if this collection contained the specified element, FALSE otherwise. | [
"Remove",
"plugin",
"."
] | be1000f898f9583bb4ecbe4ca1933ab7b7e0e785 | https://github.com/black-forest/piwik-bundle/blob/be1000f898f9583bb4ecbe4ca1933ab7b7e0e785/src/Resources/doctrine/BlackForest/PiwikBundle/Entity/PiwikSite.php#L1451-L1454 |
4,063 | agencms/core | src/Route.php | Route.init | public static function init($slug, $name, $endpoints = null, $type = Config::TYPE_COLLECTION)
{
$instance = new static();
$instance->route = [];
if (is_array($name)) {
$section = key($name);
$name = $name[$section];
} else {
$section = $name;
}
$instance->route['slug'] = $slug;
$instance->route['name'] = $name;
$instance->route['section'] = $section;
$instance->route['type'] = $type;
$instance->route['endpoints'] = self::makeEndpoints($endpoints);
$instance->route['groups'] = collect([]);
$instance->route['icon'] = 'filter_list';
return $instance;
} | php | public static function init($slug, $name, $endpoints = null, $type = Config::TYPE_COLLECTION)
{
$instance = new static();
$instance->route = [];
if (is_array($name)) {
$section = key($name);
$name = $name[$section];
} else {
$section = $name;
}
$instance->route['slug'] = $slug;
$instance->route['name'] = $name;
$instance->route['section'] = $section;
$instance->route['type'] = $type;
$instance->route['endpoints'] = self::makeEndpoints($endpoints);
$instance->route['groups'] = collect([]);
$instance->route['icon'] = 'filter_list';
return $instance;
} | [
"public",
"static",
"function",
"init",
"(",
"$",
"slug",
",",
"$",
"name",
",",
"$",
"endpoints",
"=",
"null",
",",
"$",
"type",
"=",
"Config",
"::",
"TYPE_COLLECTION",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
"(",
")",
";",
"$",
"instance",
"->",
"route",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"section",
"=",
"key",
"(",
"$",
"name",
")",
";",
"$",
"name",
"=",
"$",
"name",
"[",
"$",
"section",
"]",
";",
"}",
"else",
"{",
"$",
"section",
"=",
"$",
"name",
";",
"}",
"$",
"instance",
"->",
"route",
"[",
"'slug'",
"]",
"=",
"$",
"slug",
";",
"$",
"instance",
"->",
"route",
"[",
"'name'",
"]",
"=",
"$",
"name",
";",
"$",
"instance",
"->",
"route",
"[",
"'section'",
"]",
"=",
"$",
"section",
";",
"$",
"instance",
"->",
"route",
"[",
"'type'",
"]",
"=",
"$",
"type",
";",
"$",
"instance",
"->",
"route",
"[",
"'endpoints'",
"]",
"=",
"self",
"::",
"makeEndpoints",
"(",
"$",
"endpoints",
")",
";",
"$",
"instance",
"->",
"route",
"[",
"'groups'",
"]",
"=",
"collect",
"(",
"[",
"]",
")",
";",
"$",
"instance",
"->",
"route",
"[",
"'icon'",
"]",
"=",
"'filter_list'",
";",
"return",
"$",
"instance",
";",
"}"
] | Initialise a new route. This must be called before any other method on the class
@param string $slug
@param string $name
@param string|Array $endpoints
@param string $type
@return Agencms\Core\Route | [
"Initialise",
"a",
"new",
"route",
".",
"This",
"must",
"be",
"called",
"before",
"any",
"other",
"method",
"on",
"the",
"class"
] | 67a20e1889fb4f8548a38b66ff0abf72194bb49e | https://github.com/agencms/core/blob/67a20e1889fb4f8548a38b66ff0abf72194bb49e/src/Route.php#L36-L58 |
4,064 | agencms/core | src/Route.php | Route.load | public static function load(string $slug)
{
$instance = new static();
$instance->route = [];
$instance->route['slug'] = $slug;
$instance->route['groups'] = collect([]);
return $instance;
} | php | public static function load(string $slug)
{
$instance = new static();
$instance->route = [];
$instance->route['slug'] = $slug;
$instance->route['groups'] = collect([]);
return $instance;
} | [
"public",
"static",
"function",
"load",
"(",
"string",
"$",
"slug",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
"(",
")",
";",
"$",
"instance",
"->",
"route",
"=",
"[",
"]",
";",
"$",
"instance",
"->",
"route",
"[",
"'slug'",
"]",
"=",
"$",
"slug",
";",
"$",
"instance",
"->",
"route",
"[",
"'groups'",
"]",
"=",
"collect",
"(",
"[",
"]",
")",
";",
"return",
"$",
"instance",
";",
"}"
] | Creates a new Route instance for merging into an existing route collection
@param string $slug
@return Agencms\Core\Route | [
"Creates",
"a",
"new",
"Route",
"instance",
"for",
"merging",
"into",
"an",
"existing",
"route",
"collection"
] | 67a20e1889fb4f8548a38b66ff0abf72194bb49e | https://github.com/agencms/core/blob/67a20e1889fb4f8548a38b66ff0abf72194bb49e/src/Route.php#L66-L75 |
4,065 | agencms/core | src/Route.php | Route.initSingle | public static function initSingle($slug, $name, $endpoints = [])
{
return self::init($slug, $name, $endpoints, Config::TYPE_SINGLE);
} | php | public static function initSingle($slug, $name, $endpoints = [])
{
return self::init($slug, $name, $endpoints, Config::TYPE_SINGLE);
} | [
"public",
"static",
"function",
"initSingle",
"(",
"$",
"slug",
",",
"$",
"name",
",",
"$",
"endpoints",
"=",
"[",
"]",
")",
"{",
"return",
"self",
"::",
"init",
"(",
"$",
"slug",
",",
"$",
"name",
",",
"$",
"endpoints",
",",
"Config",
"::",
"TYPE_SINGLE",
")",
";",
"}"
] | Initialise a new single record style route.
@param string $slug
@param string $name
@param string|Array $endpoints
@return Agencms\Core\Route | [
"Initialise",
"a",
"new",
"single",
"record",
"style",
"route",
"."
] | 67a20e1889fb4f8548a38b66ff0abf72194bb49e | https://github.com/agencms/core/blob/67a20e1889fb4f8548a38b66ff0abf72194bb49e/src/Route.php#L85-L88 |
4,066 | agencms/core | src/Route.php | Route.generateCrudEndpoints | public static function generateCrudEndpoints(string $permission, string $endpoint)
{
return collect(self::ROUTE_CRUD_PERMISSION)
->map(function ($suffix, $method) use ($permission, $endpoint) {
if (Gate::allows("{$permission}_{$suffix}")) {
return [$method => $endpoint];
}
})->collapse();
} | php | public static function generateCrudEndpoints(string $permission, string $endpoint)
{
return collect(self::ROUTE_CRUD_PERMISSION)
->map(function ($suffix, $method) use ($permission, $endpoint) {
if (Gate::allows("{$permission}_{$suffix}")) {
return [$method => $endpoint];
}
})->collapse();
} | [
"public",
"static",
"function",
"generateCrudEndpoints",
"(",
"string",
"$",
"permission",
",",
"string",
"$",
"endpoint",
")",
"{",
"return",
"collect",
"(",
"self",
"::",
"ROUTE_CRUD_PERMISSION",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"suffix",
",",
"$",
"method",
")",
"use",
"(",
"$",
"permission",
",",
"$",
"endpoint",
")",
"{",
"if",
"(",
"Gate",
"::",
"allows",
"(",
"\"{$permission}_{$suffix}\"",
")",
")",
"{",
"return",
"[",
"$",
"method",
"=>",
"$",
"endpoint",
"]",
";",
"}",
"}",
")",
"->",
"collapse",
"(",
")",
";",
"}"
] | Creates a valid array of required endpoints based on the user's permissions
@param string $permission
@param string $endpoint
@return Array | [
"Creates",
"a",
"valid",
"array",
"of",
"required",
"endpoints",
"based",
"on",
"the",
"user",
"s",
"permissions"
] | 67a20e1889fb4f8548a38b66ff0abf72194bb49e | https://github.com/agencms/core/blob/67a20e1889fb4f8548a38b66ff0abf72194bb49e/src/Route.php#L97-L105 |
4,067 | agencms/core | src/Route.php | Route.makeEndpoints | private static function makeEndpoints($endpoints)
{
if (is_string($endpoints)) {
return self::makeEndpointsFromString($endpoints, self::ROUTE_METHODS);
}
return $endpoints;
} | php | private static function makeEndpoints($endpoints)
{
if (is_string($endpoints)) {
return self::makeEndpointsFromString($endpoints, self::ROUTE_METHODS);
}
return $endpoints;
} | [
"private",
"static",
"function",
"makeEndpoints",
"(",
"$",
"endpoints",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"endpoints",
")",
")",
"{",
"return",
"self",
"::",
"makeEndpointsFromString",
"(",
"$",
"endpoints",
",",
"self",
"::",
"ROUTE_METHODS",
")",
";",
"}",
"return",
"$",
"endpoints",
";",
"}"
] | Creates a valid array of required endpoints
@param string $endpoints
@return Array | [
"Creates",
"a",
"valid",
"array",
"of",
"required",
"endpoints"
] | 67a20e1889fb4f8548a38b66ff0abf72194bb49e | https://github.com/agencms/core/blob/67a20e1889fb4f8548a38b66ff0abf72194bb49e/src/Route.php#L113-L120 |
4,068 | agencms/core | src/Route.php | Route.makeEndpointsFromString | private static function makeEndpointsFromString($endpoint, $methods)
{
return collect($methods)->map(function ($method) use ($endpoint) {
return [$method => $endpoint];
})->collapse();
} | php | private static function makeEndpointsFromString($endpoint, $methods)
{
return collect($methods)->map(function ($method) use ($endpoint) {
return [$method => $endpoint];
})->collapse();
} | [
"private",
"static",
"function",
"makeEndpointsFromString",
"(",
"$",
"endpoint",
",",
"$",
"methods",
")",
"{",
"return",
"collect",
"(",
"$",
"methods",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"method",
")",
"use",
"(",
"$",
"endpoint",
")",
"{",
"return",
"[",
"$",
"method",
"=>",
"$",
"endpoint",
"]",
";",
"}",
")",
"->",
"collapse",
"(",
")",
";",
"}"
] | Creates a valid array of endpoints from a single endpoint
@param string $endpoint
@param Array $methods
@return Array | [
"Creates",
"a",
"valid",
"array",
"of",
"endpoints",
"from",
"a",
"single",
"endpoint"
] | 67a20e1889fb4f8548a38b66ff0abf72194bb49e | https://github.com/agencms/core/blob/67a20e1889fb4f8548a38b66ff0abf72194bb49e/src/Route.php#L129-L134 |
4,069 | agencms/core | src/Route.php | Route.addGroup | public function addGroup(...$groups)
{
collect($groups)->map(function ($group) {
$this->route['groups'][] = $group->get();
});
return $this;
} | php | public function addGroup(...$groups)
{
collect($groups)->map(function ($group) {
$this->route['groups'][] = $group->get();
});
return $this;
} | [
"public",
"function",
"addGroup",
"(",
"...",
"$",
"groups",
")",
"{",
"collect",
"(",
"$",
"groups",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"group",
")",
"{",
"$",
"this",
"->",
"route",
"[",
"'groups'",
"]",
"[",
"]",
"=",
"$",
"group",
"->",
"get",
"(",
")",
";",
"}",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Registers a new API endpoint group
@param Agencms\Core\Group ...$groups
@return Agencms\Core\Route | [
"Registers",
"a",
"new",
"API",
"endpoint",
"group"
] | 67a20e1889fb4f8548a38b66ff0abf72194bb49e | https://github.com/agencms/core/blob/67a20e1889fb4f8548a38b66ff0abf72194bb49e/src/Route.php#L142-L149 |
4,070 | SocietyCMS/User | Repositories/Entrust/EntrustRoleRepository.php | EntrustRoleRepository.create | public function create(array $data)
{
if (! array_key_exists('name', $data)) {
$data['name'] = Str::slug($data['display_name']);
}
return parent::create($data);
} | php | public function create(array $data)
{
if (! array_key_exists('name', $data)) {
$data['name'] = Str::slug($data['display_name']);
}
return parent::create($data);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'name'",
",",
"$",
"data",
")",
")",
"{",
"$",
"data",
"[",
"'name'",
"]",
"=",
"Str",
"::",
"slug",
"(",
"$",
"data",
"[",
"'display_name'",
"]",
")",
";",
"}",
"return",
"parent",
"::",
"create",
"(",
"$",
"data",
")",
";",
"}"
] | create name before creating a new role instance.
@param array $data
@return EloquentRole | [
"create",
"name",
"before",
"creating",
"a",
"new",
"role",
"instance",
"."
] | 76f7b52b27e8a9740f8d5a9c3b86181e1c231634 | https://github.com/SocietyCMS/User/blob/76f7b52b27e8a9740f8d5a9c3b86181e1c231634/Repositories/Entrust/EntrustRoleRepository.php#L28-L35 |
4,071 | Clastic/MediaBundle | Controller/BrowserController.php | BrowserController.directoryAction | public function directoryAction(Request $request)
{
$id = $request->query->get('id');
$parent = null;
if (intval($id)) {
$em = $this->getDoctrine()->getManager();
$parent = $em->getReference('ClasticMediaBundle:Directory', $id);
}
$directories = $this->getDoctrine()->getRepository('ClasticMediaBundle:Directory')
->findBy(array(
'parent' => $parent,
));
$data = array_map(function (Directory $directory) use ($parent) {
return array(
'id' => $directory->getId(),
'text' => $directory->getName(),
'children' => true,
'state' => array(
'disabled' => false,
'opened' => !$parent,
'selected' => !$parent,
),
);
}, $directories);
return new JsonResponse($data);
} | php | public function directoryAction(Request $request)
{
$id = $request->query->get('id');
$parent = null;
if (intval($id)) {
$em = $this->getDoctrine()->getManager();
$parent = $em->getReference('ClasticMediaBundle:Directory', $id);
}
$directories = $this->getDoctrine()->getRepository('ClasticMediaBundle:Directory')
->findBy(array(
'parent' => $parent,
));
$data = array_map(function (Directory $directory) use ($parent) {
return array(
'id' => $directory->getId(),
'text' => $directory->getName(),
'children' => true,
'state' => array(
'disabled' => false,
'opened' => !$parent,
'selected' => !$parent,
),
);
}, $directories);
return new JsonResponse($data);
} | [
"public",
"function",
"directoryAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"id",
"=",
"$",
"request",
"->",
"query",
"->",
"get",
"(",
"'id'",
")",
";",
"$",
"parent",
"=",
"null",
";",
"if",
"(",
"intval",
"(",
"$",
"id",
")",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"parent",
"=",
"$",
"em",
"->",
"getReference",
"(",
"'ClasticMediaBundle:Directory'",
",",
"$",
"id",
")",
";",
"}",
"$",
"directories",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getRepository",
"(",
"'ClasticMediaBundle:Directory'",
")",
"->",
"findBy",
"(",
"array",
"(",
"'parent'",
"=>",
"$",
"parent",
",",
")",
")",
";",
"$",
"data",
"=",
"array_map",
"(",
"function",
"(",
"Directory",
"$",
"directory",
")",
"use",
"(",
"$",
"parent",
")",
"{",
"return",
"array",
"(",
"'id'",
"=>",
"$",
"directory",
"->",
"getId",
"(",
")",
",",
"'text'",
"=>",
"$",
"directory",
"->",
"getName",
"(",
")",
",",
"'children'",
"=>",
"true",
",",
"'state'",
"=>",
"array",
"(",
"'disabled'",
"=>",
"false",
",",
"'opened'",
"=>",
"!",
"$",
"parent",
",",
"'selected'",
"=>",
"!",
"$",
"parent",
",",
")",
",",
")",
";",
"}",
",",
"$",
"directories",
")",
";",
"return",
"new",
"JsonResponse",
"(",
"$",
"data",
")",
";",
"}"
] | Get all directories.
@param Request $request
@return JsonResponse
@throws \Doctrine\ORM\ORMException | [
"Get",
"all",
"directories",
"."
] | cf0de450763f834ab1d1989b1ad06ec8f8e4de44 | https://github.com/Clastic/MediaBundle/blob/cf0de450763f834ab1d1989b1ad06ec8f8e4de44/Controller/BrowserController.php#L34-L64 |
4,072 | Clastic/MediaBundle | Controller/BrowserController.php | BrowserController.filesAction | public function filesAction(Request $request)
{
$id = $request->query->get('id');
$em = $this->getDoctrine()->getManager();
$files = $this->getDoctrine()->getRepository('ClasticMediaBundle:File')
->findBy(array(
'directory' => $em->getReference('ClasticMediaBundle:Directory', $id),
));
$data = array_map(function (File $file) {
return array(
'id' => $file->getId(),
'text' => $file->getName(),
'path' => '/uploads/documents/'.$file->getPath(),
);
}, $files);
return new JsonResponse($data);
} | php | public function filesAction(Request $request)
{
$id = $request->query->get('id');
$em = $this->getDoctrine()->getManager();
$files = $this->getDoctrine()->getRepository('ClasticMediaBundle:File')
->findBy(array(
'directory' => $em->getReference('ClasticMediaBundle:Directory', $id),
));
$data = array_map(function (File $file) {
return array(
'id' => $file->getId(),
'text' => $file->getName(),
'path' => '/uploads/documents/'.$file->getPath(),
);
}, $files);
return new JsonResponse($data);
} | [
"public",
"function",
"filesAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"id",
"=",
"$",
"request",
"->",
"query",
"->",
"get",
"(",
"'id'",
")",
";",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"files",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getRepository",
"(",
"'ClasticMediaBundle:File'",
")",
"->",
"findBy",
"(",
"array",
"(",
"'directory'",
"=>",
"$",
"em",
"->",
"getReference",
"(",
"'ClasticMediaBundle:Directory'",
",",
"$",
"id",
")",
",",
")",
")",
";",
"$",
"data",
"=",
"array_map",
"(",
"function",
"(",
"File",
"$",
"file",
")",
"{",
"return",
"array",
"(",
"'id'",
"=>",
"$",
"file",
"->",
"getId",
"(",
")",
",",
"'text'",
"=>",
"$",
"file",
"->",
"getName",
"(",
")",
",",
"'path'",
"=>",
"'/uploads/documents/'",
".",
"$",
"file",
"->",
"getPath",
"(",
")",
",",
")",
";",
"}",
",",
"$",
"files",
")",
";",
"return",
"new",
"JsonResponse",
"(",
"$",
"data",
")",
";",
"}"
] | Get all files is a specific folder.
@param Request $request
@return JsonResponse | [
"Get",
"all",
"files",
"is",
"a",
"specific",
"folder",
"."
] | cf0de450763f834ab1d1989b1ad06ec8f8e4de44 | https://github.com/Clastic/MediaBundle/blob/cf0de450763f834ab1d1989b1ad06ec8f8e4de44/Controller/BrowserController.php#L73-L92 |
4,073 | CakeCMS/Extensions | src/Migration/Migration.php | Migration.getData | public function getData()
{
$data = [];
$path = $this->getPath();
$dir = new Folder($path);
$files = (array) $dir->find('.*\.php');
if (count($files) > 0) {
foreach ($files as $file) {
$name = FS::filename($file);
$segments = explode('_', $name);
$version = array_shift($segments);
$class = Inflector::camelize(implode('_', $segments));
$data[$version] = [
'class' => $class,
'path' => $path . DS . $file
];
}
}
return $data;
} | php | public function getData()
{
$data = [];
$path = $this->getPath();
$dir = new Folder($path);
$files = (array) $dir->find('.*\.php');
if (count($files) > 0) {
foreach ($files as $file) {
$name = FS::filename($file);
$segments = explode('_', $name);
$version = array_shift($segments);
$class = Inflector::camelize(implode('_', $segments));
$data[$version] = [
'class' => $class,
'path' => $path . DS . $file
];
}
}
return $data;
} | [
"public",
"function",
"getData",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
";",
"$",
"dir",
"=",
"new",
"Folder",
"(",
"$",
"path",
")",
";",
"$",
"files",
"=",
"(",
"array",
")",
"$",
"dir",
"->",
"find",
"(",
"'.*\\.php'",
")",
";",
"if",
"(",
"count",
"(",
"$",
"files",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"name",
"=",
"FS",
"::",
"filename",
"(",
"$",
"file",
")",
";",
"$",
"segments",
"=",
"explode",
"(",
"'_'",
",",
"$",
"name",
")",
";",
"$",
"version",
"=",
"array_shift",
"(",
"$",
"segments",
")",
";",
"$",
"class",
"=",
"Inflector",
"::",
"camelize",
"(",
"implode",
"(",
"'_'",
",",
"$",
"segments",
")",
")",
";",
"$",
"data",
"[",
"$",
"version",
"]",
"=",
"[",
"'class'",
"=>",
"$",
"class",
",",
"'path'",
"=>",
"$",
"path",
".",
"DS",
".",
"$",
"file",
"]",
";",
"}",
"}",
"return",
"$",
"data",
";",
"}"
] | Get data for migration.
@return array
@throws \Cake\Core\Exception\MissingPluginException | [
"Get",
"data",
"for",
"migration",
"."
] | 5c719a8283ff2bc5499658f2ef3d6932d26c55e6 | https://github.com/CakeCMS/Extensions/blob/5c719a8283ff2bc5499658f2ef3d6932d26c55e6/src/Migration/Migration.php#L57-L79 |
4,074 | tomk79/php-excellent-db | php/validator.php | validator.validate_table | public function validate_table($table_name, $input_data){
$errors = array();
$table_definition = $this->exdb->get_table_definition( $table_name );
if( !@$table_definition ){
$errors[':common'] = 'Table NOT Exists';
return $errors;
}
// 余計な値が送られていないかチェック
foreach( $input_data as $key=>$val ){
if( !@$table_definition->columns->{$key} ){
$errors[':common'] = '"'.$key.'" is NOT Exists in table "'.$table_name.'".';
}
}
// --------------------------------------
// 入力値のチェック
foreach( $table_definition->columns as $column_definition ){
if( !array_key_exists($column_definition->name, $input_data) ){
// `$input_data` に含まれていないキーは調べない
continue;
}
$value = @$input_data[$column_definition->name];
$restrictions = array();
if($column_definition->not_null){
$restrictions['required'] = true;
}
$detect_errors = $this->detect_errors($value, $column_definition->type, $restrictions);
if( count($detect_errors) ){
$errors[$column_definition->name] = implode(' ', $detect_errors);
continue;
}
// FOREIGN KEY 制約
if( $column_definition->foreign_key ){
$foreign_key = explode( '.', $column_definition->foreign_key );
$foreign_row = $this->exdb->select(
$foreign_key[0],
array(
$foreign_key[1] => $value,
),
array(
'limit' => 1
)
);
if( !$foreign_row ){
$errors[$column_definition->name] = 'Foreign key is not exists.';
continue;
}
unset($foreign_key, $foreign_row);
}
}
return $errors;
} | php | public function validate_table($table_name, $input_data){
$errors = array();
$table_definition = $this->exdb->get_table_definition( $table_name );
if( !@$table_definition ){
$errors[':common'] = 'Table NOT Exists';
return $errors;
}
// 余計な値が送られていないかチェック
foreach( $input_data as $key=>$val ){
if( !@$table_definition->columns->{$key} ){
$errors[':common'] = '"'.$key.'" is NOT Exists in table "'.$table_name.'".';
}
}
// --------------------------------------
// 入力値のチェック
foreach( $table_definition->columns as $column_definition ){
if( !array_key_exists($column_definition->name, $input_data) ){
// `$input_data` に含まれていないキーは調べない
continue;
}
$value = @$input_data[$column_definition->name];
$restrictions = array();
if($column_definition->not_null){
$restrictions['required'] = true;
}
$detect_errors = $this->detect_errors($value, $column_definition->type, $restrictions);
if( count($detect_errors) ){
$errors[$column_definition->name] = implode(' ', $detect_errors);
continue;
}
// FOREIGN KEY 制約
if( $column_definition->foreign_key ){
$foreign_key = explode( '.', $column_definition->foreign_key );
$foreign_row = $this->exdb->select(
$foreign_key[0],
array(
$foreign_key[1] => $value,
),
array(
'limit' => 1
)
);
if( !$foreign_row ){
$errors[$column_definition->name] = 'Foreign key is not exists.';
continue;
}
unset($foreign_key, $foreign_row);
}
}
return $errors;
} | [
"public",
"function",
"validate_table",
"(",
"$",
"table_name",
",",
"$",
"input_data",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"$",
"table_definition",
"=",
"$",
"this",
"->",
"exdb",
"->",
"get_table_definition",
"(",
"$",
"table_name",
")",
";",
"if",
"(",
"!",
"@",
"$",
"table_definition",
")",
"{",
"$",
"errors",
"[",
"':common'",
"]",
"=",
"'Table NOT Exists'",
";",
"return",
"$",
"errors",
";",
"}",
"// 余計な値が送られていないかチェック",
"foreach",
"(",
"$",
"input_data",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"!",
"@",
"$",
"table_definition",
"->",
"columns",
"->",
"{",
"$",
"key",
"}",
")",
"{",
"$",
"errors",
"[",
"':common'",
"]",
"=",
"'\"'",
".",
"$",
"key",
".",
"'\" is NOT Exists in table \"'",
".",
"$",
"table_name",
".",
"'\".'",
";",
"}",
"}",
"// --------------------------------------",
"// 入力値のチェック",
"foreach",
"(",
"$",
"table_definition",
"->",
"columns",
"as",
"$",
"column_definition",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"column_definition",
"->",
"name",
",",
"$",
"input_data",
")",
")",
"{",
"// `$input_data` に含まれていないキーは調べない",
"continue",
";",
"}",
"$",
"value",
"=",
"@",
"$",
"input_data",
"[",
"$",
"column_definition",
"->",
"name",
"]",
";",
"$",
"restrictions",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"column_definition",
"->",
"not_null",
")",
"{",
"$",
"restrictions",
"[",
"'required'",
"]",
"=",
"true",
";",
"}",
"$",
"detect_errors",
"=",
"$",
"this",
"->",
"detect_errors",
"(",
"$",
"value",
",",
"$",
"column_definition",
"->",
"type",
",",
"$",
"restrictions",
")",
";",
"if",
"(",
"count",
"(",
"$",
"detect_errors",
")",
")",
"{",
"$",
"errors",
"[",
"$",
"column_definition",
"->",
"name",
"]",
"=",
"implode",
"(",
"' '",
",",
"$",
"detect_errors",
")",
";",
"continue",
";",
"}",
"// FOREIGN KEY 制約",
"if",
"(",
"$",
"column_definition",
"->",
"foreign_key",
")",
"{",
"$",
"foreign_key",
"=",
"explode",
"(",
"'.'",
",",
"$",
"column_definition",
"->",
"foreign_key",
")",
";",
"$",
"foreign_row",
"=",
"$",
"this",
"->",
"exdb",
"->",
"select",
"(",
"$",
"foreign_key",
"[",
"0",
"]",
",",
"array",
"(",
"$",
"foreign_key",
"[",
"1",
"]",
"=>",
"$",
"value",
",",
")",
",",
"array",
"(",
"'limit'",
"=>",
"1",
")",
")",
";",
"if",
"(",
"!",
"$",
"foreign_row",
")",
"{",
"$",
"errors",
"[",
"$",
"column_definition",
"->",
"name",
"]",
"=",
"'Foreign key is not exists.'",
";",
"continue",
";",
"}",
"unset",
"(",
"$",
"foreign_key",
",",
"$",
"foreign_row",
")",
";",
"}",
"}",
"return",
"$",
"errors",
";",
"}"
] | Validate Table Values
@param string $table_name テーブル名
@param array $input_data 入力データ
@return array エラー配列 | [
"Validate",
"Table",
"Values"
] | deeacf64c090fc5647267a06f97c3fb60fdf8f68 | https://github.com/tomk79/php-excellent-db/blob/deeacf64c090fc5647267a06f97c3fb60fdf8f68/php/validator.php#L31-L88 |
4,075 | tomk79/php-excellent-db | php/validator.php | validator.detect_errors | public function detect_errors($value, $type, $restrictions = array()){
$errors = array();
$is_required = @$restrictions['required'];
if( $is_required && !strlen($value) ){
// NOT NULL 制約
// 空白文字も NULL と同様に扱う
array_push($errors, 'Required.');
return $errors;
}
if( !$is_required && !strlen($value) ){
// NOT NULL 制約 がなくて値が空白の場合
// 空白文字も NULL と同様に扱う
return $errors;
}
$type_info = $this->exdb->form_elements()->get_type_info($type);
if( is_callable($type_info['validate']) ){
$errors = $type_info['validate']($value, $restrictions);
}
return $errors;
} | php | public function detect_errors($value, $type, $restrictions = array()){
$errors = array();
$is_required = @$restrictions['required'];
if( $is_required && !strlen($value) ){
// NOT NULL 制約
// 空白文字も NULL と同様に扱う
array_push($errors, 'Required.');
return $errors;
}
if( !$is_required && !strlen($value) ){
// NOT NULL 制約 がなくて値が空白の場合
// 空白文字も NULL と同様に扱う
return $errors;
}
$type_info = $this->exdb->form_elements()->get_type_info($type);
if( is_callable($type_info['validate']) ){
$errors = $type_info['validate']($value, $restrictions);
}
return $errors;
} | [
"public",
"function",
"detect_errors",
"(",
"$",
"value",
",",
"$",
"type",
",",
"$",
"restrictions",
"=",
"array",
"(",
")",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"$",
"is_required",
"=",
"@",
"$",
"restrictions",
"[",
"'required'",
"]",
";",
"if",
"(",
"$",
"is_required",
"&&",
"!",
"strlen",
"(",
"$",
"value",
")",
")",
"{",
"// NOT NULL 制約",
"// 空白文字も NULL と同様に扱う",
"array_push",
"(",
"$",
"errors",
",",
"'Required.'",
")",
";",
"return",
"$",
"errors",
";",
"}",
"if",
"(",
"!",
"$",
"is_required",
"&&",
"!",
"strlen",
"(",
"$",
"value",
")",
")",
"{",
"// NOT NULL 制約 がなくて値が空白の場合",
"// 空白文字も NULL と同様に扱う",
"return",
"$",
"errors",
";",
"}",
"$",
"type_info",
"=",
"$",
"this",
"->",
"exdb",
"->",
"form_elements",
"(",
")",
"->",
"get_type_info",
"(",
"$",
"type",
")",
";",
"if",
"(",
"is_callable",
"(",
"$",
"type_info",
"[",
"'validate'",
"]",
")",
")",
"{",
"$",
"errors",
"=",
"$",
"type_info",
"[",
"'validate'",
"]",
"(",
"$",
"value",
",",
"$",
"restrictions",
")",
";",
"}",
"return",
"$",
"errors",
";",
"}"
] | Detect Input Errors
@param string $value Validation target value
@param string $type Data type
@param array $restrictions Restrictions
@return array エラーメッセージを含む配列。 エラーがない場合、0件の配列が返ります。 | [
"Detect",
"Input",
"Errors"
] | deeacf64c090fc5647267a06f97c3fb60fdf8f68 | https://github.com/tomk79/php-excellent-db/blob/deeacf64c090fc5647267a06f97c3fb60fdf8f68/php/validator.php#L97-L118 |
4,076 | bishopb/vanilla | library/core/class.dispatcher.php | Gdn_Dispatcher._MapParts | private function _MapParts($Parts, $ControllerKey) {
$Length = count($Parts);
if ($Length > $ControllerKey)
$this->ControllerName = ucfirst(strtolower($Parts[$ControllerKey]));
if ($Length > $ControllerKey + 1)
list($this->ControllerMethod, $this->_DeliveryMethod) = $this->_SplitDeliveryMethod($Parts[$ControllerKey + 1]);
if ($Length > $ControllerKey + 2) {
for ($i = $ControllerKey + 2; $i < $Length; ++$i) {
if ($Parts[$i] != '')
$this->_ControllerMethodArgs[] = $Parts[$i];
}
}
} | php | private function _MapParts($Parts, $ControllerKey) {
$Length = count($Parts);
if ($Length > $ControllerKey)
$this->ControllerName = ucfirst(strtolower($Parts[$ControllerKey]));
if ($Length > $ControllerKey + 1)
list($this->ControllerMethod, $this->_DeliveryMethod) = $this->_SplitDeliveryMethod($Parts[$ControllerKey + 1]);
if ($Length > $ControllerKey + 2) {
for ($i = $ControllerKey + 2; $i < $Length; ++$i) {
if ($Parts[$i] != '')
$this->_ControllerMethodArgs[] = $Parts[$i];
}
}
} | [
"private",
"function",
"_MapParts",
"(",
"$",
"Parts",
",",
"$",
"ControllerKey",
")",
"{",
"$",
"Length",
"=",
"count",
"(",
"$",
"Parts",
")",
";",
"if",
"(",
"$",
"Length",
">",
"$",
"ControllerKey",
")",
"$",
"this",
"->",
"ControllerName",
"=",
"ucfirst",
"(",
"strtolower",
"(",
"$",
"Parts",
"[",
"$",
"ControllerKey",
"]",
")",
")",
";",
"if",
"(",
"$",
"Length",
">",
"$",
"ControllerKey",
"+",
"1",
")",
"list",
"(",
"$",
"this",
"->",
"ControllerMethod",
",",
"$",
"this",
"->",
"_DeliveryMethod",
")",
"=",
"$",
"this",
"->",
"_SplitDeliveryMethod",
"(",
"$",
"Parts",
"[",
"$",
"ControllerKey",
"+",
"1",
"]",
")",
";",
"if",
"(",
"$",
"Length",
">",
"$",
"ControllerKey",
"+",
"2",
")",
"{",
"for",
"(",
"$",
"i",
"=",
"$",
"ControllerKey",
"+",
"2",
";",
"$",
"i",
"<",
"$",
"Length",
";",
"++",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"Parts",
"[",
"$",
"i",
"]",
"!=",
"''",
")",
"$",
"this",
"->",
"_ControllerMethodArgs",
"[",
"]",
"=",
"$",
"Parts",
"[",
"$",
"i",
"]",
";",
"}",
"}",
"}"
] | An internal method used to map parts of the request to various properties
of this object that represent the controller, controller method, and
controller method arguments.
@param array $Parts An array of parts of the request.
@param int $ControllerKey An integer representing the key of the controller in the $Parts array. | [
"An",
"internal",
"method",
"used",
"to",
"map",
"parts",
"of",
"the",
"request",
"to",
"various",
"properties",
"of",
"this",
"object",
"that",
"represent",
"the",
"controller",
"controller",
"method",
"and",
"controller",
"method",
"arguments",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.dispatcher.php#L679-L693 |
4,077 | bishopb/vanilla | library/core/class.dispatcher.php | Gdn_Dispatcher._SplitDeliveryMethod | protected function _SplitDeliveryMethod($Name, $AllowAll = FALSE) {
$Parts = explode('.', $Name);
if (count($Parts) >= 2) {
$DeliveryPart = array_pop($Parts);
$MethodPart = implode('.', $Parts);
if ($AllowAll || in_array(strtoupper($DeliveryPart), array(DELIVERY_METHOD_JSON, DELIVERY_METHOD_XHTML, DELIVERY_METHOD_XML, DELIVERY_METHOD_TEXT, DELIVERY_METHOD_RSS))) {
return array($MethodPart, strtoupper($DeliveryPart));
} else {
return array($Name, $this->_DeliveryMethod);
}
} else {
return array($Name, $this->_DeliveryMethod);
}
} | php | protected function _SplitDeliveryMethod($Name, $AllowAll = FALSE) {
$Parts = explode('.', $Name);
if (count($Parts) >= 2) {
$DeliveryPart = array_pop($Parts);
$MethodPart = implode('.', $Parts);
if ($AllowAll || in_array(strtoupper($DeliveryPart), array(DELIVERY_METHOD_JSON, DELIVERY_METHOD_XHTML, DELIVERY_METHOD_XML, DELIVERY_METHOD_TEXT, DELIVERY_METHOD_RSS))) {
return array($MethodPart, strtoupper($DeliveryPart));
} else {
return array($Name, $this->_DeliveryMethod);
}
} else {
return array($Name, $this->_DeliveryMethod);
}
} | [
"protected",
"function",
"_SplitDeliveryMethod",
"(",
"$",
"Name",
",",
"$",
"AllowAll",
"=",
"FALSE",
")",
"{",
"$",
"Parts",
"=",
"explode",
"(",
"'.'",
",",
"$",
"Name",
")",
";",
"if",
"(",
"count",
"(",
"$",
"Parts",
")",
">=",
"2",
")",
"{",
"$",
"DeliveryPart",
"=",
"array_pop",
"(",
"$",
"Parts",
")",
";",
"$",
"MethodPart",
"=",
"implode",
"(",
"'.'",
",",
"$",
"Parts",
")",
";",
"if",
"(",
"$",
"AllowAll",
"||",
"in_array",
"(",
"strtoupper",
"(",
"$",
"DeliveryPart",
")",
",",
"array",
"(",
"DELIVERY_METHOD_JSON",
",",
"DELIVERY_METHOD_XHTML",
",",
"DELIVERY_METHOD_XML",
",",
"DELIVERY_METHOD_TEXT",
",",
"DELIVERY_METHOD_RSS",
")",
")",
")",
"{",
"return",
"array",
"(",
"$",
"MethodPart",
",",
"strtoupper",
"(",
"$",
"DeliveryPart",
")",
")",
";",
"}",
"else",
"{",
"return",
"array",
"(",
"$",
"Name",
",",
"$",
"this",
"->",
"_DeliveryMethod",
")",
";",
"}",
"}",
"else",
"{",
"return",
"array",
"(",
"$",
"Name",
",",
"$",
"this",
"->",
"_DeliveryMethod",
")",
";",
"}",
"}"
] | Parses methods that may be using dot-syntax to express a delivery type
For example, /controller/method.json
method.json should be split up and return array('method', 'JSON')
@param type $Name Name of method to search for forced delivery types
@param type $AllowAll Whether to allow delivery types that don't exist
@return type | [
"Parses",
"methods",
"that",
"may",
"be",
"using",
"dot",
"-",
"syntax",
"to",
"express",
"a",
"delivery",
"type"
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.dispatcher.php#L744-L758 |
4,078 | infinity-se/infinity-base | src/InfinityBase/Service/AbstractServiceTrait.php | AbstractServiceTrait.addMessage | protected function addMessage($message, $namespace = FlashMessenger::NAMESPACE_DEFAULT)
{
// Load flashMessenger
if (null === $this->messenger) {
$this->messenger = $this->getServiceLocator()
->get('ControllerPluginManager')
->get('flashMessenger');
}
// Set current namespace
$this->messenger->setNamespace($namespace);
// Add messages
$message = (array) $message;
foreach ($message as $value) {
$this->messenger->addMessage($value);
}
} | php | protected function addMessage($message, $namespace = FlashMessenger::NAMESPACE_DEFAULT)
{
// Load flashMessenger
if (null === $this->messenger) {
$this->messenger = $this->getServiceLocator()
->get('ControllerPluginManager')
->get('flashMessenger');
}
// Set current namespace
$this->messenger->setNamespace($namespace);
// Add messages
$message = (array) $message;
foreach ($message as $value) {
$this->messenger->addMessage($value);
}
} | [
"protected",
"function",
"addMessage",
"(",
"$",
"message",
",",
"$",
"namespace",
"=",
"FlashMessenger",
"::",
"NAMESPACE_DEFAULT",
")",
"{",
"// Load flashMessenger",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"messenger",
")",
"{",
"$",
"this",
"->",
"messenger",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'ControllerPluginManager'",
")",
"->",
"get",
"(",
"'flashMessenger'",
")",
";",
"}",
"// Set current namespace",
"$",
"this",
"->",
"messenger",
"->",
"setNamespace",
"(",
"$",
"namespace",
")",
";",
"// Add messages",
"$",
"message",
"=",
"(",
"array",
")",
"$",
"message",
";",
"foreach",
"(",
"$",
"message",
"as",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"messenger",
"->",
"addMessage",
"(",
"$",
"value",
")",
";",
"}",
"}"
] | Add a message to the flashMessenger
@param string|array $message
@param string $namespace | [
"Add",
"a",
"message",
"to",
"the",
"flashMessenger"
] | 4f869ae4b549e779560a83528d2ed2664f6deb5b | https://github.com/infinity-se/infinity-base/blob/4f869ae4b549e779560a83528d2ed2664f6deb5b/src/InfinityBase/Service/AbstractServiceTrait.php#L38-L55 |
4,079 | infinity-se/infinity-base | src/InfinityBase/Service/AbstractServiceTrait.php | AbstractServiceTrait.getFormElementManager | protected function getFormElementManager()
{
if (null === $this->formElementManager) {
$this->formElementManager = $this->getServiceLocator()
->get('FormElementManager');
}
return $this->formElementManager;
} | php | protected function getFormElementManager()
{
if (null === $this->formElementManager) {
$this->formElementManager = $this->getServiceLocator()
->get('FormElementManager');
}
return $this->formElementManager;
} | [
"protected",
"function",
"getFormElementManager",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"formElementManager",
")",
"{",
"$",
"this",
"->",
"formElementManager",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'FormElementManager'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"formElementManager",
";",
"}"
] | Retrieve form element manager
@return FormElementManager | [
"Retrieve",
"form",
"element",
"manager"
] | 4f869ae4b549e779560a83528d2ed2664f6deb5b | https://github.com/infinity-se/infinity-base/blob/4f869ae4b549e779560a83528d2ed2664f6deb5b/src/InfinityBase/Service/AbstractServiceTrait.php#L62-L69 |
4,080 | infinity-se/infinity-base | src/InfinityBase/Service/AbstractServiceTrait.php | AbstractServiceTrait.getForm | protected function getForm($name)
{
if (!isset($this->form[$name])) {
$this->form[$name] = $this->getServiceLocator()
->get($this->getModuleNamespace() . '\Form\\' . $name);
}
return $this->form[$name];
} | php | protected function getForm($name)
{
if (!isset($this->form[$name])) {
$this->form[$name] = $this->getServiceLocator()
->get($this->getModuleNamespace() . '\Form\\' . $name);
}
return $this->form[$name];
} | [
"protected",
"function",
"getForm",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"form",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"this",
"->",
"form",
"[",
"$",
"name",
"]",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"getModuleNamespace",
"(",
")",
".",
"'\\Form\\\\'",
".",
"$",
"name",
")",
";",
"}",
"return",
"$",
"this",
"->",
"form",
"[",
"$",
"name",
"]",
";",
"}"
] | Retrieve a form
@param string $name
@return Form | [
"Retrieve",
"a",
"form"
] | 4f869ae4b549e779560a83528d2ed2664f6deb5b | https://github.com/infinity-se/infinity-base/blob/4f869ae4b549e779560a83528d2ed2664f6deb5b/src/InfinityBase/Service/AbstractServiceTrait.php#L77-L84 |
4,081 | infinity-se/infinity-base | src/InfinityBase/Service/AbstractServiceTrait.php | AbstractServiceTrait.getMapper | protected function getMapper()
{
if (null === $this->mapper) {
$this->mapper = $this->getServiceLocator()
->get($this->getModuleNamespace() . '\Mapper\\' . $this->getEntityName());
}
return $this->mapper;
} | php | protected function getMapper()
{
if (null === $this->mapper) {
$this->mapper = $this->getServiceLocator()
->get($this->getModuleNamespace() . '\Mapper\\' . $this->getEntityName());
}
return $this->mapper;
} | [
"protected",
"function",
"getMapper",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"mapper",
")",
"{",
"$",
"this",
"->",
"mapper",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"getModuleNamespace",
"(",
")",
".",
"'\\Mapper\\\\'",
".",
"$",
"this",
"->",
"getEntityName",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"mapper",
";",
"}"
] | Retrieve the mapper
@return AccountsMapper | [
"Retrieve",
"the",
"mapper"
] | 4f869ae4b549e779560a83528d2ed2664f6deb5b | https://github.com/infinity-se/infinity-base/blob/4f869ae4b549e779560a83528d2ed2664f6deb5b/src/InfinityBase/Service/AbstractServiceTrait.php#L91-L98 |
4,082 | shov/wpci-core | Http/Drops/Action.php | Action.getCallbackFromReference | protected function getCallbackFromReference($reference): callable
{
$this->reference = $reference;
if(is_callable($reference)) {
if(!is_string($reference)) {
$callback = $reference;
} else {
$parts = explode("::", $reference);
$callback = [new $parts[0](), $parts[1]];
}
} else {
$callback = function () use ($reference) {
new RegularResponse($reference);
};
}
return $callback;
} | php | protected function getCallbackFromReference($reference): callable
{
$this->reference = $reference;
if(is_callable($reference)) {
if(!is_string($reference)) {
$callback = $reference;
} else {
$parts = explode("::", $reference);
$callback = [new $parts[0](), $parts[1]];
}
} else {
$callback = function () use ($reference) {
new RegularResponse($reference);
};
}
return $callback;
} | [
"protected",
"function",
"getCallbackFromReference",
"(",
"$",
"reference",
")",
":",
"callable",
"{",
"$",
"this",
"->",
"reference",
"=",
"$",
"reference",
";",
"if",
"(",
"is_callable",
"(",
"$",
"reference",
")",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"reference",
")",
")",
"{",
"$",
"callback",
"=",
"$",
"reference",
";",
"}",
"else",
"{",
"$",
"parts",
"=",
"explode",
"(",
"\"::\"",
",",
"$",
"reference",
")",
";",
"$",
"callback",
"=",
"[",
"new",
"$",
"parts",
"[",
"0",
"]",
"(",
")",
",",
"$",
"parts",
"[",
"1",
"]",
"]",
";",
"}",
"}",
"else",
"{",
"$",
"callback",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"reference",
")",
"{",
"new",
"RegularResponse",
"(",
"$",
"reference",
")",
";",
"}",
";",
"}",
"return",
"$",
"callback",
";",
"}"
] | Call this when action calling, to make Controller in a time
@param $reference
@return callable | [
"Call",
"this",
"when",
"action",
"calling",
"to",
"make",
"Controller",
"in",
"a",
"time"
] | e31084cbc2f310882df2b9b0548330ea5fdb4f26 | https://github.com/shov/wpci-core/blob/e31084cbc2f310882df2b9b0548330ea5fdb4f26/Http/Drops/Action.php#L49-L66 |
4,083 | SlabPHP/concatenator | src/Items/Base.php | Base.initialize | public function initialize($value, $filters = [])
{
$this->value = $value;
if (empty($filters)) return;
//If a comma separated string is passed in, we can explode on it
if (is_string($filters)) {
$this->filters = explode(',', $filters);
} else if (!is_array($filters)) {
$this->filters = [$this->filters];
} else {
$this->filters = $filters;
}
} | php | public function initialize($value, $filters = [])
{
$this->value = $value;
if (empty($filters)) return;
//If a comma separated string is passed in, we can explode on it
if (is_string($filters)) {
$this->filters = explode(',', $filters);
} else if (!is_array($filters)) {
$this->filters = [$this->filters];
} else {
$this->filters = $filters;
}
} | [
"public",
"function",
"initialize",
"(",
"$",
"value",
",",
"$",
"filters",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"value",
"=",
"$",
"value",
";",
"if",
"(",
"empty",
"(",
"$",
"filters",
")",
")",
"return",
";",
"//If a comma separated string is passed in, we can explode on it",
"if",
"(",
"is_string",
"(",
"$",
"filters",
")",
")",
"{",
"$",
"this",
"->",
"filters",
"=",
"explode",
"(",
"','",
",",
"$",
"filters",
")",
";",
"}",
"else",
"if",
"(",
"!",
"is_array",
"(",
"$",
"filters",
")",
")",
"{",
"$",
"this",
"->",
"filters",
"=",
"[",
"$",
"this",
"->",
"filters",
"]",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"filters",
"=",
"$",
"filters",
";",
"}",
"}"
] | Constructor must have the value and filters
@param $value
@param array $filters | [
"Constructor",
"must",
"have",
"the",
"value",
"and",
"filters"
] | 7ea1f29822a766ecb423845c549a9f9eec6594dd | https://github.com/SlabPHP/concatenator/blob/7ea1f29822a766ecb423845c549a9f9eec6594dd/src/Items/Base.php#L34-L48 |
4,084 | SlabPHP/concatenator | src/Items/Base.php | Base.getData | public function getData()
{
$this->fetchData();
$this->preProcessData();
$this->applyFilters();
$this->postProcessData();
return $this->output;
} | php | public function getData()
{
$this->fetchData();
$this->preProcessData();
$this->applyFilters();
$this->postProcessData();
return $this->output;
} | [
"public",
"function",
"getData",
"(",
")",
"{",
"$",
"this",
"->",
"fetchData",
"(",
")",
";",
"$",
"this",
"->",
"preProcessData",
"(",
")",
";",
"$",
"this",
"->",
"applyFilters",
"(",
")",
";",
"$",
"this",
"->",
"postProcessData",
"(",
")",
";",
"return",
"$",
"this",
"->",
"output",
";",
"}"
] | Get data but supply filters
@return mixed|void | [
"Get",
"data",
"but",
"supply",
"filters"
] | 7ea1f29822a766ecb423845c549a9f9eec6594dd | https://github.com/SlabPHP/concatenator/blob/7ea1f29822a766ecb423845c549a9f9eec6594dd/src/Items/Base.php#L72-L83 |
4,085 | SlabPHP/concatenator | src/Items/Base.php | Base.postProcessData | protected function postProcessData()
{
$comment = "\n/* " . (!empty($this->filters) ? implode('|', $this->filters) . '::' : '') . $this->value . " */\n";
$this->output = $comment . $this->output;
} | php | protected function postProcessData()
{
$comment = "\n/* " . (!empty($this->filters) ? implode('|', $this->filters) . '::' : '') . $this->value . " */\n";
$this->output = $comment . $this->output;
} | [
"protected",
"function",
"postProcessData",
"(",
")",
"{",
"$",
"comment",
"=",
"\"\\n/* \"",
".",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"filters",
")",
"?",
"implode",
"(",
"'|'",
",",
"$",
"this",
"->",
"filters",
")",
".",
"'::'",
":",
"''",
")",
".",
"$",
"this",
"->",
"value",
".",
"\" */\\n\"",
";",
"$",
"this",
"->",
"output",
"=",
"$",
"comment",
".",
"$",
"this",
"->",
"output",
";",
"}"
] | Post process data | [
"Post",
"process",
"data"
] | 7ea1f29822a766ecb423845c549a9f9eec6594dd | https://github.com/SlabPHP/concatenator/blob/7ea1f29822a766ecb423845c549a9f9eec6594dd/src/Items/Base.php#L109-L114 |
4,086 | SlabPHP/concatenator | src/Items/Base.php | Base.getFilterOutput | protected function getFilterOutput($filter, $input)
{
if ($filter[0] == '\\')
{
$filterClass = $filter;
}
else
{
$filterClass = '\Slab\Concatenator\Filters\\' . $filter;
}
if (!class_exists($filterClass))
{
throw new \Exception("Invalid filter class specified: " . $filterClass);
}
/**
* @var \Slab\Concatenator\Filters\FilterInterface $filterObject
*/
$filterObject = new $filterClass();
$filterObject->filter($input);
return $filterObject->getOutput();
} | php | protected function getFilterOutput($filter, $input)
{
if ($filter[0] == '\\')
{
$filterClass = $filter;
}
else
{
$filterClass = '\Slab\Concatenator\Filters\\' . $filter;
}
if (!class_exists($filterClass))
{
throw new \Exception("Invalid filter class specified: " . $filterClass);
}
/**
* @var \Slab\Concatenator\Filters\FilterInterface $filterObject
*/
$filterObject = new $filterClass();
$filterObject->filter($input);
return $filterObject->getOutput();
} | [
"protected",
"function",
"getFilterOutput",
"(",
"$",
"filter",
",",
"$",
"input",
")",
"{",
"if",
"(",
"$",
"filter",
"[",
"0",
"]",
"==",
"'\\\\'",
")",
"{",
"$",
"filterClass",
"=",
"$",
"filter",
";",
"}",
"else",
"{",
"$",
"filterClass",
"=",
"'\\Slab\\Concatenator\\Filters\\\\'",
".",
"$",
"filter",
";",
"}",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"filterClass",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Invalid filter class specified: \"",
".",
"$",
"filterClass",
")",
";",
"}",
"/**\n * @var \\Slab\\Concatenator\\Filters\\FilterInterface $filterObject\n */",
"$",
"filterObject",
"=",
"new",
"$",
"filterClass",
"(",
")",
";",
"$",
"filterObject",
"->",
"filter",
"(",
"$",
"input",
")",
";",
"return",
"$",
"filterObject",
"->",
"getOutput",
"(",
")",
";",
"}"
] | Get filter output
@param $filter
@param $input | [
"Get",
"filter",
"output"
] | 7ea1f29822a766ecb423845c549a9f9eec6594dd | https://github.com/SlabPHP/concatenator/blob/7ea1f29822a766ecb423845c549a9f9eec6594dd/src/Items/Base.php#L122-L146 |
4,087 | ssnepenthe/wp-requirements | src/class-plugin-checker.php | Plugin_Checker.notify | public function notify() {
if ( $this->requirements_met() ) {
return;
}
echo '<div class="notice notice-error">';
foreach ( $this->requirements as $requirement ) {
if ( $requirement->is_met() ) {
continue;
}
printf(
'<p>%s deactivated: %s</p>',
esc_html( $this->name ),
esc_html( $requirement->get_message() )
);
}
echo '</div>';
} | php | public function notify() {
if ( $this->requirements_met() ) {
return;
}
echo '<div class="notice notice-error">';
foreach ( $this->requirements as $requirement ) {
if ( $requirement->is_met() ) {
continue;
}
printf(
'<p>%s deactivated: %s</p>',
esc_html( $this->name ),
esc_html( $requirement->get_message() )
);
}
echo '</div>';
} | [
"public",
"function",
"notify",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"requirements_met",
"(",
")",
")",
"{",
"return",
";",
"}",
"echo",
"'<div class=\"notice notice-error\">'",
";",
"foreach",
"(",
"$",
"this",
"->",
"requirements",
"as",
"$",
"requirement",
")",
"{",
"if",
"(",
"$",
"requirement",
"->",
"is_met",
"(",
")",
")",
"{",
"continue",
";",
"}",
"printf",
"(",
"'<p>%s deactivated: %s</p>'",
",",
"esc_html",
"(",
"$",
"this",
"->",
"name",
")",
",",
"esc_html",
"(",
"$",
"requirement",
"->",
"get_message",
"(",
")",
")",
")",
";",
"}",
"echo",
"'</div>'",
";",
"}"
] | Print an admin notice for each failed requirement. | [
"Print",
"an",
"admin",
"notice",
"for",
"each",
"failed",
"requirement",
"."
] | e805f4c0feb608ff3756c6aa84638217905603df | https://github.com/ssnepenthe/wp-requirements/blob/e805f4c0feb608ff3756c6aa84638217905603df/src/class-plugin-checker.php#L155-L175 |
4,088 | ssnepenthe/wp-requirements | src/class-plugin-checker.php | Plugin_Checker.php_at_least | public function php_at_least( $version ) {
return $this->add_check(
function() use ( $version ) {
return version_compare( phpversion(), $version, '>=' );
},
sprintf( 'PHP %s or newer is required', $version )
);
} | php | public function php_at_least( $version ) {
return $this->add_check(
function() use ( $version ) {
return version_compare( phpversion(), $version, '>=' );
},
sprintf( 'PHP %s or newer is required', $version )
);
} | [
"public",
"function",
"php_at_least",
"(",
"$",
"version",
")",
"{",
"return",
"$",
"this",
"->",
"add_check",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"version",
")",
"{",
"return",
"version_compare",
"(",
"phpversion",
"(",
")",
",",
"$",
"version",
",",
"'>='",
")",
";",
"}",
",",
"sprintf",
"(",
"'PHP %s or newer is required'",
",",
"$",
"version",
")",
")",
";",
"}"
] | Verify that a minimum PHP version is met.
@param string $version Version string.
@return self | [
"Verify",
"that",
"a",
"minimum",
"PHP",
"version",
"is",
"met",
"."
] | e805f4c0feb608ff3756c6aa84638217905603df | https://github.com/ssnepenthe/wp-requirements/blob/e805f4c0feb608ff3756c6aa84638217905603df/src/class-plugin-checker.php#L184-L191 |
4,089 | ssnepenthe/wp-requirements | src/class-plugin-checker.php | Plugin_Checker.plugin_active | public function plugin_active( $plugin_file, $plugin_name ) {
return $this->add_check(
function() use ( $plugin_file ) {
return in_array(
$plugin_file,
(array) get_option( 'active_plugins' ),
true
);
},
sprintf( '%s must be installed and active', $plugin_name )
);
} | php | public function plugin_active( $plugin_file, $plugin_name ) {
return $this->add_check(
function() use ( $plugin_file ) {
return in_array(
$plugin_file,
(array) get_option( 'active_plugins' ),
true
);
},
sprintf( '%s must be installed and active', $plugin_name )
);
} | [
"public",
"function",
"plugin_active",
"(",
"$",
"plugin_file",
",",
"$",
"plugin_name",
")",
"{",
"return",
"$",
"this",
"->",
"add_check",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"plugin_file",
")",
"{",
"return",
"in_array",
"(",
"$",
"plugin_file",
",",
"(",
"array",
")",
"get_option",
"(",
"'active_plugins'",
")",
",",
"true",
")",
";",
"}",
",",
"sprintf",
"(",
"'%s must be installed and active'",
",",
"$",
"plugin_name",
")",
")",
";",
"}"
] | Check whether a plugin is active.
@param string $plugin_file Plugin file to check relative to plugins dir.
@param string $plugin_name Plugin name for notifications.
@return self | [
"Check",
"whether",
"a",
"plugin",
"is",
"active",
"."
] | e805f4c0feb608ff3756c6aa84638217905603df | https://github.com/ssnepenthe/wp-requirements/blob/e805f4c0feb608ff3756c6aa84638217905603df/src/class-plugin-checker.php#L201-L212 |
4,090 | ssnepenthe/wp-requirements | src/class-plugin-checker.php | Plugin_Checker.requirements_met | public function requirements_met() {
$met = true;
foreach ( $this->requirements as $requirement ) {
$met = $met && $requirement->is_met();
}
return $met;
} | php | public function requirements_met() {
$met = true;
foreach ( $this->requirements as $requirement ) {
$met = $met && $requirement->is_met();
}
return $met;
} | [
"public",
"function",
"requirements_met",
"(",
")",
"{",
"$",
"met",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"requirements",
"as",
"$",
"requirement",
")",
"{",
"$",
"met",
"=",
"$",
"met",
"&&",
"$",
"requirement",
"->",
"is_met",
"(",
")",
";",
"}",
"return",
"$",
"met",
";",
"}"
] | Detemine if all requirements are met.
@return bool | [
"Detemine",
"if",
"all",
"requirements",
"are",
"met",
"."
] | e805f4c0feb608ff3756c6aa84638217905603df | https://github.com/ssnepenthe/wp-requirements/blob/e805f4c0feb608ff3756c6aa84638217905603df/src/class-plugin-checker.php#L219-L227 |
4,091 | ssnepenthe/wp-requirements | src/class-plugin-checker.php | Plugin_Checker.wp_at_least | public function wp_at_least( $version ) {
return $this->add_check(
function() use ( $version ) {
return version_compare( get_bloginfo( 'version' ), $version, '>=' );
},
sprintf( 'WordPress %s or newer is required', $version )
);
} | php | public function wp_at_least( $version ) {
return $this->add_check(
function() use ( $version ) {
return version_compare( get_bloginfo( 'version' ), $version, '>=' );
},
sprintf( 'WordPress %s or newer is required', $version )
);
} | [
"public",
"function",
"wp_at_least",
"(",
"$",
"version",
")",
"{",
"return",
"$",
"this",
"->",
"add_check",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"version",
")",
"{",
"return",
"version_compare",
"(",
"get_bloginfo",
"(",
"'version'",
")",
",",
"$",
"version",
",",
"'>='",
")",
";",
"}",
",",
"sprintf",
"(",
"'WordPress %s or newer is required'",
",",
"$",
"version",
")",
")",
";",
"}"
] | Verify that a minimum WP version is met.
@param string $version Version string.
@return self | [
"Verify",
"that",
"a",
"minimum",
"WP",
"version",
"is",
"met",
"."
] | e805f4c0feb608ff3756c6aa84638217905603df | https://github.com/ssnepenthe/wp-requirements/blob/e805f4c0feb608ff3756c6aa84638217905603df/src/class-plugin-checker.php#L236-L243 |
4,092 | phox-pro/pulsar-core | src/app/CoreProvider.php | CoreProvider.routesRegister | protected function routesRegister(string $file, string $namespace)
{
$this->app->router->group([
'namespace' => $namespace,
], function ($router) use ($file) {
require $file;
});
} | php | protected function routesRegister(string $file, string $namespace)
{
$this->app->router->group([
'namespace' => $namespace,
], function ($router) use ($file) {
require $file;
});
} | [
"protected",
"function",
"routesRegister",
"(",
"string",
"$",
"file",
",",
"string",
"$",
"namespace",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"router",
"->",
"group",
"(",
"[",
"'namespace'",
"=>",
"$",
"namespace",
",",
"]",
",",
"function",
"(",
"$",
"router",
")",
"use",
"(",
"$",
"file",
")",
"{",
"require",
"$",
"file",
";",
"}",
")",
";",
"}"
] | Register routes in system.
@param string $file Path to file with routes. (Full path)
@param string $namespace Namespace to controllers for execute actions
@return void | [
"Register",
"routes",
"in",
"system",
"."
] | fa9c66f6578180253a65c91edf422fc3c51b32ba | https://github.com/phox-pro/pulsar-core/blob/fa9c66f6578180253a65c91edf422fc3c51b32ba/src/app/CoreProvider.php#L53-L60 |
4,093 | artscorestudio/core-bundle | Utils/Manager/ASFManager.php | ASFManager.getFQCN | protected function getFQCN($entity_name)
{
$parts = explode(':', $entity_name);
$entity = end($parts);
if (1 === preg_match('/^([A-Z][a-zA-Z]+)([A-Z][a-zA-Z]+)(Bundle)$/', $parts[0], $matches)) {
return $matches[1].'\\'.$matches[2].$matches[3].'\\Entity\\'.$entity;
}
return $entity_name;
} | php | protected function getFQCN($entity_name)
{
$parts = explode(':', $entity_name);
$entity = end($parts);
if (1 === preg_match('/^([A-Z][a-zA-Z]+)([A-Z][a-zA-Z]+)(Bundle)$/', $parts[0], $matches)) {
return $matches[1].'\\'.$matches[2].$matches[3].'\\Entity\\'.$entity;
}
return $entity_name;
} | [
"protected",
"function",
"getFQCN",
"(",
"$",
"entity_name",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"':'",
",",
"$",
"entity_name",
")",
";",
"$",
"entity",
"=",
"end",
"(",
"$",
"parts",
")",
";",
"if",
"(",
"1",
"===",
"preg_match",
"(",
"'/^([A-Z][a-zA-Z]+)([A-Z][a-zA-Z]+)(Bundle)$/'",
",",
"$",
"parts",
"[",
"0",
"]",
",",
"$",
"matches",
")",
")",
"{",
"return",
"$",
"matches",
"[",
"1",
"]",
".",
"'\\\\'",
".",
"$",
"matches",
"[",
"2",
"]",
".",
"$",
"matches",
"[",
"3",
"]",
".",
"'\\\\Entity\\\\'",
".",
"$",
"entity",
";",
"}",
"return",
"$",
"entity_name",
";",
"}"
] | Return FQCN entity name.
@param string $entity_name
@return string | [
"Return",
"FQCN",
"entity",
"name",
"."
] | 6a709a2294dd86260e1a8a4720d8760a6d528c0d | https://github.com/artscorestudio/core-bundle/blob/6a709a2294dd86260e1a8a4720d8760a6d528c0d/Utils/Manager/ASFManager.php#L64-L74 |
4,094 | artscorestudio/core-bundle | Utils/Manager/ASFManager.php | ASFManager.createInstance | public function createInstance()
{
if (is_null($this->entityName)) {
$class = new \ReflectionClass($this->originalEntityName);
} else {
$class = new \ReflectionClass($this->entityName);
}
return $class->newInstanceArgs();
} | php | public function createInstance()
{
if (is_null($this->entityName)) {
$class = new \ReflectionClass($this->originalEntityName);
} else {
$class = new \ReflectionClass($this->entityName);
}
return $class->newInstanceArgs();
} | [
"public",
"function",
"createInstance",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"entityName",
")",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
"->",
"originalEntityName",
")",
";",
"}",
"else",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
"->",
"entityName",
")",
";",
"}",
"return",
"$",
"class",
"->",
"newInstanceArgs",
"(",
")",
";",
"}"
] | Create new instance of the entity.
@return object | [
"Create",
"new",
"instance",
"of",
"the",
"entity",
"."
] | 6a709a2294dd86260e1a8a4720d8760a6d528c0d | https://github.com/artscorestudio/core-bundle/blob/6a709a2294dd86260e1a8a4720d8760a6d528c0d/Utils/Manager/ASFManager.php#L81-L90 |
4,095 | mickrip/fwoot-core | src/Fw/Model/Query.php | Query.get_by_id | function get_by_id($id, $ammend_query = '')
{
if (isset(self::$_cache[$this->_table][$id])) {
//var_dump(self::$_cache[$this->_table][$id]);
return self::$_cache[$this->_table][$id];
}
$q = \Fw\Db::prepare("select * from " . $this->_table . " where id=? " . $ammend_query);
$q->execute(array($id));
$res = $q->fetchObject($this->_entity);
self::$_cache[$this->_table][$id] = $res;
return $res;
} | php | function get_by_id($id, $ammend_query = '')
{
if (isset(self::$_cache[$this->_table][$id])) {
//var_dump(self::$_cache[$this->_table][$id]);
return self::$_cache[$this->_table][$id];
}
$q = \Fw\Db::prepare("select * from " . $this->_table . " where id=? " . $ammend_query);
$q->execute(array($id));
$res = $q->fetchObject($this->_entity);
self::$_cache[$this->_table][$id] = $res;
return $res;
} | [
"function",
"get_by_id",
"(",
"$",
"id",
",",
"$",
"ammend_query",
"=",
"''",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_cache",
"[",
"$",
"this",
"->",
"_table",
"]",
"[",
"$",
"id",
"]",
")",
")",
"{",
"//var_dump(self::$_cache[$this->_table][$id]);\r",
"return",
"self",
"::",
"$",
"_cache",
"[",
"$",
"this",
"->",
"_table",
"]",
"[",
"$",
"id",
"]",
";",
"}",
"$",
"q",
"=",
"\\",
"Fw",
"\\",
"Db",
"::",
"prepare",
"(",
"\"select * from \"",
".",
"$",
"this",
"->",
"_table",
".",
"\" where id=? \"",
".",
"$",
"ammend_query",
")",
";",
"$",
"q",
"->",
"execute",
"(",
"array",
"(",
"$",
"id",
")",
")",
";",
"$",
"res",
"=",
"$",
"q",
"->",
"fetchObject",
"(",
"$",
"this",
"->",
"_entity",
")",
";",
"self",
"::",
"$",
"_cache",
"[",
"$",
"this",
"->",
"_table",
"]",
"[",
"$",
"id",
"]",
"=",
"$",
"res",
";",
"return",
"$",
"res",
";",
"}"
] | Get by ID Helper. Benefits from caching
@param $id
@param string $ammend_query
@return mixed | [
"Get",
"by",
"ID",
"Helper",
".",
"Benefits",
"from",
"caching"
] | 10fae2ee4b2c85454bc91067f0f9adeef64fdd4d | https://github.com/mickrip/fwoot-core/blob/10fae2ee4b2c85454bc91067f0f9adeef64fdd4d/src/Fw/Model/Query.php#L40-L53 |
4,096 | mickrip/fwoot-core | src/Fw/Model/Query.php | Query.get_by | function get_by($field, $value)
{
$q = \Fw\Db::prepare("select * from " . $this->_table . " where " . $field . "=?");
$q->execute(array($value));
return $q->fetchAll(\PDO::FETCH_CLASS, $this->_entity);
} | php | function get_by($field, $value)
{
$q = \Fw\Db::prepare("select * from " . $this->_table . " where " . $field . "=?");
$q->execute(array($value));
return $q->fetchAll(\PDO::FETCH_CLASS, $this->_entity);
} | [
"function",
"get_by",
"(",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"q",
"=",
"\\",
"Fw",
"\\",
"Db",
"::",
"prepare",
"(",
"\"select * from \"",
".",
"$",
"this",
"->",
"_table",
".",
"\" where \"",
".",
"$",
"field",
".",
"\"=?\"",
")",
";",
"$",
"q",
"->",
"execute",
"(",
"array",
"(",
"$",
"value",
")",
")",
";",
"return",
"$",
"q",
"->",
"fetchAll",
"(",
"\\",
"PDO",
"::",
"FETCH_CLASS",
",",
"$",
"this",
"->",
"_entity",
")",
";",
"}"
] | Get by Arbitary Field
@param $field
@param $value
@return mixed | [
"Get",
"by",
"Arbitary",
"Field"
] | 10fae2ee4b2c85454bc91067f0f9adeef64fdd4d | https://github.com/mickrip/fwoot-core/blob/10fae2ee4b2c85454bc91067f0f9adeef64fdd4d/src/Fw/Model/Query.php#L63-L68 |
4,097 | GrupaZero/core | src/Gzero/Core/DynamicRouter.php | DynamicRouter.handleRequest | public function handleRequest(Request $request, Language $language)
{
$uri = $this->getRequestedPath($request, $language);
$route = $this->repository->getByPath($uri, $language->code);
if (empty($route) || $route->getRoutable() === null) {
throw new NotFoundHttpException();
}
if (!$this->routeCanBeShown($route)) {
throw new NotFoundHttpException();
}
event(new RouteMatched($route, $request));
return $route->getRoutable()->handle($language);
} | php | public function handleRequest(Request $request, Language $language)
{
$uri = $this->getRequestedPath($request, $language);
$route = $this->repository->getByPath($uri, $language->code);
if (empty($route) || $route->getRoutable() === null) {
throw new NotFoundHttpException();
}
if (!$this->routeCanBeShown($route)) {
throw new NotFoundHttpException();
}
event(new RouteMatched($route, $request));
return $route->getRoutable()->handle($language);
} | [
"public",
"function",
"handleRequest",
"(",
"Request",
"$",
"request",
",",
"Language",
"$",
"language",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getRequestedPath",
"(",
"$",
"request",
",",
"$",
"language",
")",
";",
"$",
"route",
"=",
"$",
"this",
"->",
"repository",
"->",
"getByPath",
"(",
"$",
"uri",
",",
"$",
"language",
"->",
"code",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"route",
")",
"||",
"$",
"route",
"->",
"getRoutable",
"(",
")",
"===",
"null",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"routeCanBeShown",
"(",
"$",
"route",
")",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
")",
";",
"}",
"event",
"(",
"new",
"RouteMatched",
"(",
"$",
"route",
",",
"$",
"request",
")",
")",
";",
"return",
"$",
"route",
"->",
"getRoutable",
"(",
")",
"->",
"handle",
"(",
"$",
"language",
")",
";",
"}"
] | Handles dynamic content rendering
@param Request $request Request
@param Language $language Lang entity
@throws NotFoundHttpException
@return Response | [
"Handles",
"dynamic",
"content",
"rendering"
] | 093e515234fa0385b259ba4d8bc7832174a44eab | https://github.com/GrupaZero/core/blob/093e515234fa0385b259ba4d8bc7832174a44eab/src/Gzero/Core/DynamicRouter.php#L45-L61 |
4,098 | Sowapps/orpheus-entitydescriptor | src/EntityDescriptor/EntityDescriptor.php | EntityDescriptor.getAllEntityDescriptors | public static function getAllEntityDescriptors() {
$entities = array();
foreach( static::getAllEntities() as $entity ) {
$entities[$entity] = EntityDescriptor::load($entity);
}
return $entities;
} | php | public static function getAllEntityDescriptors() {
$entities = array();
foreach( static::getAllEntities() as $entity ) {
$entities[$entity] = EntityDescriptor::load($entity);
}
return $entities;
} | [
"public",
"static",
"function",
"getAllEntityDescriptors",
"(",
")",
"{",
"$",
"entities",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"static",
"::",
"getAllEntities",
"(",
")",
"as",
"$",
"entity",
")",
"{",
"$",
"entities",
"[",
"$",
"entity",
"]",
"=",
"EntityDescriptor",
"::",
"load",
"(",
"$",
"entity",
")",
";",
"}",
"return",
"$",
"entities",
";",
"}"
] | Get all available entity descriptor
@return EntityDescriptor[] | [
"Get",
"all",
"available",
"entity",
"descriptor"
] | b9cc04c42e7955b11f37a70ee7cd2a518f5983b2 | https://github.com/Sowapps/orpheus-entitydescriptor/blob/b9cc04c42e7955b11f37a70ee7cd2a518f5983b2/src/EntityDescriptor/EntityDescriptor.php#L77-L83 |
4,099 | Sowapps/orpheus-entitydescriptor | src/EntityDescriptor/EntityDescriptor.php | EntityDescriptor.getAllEntities | public static function getAllEntities() {
$entities = cleanscandir(pathOf(CONFDIR.ENTITY_DESCRIPTOR_CONFIG_PATH));
foreach( $entities as $i => &$filename ) {
$pi = pathinfo($filename);
if( $pi['extension'] != 'yaml' ) {
unset($entities[$i]);
continue;
}
$filename = $pi['filename'];
}
return $entities;
} | php | public static function getAllEntities() {
$entities = cleanscandir(pathOf(CONFDIR.ENTITY_DESCRIPTOR_CONFIG_PATH));
foreach( $entities as $i => &$filename ) {
$pi = pathinfo($filename);
if( $pi['extension'] != 'yaml' ) {
unset($entities[$i]);
continue;
}
$filename = $pi['filename'];
}
return $entities;
} | [
"public",
"static",
"function",
"getAllEntities",
"(",
")",
"{",
"$",
"entities",
"=",
"cleanscandir",
"(",
"pathOf",
"(",
"CONFDIR",
".",
"ENTITY_DESCRIPTOR_CONFIG_PATH",
")",
")",
";",
"foreach",
"(",
"$",
"entities",
"as",
"$",
"i",
"=>",
"&",
"$",
"filename",
")",
"{",
"$",
"pi",
"=",
"pathinfo",
"(",
"$",
"filename",
")",
";",
"if",
"(",
"$",
"pi",
"[",
"'extension'",
"]",
"!=",
"'yaml'",
")",
"{",
"unset",
"(",
"$",
"entities",
"[",
"$",
"i",
"]",
")",
";",
"continue",
";",
"}",
"$",
"filename",
"=",
"$",
"pi",
"[",
"'filename'",
"]",
";",
"}",
"return",
"$",
"entities",
";",
"}"
] | Get all available entities
@return string[] | [
"Get",
"all",
"available",
"entities"
] | b9cc04c42e7955b11f37a70ee7cd2a518f5983b2 | https://github.com/Sowapps/orpheus-entitydescriptor/blob/b9cc04c42e7955b11f37a70ee7cd2a518f5983b2/src/EntityDescriptor/EntityDescriptor.php#L90-L101 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.