id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
195,500 | phpffcms/ffcms-core | src/Arch/Model.php | Model.getAllProperties | public function getAllProperties(): ?array
{
$properties = null;
// list all properties here, array_walk sucks on performance!
foreach ($this as $property => $value) {
if (Str::startsWith('_', $property)) {
continue;
}
$properties[$propert... | php | public function getAllProperties(): ?array
{
$properties = null;
// list all properties here, array_walk sucks on performance!
foreach ($this as $property => $value) {
if (Str::startsWith('_', $property)) {
continue;
}
$properties[$propert... | [
"public",
"function",
"getAllProperties",
"(",
")",
":",
"?",
"array",
"{",
"$",
"properties",
"=",
"null",
";",
"// list all properties here, array_walk sucks on performance!",
"foreach",
"(",
"$",
"this",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"i... | Get all properties for current model in key=>value array
@return array|null | [
"Get",
"all",
"properties",
"for",
"current",
"model",
"in",
"key",
"=",
">",
"value",
"array"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Arch/Model.php#L139-L151 |
195,501 | phpffcms/ffcms-core | src/Arch/Model.php | Model.clearProperties | public function clearProperties(): void
{
foreach ($this as $property => $value) {
if (!Str::startsWith('_', $property)) {
$this->{$property} = null;
}
}
} | php | public function clearProperties(): void
{
foreach ($this as $property => $value) {
if (!Str::startsWith('_', $property)) {
$this->{$property} = null;
}
}
} | [
"public",
"function",
"clearProperties",
"(",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"Str",
"::",
"startsWith",
"(",
"'_'",
",",
"$",
"property",
")",
")",
"{",
"$",
... | Cleanup all public model properties
@return void | [
"Cleanup",
"all",
"public",
"model",
"properties"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Arch/Model.php#L157-L164 |
195,502 | phpffcms/ffcms-core | src/Arch/Model.php | Model.getValidationRule | final public function getValidationRule($field): array
{
$rules = $this->rules();
$response = [];
foreach ($rules as $rule) {
if (Any::isArray($rule[0])) { // 2 or more rules [['field1', 'field2'], 'filter', 'filter_argv']
foreach ($rule[0] as $tfield) {
... | php | final public function getValidationRule($field): array
{
$rules = $this->rules();
$response = [];
foreach ($rules as $rule) {
if (Any::isArray($rule[0])) { // 2 or more rules [['field1', 'field2'], 'filter', 'filter_argv']
foreach ($rule[0] as $tfield) {
... | [
"final",
"public",
"function",
"getValidationRule",
"(",
"$",
"field",
")",
":",
"array",
"{",
"$",
"rules",
"=",
"$",
"this",
"->",
"rules",
"(",
")",
";",
"$",
"response",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"rule",
")",
... | Get validation rules for field
@param string $field
@return array | [
"Get",
"validation",
"rules",
"for",
"field"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Arch/Model.php#L171-L191 |
195,503 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.attach | public function attach($serviceClassName, array $options = [])
{
if (true === isset($this->service[$serviceClassName])) {
throw new DuplicateEntryException(
'The service "' . $serviceClassName . '" was already attached to the service factory.',
1456418859
... | php | public function attach($serviceClassName, array $options = [])
{
if (true === isset($this->service[$serviceClassName])) {
throw new DuplicateEntryException(
'The service "' . $serviceClassName . '" was already attached to the service factory.',
1456418859
... | [
"public",
"function",
"attach",
"(",
"$",
"serviceClassName",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"true",
"===",
"isset",
"(",
"$",
"this",
"->",
"service",
"[",
"$",
"serviceClassName",
"]",
")",
")",
"{",
"throw",
"new... | Will attach a service to this factory.
It will also reset the current service value to the given service,
allowing the usage of the function `setOption` with this service.
@param string $serviceClassName The class name of the service which will be attached.
@param array $options Array of options which will ... | [
"Will",
"attach",
"a",
"service",
"to",
"this",
"factory",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L107-L123 |
195,504 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.get | public function get($serviceClassName)
{
if (false === $this->hasBeenInitialized) {
throw new InitializationNotSetException(
'You can get a service instance only when the service factory has been initialized.',
1456419587
);
}
if (fals... | php | public function get($serviceClassName)
{
if (false === $this->hasBeenInitialized) {
throw new InitializationNotSetException(
'You can get a service instance only when the service factory has been initialized.',
1456419587
);
}
if (fals... | [
"public",
"function",
"get",
"(",
"$",
"serviceClassName",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"hasBeenInitialized",
")",
"{",
"throw",
"new",
"InitializationNotSetException",
"(",
"'You can get a service instance only when the service factory has been... | Returns the wanted service, if it was previously registered.
@param string $serviceClassName The class name of the wanted service.
@return AbstractService
@throws InitializationNotSetException
@throws EntryNotFoundException | [
"Returns",
"the",
"wanted",
"service",
"if",
"it",
"was",
"previously",
"registered",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L144-L161 |
195,505 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.with | public function with($serviceClassName)
{
if (false === $this->has($serviceClassName)) {
throw new Exception(
'You cannot use the function "' . __FUNCTION__ . '" on a service which was not added to the factory (service used: "' . $serviceClassName . '").',
1459425... | php | public function with($serviceClassName)
{
if (false === $this->has($serviceClassName)) {
throw new Exception(
'You cannot use the function "' . __FUNCTION__ . '" on a service which was not added to the factory (service used: "' . $serviceClassName . '").',
1459425... | [
"public",
"function",
"with",
"(",
"$",
"serviceClassName",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"has",
"(",
"$",
"serviceClassName",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'You cannot use the function \"'",
".",
"__FUNCTION__",
... | Resets the current service value to the given service, allowing the usage
of the function `setOption` with this service.
@param string $serviceClassName The class name of the service which will be saved as "current service".
@return $this
@throws Exception | [
"Resets",
"the",
"current",
"service",
"value",
"to",
"the",
"given",
"service",
"allowing",
"the",
"usage",
"of",
"the",
"function",
"setOption",
"with",
"this",
"service",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L171-L183 |
195,506 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.getOption | public function getOption($optionName)
{
return (isset($this->service[$this->currentService]['options'][$optionName]))
? $this->service[$this->currentService]['options'][$optionName]
: null;
} | php | public function getOption($optionName)
{
return (isset($this->service[$this->currentService]['options'][$optionName]))
? $this->service[$this->currentService]['options'][$optionName]
: null;
} | [
"public",
"function",
"getOption",
"(",
"$",
"optionName",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"this",
"->",
"service",
"[",
"$",
"this",
"->",
"currentService",
"]",
"[",
"'options'",
"]",
"[",
"$",
"optionName",
"]",
")",
")",
"?",
"$",
"th... | Returns an option for the current service. If the option is not found,
`null` is returned.
@param string $optionName
@return mixed | [
"Returns",
"an",
"option",
"for",
"the",
"current",
"service",
".",
"If",
"the",
"option",
"is",
"not",
"found",
"null",
"is",
"returned",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L215-L220 |
195,507 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.initialize | public function initialize()
{
if (true === $this->hasBeenInitialized) {
return;
}
$this->hasBeenInitialized = true;
foreach ($this->service as $service) {
list($serviceClassName, $serviceOptions) = $this->manageServiceData($service);
$this->ser... | php | public function initialize()
{
if (true === $this->hasBeenInitialized) {
return;
}
$this->hasBeenInitialized = true;
foreach ($this->service as $service) {
list($serviceClassName, $serviceOptions) = $this->manageServiceData($service);
$this->ser... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"hasBeenInitialized",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"hasBeenInitialized",
"=",
"true",
";",
"foreach",
"(",
"$",
"this",
"->",
"service",
... | Initializes every single service which was added in this instance.
@throws WrongInheritanceException
@internal This function is reserved for internal usage only, you should not use it in third party applications! | [
"Initializes",
"every",
"single",
"service",
"which",
"was",
"added",
"in",
"this",
"instance",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L228-L241 |
195,508 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.runServicesFromEvent | public function runServicesFromEvent($serviceEvent, $eventMethodName, AbstractServiceDTO $dto)
{
if (false === $this->hasBeenInitialized) {
return;
}
$this->checkServiceEvent($serviceEvent);
$this->checkServiceEventMethodName($serviceEvent, $eventMethodName);
$s... | php | public function runServicesFromEvent($serviceEvent, $eventMethodName, AbstractServiceDTO $dto)
{
if (false === $this->hasBeenInitialized) {
return;
}
$this->checkServiceEvent($serviceEvent);
$this->checkServiceEventMethodName($serviceEvent, $eventMethodName);
$s... | [
"public",
"function",
"runServicesFromEvent",
"(",
"$",
"serviceEvent",
",",
"$",
"eventMethodName",
",",
"AbstractServiceDTO",
"$",
"dto",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"hasBeenInitialized",
")",
"{",
"return",
";",
"}",
"$",
"this... | Will loop on each registered service in this factory, and check if they
use the requested event. If they do, the event is dispatched.
@param string $serviceEvent The class name of the service event.
@param string $eventMethodName Name of the method called in the service.
@param AbstractServi... | [
"Will",
"loop",
"on",
"each",
"registered",
"service",
"in",
"this",
"factory",
"and",
"check",
"if",
"they",
"use",
"the",
"requested",
"event",
".",
"If",
"they",
"do",
"the",
"event",
"is",
"dispatched",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L287-L305 |
195,509 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.checkServiceEvent | protected function checkServiceEvent($serviceEvent)
{
if (false === isset(self::$servicesChecked[$serviceEvent])) {
self::$servicesChecked[$serviceEvent] = [];
if (false === in_array(ServiceEventInterface::class, class_implements($serviceEvent))) {
throw new WrongInh... | php | protected function checkServiceEvent($serviceEvent)
{
if (false === isset(self::$servicesChecked[$serviceEvent])) {
self::$servicesChecked[$serviceEvent] = [];
if (false === in_array(ServiceEventInterface::class, class_implements($serviceEvent))) {
throw new WrongInh... | [
"protected",
"function",
"checkServiceEvent",
"(",
"$",
"serviceEvent",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"self",
"::",
"$",
"servicesChecked",
"[",
"$",
"serviceEvent",
"]",
")",
")",
"{",
"self",
"::",
"$",
"servicesChecked",
"[",
"$",
... | Will check if the class of the service event is correct and implements
the correct interface.
@param string $serviceEvent The class name of the service event.
@throws WrongInheritanceException | [
"Will",
"check",
"if",
"the",
"class",
"of",
"the",
"service",
"event",
"is",
"correct",
"and",
"implements",
"the",
"correct",
"interface",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L314-L326 |
195,510 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.checkServiceEventMethodName | protected function checkServiceEventMethodName($serviceEvent, $eventMethodName)
{
if (false === in_array($eventMethodName, self::$servicesChecked[$serviceEvent])) {
$eventClassReflection = ReflectionService::get()->getClassReflection($serviceEvent);
self::$servicesChecked[$serviceEve... | php | protected function checkServiceEventMethodName($serviceEvent, $eventMethodName)
{
if (false === in_array($eventMethodName, self::$servicesChecked[$serviceEvent])) {
$eventClassReflection = ReflectionService::get()->getClassReflection($serviceEvent);
self::$servicesChecked[$serviceEve... | [
"protected",
"function",
"checkServiceEventMethodName",
"(",
"$",
"serviceEvent",
",",
"$",
"eventMethodName",
")",
"{",
"if",
"(",
"false",
"===",
"in_array",
"(",
"$",
"eventMethodName",
",",
"self",
"::",
"$",
"servicesChecked",
"[",
"$",
"serviceEvent",
"]",... | Will check if the given method exists in the service event.
@param string $serviceEvent The class name of the service event.
@param string $eventMethodName Name of the method called in the service.
@throws MethodNotFoundException | [
"Will",
"check",
"if",
"the",
"given",
"method",
"exists",
"in",
"the",
"service",
"event",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L335-L348 |
195,511 | romm/configuration_object | Classes/Service/ServiceFactory.php | ServiceFactory.getServicesFromEvent | protected function getServicesFromEvent($serviceEvent)
{
if (false === isset($this->servicesEvents[$serviceEvent])) {
$servicesInstances = [];
foreach ($this->serviceInstances as $serviceInstance) {
if ($serviceInstance instanceof $serviceEvent) {
... | php | protected function getServicesFromEvent($serviceEvent)
{
if (false === isset($this->servicesEvents[$serviceEvent])) {
$servicesInstances = [];
foreach ($this->serviceInstances as $serviceInstance) {
if ($serviceInstance instanceof $serviceEvent) {
... | [
"protected",
"function",
"getServicesFromEvent",
"(",
"$",
"serviceEvent",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"this",
"->",
"servicesEvents",
"[",
"$",
"serviceEvent",
"]",
")",
")",
"{",
"$",
"servicesInstances",
"=",
"[",
"]",
";",
... | Will loop trough all the services instance and get the ones which use the
given event.
@param string $serviceEvent The class name of the service event.
@return AbstractService[] | [
"Will",
"loop",
"trough",
"all",
"the",
"services",
"instance",
"and",
"get",
"the",
"ones",
"which",
"use",
"the",
"given",
"event",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Service/ServiceFactory.php#L357-L371 |
195,512 | niridoy/LaraveIinstaller | src/Helpers/DatabaseManager.php | DatabaseManager.migrate | private function migrate($outputLog)
{
try{
DB::connection()->getPdo();
DB::unprepared(file_get_contents('core/database.sql'));
}
catch(Exception $e){
return $this->response($e->getMessage());
}
return $this->seed($output... | php | private function migrate($outputLog)
{
try{
DB::connection()->getPdo();
DB::unprepared(file_get_contents('core/database.sql'));
}
catch(Exception $e){
return $this->response($e->getMessage());
}
return $this->seed($output... | [
"private",
"function",
"migrate",
"(",
"$",
"outputLog",
")",
"{",
"try",
"{",
"DB",
"::",
"connection",
"(",
")",
"->",
"getPdo",
"(",
")",
";",
"DB",
"::",
"unprepared",
"(",
"file_get_contents",
"(",
"'core/database.sql'",
")",
")",
";",
"}",
"catch",... | Run the migration and call the seeder.
@param collection $outputLog
@return collection | [
"Run",
"the",
"migration",
"and",
"call",
"the",
"seeder",
"."
] | 8339cf45bf393be57fb4e6c63179a6865028f076 | https://github.com/niridoy/LaraveIinstaller/blob/8339cf45bf393be57fb4e6c63179a6865028f076/src/Helpers/DatabaseManager.php#L34-L47 |
195,513 | niridoy/LaraveIinstaller | src/Helpers/DatabaseManager.php | DatabaseManager.sqlite | private function sqlite($outputLog)
{
if(DB::connection() instanceof SQLiteConnection) {
$database = DB::connection()->getDatabaseName();
if(!file_exists($database)) {
touch($database);
DB::reconnect(Config::get('database.default'));
}
... | php | private function sqlite($outputLog)
{
if(DB::connection() instanceof SQLiteConnection) {
$database = DB::connection()->getDatabaseName();
if(!file_exists($database)) {
touch($database);
DB::reconnect(Config::get('database.default'));
}
... | [
"private",
"function",
"sqlite",
"(",
"$",
"outputLog",
")",
"{",
"if",
"(",
"DB",
"::",
"connection",
"(",
")",
"instanceof",
"SQLiteConnection",
")",
"{",
"$",
"database",
"=",
"DB",
"::",
"connection",
"(",
")",
"->",
"getDatabaseName",
"(",
")",
";",... | check database type. If SQLite, then create the database file.
@param collection $outputLog | [
"check",
"database",
"type",
".",
"If",
"SQLite",
"then",
"create",
"the",
"database",
"file",
"."
] | 8339cf45bf393be57fb4e6c63179a6865028f076 | https://github.com/niridoy/LaraveIinstaller/blob/8339cf45bf393be57fb4e6c63179a6865028f076/src/Helpers/DatabaseManager.php#L91-L101 |
195,514 | wb-crowdfusion/crowdfusion | system/core/classes/libraries/storagefacility/StorageFacilityFactory.php | StorageFacilityFactory.build | public function build(StorageFacilityInfo $sfInfo)
{
$storageFacility = $this->ApplicationContext->object($sfInfo->ObjectRef);
return $storageFacility;
} | php | public function build(StorageFacilityInfo $sfInfo)
{
$storageFacility = $this->ApplicationContext->object($sfInfo->ObjectRef);
return $storageFacility;
} | [
"public",
"function",
"build",
"(",
"StorageFacilityInfo",
"$",
"sfInfo",
")",
"{",
"$",
"storageFacility",
"=",
"$",
"this",
"->",
"ApplicationContext",
"->",
"object",
"(",
"$",
"sfInfo",
"->",
"ObjectRef",
")",
";",
"return",
"$",
"storageFacility",
";",
... | Get a storage facility prototype instance from the application context | [
"Get",
"a",
"storage",
"facility",
"prototype",
"instance",
"from",
"the",
"application",
"context"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/storagefacility/StorageFacilityFactory.php#L46-L50 |
195,515 | Triun/Diff | src/Diff.php | Diff.compareFiles | public static function compareFiles($file1, $file2, $compareCharacters = false)
{
return self::compare(
file_get_contents($file1),
file_get_contents($file2),
$compareCharacters
);
} | php | public static function compareFiles($file1, $file2, $compareCharacters = false)
{
return self::compare(
file_get_contents($file1),
file_get_contents($file2),
$compareCharacters
);
} | [
"public",
"static",
"function",
"compareFiles",
"(",
"$",
"file1",
",",
"$",
"file2",
",",
"$",
"compareCharacters",
"=",
"false",
")",
"{",
"return",
"self",
"::",
"compare",
"(",
"file_get_contents",
"(",
"$",
"file1",
")",
",",
"file_get_contents",
"(",
... | Returns the diff for two files.
@param string $file1 the path to the first file
@param string $file2 the path to the second file
@param bool $compareCharacters true to compare characters, and false to compare lines; this optional parameter
defaults to false.
@return array | [
"Returns",
"the",
"diff",
"for",
"two",
"files",
"."
] | b5cc865b4a924bc461215f150846c3e0f7008e11 | https://github.com/Triun/Diff/blob/b5cc865b4a924bc461215f150846c3e0f7008e11/src/Diff.php#L100-L107 |
195,516 | Triun/Diff | src/Diff.php | Diff.toString | public static function toString($diff, $separator = "\n")
{
// initialise the string
$string = '';
// loop over the lines in the diff
foreach ($diff as $line) {
// extend the string with the line
switch ($line[1]) {
case self::UNMODIFIED:
... | php | public static function toString($diff, $separator = "\n")
{
// initialise the string
$string = '';
// loop over the lines in the diff
foreach ($diff as $line) {
// extend the string with the line
switch ($line[1]) {
case self::UNMODIFIED:
... | [
"public",
"static",
"function",
"toString",
"(",
"$",
"diff",
",",
"$",
"separator",
"=",
"\"\\n\"",
")",
"{",
"// initialise the string",
"$",
"string",
"=",
"''",
";",
"// loop over the lines in the diff",
"foreach",
"(",
"$",
"diff",
"as",
"$",
"line",
")",... | Returns a diff as a string, where unmodified lines are prefixed by ' ', deletions are prefixed by '- ', and
insertions are prefixed by '+ '.
@param array $diff the diff array
@param string $separator the separator between lines; this optional parameter defaults to "\n"
@return string string | [
"Returns",
"a",
"diff",
"as",
"a",
"string",
"where",
"unmodified",
"lines",
"are",
"prefixed",
"by",
"deletions",
"are",
"prefixed",
"by",
"-",
"and",
"insertions",
"are",
"prefixed",
"by",
"+",
"."
] | b5cc865b4a924bc461215f150846c3e0f7008e11 | https://github.com/Triun/Diff/blob/b5cc865b4a924bc461215f150846c3e0f7008e11/src/Diff.php#L200-L227 |
195,517 | Triun/Diff | src/Diff.php | Diff.toTable | public static function toTable($diff, $indentation = '', $separator = '<br />')
{
// initialise the HTML
$html = $indentation . "<table class=\"diff\">\n";
// loop over the lines in the diff
$index = 0;
while ($index < count($diff)) {
// determine the line type
... | php | public static function toTable($diff, $indentation = '', $separator = '<br />')
{
// initialise the HTML
$html = $indentation . "<table class=\"diff\">\n";
// loop over the lines in the diff
$index = 0;
while ($index < count($diff)) {
// determine the line type
... | [
"public",
"static",
"function",
"toTable",
"(",
"$",
"diff",
",",
"$",
"indentation",
"=",
"''",
",",
"$",
"separator",
"=",
"'<br />'",
")",
"{",
"// initialise the HTML",
"$",
"html",
"=",
"$",
"indentation",
".",
"\"<table class=\\\"diff\\\">\\n\"",
";",
"/... | Returns a diff as an HTML table.
@param array $diff the diff array
@param string $indentation indentation to add to every line of the generated HTML; this optional parameter
defaults to ''
@param string $separator the separator between lines; this optional parameter defaults to '<br />'
@return string retur... | [
"Returns",
"a",
"diff",
"as",
"an",
"HTML",
"table",
"."
] | b5cc865b4a924bc461215f150846c3e0f7008e11 | https://github.com/Triun/Diff/blob/b5cc865b4a924bc461215f150846c3e0f7008e11/src/Diff.php#L283-L368 |
195,518 | joegreen88/zf1-component-validate | src/Zend/Validate/Barcode/Issn.php | Zend_Validate_Barcode_Issn.checkChars | public function checkChars($value)
{
if (strlen($value) != 8) {
if (strpos($value, 'X') !== false) {
return false;
}
}
return parent::checkChars($value);
} | php | public function checkChars($value)
{
if (strlen($value) != 8) {
if (strpos($value, 'X') !== false) {
return false;
}
}
return parent::checkChars($value);
} | [
"public",
"function",
"checkChars",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"value",
")",
"!=",
"8",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
"'X'",
")",
"!==",
"false",
")",
"{",
"return",
"false",
";",
"}",
"... | Allows X on length of 8 chars
@param string $value The barcode to check for allowed characters
@return boolean | [
"Allows",
"X",
"on",
"length",
"of",
"8",
"chars"
] | 88d9ea016f73d48ff0ba7d06ecbbf28951fd279e | https://github.com/joegreen88/zf1-component-validate/blob/88d9ea016f73d48ff0ba7d06ecbbf28951fd279e/src/Zend/Validate/Barcode/Issn.php#L59-L68 |
195,519 | DoSomething/mb-toolbox | src/MB_MailChimp.php | MB_MailChimp.submitSubscribe | public function submitSubscribe($listID, $composedItem = [])
{
$results = $this->mailChimp->call("lists/subscribe",
[
'id' => $listID,
'email' => [
'email' => $composedItem['email']['email']
],
'merge_vars' => $... | php | public function submitSubscribe($listID, $composedItem = [])
{
$results = $this->mailChimp->call("lists/subscribe",
[
'id' => $listID,
'email' => [
'email' => $composedItem['email']['email']
],
'merge_vars' => $... | [
"public",
"function",
"submitSubscribe",
"(",
"$",
"listID",
",",
"$",
"composedItem",
"=",
"[",
"]",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"mailChimp",
"->",
"call",
"(",
"\"lists/subscribe\"",
",",
"[",
"'id'",
"=>",
"$",
"listID",
",",
"... | Make single signup submission to MailChimp. Typically used for resubscribes.
@param string $listID
A unique ID that defines what MailChimp list the batch should be added to
@param array $composedItem
The the details of an email address to be submitted to MailChimp
@return array
A list of the RabbitMQ queue entry IDs ... | [
"Make",
"single",
"signup",
"submission",
"to",
"MailChimp",
".",
"Typically",
"used",
"for",
"resubscribes",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_MailChimp.php#L104-L130 |
195,520 | DoSomething/mb-toolbox | src/MB_MailChimp.php | MB_MailChimp.composeSubscriberSubmission | public function composeSubscriberSubmission($newSubscribers = [])
{
$composedSubscriberList = [];
foreach ($newSubscribers as $newSubscriberCount => $newSubscriber) {
if (isset($newSubscriber['birthdate']) && is_int($newSubscriber['birthdate'])) {
$newSubscriber['birthda... | php | public function composeSubscriberSubmission($newSubscribers = [])
{
$composedSubscriberList = [];
foreach ($newSubscribers as $newSubscriberCount => $newSubscriber) {
if (isset($newSubscriber['birthdate']) && is_int($newSubscriber['birthdate'])) {
$newSubscriber['birthda... | [
"public",
"function",
"composeSubscriberSubmission",
"(",
"$",
"newSubscribers",
"=",
"[",
"]",
")",
"{",
"$",
"composedSubscriberList",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"newSubscribers",
"as",
"$",
"newSubscriberCount",
"=>",
"$",
"newSubscriber",
")",
... | Format email list to meet MailChimp API requirements for batchSubscribe
@param array $newSubscribers
The list of email address to be formatted
@return array
Array of email addresses formatted to meet MailChimp API requirements. | [
"Format",
"email",
"list",
"to",
"meet",
"MailChimp",
"API",
"requirements",
"for",
"batchSubscribe"
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_MailChimp.php#L141-L204 |
195,521 | DoSomething/mb-toolbox | src/MB_MailChimp.php | MB_MailChimp.memberInfo | public function memberInfo($email, $listID)
{
$mailchimpStatus = $this->mailChimp->call("/lists/member-info", [
'id' => $listID,
'emails' => [
0 => [
'email' => $email
]
]
]);
return $mailchimpStatus;
... | php | public function memberInfo($email, $listID)
{
$mailchimpStatus = $this->mailChimp->call("/lists/member-info", [
'id' => $listID,
'emails' => [
0 => [
'email' => $email
]
]
]);
return $mailchimpStatus;
... | [
"public",
"function",
"memberInfo",
"(",
"$",
"email",
",",
"$",
"listID",
")",
"{",
"$",
"mailchimpStatus",
"=",
"$",
"this",
"->",
"mailChimp",
"->",
"call",
"(",
"\"/lists/member-info\"",
",",
"[",
"'id'",
"=>",
"$",
"listID",
",",
"'emails'",
"=>",
"... | Gather account information froma specific list
Reference: http://apidocs.mailchimp.com/api/2.0/lists/member-info.php
@param string email
Target email address to lookup
@param string $listID
The list to lookup the email address on. | [
"Gather",
"account",
"information",
"froma",
"specific",
"list"
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_MailChimp.php#L216-L229 |
195,522 | TuumPHP/Web | src/Stack/RouterStack.php | RouterStack.match | private function match($request)
{
$route = $this->router->match(
$request->getUri()->getPath(),
$request->getMethod()
);
if (!$route) {
// not matched. dispatch the next middleware.
return $this->next ? $this->next->__invoke($request) : null;
... | php | private function match($request)
{
$route = $this->router->match(
$request->getUri()->getPath(),
$request->getMethod()
);
if (!$route) {
// not matched. dispatch the next middleware.
return $this->next ? $this->next->__invoke($request) : null;
... | [
"private",
"function",
"match",
"(",
"$",
"request",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"router",
"->",
"match",
"(",
"$",
"request",
"->",
"getUri",
"(",
")",
"->",
"getPath",
"(",
")",
",",
"$",
"request",
"->",
"getMethod",
"(",
")"... | matches the route!
@param Request $request
@return null|Response | [
"matches",
"the",
"route!"
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Stack/RouterStack.php#L98-L109 |
195,523 | TuumPHP/Web | src/Stack/RouterStack.php | RouterStack.dispatch | private function dispatch($request, $route)
{
if ($route->matched()) {
$request = $request->withPathToMatch($route->matched(), $route->trailing());
}
// dispatch the route!
return $this->dispatcher->withRoute($route)->__invoke($request);
} | php | private function dispatch($request, $route)
{
if ($route->matched()) {
$request = $request->withPathToMatch($route->matched(), $route->trailing());
}
// dispatch the route!
return $this->dispatcher->withRoute($route)->__invoke($request);
} | [
"private",
"function",
"dispatch",
"(",
"$",
"request",
",",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"route",
"->",
"matched",
"(",
")",
")",
"{",
"$",
"request",
"=",
"$",
"request",
"->",
"withPathToMatch",
"(",
"$",
"route",
"->",
"matched",
"(",
... | execute the dispatcher and filters using blank new web application.
@param Request $request
@param Route $route
@return mixed | [
"execute",
"the",
"dispatcher",
"and",
"filters",
"using",
"blank",
"new",
"web",
"application",
"."
] | 8f296b6358aa93226ce08d6cc54a309f5b0a9820 | https://github.com/TuumPHP/Web/blob/8f296b6358aa93226ce08d6cc54a309f5b0a9820/src/Stack/RouterStack.php#L118-L125 |
195,524 | agentmedia/phine-core | src/Core/Logic/InsertVariables/Reader.php | Reader.ParseToken | public function ParseToken($text, $startPos, &$endPos)
{
$endPos = $startPos + strlen(self::Start);
$tokenString = $this->ExtractTokenString($text, $startPos, $endPos);
if (!$tokenString)
{
return null;
}
$nextStop = 0;
$type = $this->Par... | php | public function ParseToken($text, $startPos, &$endPos)
{
$endPos = $startPos + strlen(self::Start);
$tokenString = $this->ExtractTokenString($text, $startPos, $endPos);
if (!$tokenString)
{
return null;
}
$nextStop = 0;
$type = $this->Par... | [
"public",
"function",
"ParseToken",
"(",
"$",
"text",
",",
"$",
"startPos",
",",
"&",
"$",
"endPos",
")",
"{",
"$",
"endPos",
"=",
"$",
"startPos",
"+",
"strlen",
"(",
"self",
"::",
"Start",
")",
";",
"$",
"tokenString",
"=",
"$",
"this",
"->",
"Ex... | Tries to parse a token beginning on the start marker
@param string $text The text
@param int $startPos The start position of the token
@param int& $endPos The end position of the token or the next position
@return Token Returns the parsed token or null if parsing failed | [
"Tries",
"to",
"parse",
"a",
"token",
"beginning",
"on",
"the",
"start",
"marker"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/InsertVariables/Reader.php#L34-L74 |
195,525 | agentmedia/phine-core | src/Core/Logic/InsertVariables/Reader.php | Reader.ParseFilters | private function ParseFilters($tokenString, $nextStop)
{
$filters = array();
if ($nextStop === false)
{
return $filters;
}
$trimString = trim(substr($tokenString, $nextStop));
if ($trimString == '')
{
return $filters;
}
... | php | private function ParseFilters($tokenString, $nextStop)
{
$filters = array();
if ($nextStop === false)
{
return $filters;
}
$trimString = trim(substr($tokenString, $nextStop));
if ($trimString == '')
{
return $filters;
}
... | [
"private",
"function",
"ParseFilters",
"(",
"$",
"tokenString",
",",
"$",
"nextStop",
")",
"{",
"$",
"filters",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"nextStop",
"===",
"false",
")",
"{",
"return",
"$",
"filters",
";",
"}",
"$",
"trimString",
... | Parses the filters
@return string[] Returns the filter | [
"Parses",
"the",
"filters"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/InsertVariables/Reader.php#L133-L161 |
195,526 | agentmedia/phine-core | src/Core/Modules/Backend/UsergroupList.php | UsergroupList.RemovalObject | protected function RemovalObject()
{
$id = Request::PostData('delete');
return $id ? Usergroup::Schema()->ByID($id) : null;
} | php | protected function RemovalObject()
{
$id = Request::PostData('delete');
return $id ? Usergroup::Schema()->ByID($id) : null;
} | [
"protected",
"function",
"RemovalObject",
"(",
")",
"{",
"$",
"id",
"=",
"Request",
"::",
"PostData",
"(",
"'delete'",
")",
";",
"return",
"$",
"id",
"?",
"Usergroup",
"::",
"Schema",
"(",
")",
"->",
"ByID",
"(",
"$",
"id",
")",
":",
"null",
";",
"... | The user group required for deleting
@return Usergroup | [
"The",
"user",
"group",
"required",
"for",
"deleting"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/UsergroupList.php#L40-L44 |
195,527 | agentmedia/phine-core | src/Core/Modules/Backend/UsergroupList.php | UsergroupList.CanEdit | protected function CanEdit(Usergroup $group)
{
return self::Guard()->Allow(BackendAction::Edit(), $group)
&& self::Guard()->Allow(BackendAction::UseIt(), new UsergroupForm());
} | php | protected function CanEdit(Usergroup $group)
{
return self::Guard()->Allow(BackendAction::Edit(), $group)
&& self::Guard()->Allow(BackendAction::UseIt(), new UsergroupForm());
} | [
"protected",
"function",
"CanEdit",
"(",
"Usergroup",
"$",
"group",
")",
"{",
"return",
"self",
"::",
"Guard",
"(",
")",
"->",
"Allow",
"(",
"BackendAction",
"::",
"Edit",
"(",
")",
",",
"$",
"group",
")",
"&&",
"self",
"::",
"Guard",
"(",
")",
"->",... | True if group can be edited
@param Usergroup $group
@return bool | [
"True",
"if",
"group",
"can",
"be",
"edited"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/UsergroupList.php#L56-L60 |
195,528 | agentmedia/phine-core | src/Core/Modules/Backend/UsergroupList.php | UsergroupList.ModuleLockFormUrl | protected function ModuleLockFormUrl(Usergroup $group)
{
$args = array('usergroup' => $group->GetID());
return BackendRouter::ModuleUrl(new ModuleLockForm(), $args);
} | php | protected function ModuleLockFormUrl(Usergroup $group)
{
$args = array('usergroup' => $group->GetID());
return BackendRouter::ModuleUrl(new ModuleLockForm(), $args);
} | [
"protected",
"function",
"ModuleLockFormUrl",
"(",
"Usergroup",
"$",
"group",
")",
"{",
"$",
"args",
"=",
"array",
"(",
"'usergroup'",
"=>",
"$",
"group",
"->",
"GetID",
"(",
")",
")",
";",
"return",
"BackendRouter",
"::",
"ModuleUrl",
"(",
"new",
"ModuleL... | Gets the url for the module lock
@param Usergroup $group
@return string | [
"Gets",
"the",
"url",
"for",
"the",
"module",
"lock"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/UsergroupList.php#L118-L122 |
195,529 | cmsgears/module-community | frontend/controllers/GroupController.php | GroupController.behaviors | public function behaviors() {
return [
'rbac' => [
'class' => Yii::$app->cmgCore->getRbacFilterClass(),
'actions' => [
'index' => [ 'permission' => CoreGlobal::PERM_USER ],
'update' => [ 'permission' => CoreGlobal::PERM_USER ]
... | php | public function behaviors() {
return [
'rbac' => [
'class' => Yii::$app->cmgCore->getRbacFilterClass(),
'actions' => [
'index' => [ 'permission' => CoreGlobal::PERM_USER ],
'update' => [ 'permission' => CoreGlobal::PERM_USER ]
... | [
"public",
"function",
"behaviors",
"(",
")",
"{",
"return",
"[",
"'rbac'",
"=>",
"[",
"'class'",
"=>",
"Yii",
"::",
"$",
"app",
"->",
"cmgCore",
"->",
"getRbacFilterClass",
"(",
")",
",",
"'actions'",
"=>",
"[",
"'index'",
"=>",
"[",
"'permission'",
"=>"... | yii\base\Component | [
"yii",
"\\",
"base",
"\\",
"Component"
] | 0ca9cf0aa0cee395a4788bd6085f291e10728555 | https://github.com/cmsgears/module-community/blob/0ca9cf0aa0cee395a4788bd6085f291e10728555/frontend/controllers/GroupController.php#L39-L57 |
195,530 | Scoilnet/PhpSDK | scoilnetsdk/OAuth2/OAuthClient.php | OAuthClient.getVariable | public function getVariable($name, $default = NULL) {
return isset($this->conf[$name]) ? $this->conf[$name] : $default;
} | php | public function getVariable($name, $default = NULL) {
return isset($this->conf[$name]) ? $this->conf[$name] : $default;
} | [
"public",
"function",
"getVariable",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"conf",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"conf",
"[",
"$",
"name",
"]",
":",
"$",
"... | Returns a persistent variable.
To avoid problems, always use lower case for persistent variable names.
@param $name
The name of the variable to return.
@param $default
The default value to use if this variable has never been set.
@return
The value of the variable. | [
"Returns",
"a",
"persistent",
"variable",
"."
] | c2d033b020015b3c9c8a741bff857e7d599f18c0 | https://github.com/Scoilnet/PhpSDK/blob/c2d033b020015b3c9c8a741bff857e7d599f18c0/scoilnetsdk/OAuth2/OAuthClient.php#L43-L45 |
195,531 | Scoilnet/PhpSDK | scoilnetsdk/OAuth2/OAuthClient.php | OAuthClient.getAccessTokenFromAuthorizationCode | private function getAccessTokenFromAuthorizationCode($code) {
if ($this->getVariable('access_token_uri') && $this->getVariable('client_id') && $this->getVariable('client_secret')) {
return json_decode($this->makeRequest(
$this->getVariable('access_token_uri'),
'POST',
array(
... | php | private function getAccessTokenFromAuthorizationCode($code) {
if ($this->getVariable('access_token_uri') && $this->getVariable('client_id') && $this->getVariable('client_secret')) {
return json_decode($this->makeRequest(
$this->getVariable('access_token_uri'),
'POST',
array(
... | [
"private",
"function",
"getAccessTokenFromAuthorizationCode",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getVariable",
"(",
"'access_token_uri'",
")",
"&&",
"$",
"this",
"->",
"getVariable",
"(",
"'client_id'",
")",
"&&",
"$",
"this",
"->",
"... | Get access token from OAuth2.0 token endpoint with authorization code.
This function will only be activated if both access token URI, client
identifier and client secret are setup correctly.
@param $code
Authorization code issued by authorization server's authorization
endpoint.
@return
A valid OAuth2.0 JSON decoded... | [
"Get",
"access",
"token",
"from",
"OAuth2",
".",
"0",
"token",
"endpoint",
"with",
"authorization",
"code",
"."
] | c2d033b020015b3c9c8a741bff857e7d599f18c0 | https://github.com/Scoilnet/PhpSDK/blob/c2d033b020015b3c9c8a741bff857e7d599f18c0/scoilnetsdk/OAuth2/OAuthClient.php#L360-L375 |
195,532 | Scoilnet/PhpSDK | scoilnetsdk/OAuth2/OAuthClient.php | OAuthClient.makeRequest | protected function makeRequest($path, $method = 'GET', $params = array(), $ch = NULL) {
if (!$ch)
$ch = curl_init();
$opts = self::$CURL_OPTS;
if ($params) {
switch ($method) {
case 'GET':
$path .= '?' . http_build_query($params, NULL, '&');
break;
... | php | protected function makeRequest($path, $method = 'GET', $params = array(), $ch = NULL) {
if (!$ch)
$ch = curl_init();
$opts = self::$CURL_OPTS;
if ($params) {
switch ($method) {
case 'GET':
$path .= '?' . http_build_query($params, NULL, '&');
break;
... | [
"protected",
"function",
"makeRequest",
"(",
"$",
"path",
",",
"$",
"method",
"=",
"'GET'",
",",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"ch",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"ch",
")",
"$",
"ch",
"=",
"curl_init",
"(",
")"... | Makes an HTTP request.
This method can be overriden by subclasses if developers want to do
fancier things or use something other than cURL to make the request.
@param $path
The target path, relative to base_path/service_uri or an absolute URI.
@param $method
(optional) The HTTP method (default 'GET').
@param $params
... | [
"Makes",
"an",
"HTTP",
"request",
"."
] | c2d033b020015b3c9c8a741bff857e7d599f18c0 | https://github.com/Scoilnet/PhpSDK/blob/c2d033b020015b3c9c8a741bff857e7d599f18c0/scoilnetsdk/OAuth2/OAuthClient.php#L455-L543 |
195,533 | Scoilnet/PhpSDK | scoilnetsdk/OAuth2/OAuthClient.php | OAuthClient.setCookieFromSession | protected function setCookieFromSession($session = NULL) {
if (!$this->getVariable('cookie_support'))
return;
$cookie_name = $this->getSessionCookieName();
$value = 'deleted';
$expires = time() - 3600;
$base_domain = $this->getVariable('base_domain', self::DEFAULT_BASE_DOMAIN);
if... | php | protected function setCookieFromSession($session = NULL) {
if (!$this->getVariable('cookie_support'))
return;
$cookie_name = $this->getSessionCookieName();
$value = 'deleted';
$expires = time() - 3600;
$base_domain = $this->getVariable('base_domain', self::DEFAULT_BASE_DOMAIN);
if... | [
"protected",
"function",
"setCookieFromSession",
"(",
"$",
"session",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getVariable",
"(",
"'cookie_support'",
")",
")",
"return",
";",
"$",
"cookie_name",
"=",
"$",
"this",
"->",
"getSessionCookieName... | Set a JS Cookie based on the _passed in_ session.
It does not use the currently stored session - you need to explicitly
pass it in.
@param $session
The session to use for setting the cookie. | [
"Set",
"a",
"JS",
"Cookie",
"based",
"on",
"the",
"_passed",
"in_",
"session",
"."
] | c2d033b020015b3c9c8a741bff857e7d599f18c0 | https://github.com/Scoilnet/PhpSDK/blob/c2d033b020015b3c9c8a741bff857e7d599f18c0/scoilnetsdk/OAuth2/OAuthClient.php#L564-L590 |
195,534 | Scoilnet/PhpSDK | scoilnetsdk/OAuth2/OAuthClient.php | OAuthClient.generateSignature | protected function generateSignature($params, $secret) {
// Work with sorted data.
ksort($params);
// Generate the base string.
$base_string = '';
foreach ($params as $key => $value) {
$base_string .= $key . '=' . $value;
}
$base_string .= $secret;
return md5($base_str... | php | protected function generateSignature($params, $secret) {
// Work with sorted data.
ksort($params);
// Generate the base string.
$base_string = '';
foreach ($params as $key => $value) {
$base_string .= $key . '=' . $value;
}
$base_string .= $secret;
return md5($base_str... | [
"protected",
"function",
"generateSignature",
"(",
"$",
"params",
",",
"$",
"secret",
")",
"{",
"// Work with sorted data.\r",
"ksort",
"(",
"$",
"params",
")",
";",
"// Generate the base string.\r",
"$",
"base_string",
"=",
"''",
";",
"foreach",
"(",
"$",
"para... | Generate a signature for the given params and secret.
@param $params
The parameters to sign.
@param $secret
The secret to sign with.
@return
The generated signature | [
"Generate",
"a",
"signature",
"for",
"the",
"given",
"params",
"and",
"secret",
"."
] | c2d033b020015b3c9c8a741bff857e7d599f18c0 | https://github.com/Scoilnet/PhpSDK/blob/c2d033b020015b3c9c8a741bff857e7d599f18c0/scoilnetsdk/OAuth2/OAuthClient.php#L718-L730 |
195,535 | mullanaphy/variable | src/PHY/Variable/Int.php | Int.toMinutes | public function toMinutes()
{
$time = $this->get();
if (!$time) {
$time = '00:00';
} else {
$time = sprintf('%02d:%02d', (int)(floor($time / 60)), (int)($time % 60));
}
return $this;
} | php | public function toMinutes()
{
$time = $this->get();
if (!$time) {
$time = '00:00';
} else {
$time = sprintf('%02d:%02d', (int)(floor($time / 60)), (int)($time % 60));
}
return $this;
} | [
"public",
"function",
"toMinutes",
"(",
")",
"{",
"$",
"time",
"=",
"$",
"this",
"->",
"get",
"(",
")",
";",
"if",
"(",
"!",
"$",
"time",
")",
"{",
"$",
"time",
"=",
"'00:00'",
";",
"}",
"else",
"{",
"$",
"time",
"=",
"sprintf",
"(",
"'%02d:%02... | Convert an int as seconds into Minutes.
@return string | [
"Convert",
"an",
"int",
"as",
"seconds",
"into",
"Minutes",
"."
] | e4eb274a1799a25e33e5e21cd260603c74628031 | https://github.com/mullanaphy/variable/blob/e4eb274a1799a25e33e5e21cd260603c74628031/src/PHY/Variable/Int.php#L53-L62 |
195,536 | ScaraMVC/Framework | src/Scara/Http/View.php | View.createBlade | public function createBlade($views, $cache)
{
$this->_blade = new Blade($views, $cache);
$this->_view = $this->_blade->view();
} | php | public function createBlade($views, $cache)
{
$this->_blade = new Blade($views, $cache);
$this->_view = $this->_blade->view();
} | [
"public",
"function",
"createBlade",
"(",
"$",
"views",
",",
"$",
"cache",
")",
"{",
"$",
"this",
"->",
"_blade",
"=",
"new",
"Blade",
"(",
"$",
"views",
",",
"$",
"cache",
")",
";",
"$",
"this",
"->",
"_view",
"=",
"$",
"this",
"->",
"_blade",
"... | Creates a new Blade instance.
@param string $views - The views path
@param string $cache - The cache path
@return void | [
"Creates",
"a",
"new",
"Blade",
"instance",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/View.php#L70-L74 |
195,537 | ScaraMVC/Framework | src/Scara/Http/View.php | View.compile | public function compile($path)
{
$this->parseContent($path, $this->_data);
return $this->_factory->render();
} | php | public function compile($path)
{
$this->parseContent($path, $this->_data);
return $this->_factory->render();
} | [
"public",
"function",
"compile",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"parseContent",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"_data",
")",
";",
"return",
"$",
"this",
"->",
"_factory",
"->",
"render",
"(",
")",
";",
"}"
] | Compiles the view.
@param string $path - The path of the view
@return string | [
"Compiles",
"the",
"view",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/View.php#L83-L88 |
195,538 | ScaraMVC/Framework | src/Scara/Http/View.php | View.with | public function with($key, $value = null)
{
if (is_array($key)) {
$this->_data = array_merge($this->_data, $key);
} else {
$this->_data[$key] = $value;
}
return $this;
} | php | public function with($key, $value = null)
{
if (is_array($key)) {
$this->_data = array_merge($this->_data, $key);
} else {
$this->_data[$key] = $value;
}
return $this;
} | [
"public",
"function",
"with",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"_data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"_data",
",",
"$",
"key",
")... | Adds data to pass onto the view.
@param string $key - The key of the data to pass through
@param string $value - The $key's value
@return \Scara\Http\View | [
"Adds",
"data",
"to",
"pass",
"onto",
"the",
"view",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/View.php#L110-L119 |
195,539 | ScaraMVC/Framework | src/Scara/Http/View.php | View.renderView | public static function renderView($path, $dataName = '', $data = '')
{
$view = new self();
if (!empty($dataName)) {
$view->with($dataName, $data);
}
return $view->render($path, false);
} | php | public static function renderView($path, $dataName = '', $data = '')
{
$view = new self();
if (!empty($dataName)) {
$view->with($dataName, $data);
}
return $view->render($path, false);
} | [
"public",
"static",
"function",
"renderView",
"(",
"$",
"path",
",",
"$",
"dataName",
"=",
"''",
",",
"$",
"data",
"=",
"''",
")",
"{",
"$",
"view",
"=",
"new",
"self",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"dataName",
")",
")",
"{"... | Static function to render a view.
@param string $path
@param string $data
@param string $data
@return mixed | [
"Static",
"function",
"to",
"render",
"a",
"view",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/View.php#L159-L167 |
195,540 | ScaraMVC/Framework | src/Scara/Http/View.php | View.parseContent | private function parseContent($path, $data)
{
$path = str_replace('.', '/', $path);
$this->_factory = $this->_view->make($path, $data);
} | php | private function parseContent($path, $data)
{
$path = str_replace('.', '/', $path);
$this->_factory = $this->_view->make($path, $data);
} | [
"private",
"function",
"parseContent",
"(",
"$",
"path",
",",
"$",
"data",
")",
"{",
"$",
"path",
"=",
"str_replace",
"(",
"'.'",
",",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"_factory",
"=",
"$",
"this",
"->",
"_view",
"->",
"make",
... | Parses the view using the Blade Factory.
@param string $path - The path of the view to parse
@param string $data - Data to pass on to the view
@return void | [
"Parses",
"the",
"view",
"using",
"the",
"Blade",
"Factory",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/View.php#L189-L193 |
195,541 | SetBased/php-abc-page-core | src/CorePage.php | CorePage.echoPageLeader | protected function echoPageLeader(): void
{
echo '<!DOCTYPE html>';
echo Html::generateTag('html',
['xmlns' => 'http://www.w3.org/1999/xhtml',
'xml:lang' => Abc::$babel->getCode(),
'lang' => Abc::$babel->getCode()]);
... | php | protected function echoPageLeader(): void
{
echo '<!DOCTYPE html>';
echo Html::generateTag('html',
['xmlns' => 'http://www.w3.org/1999/xhtml',
'xml:lang' => Abc::$babel->getCode(),
'lang' => Abc::$babel->getCode()]);
... | [
"protected",
"function",
"echoPageLeader",
"(",
")",
":",
"void",
"{",
"echo",
"'<!DOCTYPE html>'",
";",
"echo",
"Html",
"::",
"generateTag",
"(",
"'html'",
",",
"[",
"'xmlns'",
"=>",
"'http://www.w3.org/1999/xhtml'",
",",
"'xml:lang'",
"=>",
"Abc",
"::",
"$",
... | Echos the XHTML document leader, i.e. the start html tag, the head element, and start body tag. | [
"Echos",
"the",
"XHTML",
"document",
"leader",
"i",
".",
"e",
".",
"the",
"start",
"html",
"tag",
"the",
"head",
"element",
"and",
"start",
"body",
"tag",
"."
] | 189d624d96cd70d99f8a838ee87d7afcd77d1576 | https://github.com/SetBased/php-abc-page-core/blob/189d624d96cd70d99f8a838ee87d7afcd77d1576/src/CorePage.php#L109-L128 |
195,542 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.assignFields | protected function assignFields($fields)
{
foreach ($fields as $field) {
if (!$field instanceof FieldInterface) {
throw new ModelException(sprintf('Field must be an instance of FieldInterface, got "%s"', $this->getType($field)));
}
$field->table($t... | php | protected function assignFields($fields)
{
foreach ($fields as $field) {
if (!$field instanceof FieldInterface) {
throw new ModelException(sprintf('Field must be an instance of FieldInterface, got "%s"', $this->getType($field)));
}
$field->table($t... | [
"protected",
"function",
"assignFields",
"(",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"$",
"field",
"instanceof",
"FieldInterface",
")",
"{",
"throw",
"new",
"ModelException",
"(",
"sprintf",
... | Assigns fields to model
@param array $fields
@throws ModelException | [
"Assigns",
"fields",
"to",
"model"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L78-L88 |
195,543 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.assignIndexes | protected function assignIndexes($indexes)
{
foreach ($indexes as $index) {
if (!$index instanceof IndexInterface) {
throw new ModelException(sprintf('Index must be an instance of IndexInterface, got "%s"', $this->getType($index)));
}
foreach ($ind... | php | protected function assignIndexes($indexes)
{
foreach ($indexes as $index) {
if (!$index instanceof IndexInterface) {
throw new ModelException(sprintf('Index must be an instance of IndexInterface, got "%s"', $this->getType($index)));
}
foreach ($ind... | [
"protected",
"function",
"assignIndexes",
"(",
"$",
"indexes",
")",
"{",
"foreach",
"(",
"$",
"indexes",
"as",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"$",
"index",
"instanceof",
"IndexInterface",
")",
"{",
"throw",
"new",
"ModelException",
"(",
"sprintf",... | Assigns indexes to model
@param array $indexes
@throws ModelException | [
"Assigns",
"indexes",
"to",
"model"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L97-L116 |
195,544 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.assignRelations | protected function assignRelations($relations)
{
foreach ($relations as $relation) {
if (!$relation instanceof RelationInterface) {
throw new ModelException(sprintf('Relation must be an instance of RelationInterface, got "%s"', $this->getType($relation)));
}
... | php | protected function assignRelations($relations)
{
foreach ($relations as $relation) {
if (!$relation instanceof RelationInterface) {
throw new ModelException(sprintf('Relation must be an instance of RelationInterface, got "%s"', $this->getType($relation)));
}
... | [
"protected",
"function",
"assignRelations",
"(",
"$",
"relations",
")",
"{",
"foreach",
"(",
"$",
"relations",
"as",
"$",
"relation",
")",
"{",
"if",
"(",
"!",
"$",
"relation",
"instanceof",
"RelationInterface",
")",
"{",
"throw",
"new",
"ModelException",
"(... | Assigns relations to model
@param array $relations
@throws ModelException | [
"Assigns",
"relations",
"to",
"model"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L125-L138 |
195,545 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.assertField | protected function assertField($field)
{
if (!$this->hasField($field)) {
throw new ModelException(sprintf('Unknown field, field "%s" not found in model "%s"', $field, $this->entity));
}
} | php | protected function assertField($field)
{
if (!$this->hasField($field)) {
throw new ModelException(sprintf('Unknown field, field "%s" not found in model "%s"', $field, $this->entity));
}
} | [
"protected",
"function",
"assertField",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasField",
"(",
"$",
"field",
")",
")",
"{",
"throw",
"new",
"ModelException",
"(",
"sprintf",
"(",
"'Unknown field, field \"%s\" not found in model \"%s\"'"... | Asserts if model has field
@param string $field
@throws ModelException | [
"Asserts",
"if",
"model",
"has",
"field"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L205-L210 |
195,546 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.primaryFields | public function primaryFields()
{
$result = [];
foreach ($this->indexes as $index) {
if (!$index->isPrimary()) {
continue;
}
foreach ($index->fields() as $field) {
$result[] = $this->field($field);
}
... | php | public function primaryFields()
{
$result = [];
foreach ($this->indexes as $index) {
if (!$index->isPrimary()) {
continue;
}
foreach ($index->fields() as $field) {
$result[] = $this->field($field);
}
... | [
"public",
"function",
"primaryFields",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"indexes",
"as",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"$",
"index",
"->",
"isPrimary",
"(",
")",
")",
"{",
"continue",
... | Returns array containing names of primary indexes
@return FieldInterface[] | [
"Returns",
"array",
"containing",
"names",
"of",
"primary",
"indexes"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L232-L246 |
195,547 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.indexFields | public function indexFields()
{
$fields = [];
foreach ($this->indexes as $index) {
$fields = array_merge($fields, $index->fields());
}
$result = [];
foreach (array_unique($fields) as $field) {
$result[] = $this->field($field);
}
... | php | public function indexFields()
{
$fields = [];
foreach ($this->indexes as $index) {
$fields = array_merge($fields, $index->fields());
}
$result = [];
foreach (array_unique($fields) as $field) {
$result[] = $this->field($field);
}
... | [
"public",
"function",
"indexFields",
"(",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"indexes",
"as",
"$",
"index",
")",
"{",
"$",
"fields",
"=",
"array_merge",
"(",
"$",
"fields",
",",
"$",
"index",
"->",
"fiel... | Returns array of fields from indexes
@return FieldInterface[] | [
"Returns",
"array",
"of",
"fields",
"from",
"indexes"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L253-L266 |
195,548 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.index | public function index($index)
{
if (empty($this->indexes[$index])) {
throw new ModelException(sprintf('Unknown index, index "%s" not found in model "%s"', $index, $this->entity));
}
return $this->indexes[$index];
} | php | public function index($index)
{
if (empty($this->indexes[$index])) {
throw new ModelException(sprintf('Unknown index, index "%s" not found in model "%s"', $index, $this->entity));
}
return $this->indexes[$index];
} | [
"public",
"function",
"index",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"indexes",
"[",
"$",
"index",
"]",
")",
")",
"{",
"throw",
"new",
"ModelException",
"(",
"sprintf",
"(",
"'Unknown index, index \"%s\" not found in model ... | Returns index definition
@param string $index
@return IndexInterface[]
@throws ModelException | [
"Returns",
"index",
"definition"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L299-L306 |
195,549 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.referredIn | public function referredIn($field)
{
$result = [];
foreach ($this->relations as $relation) {
if (false === $i = array_search($field, $relation->localKeys())) {
continue;
}
$result[$relation->foreignKeys()[$i]] = $relation;
}
... | php | public function referredIn($field)
{
$result = [];
foreach ($this->relations as $relation) {
if (false === $i = array_search($field, $relation->localKeys())) {
continue;
}
$result[$relation->foreignKeys()[$i]] = $relation;
}
... | [
"public",
"function",
"referredIn",
"(",
"$",
"field",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"relations",
"as",
"$",
"relation",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"i",
"=",
"array_search",
"(",
"$",... | Returns all relation where field is listed as local key
@param string $field
@return RelationInterface[] | [
"Returns",
"all",
"relation",
"where",
"field",
"is",
"listed",
"as",
"local",
"key"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L315-L327 |
195,550 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.relation | public function relation($relationName)
{
if (!$relation = $this->findRelationByName($relationName)) {
throw new ModelException(sprintf('Unknown relation, relation "%s" not found in model "%s"', $relationName, $this->entity));
}
return $relation;
} | php | public function relation($relationName)
{
if (!$relation = $this->findRelationByName($relationName)) {
throw new ModelException(sprintf('Unknown relation, relation "%s" not found in model "%s"', $relationName, $this->entity));
}
return $relation;
} | [
"public",
"function",
"relation",
"(",
"$",
"relationName",
")",
"{",
"if",
"(",
"!",
"$",
"relation",
"=",
"$",
"this",
"->",
"findRelationByName",
"(",
"$",
"relationName",
")",
")",
"{",
"throw",
"new",
"ModelException",
"(",
"sprintf",
"(",
"'Unknown r... | Returns relation definition for passed entity class
@param string $relationName
@return RelationInterface
@throws ModelException | [
"Returns",
"relation",
"definition",
"for",
"passed",
"entity",
"class"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L369-L376 |
195,551 | mossphp/moss-storage | Moss/Storage/Model/Model.php | Model.findRelationByName | protected function findRelationByName($relationName)
{
foreach ($this->relations as $relation) {
if ($relation->name() == $relationName || $relation->entity() == $relationName) {
return $relation;
}
}
return null;
} | php | protected function findRelationByName($relationName)
{
foreach ($this->relations as $relation) {
if ($relation->name() == $relationName || $relation->entity() == $relationName) {
return $relation;
}
}
return null;
} | [
"protected",
"function",
"findRelationByName",
"(",
"$",
"relationName",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"relations",
"as",
"$",
"relation",
")",
"{",
"if",
"(",
"$",
"relation",
"->",
"name",
"(",
")",
"==",
"$",
"relationName",
"||",
"$",
... | Finds relation by its name
@param string $relationName
@return RelationInterface | [
"Finds",
"relation",
"by",
"its",
"name"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Model.php#L385-L394 |
195,552 | squareproton/Bond | src/Bond/Container.php | Container.remove | public function remove()
{
$removed = 0;
foreach( func_get_args() as $arg ){
// is this a container?
if( $arg instanceof Container ) {
$originalCount = $this->count();
$this->collection = array_diff_key( $this->collection, $arg->collection )... | php | public function remove()
{
$removed = 0;
foreach( func_get_args() as $arg ){
// is this a container?
if( $arg instanceof Container ) {
$originalCount = $this->count();
$this->collection = array_diff_key( $this->collection, $arg->collection )... | [
"public",
"function",
"remove",
"(",
")",
"{",
"$",
"removed",
"=",
"0",
";",
"foreach",
"(",
"func_get_args",
"(",
")",
"as",
"$",
"arg",
")",
"{",
"// is this a container?",
"if",
"(",
"$",
"arg",
"instanceof",
"Container",
")",
"{",
"$",
"originalCoun... | Remove entities from collection
@param ContainerableInterface|Container|ContainerableInterface[]
@return int Number removed | [
"Remove",
"entities",
"from",
"collection"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L161-L192 |
195,553 | squareproton/Bond | src/Bond/Container.php | Container.mapCombine | public function mapCombine( $keys, $values )
{
return array_combine(
array_map( $keys, $this->collection ),
array_map( $values, $this->collection )
);
} | php | public function mapCombine( $keys, $values )
{
return array_combine(
array_map( $keys, $this->collection ),
array_map( $values, $this->collection )
);
} | [
"public",
"function",
"mapCombine",
"(",
"$",
"keys",
",",
"$",
"values",
")",
"{",
"return",
"array_combine",
"(",
"array_map",
"(",
"$",
"keys",
",",
"$",
"this",
"->",
"collection",
")",
",",
"array_map",
"(",
"$",
"values",
",",
"$",
"this",
"->",
... | MapCombine. Like array map but takes a callback for the array keys
@param callback. Specifies the keys of the return array
@param callback. Specifies the values of the return array
@return array | [
"MapCombine",
".",
"Like",
"array",
"map",
"but",
"takes",
"a",
"callback",
"for",
"the",
"array",
"keys"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L287-L293 |
195,554 | squareproton/Bond | src/Bond/Container.php | Container.pluck | public function pluck( $property, $ifEmptyDefaultToContainer = false )
{
$mapper = $this->getPropertyMapper($property);
$isAllObjects = true;
$output = [];
foreach( $this->collection as $obj ) {
$propertyValue = $mapper->get($obj);
$isAllObjects = $isAllObje... | php | public function pluck( $property, $ifEmptyDefaultToContainer = false )
{
$mapper = $this->getPropertyMapper($property);
$isAllObjects = true;
$output = [];
foreach( $this->collection as $obj ) {
$propertyValue = $mapper->get($obj);
$isAllObjects = $isAllObje... | [
"public",
"function",
"pluck",
"(",
"$",
"property",
",",
"$",
"ifEmptyDefaultToContainer",
"=",
"false",
")",
"{",
"$",
"mapper",
"=",
"$",
"this",
"->",
"getPropertyMapper",
"(",
"$",
"property",
")",
";",
"$",
"isAllObjects",
"=",
"true",
";",
"$",
"o... | Pluck a property from the collection
@param string Property
@return mixed Bond\Container | mixed[] | [
"Pluck",
"a",
"property",
"from",
"the",
"collection"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L311-L335 |
195,555 | squareproton/Bond | src/Bond/Container.php | Container.generateSortByPropertyClosure | private function generateSortByPropertyClosure( $property, $direction = SORT_ASC )
{
if( $direction === SORT_DESC ) {
$aLTb = 1;
$aGTb = -1;
} else {
$aLTb = -1;
$aGTb = 1;
}
$mapper = $this->getPropertyMapper($property);
ret... | php | private function generateSortByPropertyClosure( $property, $direction = SORT_ASC )
{
if( $direction === SORT_DESC ) {
$aLTb = 1;
$aGTb = -1;
} else {
$aLTb = -1;
$aGTb = 1;
}
$mapper = $this->getPropertyMapper($property);
ret... | [
"private",
"function",
"generateSortByPropertyClosure",
"(",
"$",
"property",
",",
"$",
"direction",
"=",
"SORT_ASC",
")",
"{",
"if",
"(",
"$",
"direction",
"===",
"SORT_DESC",
")",
"{",
"$",
"aLTb",
"=",
"1",
";",
"$",
"aGTb",
"=",
"-",
"1",
";",
"}",... | Return a user defined sort comparison function that is property mapper aware.
@param string Property to sort on.
@param const SORT_DESC | SORT_ASC Sort direction
@return callable | [
"Return",
"a",
"user",
"defined",
"sort",
"comparison",
"function",
"that",
"is",
"property",
"mapper",
"aware",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L343-L365 |
195,556 | squareproton/Bond | src/Bond/Container.php | Container.generateGetPropertyClosure | private function generateGetPropertyClosure( $property )
{
$mapper = $this->getPropertyMapper($property);
return function( $obj ) use ( $mapper ) {
return $mapper->get($obj);
};
} | php | private function generateGetPropertyClosure( $property )
{
$mapper = $this->getPropertyMapper($property);
return function( $obj ) use ( $mapper ) {
return $mapper->get($obj);
};
} | [
"private",
"function",
"generateGetPropertyClosure",
"(",
"$",
"property",
")",
"{",
"$",
"mapper",
"=",
"$",
"this",
"->",
"getPropertyMapper",
"(",
"$",
"property",
")",
";",
"return",
"function",
"(",
"$",
"obj",
")",
"use",
"(",
"$",
"mapper",
")",
"... | Returns a callable to access a object property
@param string $property
@return callable | [
"Returns",
"a",
"callable",
"to",
"access",
"a",
"object",
"property"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L372-L378 |
195,557 | squareproton/Bond | src/Bond/Container.php | Container.sortByProperty | public function sortByProperty( $property, $direction = null )
{
$this->sort( $this->generateSortByPropertyClosure( $property, $direction ) );
return $this;
} | php | public function sortByProperty( $property, $direction = null )
{
$this->sort( $this->generateSortByPropertyClosure( $property, $direction ) );
return $this;
} | [
"public",
"function",
"sortByProperty",
"(",
"$",
"property",
",",
"$",
"direction",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"sort",
"(",
"$",
"this",
"->",
"generateSortByPropertyClosure",
"(",
"$",
"property",
",",
"$",
"direction",
")",
")",
";",
"r... | Sort container by property
@param property $property
@param SORT_ASC|SORT_DESC $direction
@return Container | [
"Sort",
"container",
"by",
"property"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L386-L390 |
195,558 | squareproton/Bond | src/Bond/Container.php | Container.checkEntity | private function checkEntity( $obj )
{
if( $class = $this->classGet() and !( $obj instanceof $class ) ) {
throw new \InvalidArgumentException(
sprintf(
'Obj %s is not compatible with Container of class %s',
get_class( $obj ),
... | php | private function checkEntity( $obj )
{
if( $class = $this->classGet() and !( $obj instanceof $class ) ) {
throw new \InvalidArgumentException(
sprintf(
'Obj %s is not compatible with Container of class %s',
get_class( $obj ),
... | [
"private",
"function",
"checkEntity",
"(",
"$",
"obj",
")",
"{",
"if",
"(",
"$",
"class",
"=",
"$",
"this",
"->",
"classGet",
"(",
")",
"and",
"!",
"(",
"$",
"obj",
"instanceof",
"$",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentExce... | Check an entity implments ContainerInterface.
It should be the same type of entities already in collection.
@param mixed $obj
@return bool | [
"Check",
"an",
"entity",
"implments",
"ContainerInterface",
".",
"It",
"should",
"be",
"the",
"same",
"type",
"of",
"entities",
"already",
"in",
"collection",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L458-L470 |
195,559 | squareproton/Bond | src/Bond/Container.php | Container.checkEntityArray | private function checkEntityArray( array $entityArray, &$error = null )
{
// get class
if( $existing = $this->classGet() ) {
foreach( $entityArray as $value ) {
if( !( $value instanceof $existing ) ) {
$error = "Can't add entity of class `".get_class( ... | php | private function checkEntityArray( array $entityArray, &$error = null )
{
// get class
if( $existing = $this->classGet() ) {
foreach( $entityArray as $value ) {
if( !( $value instanceof $existing ) ) {
$error = "Can't add entity of class `".get_class( ... | [
"private",
"function",
"checkEntityArray",
"(",
"array",
"$",
"entityArray",
",",
"&",
"$",
"error",
"=",
"null",
")",
"{",
"// get class",
"if",
"(",
"$",
"existing",
"=",
"$",
"this",
"->",
"classGet",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"entity... | Check if a array of Entity's is compatible with this container
@param array $entityArray
@return bool | [
"Check",
"if",
"a",
"array",
"of",
"Entity",
"s",
"is",
"compatible",
"with",
"this",
"container"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L477-L490 |
195,560 | squareproton/Bond | src/Bond/Container.php | Container.contains | public function contains()
{
$output = true;
$args = func_get_args();
// support a arbritary number objects against which to test
while( list(,$value) = each($args) and $output ) {
// is entity
if( $value instanceof Container ) {
$numChecki... | php | public function contains()
{
$output = true;
$args = func_get_args();
// support a arbritary number objects against which to test
while( list(,$value) = each($args) and $output ) {
// is entity
if( $value instanceof Container ) {
$numChecki... | [
"public",
"function",
"contains",
"(",
")",
"{",
"$",
"output",
"=",
"true",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"// support a arbritary number objects against which to test",
"while",
"(",
"list",
"(",
",",
"$",
"value",
")",
"=",
"each",
... | Does this container contain the following entities
@param ContainerableInterface|Container|ContainerableInterface[]
@return boolean | [
"Does",
"this",
"container",
"contain",
"the",
"following",
"entities"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L535-L579 |
195,561 | squareproton/Bond | src/Bond/Container.php | Container.arrayHelperMethod | private function arrayHelperMethod( $fn, array $args )
{
$class = $this->classGet();
$fnArguments = array( $this->collection );
foreach( $args as $container ) {
// validate the arguments
if( !( $container instanceof $this ) ) {
throw new \InvalidArg... | php | private function arrayHelperMethod( $fn, array $args )
{
$class = $this->classGet();
$fnArguments = array( $this->collection );
foreach( $args as $container ) {
// validate the arguments
if( !( $container instanceof $this ) ) {
throw new \InvalidArg... | [
"private",
"function",
"arrayHelperMethod",
"(",
"$",
"fn",
",",
"array",
"$",
"args",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"classGet",
"(",
")",
";",
"$",
"fnArguments",
"=",
"array",
"(",
"$",
"this",
"->",
"collection",
")",
";",
"forea... | Validation and execution helper method for intersect and diff.
@param $fn Callback like object
@return Container | [
"Validation",
"and",
"execution",
"helper",
"method",
"for",
"intersect",
"and",
"diff",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L617-L646 |
195,562 | squareproton/Bond | src/Bond/Container.php | Container.randomGet | public function randomGet( $n = null, $returnContainer = false, $removeFromContainer = false )
{
$n = $n === null ? 1 : (int) $n;
// anything to give?
if( 0 === $containerSize = $this->count() ) {
if( $returnContainer or $n > 1 ) {
return $this->newContainer();
... | php | public function randomGet( $n = null, $returnContainer = false, $removeFromContainer = false )
{
$n = $n === null ? 1 : (int) $n;
// anything to give?
if( 0 === $containerSize = $this->count() ) {
if( $returnContainer or $n > 1 ) {
return $this->newContainer();
... | [
"public",
"function",
"randomGet",
"(",
"$",
"n",
"=",
"null",
",",
"$",
"returnContainer",
"=",
"false",
",",
"$",
"removeFromContainer",
"=",
"false",
")",
"{",
"$",
"n",
"=",
"$",
"n",
"===",
"null",
"?",
"1",
":",
"(",
"int",
")",
"$",
"n",
"... | Return a random number of entities from this collection.
If n = 1 you will recieve a entity otherwise you will get a container
@param int
@param bool Force a container to always be returned
@param bool Remove the items from the container as they are returned
@return ContainerableInterface|Container | [
"Return",
"a",
"random",
"number",
"of",
"entities",
"from",
"this",
"collection",
".",
"If",
"n",
"=",
"1",
"you",
"will",
"recieve",
"a",
"entity",
"otherwise",
"you",
"will",
"get",
"a",
"container"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L727-L775 |
195,563 | squareproton/Bond | src/Bond/Container.php | Container.findByFilterComponents | public function findByFilterComponents( $qty, array $filterComponents )
{
// don't use $this copy because we might not be returning a object of exactly the same type
$output = $this->copy();
// nothing to filter - return what we've got
if( !$filterComponents ) {
return ... | php | public function findByFilterComponents( $qty, array $filterComponents )
{
// don't use $this copy because we might not be returning a object of exactly the same type
$output = $this->copy();
// nothing to filter - return what we've got
if( !$filterComponents ) {
return ... | [
"public",
"function",
"findByFilterComponents",
"(",
"$",
"qty",
",",
"array",
"$",
"filterComponents",
")",
"{",
"// don't use $this copy because we might not be returning a object of exactly the same type",
"$",
"output",
"=",
"$",
"this",
"->",
"copy",
"(",
")",
";",
... | Filter a container
@param FindFilterComponentFactory::FIND_ALL | FindFilterComponentFactory::FIND_ONE $qty
@param Bond\Container\FindFilterComponent[]
@return object|Container | [
"Filter",
"a",
"container"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L838-L893 |
195,564 | squareproton/Bond | src/Bond/Container.php | Container.classSet | public function classSet( $input )
{
if( is_object( $input ) ) {
if( $input instanceof self ) {
$class = $input->classGet();
} else {
$class = get_class( $input );
}
} else {
$class = $input;
}
$current... | php | public function classSet( $input )
{
if( is_object( $input ) ) {
if( $input instanceof self ) {
$class = $input->classGet();
} else {
$class = get_class( $input );
}
} else {
$class = $input;
}
$current... | [
"public",
"function",
"classSet",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"input",
")",
")",
"{",
"if",
"(",
"$",
"input",
"instanceof",
"self",
")",
"{",
"$",
"class",
"=",
"$",
"input",
"->",
"classGet",
"(",
")",
";",
"}... | Set a containers class
@param string|Object|Repository|Container class
@return bool | [
"Set",
"a",
"containers",
"class"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L900-L922 |
195,565 | squareproton/Bond | src/Bond/Container.php | Container.classGet | private function classGet()
{
return isset( $this->class )
? $this->class
: (
( $firstElement = $this->firstElementGet() )
? ( $this->class = get_class( $firstElement ) )
: null
)
;
} | php | private function classGet()
{
return isset( $this->class )
? $this->class
: (
( $firstElement = $this->firstElementGet() )
? ( $this->class = get_class( $firstElement ) )
: null
)
;
} | [
"private",
"function",
"classGet",
"(",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"class",
")",
"?",
"$",
"this",
"->",
"class",
":",
"(",
"(",
"$",
"firstElement",
"=",
"$",
"this",
"->",
"firstElementGet",
"(",
")",
")",
"?",
"(",
"$",... | Get the class of this container.
@return string Class | null | [
"Get",
"the",
"class",
"of",
"this",
"container",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L928-L938 |
195,566 | squareproton/Bond | src/Bond/Container.php | Container.splitByClass | public function splitByClass()
{
$classes = array();
foreach( $this->collection as $key => $entity ) {
$classes[get_class($entity)][] = $key;
}
ksort( $classes );
$output = array();
foreach( $classes as $class => $splHashes ) {
$container = $... | php | public function splitByClass()
{
$classes = array();
foreach( $this->collection as $key => $entity ) {
$classes[get_class($entity)][] = $key;
}
ksort( $classes );
$output = array();
foreach( $classes as $class => $splHashes ) {
$container = $... | [
"public",
"function",
"splitByClass",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"collection",
"as",
"$",
"key",
"=>",
"$",
"entity",
")",
"{",
"$",
"classes",
"[",
"get_class",
"(",
"$",
"entity",
... | Split by class
@return array of containers | [
"Split",
"by",
"class"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L944-L965 |
195,567 | squareproton/Bond | src/Bond/Container.php | Container.implode | public function implode( $glue, $propertyOrClosure = null )
{
if( null === $propertyOrClosure ) {
$pieces = $this->map('strval');
} elseif ( $propertyOrClosure instanceof \Closure ) {
$pieces = $this->map( $propertyOrClosure );
} else {
$pieces = $this->ma... | php | public function implode( $glue, $propertyOrClosure = null )
{
if( null === $propertyOrClosure ) {
$pieces = $this->map('strval');
} elseif ( $propertyOrClosure instanceof \Closure ) {
$pieces = $this->map( $propertyOrClosure );
} else {
$pieces = $this->ma... | [
"public",
"function",
"implode",
"(",
"$",
"glue",
",",
"$",
"propertyOrClosure",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"propertyOrClosure",
")",
"{",
"$",
"pieces",
"=",
"$",
"this",
"->",
"map",
"(",
"'strval'",
")",
";",
"}",
"else... | Seems like I'm more and more imploding groups of entities on something
@param string $glue
@param mixed $propertyOrClosure | [
"Seems",
"like",
"I",
"m",
"more",
"and",
"more",
"imploding",
"groups",
"of",
"entities",
"on",
"something"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L990-L1000 |
195,568 | squareproton/Bond | src/Bond/Container.php | Container.newContainer | public function newContainer()
{
$refl = new ReflectionClass($this);
$container = $refl->newInstanceArgs(func_get_args());
$container->classSet($this->class);
$container->propertyMapper = $this->propertyMapper;
return $container;
} | php | public function newContainer()
{
$refl = new ReflectionClass($this);
$container = $refl->newInstanceArgs(func_get_args());
$container->classSet($this->class);
$container->propertyMapper = $this->propertyMapper;
return $container;
} | [
"public",
"function",
"newContainer",
"(",
")",
"{",
"$",
"refl",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"$",
"container",
"=",
"$",
"refl",
"->",
"newInstanceArgs",
"(",
"func_get_args",
"(",
")",
")",
";",
"$",
"container",
"->",
... | Generate a new empty container of the same type as what is currently instantiated
@param string | [
"Generate",
"a",
"new",
"empty",
"container",
"of",
"the",
"same",
"type",
"as",
"what",
"is",
"currently",
"instantiated"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container.php#L1006-L1013 |
195,569 | t-kanstantsin/fileupload | src/FileManager.php | FileManager.init | public function init(): void
{
parent::init();
if (!($this->contentFS instanceof Filesystem)) {
throw new InvalidConfigException(sprintf('ContentFS must be instance of %s.', Filesystem::class));
}
if (!($this->cacheFS instanceof Filesystem)) {
throw new Inval... | php | public function init(): void
{
parent::init();
if (!($this->contentFS instanceof Filesystem)) {
throw new InvalidConfigException(sprintf('ContentFS must be instance of %s.', Filesystem::class));
}
if (!($this->cacheFS instanceof Filesystem)) {
throw new Inval... | [
"public",
"function",
"init",
"(",
")",
":",
"void",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"contentFS",
"instanceof",
"Filesystem",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"sprintf",
"... | Check initialization parameters and parse configs
@throws config\InvalidConfigException | [
"Check",
"initialization",
"parameters",
"and",
"parse",
"configs"
] | d6317a9b9b36d992f09affe3900ef7d7ddfd855f | https://github.com/t-kanstantsin/fileupload/blob/d6317a9b9b36d992f09affe3900ef7d7ddfd855f/src/FileManager.php#L78-L93 |
195,570 | t-kanstantsin/fileupload | src/FileManager.php | FileManager.getFilePath | public function getFilePath(IFile $file, string $format, array $formatterConfig = []): ?string
{
$alias = $this->getAliasConfig($file->getModelAlias());
$formatter = $this->buildFormatter($file, $format, $formatterConfig);
$targetPath = $alias->getAssetPath($file, $format);
if (!$th... | php | public function getFilePath(IFile $file, string $format, array $formatterConfig = []): ?string
{
$alias = $this->getAliasConfig($file->getModelAlias());
$formatter = $this->buildFormatter($file, $format, $formatterConfig);
$targetPath = $alias->getAssetPath($file, $format);
if (!$th... | [
"public",
"function",
"getFilePath",
"(",
"IFile",
"$",
"file",
",",
"string",
"$",
"format",
",",
"array",
"$",
"formatterConfig",
"=",
"[",
"]",
")",
":",
"?",
"string",
"{",
"$",
"alias",
"=",
"$",
"this",
"->",
"getAliasConfig",
"(",
"$",
"file",
... | Caches file and returns url to it.
@param IFile $file
@param string $format
@param array $formatterConfig
@return string|null path to image in cacheFS or null if fails
@throws \InvalidArgumentException
@throws \RuntimeException
@throws \League\Flysystem\FileNotFoundException
@throws InvalidConfigException | [
"Caches",
"file",
"and",
"returns",
"url",
"to",
"it",
"."
] | d6317a9b9b36d992f09affe3900ef7d7ddfd855f | https://github.com/t-kanstantsin/fileupload/blob/d6317a9b9b36d992f09affe3900ef7d7ddfd855f/src/FileManager.php#L156-L167 |
195,571 | t-kanstantsin/fileupload | src/FileManager.php | FileManager.cacheFile | protected function cacheFile(IFile $file, FileFormatter $formatter, string $targetPath): bool
{
if ($file instanceof ICacheStateful && $file->getIsCached($formatter->name)) {
return true;
}
return (new Saver($file, $this->cacheFS, $targetPath))->save($formatter);
} | php | protected function cacheFile(IFile $file, FileFormatter $formatter, string $targetPath): bool
{
if ($file instanceof ICacheStateful && $file->getIsCached($formatter->name)) {
return true;
}
return (new Saver($file, $this->cacheFS, $targetPath))->save($formatter);
} | [
"protected",
"function",
"cacheFile",
"(",
"IFile",
"$",
"file",
",",
"FileFormatter",
"$",
"formatter",
",",
"string",
"$",
"targetPath",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"file",
"instanceof",
"ICacheStateful",
"&&",
"$",
"file",
"->",
"getIsCached",
... | Caches file available in web.
@param IFile $file
@param FileFormatter $formatter
@param string $targetPath
@return bool
@throws \InvalidArgumentException
@throws InvalidConfigException
@throws \League\Flysystem\FileNotFoundException | [
"Caches",
"file",
"available",
"in",
"web",
"."
] | d6317a9b9b36d992f09affe3900ef7d7ddfd855f | https://github.com/t-kanstantsin/fileupload/blob/d6317a9b9b36d992f09affe3900ef7d7ddfd855f/src/FileManager.php#L180-L187 |
195,572 | polusphp/polus-middleware | src/HttpError.php | HttpError.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
$code = $response->getStatusCode();
$allowedCodes = array_keys($this->renderer) + array_keys($this->defaultErrors);
if (in_array($co... | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
$code = $response->getStatusCode();
$allowedCodes = array_keys($this->renderer) + array_keys($this->defaultErrors);
if (in_array($co... | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"handler",
")",
":",
"ResponseInterface",
"{",
"$",
"response",
"=",
"$",
"handler",
"->",
"handle",
"(",
"$",
"request",
")",
";",
"$",
"code"... | Execute the middleware. | [
"Execute",
"the",
"middleware",
"."
] | c265c51fbdf6b2c5ed85686415b47a1fbf720c57 | https://github.com/polusphp/polus-middleware/blob/c265c51fbdf6b2c5ed85686415b47a1fbf720c57/src/HttpError.php#L89-L122 |
195,573 | ARCANESOFT/Auth | src/ViewComposers/Dashboard/OnlineUsersCountComposer.php | OnlineUsersCountComposer.getOnlineUsers | private function getOnlineUsers()
{
$date = Carbon::now()->subMinutes(
config('arcanesoft.auth.track-activity.minutes', 5)
);
return $this->getCachedUsers()->filter(function (User $user) use ($date) {
return ! is_null($user->last_activity) && $user->last_activity->gt... | php | private function getOnlineUsers()
{
$date = Carbon::now()->subMinutes(
config('arcanesoft.auth.track-activity.minutes', 5)
);
return $this->getCachedUsers()->filter(function (User $user) use ($date) {
return ! is_null($user->last_activity) && $user->last_activity->gt... | [
"private",
"function",
"getOnlineUsers",
"(",
")",
"{",
"$",
"date",
"=",
"Carbon",
"::",
"now",
"(",
")",
"->",
"subMinutes",
"(",
"config",
"(",
"'arcanesoft.auth.track-activity.minutes'",
",",
"5",
")",
")",
";",
"return",
"$",
"this",
"->",
"getCachedUse... | Get the online users.
@return \Illuminate\Database\Eloquent\Collection | [
"Get",
"the",
"online",
"users",
"."
] | b33ca82597a76b1e395071f71ae3e51f1ec67e62 | https://github.com/ARCANESOFT/Auth/blob/b33ca82597a76b1e395071f71ae3e51f1ec67e62/src/ViewComposers/Dashboard/OnlineUsersCountComposer.php#L45-L54 |
195,574 | AnonymPHP/Anonym-Route | ModelDispatcher.php | ModelDispatcher.model | public function model($name = '', $namespace = null)
{
if (null === $name) {
$namespace = $this->namespace;
}
$namespace = $this->resolveNamespace($namespace);
$model = $this->model = $this->createModelInstance($namespace, $name);
return $model;
} | php | public function model($name = '', $namespace = null)
{
if (null === $name) {
$namespace = $this->namespace;
}
$namespace = $this->resolveNamespace($namespace);
$model = $this->model = $this->createModelInstance($namespace, $name);
return $model;
} | [
"public",
"function",
"model",
"(",
"$",
"name",
"=",
"''",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"name",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"namespace",
";",
"}",
"$",
"namespace",
"=",
"$"... | create and return model instance
@param string $name
@param null $namespace
@return mixed | [
"create",
"and",
"return",
"model",
"instance"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/ModelDispatcher.php#L40-L50 |
195,575 | fulgurio/LightCMSBundle | Extension/LightCMSTwigExtension.php | LightCMSTwigExtension.getDataForBreadcrumb | public function getDataForBreadcrumb(Page $page)
{
$parent = $page->getParent();
if ($parent)
{
$data = array();
if ($parent->getParent())
{
$data = array_merge($this->getDataForBreadcrumb($parent), $data);
}
$data[]... | php | public function getDataForBreadcrumb(Page $page)
{
$parent = $page->getParent();
if ($parent)
{
$data = array();
if ($parent->getParent())
{
$data = array_merge($this->getDataForBreadcrumb($parent), $data);
}
$data[]... | [
"public",
"function",
"getDataForBreadcrumb",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"parent",
"=",
"$",
"page",
"->",
"getParent",
"(",
")",
";",
"if",
"(",
"$",
"parent",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"pa... | Get breadcrumb data
@param Page $page
@return array|NULL | [
"Get",
"breadcrumb",
"data"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Extension/LightCMSTwigExtension.php#L87-L101 |
195,576 | fulgurio/LightCMSBundle | Extension/LightCMSTwigExtension.php | LightCMSTwigExtension.allowChildren | public function allowChildren(Page $page)
{
$models = $this->container->getParameter('fulgurio_light_cms.models');
return $models[$page->getModel()]['allow_children'];
} | php | public function allowChildren(Page $page)
{
$models = $this->container->getParameter('fulgurio_light_cms.models');
return $models[$page->getModel()]['allow_children'];
} | [
"public",
"function",
"allowChildren",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"models",
"=",
"$",
"this",
"->",
"container",
"->",
"getParameter",
"(",
"'fulgurio_light_cms.models'",
")",
";",
"return",
"$",
"models",
"[",
"$",
"page",
"->",
"getModel",
... | Check if page model allow children
@param Page $page | [
"Check",
"if",
"page",
"model",
"allow",
"children"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Extension/LightCMSTwigExtension.php#L108-L112 |
195,577 | fulgurio/LightCMSBundle | Extension/LightCMSTwigExtension.php | LightCMSTwigExtension.needTranslatedPages | public function needTranslatedPages(Page $page)
{
// Route page
if (!$page->getParent() || !is_null($page->getSourceId()))
{
return FALSE;
}
if ($this->container->hasParameter('fulgurio_light_cms.languages'))
{
$availableLangs = $this->container->get... | php | public function needTranslatedPages(Page $page)
{
// Route page
if (!$page->getParent() || !is_null($page->getSourceId()))
{
return FALSE;
}
if ($this->container->hasParameter('fulgurio_light_cms.languages'))
{
$availableLangs = $this->container->get... | [
"public",
"function",
"needTranslatedPages",
"(",
"Page",
"$",
"page",
")",
"{",
"// Route page",
"if",
"(",
"!",
"$",
"page",
"->",
"getParent",
"(",
")",
"||",
"!",
"is_null",
"(",
"$",
"page",
"->",
"getSourceId",
"(",
")",
")",
")",
"{",
"return",
... | Get parent page to copy page for translation
@param Page $page
@return multitype:number | [
"Get",
"parent",
"page",
"to",
"copy",
"page",
"for",
"translation"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Extension/LightCMSTwigExtension.php#L119-L181 |
195,578 | fulgurio/LightCMSBundle | Extension/LightCMSTwigExtension.php | LightCMSTwigExtension.thumb | public function thumb($media, $size = 'small')
{
$thumbSizes = $this->container->getParameter('fulgurio_light_cms.thumbs');
return LightCMSUtils::getThumbFilename($media->getFullPath(), $media->getMediaType(), $thumbSizes[$size]);
} | php | public function thumb($media, $size = 'small')
{
$thumbSizes = $this->container->getParameter('fulgurio_light_cms.thumbs');
return LightCMSUtils::getThumbFilename($media->getFullPath(), $media->getMediaType(), $thumbSizes[$size]);
} | [
"public",
"function",
"thumb",
"(",
"$",
"media",
",",
"$",
"size",
"=",
"'small'",
")",
"{",
"$",
"thumbSizes",
"=",
"$",
"this",
"->",
"container",
"->",
"getParameter",
"(",
"'fulgurio_light_cms.thumbs'",
")",
";",
"return",
"LightCMSUtils",
"::",
"getThu... | Get thumb of a picture
@param Page $page | [
"Get",
"thumb",
"of",
"a",
"picture"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Extension/LightCMSTwigExtension.php#L188-L192 |
195,579 | fulgurio/LightCMSBundle | Extension/LightCMSTwigExtension.php | LightCMSTwigExtension.getPagesMenu | public function getPagesMenu($menuName, $lang = NULL)
{
// $currentUser = $this->securityContext->getToken()->getUser();
// if ($currentUser != 'anon.')
// {
// $roles = $currentUser->getRoles();
// }
// else
// {
// $roles = array();
// ... | php | public function getPagesMenu($menuName, $lang = NULL)
{
// $currentUser = $this->securityContext->getToken()->getUser();
// if ($currentUser != 'anon.')
// {
// $roles = $currentUser->getRoles();
// }
// else
// {
// $roles = array();
// ... | [
"public",
"function",
"getPagesMenu",
"(",
"$",
"menuName",
",",
"$",
"lang",
"=",
"NULL",
")",
"{",
"// $currentUser = $this->securityContext->getToken()->getUser();",
"// if ($currentUser != 'anon.')",
"// {",
"// $roles = $currentUser->getRoles(... | Get page menu to display
@param string $menuName
@param string $lang
@return array | [
"Get",
"page",
"menu",
"to",
"display"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Extension/LightCMSTwigExtension.php#L201-L236 |
195,580 | koolkode/k2 | src/Instrument/InstrumentorLoader.php | InstrumentorLoader.getHash | public function getHash()
{
$data = [];
foreach($this->instrumentors as $instrumentor)
{
$data[get_class($instrumentor)] = NULL;
if($instrumentor instanceof CachingInstrumentorInterface)
{
$data[get_class($instrumentor)] = $instrumentor->getHash();
}
else
{
$data[get_class($instrum... | php | public function getHash()
{
$data = [];
foreach($this->instrumentors as $instrumentor)
{
$data[get_class($instrumentor)] = NULL;
if($instrumentor instanceof CachingInstrumentorInterface)
{
$data[get_class($instrumentor)] = $instrumentor->getHash();
}
else
{
$data[get_class($instrum... | [
"public",
"function",
"getHash",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"instrumentors",
"as",
"$",
"instrumentor",
")",
"{",
"$",
"data",
"[",
"get_class",
"(",
"$",
"instrumentor",
")",
"]",
"=",
"NULL",
... | Get a hash computed from the the fully-qualified names of all registered instrumentors.
@return string | [
"Get",
"a",
"hash",
"computed",
"from",
"the",
"the",
"fully",
"-",
"qualified",
"names",
"of",
"all",
"registered",
"instrumentors",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Instrument/InstrumentorLoader.php#L72-L106 |
195,581 | koolkode/k2 | src/Instrument/InstrumentorLoader.php | InstrumentorLoader.getLastModified | public function getLastModified()
{
$mtime = 0;
foreach($this->instrumentors as $instrumentor)
{
$mtime = max($mtime, filemtime((new \ReflectionClass($instrumentor))->getFileName()));
if($instrumentor instanceof CachingInstrumentorInterface)
{
$mtime = max($mtime, $instrumentor->getLastModifi... | php | public function getLastModified()
{
$mtime = 0;
foreach($this->instrumentors as $instrumentor)
{
$mtime = max($mtime, filemtime((new \ReflectionClass($instrumentor))->getFileName()));
if($instrumentor instanceof CachingInstrumentorInterface)
{
$mtime = max($mtime, $instrumentor->getLastModifi... | [
"public",
"function",
"getLastModified",
"(",
")",
"{",
"$",
"mtime",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"instrumentors",
"as",
"$",
"instrumentor",
")",
"{",
"$",
"mtime",
"=",
"max",
"(",
"$",
"mtime",
",",
"filemtime",
"(",
"(",
"ne... | Get the most-recent modification time computed from all registered instrumentors.
@return integer | [
"Get",
"the",
"most",
"-",
"recent",
"modification",
"time",
"computed",
"from",
"all",
"registered",
"instrumentors",
"."
] | c425a1bc7d2f8c567b1b0cc724ca9e8be7087397 | https://github.com/koolkode/k2/blob/c425a1bc7d2f8c567b1b0cc724ca9e8be7087397/src/Instrument/InstrumentorLoader.php#L113-L128 |
195,582 | prolic/HumusMvc | src/HumusMvc/Dispatcher.php | Dispatcher.isDispatchable | public function isDispatchable(Request $request)
{
$className = $this->getControllerClass($request);
if (($this->_defaultModule != $this->_curModule)
|| $this->getParam('prefixDefaultModule'))
{
$className = $this->formatClassName($this->_curModule, $className);
}... | php | public function isDispatchable(Request $request)
{
$className = $this->getControllerClass($request);
if (($this->_defaultModule != $this->_curModule)
|| $this->getParam('prefixDefaultModule'))
{
$className = $this->formatClassName($this->_curModule, $className);
}... | [
"public",
"function",
"isDispatchable",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"getControllerClass",
"(",
"$",
"request",
")",
";",
"if",
"(",
"(",
"$",
"this",
"->",
"_defaultModule",
"!=",
"$",
"this",
"->",... | Returns TRUE if the Zend_Controller_Request_Abstract object can be
dispatched to a controller.
Use this method wisely. By default, the dispatcher will fall back to the
default controller (either in the module specified or the global default)
if a given controller does not exist. This method returning false does
not ne... | [
"Returns",
"TRUE",
"if",
"the",
"Zend_Controller_Request_Abstract",
"object",
"can",
"be",
"dispatched",
"to",
"a",
"controller",
"."
] | 09e8c6422d84b57745cc643047e10761be2a21a7 | https://github.com/prolic/HumusMvc/blob/09e8c6422d84b57745cc643047e10761be2a21a7/src/HumusMvc/Dispatcher.php#L73-L85 |
195,583 | libreworks/caridea-session | src/Values.php | Values.init | protected function init(): bool
{
if (!isset($_SESSION[$this->name])) {
$_SESSION[$this->name] = [];
}
return true;
} | php | protected function init(): bool
{
if (!isset($_SESSION[$this->name])) {
$_SESSION[$this->name] = [];
}
return true;
} | [
"protected",
"function",
"init",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"name",
"]",
")",
")",
"{",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"name",
"]",
"=",
"[",
"]",
";",
"}",
"re... | Initializes the session.
@return bool Always `true` | [
"Initializes",
"the",
"session",
"."
] | cb2a7c0cdcd172edbf267e5c69b396708b425f47 | https://github.com/libreworks/caridea-session/blob/cb2a7c0cdcd172edbf267e5c69b396708b425f47/src/Values.php#L180-L186 |
195,584 | SlaxWeb/Config | src/Handler.php | Handler.set | public function set(string $key, $value): bool
{
if (is_string($key) === false || $key === "") {
return false;
}
$this->_configValues[$key] = $value;
return true;
} | php | public function set(string $key, $value): bool
{
if (is_string($key) === false || $key === "") {
return false;
}
$this->_configValues[$key] = $value;
return true;
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
":",
"bool",
"{",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
"===",
"false",
"||",
"$",
"key",
"===",
"\"\"",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
... | Set config item
Set a new config item, ro overwrite an existing item.
@param string $key Config item key
@param mixed $value Config item value
@return bool | [
"Set",
"config",
"item"
] | 92e75c3538d3903e00f5c52507bc0a322c4d1f11 | https://github.com/SlaxWeb/Config/blob/92e75c3538d3903e00f5c52507bc0a322c4d1f11/src/Handler.php#L85-L93 |
195,585 | SlaxWeb/Config | src/Handler.php | Handler.get | public function get(string $key)
{
return isset($this->_configValues[$key])
? $this->_configValues[$key]
: null;
} | php | public function get(string $key)
{
return isset($this->_configValues[$key])
? $this->_configValues[$key]
: null;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_configValues",
"[",
"$",
"key",
"]",
")",
"?",
"$",
"this",
"->",
"_configValues",
"[",
"$",
"key",
"]",
":",
"null",
";",
"}"
] | Get config item
Get a config item from the internal config container. On a missing key,
return null.
@param string $key Config item key
@return mixed | [
"Get",
"config",
"item"
] | 92e75c3538d3903e00f5c52507bc0a322c4d1f11 | https://github.com/SlaxWeb/Config/blob/92e75c3538d3903e00f5c52507bc0a322c4d1f11/src/Handler.php#L104-L109 |
195,586 | SlaxWeb/Config | src/Handler.php | Handler.remove | public function remove(string $key): bool
{
if (isset($this->_configValues[$key]) === false) {
return false;
}
unset($this->_configValues[$key]);
return true;
} | php | public function remove(string $key): bool
{
if (isset($this->_configValues[$key]) === false) {
return false;
}
unset($this->_configValues[$key]);
return true;
} | [
"public",
"function",
"remove",
"(",
"string",
"$",
"key",
")",
":",
"bool",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_configValues",
"[",
"$",
"key",
"]",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"unset",
"(",
"$",
"t... | Remove config item
Check if an item with provided key exists, and remove it.
@param string $key Config item key
@return bool | [
"Remove",
"config",
"item"
] | 92e75c3538d3903e00f5c52507bc0a322c4d1f11 | https://github.com/SlaxWeb/Config/blob/92e75c3538d3903e00f5c52507bc0a322c4d1f11/src/Handler.php#L119-L127 |
195,587 | SlaxWeb/Config | src/Handler.php | Handler.prependResourceName | public function prependResourceName(
array $loadedConfig,
string $resName
): array {
$prefixedConf = [];
foreach ($loadedConfig as $key => $value) {
$prefixedConf["{$resName}.{$key}"] = $value;
}
return $prefixedConf;
} | php | public function prependResourceName(
array $loadedConfig,
string $resName
): array {
$prefixedConf = [];
foreach ($loadedConfig as $key => $value) {
$prefixedConf["{$resName}.{$key}"] = $value;
}
return $prefixedConf;
} | [
"public",
"function",
"prependResourceName",
"(",
"array",
"$",
"loadedConfig",
",",
"string",
"$",
"resName",
")",
":",
"array",
"{",
"$",
"prefixedConf",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"loadedConfig",
"as",
"$",
"key",
"=>",
"$",
"value",
")"... | Prepend resource name to keys
Prepends the resource name to the keys defined in loaded configuration
array.
@param array $loadedConfig The loaded config
@param string $resName Resource name, that is prepended to the keys
@return array Loaded config with keys prepended by resource name | [
"Prepend",
"resource",
"name",
"to",
"keys"
] | 92e75c3538d3903e00f5c52507bc0a322c4d1f11 | https://github.com/SlaxWeb/Config/blob/92e75c3538d3903e00f5c52507bc0a322c4d1f11/src/Handler.php#L152-L161 |
195,588 | SlaxWeb/Config | src/Handler.php | Handler._getAbsPath | protected function _getAbsPath(string $resName): string
{
foreach ($this->_resDir as $dir) {
$absPath = rtrim($dir, DIRECTORY_SEPARATOR)
. DIRECTORY_SEPARATOR
. $resName;
if (file_exists($absPath)) {
return $absPath;
}
... | php | protected function _getAbsPath(string $resName): string
{
foreach ($this->_resDir as $dir) {
$absPath = rtrim($dir, DIRECTORY_SEPARATOR)
. DIRECTORY_SEPARATOR
. $resName;
if (file_exists($absPath)) {
return $absPath;
}
... | [
"protected",
"function",
"_getAbsPath",
"(",
"string",
"$",
"resName",
")",
":",
"string",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_resDir",
"as",
"$",
"dir",
")",
"{",
"$",
"absPath",
"=",
"rtrim",
"(",
"$",
"dir",
",",
"DIRECTORY_SEPARATOR",
")",
".... | Get resource absolute path
Iterate the Resource Location array and return the absolute path of the
resource. Return empty string if resource does not exist in any of the
directories.
@param string $resName Name of the resource
@return string | [
"Get",
"resource",
"absolute",
"path"
] | 92e75c3538d3903e00f5c52507bc0a322c4d1f11 | https://github.com/SlaxWeb/Config/blob/92e75c3538d3903e00f5c52507bc0a322c4d1f11/src/Handler.php#L199-L212 |
195,589 | enikeishik/ufoframework | src/Ufo/Core/Result.php | Result.changeHeader | public function changeHeader(string $name, string $value): void
{
// if (!array_key_exists($name, $this->headers)) {
// throw new NotFoundException();
// }
$this->headers[$name] = $value;
} | php | public function changeHeader(string $name, string $value): void
{
// if (!array_key_exists($name, $this->headers)) {
// throw new NotFoundException();
// }
$this->headers[$name] = $value;
} | [
"public",
"function",
"changeHeader",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"value",
")",
":",
"void",
"{",
"// if (!array_key_exists($name, $this->headers)) {",
"// throw new NotFoundException();",
"// }",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"... | Changes header value.
@param string $name
@param string $value
@return void | [
"Changes",
"header",
"value",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Core/Result.php#L107-L113 |
195,590 | enikeishik/ufoframework | src/Ufo/Core/Result.php | Result.changeHeaders | public function changeHeaders(callable $callback): void
{
foreach ($this->headers as $name => $value) {
$this->headers[$name] = call_user_func($callback, $name, $value);
}
} | php | public function changeHeaders(callable $callback): void
{
foreach ($this->headers as $name => $value) {
$this->headers[$name] = call_user_func($callback, $name, $value);
}
} | [
"public",
"function",
"changeHeaders",
"(",
"callable",
"$",
"callback",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"]",
"=",
... | Changes headers using callback function.
@param callable $callback
@return void | [
"Changes",
"headers",
"using",
"callback",
"function",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Core/Result.php#L120-L125 |
195,591 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Resource/ResourceFactory.php | ResourceFactory.applyEntity | public function applyEntity(Resource $resource, EntityInterface $entity)
{
$this->validateResourceTypes($resource->getEntityType(), $entity->getType());
$document->pushData($entity);
return $this;
} | php | public function applyEntity(Resource $resource, EntityInterface $entity)
{
$this->validateResourceTypes($resource->getEntityType(), $entity->getType());
$document->pushData($entity);
return $this;
} | [
"public",
"function",
"applyEntity",
"(",
"Resource",
"$",
"resource",
",",
"EntityInterface",
"$",
"entity",
")",
"{",
"$",
"this",
"->",
"validateResourceTypes",
"(",
"$",
"resource",
"->",
"getEntityType",
"(",
")",
",",
"$",
"entity",
"->",
"getType",
"(... | Applies an entity or entity identifier to a resource.
@param Resource $document The primary resource.
@param EntityInterface $entity The entity or entity identifier to add.
@return self | [
"Applies",
"an",
"entity",
"or",
"entity",
"identifier",
"to",
"a",
"resource",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Resource/ResourceFactory.php#L73-L78 |
195,592 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Resource/ResourceFactory.php | ResourceFactory.applyRelationships | public function applyRelationships(Entity $owner, $data)
{
$this->validateData($data);
$meta = $this->mf->getMetadataForType($owner->getType());
foreach ($meta->getRelationships() as $key => $relationship) {
if (!isset($data[$key]) || !$data[$key] instanceof EntityInterface) {
... | php | public function applyRelationships(Entity $owner, $data)
{
$this->validateData($data);
$meta = $this->mf->getMetadataForType($owner->getType());
foreach ($meta->getRelationships() as $key => $relationship) {
if (!isset($data[$key]) || !$data[$key] instanceof EntityInterface) {
... | [
"public",
"function",
"applyRelationships",
"(",
"Entity",
"$",
"owner",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"validateData",
"(",
"$",
"data",
")",
";",
"$",
"meta",
"=",
"$",
"this",
"->",
"mf",
"->",
"getMetadataForType",
"(",
"$",
"owner"... | Applies an array or array-like set of relationship data to an entity.
Each array member must be a EntityInterface object keyed by the relationship field key.
@param Entity $owner The owning entity.
@param array|\ArrayAccess $data The resource data to apply.
@return self | [
"Applies",
"an",
"array",
"or",
"array",
"-",
"like",
"set",
"of",
"relationship",
"data",
"to",
"an",
"entity",
".",
"Each",
"array",
"member",
"must",
"be",
"a",
"EntityInterface",
"object",
"keyed",
"by",
"the",
"relationship",
"field",
"key",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Resource/ResourceFactory.php#L88-L99 |
195,593 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Resource/ResourceFactory.php | ResourceFactory.applyRelationship | public function applyRelationship(Entity $owner, $fieldKey, EntityInterface $related)
{
$meta = $this->em->getMetadataForType($owner->getType());
if (false === $meta->hasRelationship($fieldKey)) {
throw new InvalidArgumentException('The resource "%s" does not contain relationship field "... | php | public function applyRelationship(Entity $owner, $fieldKey, EntityInterface $related)
{
$meta = $this->em->getMetadataForType($owner->getType());
if (false === $meta->hasRelationship($fieldKey)) {
throw new InvalidArgumentException('The resource "%s" does not contain relationship field "... | [
"public",
"function",
"applyRelationship",
"(",
"Entity",
"$",
"owner",
",",
"$",
"fieldKey",
",",
"EntityInterface",
"$",
"related",
")",
"{",
"$",
"meta",
"=",
"$",
"this",
"->",
"em",
"->",
"getMetadataForType",
"(",
"$",
"owner",
"->",
"getType",
"(",
... | Applies a single relationship to an owning resource via a related resource object.
@param Entity $owner The owning entity to apply the relationship to.
@param string $fieldKey The relationship field key.
@param EntityInterface $related The related EntityInterfa... | [
"Applies",
"a",
"single",
"relationship",
"to",
"an",
"owning",
"resource",
"via",
"a",
"related",
"resource",
"object",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Resource/ResourceFactory.php#L110-L123 |
195,594 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Resource/ResourceFactory.php | ResourceFactory.applyAttributes | public function applyAttributes(Resource $entity, $data)
{
$this->validateData($data);
$meta = $this->em->getMetadataFor($entity->getType());
foreach ($meta->getAttributes() as $key => $attribute) {
if (!isset($data[$key])) {
continue;
}
$t... | php | public function applyAttributes(Resource $entity, $data)
{
$this->validateData($data);
$meta = $this->em->getMetadataFor($entity->getType());
foreach ($meta->getAttributes() as $key => $attribute) {
if (!isset($data[$key])) {
continue;
}
$t... | [
"public",
"function",
"applyAttributes",
"(",
"Resource",
"$",
"entity",
",",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"validateData",
"(",
"$",
"data",
")",
";",
"$",
"meta",
"=",
"$",
"this",
"->",
"em",
"->",
"getMetadataFor",
"(",
"$",
"entity",
... | Applies an array or array-like set of attribute data to an entity.
Each array member must be keyed by the attribute field key.
@param Entity $entity The entity to apply the attributes to.
@param array|\ArrayAccess $data The attribute data to apply.
@return self | [
"Applies",
"an",
"array",
"or",
"array",
"-",
"like",
"set",
"of",
"attribute",
"data",
"to",
"an",
"entity",
".",
"Each",
"array",
"member",
"must",
"be",
"keyed",
"by",
"the",
"attribute",
"field",
"key",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Resource/ResourceFactory.php#L133-L144 |
195,595 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Resource/ResourceFactory.php | ResourceFactory.applyAttribute | public function applyAttribute(Entity $entity, $fieldKey, $value)
{
$entity->addAttribute($this->createAttribute($fieldKey, $value));
return $this;
} | php | public function applyAttribute(Entity $entity, $fieldKey, $value)
{
$entity->addAttribute($this->createAttribute($fieldKey, $value));
return $this;
} | [
"public",
"function",
"applyAttribute",
"(",
"Entity",
"$",
"entity",
",",
"$",
"fieldKey",
",",
"$",
"value",
")",
"{",
"$",
"entity",
"->",
"addAttribute",
"(",
"$",
"this",
"->",
"createAttribute",
"(",
"$",
"fieldKey",
",",
"$",
"value",
")",
")",
... | Applies a single attribute value to a resource.
@param Entity $entity The entity to apply the attribute value to.
@param string $fieldKey The attribute field key.
@param mixed $value The attribute value.
@return self | [
"Applies",
"a",
"single",
"attribute",
"value",
"to",
"a",
"resource",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Resource/ResourceFactory.php#L155-L159 |
195,596 | Palmabit-IT/library | src/Palmabit/Library/Repository/EloquentBaseRepository.php | EloquentBaseRepository.update | public function update($id, array $data)
{
$obj = $this->find($id);
Event::fire('repository.updating', [$obj, $data]);
$obj->update($data);
return $obj;
} | php | public function update($id, array $data)
{
$obj = $this->find($id);
Event::fire('repository.updating', [$obj, $data]);
$obj->update($data);
return $obj;
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"array",
"$",
"data",
")",
"{",
"$",
"obj",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"id",
")",
";",
"Event",
"::",
"fire",
"(",
"'repository.updating'",
",",
"[",
"$",
"obj",
",",
"$",
"data"... | Update a new object
@param id
@param array $data
@return mixed
@throws \Illuminate\Database\Eloquent\ModelNotFoundException | [
"Update",
"a",
"new",
"object"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/Repository/EloquentBaseRepository.php#L43-L49 |
195,597 | Palmabit-IT/library | src/Palmabit/Library/Repository/EloquentBaseRepository.php | EloquentBaseRepository.delete | public function delete($id)
{
$obj = $this->find($id);
Event::fire('repository.deleting', [$obj]);
return $obj->delete();
} | php | public function delete($id)
{
$obj = $this->find($id);
Event::fire('repository.deleting', [$obj]);
return $obj->delete();
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"$",
"obj",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"id",
")",
";",
"Event",
"::",
"fire",
"(",
"'repository.deleting'",
",",
"[",
"$",
"obj",
"]",
")",
";",
"return",
"$",
"obj",
"->",
... | Deletes a new object
@param $id
@return mixed
@throws \Illuminate\Database\Eloquent\ModelNotFoundException | [
"Deletes",
"a",
"new",
"object"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/Repository/EloquentBaseRepository.php#L57-L62 |
195,598 | shgysk8zer0/core_api | traits/socket_common.php | Socket_Common.socketCreatePair | final public function socketCreatePair($domain, $type, $protocol, array &$fd)
{
return socket_create_pair($domain, $type, $protocol, $fd);
} | php | final public function socketCreatePair($domain, $type, $protocol, array &$fd)
{
return socket_create_pair($domain, $type, $protocol, $fd);
} | [
"final",
"public",
"function",
"socketCreatePair",
"(",
"$",
"domain",
",",
"$",
"type",
",",
"$",
"protocol",
",",
"array",
"&",
"$",
"fd",
")",
"{",
"return",
"socket_create_pair",
"(",
"$",
"domain",
",",
"$",
"type",
",",
"$",
"protocol",
",",
"$",... | Creates a pair of indistinguishable sockets and stores them in an array
@param int $domain The protocol family to be used by the socket
@param int $type The type of communication to be used by the socket
@param int $protocol The specific protocol within the specified domain
@param array $fd Refer... | [
"Creates",
"a",
"pair",
"of",
"indistinguishable",
"sockets",
"and",
"stores",
"them",
"in",
"an",
"array"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/socket_common.php#L37-L40 |
195,599 | shgysk8zer0/core_api | traits/socket_common.php | Socket_Common.socketSetOption | final public function socketSetOption($optname, $optval, $level = SOL_SOCKET)
{
return socket_set_option($this->socket, $level, $optname, $optval);
} | php | final public function socketSetOption($optname, $optval, $level = SOL_SOCKET)
{
return socket_set_option($this->socket, $level, $optname, $optval);
} | [
"final",
"public",
"function",
"socketSetOption",
"(",
"$",
"optname",
",",
"$",
"optval",
",",
"$",
"level",
"=",
"SOL_SOCKET",
")",
"{",
"return",
"socket_set_option",
"(",
"$",
"this",
"->",
"socket",
",",
"$",
"level",
",",
"$",
"optname",
",",
"$",
... | Sets socket options for the socket
@param int $optname Same as those for the socket_get_option() function
@param mixed $optval The option value
@param int $level The protocol level at which the option resides | [
"Sets",
"socket",
"options",
"for",
"the",
"socket"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/socket_common.php#L72-L75 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.