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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4,900 | phlexible/phlexible | src/Phlexible/Bundle/ElementtypeBundle/Controller/ViabilityController.php | ViabilityController.fortypeAction | public function fortypeAction(Request $request)
{
$elementtypeService = $this->get('phlexible_elementtype.elementtype_service');
$for = $request->get('type', Elementtype::TYPE_FULL);
$elementtypes = $elementtypeService->findAllElementtypes();
$allowedForFull = $allowedForStructure... | php | public function fortypeAction(Request $request)
{
$elementtypeService = $this->get('phlexible_elementtype.elementtype_service');
$for = $request->get('type', Elementtype::TYPE_FULL);
$elementtypes = $elementtypeService->findAllElementtypes();
$allowedForFull = $allowedForStructure... | [
"public",
"function",
"fortypeAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"elementtypeService",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_elementtype.elementtype_service'",
")",
";",
"$",
"for",
"=",
"$",
"request",
"->",
"get",
"(",
"'type'"... | List Element Types.
@param Request $request
@return JsonResponse
@Route("/fortype", name="elementtypes_viability_for_type") | [
"List",
"Element",
"Types",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Bundle/ElementtypeBundle/Controller/ViabilityController.php#L39-L84 |
4,901 | axypro/creator | helpers/Args.php | Args.createArgs | public static function createArgs(array $pointer, array $context)
{
if (array_key_exists('args', $pointer)) {
$args = $pointer['args'];
if (!is_array($args)) {
throw new InvalidPointer('args must be an array');
}
} elseif (array_key_exists('options... | php | public static function createArgs(array $pointer, array $context)
{
if (array_key_exists('args', $pointer)) {
$args = $pointer['args'];
if (!is_array($args)) {
throw new InvalidPointer('args must be an array');
}
} elseif (array_key_exists('options... | [
"public",
"static",
"function",
"createArgs",
"(",
"array",
"$",
"pointer",
",",
"array",
"$",
"context",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'args'",
",",
"$",
"pointer",
")",
")",
"{",
"$",
"args",
"=",
"$",
"pointer",
"[",
"'args'",
"]",
... | Creates a arguments list
@param array $pointer
the normalized pointer
@param array $context
the normalized context
@return array
the arguments list
@throws \axy\creator\errors\InvalidPointer | [
"Creates",
"a",
"arguments",
"list"
] | 3d74e2201cdb93912d32b1d80d1fdc44018f132a | https://github.com/axypro/creator/blob/3d74e2201cdb93912d32b1d80d1fdc44018f132a/helpers/Args.php#L27-L49 |
4,902 | atelierspierrot/library | src/Library/Helper/Filesystem.php | Filesystem.resolveRelatedPath | public static function resolveRelatedPath($from, $to)
{
$from_parts = array_filter( explode('/', $from) );
$to_parts = array_filter( explode('/', $to) );
foreach($from_parts as $i=>$path) {
if (in_array($path, $to_parts)) {
$from_parts[$i] = null;
... | php | public static function resolveRelatedPath($from, $to)
{
$from_parts = array_filter( explode('/', $from) );
$to_parts = array_filter( explode('/', $to) );
foreach($from_parts as $i=>$path) {
if (in_array($path, $to_parts)) {
$from_parts[$i] = null;
... | [
"public",
"static",
"function",
"resolveRelatedPath",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"from_parts",
"=",
"array_filter",
"(",
"explode",
"(",
"'/'",
",",
"$",
"from",
")",
")",
";",
"$",
"to_parts",
"=",
"array_filter",
"(",
"explode",
... | Returns a relative path between two filesystem realpaths
@param string $from The absolute path to work from
@param string $to The absolute path to resolve from `$from`
@return string The relative path from `$from` to `$to` | [
"Returns",
"a",
"relative",
"path",
"between",
"two",
"filesystem",
"realpaths"
] | a2988a11370d13c7e0dc47f9d2d81c664c30b8dd | https://github.com/atelierspierrot/library/blob/a2988a11370d13c7e0dc47f9d2d81c664c30b8dd/src/Library/Helper/Filesystem.php#L47-L68 |
4,903 | Zeeml/Dataset | src/Core/Mapper.php | Mapper.map | public function map(array &$row)
{
$inputs = $this->parse($this->inputsParams, $row);
$outputs = $this->parse($this->outputParams, $row);
return $inputs && $outputs ? [$inputs, $outputs] : null;
} | php | public function map(array &$row)
{
$inputs = $this->parse($this->inputsParams, $row);
$outputs = $this->parse($this->outputParams, $row);
return $inputs && $outputs ? [$inputs, $outputs] : null;
} | [
"public",
"function",
"map",
"(",
"array",
"&",
"$",
"row",
")",
"{",
"$",
"inputs",
"=",
"$",
"this",
"->",
"parse",
"(",
"$",
"this",
"->",
"inputsParams",
",",
"$",
"row",
")",
";",
"$",
"outputs",
"=",
"$",
"this",
"->",
"parse",
"(",
"$",
... | Creates an Instance class from an array using the inputKeys and outputKeys specified in the construct
@param array $row
@return null|array
@throws DataSetPreparationException | [
"Creates",
"an",
"Instance",
"class",
"from",
"an",
"array",
"using",
"the",
"inputKeys",
"and",
"outputKeys",
"specified",
"in",
"the",
"construct"
] | 8809ba48c99bce1e9fe7e6431be7022e02ff027a | https://github.com/Zeeml/Dataset/blob/8809ba48c99bce1e9fe7e6431be7022e02ff027a/src/Core/Mapper.php#L34-L41 |
4,904 | marando/phpSOFA | src/Marando/IAU/iauTrxpv.php | iauTrxpv.Trxpv | public static function Trxpv(array $r, array $pv, array &$trpv) {
$tr = [];
/* Transpose of matrix r. */
IAU::Tr($r, $tr);
/* Matrix tr * vector pv -> vector trpv. */
IAU::Rxpv($tr, $pv, $trpv);
return;
} | php | public static function Trxpv(array $r, array $pv, array &$trpv) {
$tr = [];
/* Transpose of matrix r. */
IAU::Tr($r, $tr);
/* Matrix tr * vector pv -> vector trpv. */
IAU::Rxpv($tr, $pv, $trpv);
return;
} | [
"public",
"static",
"function",
"Trxpv",
"(",
"array",
"$",
"r",
",",
"array",
"$",
"pv",
",",
"array",
"&",
"$",
"trpv",
")",
"{",
"$",
"tr",
"=",
"[",
"]",
";",
"/* Transpose of matrix r. */",
"IAU",
"::",
"Tr",
"(",
"$",
"r",
",",
"$",
"tr",
"... | - - - - - - - - -
i a u T r x p v
- - - - - - - - -
Multiply a pv-vector by the transpose of an r-matrix.
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: vector/matrix support function.
Given:
r double[3][3] r-matrix
p... | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"T",
"r",
"x",
"p",
"v",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauTrxpv.php#L39-L49 |
4,905 | rinvex/obsolete-attributable | src/Support/ValueCollection.php | ValueCollection.trashCurrentItems | protected function trashCurrentItems()
{
$trash = $this->entity->getEntityAttributeValueTrash();
foreach ($this->items as $value) {
$trash->push($value);
}
} | php | protected function trashCurrentItems()
{
$trash = $this->entity->getEntityAttributeValueTrash();
foreach ($this->items as $value) {
$trash->push($value);
}
} | [
"protected",
"function",
"trashCurrentItems",
"(",
")",
"{",
"$",
"trash",
"=",
"$",
"this",
"->",
"entity",
"->",
"getEntityAttributeValueTrash",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"value",
")",
"{",
"$",
"trash",
"->"... | Trash the current values by queuing into entity object,
these trashed values will physically deleted on entity save.
@return void | [
"Trash",
"the",
"current",
"values",
"by",
"queuing",
"into",
"entity",
"object",
"these",
"trashed",
"values",
"will",
"physically",
"deleted",
"on",
"entity",
"save",
"."
] | 23fa78efda9c24e2e1579917967537a3b3b9e4ce | https://github.com/rinvex/obsolete-attributable/blob/23fa78efda9c24e2e1579917967537a3b3b9e4ce/src/Support/ValueCollection.php#L94-L101 |
4,906 | novuso/common | src/Domain/Model/EventCollection.php | EventCollection.record | public function record(EventMessage $message): void
{
$eventRecord = new EventRecord(
$message,
$this->aggregateId,
$this->aggregateType,
$this->nextSequence()
);
$this->lastSequence = $eventRecord->sequenceNumber();
$this->eventRecords... | php | public function record(EventMessage $message): void
{
$eventRecord = new EventRecord(
$message,
$this->aggregateId,
$this->aggregateType,
$this->nextSequence()
);
$this->lastSequence = $eventRecord->sequenceNumber();
$this->eventRecords... | [
"public",
"function",
"record",
"(",
"EventMessage",
"$",
"message",
")",
":",
"void",
"{",
"$",
"eventRecord",
"=",
"new",
"EventRecord",
"(",
"$",
"message",
",",
"$",
"this",
"->",
"aggregateId",
",",
"$",
"this",
"->",
"aggregateType",
",",
"$",
"thi... | Records an event message
@param EventMessage $message The event message
@return void | [
"Records",
"an",
"event",
"message"
] | 7d0e5a4f4c79c9622e068efc8b7c70815c460863 | https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Domain/Model/EventCollection.php#L97-L107 |
4,907 | novuso/common | src/Domain/Model/EventCollection.php | EventCollection.initializeSequence | public function initializeSequence(int $committedSequence): void
{
assert($this->isEmpty(), 'Cannot initialize sequence after adding events');
$this->committedSequence = $committedSequence;
} | php | public function initializeSequence(int $committedSequence): void
{
assert($this->isEmpty(), 'Cannot initialize sequence after adding events');
$this->committedSequence = $committedSequence;
} | [
"public",
"function",
"initializeSequence",
"(",
"int",
"$",
"committedSequence",
")",
":",
"void",
"{",
"assert",
"(",
"$",
"this",
"->",
"isEmpty",
"(",
")",
",",
"'Cannot initialize sequence after adding events'",
")",
";",
"$",
"this",
"->",
"committedSequence... | Initializes the committed sequence
@param int $committedSequence The committed sequence number
@return void | [
"Initializes",
"the",
"committed",
"sequence"
] | 7d0e5a4f4c79c9622e068efc8b7c70815c460863 | https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Domain/Model/EventCollection.php#L126-L130 |
4,908 | novuso/common | src/Domain/Model/EventCollection.php | EventCollection.commit | public function commit(): void
{
$this->committedSequence = $this->lastSequence();
$this->eventRecords = SortedSet::comparable(EventRecord::class);
} | php | public function commit(): void
{
$this->committedSequence = $this->lastSequence();
$this->eventRecords = SortedSet::comparable(EventRecord::class);
} | [
"public",
"function",
"commit",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"committedSequence",
"=",
"$",
"this",
"->",
"lastSequence",
"(",
")",
";",
"$",
"this",
"->",
"eventRecords",
"=",
"SortedSet",
"::",
"comparable",
"(",
"EventRecord",
"::",
... | Clears events and updates committed sequence number
@return void | [
"Clears",
"events",
"and",
"updates",
"committed",
"sequence",
"number"
] | 7d0e5a4f4c79c9622e068efc8b7c70815c460863 | https://github.com/novuso/common/blob/7d0e5a4f4c79c9622e068efc8b7c70815c460863/src/Domain/Model/EventCollection.php#L161-L165 |
4,909 | thesalegroup/restorm | src/PaginatedCollection.php | PaginatedCollection.count | public function count(): int
{
// If the count is already set, return it
if(!is_null($this->count)) {
return $this->count;
}
// Maually create a count by looping through the entities. This will
// trigger the pagination calls to get the correct count of entities
... | php | public function count(): int
{
// If the count is already set, return it
if(!is_null($this->count)) {
return $this->count;
}
// Maually create a count by looping through the entities. This will
// trigger the pagination calls to get the correct count of entities
... | [
"public",
"function",
"count",
"(",
")",
":",
"int",
"{",
"// If the count is already set, return it",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"count",
")",
")",
"{",
"return",
"$",
"this",
"->",
"count",
";",
"}",
"// Maually create a count by loop... | Get the count of entities.
Calling this method will force initialisation of this object and call
each page of content.
@return integer the count of entities.
@author Rob Treacy <erobert.treacy@thesalegroup.co.uk> | [
"Get",
"the",
"count",
"of",
"entities",
"."
] | e8b9c3c0282b624450c9c6e508f2e086d4b2155d | https://github.com/thesalegroup/restorm/blob/e8b9c3c0282b624450c9c6e508f2e086d4b2155d/src/PaginatedCollection.php#L109-L125 |
4,910 | phn-io/template | spec/Phn/Template/Fragment/SetSpec.php | SetSpec.it_can_be_compared_to_other_template_fragments | function it_can_be_compared_to_other_template_fragments($sameValue, $differentValue, $differentType)
{
$sameValue->getValueMask()->willReturn(['1', '2']);
$sameValue->getTypeMask()->willReturn('[..]');
$this->equals($sameValue)->shouldReturn(true);
$differentValue->getValueMask()->... | php | function it_can_be_compared_to_other_template_fragments($sameValue, $differentValue, $differentType)
{
$sameValue->getValueMask()->willReturn(['1', '2']);
$sameValue->getTypeMask()->willReturn('[..]');
$this->equals($sameValue)->shouldReturn(true);
$differentValue->getValueMask()->... | [
"function",
"it_can_be_compared_to_other_template_fragments",
"(",
"$",
"sameValue",
",",
"$",
"differentValue",
",",
"$",
"differentType",
")",
"{",
"$",
"sameValue",
"->",
"getValueMask",
"(",
")",
"->",
"willReturn",
"(",
"[",
"'1'",
",",
"'2'",
"]",
")",
"... | It can be compared to other template fragments.
@param \Phn\Template\Fragment\Set $sameValue
@param \Phn\Template\Fragment\Set $differentValue
@param \Phn\Template\Fragment\Set $differentType | [
"It",
"can",
"be",
"compared",
"to",
"other",
"template",
"fragments",
"."
] | 7d89c2a54347069340ff9b545b4c64b5512da1c3 | https://github.com/phn-io/template/blob/7d89c2a54347069340ff9b545b4c64b5512da1c3/spec/Phn/Template/Fragment/SetSpec.php#L86-L102 |
4,911 | snje1987/minifw | src/Controler.php | Controler.dispatch | public function dispatch($function, $args) {
$class_name = get_class($this);
$class = new \ReflectionClass($class_name);
if ($function == '') {
$function = $class->getConstant('DEFAULT_FUNCTION');
}
$function = str_replace('.', '', $function);
if ($function ==... | php | public function dispatch($function, $args) {
$class_name = get_class($this);
$class = new \ReflectionClass($class_name);
if ($function == '') {
$function = $class->getConstant('DEFAULT_FUNCTION');
}
$function = str_replace('.', '', $function);
if ($function ==... | [
"public",
"function",
"dispatch",
"(",
"$",
"function",
",",
"$",
"args",
")",
"{",
"$",
"class_name",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class_name",
")",
";",
"if",
"(",
"$",
... | Call controler function according to the given name.
@param type $func function name
@param type $args args. | [
"Call",
"controler",
"function",
"according",
"to",
"the",
"given",
"name",
"."
] | 57bd2c92fd97d219487216beba8dc6c91a41aab5 | https://github.com/snje1987/minifw/blob/57bd2c92fd97d219487216beba8dc6c91a41aab5/src/Controler.php#L220-L248 |
4,912 | marando/phpSOFA | src/Marando/IAU/iauEra00.php | iauEra00.Era00 | public static function Era00($dj1, $dj2) {
$d1;
$d2;
$t;
$f;
$theta;
/* Days since fundamental epoch. */
if ($dj1 < $dj2) {
$d1 = $dj1;
$d2 = $dj2;
}
else {
$d1 = $dj2;
$d2 = $dj1;
}
$t = $d1 + ($d2 - DJ00);
/* Fractional part of T (days). */
... | php | public static function Era00($dj1, $dj2) {
$d1;
$d2;
$t;
$f;
$theta;
/* Days since fundamental epoch. */
if ($dj1 < $dj2) {
$d1 = $dj1;
$d2 = $dj2;
}
else {
$d1 = $dj2;
$d2 = $dj1;
}
$t = $d1 + ($d2 - DJ00);
/* Fractional part of T (days). */
... | [
"public",
"static",
"function",
"Era00",
"(",
"$",
"dj1",
",",
"$",
"dj2",
")",
"{",
"$",
"d1",
";",
"$",
"d2",
";",
"$",
"t",
";",
"$",
"f",
";",
"$",
"theta",
";",
"/* Days since fundamental epoch. */",
"if",
"(",
"$",
"dj1",
"<",
"$",
"dj2",
"... | - - - - - - - - -
i a u E r a 0 0
- - - - - - - - -
Earth rotation angle (IAU 2000 model).
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: canonical model.
Given:
dj1,dj2 double UT1 as a 2-part Julian Date (see note)
Retur... | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"E",
"r",
"a",
"0",
"0",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauEra00.php#L71-L96 |
4,913 | romeOz/rock-events | src/Event.php | Event.on | public static function on($class, $name, callable $handler)
{
$class = ObjectHelper::getClass($class);
if (!isset(static::$events[$class][$name])) {
static::$events[$class][$name] = [];
}
static::$events[$class][$name][] = $handler;
} | php | public static function on($class, $name, callable $handler)
{
$class = ObjectHelper::getClass($class);
if (!isset(static::$events[$class][$name])) {
static::$events[$class][$name] = [];
}
static::$events[$class][$name][] = $handler;
} | [
"public",
"static",
"function",
"on",
"(",
"$",
"class",
",",
"$",
"name",
",",
"callable",
"$",
"handler",
")",
"{",
"$",
"class",
"=",
"ObjectHelper",
"::",
"getClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$... | Subscribing in event.
@param string|object $class the fully qualified class name to which the event handler needs to attach.
@param string $name name of event
@param callable $handler handler
- `function (Event $event) { ... }`
- `[new Foo, 'method']`
- `['Foo', 'static_method']` | [
"Subscribing",
"in",
"event",
"."
] | 7aacfee29afcc29145c4452782df11e248759acc | https://github.com/romeOz/rock-events/blob/7aacfee29afcc29145c4452782df11e248759acc/src/Event.php#L50-L57 |
4,914 | romeOz/rock-events | src/Event.php | Event.trigger | public static function trigger($class, $name, Event $event = null)
{
if (empty(static::$events)) {
return;
}
if ($event === null) {
$event = new static;
}
$event->handled = false;
$event->name = $name;
if (is_object($class)) {
... | php | public static function trigger($class, $name, Event $event = null)
{
if (empty(static::$events)) {
return;
}
if ($event === null) {
$event = new static;
}
$event->handled = false;
$event->name = $name;
if (is_object($class)) {
... | [
"public",
"static",
"function",
"trigger",
"(",
"$",
"class",
",",
"$",
"name",
",",
"Event",
"$",
"event",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"static",
"::",
"$",
"events",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"event",... | Publishing event.
@param string|object $class the object or the fully qualified class name specifying the class-level event.
@param string $name the event name.
@param Event $event the event parameter. If not set, a default [[Event]] object will be created. | [
"Publishing",
"event",
"."
] | 7aacfee29afcc29145c4452782df11e248759acc | https://github.com/romeOz/rock-events/blob/7aacfee29afcc29145c4452782df11e248759acc/src/Event.php#L66-L97 |
4,915 | romeOz/rock-events | src/Event.php | Event.off | public static function off($class, $name, callable $handler = null)
{
$class = ObjectHelper::getClass($class);
if ($handler === null) {
unset(static::$events[$class][$name]);
if (empty(static::$events[$class])) {
unset(static::$events[$class]);
}
... | php | public static function off($class, $name, callable $handler = null)
{
$class = ObjectHelper::getClass($class);
if ($handler === null) {
unset(static::$events[$class][$name]);
if (empty(static::$events[$class])) {
unset(static::$events[$class]);
}
... | [
"public",
"static",
"function",
"off",
"(",
"$",
"class",
",",
"$",
"name",
",",
"callable",
"$",
"handler",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"ObjectHelper",
"::",
"getClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"handler",
"===",
... | Detach event.
@param string|object $class the fully qualified class name from which the event handler needs to be detached.
@param string $name name of event
@param callable $handler the event handler to be removed.
If it is null, all handlers attached to the named event will be removed.
@return bool
@see on(... | [
"Detach",
"event",
"."
] | 7aacfee29afcc29145c4452782df11e248759acc | https://github.com/romeOz/rock-events/blob/7aacfee29afcc29145c4452782df11e248759acc/src/Event.php#L109-L132 |
4,916 | romeOz/rock-events | src/Event.php | Event.offMulti | public static function offMulti(array $names)
{
foreach ($names as $value) {
list($class, $name) = $value;
static::off($class, $name);
}
} | php | public static function offMulti(array $names)
{
foreach ($names as $value) {
list($class, $name) = $value;
static::off($class, $name);
}
} | [
"public",
"static",
"function",
"offMulti",
"(",
"array",
"$",
"names",
")",
"{",
"foreach",
"(",
"$",
"names",
"as",
"$",
"value",
")",
"{",
"list",
"(",
"$",
"class",
",",
"$",
"name",
")",
"=",
"$",
"value",
";",
"static",
"::",
"off",
"(",
"$... | Detach events.
```php
$events = [
['foo\\Foo', 'onAfter']
];
Event::offMulti($events);
```
@param array $names - names of event | [
"Detach",
"events",
"."
] | 7aacfee29afcc29145c4452782df11e248759acc | https://github.com/romeOz/rock-events/blob/7aacfee29afcc29145c4452782df11e248759acc/src/Event.php#L146-L152 |
4,917 | romeOz/rock-events | src/Event.php | Event.get | public static function get($class, $name)
{
$class = ObjectHelper::getClass($class);
return !empty(static::$events[$class][$name]) ? static::$events[$class][$name] : null;
} | php | public static function get($class, $name)
{
$class = ObjectHelper::getClass($class);
return !empty(static::$events[$class][$name]) ? static::$events[$class][$name] : null;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"class",
",",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"ObjectHelper",
"::",
"getClass",
"(",
"$",
"class",
")",
";",
"return",
"!",
"empty",
"(",
"static",
"::",
"$",
"events",
"[",
"$",
"class",
"... | Get event.
@param string|object $class the object or the fully qualified class name specifying the class-level event.
@param string $name name of event
@return array|null | [
"Get",
"event",
"."
] | 7aacfee29afcc29145c4452782df11e248759acc | https://github.com/romeOz/rock-events/blob/7aacfee29afcc29145c4452782df11e248759acc/src/Event.php#L180-L184 |
4,918 | romeOz/rock-events | src/Event.php | Event.exists | public static function exists($class, $name)
{
$class = ObjectHelper::getClass($class);
do {
if (!empty(self::$events[$class][$name])) {
return true;
}
} while (($class = get_parent_class($class)) !== false);
return false;
} | php | public static function exists($class, $name)
{
$class = ObjectHelper::getClass($class);
do {
if (!empty(self::$events[$class][$name])) {
return true;
}
} while (($class = get_parent_class($class)) !== false);
return false;
} | [
"public",
"static",
"function",
"exists",
"(",
"$",
"class",
",",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"ObjectHelper",
"::",
"getClass",
"(",
"$",
"class",
")",
";",
"do",
"{",
"if",
"(",
"!",
"empty",
"(",
"self",
"::",
"$",
"events",
"[",
... | Exists event.
@param string|object $class the object or the fully qualified class name specifying the class-level event.
@param string $name name of event
@return bool | [
"Exists",
"event",
"."
] | 7aacfee29afcc29145c4452782df11e248759acc | https://github.com/romeOz/rock-events/blob/7aacfee29afcc29145c4452782df11e248759acc/src/Event.php#L205-L215 |
4,919 | romeOz/rock-events | src/Event.php | Event.countHandlers | public static function countHandlers($class, $name)
{
$class = ObjectHelper::getClass($class);
$count = 0;
do {
if (!empty(self::$events[$class][$name])) {
$count += count(static::$events[$class][$name]);
}
} while (($class = get_parent_class(... | php | public static function countHandlers($class, $name)
{
$class = ObjectHelper::getClass($class);
$count = 0;
do {
if (!empty(self::$events[$class][$name])) {
$count += count(static::$events[$class][$name]);
}
} while (($class = get_parent_class(... | [
"public",
"static",
"function",
"countHandlers",
"(",
"$",
"class",
",",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"ObjectHelper",
"::",
"getClass",
"(",
"$",
"class",
")",
";",
"$",
"count",
"=",
"0",
";",
"do",
"{",
"if",
"(",
"!",
"empty",
"(",
... | Count handlers of events.
@param string|object $class
@param string $name name of event
@return int | [
"Count",
"handlers",
"of",
"events",
"."
] | 7aacfee29afcc29145c4452782df11e248759acc | https://github.com/romeOz/rock-events/blob/7aacfee29afcc29145c4452782df11e248759acc/src/Event.php#L233-L245 |
4,920 | carbontwelve/tools | src/Carbontwelve/Tools/Formatters/Time.php | Time.toHuman | public function toHuman()
{
$units = array(
"week" => 7*24*3600,
"day" => 24*3600,
"hour" => 3600,
"minute" => 60,
"second" => 1,
);
// specifically handle zero
if ( $this->seconds == 0 ) return "0 secon... | php | public function toHuman()
{
$units = array(
"week" => 7*24*3600,
"day" => 24*3600,
"hour" => 3600,
"minute" => 60,
"second" => 1,
);
// specifically handle zero
if ( $this->seconds == 0 ) return "0 secon... | [
"public",
"function",
"toHuman",
"(",
")",
"{",
"$",
"units",
"=",
"array",
"(",
"\"week\"",
"=>",
"7",
"*",
"24",
"*",
"3600",
",",
"\"day\"",
"=>",
"24",
"*",
"3600",
",",
"\"hour\"",
"=>",
"3600",
",",
"\"minute\"",
"=>",
"60",
",",
"\"second\"",
... | Convert seconds to human readable text.
@source http://csl.name/php-secs-to-human-text/
@return string | [
"Convert",
"seconds",
"to",
"human",
"readable",
"text",
"."
] | bad49a7791612c18c3ca5b935a47d2955ae8dc67 | https://github.com/carbontwelve/tools/blob/bad49a7791612c18c3ca5b935a47d2955ae8dc67/src/Carbontwelve/Tools/Formatters/Time.php#L37-L61 |
4,921 | mikebarlow/advanced-assets | src/Assets.php | Assets.findAsset | public function findAsset($url)
{
if (empty($url)) {
return false;
}
$this->asset = $this->processUrl($url);
if ($this->asset === false) {
return false;
}
// check main assets dir
$mainAsset = $this->findMainAsset(
$this-... | php | public function findAsset($url)
{
if (empty($url)) {
return false;
}
$this->asset = $this->processUrl($url);
if ($this->asset === false) {
return false;
}
// check main assets dir
$mainAsset = $this->findMainAsset(
$this-... | [
"public",
"function",
"findAsset",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"asset",
"=",
"$",
"this",
"->",
"processUrl",
"(",
"$",
"url",
")",
";",
"if",
"(... | find the asset and create symlink
@param string $url Asset URL to find
@return string|bool | [
"find",
"the",
"asset",
"and",
"create",
"symlink"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L94-L128 |
4,922 | mikebarlow/advanced-assets | src/Assets.php | Assets.findMainAsset | public function findMainAsset($asset)
{
if (file_exists($asset) && $this->checkLink($asset)) {
return '/' . $this->assetDir . '/' . $this->asset['asset'];
}
return false;
} | php | public function findMainAsset($asset)
{
if (file_exists($asset) && $this->checkLink($asset)) {
return '/' . $this->assetDir . '/' . $this->asset['asset'];
}
return false;
} | [
"public",
"function",
"findMainAsset",
"(",
"$",
"asset",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"asset",
")",
"&&",
"$",
"this",
"->",
"checkLink",
"(",
"$",
"asset",
")",
")",
"{",
"return",
"'/'",
".",
"$",
"this",
"->",
"assetDir",
".",
... | check for a main asset
@param string Full Absolute path to the main asset
@return string|bool url path to asset or bool false | [
"check",
"for",
"a",
"main",
"asset"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L161-L168 |
4,923 | mikebarlow/advanced-assets | src/Assets.php | Assets.findThemeAsset | public function findThemeAsset($theme, $asset)
{
if (! empty($theme)) {
$Folders = $this->engine->getFolders();
if ($Folders->exists($theme)) {
$this->Folder = $Folders->get($theme);
$folderPath = rtrim($this->Folder->getPath(), '/');
... | php | public function findThemeAsset($theme, $asset)
{
if (! empty($theme)) {
$Folders = $this->engine->getFolders();
if ($Folders->exists($theme)) {
$this->Folder = $Folders->get($theme);
$folderPath = rtrim($this->Folder->getPath(), '/');
... | [
"public",
"function",
"findThemeAsset",
"(",
"$",
"theme",
",",
"$",
"asset",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"theme",
")",
")",
"{",
"$",
"Folders",
"=",
"$",
"this",
"->",
"engine",
"->",
"getFolders",
"(",
")",
";",
"if",
"(",
"$"... | check for a theme asset
@param string Theme to load
@param string Path to the asset
@return string|bool url path to asset or bool false | [
"check",
"for",
"a",
"theme",
"asset"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L177-L196 |
4,924 | mikebarlow/advanced-assets | src/Assets.php | Assets.findFallbackAsset | public function findFallbackAsset($asset, $Folder = null)
{
$folderEmpty = empty($Folder);
$folderAllowFallback = ! empty($Folder) && $Folder->getFallback();
if ($folderEmpty || $folderAllowFallback) {
$fallbackPath = $this->engine->getDirectory();
$fallbackPath = $... | php | public function findFallbackAsset($asset, $Folder = null)
{
$folderEmpty = empty($Folder);
$folderAllowFallback = ! empty($Folder) && $Folder->getFallback();
if ($folderEmpty || $folderAllowFallback) {
$fallbackPath = $this->engine->getDirectory();
$fallbackPath = $... | [
"public",
"function",
"findFallbackAsset",
"(",
"$",
"asset",
",",
"$",
"Folder",
"=",
"null",
")",
"{",
"$",
"folderEmpty",
"=",
"empty",
"(",
"$",
"Folder",
")",
";",
"$",
"folderAllowFallback",
"=",
"!",
"empty",
"(",
"$",
"Folder",
")",
"&&",
"$",
... | find the fallback asset
@param string Full path to the main asset
@param Object Plates\Folder Object, so we can check for fallback => true
@return string|bool url path to asset or bool false | [
"find",
"the",
"fallback",
"asset"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L205-L222 |
4,925 | mikebarlow/advanced-assets | src/Assets.php | Assets.removeViewFromPath | public function removeViewFromPath($path)
{
$folderBits = explode('/', $path);
if (strtolower(end($folderBits)) === 'views') {
array_pop($folderBits);
$path = implode('/', $folderBits);
}
return $path;
} | php | public function removeViewFromPath($path)
{
$folderBits = explode('/', $path);
if (strtolower(end($folderBits)) === 'views') {
array_pop($folderBits);
$path = implode('/', $folderBits);
}
return $path;
} | [
"public",
"function",
"removeViewFromPath",
"(",
"$",
"path",
")",
"{",
"$",
"folderBits",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"if",
"(",
"strtolower",
"(",
"end",
"(",
"$",
"folderBits",
")",
")",
"===",
"'views'",
")",
"{",
"arr... | remove 'views' from any folder path
@param string $path View path
@return string $path Path with view folder remove | [
"remove",
"views",
"from",
"any",
"folder",
"path"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L266-L275 |
4,926 | mikebarlow/advanced-assets | src/Assets.php | Assets.setDocRoot | public function setDocRoot($docRoot)
{
if (empty($docRoot) || ! file_exists($docRoot) || ! is_dir($docRoot)) {
throw new \InvalidArgumentException(
'The document root set is not a valid directory.'
);
}
$this->docRoot = rtrim($docRoot, '/');
} | php | public function setDocRoot($docRoot)
{
if (empty($docRoot) || ! file_exists($docRoot) || ! is_dir($docRoot)) {
throw new \InvalidArgumentException(
'The document root set is not a valid directory.'
);
}
$this->docRoot = rtrim($docRoot, '/');
} | [
"public",
"function",
"setDocRoot",
"(",
"$",
"docRoot",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"docRoot",
")",
"||",
"!",
"file_exists",
"(",
"$",
"docRoot",
")",
"||",
"!",
"is_dir",
"(",
"$",
"docRoot",
")",
")",
"{",
"throw",
"new",
"\\",
"Inv... | set the document root
@param string Document Root
@throws \InvalidArgumentException | [
"set",
"the",
"document",
"root"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L283-L291 |
4,927 | mikebarlow/advanced-assets | src/Assets.php | Assets.setFileSystem | public function setFileSystem($fileSystem)
{
if (! is_object($fileSystem) || ! is_a($fileSystem, 'Symfony\Component\Filesystem\Filesystem')) {
throw new \InvalidArgumentException(
'The File System was not a valid object.'
);
}
$this->fileSystem = $file... | php | public function setFileSystem($fileSystem)
{
if (! is_object($fileSystem) || ! is_a($fileSystem, 'Symfony\Component\Filesystem\Filesystem')) {
throw new \InvalidArgumentException(
'The File System was not a valid object.'
);
}
$this->fileSystem = $file... | [
"public",
"function",
"setFileSystem",
"(",
"$",
"fileSystem",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"fileSystem",
")",
"||",
"!",
"is_a",
"(",
"$",
"fileSystem",
",",
"'Symfony\\Component\\Filesystem\\Filesystem'",
")",
")",
"{",
"throw",
"new",
... | set the file system
@param object Instance of Symfony filesystem
@throws \InvalidArgumentException | [
"set",
"the",
"file",
"system"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L299-L307 |
4,928 | mikebarlow/advanced-assets | src/Assets.php | Assets.setAssetDir | public function setAssetDir($assetDir)
{
$emptyAssetDir = empty($assetDir);
$folderNotExists = ! file_exists($this->docRoot . DS . $assetDir);
$folderNotDir = ! is_dir($this->docRoot . DS . $assetDir);
if ($emptyAssetDir || $folderNotExists || $folderNotDir) {
throw new ... | php | public function setAssetDir($assetDir)
{
$emptyAssetDir = empty($assetDir);
$folderNotExists = ! file_exists($this->docRoot . DS . $assetDir);
$folderNotDir = ! is_dir($this->docRoot . DS . $assetDir);
if ($emptyAssetDir || $folderNotExists || $folderNotDir) {
throw new ... | [
"public",
"function",
"setAssetDir",
"(",
"$",
"assetDir",
")",
"{",
"$",
"emptyAssetDir",
"=",
"empty",
"(",
"$",
"assetDir",
")",
";",
"$",
"folderNotExists",
"=",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"docRoot",
".",
"DS",
".",
"$",
"assetDir",
... | set the asset container folder
@param string set the asset directory
@throws \InvalidArgumentException
@throws \LogicException | [
"set",
"the",
"asset",
"container",
"folder"
] | 88824f58408beea06703684df0c7f8024ce8478a | https://github.com/mikebarlow/advanced-assets/blob/88824f58408beea06703684df0c7f8024ce8478a/src/Assets.php#L332-L350 |
4,929 | FlorianWolters/PHP-Component-Core-Comparable | src/php/FlorianWolters/Component/Core/ComparableUtils.php | ComparableUtils.compare | public static function compare(
ComparableInterface $first = null,
ComparableInterface $second = null,
$nullGreater = false
) {
if ($first === $second) {
return self::EQUAL;
} elseif (null === $first) {
return $nullGreater
? self::FIRST... | php | public static function compare(
ComparableInterface $first = null,
ComparableInterface $second = null,
$nullGreater = false
) {
if ($first === $second) {
return self::EQUAL;
} elseif (null === $first) {
return $nullGreater
? self::FIRST... | [
"public",
"static",
"function",
"compare",
"(",
"ComparableInterface",
"$",
"first",
"=",
"null",
",",
"ComparableInterface",
"$",
"second",
"=",
"null",
",",
"$",
"nullGreater",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"first",
"===",
"$",
"second",
")",
... | Compares an object with another object for order.
Returns a negative integer, zero, or a positive integer as the first
object is less than, equal to, or greater than the second object.
The comparison of the objects is `null`-safe.
@param ComparableInterface|null $first The first object to compare.
May be `null... | [
"Compares",
"an",
"object",
"with",
"another",
"object",
"for",
"order",
"."
] | f6d9c11a7c672c704dd02420d881da9d91d34b21 | https://github.com/FlorianWolters/PHP-Component-Core-Comparable/blob/f6d9c11a7c672c704dd02420d881da9d91d34b21/src/php/FlorianWolters/Component/Core/ComparableUtils.php#L80-L98 |
4,930 | NotQuiteZen/cakephp-plugin-material | src/View/Helper/FormHelper.php | FormHelper.setTemplates | public function setTemplates(array $templates) {
if ($templates !== null && is_array($templates)) {
$this->_userChangedTemplates = array_merge(array_keys($templates), $this->_userChangedTemplates);
}
$this->_setTemplatesWrapper($templates);
} | php | public function setTemplates(array $templates) {
if ($templates !== null && is_array($templates)) {
$this->_userChangedTemplates = array_merge(array_keys($templates), $this->_userChangedTemplates);
}
$this->_setTemplatesWrapper($templates);
} | [
"public",
"function",
"setTemplates",
"(",
"array",
"$",
"templates",
")",
"{",
"if",
"(",
"$",
"templates",
"!==",
"null",
"&&",
"is_array",
"(",
"$",
"templates",
")",
")",
"{",
"$",
"this",
"->",
"_userChangedTemplates",
"=",
"array_merge",
"(",
"array_... | Sets templates to use.
@param array $templates Templates to be added.
@return void | [
"Sets",
"templates",
"to",
"use",
"."
] | ba77755139707a1c83ef30d6ae2db2908a941145 | https://github.com/NotQuiteZen/cakephp-plugin-material/blob/ba77755139707a1c83ef30d6ae2db2908a941145/src/View/Helper/FormHelper.php#L815-L822 |
4,931 | NotQuiteZen/cakephp-plugin-material | src/View/Helper/FormHelper.php | FormHelper._setTemplatesInternal | protected function _setTemplatesInternal(array $templates) {
if (is_array($templates)) {
foreach ($this->_userChangedTemplates as $key) {
if (array_key_exists($key, $templates)) {
unset($templates[$key]);
}
}
}
$this... | php | protected function _setTemplatesInternal(array $templates) {
if (is_array($templates)) {
foreach ($this->_userChangedTemplates as $key) {
if (array_key_exists($key, $templates)) {
unset($templates[$key]);
}
}
}
$this... | [
"protected",
"function",
"_setTemplatesInternal",
"(",
"array",
"$",
"templates",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"templates",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_userChangedTemplates",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"a... | Set templates after removing the ones previously set by the user,
this is to protect against overriding the users wishes
@param array $templates Templates to set
@return void | [
"Set",
"templates",
"after",
"removing",
"the",
"ones",
"previously",
"set",
"by",
"the",
"user",
"this",
"is",
"to",
"protect",
"against",
"overriding",
"the",
"users",
"wishes"
] | ba77755139707a1c83ef30d6ae2db2908a941145 | https://github.com/NotQuiteZen/cakephp-plugin-material/blob/ba77755139707a1c83ef30d6ae2db2908a941145/src/View/Helper/FormHelper.php#L841-L854 |
4,932 | NotQuiteZen/cakephp-plugin-material | src/View/Helper/FormHelper.php | FormHelper.submit | public function submit($caption = null, array $options = []) {
if ( ! preg_match('/\.(jpg|jpe|jpeg|gif|png|ico)$/', $caption)) {
$options = $this->parseButtonClass($options);
}
if ( ! empty($this->getConfig('layout.classes.submitContainer'))) {
$this->_setTemplatesInter... | php | public function submit($caption = null, array $options = []) {
if ( ! preg_match('/\.(jpg|jpe|jpeg|gif|png|ico)$/', $caption)) {
$options = $this->parseButtonClass($options);
}
if ( ! empty($this->getConfig('layout.classes.submitContainer'))) {
$this->_setTemplatesInter... | [
"public",
"function",
"submit",
"(",
"$",
"caption",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/\\.(jpg|jpe|jpeg|gif|png|ico)$/'",
",",
"$",
"caption",
")",
")",
"{",
"$",
"options",
"=",
"... | Creates submit button but adds bootstrap styling
@param string|null $caption The label appearing on the button OR if string contains :// or the
extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension
exists, AND the first character is /, image is relative to webroot,
OR if the first character is not /, i... | [
"Creates",
"submit",
"button",
"but",
"adds",
"bootstrap",
"styling"
] | ba77755139707a1c83ef30d6ae2db2908a941145 | https://github.com/NotQuiteZen/cakephp-plugin-material/blob/ba77755139707a1c83ef30d6ae2db2908a941145/src/View/Helper/FormHelper.php#L1108-L1128 |
4,933 | NotQuiteZen/cakephp-plugin-material | src/View/Helper/FormHelper.php | FormHelper._bootstrapTypeMap | protected function _bootstrapTypeMap($type) {
$map = $this->_bootstrapTypeMap;
return isset($map[$type]) ? $map[$type] : 'text';
} | php | protected function _bootstrapTypeMap($type) {
$map = $this->_bootstrapTypeMap;
return isset($map[$type]) ? $map[$type] : 'text';
} | [
"protected",
"function",
"_bootstrapTypeMap",
"(",
"$",
"type",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"_bootstrapTypeMap",
";",
"return",
"isset",
"(",
"$",
"map",
"[",
"$",
"type",
"]",
")",
"?",
"$",
"map",
"[",
"$",
"type",
"]",
":",
"'t... | Maps the type to bootstrap else text
@param $type
@return mixed|string | [
"Maps",
"the",
"type",
"to",
"bootstrap",
"else",
"text"
] | ba77755139707a1c83ef30d6ae2db2908a941145 | https://github.com/NotQuiteZen/cakephp-plugin-material/blob/ba77755139707a1c83ef30d6ae2db2908a941145/src/View/Helper/FormHelper.php#L1292-L1296 |
4,934 | NotQuiteZen/cakephp-plugin-material | src/View/Helper/FormHelper.php | FormHelper._parseOptions | protected function _parseOptions($fieldName, $options) {
$needsMagicType = false;
if (empty($options['type'])) {
$needsMagicType = true;
$context = $this->_getContext();
$internalType = $context->type($fieldName);
if ($this->isHtml5Render($options) && in... | php | protected function _parseOptions($fieldName, $options) {
$needsMagicType = false;
if (empty($options['type'])) {
$needsMagicType = true;
$context = $this->_getContext();
$internalType = $context->type($fieldName);
if ($this->isHtml5Render($options) && in... | [
"protected",
"function",
"_parseOptions",
"(",
"$",
"fieldName",
",",
"$",
"options",
")",
"{",
"$",
"needsMagicType",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"options",
"[",
"'type'",
"]",
")",
")",
"{",
"$",
"needsMagicType",
"=",
"true",
";... | In case the type is defined manually by the user we need to map it
@param string $fieldName
@param array $options
@return array | [
"In",
"case",
"the",
"type",
"is",
"defined",
"manually",
"by",
"the",
"user",
"we",
"need",
"to",
"map",
"it"
] | ba77755139707a1c83ef30d6ae2db2908a941145 | https://github.com/NotQuiteZen/cakephp-plugin-material/blob/ba77755139707a1c83ef30d6ae2db2908a941145/src/View/Helper/FormHelper.php#L1306-L1328 |
4,935 | PHPPlatform/session | src/Session/Factory.php | Factory.getSession | static function getSession(){
if(self::$session == null){
$sessionImplClassName = Settings::getSettings('php-platform/session',"session.class");
try{
$sessionImplReflectionClass = new \ReflectionClass($sessionImplClassName);
}catch (\ReflectionException $re){
throw new ProgrammingError("session... | php | static function getSession(){
if(self::$session == null){
$sessionImplClassName = Settings::getSettings('php-platform/session',"session.class");
try{
$sessionImplReflectionClass = new \ReflectionClass($sessionImplClassName);
}catch (\ReflectionException $re){
throw new ProgrammingError("session... | [
"static",
"function",
"getSession",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"session",
"==",
"null",
")",
"{",
"$",
"sessionImplClassName",
"=",
"Settings",
"::",
"getSettings",
"(",
"'php-platform/session'",
",",
"\"session.class\"",
")",
";",
"try",
"... | This method returns Session singleton object
@throws ProgrammingError
@return Session | [
"This",
"method",
"returns",
"Session",
"singleton",
"object"
] | 9614f7718cda2003f2cf67d572a4a60a81d0d78e | https://github.com/PHPPlatform/session/blob/9614f7718cda2003f2cf67d572a4a60a81d0d78e/src/Session/Factory.php#L16-L34 |
4,936 | zachgarwood/datatable | library/Table.php | Table.findColumn | public function findColumn($label)
{
$column = false;
foreach ($this->getColumns() as $col) {
if ($col->getLabel() == $label) {
$column = $col;
break;
}
}
return $column;
} | php | public function findColumn($label)
{
$column = false;
foreach ($this->getColumns() as $col) {
if ($col->getLabel() == $label) {
$column = $col;
break;
}
}
return $column;
} | [
"public",
"function",
"findColumn",
"(",
"$",
"label",
")",
"{",
"$",
"column",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"getColumns",
"(",
")",
"as",
"$",
"col",
")",
"{",
"if",
"(",
"$",
"col",
"->",
"getLabel",
"(",
")",
"==",
"$"... | Finds the column with the specified label
@api
@since 1.0.0
@param string $label
@return Column|false Returns false if no column is found | [
"Finds",
"the",
"column",
"with",
"the",
"specified",
"label"
] | 01d2f12e69742b721663d47a66b469397f115b34 | https://github.com/zachgarwood/datatable/blob/01d2f12e69742b721663d47a66b469397f115b34/library/Table.php#L69-L80 |
4,937 | northern/PHP-Common | src/Northern/Common/Util/ArrayUtil.php | ArrayUtil.insert | public static function insert(&$arr, $path, $value, $delimiter = '.')
{
if (! static::exists($arr, $path, $delimiter)) {
static::set($arr, $path, $value, $delimiter);
}
} | php | public static function insert(&$arr, $path, $value, $delimiter = '.')
{
if (! static::exists($arr, $path, $delimiter)) {
static::set($arr, $path, $value, $delimiter);
}
} | [
"public",
"static",
"function",
"insert",
"(",
"&",
"$",
"arr",
",",
"$",
"path",
",",
"$",
"value",
",",
"$",
"delimiter",
"=",
"'.'",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"exists",
"(",
"$",
"arr",
",",
"$",
"path",
",",
"$",
"delimiter",
... | Inserts a new value into a key or path only if the key or path does not yet
exists.
@param array $arr
@param string $path
@param mixed $value
@param string $delimiter | [
"Inserts",
"a",
"new",
"value",
"into",
"a",
"key",
"or",
"path",
"only",
"if",
"the",
"key",
"or",
"path",
"does",
"not",
"yet",
"exists",
"."
] | 7c63ef19252fd540fb412a18af956b8563afaa55 | https://github.com/northern/PHP-Common/blob/7c63ef19252fd540fb412a18af956b8563afaa55/src/Northern/Common/Util/ArrayUtil.php#L144-L149 |
4,938 | northern/PHP-Common | src/Northern/Common/Util/ArrayUtil.php | ArrayUtil.exists | public static function exists(array &$arr, $path, $delimiter = '.')
{
if (array_key_exists($path, $arr)) {
return true;
}
$segments = explode($delimiter, $path);
$cur = $arr;
foreach ($segments as $segment) {
if (! is_array($cur) or ! array_key_exis... | php | public static function exists(array &$arr, $path, $delimiter = '.')
{
if (array_key_exists($path, $arr)) {
return true;
}
$segments = explode($delimiter, $path);
$cur = $arr;
foreach ($segments as $segment) {
if (! is_array($cur) or ! array_key_exis... | [
"public",
"static",
"function",
"exists",
"(",
"array",
"&",
"$",
"arr",
",",
"$",
"path",
",",
"$",
"delimiter",
"=",
"'.'",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"path",
",",
"$",
"arr",
")",
")",
"{",
"return",
"true",
";",
"}",
"... | Tests if a key or path exists in a specified array. If the specified key or
path exists this method will return TRUE otherwise FALSE.
@param array $arr
@param string $path
@param string $delimiter
@return boolean | [
"Tests",
"if",
"a",
"key",
"or",
"path",
"exists",
"in",
"a",
"specified",
"array",
".",
"If",
"the",
"specified",
"key",
"or",
"path",
"exists",
"this",
"method",
"will",
"return",
"TRUE",
"otherwise",
"FALSE",
"."
] | 7c63ef19252fd540fb412a18af956b8563afaa55 | https://github.com/northern/PHP-Common/blob/7c63ef19252fd540fb412a18af956b8563afaa55/src/Northern/Common/Util/ArrayUtil.php#L202-L221 |
4,939 | northern/PHP-Common | src/Northern/Common/Util/ArrayUtil.php | ArrayUtil.keys | public static function keys($array, $prefix = null)
{
$keys = array_keys($array);
if (! empty($prefix)) {
$keys = static::prefix($keys, $prefix);
}
return $keys;
} | php | public static function keys($array, $prefix = null)
{
$keys = array_keys($array);
if (! empty($prefix)) {
$keys = static::prefix($keys, $prefix);
}
return $keys;
} | [
"public",
"static",
"function",
"keys",
"(",
"$",
"array",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"array",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"prefix",
")",
")",
"{",
"$",
"keys",
"=",
"st... | This method will return all the keys of a given array and optionally
prefix each key with a specified prefix.
@param array $array
@param string $prefix
@return array | [
"This",
"method",
"will",
"return",
"all",
"the",
"keys",
"of",
"a",
"given",
"array",
"and",
"optionally",
"prefix",
"each",
"key",
"with",
"a",
"specified",
"prefix",
"."
] | 7c63ef19252fd540fb412a18af956b8563afaa55 | https://github.com/northern/PHP-Common/blob/7c63ef19252fd540fb412a18af956b8563afaa55/src/Northern/Common/Util/ArrayUtil.php#L280-L289 |
4,940 | northern/PHP-Common | src/Northern/Common/Util/ArrayUtil.php | ArrayUtil.values | public static function values($array, $prefix = null)
{
$values = array_values($array);
if (! empty($prefix)) {
$values = static::prefix($values, $prefix);
}
return $values;
} | php | public static function values($array, $prefix = null)
{
$values = array_values($array);
if (! empty($prefix)) {
$values = static::prefix($values, $prefix);
}
return $values;
} | [
"public",
"static",
"function",
"values",
"(",
"$",
"array",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"values",
"=",
"array_values",
"(",
"$",
"array",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"prefix",
")",
")",
"{",
"$",
"values",
"=... | This method will return all values of a given array and optionally prefix
each value with a specified prefix.
@param array $array
@param string $prefix
@return array | [
"This",
"method",
"will",
"return",
"all",
"values",
"of",
"a",
"given",
"array",
"and",
"optionally",
"prefix",
"each",
"value",
"with",
"a",
"specified",
"prefix",
"."
] | 7c63ef19252fd540fb412a18af956b8563afaa55 | https://github.com/northern/PHP-Common/blob/7c63ef19252fd540fb412a18af956b8563afaa55/src/Northern/Common/Util/ArrayUtil.php#L299-L308 |
4,941 | northern/PHP-Common | src/Northern/Common/Util/ArrayUtil.php | ArrayUtil.map | public static function map($callbacks, $arr, $keys = null)
{
foreach ($arr as $key => $val) {
if (is_array($val)) {
$arr[ $key ] = static::map($callbacks, $arr[ $key ]);
} elseif (! is_array($keys) or in_array($key, $keys)) {
if (is_array($callbacks)) ... | php | public static function map($callbacks, $arr, $keys = null)
{
foreach ($arr as $key => $val) {
if (is_array($val)) {
$arr[ $key ] = static::map($callbacks, $arr[ $key ]);
} elseif (! is_array($keys) or in_array($key, $keys)) {
if (is_array($callbacks)) ... | [
"public",
"static",
"function",
"map",
"(",
"$",
"callbacks",
",",
"$",
"arr",
",",
"$",
"keys",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"val",
")",
")",
... | Recursive version of array_map, applies one or more callbacks to all
elements in an array, including sub-arrays.
Apply "strip_tags" to every element in the array
$array = ArrayHelper::map('strip_tags', $array);
Apply $this->filter to every element in the array
$array = ArrayHelper::map(array(array($this,'filter')), $... | [
"Recursive",
"version",
"of",
"array_map",
"applies",
"one",
"or",
"more",
"callbacks",
"to",
"all",
"elements",
"in",
"an",
"array",
"including",
"sub",
"-",
"arrays",
"."
] | 7c63ef19252fd540fb412a18af956b8563afaa55 | https://github.com/northern/PHP-Common/blob/7c63ef19252fd540fb412a18af956b8563afaa55/src/Northern/Common/Util/ArrayUtil.php#L328-L345 |
4,942 | northern/PHP-Common | src/Northern/Common/Util/ArrayUtil.php | ArrayUtil.remapCollection | public static function remapCollection(array $collection, array $map, $createMode = true)
{
$results = array();
foreach ($collection as $item) {
$results[] = self::remap($item, $map, $createMode);
}
return $results;
} | php | public static function remapCollection(array $collection, array $map, $createMode = true)
{
$results = array();
foreach ($collection as $item) {
$results[] = self::remap($item, $map, $createMode);
}
return $results;
} | [
"public",
"static",
"function",
"remapCollection",
"(",
"array",
"$",
"collection",
",",
"array",
"$",
"map",
",",
"$",
"createMode",
"=",
"true",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"ite... | Remaps a collection.
@param array $collection
@param array $map
@return array | [
"Remaps",
"a",
"collection",
"."
] | 7c63ef19252fd540fb412a18af956b8563afaa55 | https://github.com/northern/PHP-Common/blob/7c63ef19252fd540fb412a18af956b8563afaa55/src/Northern/Common/Util/ArrayUtil.php#L377-L386 |
4,943 | northern/PHP-Common | src/Northern/Common/Util/ArrayUtil.php | ArrayUtil.extract | public static function extract(array &$arr, $path, $default = null, $delimiter = '.')
{
$value = static::get($arr, $path, $default, $delimiter);
static::delete($arr, $path, $delimiter);
return $value;
} | php | public static function extract(array &$arr, $path, $default = null, $delimiter = '.')
{
$value = static::get($arr, $path, $default, $delimiter);
static::delete($arr, $path, $delimiter);
return $value;
} | [
"public",
"static",
"function",
"extract",
"(",
"array",
"&",
"$",
"arr",
",",
"$",
"path",
",",
"$",
"default",
"=",
"null",
",",
"$",
"delimiter",
"=",
"'.'",
")",
"{",
"$",
"value",
"=",
"static",
"::",
"get",
"(",
"$",
"arr",
",",
"$",
"path"... | Returns a value for a specified array key and deletes the key.
@param array $arr
@param string $path
@param mixed $default
@param string $delimiter
@return mixed | [
"Returns",
"a",
"value",
"for",
"a",
"specified",
"array",
"key",
"and",
"deletes",
"the",
"key",
"."
] | 7c63ef19252fd540fb412a18af956b8563afaa55 | https://github.com/northern/PHP-Common/blob/7c63ef19252fd540fb412a18af956b8563afaa55/src/Northern/Common/Util/ArrayUtil.php#L449-L456 |
4,944 | ouranoshong/phdescriptors | libs/CookieDescriptor.php | CookieDescriptor.getFromHeaderLine | public static function getFromHeaderLine($header_line, $source_url)
{
$parts = explode(';', trim($header_line));
$name = '';
$value = '';
$expires = null;
$path = null;
$domain = '';
// Name and value
preg_match('#([^=]*)=(.*)#', $parts[0], $match);
... | php | public static function getFromHeaderLine($header_line, $source_url)
{
$parts = explode(';', trim($header_line));
$name = '';
$value = '';
$expires = null;
$path = null;
$domain = '';
// Name and value
preg_match('#([^=]*)=(.*)#', $parts[0], $match);
... | [
"public",
"static",
"function",
"getFromHeaderLine",
"(",
"$",
"header_line",
",",
"$",
"source_url",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"';'",
",",
"trim",
"(",
"$",
"header_line",
")",
")",
";",
"$",
"name",
"=",
"''",
";",
"$",
"value",
... | Returns a CookieDescriptor-object initiated by the given cookie-header-line.
@param string $header_line The line from an header defining the cookie, e.g. "VISITOR=4c63394c2d82e31552001a58; expires="Sat, 08-Aug-2020 23:59:08 GMT"; Path=/"
@param string $source_url URL the cookie was send from.
@return CookieDescripto... | [
"Returns",
"a",
"CookieDescriptor",
"-",
"object",
"initiated",
"by",
"the",
"given",
"cookie",
"-",
"header",
"-",
"line",
"."
] | 1d2277d3d6547de443d14ef70cc297cab49e0c50 | https://github.com/ouranoshong/phdescriptors/blob/1d2277d3d6547de443d14ef70cc297cab49e0c50/libs/CookieDescriptor.php#L155-L190 |
4,945 | CampusUnion/Sked | src/ValidatesDates.php | ValidatesDates.validateDate | protected function validateDate(string &$strDate)
{
if (!preg_match("/\d{4}\-\d{2}-\d{2}/", $strDate)) {
if ($iTime = strtotime($strDate)) {
$strDate = date('Y-m-d', $iTime);
} else {
throw new \Exception(
'Invalid date string given... | php | protected function validateDate(string &$strDate)
{
if (!preg_match("/\d{4}\-\d{2}-\d{2}/", $strDate)) {
if ($iTime = strtotime($strDate)) {
$strDate = date('Y-m-d', $iTime);
} else {
throw new \Exception(
'Invalid date string given... | [
"protected",
"function",
"validateDate",
"(",
"string",
"&",
"$",
"strDate",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"\"/\\d{4}\\-\\d{2}-\\d{2}/\"",
",",
"$",
"strDate",
")",
")",
"{",
"if",
"(",
"$",
"iTime",
"=",
"strtotime",
"(",
"$",
"strDate",
... | Verifies that the given date string is in format YYYY-MM-DD.
Converts the date string to the desired format if possible.
@param string $strDate YYYY-MM-DD
@return bool | [
"Verifies",
"that",
"the",
"given",
"date",
"string",
"is",
"in",
"format",
"YYYY",
"-",
"MM",
"-",
"DD",
"."
] | 5b51afdb56c0f607e54364635c4725627b19ecc6 | https://github.com/CampusUnion/Sked/blob/5b51afdb56c0f607e54364635c4725627b19ecc6/src/ValidatesDates.php#L15-L27 |
4,946 | webforge-labs/webforge-project-stack | lib/Webforge/ProjectStack/Symfony/Form/Transformer/DoctrineEntityTransformer.php | DoctrineEntityTransformer.transform | public function transform($entity) {
if ($entity === NULL) {
return NULL;
}
$getter = 'get'.ucfirst($this->identifierName);
return array(
'__class' => $this->entityClass, // just for verbose
$this->identifierName => $entity->$getter()
);
} | php | public function transform($entity) {
if ($entity === NULL) {
return NULL;
}
$getter = 'get'.ucfirst($this->identifierName);
return array(
'__class' => $this->entityClass, // just for verbose
$this->identifierName => $entity->$getter()
);
} | [
"public",
"function",
"transform",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"entity",
"===",
"NULL",
")",
"{",
"return",
"NULL",
";",
"}",
"$",
"getter",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"this",
"->",
"identifierName",
")",
";",
"return",... | Transforms an entity to its json object | [
"Transforms",
"an",
"entity",
"to",
"its",
"json",
"object"
] | 753929c0957c660fdc62f7f358591fcb56e6d284 | https://github.com/webforge-labs/webforge-project-stack/blob/753929c0957c660fdc62f7f358591fcb56e6d284/lib/Webforge/ProjectStack/Symfony/Form/Transformer/DoctrineEntityTransformer.php#L34-L45 |
4,947 | webforge-labs/webforge-project-stack | lib/Webforge/ProjectStack/Symfony/Form/Transformer/DoctrineEntityTransformer.php | DoctrineEntityTransformer.reverseTransform | public function reverseTransform($properties) {
if (!is_array($properties)) {
return NULL;
}
if (!isset($properties[$this->identifierName])) {
throw new TransformationFailedException(sprintf(
'Identifier (%s) for entity %s is not set in properties %s',
$this->identifierName,
... | php | public function reverseTransform($properties) {
if (!is_array($properties)) {
return NULL;
}
if (!isset($properties[$this->identifierName])) {
throw new TransformationFailedException(sprintf(
'Identifier (%s) for entity %s is not set in properties %s',
$this->identifierName,
... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"properties",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"properties",
")",
")",
"{",
"return",
"NULL",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"properties",
"[",
"$",
"this",
"->",
"ident... | Transforms an json object to an entity | [
"Transforms",
"an",
"json",
"object",
"to",
"an",
"entity"
] | 753929c0957c660fdc62f7f358591fcb56e6d284 | https://github.com/webforge-labs/webforge-project-stack/blob/753929c0957c660fdc62f7f358591fcb56e6d284/lib/Webforge/ProjectStack/Symfony/Form/Transformer/DoctrineEntityTransformer.php#L51-L82 |
4,948 | ntentan/utils | src/filesystem/UploadedFile.php | UploadedFile.moveTo | public function moveTo(string $destination): void
{
$destination = is_dir($destination) ? ("$destination/{$this->clientName}") : $destination;
Filesystem::checkWritable(dirname($destination));
if (!move_uploaded_file($this->path, $destination)) {
throw new FilesystemException("Fa... | php | public function moveTo(string $destination): void
{
$destination = is_dir($destination) ? ("$destination/{$this->clientName}") : $destination;
Filesystem::checkWritable(dirname($destination));
if (!move_uploaded_file($this->path, $destination)) {
throw new FilesystemException("Fa... | [
"public",
"function",
"moveTo",
"(",
"string",
"$",
"destination",
")",
":",
"void",
"{",
"$",
"destination",
"=",
"is_dir",
"(",
"$",
"destination",
")",
"?",
"(",
"\"$destination/{$this->clientName}\"",
")",
":",
"$",
"destination",
";",
"Filesystem",
"::",
... | Move the uploaded file safely to another location.
Ensures that files were actually uploaded through PHP before moving them.
@param string $destination
@throws FilesystemException
@throws \ntentan\utils\exceptions\FileNotWriteableException | [
"Move",
"the",
"uploaded",
"file",
"safely",
"to",
"another",
"location",
".",
"Ensures",
"that",
"files",
"were",
"actually",
"uploaded",
"through",
"PHP",
"before",
"moving",
"them",
"."
] | 151f3582ee6007ea77a38d2b6c590289331e19a1 | https://github.com/ntentan/utils/blob/151f3582ee6007ea77a38d2b6c590289331e19a1/src/filesystem/UploadedFile.php#L82-L89 |
4,949 | nicolasherve/StimLog | src/StimLog/Event/LogEvent.php | LogEvent.create | public static function create($className, $level) {
// Create the event
$event = new LogEvent();
// Assign level and message
$event->_setLevel(LogLevel::create($level));
// Initialize current date and time (with milliseconds)
$event->_setDate(DateMilli::create()... | php | public static function create($className, $level) {
// Create the event
$event = new LogEvent();
// Assign level and message
$event->_setLevel(LogLevel::create($level));
// Initialize current date and time (with milliseconds)
$event->_setDate(DateMilli::create()... | [
"public",
"static",
"function",
"create",
"(",
"$",
"className",
",",
"$",
"level",
")",
"{",
"// Create the event\r",
"$",
"event",
"=",
"new",
"LogEvent",
"(",
")",
";",
"// Assign level and message\r",
"$",
"event",
"->",
"_setLevel",
"(",
"LogLevel",
"::",... | Create a new log event and return it
@param string $className the class name where the event was created
@param integer $level the log level of the event
@return LogEvent | [
"Create",
"a",
"new",
"log",
"event",
"and",
"return",
"it"
] | b9fabe8a5141a835c0d2a18a7ae67663359eb0f7 | https://github.com/nicolasherve/StimLog/blob/b9fabe8a5141a835c0d2a18a7ae67663359eb0f7/src/StimLog/Event/LogEvent.php#L73-L92 |
4,950 | helloandre/pressing | src/Ingester.php | Ingester.scandir | private function scandir($dir) {
$dir = trim($dir, '/') . '/';
$absolute = $this->absolute($dir);
$files = scandir($absolute);
foreach ($files as $file) {
// ignore relative references
if ($file === "." || $file === "..") {
continue;
}... | php | private function scandir($dir) {
$dir = trim($dir, '/') . '/';
$absolute = $this->absolute($dir);
$files = scandir($absolute);
foreach ($files as $file) {
// ignore relative references
if ($file === "." || $file === "..") {
continue;
}... | [
"private",
"function",
"scandir",
"(",
"$",
"dir",
")",
"{",
"$",
"dir",
"=",
"trim",
"(",
"$",
"dir",
",",
"'/'",
")",
".",
"'/'",
";",
"$",
"absolute",
"=",
"$",
"this",
"->",
"absolute",
"(",
"$",
"dir",
")",
";",
"$",
"files",
"=",
"scandir... | recursively scan the directory for any files
@param String $dir - relative to getcwd() | [
"recursively",
"scan",
"the",
"directory",
"for",
"any",
"files"
] | e4244c7bbe90c38fa7d45e3c2da5d4b9153a0f54 | https://github.com/helloandre/pressing/blob/e4244c7bbe90c38fa7d45e3c2da5d4b9153a0f54/src/Ingester.php#L62-L84 |
4,951 | phlexible/phlexible | src/Phlexible/Component/MediaCache/Queue/InstructionCreator.php | InstructionCreator.createInstruction | public function createInstruction(InputDescriptor $input, TemplateInterface $template, array $flags = [])
{
if (!$template->getManaged()) {
return null;
}
$cacheItem = $this->cacheManager->findByTemplateAndFile($template->getKey(), $input->getFileId(), $input->getFileVersion());... | php | public function createInstruction(InputDescriptor $input, TemplateInterface $template, array $flags = [])
{
if (!$template->getManaged()) {
return null;
}
$cacheItem = $this->cacheManager->findByTemplateAndFile($template->getKey(), $input->getFileId(), $input->getFileVersion());... | [
"public",
"function",
"createInstruction",
"(",
"InputDescriptor",
"$",
"input",
",",
"TemplateInterface",
"$",
"template",
",",
"array",
"$",
"flags",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"template",
"->",
"getManaged",
"(",
")",
")",
"{",
"ret... | Resolve batch to queue items.
@param InputDescriptor $input
@param TemplateInterface $template
@param array $flags
@return Instruction|null | [
"Resolve",
"batch",
"to",
"queue",
"items",
"."
] | 132f24924c9bb0dbb6c1ea84db0a463f97fa3893 | https://github.com/phlexible/phlexible/blob/132f24924c9bb0dbb6c1ea84db0a463f97fa3893/src/Phlexible/Component/MediaCache/Queue/InstructionCreator.php#L64-L108 |
4,952 | rad8329/Cordillera | middlewares/filters/request/Cors.php | Cors.prepareHeaders | public function prepareHeaders($requestHeaders)
{
$responseHeaders = [];
if (isset($requestHeaders['Origin'], $this->_cors['Origin'])) {
if (in_array('*', $this->_cors['Origin']) || in_array($requestHeaders['Origin'], $this->_cors['Origin'])) {
$responseHeaders['Access-C... | php | public function prepareHeaders($requestHeaders)
{
$responseHeaders = [];
if (isset($requestHeaders['Origin'], $this->_cors['Origin'])) {
if (in_array('*', $this->_cors['Origin']) || in_array($requestHeaders['Origin'], $this->_cors['Origin'])) {
$responseHeaders['Access-C... | [
"public",
"function",
"prepareHeaders",
"(",
"$",
"requestHeaders",
")",
"{",
"$",
"responseHeaders",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"requestHeaders",
"[",
"'Origin'",
"]",
",",
"$",
"this",
"->",
"_cors",
"[",
"'Origin'",
"]",
")",
... | For each CORS headers create the specific response.
@param array $requestHeaders CORS headers we have detected
@return array CORS headers ready to be sent | [
"For",
"each",
"CORS",
"headers",
"create",
"the",
"specific",
"response",
"."
] | fbc16dee44116556537390628301feeb11c7639a | https://github.com/rad8329/Cordillera/blob/fbc16dee44116556537390628301feeb11c7639a/middlewares/filters/request/Cors.php#L84-L113 |
4,953 | rad8329/Cordillera | middlewares/filters/request/Cors.php | Cors.prepareAllowHeaders | protected function prepareAllowHeaders($type, $requestHeaders, &$responseHeaders)
{
$requestHeaderField = 'Access-Control-Request-'.$type;
$responseHeaderField = 'Access-Control-Allow-'.$type;
if (!isset($requestHeaders[$requestHeaderField], $this->_cors[$requestHeaderField])) {
... | php | protected function prepareAllowHeaders($type, $requestHeaders, &$responseHeaders)
{
$requestHeaderField = 'Access-Control-Request-'.$type;
$responseHeaderField = 'Access-Control-Allow-'.$type;
if (!isset($requestHeaders[$requestHeaderField], $this->_cors[$requestHeaderField])) {
... | [
"protected",
"function",
"prepareAllowHeaders",
"(",
"$",
"type",
",",
"$",
"requestHeaders",
",",
"&",
"$",
"responseHeaders",
")",
"{",
"$",
"requestHeaderField",
"=",
"'Access-Control-Request-'",
".",
"$",
"type",
";",
"$",
"responseHeaderField",
"=",
"'Access-... | Handle classic CORS request to avoid duplicate code.
@param string $type the kind of headers we would handle
@param array $requestHeaders CORS headers request by client
@param array $responseHeaders CORS response headers sent to the client | [
"Handle",
"classic",
"CORS",
"request",
"to",
"avoid",
"duplicate",
"code",
"."
] | fbc16dee44116556537390628301feeb11c7639a | https://github.com/rad8329/Cordillera/blob/fbc16dee44116556537390628301feeb11c7639a/middlewares/filters/request/Cors.php#L122-L138 |
4,954 | Becklyn/BecklynBugsnagBundle | DependencyInjection/MonitoringCompilerPass.php | MonitoringCompilerPass.createClientDefinition | private function createClientDefinition ($rootDir)
{
$bugsnagClient = new Definition(Client::class, [
$this->configuration->getApiKey(),
]);
$bugsnagClient->setFactory([Client::class, "make"]);
$bugsnagClient->setPublic(false);
// strip root dir from logs
... | php | private function createClientDefinition ($rootDir)
{
$bugsnagClient = new Definition(Client::class, [
$this->configuration->getApiKey(),
]);
$bugsnagClient->setFactory([Client::class, "make"]);
$bugsnagClient->setPublic(false);
// strip root dir from logs
... | [
"private",
"function",
"createClientDefinition",
"(",
"$",
"rootDir",
")",
"{",
"$",
"bugsnagClient",
"=",
"new",
"Definition",
"(",
"Client",
"::",
"class",
",",
"[",
"$",
"this",
"->",
"configuration",
"->",
"getApiKey",
"(",
")",
",",
"]",
")",
";",
"... | Creates the bugsnag client
@param string $rootDir
@return Definition | [
"Creates",
"the",
"bugsnag",
"client"
] | d9f0d0aef7fb2ba68975b8279364e744f56cb6ee | https://github.com/Becklyn/BecklynBugsnagBundle/blob/d9f0d0aef7fb2ba68975b8279364e744f56cb6ee/DependencyInjection/MonitoringCompilerPass.php#L88-L103 |
4,955 | Becklyn/BecklynBugsnagBundle | DependencyInjection/MonitoringCompilerPass.php | MonitoringCompilerPass.addLoggerReferenceToContainer | private function addLoggerReferenceToContainer (Definition $handlerDefinition, ContainerBuilder $container)
{
// first wrap logger in FingersCrossedHandler
$monitoringDefinition = new Definition(FingersCrossedHandler::class, [
$handlerDefinition,
Logger::WARNING
]);
... | php | private function addLoggerReferenceToContainer (Definition $handlerDefinition, ContainerBuilder $container)
{
// first wrap logger in FingersCrossedHandler
$monitoringDefinition = new Definition(FingersCrossedHandler::class, [
$handlerDefinition,
Logger::WARNING
]);
... | [
"private",
"function",
"addLoggerReferenceToContainer",
"(",
"Definition",
"$",
"handlerDefinition",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"// first wrap logger in FingersCrossedHandler",
"$",
"monitoringDefinition",
"=",
"new",
"Definition",
"(",
"FingersCross... | Adds the monolog handler to the service container
@param Definition $handlerDefinition
@param ContainerBuilder $container | [
"Adds",
"the",
"monolog",
"handler",
"to",
"the",
"service",
"container"
] | d9f0d0aef7fb2ba68975b8279364e744f56cb6ee | https://github.com/Becklyn/BecklynBugsnagBundle/blob/d9f0d0aef7fb2ba68975b8279364e744f56cb6ee/DependencyInjection/MonitoringCompilerPass.php#L129-L139 |
4,956 | Becklyn/BecklynBugsnagBundle | DependencyInjection/MonitoringCompilerPass.php | MonitoringCompilerPass.collectReportTransformers | private function collectReportTransformers (Definition $handler, ContainerBuilder $container)
{
$taggedServices = $container->findTaggedServiceIds(self::REPORT_TRANSFORMER_TAG);
foreach ($taggedServices as $serviceId => $tags)
{
$handler->addMethodCall("addReportTransformer", [n... | php | private function collectReportTransformers (Definition $handler, ContainerBuilder $container)
{
$taggedServices = $container->findTaggedServiceIds(self::REPORT_TRANSFORMER_TAG);
foreach ($taggedServices as $serviceId => $tags)
{
$handler->addMethodCall("addReportTransformer", [n... | [
"private",
"function",
"collectReportTransformers",
"(",
"Definition",
"$",
"handler",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"taggedServices",
"=",
"$",
"container",
"->",
"findTaggedServiceIds",
"(",
"self",
"::",
"REPORT_TRANSFORMER_TAG",
")",
... | Collects all report transformers and registers them in the handler
@param Definition $handler
@param ContainerBuilder $container | [
"Collects",
"all",
"report",
"transformers",
"and",
"registers",
"them",
"in",
"the",
"handler"
] | d9f0d0aef7fb2ba68975b8279364e744f56cb6ee | https://github.com/Becklyn/BecklynBugsnagBundle/blob/d9f0d0aef7fb2ba68975b8279364e744f56cb6ee/DependencyInjection/MonitoringCompilerPass.php#L149-L157 |
4,957 | Becklyn/BecklynBugsnagBundle | DependencyInjection/MonitoringCompilerPass.php | MonitoringCompilerPass.registerMonologHandlerInAllChannels | private function registerMonologHandlerInAllChannels (ContainerBuilder $container)
{
$monitoringReference = new Reference(self::MONOLOG_HANDLER_SERVICE_ID);
// push reference as handler to every logger in the system
foreach ($container->getDefinitions() as $key => $definition)
{
... | php | private function registerMonologHandlerInAllChannels (ContainerBuilder $container)
{
$monitoringReference = new Reference(self::MONOLOG_HANDLER_SERVICE_ID);
// push reference as handler to every logger in the system
foreach ($container->getDefinitions() as $key => $definition)
{
... | [
"private",
"function",
"registerMonologHandlerInAllChannels",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"monitoringReference",
"=",
"new",
"Reference",
"(",
"self",
"::",
"MONOLOG_HANDLER_SERVICE_ID",
")",
";",
"// push reference as handler to every logger in ... | Registers the monolog handler in all channels
@param ContainerBuilder $container | [
"Registers",
"the",
"monolog",
"handler",
"in",
"all",
"channels"
] | d9f0d0aef7fb2ba68975b8279364e744f56cb6ee | https://github.com/Becklyn/BecklynBugsnagBundle/blob/d9f0d0aef7fb2ba68975b8279364e744f56cb6ee/DependencyInjection/MonitoringCompilerPass.php#L166-L178 |
4,958 | novuso/system | src/Collection/SortedTable.php | SortedTable.create | public static function create(
Comparator $comparator,
?string $keyType = null,
?string $valueType = null
): SortedTable {
return new static($comparator, $keyType, $valueType);
} | php | public static function create(
Comparator $comparator,
?string $keyType = null,
?string $valueType = null
): SortedTable {
return new static($comparator, $keyType, $valueType);
} | [
"public",
"static",
"function",
"create",
"(",
"Comparator",
"$",
"comparator",
",",
"?",
"string",
"$",
"keyType",
"=",
"null",
",",
"?",
"string",
"$",
"valueType",
"=",
"null",
")",
":",
"SortedTable",
"{",
"return",
"new",
"static",
"(",
"$",
"compar... | Creates collection with a custom comparator
If types are not provided, the types are dynamic.
The type can be any fully-qualified class or interface name,
or one of the following type strings:
[array, object, bool, int, float, string, callable]
@param Comparator $comparator The comparator
@param string|null $keyTyp... | [
"Creates",
"collection",
"with",
"a",
"custom",
"comparator"
] | e34038b391826edc68d0b5fccfba96642de9d6f0 | https://github.com/novuso/system/blob/e34038b391826edc68d0b5fccfba96642de9d6f0/src/Collection/SortedTable.php#L73-L79 |
4,959 | novuso/system | src/Collection/SortedTable.php | SortedTable.comparable | public static function comparable(?string $keyType = null, ?string $valueType = null): SortedTable
{
assert(
Validate::isNull($keyType) || Validate::implementsInterface($keyType, Comparable::class),
sprintf('%s expects $keyType to implement %s', __METHOD__, Comparable::class)
... | php | public static function comparable(?string $keyType = null, ?string $valueType = null): SortedTable
{
assert(
Validate::isNull($keyType) || Validate::implementsInterface($keyType, Comparable::class),
sprintf('%s expects $keyType to implement %s', __METHOD__, Comparable::class)
... | [
"public",
"static",
"function",
"comparable",
"(",
"?",
"string",
"$",
"keyType",
"=",
"null",
",",
"?",
"string",
"$",
"valueType",
"=",
"null",
")",
":",
"SortedTable",
"{",
"assert",
"(",
"Validate",
"::",
"isNull",
"(",
"$",
"keyType",
")",
"||",
"... | Creates collection with comparable keys
If types are not provided, the types are dynamic.
The key type must be a fully-qualified class name that implements:
`Novuso\System\Type\Comparable`
The value type can be any fully-qualified class or interface name,
or one of the following type strings:
[array, object, bool, i... | [
"Creates",
"collection",
"with",
"comparable",
"keys"
] | e34038b391826edc68d0b5fccfba96642de9d6f0 | https://github.com/novuso/system/blob/e34038b391826edc68d0b5fccfba96642de9d6f0/src/Collection/SortedTable.php#L98-L106 |
4,960 | romeOz/rock-template | src/template/twig/ViewRenderer.php | ViewRenderer.addGlobals | public function addGlobals($globals)
{
foreach ($globals as $name => $value) {
if (!is_object($value)) {
$value = new ViewRendererStaticClassProxy($value);
}
$this->twig->addGlobal($name, $value);
}
} | php | public function addGlobals($globals)
{
foreach ($globals as $name => $value) {
if (!is_object($value)) {
$value = new ViewRendererStaticClassProxy($value);
}
$this->twig->addGlobal($name, $value);
}
} | [
"public",
"function",
"addGlobals",
"(",
"$",
"globals",
")",
"{",
"foreach",
"(",
"$",
"globals",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"new",
"ViewRender... | Adds a global objects or static classes
@param array $globals @see self::$globals | [
"Adds",
"a",
"global",
"objects",
"or",
"static",
"classes"
] | fcb7bd6dd923d11f02a1c71a63065f3f49728e92 | https://github.com/romeOz/rock-template/blob/fcb7bd6dd923d11f02a1c71a63065f3f49728e92/src/template/twig/ViewRenderer.php#L134-L142 |
4,961 | romeOz/rock-template | src/template/twig/ViewRenderer.php | ViewRenderer.addLexerOptions | public function addLexerOptions($options)
{
$lexer = new \Twig_Lexer($this->twig, $options);
$this->twig->setLexer($lexer);
} | php | public function addLexerOptions($options)
{
$lexer = new \Twig_Lexer($this->twig, $options);
$this->twig->setLexer($lexer);
} | [
"public",
"function",
"addLexerOptions",
"(",
"$",
"options",
")",
"{",
"$",
"lexer",
"=",
"new",
"\\",
"Twig_Lexer",
"(",
"$",
"this",
"->",
"twig",
",",
"$",
"options",
")",
";",
"$",
"this",
"->",
"twig",
"->",
"setLexer",
"(",
"$",
"lexer",
")",
... | Sets a Twig lexer options to change templates syntax
@param array $options @see self::$lexerOptions | [
"Sets",
"a",
"Twig",
"lexer",
"options",
"to",
"change",
"templates",
"syntax"
] | fcb7bd6dd923d11f02a1c71a63065f3f49728e92 | https://github.com/romeOz/rock-template/blob/fcb7bd6dd923d11f02a1c71a63065f3f49728e92/src/template/twig/ViewRenderer.php#L177-L181 |
4,962 | koolkode/event | src/AbstractListener.php | AbstractListener.loadArguments | protected function loadArguments(\ReflectionFunctionAbstract $ref, EventParamResolverInterface $resolver)
{
$args = [];
if($ref->getNumberOfParameters() > 1)
{
foreach(array_slice($ref->getParameters(), 1) as $param)
{
$args[] = $resolver->resolve($param->getClass(), $param->isDefaultValueAvailable(... | php | protected function loadArguments(\ReflectionFunctionAbstract $ref, EventParamResolverInterface $resolver)
{
$args = [];
if($ref->getNumberOfParameters() > 1)
{
foreach(array_slice($ref->getParameters(), 1) as $param)
{
$args[] = $resolver->resolve($param->getClass(), $param->isDefaultValueAvailable(... | [
"protected",
"function",
"loadArguments",
"(",
"\\",
"ReflectionFunctionAbstract",
"$",
"ref",
",",
"EventParamResolverInterface",
"$",
"resolver",
")",
"{",
"$",
"args",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"ref",
"->",
"getNumberOfParameters",
"(",
")",
">",
... | Populates arguments assembled from the event and the given target function.
@param \ReflectionFunctionAbstract $ref
@param EventParamResolverInterface $resolver
@return array | [
"Populates",
"arguments",
"assembled",
"from",
"the",
"event",
"and",
"the",
"given",
"target",
"function",
"."
] | 0f823ec5aaa2df0e3e437592a4dd3a4456af7be9 | https://github.com/koolkode/event/blob/0f823ec5aaa2df0e3e437592a4dd3a4456af7be9/src/AbstractListener.php#L91-L104 |
4,963 | rseyferth/activerecord | lib/ConnectionManager.php | ConnectionManager.dropConnection | public static function dropConnection($name=null)
{
if (isset(self::$connections[$name]))
unset(self::$connections[$name]);
} | php | public static function dropConnection($name=null)
{
if (isset(self::$connections[$name]))
unset(self::$connections[$name]);
} | [
"public",
"static",
"function",
"dropConnection",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"connections",
"[",
"$",
"name",
"]",
")",
")",
"unset",
"(",
"self",
"::",
"$",
"connections",
"[",
"$",
"name",
... | Drops the connection from the connection manager. Does not actually close it since there
is no close method in PDO.
@param string $name Name of the connection to forget about | [
"Drops",
"the",
"connection",
"from",
"the",
"connection",
"manager",
".",
"Does",
"not",
"actually",
"close",
"it",
"since",
"there",
"is",
"no",
"close",
"method",
"in",
"PDO",
"."
] | 0e7b1cbddd6f967c3a09adf38753babd5f698e39 | https://github.com/rseyferth/activerecord/blob/0e7b1cbddd6f967c3a09adf38753babd5f698e39/lib/ConnectionManager.php#L44-L48 |
4,964 | schnittstabil/composer-extra | src/ComposerExtra.php | ComposerExtra.merge | protected function merge($target, $source)
{
if ($source === null) {
return $target;
}
return call_user_func($this->merge, $target, $source);
} | php | protected function merge($target, $source)
{
if ($source === null) {
return $target;
}
return call_user_func($this->merge, $target, $source);
} | [
"protected",
"function",
"merge",
"(",
"$",
"target",
",",
"$",
"source",
")",
"{",
"if",
"(",
"$",
"source",
"===",
"null",
")",
"{",
"return",
"$",
"target",
";",
"}",
"return",
"call_user_func",
"(",
"$",
"this",
"->",
"merge",
",",
"$",
"target",... | Merge two configs.
@param mixed $target Target config
@param mixed $source Source config
@return mixed The merged config | [
"Merge",
"two",
"configs",
"."
] | 918d14368102b979715f312e9258286abf6dece2 | https://github.com/schnittstabil/composer-extra/blob/918d14368102b979715f312e9258286abf6dece2/src/ComposerExtra.php#L61-L68 |
4,965 | rafflesargentina/l5-resource-controller | src/Traits/FormatsValidJsonResponses.php | FormatsValidJsonResponses.validInternalServerErrorJsonResponse | public function validInternalServerErrorJsonResponse($exception, $message = 'Error')
{
return response()->json(
[
'exception' => class_basename($exception),
'file' => basename($exception->getFile()),
'line' => $exception->getLine(),
... | php | public function validInternalServerErrorJsonResponse($exception, $message = 'Error')
{
return response()->json(
[
'exception' => class_basename($exception),
'file' => basename($exception->getFile()),
'line' => $exception->getLine(),
... | [
"public",
"function",
"validInternalServerErrorJsonResponse",
"(",
"$",
"exception",
",",
"$",
"message",
"=",
"'Error'",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"[",
"'exception'",
"=>",
"class_basename",
"(",
"$",
"exception",
")",
",",
... | Return a valid 500 Internal Server Error json response.
@param Exception $exception The exception object.
@param string $message The response message.
@return \Illuminate\Http\JsonResponse | [
"Return",
"a",
"valid",
"500",
"Internal",
"Server",
"Error",
"json",
"response",
"."
] | 5ee5de4803a26d0592dd6f5db77aec40c1a56c09 | https://github.com/rafflesargentina/l5-resource-controller/blob/5ee5de4803a26d0592dd6f5db77aec40c1a56c09/src/Traits/FormatsValidJsonResponses.php#L17-L28 |
4,966 | rafflesargentina/l5-resource-controller | src/Traits/FormatsValidJsonResponses.php | FormatsValidJsonResponses.validSuccessJsonResponse | public function validSuccessJsonResponse($message = 'Success', $data = [], $redirect = null)
{
return response()->json(
[
'code' => '200',
'message' => $message,
'data' => $data,
'errors' => [],
'redirect' => $redire... | php | public function validSuccessJsonResponse($message = 'Success', $data = [], $redirect = null)
{
return response()->json(
[
'code' => '200',
'message' => $message,
'data' => $data,
'errors' => [],
'redirect' => $redire... | [
"public",
"function",
"validSuccessJsonResponse",
"(",
"$",
"message",
"=",
"'Success'",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"redirect",
"=",
"null",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"[",
"'code'",
"=>",
"'200'",
",",... | Return a valid 200 Success json response.
@param string $message The response message.
@param array $data The passed data.
@param string $redirect The redirection url.
@return \Illuminate\Http\JsonResponse | [
"Return",
"a",
"valid",
"200",
"Success",
"json",
"response",
"."
] | 5ee5de4803a26d0592dd6f5db77aec40c1a56c09 | https://github.com/rafflesargentina/l5-resource-controller/blob/5ee5de4803a26d0592dd6f5db77aec40c1a56c09/src/Traits/FormatsValidJsonResponses.php#L59-L70 |
4,967 | rafflesargentina/l5-resource-controller | src/Traits/FormatsValidJsonResponses.php | FormatsValidJsonResponses.validUnprocessableEntityJsonResponse | public function validUnprocessableEntityJsonResponse(MessageBag $errors, $message = 'Unprocessable Entity', $redirect = null)
{
return response()->json(
[
'code' => '422',
'message' => $message,
'errors' => $errors,
'redirect' => $r... | php | public function validUnprocessableEntityJsonResponse(MessageBag $errors, $message = 'Unprocessable Entity', $redirect = null)
{
return response()->json(
[
'code' => '422',
'message' => $message,
'errors' => $errors,
'redirect' => $r... | [
"public",
"function",
"validUnprocessableEntityJsonResponse",
"(",
"MessageBag",
"$",
"errors",
",",
"$",
"message",
"=",
"'Unprocessable Entity'",
",",
"$",
"redirect",
"=",
"null",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"[",
"'code'",
"... | Return a valid 422 Unprocessable entity json response.
@param \Illuminate\Support\MessageBag $errors The message bag errors.
@param string $message The response message.
@param string $redirect The redirection url.
@return \Illuminate\Http\JsonResponse | [
"Return",
"a",
"valid",
"422",
"Unprocessable",
"entity",
"json",
"response",
"."
] | 5ee5de4803a26d0592dd6f5db77aec40c1a56c09 | https://github.com/rafflesargentina/l5-resource-controller/blob/5ee5de4803a26d0592dd6f5db77aec40c1a56c09/src/Traits/FormatsValidJsonResponses.php#L81-L91 |
4,968 | setrun/setrun-component-user | src/entities/User.php | User.getStatusesArray | public static function getStatusesArray() : array
{
return [
self::STATUS_BLOCKED => Yii::t('setrun/user', 'Blocked'),
self::STATUS_ACTIVE => Yii::t('setrun/user', 'Active'),
self::STATUS_WAIT => Yii::t('setrun/user', 'Wait')
];
} | php | public static function getStatusesArray() : array
{
return [
self::STATUS_BLOCKED => Yii::t('setrun/user', 'Blocked'),
self::STATUS_ACTIVE => Yii::t('setrun/user', 'Active'),
self::STATUS_WAIT => Yii::t('setrun/user', 'Wait')
];
} | [
"public",
"static",
"function",
"getStatusesArray",
"(",
")",
":",
"array",
"{",
"return",
"[",
"self",
"::",
"STATUS_BLOCKED",
"=>",
"Yii",
"::",
"t",
"(",
"'setrun/user'",
",",
"'Blocked'",
")",
",",
"self",
"::",
"STATUS_ACTIVE",
"=>",
"Yii",
"::",
"t",... | Get all statuses.
@return array | [
"Get",
"all",
"statuses",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L98-L105 |
4,969 | setrun/setrun-component-user | src/entities/User.php | User.create | public static function create(string $username, string $email, string $password) : User
{
$user = new User();
$user->username = $username;
$user->email = $email;
$user->status = self::STATUS_ACTIVE;
$user->setPassword($password);
$user->generateAuthKey();
... | php | public static function create(string $username, string $email, string $password) : User
{
$user = new User();
$user->username = $username;
$user->email = $email;
$user->status = self::STATUS_ACTIVE;
$user->setPassword($password);
$user->generateAuthKey();
... | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"email",
",",
"string",
"$",
"password",
")",
":",
"User",
"{",
"$",
"user",
"=",
"new",
"User",
"(",
")",
";",
"$",
"user",
"->",
"username",
"=",
"$",
"... | Creating a user.
@param string $username
@param string $email
@param string $password
@return User | [
"Creating",
"a",
"user",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L114-L123 |
4,970 | setrun/setrun-component-user | src/entities/User.php | User.edit | public function edit(string $username, string $email) : void
{
$this->username = $username;
$this->email = $email;
} | php | public function edit(string $username, string $email) : void
{
$this->username = $username;
$this->email = $email;
} | [
"public",
"function",
"edit",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"email",
")",
":",
"void",
"{",
"$",
"this",
"->",
"username",
"=",
"$",
"username",
";",
"$",
"this",
"->",
"email",
"=",
"$",
"email",
";",
"}"
] | Editing a user.
@param string $username
@param string $email
@return void | [
"Editing",
"a",
"user",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L131-L135 |
4,971 | setrun/setrun-component-user | src/entities/User.php | User.requestSignup | public static function requestSignup(string $username, string $email, string $password) : User
{
$user = new User();
$user->username = $username;
$user->email = $email;
$user->status = self::STATUS_WAIT;
$user->generateEmailConfirmToken();
$user->generateAuthKey(... | php | public static function requestSignup(string $username, string $email, string $password) : User
{
$user = new User();
$user->username = $username;
$user->email = $email;
$user->status = self::STATUS_WAIT;
$user->generateEmailConfirmToken();
$user->generateAuthKey(... | [
"public",
"static",
"function",
"requestSignup",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"email",
",",
"string",
"$",
"password",
")",
":",
"User",
"{",
"$",
"user",
"=",
"new",
"User",
"(",
")",
";",
"$",
"user",
"->",
"username",
"=",
"... | Request to sing up a new user.
@param string $username
@param string $email
@param string $password
@return User | [
"Request",
"to",
"sing",
"up",
"a",
"new",
"user",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L144-L154 |
4,972 | setrun/setrun-component-user | src/entities/User.php | User.confirmSignup | public function confirmSignup() : void
{
if (!$this->isWait()) {
throw new \DomainException(Yii::t('setrun/user', 'User is already active'));
}
$this->status = self::STATUS_ACTIVE;
$this->removeEmailConfirmToken();
} | php | public function confirmSignup() : void
{
if (!$this->isWait()) {
throw new \DomainException(Yii::t('setrun/user', 'User is already active'));
}
$this->status = self::STATUS_ACTIVE;
$this->removeEmailConfirmToken();
} | [
"public",
"function",
"confirmSignup",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isWait",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"DomainException",
"(",
"Yii",
"::",
"t",
"(",
"'setrun/user'",
",",
"'User is already active'",
")"... | Confirm user sing up.
@return void | [
"Confirm",
"user",
"sing",
"up",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L160-L167 |
4,973 | setrun/setrun-component-user | src/entities/User.php | User.requestPasswordReset | public function requestPasswordReset() : void
{
if (!empty($this->password_reset_token) && self::isPasswordResetTokenValid($this->password_reset_token)) {
throw new \DomainException(Yii::t('setrun/user', 'Password resetting is already requested'));
}
$this->generatePasswordResetT... | php | public function requestPasswordReset() : void
{
if (!empty($this->password_reset_token) && self::isPasswordResetTokenValid($this->password_reset_token)) {
throw new \DomainException(Yii::t('setrun/user', 'Password resetting is already requested'));
}
$this->generatePasswordResetT... | [
"public",
"function",
"requestPasswordReset",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"password_reset_token",
")",
"&&",
"self",
"::",
"isPasswordResetTokenValid",
"(",
"$",
"this",
"->",
"password_reset_token",
")",
")",
... | Request to reset the user's password.
@return void | [
"Request",
"to",
"reset",
"the",
"user",
"s",
"password",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L173-L179 |
4,974 | setrun/setrun-component-user | src/entities/User.php | User.resetPassword | public function resetPassword(string $password) : void
{
if (empty($this->password_reset_token)) {
throw new \DomainException(Yii::t('setrun/user', 'Password resetting is not requested'));
}
$this->setPassword($password);
$this->removePasswordResetToken();
} | php | public function resetPassword(string $password) : void
{
if (empty($this->password_reset_token)) {
throw new \DomainException(Yii::t('setrun/user', 'Password resetting is not requested'));
}
$this->setPassword($password);
$this->removePasswordResetToken();
} | [
"public",
"function",
"resetPassword",
"(",
"string",
"$",
"password",
")",
":",
"void",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"password_reset_token",
")",
")",
"{",
"throw",
"new",
"\\",
"DomainException",
"(",
"Yii",
"::",
"t",
"(",
"'setrun... | Reset user password.
@param string $password
@return void | [
"Reset",
"user",
"password",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L186-L193 |
4,975 | setrun/setrun-component-user | src/entities/User.php | User.findByPasswordResetToken | public static function findByPasswordResetToken(string $token) : ?self
{
if (!static::isPasswordResetTokenValid($token)) {
return null;
}
return static::findOne([
'password_reset_token' => $token,
'status' => self::STATUS_ACTIVE,
]);
} | php | public static function findByPasswordResetToken(string $token) : ?self
{
if (!static::isPasswordResetTokenValid($token)) {
return null;
}
return static::findOne([
'password_reset_token' => $token,
'status' => self::STATUS_ACTIVE,
]);
} | [
"public",
"static",
"function",
"findByPasswordResetToken",
"(",
"string",
"$",
"token",
")",
":",
"?",
"self",
"{",
"if",
"(",
"!",
"static",
"::",
"isPasswordResetTokenValid",
"(",
"$",
"token",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"stati... | Finds user by password reset token.
@param string $token password reset token.
@return self | [
"Finds",
"user",
"by",
"password",
"reset",
"token",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L238-L247 |
4,976 | setrun/setrun-component-user | src/entities/User.php | User.setPassword | public function setPassword(string $password) : void
{
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
} | php | public function setPassword(string $password) : void
{
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
} | [
"public",
"function",
"setPassword",
"(",
"string",
"$",
"password",
")",
":",
"void",
"{",
"$",
"this",
"->",
"password_hash",
"=",
"Yii",
"::",
"$",
"app",
"->",
"security",
"->",
"generatePasswordHash",
"(",
"$",
"password",
")",
";",
"}"
] | Generates password hash from password and sets it to the model.
@param string $password
@return void | [
"Generates",
"password",
"hash",
"from",
"password",
"and",
"sets",
"it",
"to",
"the",
"model",
"."
] | 6aca4c62f099918032b66da1f94d7565694a0735 | https://github.com/setrun/setrun-component-user/blob/6aca4c62f099918032b66da1f94d7565694a0735/src/entities/User.php#L368-L371 |
4,977 | phossa2/libs | src/Phossa2/Query/Traits/Clause/JoinTrait.php | JoinTrait.realJoin | protected function realJoin(
/*# string */ $joinType,
$secondTable,
$onClause = '',
/*# bool */ $rawMode = false
) {
$alias = 0; // no alias
list($secondTable, $alias) = $this->fixJoinTable($secondTable);
if ($rawMode || '' === $onClause || $this->isRaw($onCl... | php | protected function realJoin(
/*# string */ $joinType,
$secondTable,
$onClause = '',
/*# bool */ $rawMode = false
) {
$alias = 0; // no alias
list($secondTable, $alias) = $this->fixJoinTable($secondTable);
if ($rawMode || '' === $onClause || $this->isRaw($onCl... | [
"protected",
"function",
"realJoin",
"(",
"/*# string */",
"$",
"joinType",
",",
"$",
"secondTable",
",",
"$",
"onClause",
"=",
"''",
",",
"/*# bool */",
"$",
"rawMode",
"=",
"false",
")",
"{",
"$",
"alias",
"=",
"0",
";",
"// no alias",
"list",
"(",
"$"... | The real join
@param string $joinType
@param string|string[]|SelectStatementInterface $secondTable
@param string|string[]|ExpressionInterface $onClause
@param bool $rawMode
@return $this
@access protected | [
"The",
"real",
"join"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Query/Traits/Clause/JoinTrait.php#L115-L132 |
4,978 | phossa2/libs | src/Phossa2/Query/Traits/Clause/JoinTrait.php | JoinTrait.fixJoinTable | protected function fixJoinTable($table)
{
if (is_array($table)) {
return $table;
} elseif (is_object($table) && $table instanceof StatementInterface) {
return [$table, uniqid()];
} else {
return [$table, 0]; // alias set 0
}
} | php | protected function fixJoinTable($table)
{
if (is_array($table)) {
return $table;
} elseif (is_object($table) && $table instanceof StatementInterface) {
return [$table, uniqid()];
} else {
return [$table, 0]; // alias set 0
}
} | [
"protected",
"function",
"fixJoinTable",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"table",
")",
")",
"{",
"return",
"$",
"table",
";",
"}",
"elseif",
"(",
"is_object",
"(",
"$",
"table",
")",
"&&",
"$",
"table",
"instanceof",
"St... | Fix join table
@param string|string[]|SelectStatementInterface $table
@return array [table, alias]
@access protected | [
"Fix",
"join",
"table"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Query/Traits/Clause/JoinTrait.php#L141-L150 |
4,979 | phossa2/libs | src/Phossa2/Query/Traits/Clause/JoinTrait.php | JoinTrait.fixOnClause | protected function fixOnClause($onClause)
{
if (is_string($onClause)) {
return [$onClause, '=', $onClause];
} elseif (is_array($onClause) && !isset($onClause[2])) {
return [$onClause[0], '=', $onClause[1]];
} else {
return $onClause;
}
} | php | protected function fixOnClause($onClause)
{
if (is_string($onClause)) {
return [$onClause, '=', $onClause];
} elseif (is_array($onClause) && !isset($onClause[2])) {
return [$onClause[0], '=', $onClause[1]];
} else {
return $onClause;
}
} | [
"protected",
"function",
"fixOnClause",
"(",
"$",
"onClause",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"onClause",
")",
")",
"{",
"return",
"[",
"$",
"onClause",
",",
"'='",
",",
"$",
"onClause",
"]",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",... | Fix 'ON' clause
@param mixed $onClause
@return array|ExpressionInterface
@access protected | [
"Fix",
"ON",
"clause"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Query/Traits/Clause/JoinTrait.php#L159-L168 |
4,980 | phossa2/libs | src/Phossa2/Query/Traits/Clause/JoinTrait.php | JoinTrait.buildJoinTable | protected function buildJoinTable(array $cls, array $settings)/*# : string */
{
$table = $cls[2];
$alias = $cls[3];
return $this->quoteItem($table, $settings) . $this->quoteAlias($alias, $settings);
} | php | protected function buildJoinTable(array $cls, array $settings)/*# : string */
{
$table = $cls[2];
$alias = $cls[3];
return $this->quoteItem($table, $settings) . $this->quoteAlias($alias, $settings);
} | [
"protected",
"function",
"buildJoinTable",
"(",
"array",
"$",
"cls",
",",
"array",
"$",
"settings",
")",
"/*# : string */",
"{",
"$",
"table",
"=",
"$",
"cls",
"[",
"2",
"]",
";",
"$",
"alias",
"=",
"$",
"cls",
"[",
"3",
"]",
";",
"return",
"$",
"t... | Build TABLE part
@param array $cls
@param array $settings
@return string
@access protected | [
"Build",
"TABLE",
"part"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Query/Traits/Clause/JoinTrait.php#L204-L209 |
4,981 | phossa2/libs | src/Phossa2/Query/Traits/Clause/JoinTrait.php | JoinTrait.buildJoinOn | protected function buildJoinOn(array $cls, array $settings)/*# : string */
{
$res = ['ON'];
$on = $cls[4];
if (is_string($on)) { // ON string
$res[] = $on;
} elseif (is_object($on)) { // ON is an object
$res[] = $this->quoteItem($on, $settings);
} else... | php | protected function buildJoinOn(array $cls, array $settings)/*# : string */
{
$res = ['ON'];
$on = $cls[4];
if (is_string($on)) { // ON string
$res[] = $on;
} elseif (is_object($on)) { // ON is an object
$res[] = $this->quoteItem($on, $settings);
} else... | [
"protected",
"function",
"buildJoinOn",
"(",
"array",
"$",
"cls",
",",
"array",
"$",
"settings",
")",
"/*# : string */",
"{",
"$",
"res",
"=",
"[",
"'ON'",
"]",
";",
"$",
"on",
"=",
"$",
"cls",
"[",
"4",
"]",
";",
"if",
"(",
"is_string",
"(",
"$",
... | Build ON part
@param array $cls
@param array $settings
@return string
@access protected | [
"Build",
"ON",
"part"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Query/Traits/Clause/JoinTrait.php#L219-L239 |
4,982 | phossa2/libs | src/Phossa2/Query/Traits/Clause/JoinTrait.php | JoinTrait.getFirstTableAlias | protected function getFirstTableAlias(
/*# string */ $left
)/*# : string */ {
if (false !== strpos($left, '.')) { // alias exists
return '';
} else { // prepend first table alias
$tables = &$this->getClause('TABLE');
reset($tables);
$alias = ke... | php | protected function getFirstTableAlias(
/*# string */ $left
)/*# : string */ {
if (false !== strpos($left, '.')) { // alias exists
return '';
} else { // prepend first table alias
$tables = &$this->getClause('TABLE');
reset($tables);
$alias = ke... | [
"protected",
"function",
"getFirstTableAlias",
"(",
"/*# string */",
"$",
"left",
")",
"/*# : string */",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"left",
",",
"'.'",
")",
")",
"{",
"// alias exists",
"return",
"''",
";",
"}",
"else",
"{",
"// p... | Get first table alias
@param string $left left part of eq
@return string
@access protected | [
"Get",
"first",
"table",
"alias"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Query/Traits/Clause/JoinTrait.php#L248-L259 |
4,983 | phossa2/libs | src/Phossa2/Query/Traits/Clause/JoinTrait.php | JoinTrait.getSecondTableAlias | protected function getSecondTableAlias(
array $cls,
/*# string */ $right
)/*# : string */ {
if (false !== strpos($right, '.')) {
return '';
} else {
$alias = $cls[3];
if (!is_string($alias)) {
$alias = $cls[2];
}
... | php | protected function getSecondTableAlias(
array $cls,
/*# string */ $right
)/*# : string */ {
if (false !== strpos($right, '.')) {
return '';
} else {
$alias = $cls[3];
if (!is_string($alias)) {
$alias = $cls[2];
}
... | [
"protected",
"function",
"getSecondTableAlias",
"(",
"array",
"$",
"cls",
",",
"/*# string */",
"$",
"right",
")",
"/*# : string */",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"right",
",",
"'.'",
")",
")",
"{",
"return",
"''",
";",
"}",
"else"... | Get second table alias
@param array $cls
@param string $right right part of eq
@return string
@access protected | [
"Get",
"second",
"table",
"alias"
] | 921e485c8cc29067f279da2cdd06f47a9bddd115 | https://github.com/phossa2/libs/blob/921e485c8cc29067f279da2cdd06f47a9bddd115/src/Phossa2/Query/Traits/Clause/JoinTrait.php#L269-L282 |
4,984 | synapsestudios/synapse-base | src/Synapse/User/RoleService.php | RoleService.addRoleForUser | public function addRoleForUser(UserEntity $user, $role)
{
$roles = $user->getRoles();
if (! in_array($role, $roles)) {
$this->userRolePivotMapper->addRoleForUser($user->getId(), $role);
array_push($roles, $role);
$user->setRoles($roles);
}
} | php | public function addRoleForUser(UserEntity $user, $role)
{
$roles = $user->getRoles();
if (! in_array($role, $roles)) {
$this->userRolePivotMapper->addRoleForUser($user->getId(), $role);
array_push($roles, $role);
$user->setRoles($roles);
}
} | [
"public",
"function",
"addRoleForUser",
"(",
"UserEntity",
"$",
"user",
",",
"$",
"role",
")",
"{",
"$",
"roles",
"=",
"$",
"user",
"->",
"getRoles",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"role",
",",
"$",
"roles",
")",
")",
"{",
"... | Add a role to a given user
@param UserEntity $user
@param string $role name of the role to add | [
"Add",
"a",
"role",
"to",
"a",
"given",
"user"
] | 60c830550491742a077ab063f924e2f0b63825da | https://github.com/synapsestudios/synapse-base/blob/60c830550491742a077ab063f924e2f0b63825da/src/Synapse/User/RoleService.php#L29-L40 |
4,985 | TeaLabs/uzi | src/Str.php | Str._format | public function _format($format, $placeholders = [], $default = '')
{
$placeholders = (array) $placeholders;
$matches = [];
if(!preg_match_all('/\{([^{}]*)\}+/u', $format, $matches))
return sprintf($format, ...array_values($placeholders));
ksort($placeholders, SORT_NATURAL);
$placeholders['__default__'] ... | php | public function _format($format, $placeholders = [], $default = '')
{
$placeholders = (array) $placeholders;
$matches = [];
if(!preg_match_all('/\{([^{}]*)\}+/u', $format, $matches))
return sprintf($format, ...array_values($placeholders));
ksort($placeholders, SORT_NATURAL);
$placeholders['__default__'] ... | [
"public",
"function",
"_format",
"(",
"$",
"format",
",",
"$",
"placeholders",
"=",
"[",
"]",
",",
"$",
"default",
"=",
"''",
")",
"{",
"$",
"placeholders",
"=",
"(",
"array",
")",
"$",
"placeholders",
";",
"$",
"matches",
"=",
"[",
"]",
";",
"if",... | Return a formatted string.
@param string $format
@param array $placeholders
@param mixed $default
@return string | [
"Return",
"a",
"formatted",
"string",
"."
] | af7858caefcf8b972e61cf323280b3a9816cd8cc | https://github.com/TeaLabs/uzi/blob/af7858caefcf8b972e61cf323280b3a9816cd8cc/src/Str.php#L119-L149 |
4,986 | TeaLabs/uzi | src/Str.php | Str.is | public function is($value, $wildcards = true, $caseSensitive = true)
{
if($this->str == $value)
return true;
return $this->regexPatternForIs($wildcards, $caseSensitive)->matches($value);
} | php | public function is($value, $wildcards = true, $caseSensitive = true)
{
if($this->str == $value)
return true;
return $this->regexPatternForIs($wildcards, $caseSensitive)->matches($value);
} | [
"public",
"function",
"is",
"(",
"$",
"value",
",",
"$",
"wildcards",
"=",
"true",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"str",
"==",
"$",
"value",
")",
"return",
"true",
";",
"return",
"$",
"this",
"->",
... | Determine if the string is a pattern matching the given value.
Asterisks (*) in the string are translated into zero-or-more regular expression
wildcards to make it convenient to check if the values starts with the given
pattern such as "library/*", making any string check convenient. This can be
disabled by setting wi... | [
"Determine",
"if",
"the",
"string",
"is",
"a",
"pattern",
"matching",
"the",
"given",
"value",
"."
] | af7858caefcf8b972e61cf323280b3a9816cd8cc | https://github.com/TeaLabs/uzi/blob/af7858caefcf8b972e61cf323280b3a9816cd8cc/src/Str.php#L209-L215 |
4,987 | TeaLabs/uzi | src/Str.php | Str.isAll | public function isAll($values, $wildcards = true, $caseSensitive = true)
{
$regex = $this->regexPatternForIs($wildcards, $caseSensitive);
return count($regex->filter(Helpers::toArray($values), true)) === 0;
} | php | public function isAll($values, $wildcards = true, $caseSensitive = true)
{
$regex = $this->regexPatternForIs($wildcards, $caseSensitive);
return count($regex->filter(Helpers::toArray($values), true)) === 0;
} | [
"public",
"function",
"isAll",
"(",
"$",
"values",
",",
"$",
"wildcards",
"=",
"true",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"regex",
"=",
"$",
"this",
"->",
"regexPatternForIs",
"(",
"$",
"wildcards",
",",
"$",
"caseSensitive",
")",
"... | Determine if the string is a pattern matching all the given values.
Asterisks (*) in the string are translated into zero-or-more regular expression
wildcards to make it convenient to check if the values starts with the given
pattern such as "library/*", making any string check convenient. This can be
disabled by setti... | [
"Determine",
"if",
"the",
"string",
"is",
"a",
"pattern",
"matching",
"all",
"the",
"given",
"values",
"."
] | af7858caefcf8b972e61cf323280b3a9816cd8cc | https://github.com/TeaLabs/uzi/blob/af7858caefcf8b972e61cf323280b3a9816cd8cc/src/Str.php#L235-L240 |
4,988 | TeaLabs/uzi | src/Str.php | Str.matches | public function matches($pattern, $caseSensitive = true)
{
$regex = $this->toRegex($pattern, ($caseSensitive ? "" : Modifiers::CASELESS ));
return $regex->matches($this);
} | php | public function matches($pattern, $caseSensitive = true)
{
$regex = $this->toRegex($pattern, ($caseSensitive ? "" : Modifiers::CASELESS ));
return $regex->matches($this);
} | [
"public",
"function",
"matches",
"(",
"$",
"pattern",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"regex",
"=",
"$",
"this",
"->",
"toRegex",
"(",
"$",
"pattern",
",",
"(",
"$",
"caseSensitive",
"?",
"\"\"",
":",
"Modifiers",
"::",
"CASELESS... | Determine if the string matches the given regex pattern.
Unless the case-less modifier is set on the pattern, the comparison is
case-sensitive. This can be changed by passing $caseSensitive to FALSE.
@param string|\Tea\Contracts\Regex\RegularExpression $pattern
@param bool ... | [
"Determine",
"if",
"the",
"string",
"matches",
"the",
"given",
"regex",
"pattern",
"."
] | af7858caefcf8b972e61cf323280b3a9816cd8cc | https://github.com/TeaLabs/uzi/blob/af7858caefcf8b972e61cf323280b3a9816cd8cc/src/Str.php#L279-L284 |
4,989 | TeaLabs/uzi | src/Str.php | Str.replace | public function replace($search, $replacement, &$count = 0)
{
return $this->getNew(str_replace($search, $replacement, $this->str, $count));
} | php | public function replace($search, $replacement, &$count = 0)
{
return $this->getNew(str_replace($search, $replacement, $this->str, $count));
} | [
"public",
"function",
"replace",
"(",
"$",
"search",
",",
"$",
"replacement",
",",
"&",
"$",
"count",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"getNew",
"(",
"str_replace",
"(",
"$",
"search",
",",
"$",
"replacement",
",",
"$",
"this",
"->",
... | Replaces occurrences of search in string by replacement.
@uses str_replace()
@param string|array|\Tea\Contracts\Regex\RegularExpression $search
@param string|array $replacement
@param int $limit
@param int &$count
@return \Tea\Uzi\Str | [
"Replaces",
"occurrences",
"of",
"search",
"in",
"string",
"by",
"replacement",
"."
] | af7858caefcf8b972e61cf323280b3a9816cd8cc | https://github.com/TeaLabs/uzi/blob/af7858caefcf8b972e61cf323280b3a9816cd8cc/src/Str.php#L312-L315 |
4,990 | TeaLabs/uzi | src/Str.php | Str.regexPatternForStrip | protected function regexPatternForStrip($substring, $limit)
{
$pattern = $substring ? Regex::quote($substring) : '\s';
return '(?:'.'(?:'.$pattern.')'. ($limit > 0 ? '{1,'.$limit.'}' : '+').')';
} | php | protected function regexPatternForStrip($substring, $limit)
{
$pattern = $substring ? Regex::quote($substring) : '\s';
return '(?:'.'(?:'.$pattern.')'. ($limit > 0 ? '{1,'.$limit.'}' : '+').')';
} | [
"protected",
"function",
"regexPatternForStrip",
"(",
"$",
"substring",
",",
"$",
"limit",
")",
"{",
"$",
"pattern",
"=",
"$",
"substring",
"?",
"Regex",
"::",
"quote",
"(",
"$",
"substring",
")",
":",
"'\\s'",
";",
"return",
"'(?:'",
".",
"'(?:'",
".",
... | Get the appropriate regex pattern for stripping a string | [
"Get",
"the",
"appropriate",
"regex",
"pattern",
"for",
"stripping",
"a",
"string"
] | af7858caefcf8b972e61cf323280b3a9816cd8cc | https://github.com/TeaLabs/uzi/blob/af7858caefcf8b972e61cf323280b3a9816cd8cc/src/Str.php#L895-L899 |
4,991 | mrcoco/phalms-core | user/controllers/UserControlController.php | UserControlController.confirmEmailAction | public function confirmEmailAction()
{
$code = $this->dispatcher->getParam('code');
$confirmation = EmailConfirmations::findFirstByCode($code);
if (!$confirmation) {
return $this->dispatcher->forward([
'controller' => 'index',
'action' => 'index'... | php | public function confirmEmailAction()
{
$code = $this->dispatcher->getParam('code');
$confirmation = EmailConfirmations::findFirstByCode($code);
if (!$confirmation) {
return $this->dispatcher->forward([
'controller' => 'index',
'action' => 'index'... | [
"public",
"function",
"confirmEmailAction",
"(",
")",
"{",
"$",
"code",
"=",
"$",
"this",
"->",
"dispatcher",
"->",
"getParam",
"(",
"'code'",
")",
";",
"$",
"confirmation",
"=",
"EmailConfirmations",
"::",
"findFirstByCode",
"(",
"$",
"code",
")",
";",
"i... | Confirms an e-mail, if the user must change thier password then changes it | [
"Confirms",
"an",
"e",
"-",
"mail",
"if",
"the",
"user",
"must",
"change",
"thier",
"password",
"then",
"changes",
"it"
] | 23486c3e75077896e708f0d2e257cde280a79ad4 | https://github.com/mrcoco/phalms-core/blob/23486c3e75077896e708f0d2e257cde280a79ad4/user/controllers/UserControlController.php#L29-L92 |
4,992 | sulazix/SeanceBundle | Controller/ContainerController.php | ContainerController.getContainersAction | public function getContainersAction() {
$em = $this->getDoctrine()->getManager();
// TODO : Check user access !
$containers = $em->getRepository('InterneSeanceBundle:Container')->findAll();
$view = $this->view($containers, Response::HTTP_OK);
return $this->handleView($view);
... | php | public function getContainersAction() {
$em = $this->getDoctrine()->getManager();
// TODO : Check user access !
$containers = $em->getRepository('InterneSeanceBundle:Container')->findAll();
$view = $this->view($containers, Response::HTTP_OK);
return $this->handleView($view);
... | [
"public",
"function",
"getContainersAction",
"(",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"// TODO : Check user access !",
"$",
"containers",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'Inter... | Gets the list of all Containers. | [
"Gets",
"the",
"list",
"of",
"all",
"Containers",
"."
] | 6818f261dc5ca13a8f9664a46fad9bba273559c1 | https://github.com/sulazix/SeanceBundle/blob/6818f261dc5ca13a8f9664a46fad9bba273559c1/Controller/ContainerController.php#L30-L40 |
4,993 | lucifurious/kisma | src/Kisma/Core/Utility/EventManager.php | EventManager.discoverListeners | public static function discoverListeners( $object, $listeners = null, $pattern = self::LISTENER_DISCOVERY_PATTERN )
{
// Allow for passed in listeners
$_listeners = $listeners ?: static::_discoverObjectListeners( $object, $pattern );
// And wire them up...
if ( empty( $_listeners ) ... | php | public static function discoverListeners( $object, $listeners = null, $pattern = self::LISTENER_DISCOVERY_PATTERN )
{
// Allow for passed in listeners
$_listeners = $listeners ?: static::_discoverObjectListeners( $object, $pattern );
// And wire them up...
if ( empty( $_listeners ) ... | [
"public",
"static",
"function",
"discoverListeners",
"(",
"$",
"object",
",",
"$",
"listeners",
"=",
"null",
",",
"$",
"pattern",
"=",
"self",
"::",
"LISTENER_DISCOVERY_PATTERN",
")",
"{",
"//\tAllow for passed in listeners",
"$",
"_listeners",
"=",
"$",
"listener... | Wires up any event handlers automatically
@param \Kisma\Core\Interfaces\SubscriberLike|string $object Object or class discovery target
@param array|null $listeners Array of 'event.name' => callback/closure pairs
@param string $pattern
@return ... | [
"Wires",
"up",
"any",
"event",
"handlers",
"automatically"
] | 4cc9954249da4e535b52f154e728935f07e648ae | https://github.com/lucifurious/kisma/blob/4cc9954249da4e535b52f154e728935f07e648ae/src/Kisma/Core/Utility/EventManager.php#L99-L117 |
4,994 | lucifurious/kisma | src/Kisma/Core/Utility/EventManager.php | EventManager._discoverObjectListeners | public static function _discoverObjectListeners( $object, $pattern = self::LISTENER_DISCOVERY_PATTERN, $rediscover = false )
{
static $_discovered = array();
$_listeners = array();
$_objectId = spl_object_hash( is_string( $object ) ? '_class.' . $object : $object );
if ( false ===... | php | public static function _discoverObjectListeners( $object, $pattern = self::LISTENER_DISCOVERY_PATTERN, $rediscover = false )
{
static $_discovered = array();
$_listeners = array();
$_objectId = spl_object_hash( is_string( $object ) ? '_class.' . $object : $object );
if ( false ===... | [
"public",
"static",
"function",
"_discoverObjectListeners",
"(",
"$",
"object",
",",
"$",
"pattern",
"=",
"self",
"::",
"LISTENER_DISCOVERY_PATTERN",
",",
"$",
"rediscover",
"=",
"false",
")",
"{",
"static",
"$",
"_discovered",
"=",
"array",
"(",
")",
";",
"... | Builds a hash of events and handlers that are present in this object based on the event handler signature.
This merely builds the hash, nothing is done with it.
@param \Kisma\Core\Interfaces\SubscriberLike|string $object The object or class to scan
@param string $pattern Th... | [
"Builds",
"a",
"hash",
"of",
"events",
"and",
"handlers",
"that",
"are",
"present",
"in",
"this",
"object",
"based",
"on",
"the",
"event",
"handler",
"signature",
".",
"This",
"merely",
"builds",
"the",
"hash",
"nothing",
"is",
"done",
"with",
"it",
"."
] | 4cc9954249da4e535b52f154e728935f07e648ae | https://github.com/lucifurious/kisma/blob/4cc9954249da4e535b52f154e728935f07e648ae/src/Kisma/Core/Utility/EventManager.php#L131-L184 |
4,995 | gourmet/common | View/Helper/NavigationHelper.php | NavigationHelper.render | public function render($paths, $navAttrs = array(), $listAttrs = array()) {
if (false !== $navAttrs) {
$navAttrs = array_merge(array('tag' => 'nav'), $navAttrs);
$navTag = $navAttrs['tag'];
unset($navAttrs['tag']);
}
$listAttrs = array_merge(array('tag' => 'ul'), $listAttrs);
$this->_tag = $listAttrs[... | php | public function render($paths, $navAttrs = array(), $listAttrs = array()) {
if (false !== $navAttrs) {
$navAttrs = array_merge(array('tag' => 'nav'), $navAttrs);
$navTag = $navAttrs['tag'];
unset($navAttrs['tag']);
}
$listAttrs = array_merge(array('tag' => 'ul'), $listAttrs);
$this->_tag = $listAttrs[... | [
"public",
"function",
"render",
"(",
"$",
"paths",
",",
"$",
"navAttrs",
"=",
"array",
"(",
")",
",",
"$",
"listAttrs",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"navAttrs",
")",
"{",
"$",
"navAttrs",
"=",
"array_merge",
"("... | Render navigation.
@param string $path Optional. The navigation's item(s) `Hash` path.
@param array $navAttrs Optional. Navigation's HTML attributes.
@param array $listAttrs Optional. List's HTML attributes.
@return string | [
"Render",
"navigation",
"."
] | 53ad4e919c51606dc81f2c716267d01ee768ade5 | https://github.com/gourmet/common/blob/53ad4e919c51606dc81f2c716267d01ee768ade5/View/Helper/NavigationHelper.php#L61-L102 |
4,996 | budkit/budkit-framework | src/Budkit/Parameter/Repository/File.php | File.load | public function load($environment, $namespace)
{
//evironments = /config/<environment>/namespace.ini[section].key
$file = $this->directory;
$file .= !empty($environment) ? $environment . DS : DS;
$file .= $namespace;
$file .= $this->extension;
//Check that we have ... | php | public function load($environment, $namespace)
{
//evironments = /config/<environment>/namespace.ini[section].key
$file = $this->directory;
$file .= !empty($environment) ? $environment . DS : DS;
$file .= $namespace;
$file .= $this->extension;
//Check that we have ... | [
"public",
"function",
"load",
"(",
"$",
"environment",
",",
"$",
"namespace",
")",
"{",
"//evironments = /config/<environment>/namespace.ini[section].key",
"$",
"file",
"=",
"$",
"this",
"->",
"directory",
";",
"$",
"file",
".=",
"!",
"empty",
"(",
"$",
"environ... | Loads config from a specific namespace
@param $env
@param string $group
@param string $namespace | [
"Loads",
"config",
"from",
"a",
"specific",
"namespace"
] | 0635061815fe07a8c63f9514b845d199b3c0d485 | https://github.com/budkit/budkit-framework/blob/0635061815fe07a8c63f9514b845d199b3c0d485/src/Budkit/Parameter/Repository/File.php#L38-L59 |
4,997 | ciims/cii | widgets/comments/CiiMSComments.php | CiiMSComments.init | public function init()
{
$asset = Yii::app()->assetManager->publish(YiiBase::getPathOfAlias('cii.assets.dist'), true, -1, YII_DEBUG);
// Register CSS and Scripts
Yii::app()->clientScript->registerScriptFile($asset. (YII_DEBUG ? '/ciimscomments.js' : '/ciimscomments.min.js'), CClientScript::POS_END);
Yii... | php | public function init()
{
$asset = Yii::app()->assetManager->publish(YiiBase::getPathOfAlias('cii.assets.dist'), true, -1, YII_DEBUG);
// Register CSS and Scripts
Yii::app()->clientScript->registerScriptFile($asset. (YII_DEBUG ? '/ciimscomments.js' : '/ciimscomments.min.js'), CClientScript::POS_END);
Yii... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"asset",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"assetManager",
"->",
"publish",
"(",
"YiiBase",
"::",
"getPathOfAlias",
"(",
"'cii.assets.dist'",
")",
",",
"true",
",",
"-",
"1",
",",
"YII_DEBUG",
")... | Init function to start the rendering process | [
"Init",
"function",
"to",
"start",
"the",
"rendering",
"process"
] | cc8550b9a3a6a0bf0214554679de8743d50dc9ef | https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/comments/CiiMSComments.php#L14-L26 |
4,998 | ciims/cii | widgets/comments/CiiMSComments.php | CiiMSComments.renderCommentBox | private function renderCommentBox()
{
$link = CHtml::link('0', Yii::app()->createAbsoluteUrl($this->content['slug']) . '#comment', array('data-ciimscomments-identifier' => $this->content['id']));
$id = $this->content['id'];
Yii::app()->clientScript->registerScript('CiiMSComments', "
$(document... | php | private function renderCommentBox()
{
$link = CHtml::link('0', Yii::app()->createAbsoluteUrl($this->content['slug']) . '#comment', array('data-ciimscomments-identifier' => $this->content['id']));
$id = $this->content['id'];
Yii::app()->clientScript->registerScript('CiiMSComments', "
$(document... | [
"private",
"function",
"renderCommentBox",
"(",
")",
"{",
"$",
"link",
"=",
"CHtml",
"::",
"link",
"(",
"'0'",
",",
"Yii",
"::",
"app",
"(",
")",
"->",
"createAbsoluteUrl",
"(",
"$",
"this",
"->",
"content",
"[",
"'slug'",
"]",
")",
".",
"'#comment'",
... | Renders the Disqus Comment Box on the page | [
"Renders",
"the",
"Disqus",
"Comment",
"Box",
"on",
"the",
"page"
] | cc8550b9a3a6a0bf0214554679de8743d50dc9ef | https://github.com/ciims/cii/blob/cc8550b9a3a6a0bf0214554679de8743d50dc9ef/widgets/comments/CiiMSComments.php#L31-L49 |
4,999 | sopinet/ApiHelperBundle | Service/ApiHelper.php | ApiHelper.handleForm | public function handleForm(Request $request,Form $form){
// The JSON PUT data will include all attributes in the entity, even
// those that are not updateable by the user and are not in the form.
// We need to remove these extra fields or we will get a
// "This form should not contain ex... | php | public function handleForm(Request $request,Form $form){
// The JSON PUT data will include all attributes in the entity, even
// those that are not updateable by the user and are not in the form.
// We need to remove these extra fields or we will get a
// "This form should not contain ex... | [
"public",
"function",
"handleForm",
"(",
"Request",
"$",
"request",
",",
"Form",
"$",
"form",
")",
"{",
"// The JSON PUT data will include all attributes in the entity, even",
"// those that are not updateable by the user and are not in the form.",
"// We need to remove these extra fie... | Se hace un submit de los campos de un request que esten definidos en un formulario
@param Request $request
@param Form $form
@return Form | [
"Se",
"hace",
"un",
"submit",
"de",
"los",
"campos",
"de",
"un",
"request",
"que",
"esten",
"definidos",
"en",
"un",
"formulario"
] | 878dd397445f5289afaa8ee1b1752dc111b557de | https://github.com/sopinet/ApiHelperBundle/blob/878dd397445f5289afaa8ee1b1752dc111b557de/Service/ApiHelper.php#L104-L115 |
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.