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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,400 | Kajna/K-Core | Core/Http/Request.php | Request.isAjax | public function isAjax()
{
if ($this->headers->get('HTTP_X_REQUESTED_WITH') !== null
&& strtolower($this->headers->get('HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest'
) {
return true;
}
return false;
} | php | public function isAjax()
{
if ($this->headers->get('HTTP_X_REQUESTED_WITH') !== null
&& strtolower($this->headers->get('HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest'
) {
return true;
}
return false;
} | [
"public",
"function",
"isAjax",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"headers",
"->",
"get",
"(",
"'HTTP_X_REQUESTED_WITH'",
")",
"!==",
"null",
"&&",
"strtolower",
"(",
"$",
"this",
"->",
"headers",
"->",
"get",
"(",
"'HTTP_X_REQUESTED_WITH'",
")"... | Check if it is AJAX request.
@return bool | [
"Check",
"if",
"it",
"is",
"AJAX",
"request",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Http/Request.php#L226-L234 |
35,401 | hail-framework/framework | src/Filesystem/Adapter/Zip.php | Zip.reopenArchive | protected function reopenArchive()
{
$path = $this->archive->filename;
$this->archive->close();
$this->openArchive($path);
} | php | protected function reopenArchive()
{
$path = $this->archive->filename;
$this->archive->close();
$this->openArchive($path);
} | [
"protected",
"function",
"reopenArchive",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"archive",
"->",
"filename",
";",
"$",
"this",
"->",
"archive",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"openArchive",
"(",
"$",
"path",
")",
";",
... | Re-open an archive to ensure persistence. | [
"Re",
"-",
"open",
"an",
"archive",
"to",
"ensure",
"persistence",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Filesystem/Adapter/Zip.php#L50-L55 |
35,402 | hail-framework/framework | src/Filesystem/Adapter/Zip.php | Zip.normalizeObject | protected function normalizeObject(array $object)
{
if (\substr($object['name'], -1) === '/') {
return [
'path' => $this->removePathPrefix(\trim($object['name'], '/')),
'type' => 'dir',
];
}
$result = ['type' => 'file'];
$normalised = Util::map($object, static::$resultMap);
$normalised['path']... | php | protected function normalizeObject(array $object)
{
if (\substr($object['name'], -1) === '/') {
return [
'path' => $this->removePathPrefix(\trim($object['name'], '/')),
'type' => 'dir',
];
}
$result = ['type' => 'file'];
$normalised = Util::map($object, static::$resultMap);
$normalised['path']... | [
"protected",
"function",
"normalizeObject",
"(",
"array",
"$",
"object",
")",
"{",
"if",
"(",
"\\",
"substr",
"(",
"$",
"object",
"[",
"'name'",
"]",
",",
"-",
"1",
")",
"===",
"'/'",
")",
"{",
"return",
"[",
"'path'",
"=>",
"$",
"this",
"->",
"rem... | Normalize a zip response array.
@param array $object
@return array | [
"Normalize",
"a",
"zip",
"response",
"array",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Filesystem/Adapter/Zip.php#L264-L278 |
35,403 | hail-framework/framework | src/I18n/Gettext/Extractors/Jed.php | Jed.extract | public static function extract(array $content, Translations $translations)
{
$messages = \current($content);
$headers = $messages[''] ?? null;
unset($messages['']);
if (!empty($headers['domain'])) {
$translations->setDomain($headers['domain']);
}
if (!em... | php | public static function extract(array $content, Translations $translations)
{
$messages = \current($content);
$headers = $messages[''] ?? null;
unset($messages['']);
if (!empty($headers['domain'])) {
$translations->setDomain($headers['domain']);
}
if (!em... | [
"public",
"static",
"function",
"extract",
"(",
"array",
"$",
"content",
",",
"Translations",
"$",
"translations",
")",
"{",
"$",
"messages",
"=",
"\\",
"current",
"(",
"$",
"content",
")",
";",
"$",
"headers",
"=",
"$",
"messages",
"[",
"''",
"]",
"??... | Handle an array of translations and append to the Translations instance.
@param array $content
@param Translations $translations | [
"Handle",
"an",
"array",
"of",
"translations",
"and",
"append",
"to",
"the",
"Translations",
"instance",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Extractors/Jed.php#L26-L54 |
35,404 | hail-framework/framework | src/Event/EventManager.php | EventManager.addSubscriber | public function addSubscriber(EventSubscriberInterface $subscriber)
{
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
if (\is_string($params)) {
$this->attach($eventName, [$subscriber, $params]);
} elseif (\is_array($params)) {
if (\is_string($params[0])) {
$this->attach($e... | php | public function addSubscriber(EventSubscriberInterface $subscriber)
{
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
if (\is_string($params)) {
$this->attach($eventName, [$subscriber, $params]);
} elseif (\is_array($params)) {
if (\is_string($params[0])) {
$this->attach($e... | [
"public",
"function",
"addSubscriber",
"(",
"EventSubscriberInterface",
"$",
"subscriber",
")",
"{",
"foreach",
"(",
"$",
"subscriber",
"->",
"getSubscribedEvents",
"(",
")",
"as",
"$",
"eventName",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"\\",
"is_string",
... | Adds an event subscriber.
The subscriber is asked for all the events he is
interested in and added as a listener for these events.
@param EventSubscriberInterface $subscriber The subscriber
@return $this | [
"Adds",
"an",
"event",
"subscriber",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Event/EventManager.php#L195-L212 |
35,405 | hail-framework/framework | src/Event/EventManager.php | EventManager.removeSubscriber | public function removeSubscriber(EventSubscriberInterface $subscriber)
{
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
if (\is_array($params) && \is_array($params[0])) {
foreach ($params as $listener) {
$this->detach($eventName, [$subscriber, $listener[0]]);
}
} else {
... | php | public function removeSubscriber(EventSubscriberInterface $subscriber)
{
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
if (\is_array($params) && \is_array($params[0])) {
foreach ($params as $listener) {
$this->detach($eventName, [$subscriber, $listener[0]]);
}
} else {
... | [
"public",
"function",
"removeSubscriber",
"(",
"EventSubscriberInterface",
"$",
"subscriber",
")",
"{",
"foreach",
"(",
"$",
"subscriber",
"->",
"getSubscribedEvents",
"(",
")",
"as",
"$",
"eventName",
"=>",
"$",
"params",
")",
"{",
"if",
"(",
"\\",
"is_array"... | Removes an event subscriber.
@param EventSubscriberInterface $subscriber The subscriber
@return $this | [
"Removes",
"an",
"event",
"subscriber",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Event/EventManager.php#L221-L234 |
35,406 | hiqdev/hipanel-module-server | src/models/Server.php | Server.canFullRefuse | public function canFullRefuse()
{
if (!is_numeric($this->last_expires)) {
return null; // In case server is not sold
}
return (time() - Yii::$app->formatter->asTimestamp($this->last_expires)) / 3600 / 24 < 5;
} | php | public function canFullRefuse()
{
if (!is_numeric($this->last_expires)) {
return null; // In case server is not sold
}
return (time() - Yii::$app->formatter->asTimestamp($this->last_expires)) / 3600 / 24 < 5;
} | [
"public",
"function",
"canFullRefuse",
"(",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"this",
"->",
"last_expires",
")",
")",
"{",
"return",
"null",
";",
"// In case server is not sold",
"}",
"return",
"(",
"time",
"(",
")",
"-",
"Yii",
"::",
"$"... | During 5 days after the last expiration client is able to refuse server with full refund.
Method checks, whether 5 days passed.
@return bool | [
"During",
"5",
"days",
"after",
"the",
"last",
"expiration",
"client",
"is",
"able",
"to",
"refuse",
"server",
"with",
"full",
"refund",
".",
"Method",
"checks",
"whether",
"5",
"days",
"passed",
"."
] | e40c3601952cf1fd420ebb97093ee17a33ff3207 | https://github.com/hiqdev/hipanel-module-server/blob/e40c3601952cf1fd420ebb97093ee17a33ff3207/src/models/Server.php#L240-L247 |
35,407 | hail-framework/framework | src/Http/Message/MessageTrait.php | MessageTrait.validateProtocolVersion | private function validateProtocolVersion($version): void
{
if (empty($version)) {
throw new \InvalidArgumentException(
'HTTP protocol version can not be empty'
);
}
if (!\is_string($version)) {
throw new \InvalidArgumentException(sprintf(
... | php | private function validateProtocolVersion($version): void
{
if (empty($version)) {
throw new \InvalidArgumentException(
'HTTP protocol version can not be empty'
);
}
if (!\is_string($version)) {
throw new \InvalidArgumentException(sprintf(
... | [
"private",
"function",
"validateProtocolVersion",
"(",
"$",
"version",
")",
":",
"void",
"{",
"if",
"(",
"empty",
"(",
"$",
"version",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'HTTP protocol version can not be empty'",
")",
";",
"}"... | Validate the HTTP protocol version
@param string $version
@throws \InvalidArgumentException on invalid HTTP protocol version | [
"Validate",
"the",
"HTTP",
"protocol",
"version"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Message/MessageTrait.php#L193-L215 |
35,408 | hail-framework/framework | src/I18n/Gettext/Extractors/Po.php | Po.fixMultiLines | private static function fixMultiLines($line, array $lines, &$i)
{
for ($j = $i, $t = \count($lines); $j < $t; ++$j) {
if (\substr($line, -1, 1) == '"'
&& isset($lines[$j + 1])
&& \substr(\trim($lines[$j + 1]), 0, 1) == '"'
) {
$line = \... | php | private static function fixMultiLines($line, array $lines, &$i)
{
for ($j = $i, $t = \count($lines); $j < $t; ++$j) {
if (\substr($line, -1, 1) == '"'
&& isset($lines[$j + 1])
&& \substr(\trim($lines[$j + 1]), 0, 1) == '"'
) {
$line = \... | [
"private",
"static",
"function",
"fixMultiLines",
"(",
"$",
"line",
",",
"array",
"$",
"lines",
",",
"&",
"$",
"i",
")",
"{",
"for",
"(",
"$",
"j",
"=",
"$",
"i",
",",
"$",
"t",
"=",
"\\",
"count",
"(",
"$",
"lines",
")",
";",
"$",
"j",
"<",
... | Gets one string from multiline strings.
@param string $line
@param array $lines
@param int &$i
@return string | [
"Gets",
"one",
"string",
"from",
"multiline",
"strings",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Extractors/Po.php#L162-L177 |
35,409 | mirko-pagliai/php-tools | src/Entity.php | Entity.set | public function set($property, $value = null)
{
if (is_string($property) && $value != '') {
$property = [$property => $value];
}
foreach ($property as $name => $value) {
$this->properties[$name] = $value;
}
return $this;
} | php | public function set($property, $value = null)
{
if (is_string($property) && $value != '') {
$property = [$property => $value];
}
foreach ($property as $name => $value) {
$this->properties[$name] = $value;
}
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"property",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"property",
")",
"&&",
"$",
"value",
"!=",
"''",
")",
"{",
"$",
"property",
"=",
"[",
"$",
"property",
"=>",
"$",
"valu... | Sets a single property inside this entity
@param string|array $property The name of property to set or a list of
properties with their respective values
@param mixed $value The value to set to the property
@return $this
@uses $properties | [
"Sets",
"a",
"single",
"property",
"inside",
"this",
"entity"
] | 46003b05490de4b570b46c6377f1e09139ffe43b | https://github.com/mirko-pagliai/php-tools/blob/46003b05490de4b570b46c6377f1e09139ffe43b/src/Entity.php#L140-L151 |
35,410 | hail-framework/framework | src/Database/Model.php | Model.dirty | public function dirty(array $dirty = [])
{
$this->dirty = $dirty;
$this->data = \array_merge($this->data, $dirty);
return $this;
} | php | public function dirty(array $dirty = [])
{
$this->dirty = $dirty;
$this->data = \array_merge($this->data, $dirty);
return $this;
} | [
"public",
"function",
"dirty",
"(",
"array",
"$",
"dirty",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"dirty",
"=",
"$",
"dirty",
";",
"$",
"this",
"->",
"data",
"=",
"\\",
"array_merge",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"dirty",
")",
... | function to SET or RESET the dirty data.
@param array $dirty The dirty data will be set, or empty array to reset the dirty data.
@return self return $this, can using chain method calls. | [
"function",
"to",
"SET",
"or",
"RESET",
"the",
"dirty",
"data",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Model.php#L165-L171 |
35,411 | hail-framework/framework | src/Database/Model.php | Model.get | public function get($id = null)
{
if ($id !== null) {
$this->eq($this->primary, $id);
}
$this->defaultTable();
DB::get($this->sql, PDO::FETCH_INTO, $this->reset());
return $this->dirty();
} | php | public function get($id = null)
{
if ($id !== null) {
$this->eq($this->primary, $id);
}
$this->defaultTable();
DB::get($this->sql, PDO::FETCH_INTO, $this->reset());
return $this->dirty();
} | [
"public",
"function",
"get",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"eq",
"(",
"$",
"this",
"->",
"primary",
",",
"$",
"id",
")",
";",
"}",
"$",
"this",
"->",
"defaultTable",
"... | function to find one record and assign in to current object.
@param int $id If call this function using this param, will find record by using this id. If not set, just find
the first record in database.
@return bool|self if find record, assign in to current object and return it, other wise return "false". | [
"function",
"to",
"find",
"one",
"record",
"and",
"assign",
"in",
"to",
"current",
"object",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Model.php#L188-L198 |
35,412 | hail-framework/framework | src/Database/Model.php | Model.all | public function all()
{
$this->defaultTable();
$sql = $this->sql;
$this->reset();
return DB::select($sql, PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, static::class);
} | php | public function all()
{
$this->defaultTable();
$sql = $this->sql;
$this->reset();
return DB::select($sql, PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, static::class);
} | [
"public",
"function",
"all",
"(",
")",
"{",
"$",
"this",
"->",
"defaultTable",
"(",
")",
";",
"$",
"sql",
"=",
"$",
"this",
"->",
"sql",
";",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"return",
"DB",
"::",
"select",
"(",
"$",
"sql",
",",
"PDO"... | function to find all records in database.
@return array return array of ORM | [
"function",
"to",
"find",
"all",
"records",
"in",
"database",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Model.php#L205-L212 |
35,413 | hail-framework/framework | src/Database/Model.php | Model.delete | public function delete()
{
$this->defaultTable();
$this->eq($this->primary, $this->__get($this->primary));
return DB::delete($this->sql);
} | php | public function delete()
{
$this->defaultTable();
$this->eq($this->primary, $this->__get($this->primary));
return DB::delete($this->sql);
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"defaultTable",
"(",
")",
";",
"$",
"this",
"->",
"eq",
"(",
"$",
"this",
"->",
"primary",
",",
"$",
"this",
"->",
"__get",
"(",
"$",
"this",
"->",
"primary",
")",
")",
";",
"retur... | function to delete current record in database.
@return bool | [
"function",
"to",
"delete",
"current",
"record",
"in",
"database",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Model.php#L219-L225 |
35,414 | hail-framework/framework | src/Database/Model.php | Model.update | public function update()
{
if ($this->dirty === []) {
return true;
}
$this->defaultTable();
$this->sql['SET'] = $this->dirty;
$this->eq($this->primary, $this->__get($this->primary));
if (DB::update($this->sql)) {
return $this->dirty()->reset(... | php | public function update()
{
if ($this->dirty === []) {
return true;
}
$this->defaultTable();
$this->sql['SET'] = $this->dirty;
$this->eq($this->primary, $this->__get($this->primary));
if (DB::update($this->sql)) {
return $this->dirty()->reset(... | [
"public",
"function",
"update",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dirty",
"===",
"[",
"]",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"defaultTable",
"(",
")",
";",
"$",
"this",
"->",
"sql",
"[",
"'SET'",
"]",
"=",
"$"... | function to build update SQL, and update current record in database, just write the dirty data into database.
@return bool|self if update success return current object, other wise return false. | [
"function",
"to",
"build",
"update",
"SQL",
"and",
"update",
"current",
"record",
"in",
"database",
"just",
"write",
"the",
"dirty",
"data",
"into",
"database",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Model.php#L232-L247 |
35,415 | hail-framework/framework | src/Database/Model.php | Model.insert | public function insert()
{
if (\count($this->dirty) === 0) {
return true;
}
$this->defaultTable();
$this->sql['VALUES'] = $this->dirty;
if ($return = DB::insert($this->sql)) {
$this->__set($this->primary, $return);
return $this->dirty()-... | php | public function insert()
{
if (\count($this->dirty) === 0) {
return true;
}
$this->defaultTable();
$this->sql['VALUES'] = $this->dirty;
if ($return = DB::insert($this->sql)) {
$this->__set($this->primary, $return);
return $this->dirty()-... | [
"public",
"function",
"insert",
"(",
")",
"{",
"if",
"(",
"\\",
"count",
"(",
"$",
"this",
"->",
"dirty",
")",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"defaultTable",
"(",
")",
";",
"$",
"this",
"->",
"sql",
"[",
"'... | function to build insert SQL, and insert current record into database.
@return bool|self if insert success return current object, other wise return false. | [
"function",
"to",
"build",
"insert",
"SQL",
"and",
"insert",
"current",
"record",
"into",
"database",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Model.php#L254-L270 |
35,416 | hail-framework/framework | src/Database/Model.php | Model.addWhere | public function addWhere($field, $value, $op = 'AND')
{
if (!isset($this->sql['WHERE'])) {
$this->sql['WHERE'] = [];
}
if (isset($this->sql['WHERE'][$op])) {
$this->sql['WHERE'][$op][$field] = $value;
} else {
$this->sql['WHERE'][$field] = $value;... | php | public function addWhere($field, $value, $op = 'AND')
{
if (!isset($this->sql['WHERE'])) {
$this->sql['WHERE'] = [];
}
if (isset($this->sql['WHERE'][$op])) {
$this->sql['WHERE'][$op][$field] = $value;
} else {
$this->sql['WHERE'][$field] = $value;... | [
"public",
"function",
"addWhere",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"op",
"=",
"'AND'",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"sql",
"[",
"'WHERE'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"sql",
"[",
"'WHERE'"... | helper function to add condition into WHERE.
create the SQL Expressions.
@param string $field The field name, the source of Expressions
@param mixed $value the target of the Expressions
@param string $op the operator to concat this Expressions into WHERE or SET statment. | [
"helper",
"function",
"to",
"add",
"condition",
"into",
"WHERE",
".",
"create",
"the",
"SQL",
"Expressions",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Model.php#L383-L395 |
35,417 | DoSomething/gateway | src/Northstar.php | Northstar.getUser | public function getUser($type, $id)
{
$response = $this->get('v1/users/'.$type.'/'.$id);
if (is_null($response)) {
return null;
}
return new NorthstarUser($response['data']);
} | php | public function getUser($type, $id)
{
$response = $this->get('v1/users/'.$type.'/'.$id);
if (is_null($response)) {
return null;
}
return new NorthstarUser($response['data']);
} | [
"public",
"function",
"getUser",
"(",
"$",
"type",
",",
"$",
"id",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"get",
"(",
"'v1/users/'",
".",
"$",
"type",
".",
"'/'",
".",
"$",
"id",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"response",
... | Send a GET request to return a user with that id.
@param string $type - 'id', 'email', 'mobile'
@param string $id - ID, email, id, phone
@return NorthstarUser | [
"Send",
"a",
"GET",
"request",
"to",
"return",
"a",
"user",
"with",
"that",
"id",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Northstar.php#L57-L66 |
35,418 | DoSomething/gateway | src/Northstar.php | Northstar.updateUser | public function updateUser($id, $input)
{
$response = $this->put('v1/users/_id/'.$id, $input);
return new NorthstarUser($response['data']);
} | php | public function updateUser($id, $input)
{
$response = $this->put('v1/users/_id/'.$id, $input);
return new NorthstarUser($response['data']);
} | [
"public",
"function",
"updateUser",
"(",
"$",
"id",
",",
"$",
"input",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"put",
"(",
"'v1/users/_id/'",
".",
"$",
"id",
",",
"$",
"input",
")",
";",
"return",
"new",
"NorthstarUser",
"(",
"$",
"respons... | Send a PUT request to update a user in Northstar.
@param string $id - Northstar User ID
@param array $input - Fields to update in profile
@return mixed | [
"Send",
"a",
"PUT",
"request",
"to",
"update",
"a",
"user",
"in",
"Northstar",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Northstar.php#L89-L94 |
35,419 | DoSomething/gateway | src/Northstar.php | Northstar.mergeUsers | public function mergeUsers($id, $duplicateId, $pretend = false)
{
$pretendParam = $pretend ? '?pretend=true' : null;
$response = $this->post('v1/users/'.$id.'/merge'.$pretendParam, ['id' => $duplicateId]);
return new NorthstarUser($response['data']);
} | php | public function mergeUsers($id, $duplicateId, $pretend = false)
{
$pretendParam = $pretend ? '?pretend=true' : null;
$response = $this->post('v1/users/'.$id.'/merge'.$pretendParam, ['id' => $duplicateId]);
return new NorthstarUser($response['data']);
} | [
"public",
"function",
"mergeUsers",
"(",
"$",
"id",
",",
"$",
"duplicateId",
",",
"$",
"pretend",
"=",
"false",
")",
"{",
"$",
"pretendParam",
"=",
"$",
"pretend",
"?",
"'?pretend=true'",
":",
"null",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"post... | Send a POST request to merge two users in Northstar.
@param string $id - Northstar User ID.
@param string $duplicateId - Northstar User ID of duplicate user.
@param bool $pretend - Whether to persist the merge or not.
@return mixed | [
"Send",
"a",
"POST",
"request",
"to",
"merge",
"two",
"users",
"in",
"Northstar",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Northstar.php#L118-L125 |
35,420 | DoSomething/gateway | src/Northstar.php | Northstar.updateClient | public function updateClient($client_id, $input)
{
$response = $this->put('v2/clients/'.$client_id, $input);
return new NorthstarClient($response['data']);
} | php | public function updateClient($client_id, $input)
{
$response = $this->put('v2/clients/'.$client_id, $input);
return new NorthstarClient($response['data']);
} | [
"public",
"function",
"updateClient",
"(",
"$",
"client_id",
",",
"$",
"input",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"put",
"(",
"'v2/clients/'",
".",
"$",
"client_id",
",",
"$",
"input",
")",
";",
"return",
"new",
"NorthstarClient",
"(",
... | Send a POST request to generate new keys to northstar
Requires an `admin` scoped API key.
@param string $client_id - API key
@param array $input - key values
@return NorthstarClient | [
"Send",
"a",
"POST",
"request",
"to",
"generate",
"new",
"keys",
"to",
"northstar",
"Requires",
"an",
"admin",
"scoped",
"API",
"key",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Northstar.php#L189-L194 |
35,421 | hail-framework/framework | src/Http/Client/AbstractCurl.php | AbstractCurl.createHandle | protected function createHandle()
{
$curl = $this->handles ? \array_pop($this->handles) : \curl_init();
if (false === $curl) {
throw new ClientException('Unable to create a new cURL handle');
}
return $curl;
} | php | protected function createHandle()
{
$curl = $this->handles ? \array_pop($this->handles) : \curl_init();
if (false === $curl) {
throw new ClientException('Unable to create a new cURL handle');
}
return $curl;
} | [
"protected",
"function",
"createHandle",
"(",
")",
"{",
"$",
"curl",
"=",
"$",
"this",
"->",
"handles",
"?",
"\\",
"array_pop",
"(",
"$",
"this",
"->",
"handles",
")",
":",
"\\",
"curl_init",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"curl",
"... | Creates a new cURL resource.
@return resource A new cURL resource
@throws ClientException If unable to create a cURL resource | [
"Creates",
"a",
"new",
"cURL",
"resource",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Client/AbstractCurl.php#L38-L46 |
35,422 | hail-framework/framework | src/Http/Client/AbstractCurl.php | AbstractCurl.prepare | protected function prepare($curl, RequestInterface $request, array $options): ResponseInterface
{
if (\defined('CURLOPT_PROTOCOLS')) {
\curl_setopt($curl, \CURLOPT_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS);
\curl_setopt($curl, \CURLOPT_REDIR_PROTOCOLS, \CURLPROTO_HTTP | \CUR... | php | protected function prepare($curl, RequestInterface $request, array $options): ResponseInterface
{
if (\defined('CURLOPT_PROTOCOLS')) {
\curl_setopt($curl, \CURLOPT_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS);
\curl_setopt($curl, \CURLOPT_REDIR_PROTOCOLS, \CURLPROTO_HTTP | \CUR... | [
"protected",
"function",
"prepare",
"(",
"$",
"curl",
",",
"RequestInterface",
"$",
"request",
",",
"array",
"$",
"options",
")",
":",
"ResponseInterface",
"{",
"if",
"(",
"\\",
"defined",
"(",
"'CURLOPT_PROTOCOLS'",
")",
")",
"{",
"\\",
"curl_setopt",
"(",
... | Prepares a cURL resource to send a request.
@param resource $curl
@param RequestInterface $request
@param array $options
@return ResponseInterface | [
"Prepares",
"a",
"cURL",
"resource",
"to",
"send",
"a",
"request",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Client/AbstractCurl.php#L83-L121 |
35,423 | hiqdev/hipanel-module-server | src/controllers/ServerController.php | ServerController.getVNCInfo | public function getVNCInfo($model, $enable = false)
{
if ($enable) {
try {
$vnc = Server::perform('enable-VNC', ['id' => $model->id]);
$vnc['endTime'] = time() + 28800;
Yii::$app->cache->set([__METHOD__, $model->id, $model], $vnc, 28800);
... | php | public function getVNCInfo($model, $enable = false)
{
if ($enable) {
try {
$vnc = Server::perform('enable-VNC', ['id' => $model->id]);
$vnc['endTime'] = time() + 28800;
Yii::$app->cache->set([__METHOD__, $model->id, $model], $vnc, 28800);
... | [
"public",
"function",
"getVNCInfo",
"(",
"$",
"model",
",",
"$",
"enable",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"enable",
")",
"{",
"try",
"{",
"$",
"vnc",
"=",
"Server",
"::",
"perform",
"(",
"'enable-VNC'",
",",
"[",
"'id'",
"=>",
"$",
"model"... | Gets info of VNC on the server.
@param Server $model
@param bool $enable
@throws ResponseErrorException
@return array | [
"Gets",
"info",
"of",
"VNC",
"on",
"the",
"server",
"."
] | e40c3601952cf1fd420ebb97093ee17a33ff3207 | https://github.com/hiqdev/hipanel-module-server/blob/e40c3601952cf1fd420ebb97093ee17a33ff3207/src/controllers/ServerController.php#L829-L854 |
35,424 | hiqdev/hipanel-module-server | src/controllers/ServerController.php | ServerController.getOsimages | protected function getOsimages(Server $model = null)
{
if ($model !== null) {
$type = $model->type;
} else {
$type = null;
}
$models = ServerHelper::getOsimages($type);
if ($models === null) {
throw new NotFoundHttpException('The requeste... | php | protected function getOsimages(Server $model = null)
{
if ($model !== null) {
$type = $model->type;
} else {
$type = null;
}
$models = ServerHelper::getOsimages($type);
if ($models === null) {
throw new NotFoundHttpException('The requeste... | [
"protected",
"function",
"getOsimages",
"(",
"Server",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"model",
"!==",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"model",
"->",
"type",
";",
"}",
"else",
"{",
"$",
"type",
"=",
"null",
";",
"}",... | Gets OS images.
@param Server $model
@throws NotFoundHttpException
@return array | [
"Gets",
"OS",
"images",
"."
] | e40c3601952cf1fd420ebb97093ee17a33ff3207 | https://github.com/hiqdev/hipanel-module-server/blob/e40c3601952cf1fd420ebb97093ee17a33ff3207/src/controllers/ServerController.php#L887-L902 |
35,425 | hail-framework/framework | src/Http/Cookie.php | Cookie.getExpiresTime | private function getExpiresTime($time): int
{
if ($time instanceof \DateTimeInterface) {
return (int) $time->format('U');
}
if (\is_numeric($time)) {
// average year in seconds
if ($time <= 31557600) {
$time += \time();
}
... | php | private function getExpiresTime($time): int
{
if ($time instanceof \DateTimeInterface) {
return (int) $time->format('U');
}
if (\is_numeric($time)) {
// average year in seconds
if ($time <= 31557600) {
$time += \time();
}
... | [
"private",
"function",
"getExpiresTime",
"(",
"$",
"time",
")",
":",
"int",
"{",
"if",
"(",
"$",
"time",
"instanceof",
"\\",
"DateTimeInterface",
")",
"{",
"return",
"(",
"int",
")",
"$",
"time",
"->",
"format",
"(",
"'U'",
")",
";",
"}",
"if",
"(",
... | Convert to unix timestamp
@param string|int|\DateTimeInterface $time
@return int | [
"Convert",
"to",
"unix",
"timestamp"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Cookie.php#L188-L204 |
35,426 | hail-framework/framework | src/Container/Container.php | Container.get | public function get($name)
{
switch (true) {
case isset($this->active[$name]):
return $this->values[$name];
case isset($this->values[$name]):
break;
case \array_key_exists($name, $this->values):
break;
case is... | php | public function get($name)
{
switch (true) {
case isset($this->active[$name]):
return $this->values[$name];
case isset($this->values[$name]):
break;
case \array_key_exists($name, $this->values):
break;
case is... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"isset",
"(",
"$",
"this",
"->",
"active",
"[",
"$",
"name",
"]",
")",
":",
"return",
"$",
"this",
"->",
"values",
"[",
"$",
"name",
"]",
";",
"ca... | Resolve the registered component with the given name.
@param string $name component name
@return mixed
@throws NotFoundException
@throws InvalidArgumentException | [
"Resolve",
"the",
"registered",
"component",
"with",
"the",
"given",
"name",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Container.php#L90-L138 |
35,427 | hail-framework/framework | src/Container/Container.php | Container.has | public function has($name): bool
{
return isset($this->values[$name]) ||
isset($this->factory[$name]) ||
isset($this->alias[$name]) ||
\array_key_exists($name, $this->values);
} | php | public function has($name): bool
{
return isset($this->values[$name]) ||
isset($this->factory[$name]) ||
isset($this->alias[$name]) ||
\array_key_exists($name, $this->values);
} | [
"public",
"function",
"has",
"(",
"$",
"name",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"values",
"[",
"$",
"name",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"factory",
"[",
"$",
"name",
"]",
")",
"||",
"isset",
... | Check for the existence of a component with a given name.
@param string $name component name
@return bool true, if a component with the given name has been defined | [
"Check",
"for",
"the",
"existence",
"of",
"a",
"component",
"with",
"a",
"given",
"name",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Container.php#L148-L154 |
35,428 | hail-framework/framework | src/Container/Container.php | Container.inject | public function inject(string $name, $value): void
{
if ($this->has($name)) {
throw new InvalidArgumentException("Attempted override of existing component: {$name}");
}
$this->values[$name] = $value;
$this->active[$name] = true;
} | php | public function inject(string $name, $value): void
{
if ($this->has($name)) {
throw new InvalidArgumentException("Attempted override of existing component: {$name}");
}
$this->values[$name] = $value;
$this->active[$name] = true;
} | [
"public",
"function",
"inject",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Attempted override of existing c... | Dynamically inject a component into this Container.
Enables implementation of "auto-wiring" patterns, where missing components are injected
at run-time into a live `Container` instance.
You should always test with {@see has()} prior to injecting a component - attempting to
override an existing component will generate... | [
"Dynamically",
"inject",
"a",
"component",
"into",
"this",
"Container",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Container.php#L211-L219 |
35,429 | hail-framework/framework | src/Container/Container.php | Container.register | public function register(string $name, $define = null, array $map = []): void
{
if (isset($this->active[$name])) {
throw new InvalidArgumentException("Attempted override of existing component: {$name}");
}
if ($define instanceof \Closure) {
$func = $define;
}... | php | public function register(string $name, $define = null, array $map = []): void
{
if (isset($this->active[$name])) {
throw new InvalidArgumentException("Attempted override of existing component: {$name}");
}
if ($define instanceof \Closure) {
$func = $define;
}... | [
"public",
"function",
"register",
"(",
"string",
"$",
"name",
",",
"$",
"define",
"=",
"null",
",",
"array",
"$",
"map",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"active",
"[",
"$",
"name",
"]",
")",
")"... | Register a component for dependency injection.
There are numerous valid ways to register components.
* `register(Foo::class)` registers a component by it's class-name, and will try to
automatically resolve all of it's constructor arguments.
* `register(Foo::class, ['bar'])` registers a component by it's class-name, ... | [
"Register",
"a",
"component",
"for",
"dependency",
"injection",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Container.php#L294-L323 |
35,430 | hail-framework/framework | src/Container/Container.php | Container.set | public function set(string $name, $value): void
{
if (isset($this->active[$name])) {
throw new InvalidArgumentException("Attempted override of existing component: {$name}");
}
$this->values[$name] = $value;
unset(
$this->factory[$name],
$this->fa... | php | public function set(string $name, $value): void
{
if (isset($this->active[$name])) {
throw new InvalidArgumentException("Attempted override of existing component: {$name}");
}
$this->values[$name] = $value;
unset(
$this->factory[$name],
$this->fa... | [
"public",
"function",
"set",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"active",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Attempt... | Directly inject a component into the container - use this to register components that
have already been created for some reason; for example, the Composer ClassLoader.
@param string $name component name
@param mixed $value
@return void
@throws InvalidArgumentException | [
"Directly",
"inject",
"a",
"component",
"into",
"the",
"container",
"-",
"use",
"this",
"to",
"register",
"components",
"that",
"have",
"already",
"been",
"created",
"for",
"some",
"reason",
";",
"for",
"example",
"the",
"Composer",
"ClassLoader",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Container.php#L336-L351 |
35,431 | hail-framework/framework | src/Container/Container.php | Container.alias | public function alias(string $alias, string $abstract): void
{
if (\array_key_exists($alias, $this->values) || isset($this->factory[$alias])) {
throw new InvalidArgumentException("Already defined in container: $alias");
}
if ($alias === $abstract) {
throw new Invalid... | php | public function alias(string $alias, string $abstract): void
{
if (\array_key_exists($alias, $this->values) || isset($this->factory[$alias])) {
throw new InvalidArgumentException("Already defined in container: $alias");
}
if ($alias === $abstract) {
throw new Invalid... | [
"public",
"function",
"alias",
"(",
"string",
"$",
"alias",
",",
"string",
"$",
"abstract",
")",
":",
"void",
"{",
"if",
"(",
"\\",
"array_key_exists",
"(",
"$",
"alias",
",",
"$",
"this",
"->",
"values",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
... | Register a component as an alias of another registered component.
@param string $alias new component name
@param string $abstract referenced existing component name
@throws InvalidArgumentException | [
"Register",
"a",
"component",
"as",
"an",
"alias",
"of",
"another",
"registered",
"component",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Container.php#L361-L378 |
35,432 | hail-framework/framework | src/Container/Container.php | Container.ref | public function ref(string $name)
{
if (isset($this->active[$name])) {
return $this->values[$name];
}
return function () use ($name) {
return $this->get($name);
};
} | php | public function ref(string $name)
{
if (isset($this->active[$name])) {
return $this->values[$name];
}
return function () use ($name) {
return $this->get($name);
};
} | [
"public",
"function",
"ref",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"active",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"values",
"[",
"$",
"name",
"]",
";",
"}",
"return",
"fu... | Creates a boxed reference to a component with a given name.
You can use this in conjunction with `register()` to provide a component reference
without expanding that reference until first use - for example:
$container->register(UserRepo::class, [$container->ref('cache')]);
This will reference the "cache" component a... | [
"Creates",
"a",
"boxed",
"reference",
"to",
"a",
"component",
"with",
"a",
"given",
"name",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Container.php#L514-L523 |
35,433 | hail-framework/framework | src/Filesystem/Adapter/Polyfill/StreamedReadingTrait.php | StreamedReadingTrait.readStream | public function readStream($path)
{
if ( ! $data = $this->read($path)) {
return false;
}
$stream = \fopen('php://temp', 'w+b');
\fwrite($stream, $data['contents']);
\rewind($stream);
$data['stream'] = $stream;
unset($data['contents']);
re... | php | public function readStream($path)
{
if ( ! $data = $this->read($path)) {
return false;
}
$stream = \fopen('php://temp', 'w+b');
\fwrite($stream, $data['contents']);
\rewind($stream);
$data['stream'] = $stream;
unset($data['contents']);
re... | [
"public",
"function",
"readStream",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"data",
"=",
"$",
"this",
"->",
"read",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"stream",
"=",
"\\",
"fopen",
"(",
"'php://temp'",
","... | Reads a file as a stream.
@param string $path
@return array|false
@see \Hail\Filesystem\ReadInterface::readStream() | [
"Reads",
"a",
"file",
"as",
"a",
"stream",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Filesystem/Adapter/Polyfill/StreamedReadingTrait.php#L19-L32 |
35,434 | hail-framework/framework | src/Filesystem/Adapter/AbstractFtpAdapter.php | AbstractFtpAdapter.sortListing | protected function sortListing(array $result)
{
$compare = function ($one, $two) {
return \strnatcmp($one['path'], $two['path']);
};
\usort($result, $compare);
return $result;
} | php | protected function sortListing(array $result)
{
$compare = function ($one, $two) {
return \strnatcmp($one['path'], $two['path']);
};
\usort($result, $compare);
return $result;
} | [
"protected",
"function",
"sortListing",
"(",
"array",
"$",
"result",
")",
"{",
"$",
"compare",
"=",
"function",
"(",
"$",
"one",
",",
"$",
"two",
")",
"{",
"return",
"\\",
"strnatcmp",
"(",
"$",
"one",
"[",
"'path'",
"]",
",",
"$",
"two",
"[",
"'pa... | Sort a directory listing.
@param array $result
@return array sorted listing | [
"Sort",
"a",
"directory",
"listing",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Filesystem/Adapter/AbstractFtpAdapter.php#L324-L333 |
35,435 | jormin/aliyun | sdk/aliyun-mns-php-sdk/AliyunMNS/Http/HttpClient.php | HttpClient.parseEndpoint | private function parseEndpoint()
{
$pieces = explode("//", $this->endpoint);
$host = end($pieces);
$host_pieces = explode(".", $host);
$this->accountId = $host_pieces[0];
$region_pieces = explode("-internal", $host_pieces[2]);
$this->region = $region_pieces[0];
} | php | private function parseEndpoint()
{
$pieces = explode("//", $this->endpoint);
$host = end($pieces);
$host_pieces = explode(".", $host);
$this->accountId = $host_pieces[0];
$region_pieces = explode("-internal", $host_pieces[2]);
$this->region = $region_pieces[0];
} | [
"private",
"function",
"parseEndpoint",
"(",
")",
"{",
"$",
"pieces",
"=",
"explode",
"(",
"\"//\"",
",",
"$",
"this",
"->",
"endpoint",
")",
";",
"$",
"host",
"=",
"end",
"(",
"$",
"pieces",
")",
";",
"$",
"host_pieces",
"=",
"explode",
"(",
"\".\""... | This function is for SDK internal use | [
"This",
"function",
"is",
"for",
"SDK",
"internal",
"use"
] | c0eb19f5c265dba1f463af1db7347acdcfddb240 | https://github.com/jormin/aliyun/blob/c0eb19f5c265dba1f463af1db7347acdcfddb240/sdk/aliyun-mns-php-sdk/AliyunMNS/Http/HttpClient.php#L64-L73 |
35,436 | Kajna/K-Core | Core/Auth/Auth.php | Auth.changePassword | public function changePassword($username, $newPass)
{
$password = $this->hasher->HashPassword($newPass);
return $this
->conn
->prepare(sprintf("UPDATE %s SET user_pass=:newPass WHERE user_name = :username", $this->table))
->execute(['newPass' => $password, 'userna... | php | public function changePassword($username, $newPass)
{
$password = $this->hasher->HashPassword($newPass);
return $this
->conn
->prepare(sprintf("UPDATE %s SET user_pass=:newPass WHERE user_name = :username", $this->table))
->execute(['newPass' => $password, 'userna... | [
"public",
"function",
"changePassword",
"(",
"$",
"username",
",",
"$",
"newPass",
")",
"{",
"$",
"password",
"=",
"$",
"this",
"->",
"hasher",
"->",
"HashPassword",
"(",
"$",
"newPass",
")",
";",
"return",
"$",
"this",
"->",
"conn",
"->",
"prepare",
"... | Change user password.
@param string $username
@param string $newPass
@return bool | [
"Change",
"user",
"password",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Auth/Auth.php#L112-L119 |
35,437 | Kajna/K-Core | Core/Auth/Auth.php | Auth.login | public function login($username, $password)
{
$stmt = $this->conn->prepare(
sprintf("SELECT user_id, user_name, user_pass
FROM %s WHERE user_name = :name LIMIT 1", $this->table));
$stmt->execute(['name' => $username]);
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($... | php | public function login($username, $password)
{
$stmt = $this->conn->prepare(
sprintf("SELECT user_id, user_name, user_pass
FROM %s WHERE user_name = :name LIMIT 1", $this->table));
$stmt->execute(['name' => $username]);
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
if ($... | [
"public",
"function",
"login",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"conn",
"->",
"prepare",
"(",
"sprintf",
"(",
"\"SELECT user_id, user_name, user_pass\n\t\t\tFROM %s WHERE user_name = :name LIMIT 1\"",
",",
"$... | Try to login user with passed parameters.
@param string $username
@param string $password
@return bool | [
"Try",
"to",
"login",
"user",
"with",
"passed",
"parameters",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Auth/Auth.php#L143-L168 |
35,438 | Kajna/K-Core | Core/Auth/Auth.php | Auth.isLogged | public function isLogged()
{
$user = $this->session->get('user');
if (isset($user['logged_' . $this->table])
&& $user['logged_' . $this->table] === true
) {
return true;
}
return false;
} | php | public function isLogged()
{
$user = $this->session->get('user');
if (isset($user['logged_' . $this->table])
&& $user['logged_' . $this->table] === true
) {
return true;
}
return false;
} | [
"public",
"function",
"isLogged",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"'user'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"user",
"[",
"'logged_'",
".",
"$",
"this",
"->",
"table",
"]",
")",
"&&",
"$",
... | Check if there is logged user.
@return bool | [
"Check",
"if",
"there",
"is",
"logged",
"user",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Auth/Auth.php#L213-L222 |
35,439 | hail-framework/framework | src/I18n/Gettext/Translator.php | Translator.addTranslations | protected function addTranslations(array $translations)
{
$domain = $translations['domain'] ?? '';
//Set the first domain loaded as default domain
if ($this->domain === null) {
$this->domain = $domain;
}
if (isset($this->dictionary[$domain])) {
$this... | php | protected function addTranslations(array $translations)
{
$domain = $translations['domain'] ?? '';
//Set the first domain loaded as default domain
if ($this->domain === null) {
$this->domain = $domain;
}
if (isset($this->dictionary[$domain])) {
$this... | [
"protected",
"function",
"addTranslations",
"(",
"array",
"$",
"translations",
")",
"{",
"$",
"domain",
"=",
"$",
"translations",
"[",
"'domain'",
"]",
"??",
"''",
";",
"//Set the first domain loaded as default domain",
"if",
"(",
"$",
"this",
"->",
"domain",
"=... | Set new translations to the dictionary.
@param array $translations | [
"Set",
"new",
"translations",
"to",
"the",
"dictionary",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Translator.php#L179-L206 |
35,440 | hail-framework/framework | src/I18n/Gettext/Translator.php | Translator.fixTerseIfs | private static function fixTerseIfs($code, $inner = false)
{
/*
* (?P<expression>[^?]+) Capture everything up to ? as 'expression'
* \? ?
* (?P<success>[^:]+) Capture everything up to : as 'success'
* : :
* (?P<fa... | php | private static function fixTerseIfs($code, $inner = false)
{
/*
* (?P<expression>[^?]+) Capture everything up to ? as 'expression'
* \? ?
* (?P<success>[^:]+) Capture everything up to : as 'success'
* : :
* (?P<fa... | [
"private",
"static",
"function",
"fixTerseIfs",
"(",
"$",
"code",
",",
"$",
"inner",
"=",
"false",
")",
"{",
"/*\n * (?P<expression>[^?]+) Capture everything up to ? as 'expression'\n * \\? ?\n * (?P<success>[^:]+) Capture everything up... | This function will recursively wrap failure states in brackets if they contain a nested terse if.
This because PHP can not handle nested terse if's unless they are wrapped in brackets.
This code probably only works for the gettext plural decision codes.
return ($n==1 ? 0 : $n%10>=2 && $n%10<=4 && ($n%100<10 || $n%10... | [
"This",
"function",
"will",
"recursively",
"wrap",
"failure",
"states",
"in",
"brackets",
"if",
"they",
"contain",
"a",
"nested",
"terse",
"if",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Translator.php#L267-L297 |
35,441 | Kajna/K-Core | Core/Core/Controller.php | Controller.render | protected function render($view, array $data = [])
{
// Extract variables.
extract($data);
// Start buffering.
ob_start();
// Load view file (root location is declared in viewPath var).
include $this->container->get('config')['viewsPath'] . '/' . $view . '.php';
... | php | protected function render($view, array $data = [])
{
// Extract variables.
extract($data);
// Start buffering.
ob_start();
// Load view file (root location is declared in viewPath var).
include $this->container->get('config')['viewsPath'] . '/' . $view . '.php';
... | [
"protected",
"function",
"render",
"(",
"$",
"view",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"// Extract variables.",
"extract",
"(",
"$",
"data",
")",
";",
"// Start buffering.",
"ob_start",
"(",
")",
";",
"// Load view file (root location is declar... | Render output for display.
@param string $view
@param array $data
@return ResponseInterface | [
"Render",
"output",
"for",
"display",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Core/Controller.php#L30-L49 |
35,442 | Kajna/K-Core | Core/Core/Controller.php | Controller.buffer | protected function buffer($view, array $data = [])
{
// Extract variables.
extract($data);
// Start buffering.
ob_start();
// Load view file (root location is declared in viewsPath var).
include $this->container->get('config')['viewsPath'] . '/' . $view . '.php';
... | php | protected function buffer($view, array $data = [])
{
// Extract variables.
extract($data);
// Start buffering.
ob_start();
// Load view file (root location is declared in viewsPath var).
include $this->container->get('config')['viewsPath'] . '/' . $view . '.php';
... | [
"protected",
"function",
"buffer",
"(",
"$",
"view",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"// Extract variables.",
"extract",
"(",
"$",
"data",
")",
";",
"// Start buffering.",
"ob_start",
"(",
")",
";",
"// Load view file (root location is declar... | Buffer output and return it as string.
@param string $view
@param array $data
@return string | [
"Buffer",
"output",
"and",
"return",
"it",
"as",
"string",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Core/Controller.php#L58-L73 |
35,443 | hail-framework/framework | src/Debugger/Logger.php | Logger.log | public function log($level, $message, array $context = []): void
{
if (!isset($this->logLevels[$level])) {
$level = LogLevel::DEBUG;
}
$this->exceptionFile = null;
if ($this->logLevels[$level] < $this->level) {
return;
}
$exceptionFile = nul... | php | public function log($level, $message, array $context = []): void
{
if (!isset($this->logLevels[$level])) {
$level = LogLevel::DEBUG;
}
$this->exceptionFile = null;
if ($this->logLevels[$level] < $this->level) {
return;
}
$exceptionFile = nul... | [
"public",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
":",
"void",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"logLevels",
"[",
"$",
"level",
"]",
")",
")",
"{",
"$",
... | Logs message or exception to file and sends email notification.
@param mixed $level
@param string $message
@param array $context
@return void | [
"Logs",
"message",
"or",
"exception",
"to",
"file",
"and",
"sends",
"email",
"notification",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/Logger.php#L99-L140 |
35,444 | hail-framework/framework | src/Debugger/Logger.php | Logger.logException | protected function logException(\Throwable $exception, string $file = null): string
{
$file = $file ?: $this->getExceptionFile($exception);
$bs = $this->blueScreen ?: new BlueScreen;
$bs->renderToFile($exception, $file);
return $file;
} | php | protected function logException(\Throwable $exception, string $file = null): string
{
$file = $file ?: $this->getExceptionFile($exception);
$bs = $this->blueScreen ?: new BlueScreen;
$bs->renderToFile($exception, $file);
return $file;
} | [
"protected",
"function",
"logException",
"(",
"\\",
"Throwable",
"$",
"exception",
",",
"string",
"$",
"file",
"=",
"null",
")",
":",
"string",
"{",
"$",
"file",
"=",
"$",
"file",
"?",
":",
"$",
"this",
"->",
"getExceptionFile",
"(",
"$",
"exception",
... | Logs exception to the file if file doesn't exist.
@param \Throwable $exception
@param string $file
@return string logged error filename | [
"Logs",
"exception",
"to",
"the",
"file",
"if",
"file",
"doesn",
"t",
"exist",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/Logger.php#L208-L215 |
35,445 | hail-framework/framework | src/Debugger/Logger.php | Logger.defaultMailer | public function defaultMailer($message, string $email): void
{
$host = \preg_replace('#[^\w.-]+#', '', $_SERVER['HTTP_HOST'] ?? php_uname('n'));
$parts = \str_replace(
["\r\n", "\n"],
["\n", PHP_EOL],
[
'headers' => \implode("\n", [
... | php | public function defaultMailer($message, string $email): void
{
$host = \preg_replace('#[^\w.-]+#', '', $_SERVER['HTTP_HOST'] ?? php_uname('n'));
$parts = \str_replace(
["\r\n", "\n"],
["\n", PHP_EOL],
[
'headers' => \implode("\n", [
... | [
"public",
"function",
"defaultMailer",
"(",
"$",
"message",
",",
"string",
"$",
"email",
")",
":",
"void",
"{",
"$",
"host",
"=",
"\\",
"preg_replace",
"(",
"'#[^\\w.-]+#'",
",",
"''",
",",
"$",
"_SERVER",
"[",
"'HTTP_HOST'",
"]",
"??",
"php_uname",
"(",... | Default mailer.
@param mixed
@param string
@return void
@internal | [
"Default",
"mailer",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/Logger.php#L247-L266 |
35,446 | Kajna/K-Core | Core/Routing/Router.php | Router.execute | public function execute($uri, $requestMethod)
{
foreach ($this->routes as $route) {
if (true === $route->matches($uri, $requestMethod)) {
return $route;
}
}
return null;
} | php | public function execute($uri, $requestMethod)
{
foreach ($this->routes as $route) {
if (true === $route->matches($uri, $requestMethod)) {
return $route;
}
}
return null;
} | [
"public",
"function",
"execute",
"(",
"$",
"uri",
",",
"$",
"requestMethod",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"route",
"->",
"matches",
"(",
"$",
"uri",
",",
"$",
... | Check routes and returns matching one if found,
otherwise return null.
@var string $uri
@var string $requestMethod
@return null|RouteInterface | [
"Check",
"routes",
"and",
"returns",
"matching",
"one",
"if",
"found",
"otherwise",
"return",
"null",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Routing/Router.php#L48-L56 |
35,447 | Kajna/K-Core | Core/Routing/Router.php | Router.put | public function put($url, $class, $function)
{
$route = new Route($this->urlPrefix . $url, 'PUT', self::$CONTROLLERS_ROOT . $class, $function);
$this->addRoute($route);
return $route;
} | php | public function put($url, $class, $function)
{
$route = new Route($this->urlPrefix . $url, 'PUT', self::$CONTROLLERS_ROOT . $class, $function);
$this->addRoute($route);
return $route;
} | [
"public",
"function",
"put",
"(",
"$",
"url",
",",
"$",
"class",
",",
"$",
"function",
")",
"{",
"$",
"route",
"=",
"new",
"Route",
"(",
"$",
"this",
"->",
"urlPrefix",
".",
"$",
"url",
",",
"'PUT'",
",",
"self",
"::",
"$",
"CONTROLLERS_ROOT",
".",... | Add a route object to the router accepting PUT request method.
@param string $url
@param string $class
@param string $function
@return RouteInterface | [
"Add",
"a",
"route",
"object",
"to",
"the",
"router",
"accepting",
"PUT",
"request",
"method",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Routing/Router.php#L96-L101 |
35,448 | Kajna/K-Core | Core/Routing/Router.php | Router.addRoute | public function addRoute(RouteInterface $route)
{
foreach ($this->middlewares as $m) {
$route->addMiddleware($m);
}
$this->routes[] = $route;
return $this;
} | php | public function addRoute(RouteInterface $route)
{
foreach ($this->middlewares as $m) {
$route->addMiddleware($m);
}
$this->routes[] = $route;
return $this;
} | [
"public",
"function",
"addRoute",
"(",
"RouteInterface",
"$",
"route",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"middlewares",
"as",
"$",
"m",
")",
"{",
"$",
"route",
"->",
"addMiddleware",
"(",
"$",
"m",
")",
";",
"}",
"$",
"this",
"->",
"routes... | Add custom route object to routes array.
@param RouteInterface $route
@return self | [
"Add",
"custom",
"route",
"object",
"to",
"routes",
"array",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Routing/Router.php#L174-L181 |
35,449 | hiqdev/hipanel-module-server | src/widgets/OSFormatter.php | OSFormatter.generateInfoCircle | public function generateInfoCircle()
{
Modal::begin([
'toggleButton' => [
'class' => 'fa fa-info text-info os-info-popover',
'label' => '',
],
'header' => Html::tag('h4', $this->osimage->getFullOsName()),
'size' =>... | php | public function generateInfoCircle()
{
Modal::begin([
'toggleButton' => [
'class' => 'fa fa-info text-info os-info-popover',
'label' => '',
],
'header' => Html::tag('h4', $this->osimage->getFullOsName()),
'size' =>... | [
"public",
"function",
"generateInfoCircle",
"(",
")",
"{",
"Modal",
"::",
"begin",
"(",
"[",
"'toggleButton'",
"=>",
"[",
"'class'",
"=>",
"'fa fa-info text-info os-info-popover'",
",",
"'label'",
"=>",
"''",
",",
"]",
",",
"'header'",
"=>",
"Html",
"::",
"tag... | Renders info-circle with modal popup. | [
"Renders",
"info",
"-",
"circle",
"with",
"modal",
"popup",
"."
] | e40c3601952cf1fd420ebb97093ee17a33ff3207 | https://github.com/hiqdev/hipanel-module-server/blob/e40c3601952cf1fd420ebb97093ee17a33ff3207/src/widgets/OSFormatter.php#L85-L99 |
35,450 | DoSomething/gateway | src/Laravel/HasNorthstarToken.php | HasNorthstarToken.getOAuthToken | public function getOAuthToken()
{
// If any of the required fields are empty, return null.
$hasAnEmptyField = empty($this->northstar_id) || empty($this->access_token) ||
empty($this->access_token_expiration) || empty($this->refresh_token) || empty($this->role);
if ($hasAnEmptyFi... | php | public function getOAuthToken()
{
// If any of the required fields are empty, return null.
$hasAnEmptyField = empty($this->northstar_id) || empty($this->access_token) ||
empty($this->access_token_expiration) || empty($this->refresh_token) || empty($this->role);
if ($hasAnEmptyFi... | [
"public",
"function",
"getOAuthToken",
"(",
")",
"{",
"// If any of the required fields are empty, return null.",
"$",
"hasAnEmptyField",
"=",
"empty",
"(",
"$",
"this",
"->",
"northstar_id",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"access_token",
")",
"||",
"... | Get the access token for the user.
@return AccessToken|null | [
"Get",
"the",
"access",
"token",
"for",
"the",
"user",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Laravel/HasNorthstarToken.php#L72-L89 |
35,451 | DoSomething/gateway | src/Laravel/HasNorthstarToken.php | HasNorthstarToken.setOAuthToken | public function setOAuthToken(AccessToken $token)
{
$this->access_token = $token->getToken();
$this->access_token_expiration = $token->getExpires();
$this->refresh_token = $token->getRefreshToken();
$this->role = $token->getValues()['role'];
} | php | public function setOAuthToken(AccessToken $token)
{
$this->access_token = $token->getToken();
$this->access_token_expiration = $token->getExpires();
$this->refresh_token = $token->getRefreshToken();
$this->role = $token->getValues()['role'];
} | [
"public",
"function",
"setOAuthToken",
"(",
"AccessToken",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"access_token",
"=",
"$",
"token",
"->",
"getToken",
"(",
")",
";",
"$",
"this",
"->",
"access_token_expiration",
"=",
"$",
"token",
"->",
"getExpires",
"... | Save the access token for the user.
@param AccessToken $token | [
"Save",
"the",
"access",
"token",
"for",
"the",
"user",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Laravel/HasNorthstarToken.php#L96-L102 |
35,452 | DoSomething/gateway | src/Laravel/HasNorthstarToken.php | HasNorthstarToken.clearOAuthToken | public function clearOAuthToken()
{
$this->access_token = null;
$this->access_token_expiration = null;
$this->refresh_token = null;
} | php | public function clearOAuthToken()
{
$this->access_token = null;
$this->access_token_expiration = null;
$this->refresh_token = null;
} | [
"public",
"function",
"clearOAuthToken",
"(",
")",
"{",
"$",
"this",
"->",
"access_token",
"=",
"null",
";",
"$",
"this",
"->",
"access_token_expiration",
"=",
"null",
";",
"$",
"this",
"->",
"refresh_token",
"=",
"null",
";",
"}"
] | Clear the access token for the user.
@return void | [
"Clear",
"the",
"access",
"token",
"for",
"the",
"user",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Laravel/HasNorthstarToken.php#L109-L114 |
35,453 | jormin/aliyun | sdk/aliyun-opensearch-php-sdk/OpenSearch/Thrift/Protocol/TProtocol.php | TProtocol.skip | public function skip($type)
{
switch ($type) {
case TType::BOOL:
return $this->readBool($bool);
case TType::BYTE:
return $this->readByte($byte);
case TType::I16:
return $this->readI16($i16);
case TType::I32:
return $this->readI32($i32);
case TType::I64:
return $th... | php | public function skip($type)
{
switch ($type) {
case TType::BOOL:
return $this->readBool($bool);
case TType::BYTE:
return $this->readByte($byte);
case TType::I16:
return $this->readI16($i16);
case TType::I32:
return $this->readI32($i32);
case TType::I64:
return $th... | [
"public",
"function",
"skip",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"TType",
"::",
"BOOL",
":",
"return",
"$",
"this",
"->",
"readBool",
"(",
"$",
"bool",
")",
";",
"case",
"TType",
"::",
"BYTE",
":",
"return",
... | The skip function is a utility to parse over unrecognized date without
causing corruption.
@param TType $type What type is it | [
"The",
"skip",
"function",
"is",
"a",
"utility",
"to",
"parse",
"over",
"unrecognized",
"date",
"without",
"causing",
"corruption",
"."
] | c0eb19f5c265dba1f463af1db7347acdcfddb240 | https://github.com/jormin/aliyun/blob/c0eb19f5c265dba1f463af1db7347acdcfddb240/sdk/aliyun-opensearch-php-sdk/OpenSearch/Thrift/Protocol/TProtocol.php#L184-L251 |
35,454 | hiqdev/hipanel-module-server | src/forms/ServerForm.php | ServerForm.fromServer | public static function fromServer(Server $server): ServerForm
{
return new self(array_merge($server->getAttributes(), ['server' => $server->name, 'scenario' => 'update'], [
'ips' => implode(',', ArrayHelper::getColumn($server->ips, 'ip')),
]));
} | php | public static function fromServer(Server $server): ServerForm
{
return new self(array_merge($server->getAttributes(), ['server' => $server->name, 'scenario' => 'update'], [
'ips' => implode(',', ArrayHelper::getColumn($server->ips, 'ip')),
]));
} | [
"public",
"static",
"function",
"fromServer",
"(",
"Server",
"$",
"server",
")",
":",
"ServerForm",
"{",
"return",
"new",
"self",
"(",
"array_merge",
"(",
"$",
"server",
"->",
"getAttributes",
"(",
")",
",",
"[",
"'server'",
"=>",
"$",
"server",
"->",
"n... | Create ServerForm model from Server model.
@param Server $server
@return ServerForm | [
"Create",
"ServerForm",
"model",
"from",
"Server",
"model",
"."
] | e40c3601952cf1fd420ebb97093ee17a33ff3207 | https://github.com/hiqdev/hipanel-module-server/blob/e40c3601952cf1fd420ebb97093ee17a33ff3207/src/forms/ServerForm.php#L39-L44 |
35,455 | hail-framework/framework | src/Http/Header.php | Header.replace | public function replace(array $headers = []): void
{
$this->headerNames = [];
$this->headers = [];
$headers !== [] && $this->add($headers);
if (!isset($this->headers['Cache-Control'])) {
$this->set('Cache-Control', '');
}
} | php | public function replace(array $headers = []): void
{
$this->headerNames = [];
$this->headers = [];
$headers !== [] && $this->add($headers);
if (!isset($this->headers['Cache-Control'])) {
$this->set('Cache-Control', '');
}
} | [
"public",
"function",
"replace",
"(",
"array",
"$",
"headers",
"=",
"[",
"]",
")",
":",
"void",
"{",
"$",
"this",
"->",
"headerNames",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"headers",
"=",
"[",
"]",
";",
"$",
"headers",
"!==",
"[",
"]",
"&&",
... | Replaces the current HTTP headers by a new set.
@param array $headers An array of HTTP headers
@throws \LogicException | [
"Replaces",
"the",
"current",
"HTTP",
"headers",
"by",
"a",
"new",
"set",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Header.php#L55-L65 |
35,456 | hail-framework/framework | src/Http/Header.php | Header.has | public function has($key)
{
if (\strpos($key, '_')) {
$key = \str_replace('_', '-', $key);
}
return isset($this->headerNames[\strtolower($key)]);
} | php | public function has($key)
{
if (\strpos($key, '_')) {
$key = \str_replace('_', '-', $key);
}
return isset($this->headerNames[\strtolower($key)]);
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"\\",
"strpos",
"(",
"$",
"key",
",",
"'_'",
")",
")",
"{",
"$",
"key",
"=",
"\\",
"str_replace",
"(",
"'_'",
",",
"'-'",
",",
"$",
"key",
")",
";",
"}",
"return",
"isset",
"(... | Returns true if the HTTP header is defined.
@param string $key The HTTP header
@return bool true if the parameter exists, false otherwise | [
"Returns",
"true",
"if",
"the",
"HTTP",
"header",
"is",
"defined",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Header.php#L162-L169 |
35,457 | hail-framework/framework | src/Http/Header.php | Header.hasCacheControlDirective | public function hasCacheControlDirective($key)
{
return isset($this->computedCacheControl[$key]) || \array_key_exists($key, $this->computedCacheControl);
} | php | public function hasCacheControlDirective($key)
{
return isset($this->computedCacheControl[$key]) || \array_key_exists($key, $this->computedCacheControl);
} | [
"public",
"function",
"hasCacheControlDirective",
"(",
"$",
"key",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"computedCacheControl",
"[",
"$",
"key",
"]",
")",
"||",
"\\",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"computedCac... | Returns true if the Cache-Control directive is defined.
@param string $key The Cache-Control directive
@return bool true if the directive exists, false otherwise | [
"Returns",
"true",
"if",
"the",
"Cache",
"-",
"Control",
"directive",
"is",
"defined",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Header.php#L218-L221 |
35,458 | hail-framework/framework | src/Http/Header.php | Header.parseCacheControl | protected function parseCacheControl($header)
{
$cacheControl = [];
\preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$cacheControl[\strtolower($match[1])] = $match[3] ?? ($match[2] ?? ... | php | protected function parseCacheControl($header)
{
$cacheControl = [];
\preg_match_all('#([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?#', $header, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$cacheControl[\strtolower($match[1])] = $match[3] ?? ($match[2] ?? ... | [
"protected",
"function",
"parseCacheControl",
"(",
"$",
"header",
")",
"{",
"$",
"cacheControl",
"=",
"[",
"]",
";",
"\\",
"preg_match_all",
"(",
"'#([a-zA-Z][a-zA-Z_-]*)\\s*(?:=(?:\"([^\"]*)\"|([^ \\t\",;]*)))?#'",
",",
"$",
"header",
",",
"$",
"matches",
",",
"PRE... | Parses a Cache-Control HTTP header.
@param string $header The value of the Cache-Control HTTP header
@return array An array representing the attribute values | [
"Parses",
"a",
"Cache",
"-",
"Control",
"HTTP",
"header",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Header.php#L415-L424 |
35,459 | hail-framework/framework | src/Http/RequestHandler.php | RequestHandler.get | protected function get(ServerRequestInterface $request, bool $next = false): ?MiddlewareInterface
{
$index = $next ? ++$this->index : $this->index;
if (!isset($this->middleware[$index])) {
return null;
}
$middleware = $this->middleware[$index];
if (\is_array($m... | php | protected function get(ServerRequestInterface $request, bool $next = false): ?MiddlewareInterface
{
$index = $next ? ++$this->index : $this->index;
if (!isset($this->middleware[$index])) {
return null;
}
$middleware = $this->middleware[$index];
if (\is_array($m... | [
"protected",
"function",
"get",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"bool",
"$",
"next",
"=",
"false",
")",
":",
"?",
"MiddlewareInterface",
"{",
"$",
"index",
"=",
"$",
"next",
"?",
"++",
"$",
"this",
"->",
"index",
":",
"$",
"this",
"... | Return the current or next available middleware frame in the middleware.
@param ServerRequestInterface $request
@param bool $next
@return null|MiddlewareInterface
@throws | [
"Return",
"the",
"current",
"or",
"next",
"available",
"middleware",
"frame",
"in",
"the",
"middleware",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/RequestHandler.php#L87-L123 |
35,460 | hail-framework/framework | src/Http/Middleware/BasePath.php | BasePath.addBasePath | private function addBasePath($path)
{
if (\strpos($path, $this->basePath) === 0) {
return $path;
}
return \str_replace('//', '/', $this->basePath . '/' . $path);
} | php | private function addBasePath($path)
{
if (\strpos($path, $this->basePath) === 0) {
return $path;
}
return \str_replace('//', '/', $this->basePath . '/' . $path);
} | [
"private",
"function",
"addBasePath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"\\",
"strpos",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"basePath",
")",
"===",
"0",
")",
"{",
"return",
"$",
"path",
";",
"}",
"return",
"\\",
"str_replace",
"(",
"'//'... | Adds the basepath to a path.
@param string $path
@return string | [
"Adds",
"the",
"basepath",
"to",
"a",
"path",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Middleware/BasePath.php#L111-L118 |
35,461 | hail-framework/framework | src/Image/Commands/Argument.php | Argument.required | public function required()
{
if (!array_key_exists($this->key, $this->command->arguments)) {
throw new \Hail\Image\Exception\InvalidArgumentException(
sprintf('Missing argument %d for %s', $this->key + 1, $this->getCommandName())
);
}
return $this;
... | php | public function required()
{
if (!array_key_exists($this->key, $this->command->arguments)) {
throw new \Hail\Image\Exception\InvalidArgumentException(
sprintf('Missing argument %d for %s', $this->key + 1, $this->getCommandName())
);
}
return $this;
... | [
"public",
"function",
"required",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"this",
"->",
"key",
",",
"$",
"this",
"->",
"command",
"->",
"arguments",
")",
")",
"{",
"throw",
"new",
"\\",
"Hail",
"\\",
"Image",
"\\",
"Exception",
"... | Defines current argument as required
@return self | [
"Defines",
"current",
"argument",
"as",
"required"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Image/Commands/Argument.php#L68-L77 |
35,462 | hiqdev/hipanel-module-dns | src/models/Record.php | Record.buildRuleWhen | protected function buildRuleWhen($type, $not = false)
{
return function ($model) use ($type, $not) {
/* @var $model Record */
return $not xor in_array($model->type, (array) $type, true);
};
} | php | protected function buildRuleWhen($type, $not = false)
{
return function ($model) use ($type, $not) {
/* @var $model Record */
return $not xor in_array($model->type, (array) $type, true);
};
} | [
"protected",
"function",
"buildRuleWhen",
"(",
"$",
"type",
",",
"$",
"not",
"=",
"false",
")",
"{",
"return",
"function",
"(",
"$",
"model",
")",
"use",
"(",
"$",
"type",
",",
"$",
"not",
")",
"{",
"/* @var $model Record */",
"return",
"$",
"not",
"xo... | Builds a closure for Yii server-side validation property `when` in order to apply the rule to only a certain
list of DNS record types.
@param array|string $type types, that are must be validated with the rule
@param bool $not inverts $type
@return \Closure | [
"Builds",
"a",
"closure",
"for",
"Yii",
"server",
"-",
"side",
"validation",
"property",
"when",
"in",
"order",
"to",
"apply",
"the",
"rule",
"to",
"only",
"a",
"certain",
"list",
"of",
"DNS",
"record",
"types",
"."
] | 7e9199c95d91a979b7bd4fd07fe801dbe9e69183 | https://github.com/hiqdev/hipanel-module-dns/blob/7e9199c95d91a979b7bd4fd07fe801dbe9e69183/src/models/Record.php#L156-L162 |
35,463 | hiqdev/hipanel-module-dns | src/models/Record.php | Record.buildRuleWhenClient | protected function buildRuleWhenClient($type, $not = false)
{
$not = Json::encode($not);
$types = Json::encode((array) $type);
return new JsExpression("
function (attribute, value) {
var type = $(attribute.input).closest('.record-item').find('[data-attribute=type... | php | protected function buildRuleWhenClient($type, $not = false)
{
$not = Json::encode($not);
$types = Json::encode((array) $type);
return new JsExpression("
function (attribute, value) {
var type = $(attribute.input).closest('.record-item').find('[data-attribute=type... | [
"protected",
"function",
"buildRuleWhenClient",
"(",
"$",
"type",
",",
"$",
"not",
"=",
"false",
")",
"{",
"$",
"not",
"=",
"Json",
"::",
"encode",
"(",
"$",
"not",
")",
";",
"$",
"types",
"=",
"Json",
"::",
"encode",
"(",
"(",
"array",
")",
"$",
... | Builds the JS expression for Yii `whenClient` validation in order to apply validation to only a certain
list of DNS record types.
@param array|string $type types, that are must be validated with the rule
@param bool $not inverts $type
@return JsExpression | [
"Builds",
"the",
"JS",
"expression",
"for",
"Yii",
"whenClient",
"validation",
"in",
"order",
"to",
"apply",
"validation",
"to",
"only",
"a",
"certain",
"list",
"of",
"DNS",
"record",
"types",
"."
] | 7e9199c95d91a979b7bd4fd07fe801dbe9e69183 | https://github.com/hiqdev/hipanel-module-dns/blob/7e9199c95d91a979b7bd4fd07fe801dbe9e69183/src/models/Record.php#L172-L185 |
35,464 | hail-framework/framework | src/Database/Migration/Adapter/PostgresAdapter.php | PostgresAdapter.createSchema | public function createSchema($schemaName = 'public')
{
$sql = \sprintf('CREATE SCHEMA %s;',
$this->quoteSchemaName($schemaName)); // from postgres 9.3 we can use "CREATE SCHEMA IF NOT EXISTS schema_name"
$this->execute($sql);
} | php | public function createSchema($schemaName = 'public')
{
$sql = \sprintf('CREATE SCHEMA %s;',
$this->quoteSchemaName($schemaName)); // from postgres 9.3 we can use "CREATE SCHEMA IF NOT EXISTS schema_name"
$this->execute($sql);
} | [
"public",
"function",
"createSchema",
"(",
"$",
"schemaName",
"=",
"'public'",
")",
"{",
"$",
"sql",
"=",
"\\",
"sprintf",
"(",
"'CREATE SCHEMA %s;'",
",",
"$",
"this",
"->",
"quoteSchemaName",
"(",
"$",
"schemaName",
")",
")",
";",
"// from postgres 9.3 we ca... | Creates the specified schema.
@param string $schemaName Schema Name
@return void | [
"Creates",
"the",
"specified",
"schema",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Migration/Adapter/PostgresAdapter.php#L1053-L1058 |
35,465 | hail-framework/framework | src/Database/Migration/Adapter/PostgresAdapter.php | PostgresAdapter.isArrayType | protected function isArrayType($columnType)
{
if (!\preg_match('/^([a-z]+)(?:\[\]){1,}$/', $columnType, $matches)) {
return false;
}
$baseType = $matches[1];
return \in_array($baseType, $this->getColumnTypes(), true);
} | php | protected function isArrayType($columnType)
{
if (!\preg_match('/^([a-z]+)(?:\[\]){1,}$/', $columnType, $matches)) {
return false;
}
$baseType = $matches[1];
return \in_array($baseType, $this->getColumnTypes(), true);
} | [
"protected",
"function",
"isArrayType",
"(",
"$",
"columnType",
")",
"{",
"if",
"(",
"!",
"\\",
"preg_match",
"(",
"'/^([a-z]+)(?:\\[\\]){1,}$/'",
",",
"$",
"columnType",
",",
"$",
"matches",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"baseType",
"="... | Check if the given column is an array of a valid type.
@param string $columnType
@return bool | [
"Check",
"if",
"the",
"given",
"column",
"is",
"an",
"array",
"of",
"a",
"valid",
"type",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Migration/Adapter/PostgresAdapter.php#L1148-L1157 |
35,466 | hail-framework/framework | src/Util/Env.php | Env.get | public static function get(string $name): ?string
{
if (isset($_ENV[$name])) {
return $_ENV[$name];
}
if (isset($_SERVER[$name])) {
return $_SERVER[$name];
}
$value = \getenv($name);
return $value === false ? null : $value; // switch getenv ... | php | public static function get(string $name): ?string
{
if (isset($_ENV[$name])) {
return $_ENV[$name];
}
if (isset($_SERVER[$name])) {
return $_SERVER[$name];
}
$value = \getenv($name);
return $value === false ? null : $value; // switch getenv ... | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"name",
")",
":",
"?",
"string",
"{",
"if",
"(",
"isset",
"(",
"$",
"_ENV",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"_ENV",
"[",
"$",
"name",
"]",
";",
"}",
"if",
"(",
"i... | Search the different places for environment variables and return first value found.
@param string $name
@return string|null | [
"Search",
"the",
"different",
"places",
"for",
"environment",
"variables",
"and",
"return",
"first",
"value",
"found",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Env.php#L107-L120 |
35,467 | hail-framework/framework | src/Util/Env.php | Env.clear | public static function clear($name): void
{
if (static::$immutable) {
return;
}
if (\function_exists('\\putenv')) {
\putenv($name);
}
unset($_ENV[$name], $_SERVER[$name]);
} | php | public static function clear($name): void
{
if (static::$immutable) {
return;
}
if (\function_exists('\\putenv')) {
\putenv($name);
}
unset($_ENV[$name], $_SERVER[$name]);
} | [
"public",
"static",
"function",
"clear",
"(",
"$",
"name",
")",
":",
"void",
"{",
"if",
"(",
"static",
"::",
"$",
"immutable",
")",
"{",
"return",
";",
"}",
"if",
"(",
"\\",
"function_exists",
"(",
"'\\\\putenv'",
")",
")",
"{",
"\\",
"putenv",
"(",
... | Clear an environment variable.
@param string $name
@return void | [
"Clear",
"an",
"environment",
"variable",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Env.php#L169-L180 |
35,468 | hail-framework/framework | src/Template/Tokenizer/Token/Element.php | Element.isClosingElementImplied | public function isClosingElementImplied(string $html): bool
{
$parent = $this->getParent();
if ($parent === null || !($parent instanceof self)) {
return false;
}
$name = $this->parseElementName($html);
$parentName = $parent->getName();
// HEAD: no closin... | php | public function isClosingElementImplied(string $html): bool
{
$parent = $this->getParent();
if ($parent === null || !($parent instanceof self)) {
return false;
}
$name = $this->parseElementName($html);
$parentName = $parent->getName();
// HEAD: no closin... | [
"public",
"function",
"isClosingElementImplied",
"(",
"string",
"$",
"html",
")",
":",
"bool",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
")",
";",
"if",
"(",
"$",
"parent",
"===",
"null",
"||",
"!",
"(",
"$",
"parent",
"instanceof",... | Does the parent have an implied closing tag?
@param string $html
@return boolean | [
"Does",
"the",
"parent",
"have",
"an",
"implied",
"closing",
"tag?"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Tokenizer/Token/Element.php#L80-L116 |
35,469 | hail-framework/framework | src/Template/Tokenizer/Token/Element.php | Element.parse | public function parse(string $html): string
{
$html = ltrim($html);
$this->setTokenPosition($html);
try {
$this->name = $this->parseElementName($html);
$remainingHtml = $this->parseAttributes($html);
$posOfClosingBracket = $this->getPositionOfElementEndTa... | php | public function parse(string $html): string
{
$html = ltrim($html);
$this->setTokenPosition($html);
try {
$this->name = $this->parseElementName($html);
$remainingHtml = $this->parseAttributes($html);
$posOfClosingBracket = $this->getPositionOfElementEndTa... | [
"public",
"function",
"parse",
"(",
"string",
"$",
"html",
")",
":",
"string",
"{",
"$",
"html",
"=",
"ltrim",
"(",
"$",
"html",
")",
";",
"$",
"this",
"->",
"setTokenPosition",
"(",
"$",
"html",
")",
";",
"try",
"{",
"$",
"this",
"->",
"name",
"... | Will parse this element.
@param string $html
@return string Remaining HTML. | [
"Will",
"parse",
"this",
"element",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Tokenizer/Token/Element.php#L125-L157 |
35,470 | hail-framework/framework | src/Template/Tokenizer/Token/Element.php | Element.parseContents | private function parseContents(string $html): string
{
if (\trim($html) === '') {
return '';
}
// Determine value.
$this->value = $html;
if (\preg_match("/(.*)<\/\s*" . $this->name . "\s*>/iU", $html, $valueMatches) === 1) {
$this->value = $valueMatch... | php | private function parseContents(string $html): string
{
if (\trim($html) === '') {
return '';
}
// Determine value.
$this->value = $html;
if (\preg_match("/(.*)<\/\s*" . $this->name . "\s*>/iU", $html, $valueMatches) === 1) {
$this->value = $valueMatch... | [
"private",
"function",
"parseContents",
"(",
"string",
"$",
"html",
")",
":",
"string",
"{",
"if",
"(",
"\\",
"trim",
"(",
"$",
"html",
")",
"===",
"''",
")",
"{",
"return",
"''",
";",
"}",
"// Determine value.",
"$",
"this",
"->",
"value",
"=",
"$",... | Will parse the contents of this element.
@param string $html
@return string Remaining HTML. | [
"Will",
"parse",
"the",
"contents",
"of",
"this",
"element",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Tokenizer/Token/Element.php#L234-L280 |
35,471 | hail-framework/framework | src/Template/Tokenizer/Token/Element.php | Element.parseElementName | private function parseElementName(string $html): string
{
$html = \trim($html);
$elementMatchSuccessful = \preg_match(
"/^(<(([a-z0-9\-]+:)?[a-z0-9\-]+))/i",
$html,
$elementMatches
);
if ($elementMatchSuccessful !== 1) {
if ($this->getT... | php | private function parseElementName(string $html): string
{
$html = \trim($html);
$elementMatchSuccessful = \preg_match(
"/^(<(([a-z0-9\-]+:)?[a-z0-9\-]+))/i",
$html,
$elementMatches
);
if ($elementMatchSuccessful !== 1) {
if ($this->getT... | [
"private",
"function",
"parseElementName",
"(",
"string",
"$",
"html",
")",
":",
"string",
"{",
"$",
"html",
"=",
"\\",
"trim",
"(",
"$",
"html",
")",
";",
"$",
"elementMatchSuccessful",
"=",
"\\",
"preg_match",
"(",
"\"/^(<(([a-z0-9\\-]+:)?[a-z0-9\\-]+))/i\"",
... | Will get the element name from the html string.
@param $html string
@return string The element name. | [
"Will",
"get",
"the",
"element",
"name",
"from",
"the",
"html",
"string",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Tokenizer/Token/Element.php#L289-L306 |
35,472 | hail-framework/framework | src/Template/Tokenizer/Token/Element.php | Element.parseForeignContents | private function parseForeignContents(string $tag, string $html): string
{
$remainingHtml = \ltrim($html);
// Find all contents.
$remainingHtml = $this->determineRemainingHtmlOfForeignContents(
$tag,
$html,
$remainingHtml
);
// Handle no ... | php | private function parseForeignContents(string $tag, string $html): string
{
$remainingHtml = \ltrim($html);
// Find all contents.
$remainingHtml = $this->determineRemainingHtmlOfForeignContents(
$tag,
$html,
$remainingHtml
);
// Handle no ... | [
"private",
"function",
"parseForeignContents",
"(",
"string",
"$",
"tag",
",",
"string",
"$",
"html",
")",
":",
"string",
"{",
"$",
"remainingHtml",
"=",
"\\",
"ltrim",
"(",
"$",
"html",
")",
";",
"// Find all contents.",
"$",
"remainingHtml",
"=",
"$",
"t... | Will parse the script and style contents correctly.
@param $tag string
@param $html string
@return string The remaining HTML. | [
"Will",
"parse",
"the",
"script",
"and",
"style",
"contents",
"correctly",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Tokenizer/Token/Element.php#L316-L343 |
35,473 | hail-framework/framework | src/Template/Tokenizer/Token/Element.php | Element.parseNoContents | private function parseNoContents(string $tag, string $html): string
{
$remainingHtml = \ltrim($html);
$matchingResult = \preg_match(
"/(<\/\s*" . $tag . "\s*>)/i",
$html,
$endOfScriptMatches
);
if ($matchingResult === 0) {
return '';
... | php | private function parseNoContents(string $tag, string $html): string
{
$remainingHtml = \ltrim($html);
$matchingResult = \preg_match(
"/(<\/\s*" . $tag . "\s*>)/i",
$html,
$endOfScriptMatches
);
if ($matchingResult === 0) {
return '';
... | [
"private",
"function",
"parseNoContents",
"(",
"string",
"$",
"tag",
",",
"string",
"$",
"html",
")",
":",
"string",
"{",
"$",
"remainingHtml",
"=",
"\\",
"ltrim",
"(",
"$",
"html",
")",
";",
"$",
"matchingResult",
"=",
"\\",
"preg_match",
"(",
"\"/(<\\/... | Will not parse the contents of an element.
"iframe" elements.
@param $tag string
@param $html string
@return string The remaining HTML. | [
"Will",
"not",
"parse",
"the",
"contents",
"of",
"an",
"element",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Tokenizer/Token/Element.php#L355-L374 |
35,474 | hail-framework/framework | src/Database/Migration/Adapter/AdapterFactory.php | AdapterFactory.registerAdapter | public function registerAdapter($name, $class)
{
if (!is_subclass_of($class, AdapterInterface::class)) {
throw new \RuntimeException(sprintf(
'Adapter class "%s" must implement ' . AdapterInterface::class,
$class
));
}
$this->adapters[$... | php | public function registerAdapter($name, $class)
{
if (!is_subclass_of($class, AdapterInterface::class)) {
throw new \RuntimeException(sprintf(
'Adapter class "%s" must implement ' . AdapterInterface::class,
$class
));
}
$this->adapters[$... | [
"public",
"function",
"registerAdapter",
"(",
"$",
"name",
",",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"is_subclass_of",
"(",
"$",
"class",
",",
"AdapterInterface",
"::",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
... | Add or replace an adapter with a fully qualified class name.
@throws \RuntimeException
@param string $name
@param string $class
@return $this | [
"Add",
"or",
"replace",
"an",
"adapter",
"with",
"a",
"fully",
"qualified",
"class",
"name",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Migration/Adapter/AdapterFactory.php#L93-L104 |
35,475 | hail-framework/framework | src/Database/Migration/Adapter/AdapterFactory.php | AdapterFactory.registerWrapper | public function registerWrapper($name, $class)
{
if (!is_subclass_of($class, WrapperInterface::class)) {
throw new \RuntimeException(sprintf(
'Wrapper class "%s" must be implement ' . WrapperInterface::class,
$class
));
}
$this->wrapper... | php | public function registerWrapper($name, $class)
{
if (!is_subclass_of($class, WrapperInterface::class)) {
throw new \RuntimeException(sprintf(
'Wrapper class "%s" must be implement ' . WrapperInterface::class,
$class
));
}
$this->wrapper... | [
"public",
"function",
"registerWrapper",
"(",
"$",
"name",
",",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"is_subclass_of",
"(",
"$",
"class",
",",
"WrapperInterface",
"::",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
... | Add or replace a wrapper with a fully qualified class name.
@throws \RuntimeException
@param string $name
@param string $class
@return $this | [
"Add",
"or",
"replace",
"a",
"wrapper",
"with",
"a",
"fully",
"qualified",
"class",
"name",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Migration/Adapter/AdapterFactory.php#L152-L163 |
35,476 | aimeos/ai-slim | lib/custom/src/MW/View/Helper/Response/Slim.php | Slim.createStream | public function createStream( $resource )
{
if( is_resource( $resource ) === true ) {
return new \Slim\Http\Stream( $resource );
}
if( ( $fh = @fopen( $resource, 'r' ) ) !== false ) {
return new \Slim\Http\Stream( $fh );
}
throw new \Aimeos\MW\Exception( sprintf( 'Unable to open file "%1$s"', $resour... | php | public function createStream( $resource )
{
if( is_resource( $resource ) === true ) {
return new \Slim\Http\Stream( $resource );
}
if( ( $fh = @fopen( $resource, 'r' ) ) !== false ) {
return new \Slim\Http\Stream( $fh );
}
throw new \Aimeos\MW\Exception( sprintf( 'Unable to open file "%1$s"', $resour... | [
"public",
"function",
"createStream",
"(",
"$",
"resource",
")",
"{",
"if",
"(",
"is_resource",
"(",
"$",
"resource",
")",
"===",
"true",
")",
"{",
"return",
"new",
"\\",
"Slim",
"\\",
"Http",
"\\",
"Stream",
"(",
"$",
"resource",
")",
";",
"}",
"if"... | Creates a new PSR-7 stream object
@param string|resource Absolute file path or file descriptor
@return \Psr\Http\Message\StreamInterface Stream object | [
"Creates",
"a",
"new",
"PSR",
"-",
"7",
"stream",
"object"
] | 13f22efe21450df4c822d9a77034f66a471cfa69 | https://github.com/aimeos/ai-slim/blob/13f22efe21450df4c822d9a77034f66a471cfa69/lib/custom/src/MW/View/Helper/Response/Slim.php#L32-L43 |
35,477 | htmlburger/wpemerge-cli | src/NodePackageManagers/Proxy.php | Proxy.getNodePackageManager | protected function getNodePackageManager() {
$is_windows = strtolower( substr( PHP_OS, 0, 3 ) ) === 'win';
$node_package_managers = [
'yarn' => Yarn::class,
'npm' => Npm::class,
];
foreach ( $node_package_managers as $manager => $class ) {
$command = $is_windows ? 'where ' . escapeshellarg( $manager )... | php | protected function getNodePackageManager() {
$is_windows = strtolower( substr( PHP_OS, 0, 3 ) ) === 'win';
$node_package_managers = [
'yarn' => Yarn::class,
'npm' => Npm::class,
];
foreach ( $node_package_managers as $manager => $class ) {
$command = $is_windows ? 'where ' . escapeshellarg( $manager )... | [
"protected",
"function",
"getNodePackageManager",
"(",
")",
"{",
"$",
"is_windows",
"=",
"strtolower",
"(",
"substr",
"(",
"PHP_OS",
",",
"0",
",",
"3",
")",
")",
"===",
"'win'",
";",
"$",
"node_package_managers",
"=",
"[",
"'yarn'",
"=>",
"Yarn",
"::",
... | Get an instance of the first available package manager
@return NodePackageManagerInterface | [
"Get",
"an",
"instance",
"of",
"the",
"first",
"available",
"package",
"manager"
] | 075f1982b7dd87039a4e7bbc05caf676a10fe862 | https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/NodePackageManagers/Proxy.php#L51-L75 |
35,478 | hail-framework/framework | src/Container/Builder.php | Builder.create | public static function create(ContainerInterface $container, string $class, array $map = [], array $params = null)
{
if (!\class_exists($class)) {
throw new \InvalidArgumentException("unable to create component: {$class} (autoloading failed)");
}
if (\method_exists($class, 'getI... | php | public static function create(ContainerInterface $container, string $class, array $map = [], array $params = null)
{
if (!\class_exists($class)) {
throw new \InvalidArgumentException("unable to create component: {$class} (autoloading failed)");
}
if (\method_exists($class, 'getI... | [
"public",
"static",
"function",
"create",
"(",
"ContainerInterface",
"$",
"container",
",",
"string",
"$",
"class",
",",
"array",
"$",
"map",
"=",
"[",
"]",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"\\",
"class_exists",
"(",
... | Create an instance of a given class.
@noinspection PhpDocMissingThrowsInspection
@param ContainerInterface $container
@param string $class fully-qualified class-name
@param mixed[] $map mixed list/map of parameter values (and/or boxed values)... | [
"Create",
"an",
"instance",
"of",
"a",
"given",
"class",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Builder.php#L67-L100 |
35,479 | hail-framework/framework | src/Container/Builder.php | Builder.resolve | protected static function resolve(
ContainerInterface $container,
array $params,
array $map,
bool $safe = true
): array {
$args = [];
foreach ($params as $index => $param) {
$value = static::getParameterValue($container, $param, $index, $map, $safe);
... | php | protected static function resolve(
ContainerInterface $container,
array $params,
array $map,
bool $safe = true
): array {
$args = [];
foreach ($params as $index => $param) {
$value = static::getParameterValue($container, $param, $index, $map, $safe);
... | [
"protected",
"static",
"function",
"resolve",
"(",
"ContainerInterface",
"$",
"container",
",",
"array",
"$",
"params",
",",
"array",
"$",
"map",
",",
"bool",
"$",
"safe",
"=",
"true",
")",
":",
"array",
"{",
"$",
"args",
"=",
"[",
"]",
";",
"foreach",... | Internally resolves parameters to functions or constructors.
@param ContainerInterface $container
@param \ReflectionParameter[]|array[] $params parameter reflections
@param array $map mixed list/map of parameter values (and/or boxed values)
@param bool ... | [
"Internally",
"resolves",
"parameters",
"to",
"functions",
"or",
"constructors",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Container/Builder.php#L137-L155 |
35,480 | hail-framework/framework | src/Debugger/Helpers.php | Helpers.editorLink | public static function editorLink(string $file, int $line = null): string
{
$file = \strtr($origFile = $file, Debugger::$editorMapping);
if ($editor = self::editorUri($origFile, $line)) {
$file = \str_replace('\\', '/', $file);
if (\preg_match('#(^[a-z]:)?/.{1,50}$#i', $file,... | php | public static function editorLink(string $file, int $line = null): string
{
$file = \strtr($origFile = $file, Debugger::$editorMapping);
if ($editor = self::editorUri($origFile, $line)) {
$file = \str_replace('\\', '/', $file);
if (\preg_match('#(^[a-z]:)?/.{1,50}$#i', $file,... | [
"public",
"static",
"function",
"editorLink",
"(",
"string",
"$",
"file",
",",
"int",
"$",
"line",
"=",
"null",
")",
":",
"string",
"{",
"$",
"file",
"=",
"\\",
"strtr",
"(",
"$",
"origFile",
"=",
"$",
"file",
",",
"Debugger",
"::",
"$",
"editorMappi... | Returns HTML link to editor.
@param string $file
@param int|null $line
@return string | [
"Returns",
"HTML",
"link",
"to",
"editor",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/Helpers.php#L29-L49 |
35,481 | hail-framework/framework | src/Debugger/Helpers.php | Helpers.editorUri | public static function editorUri(
string $file,
int $line = null,
string $action = 'open',
string $search = '',
string $replace = ''
): ?string {
if (Debugger::$editor && $file && ($action === 'create' || is_file($file))) {
$file = \str_replace('/', DIRECT... | php | public static function editorUri(
string $file,
int $line = null,
string $action = 'open',
string $search = '',
string $replace = ''
): ?string {
if (Debugger::$editor && $file && ($action === 'create' || is_file($file))) {
$file = \str_replace('/', DIRECT... | [
"public",
"static",
"function",
"editorUri",
"(",
"string",
"$",
"file",
",",
"int",
"$",
"line",
"=",
"null",
",",
"string",
"$",
"action",
"=",
"'open'",
",",
"string",
"$",
"search",
"=",
"''",
",",
"string",
"$",
"replace",
"=",
"''",
")",
":",
... | Returns link to editor.
@return string|null | [
"Returns",
"link",
"to",
"editor",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/Helpers.php#L57-L78 |
35,482 | hail-framework/framework | src/Debugger/Helpers.php | Helpers.getSuggestion | public static function getSuggestion(array $items, string $value): ?string
{
$best = null;
$min = (\strlen($value) / 4 + 1) * 10 + .1;
foreach (\array_unique($items, SORT_REGULAR) as $item) {
$item = \is_object($item) ? $item->getName() : $item;
if (($len = \levenshte... | php | public static function getSuggestion(array $items, string $value): ?string
{
$best = null;
$min = (\strlen($value) / 4 + 1) * 10 + .1;
foreach (\array_unique($items, SORT_REGULAR) as $item) {
$item = \is_object($item) ? $item->getName() : $item;
if (($len = \levenshte... | [
"public",
"static",
"function",
"getSuggestion",
"(",
"array",
"$",
"items",
",",
"string",
"$",
"value",
")",
":",
"?",
"string",
"{",
"$",
"best",
"=",
"null",
";",
"$",
"min",
"=",
"(",
"\\",
"strlen",
"(",
"$",
"value",
")",
"/",
"4",
"+",
"1... | Finds the best suggestion.
@return string|NULL | [
"Finds",
"the",
"best",
"suggestion",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/Helpers.php#L292-L305 |
35,483 | hail-framework/framework | src/Session/Session.php | Session.isStarted | public function isStarted()
{
$started = \session_status() === PHP_SESSION_ACTIVE;
// if the session was started externally, move the flash values forward
if ($started && !$this->flashMoved) {
$this->moveFlash();
}
// done
return $started;
} | php | public function isStarted()
{
$started = \session_status() === PHP_SESSION_ACTIVE;
// if the session was started externally, move the flash values forward
if ($started && !$this->flashMoved) {
$this->moveFlash();
}
// done
return $started;
} | [
"public",
"function",
"isStarted",
"(",
")",
"{",
"$",
"started",
"=",
"\\",
"session_status",
"(",
")",
"===",
"PHP_SESSION_ACTIVE",
";",
"// if the session was started externally, move the flash values forward",
"if",
"(",
"$",
"started",
"&&",
"!",
"$",
"this",
"... | Is the session already started?
@return bool | [
"Is",
"the",
"session",
"already",
"started?"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Session/Session.php#L178-L189 |
35,484 | hail-framework/framework | src/Session/Session.php | Session.start | public function start(array $options = null)
{
$sessionStatus = \session_status();
if ($sessionStatus === PHP_SESSION_DISABLED) {
throw new \RuntimeException('PHP sessions are disabled');
}
if ($sessionStatus === PHP_SESSION_ACTIVE) {
throw new \RuntimeExcep... | php | public function start(array $options = null)
{
$sessionStatus = \session_status();
if ($sessionStatus === PHP_SESSION_DISABLED) {
throw new \RuntimeException('PHP sessions are disabled');
}
if ($sessionStatus === PHP_SESSION_ACTIVE) {
throw new \RuntimeExcep... | [
"public",
"function",
"start",
"(",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"sessionStatus",
"=",
"\\",
"session_status",
"(",
")",
";",
"if",
"(",
"$",
"sessionStatus",
"===",
"PHP_SESSION_DISABLED",
")",
"{",
"throw",
"new",
"\\",
"RuntimeEx... | Starts a new or existing session.
@param array $options
@return bool
@throws \RuntimeException | [
"Starts",
"a",
"new",
"or",
"existing",
"session",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Session/Session.php#L200-L242 |
35,485 | hail-framework/framework | src/Session/Session.php | Session.moveFlash | protected function moveFlash()
{
if (!isset($_SESSION[static::FLASH_NEXT])) {
$_SESSION[static::FLASH_NEXT] = [];
}
$_SESSION[static::FLASH_NOW] = $_SESSION[static::FLASH_NEXT];
$_SESSION[static::FLASH_NEXT] = [];
$this->flashMoved = true;
} | php | protected function moveFlash()
{
if (!isset($_SESSION[static::FLASH_NEXT])) {
$_SESSION[static::FLASH_NEXT] = [];
}
$_SESSION[static::FLASH_NOW] = $_SESSION[static::FLASH_NEXT];
$_SESSION[static::FLASH_NEXT] = [];
$this->flashMoved = true;
} | [
"protected",
"function",
"moveFlash",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SESSION",
"[",
"static",
"::",
"FLASH_NEXT",
"]",
")",
")",
"{",
"$",
"_SESSION",
"[",
"static",
"::",
"FLASH_NEXT",
"]",
"=",
"[",
"]",
";",
"}",
"$",
"_SESS... | Moves the "next" flash values to the "now" values, thereby clearing the
"next" values. | [
"Moves",
"the",
"next",
"flash",
"values",
"to",
"the",
"now",
"values",
"thereby",
"clearing",
"the",
"next",
"values",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Session/Session.php#L248-L256 |
35,486 | hail-framework/framework | src/Session/Session.php | Session.isResumable | public function isResumable(): bool
{
$name = $this->getName();
if ($this->request) {
return $this->request->cookie($name) !== null;
}
return isset($_COOKIE[$name]);
} | php | public function isResumable(): bool
{
$name = $this->getName();
if ($this->request) {
return $this->request->cookie($name) !== null;
}
return isset($_COOKIE[$name]);
} | [
"public",
"function",
"isResumable",
"(",
")",
":",
"bool",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"request",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"->",
"cookie",
"(",
"$",
"... | Is a session available to be resumed?
@return bool | [
"Is",
"a",
"session",
"available",
"to",
"be",
"resumed?"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Session/Session.php#L295-L304 |
35,487 | hail-framework/framework | src/Session/Session.php | Session.resume | public function resume(): bool
{
if ($this->isStarted()) {
return true;
}
if ($this->isResumable()) {
return $this->start();
}
return false;
} | php | public function resume(): bool
{
if ($this->isStarted()) {
return true;
}
if ($this->isResumable()) {
return $this->start();
}
return false;
} | [
"public",
"function",
"resume",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"isStarted",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isResumable",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
... | Resumes a session, but does not start a new one if there is no
existing one.
@return bool | [
"Resumes",
"a",
"session",
"but",
"does",
"not",
"start",
"a",
"new",
"one",
"if",
"there",
"is",
"no",
"existing",
"one",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Session/Session.php#L313-L324 |
35,488 | hail-framework/framework | src/Session/Session.php | Session.regenerateId | public function regenerateId(): bool
{
$result = \session_regenerate_id(true);
if ($result && $this->csrfToken) {
$this->csrfToken->regenerateValue();
}
return $result;
} | php | public function regenerateId(): bool
{
$result = \session_regenerate_id(true);
if ($result && $this->csrfToken) {
$this->csrfToken->regenerateValue();
}
return $result;
} | [
"public",
"function",
"regenerateId",
"(",
")",
":",
"bool",
"{",
"$",
"result",
"=",
"\\",
"session_regenerate_id",
"(",
"true",
")",
";",
"if",
"(",
"$",
"result",
"&&",
"$",
"this",
"->",
"csrfToken",
")",
"{",
"$",
"this",
"->",
"csrfToken",
"->",
... | Regenerates and replaces the current session id; also regenerates the
CSRF token value if one exists.
@return bool True if regeneration worked, false if not. | [
"Regenerates",
"and",
"replaces",
"the",
"current",
"session",
"id",
";",
"also",
"regenerates",
"the",
"CSRF",
"token",
"value",
"if",
"one",
"exists",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Session/Session.php#L409-L417 |
35,489 | hail-framework/framework | src/Image/ImageCache.php | ImageCache.make | public function make($data)
{
// include "modified" property for any files
if ($this->isFile($data)) {
$this->setProperty('modified', \filemtime((string) $data));
}
// register make call
$this->__call('make', [$data]);
return $this;
} | php | public function make($data)
{
// include "modified" property for any files
if ($this->isFile($data)) {
$this->setProperty('modified', \filemtime((string) $data));
}
// register make call
$this->__call('make', [$data]);
return $this;
} | [
"public",
"function",
"make",
"(",
"$",
"data",
")",
"{",
"// include \"modified\" property for any files",
"if",
"(",
"$",
"this",
"->",
"isFile",
"(",
"$",
"data",
")",
")",
"{",
"$",
"this",
"->",
"setProperty",
"(",
"'modified'",
",",
"\\",
"filemtime",
... | Special make method to add modifed data to checksum
@param mixed $data
@return self | [
"Special",
"make",
"method",
"to",
"add",
"modifed",
"data",
"to",
"checksum"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Image/ImageCache.php#L81-L92 |
35,490 | hail-framework/framework | src/Debugger/BlueScreen.php | BlueScreen.render | public function render(\Throwable $exception): string
{
\ob_start();
if (Helpers::isAjax() && \session_status() === PHP_SESSION_ACTIVE) {
$this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/content.phtml');
$contentId = $_SERVER['HTTP_X_TRACY_AJAX'];
$... | php | public function render(\Throwable $exception): string
{
\ob_start();
if (Helpers::isAjax() && \session_status() === PHP_SESSION_ACTIVE) {
$this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/content.phtml');
$contentId = $_SERVER['HTTP_X_TRACY_AJAX'];
$... | [
"public",
"function",
"render",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
":",
"string",
"{",
"\\",
"ob_start",
"(",
")",
";",
"if",
"(",
"Helpers",
"::",
"isAjax",
"(",
")",
"&&",
"\\",
"session_status",
"(",
")",
"===",
"PHP_SESSION_ACTIVE",
")",
... | Renders blue screen.
@param \Throwable $exception
@return string | [
"Renders",
"blue",
"screen",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/BlueScreen.php#L84-L102 |
35,491 | hail-framework/framework | src/Debugger/BlueScreen.php | BlueScreen.highlightLine | public static function highlightLine(string $html, int $line, int $lines = 15): string
{
$source = \explode("\n", "\n" . \str_replace("\r\n", "\n", $html));
$out = '';
$spans = 1;
$start = $i = \max(1, \min($line, \count($source) - 1) - (int)\floor($lines * 2 / 3));
while (--... | php | public static function highlightLine(string $html, int $line, int $lines = 15): string
{
$source = \explode("\n", "\n" . \str_replace("\r\n", "\n", $html));
$out = '';
$spans = 1;
$start = $i = \max(1, \min($line, \count($source) - 1) - (int)\floor($lines * 2 / 3));
while (--... | [
"public",
"static",
"function",
"highlightLine",
"(",
"string",
"$",
"html",
",",
"int",
"$",
"line",
",",
"int",
"$",
"lines",
"=",
"15",
")",
":",
"string",
"{",
"$",
"source",
"=",
"\\",
"explode",
"(",
"\"\\n\"",
",",
"\"\\n\"",
".",
"\\",
"str_r... | Returns highlighted line in HTML code.
@param string $html
@param int $line
@param int $lines
@return string | [
"Returns",
"highlighted",
"line",
"in",
"HTML",
"code",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/BlueScreen.php#L344-L382 |
35,492 | hail-framework/framework | src/Debugger/BlueScreen.php | BlueScreen.isCollapsed | public function isCollapsed(string $file): bool
{
$file = \str_replace('\\', '/', $file) . '/';
foreach ($this->collapsePaths as $path) {
$path = \str_replace('\\', '/', $path) . '/';
if (\strpos($file, $path) === 0) {
return true;
}
}
... | php | public function isCollapsed(string $file): bool
{
$file = \str_replace('\\', '/', $file) . '/';
foreach ($this->collapsePaths as $path) {
$path = \str_replace('\\', '/', $path) . '/';
if (\strpos($file, $path) === 0) {
return true;
}
}
... | [
"public",
"function",
"isCollapsed",
"(",
"string",
"$",
"file",
")",
":",
"bool",
"{",
"$",
"file",
"=",
"\\",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"file",
")",
".",
"'/'",
";",
"foreach",
"(",
"$",
"this",
"->",
"collapsePaths",
"as"... | Should a file be collapsed in stack trace?
@param string $file
@return bool | [
"Should",
"a",
"file",
"be",
"collapsed",
"in",
"stack",
"trace?"
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Debugger/BlueScreen.php#L392-L403 |
35,493 | hail-framework/framework | src/Template/Extension/Asset.php | Asset.cachedAssetUrl | public function cachedAssetUrl($url)
{
$filePath = $this->path . '/' . \ltrim($url, '/');
if (!\file_exists($filePath)) {
throw new \LogicException(
'Unable to locate the asset "' . $url . '" in the "' . $this->path . '" directory.'
);
}
$las... | php | public function cachedAssetUrl($url)
{
$filePath = $this->path . '/' . \ltrim($url, '/');
if (!\file_exists($filePath)) {
throw new \LogicException(
'Unable to locate the asset "' . $url . '" in the "' . $this->path . '" directory.'
);
}
$las... | [
"public",
"function",
"cachedAssetUrl",
"(",
"$",
"url",
")",
"{",
"$",
"filePath",
"=",
"$",
"this",
"->",
"path",
".",
"'/'",
".",
"\\",
"ltrim",
"(",
"$",
"url",
",",
"'/'",
")",
";",
"if",
"(",
"!",
"\\",
"file_exists",
"(",
"$",
"filePath",
... | Create "cache busted" asset URL.
@param string $url
@return string | [
"Create",
"cache",
"busted",
"asset",
"URL",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Extension/Asset.php#L63-L89 |
35,494 | hail-framework/framework | src/Database/Migration/Generator/MySqlAdapter.php | MySqlAdapter.getSchema | public function getSchema()
{
$this->output->writeln('Load current database schema.');
$result = [];
$result['database'] = $this->getDatabaseSchemata($this->dbName);
$tables = $this->getTables();
foreach ($tables as $table) {
$tableName = $table['table_name'];
... | php | public function getSchema()
{
$this->output->writeln('Load current database schema.');
$result = [];
$result['database'] = $this->getDatabaseSchemata($this->dbName);
$tables = $this->getTables();
foreach ($tables as $table) {
$tableName = $table['table_name'];
... | [
"public",
"function",
"getSchema",
"(",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"'Load current database schema.'",
")",
";",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"result",
"[",
"'database'",
"]",
"=",
"$",
"this",
"->",
"getDataba... | Load current database schema.
@return array | [
"Load",
"current",
"database",
"schema",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Migration/Generator/MySqlAdapter.php#L64-L82 |
35,495 | hail-framework/framework | src/Database/Migration/Generator/MySqlAdapter.php | MySqlAdapter.getTableCreateSql | public function getTableCreateSql($tableName)
{
$sql = sprintf('SHOW CREATE TABLE %s', $this->ident($tableName));
$result = $this->pdo->query($sql)->fetch();
return $result['CREATE TABLE'];
} | php | public function getTableCreateSql($tableName)
{
$sql = sprintf('SHOW CREATE TABLE %s', $this->ident($tableName));
$result = $this->pdo->query($sql)->fetch();
return $result['CREATE TABLE'];
} | [
"public",
"function",
"getTableCreateSql",
"(",
"$",
"tableName",
")",
"{",
"$",
"sql",
"=",
"sprintf",
"(",
"'SHOW CREATE TABLE %s'",
",",
"$",
"this",
"->",
"ident",
"(",
"$",
"tableName",
")",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"pdo",
... | Get SQL to create a table.
@param string $tableName
@return string | [
"Get",
"SQL",
"to",
"create",
"a",
"table",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Database/Migration/Generator/MySqlAdapter.php#L276-L282 |
35,496 | DoSomething/gateway | src/Common/ApiCollection.php | ApiCollection.setPaginator | public function setPaginator($class, $options = [])
{
$interfaces = class_implements($class);
if (in_array('Illuminate\Contracts\Pagination\LengthAwarePaginator', $interfaces)) {
$paginator = new $class($this->items, $this->total, $this->perPage, $this->currentPage, $options);
}... | php | public function setPaginator($class, $options = [])
{
$interfaces = class_implements($class);
if (in_array('Illuminate\Contracts\Pagination\LengthAwarePaginator', $interfaces)) {
$paginator = new $class($this->items, $this->total, $this->perPage, $this->currentPage, $options);
}... | [
"public",
"function",
"setPaginator",
"(",
"$",
"class",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"interfaces",
"=",
"class_implements",
"(",
"$",
"class",
")",
";",
"if",
"(",
"in_array",
"(",
"'Illuminate\\Contracts\\Pagination\\LengthAwarePaginator'... | Set a paginator for this collection.
@param string $class
@param array $options | [
"Set",
"a",
"paginator",
"for",
"this",
"collection",
"."
] | 89c1c59c6af038dff790df6d5aaa9fc703246568 | https://github.com/DoSomething/gateway/blob/89c1c59c6af038dff790df6d5aaa9fc703246568/src/Common/ApiCollection.php#L88-L102 |
35,497 | Kajna/K-Core | Core/Util/Message.php | Message.get | public static function get($key = '', $preserve = false)
{
$value = null;
if (isset($_SESSION['flashmessage'][$key])) {
$value = $_SESSION['flashmessage'][$key];
if (!$preserve) {
unset($_SESSION['flashmessage'][$key]);
}
}
return $... | php | public static function get($key = '', $preserve = false)
{
$value = null;
if (isset($_SESSION['flashmessage'][$key])) {
$value = $_SESSION['flashmessage'][$key];
if (!$preserve) {
unset($_SESSION['flashmessage'][$key]);
}
}
return $... | [
"public",
"static",
"function",
"get",
"(",
"$",
"key",
"=",
"''",
",",
"$",
"preserve",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"'flashmessage'",
"]",
"[",
"$",
"key",
"]",
")",
")",... | Get message and destroy upon reading unless stated otherwise.
@param string $key
@param bool $preserve
@return mixed | [
"Get",
"message",
"and",
"destroy",
"upon",
"reading",
"unless",
"stated",
"otherwise",
"."
] | 6a354056cf95e471b9b1eb372c5626123fd77df2 | https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Util/Message.php#L32-L42 |
35,498 | hail-framework/framework | src/Template/Engine.php | Engine.addData | public function addData(array $data, $templates = null): self
{
if (null === $templates) {
$this->sharedVariables = \array_merge($this->sharedVariables, $data);
return $this;
}
if (\is_string($templates)) {
$templates = [$templates];
}
i... | php | public function addData(array $data, $templates = null): self
{
if (null === $templates) {
$this->sharedVariables = \array_merge($this->sharedVariables, $data);
return $this;
}
if (\is_string($templates)) {
$templates = [$templates];
}
i... | [
"public",
"function",
"addData",
"(",
"array",
"$",
"data",
",",
"$",
"templates",
"=",
"null",
")",
":",
"self",
"{",
"if",
"(",
"null",
"===",
"$",
"templates",
")",
"{",
"$",
"this",
"->",
"sharedVariables",
"=",
"\\",
"array_merge",
"(",
"$",
"th... | Add preassigned template data.
@param array $data ;
@param null|string|array $templates ;
@return self
@throws \InvalidArgumentException | [
"Add",
"preassigned",
"template",
"data",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Engine.php#L91-L118 |
35,499 | hail-framework/framework | src/Template/Engine.php | Engine.callFunction | public function callFunction($name, Template $template = null, $arguments = [])
{
$callable = $this->getFunction($name);
if (\is_array($callable) &&
isset($callable[0]) &&
$callable[0] instanceof ExtensionInterface
) {
$callable[0]->template = $template;
... | php | public function callFunction($name, Template $template = null, $arguments = [])
{
$callable = $this->getFunction($name);
if (\is_array($callable) &&
isset($callable[0]) &&
$callable[0] instanceof ExtensionInterface
) {
$callable[0]->template = $template;
... | [
"public",
"function",
"callFunction",
"(",
"$",
"name",
",",
"Template",
"$",
"template",
"=",
"null",
",",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"callable",
"=",
"$",
"this",
"->",
"getFunction",
"(",
"$",
"name",
")",
";",
"if",
"(",
"\... | Call the function.
@param string $name
@param Template $template
@param array $arguments
@return mixed | [
"Call",
"the",
"function",
"."
] | d419e6c098d29ef9b62192b74050e51985b94f90 | https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Engine.php#L229-L241 |
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.