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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
198,700 | twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.getEditableRecords | public function getEditableRecords()
{
$recordType = $this->getRecordType();
$all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
return $obj->canEdit();
});
return new PaginatedList($all, $this->request);
} | php | public function getEditableRecords()
{
$recordType = $this->getRecordType();
$all = $recordType::get()->filterByCallBack(function (DataObject $obj) {
return $obj->canEdit();
});
return new PaginatedList($all, $this->request);
} | [
"public",
"function",
"getEditableRecords",
"(",
")",
"{",
"$",
"recordType",
"=",
"$",
"this",
"->",
"getRecordType",
"(",
")",
";",
"$",
"all",
"=",
"$",
"recordType",
"::",
"get",
"(",
")",
"->",
"filterByCallBack",
"(",
"function",
"(",
"DataObject",
... | Gets all editable records and returns them, paginated
@return PaginatedList
@throws \Exception | [
"Gets",
"all",
"editable",
"records",
"and",
"returns",
"them",
"paginated"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L180-L188 |
198,701 | twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.create_new | public function create_new($request)
{
if (!$this->canCreate()) {
return $this->httpError(403, "You do not have permission to create new " . $this->getPluralName());
}
$this->addCrumb('Create new ' . $this->getSingularName());
return $this->customise(['Form' => $this->Cre... | php | public function create_new($request)
{
if (!$this->canCreate()) {
return $this->httpError(403, "You do not have permission to create new " . $this->getPluralName());
}
$this->addCrumb('Create new ' . $this->getSingularName());
return $this->customise(['Form' => $this->Cre... | [
"public",
"function",
"create_new",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"canCreate",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"403",
",",
"\"You do not have permission to create new \"",
".",
"$",
"th... | URL method to create a new record
@param HTTPRequest $request
@return \SilverStripe\View\ViewableData_Customised|void
@throws HTTPResponse_Exception | [
"URL",
"method",
"to",
"create",
"a",
"new",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L241-L248 |
198,702 | twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.CreationForm | public function CreationForm()
{
/** @var FieldList $fields */
$fields = singleton($this->getRecordType())->getFrontEndFields();
$fields->push(new HiddenField('ID'));
$form = new Form(
$this,
'CreationForm',
$fields,
new FieldList(
... | php | public function CreationForm()
{
/** @var FieldList $fields */
$fields = singleton($this->getRecordType())->getFrontEndFields();
$fields->push(new HiddenField('ID'));
$form = new Form(
$this,
'CreationForm',
$fields,
new FieldList(
... | [
"public",
"function",
"CreationForm",
"(",
")",
"{",
"/** @var FieldList $fields */",
"$",
"fields",
"=",
"singleton",
"(",
"$",
"this",
"->",
"getRecordType",
"(",
")",
")",
"->",
"getFrontEndFields",
"(",
")",
";",
"$",
"fields",
"->",
"push",
"(",
"new",
... | Scaffolds a form for creating managed data types
@return Form | [
"Scaffolds",
"a",
"form",
"for",
"creating",
"managed",
"data",
"types"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L295-L309 |
198,703 | twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.doSave | public function doSave($data, $form)
{
$recordType = $this->getRecordType();
$record = $recordType::create();
$form->saveInto($record);
$record->write();
$this->redirect($this->Link());
} | php | public function doSave($data, $form)
{
$recordType = $this->getRecordType();
$record = $recordType::create();
$form->saveInto($record);
$record->write();
$this->redirect($this->Link());
} | [
"public",
"function",
"doSave",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"$",
"recordType",
"=",
"$",
"this",
"->",
"getRecordType",
"(",
")",
";",
"$",
"record",
"=",
"$",
"recordType",
"::",
"create",
"(",
")",
";",
"$",
"form",
"->",
"saveI... | Function for saving the form | [
"Function",
"for",
"saving",
"the",
"form"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L314-L321 |
198,704 | twohill/silverstripe-nestedcontrollers | code/NestedCollectionController.php | NestedCollectionController.AlphabetPages | public function AlphabetPages()
{
$query = new SQLSelect();
$pages = new ArrayList();
$sortOn = $this->config()->sort_on;
//Build an SQL query to get all the letters that people start with
$query->select(array("Left($sortOn, 1) AS Letter"));
$query->from($this->getRe... | php | public function AlphabetPages()
{
$query = new SQLSelect();
$pages = new ArrayList();
$sortOn = $this->config()->sort_on;
//Build an SQL query to get all the letters that people start with
$query->select(array("Left($sortOn, 1) AS Letter"));
$query->from($this->getRe... | [
"public",
"function",
"AlphabetPages",
"(",
")",
"{",
"$",
"query",
"=",
"new",
"SQLSelect",
"(",
")",
";",
"$",
"pages",
"=",
"new",
"ArrayList",
"(",
")",
";",
"$",
"sortOn",
"=",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"sort_on",
";",
"//Bu... | Generates a ArrayList of anonymous objects that can be used
to create an alphabet menu for all the items, linking only
when there are items begining with the letter, and providing
an indication of whether it is currently selected or not
@return ArrayList | [
"Generates",
"a",
"ArrayList",
"of",
"anonymous",
"objects",
"that",
"can",
"be",
"used",
"to",
"create",
"an",
"alphabet",
"menu",
"for",
"all",
"the",
"items",
"linking",
"only",
"when",
"there",
"are",
"items",
"begining",
"with",
"the",
"letter",
"and",
... | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedCollectionController.php#L390-L457 |
198,705 | rawphp/RawSession | src/RawPHP/RawSession/Session.php | Session.removeHandler | public function removeHandler( IHandler $handler = NULL )
{
if ( NULL !== $handler && $this->handler == $handler )
{
$this->handler = NULL;
}
else
{
$this->handler = NULL;
}
} | php | public function removeHandler( IHandler $handler = NULL )
{
if ( NULL !== $handler && $this->handler == $handler )
{
$this->handler = NULL;
}
else
{
$this->handler = NULL;
}
} | [
"public",
"function",
"removeHandler",
"(",
"IHandler",
"$",
"handler",
"=",
"NULL",
")",
"{",
"if",
"(",
"NULL",
"!==",
"$",
"handler",
"&&",
"$",
"this",
"->",
"handler",
"==",
"$",
"handler",
")",
"{",
"$",
"this",
"->",
"handler",
"=",
"NULL",
";... | Remove a handler from the session.
@param IHandler $handler | [
"Remove",
"a",
"handler",
"from",
"the",
"session",
"."
] | 1e410e1def1d6d61acfade3bd31478464c70aea3 | https://github.com/rawphp/RawSession/blob/1e410e1def1d6d61acfade3bd31478464c70aea3/src/RawPHP/RawSession/Session.php#L281-L291 |
198,706 | praxigento/mobi_mod_pv | Service/Batch/Transfer/Save.php | Save.readCsv | private function readCsv($fullPath)
{
$result = [];
$entries = $this->hlpCsv->read($fullPath);
foreach ($entries as $one) {
$i=0;
$fromId = $one[$i++];
$fromName = $one[$i++];
$toId = $one[$i++];
$toName = $one[$i++];
$v... | php | private function readCsv($fullPath)
{
$result = [];
$entries = $this->hlpCsv->read($fullPath);
foreach ($entries as $one) {
$i=0;
$fromId = $one[$i++];
$fromName = $one[$i++];
$toId = $one[$i++];
$toName = $one[$i++];
$v... | [
"private",
"function",
"readCsv",
"(",
"$",
"fullPath",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"entries",
"=",
"$",
"this",
"->",
"hlpCsv",
"->",
"read",
"(",
"$",
"fullPath",
")",
";",
"foreach",
"(",
"$",
"entries",
"as",
"$",
"one",
... | Read & parse CSV file.
@param string $fullPath
@return DItem[] | [
"Read",
"&",
"parse",
"CSV",
"file",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Service/Batch/Transfer/Save.php#L54-L73 |
198,707 | cubicmushroom/valueobjects | src/Money/Money.php | Money.fromNative | public static function fromNative()
{
$args = func_get_args();
$amount = new Integer($args[0]);
$currency = Currency::fromNative($args[1]);
return new static($amount, $currency);
} | php | public static function fromNative()
{
$args = func_get_args();
$amount = new Integer($args[0]);
$currency = Currency::fromNative($args[1]);
return new static($amount, $currency);
} | [
"public",
"static",
"function",
"fromNative",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"amount",
"=",
"new",
"Integer",
"(",
"$",
"args",
"[",
"0",
"]",
")",
";",
"$",
"currency",
"=",
"Currency",
"::",
"fromNative",
"(",... | Returns a Money object from native int amount and string currency code
@param int $amount Amount expressed in the smallest units of $currency (e.g. cents)
@param string $currency Currency code of the money object
@return static | [
"Returns",
"a",
"Money",
"object",
"from",
"native",
"int",
"amount",
"and",
"string",
"currency",
"code"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Money/Money.php#L28-L36 |
198,708 | cubicmushroom/valueobjects | src/Money/Money.php | Money.sameValueAs | public function sameValueAs(ValueObjectInterface $money)
{
if (false === Util::classEquals($this, $money)) {
return false;
}
return $this->getAmount()->sameValueAs($money->getAmount()) && $this->getCurrency()->sameValueAs($money->getCurrency());
} | php | public function sameValueAs(ValueObjectInterface $money)
{
if (false === Util::classEquals($this, $money)) {
return false;
}
return $this->getAmount()->sameValueAs($money->getAmount()) && $this->getCurrency()->sameValueAs($money->getCurrency());
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"money",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"money",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"-... | Tells whether two Currency are equal by comparing their amount and currency
@param ValueObjectInterface $money
@return bool | [
"Tells",
"whether",
"two",
"Currency",
"are",
"equal",
"by",
"comparing",
"their",
"amount",
"and",
"currency"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Money/Money.php#L57-L64 |
198,709 | cubicmushroom/valueobjects | src/Money/Money.php | Money.add | public function add(Integer $quantity)
{
$amount = new Integer($this->getAmount()->toNative() + $quantity->toNative());
$result = new self($amount, $this->getCurrency());
return $result;
} | php | public function add(Integer $quantity)
{
$amount = new Integer($this->getAmount()->toNative() + $quantity->toNative());
$result = new self($amount, $this->getCurrency());
return $result;
} | [
"public",
"function",
"add",
"(",
"Integer",
"$",
"quantity",
")",
"{",
"$",
"amount",
"=",
"new",
"Integer",
"(",
"$",
"this",
"->",
"getAmount",
"(",
")",
"->",
"toNative",
"(",
")",
"+",
"$",
"quantity",
"->",
"toNative",
"(",
")",
")",
";",
"$"... | Add an integer quantity to the amount and returns a new Money object.
Use a negative quantity for subtraction.
@param Integer $quantity Quantity to add
@return Money | [
"Add",
"an",
"integer",
"quantity",
"to",
"the",
"amount",
"and",
"returns",
"a",
"new",
"Money",
"object",
".",
"Use",
"a",
"negative",
"quantity",
"for",
"subtraction",
"."
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Money/Money.php#L95-L101 |
198,710 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2PQuery.php | M2PQuery.filterByPageId | public function filterByPageId($pageId = null, $comparison = null)
{
if (is_array($pageId)) {
$useMinMax = false;
if (isset($pageId['min'])) {
$this->addUsingAlias(M2PTableMap::COL_PAGE_ID, $pageId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | php | public function filterByPageId($pageId = null, $comparison = null)
{
if (is_array($pageId)) {
$useMinMax = false;
if (isset($pageId['min'])) {
$this->addUsingAlias(M2PTableMap::COL_PAGE_ID, $pageId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
... | [
"public",
"function",
"filterByPageId",
"(",
"$",
"pageId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"pageId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"pa... | Filter the query on the page_id column
Example usage:
<code>
$query->filterByPageId(1234); // WHERE page_id = 1234
$query->filterByPageId(array(12, 34)); // WHERE page_id IN (12, 34)
$query->filterByPageId(array('min' => 12)); // WHERE page_id > 12
</code>
@see filterByPage()
@param mixed $pageId The value... | [
"Filter",
"the",
"query",
"on",
"the",
"page_id",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2PQuery.php#L337-L358 |
198,711 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/M2PQuery.php | M2PQuery.usePageQuery | public function usePageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinPage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Page', '\Attogram\SharedMedia\Orm\PageQuery');
} | php | public function usePageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinPage($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Page', '\Attogram\SharedMedia\Orm\PageQuery');
} | [
"public",
"function",
"usePageQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinPage",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuer... | Use the Page relation Page object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Attogram\SharedMedia\Orm\PageQuery A secondary que... | [
"Use",
"the",
"Page",
"relation",
"Page",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/M2PQuery.php#L507-L512 |
198,712 | covex-nn/JooS | src/JooS/Config/Config.php | Config.getInstance | public static function getInstance($name)
{
$key = self::_instanceKey($name);
if (!isset(self::$_instances[$key])) {
$dataSource = self::getDataAdapter();
if (is_null($dataSource)) {
$data = array();
} else {
$data = $dataSource->load($key);
}
$config = ne... | php | public static function getInstance($name)
{
$key = self::_instanceKey($name);
if (!isset(self::$_instances[$key])) {
$dataSource = self::getDataAdapter();
if (is_null($dataSource)) {
$data = array();
} else {
$data = $dataSource->load($key);
}
$config = ne... | [
"public",
"static",
"function",
"getInstance",
"(",
"$",
"name",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"_instanceKey",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"_instances",
"[",
"$",
"key",
"]",
")",
")",
"... | Returns config instance
@param string $name Config name
@return Config | [
"Returns",
"config",
"instance"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L53-L73 |
198,713 | covex-nn/JooS | src/JooS/Config/Config.php | Config.newInstance | public static function newInstance($name, $data = null)
{
if (!is_array($data)) {
$data = array();
}
$config = self::getInstance($name);
$config->_data = $data;
return $config;
} | php | public static function newInstance($name, $data = null)
{
if (!is_array($data)) {
$data = array();
}
$config = self::getInstance($name);
$config->_data = $data;
return $config;
} | [
"public",
"static",
"function",
"newInstance",
"(",
"$",
"name",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"}",
"$",
"config",
"=",
"self",
":... | Shortcut for instance creation.
@param string $name Config name
@param array $data Config data
@return Config | [
"Shortcut",
"for",
"instance",
"creation",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L83-L93 |
198,714 | covex-nn/JooS | src/JooS/Config/Config.php | Config.clearInstance | public static function clearInstance($name)
{
$key = self::_instanceKey($name);
if (isset(self::$_instances[$key])) {
unset(self::$_instances[$key]);
}
} | php | public static function clearInstance($name)
{
$key = self::_instanceKey($name);
if (isset(self::$_instances[$key])) {
unset(self::$_instances[$key]);
}
} | [
"public",
"static",
"function",
"clearInstance",
"(",
"$",
"name",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"_instanceKey",
"(",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"_instances",
"[",
"$",
"key",
"]",
")",
")",
"{",
... | Unloads config instance.
@param string $name Config name
@return null | [
"Unloads",
"config",
"instance",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L102-L109 |
198,715 | covex-nn/JooS | src/JooS/Config/Config.php | Config.clearAll | public static function clearAll()
{
$names = array_keys(self::$_instances);
foreach ($names as $name) {
self::clearInstance($name);
}
} | php | public static function clearAll()
{
$names = array_keys(self::$_instances);
foreach ($names as $name) {
self::clearInstance($name);
}
} | [
"public",
"static",
"function",
"clearAll",
"(",
")",
"{",
"$",
"names",
"=",
"array_keys",
"(",
"self",
"::",
"$",
"_instances",
")",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"name",
")",
"{",
"self",
"::",
"clearInstance",
"(",
"$",
"name",
")... | Upload all configs data
@return null | [
"Upload",
"all",
"configs",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L116-L122 |
198,716 | covex-nn/JooS | src/JooS/Config/Config.php | Config.saveInstance | public static function saveInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$config = self::getInstance($name);
$key = self::_instanceKey($name);
$result = $adapter->save($key, $config);
} else {
$result = false;
}
return $result;
... | php | public static function saveInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$config = self::getInstance($name);
$key = self::_instanceKey($name);
$result = $adapter->save($key, $config);
} else {
$result = false;
}
return $result;
... | [
"public",
"static",
"function",
"saveInstance",
"(",
"$",
"name",
")",
"{",
"$",
"adapter",
"=",
"self",
"::",
"getDataAdapter",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"adapter",
")",
")",
"{",
"$",
"config",
"=",
"self",
"::",
"getInsta... | Save config instance data
@param string $name Config name
@return boolean | [
"Save",
"config",
"instance",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L131-L144 |
198,717 | covex-nn/JooS | src/JooS/Config/Config.php | Config.deleteInstance | public static function deleteInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$key = self::_instanceKey($name);
$result = $adapter->delete($key);
} else {
$result = false;
}
self::clearInstance($name);
return $result;
} | php | public static function deleteInstance($name)
{
$adapter = self::getDataAdapter();
if (!is_null($adapter)) {
$key = self::_instanceKey($name);
$result = $adapter->delete($key);
} else {
$result = false;
}
self::clearInstance($name);
return $result;
} | [
"public",
"static",
"function",
"deleteInstance",
"(",
"$",
"name",
")",
"{",
"$",
"adapter",
"=",
"self",
"::",
"getDataAdapter",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"adapter",
")",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"_instance... | Delete config instance data
@param string $name Config name
@return boolean | [
"Delete",
"config",
"instance",
"data"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Config/Config.php#L153-L166 |
198,718 | freialib/freia.autoloader | src/Configs.php | Configs.instance | static function instance(\hlin\archetype\Filesystem $fs, array $filemaps) {
$i = new static;
$i->fs = $fs;
$i->filemaps = $filemaps;
return $i;
} | php | static function instance(\hlin\archetype\Filesystem $fs, array $filemaps) {
$i = new static;
$i->fs = $fs;
$i->filemaps = $filemaps;
return $i;
} | [
"static",
"function",
"instance",
"(",
"\\",
"hlin",
"\\",
"archetype",
"\\",
"Filesystem",
"$",
"fs",
",",
"array",
"$",
"filemaps",
")",
"{",
"$",
"i",
"=",
"new",
"static",
";",
"$",
"i",
"->",
"fs",
"=",
"$",
"fs",
";",
"$",
"i",
"->",
"filem... | Default filemaps will be used if none are specified.
@return static | [
"Default",
"filemaps",
"will",
"be",
"used",
"if",
"none",
"are",
"specified",
"."
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/Configs.php#L25-L30 |
198,719 | PascalKleindienst/simple-api-client | src/Client.php | Client.get | public function get($endpoint, $params = [])
{
// build url
$url = $this->domain . '/' . $endpoint;
if (!empty($params)) {
$url = $url . '?' . http_build_query($params);
}
$request = new Request($url);
// Add client secret header
if (iss... | php | public function get($endpoint, $params = [])
{
// build url
$url = $this->domain . '/' . $endpoint;
if (!empty($params)) {
$url = $url . '?' . http_build_query($params);
}
$request = new Request($url);
// Add client secret header
if (iss... | [
"public",
"function",
"get",
"(",
"$",
"endpoint",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"// build url",
"$",
"url",
"=",
"$",
"this",
"->",
"domain",
".",
"'/'",
".",
"$",
"endpoint",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"params",
")",... | Make a GET Request to an endpoint
@param $endpoint
@param array $params
@return \Jyggen\Curl\Response
@throws \Jyggen\Curl\Exception\CurlErrorException
@throws \Jyggen\Curl\Exception\ProtectedOptionException | [
"Make",
"a",
"GET",
"Request",
"to",
"an",
"endpoint"
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Client.php#L84-L110 |
198,720 | PascalKleindienst/simple-api-client | src/Client.php | Client.getEndpoint | public function getEndpoint($endpoint)
{
// Get Endpoint Class name
$endpoint = studly_case($endpoint);
if (!array_key_exists($endpoint, $this->endpoints)) {
throw new InvalidEndpointException("Endpoint {$endpoint} does not exists");
}
$class = $this->endpoints[... | php | public function getEndpoint($endpoint)
{
// Get Endpoint Class name
$endpoint = studly_case($endpoint);
if (!array_key_exists($endpoint, $this->endpoints)) {
throw new InvalidEndpointException("Endpoint {$endpoint} does not exists");
}
$class = $this->endpoints[... | [
"public",
"function",
"getEndpoint",
"(",
"$",
"endpoint",
")",
"{",
"// Get Endpoint Class name",
"$",
"endpoint",
"=",
"studly_case",
"(",
"$",
"endpoint",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"endpoint",
",",
"$",
"this",
"->",
"endpoin... | Get an API endpoint.
@param string $endpoint
@return \Atog\Api\Endpoint
@throws \Atog\Api\Exceptions\InvalidEndpointException | [
"Get",
"an",
"API",
"endpoint",
"."
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Client.php#L129-L160 |
198,721 | ARCANESOFT/Blog | src/Blog.php | Blog.routes | public static function routes()
{
Route::name('public::blog.')
->prefix('blog')
->namespace('\\Arcanesoft\\Blog\\Http\\Controllers\\Front')
->group(function () {
Routes\PostsRoutes::register();
Routes\CategoriesRoutes::register();
... | php | public static function routes()
{
Route::name('public::blog.')
->prefix('blog')
->namespace('\\Arcanesoft\\Blog\\Http\\Controllers\\Front')
->group(function () {
Routes\PostsRoutes::register();
Routes\CategoriesRoutes::register();
... | [
"public",
"static",
"function",
"routes",
"(",
")",
"{",
"Route",
"::",
"name",
"(",
"'public::blog.'",
")",
"->",
"prefix",
"(",
"'blog'",
")",
"->",
"namespace",
"(",
"'\\\\Arcanesoft\\\\Blog\\\\Http\\\\Controllers\\\\Front'",
")",
"->",
"group",
"(",
"function"... | Register the public blog routes. | [
"Register",
"the",
"public",
"blog",
"routes",
"."
] | 2078fdfdcbccda161c02899b9e1f344f011b2859 | https://github.com/ARCANESOFT/Blog/blob/2078fdfdcbccda161c02899b9e1f344f011b2859/src/Blog.php#L58-L68 |
198,722 | dsv-su/daisy-api-client-php | src/Publication.php | Publication.find | public static function find(array $query)
{
$pubs = Client::get('publication', $query);
return array_map(function ($data) { return new self($data); }, $pubs);
} | php | public static function find(array $query)
{
$pubs = Client::get('publication', $query);
return array_map(function ($data) { return new self($data); }, $pubs);
} | [
"public",
"static",
"function",
"find",
"(",
"array",
"$",
"query",
")",
"{",
"$",
"pubs",
"=",
"Client",
"::",
"get",
"(",
"'publication'",
",",
"$",
"query",
")",
";",
"return",
"array_map",
"(",
"function",
"(",
"$",
"data",
")",
"{",
"return",
"n... | Retrieve an array of Publication objects according to a search query.
@param array $query The query.
@return Publication[] | [
"Retrieve",
"an",
"array",
"of",
"Publication",
"objects",
"according",
"to",
"a",
"search",
"query",
"."
] | aa6817ed45fdf3629c9683ea8a8e70a80f59b441 | https://github.com/dsv-su/daisy-api-client-php/blob/aa6817ed45fdf3629c9683ea8a8e70a80f59b441/src/Publication.php#L15-L19 |
198,723 | rutger-speksnijder/restphp | src/RestPHP/Response/Types/HTML.php | HTML.transformToHtml | private function transformToHtml($data, $hypertextRoutes = [])
{
// Generate the html for the hypertext routes
$hypertextHtml = $this->getHypertextHtml($hypertextRoutes);
// Check if the data is not an array
if (!is_array($data)) {
return "<p>{$data}</p>\n{$hypertextHtml... | php | private function transformToHtml($data, $hypertextRoutes = [])
{
// Generate the html for the hypertext routes
$hypertextHtml = $this->getHypertextHtml($hypertextRoutes);
// Check if the data is not an array
if (!is_array($data)) {
return "<p>{$data}</p>\n{$hypertextHtml... | [
"private",
"function",
"transformToHtml",
"(",
"$",
"data",
",",
"$",
"hypertextRoutes",
"=",
"[",
"]",
")",
"{",
"// Generate the html for the hypertext routes",
"$",
"hypertextHtml",
"=",
"$",
"this",
"->",
"getHypertextHtml",
"(",
"$",
"hypertextRoutes",
")",
"... | Recursively converts the response into an html string.
This is an html string with tables and underlying tables.
@param mixed $data The data to transform.
@param optional array $hypertextRoutes An array with hypertext routes.
@return string The response as an html string. | [
"Recursively",
"converts",
"the",
"response",
"into",
"an",
"html",
"string",
".",
"This",
"is",
"an",
"html",
"string",
"with",
"tables",
"and",
"underlying",
"tables",
"."
] | 326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Response/Types/HTML.php#L49-L74 |
198,724 | rutger-speksnijder/restphp | src/RestPHP/Response/Types/HTML.php | HTML.getHypertextHtml | private function getHypertextHtml($routes = [])
{
// Check if we have routes
if (!$routes) {
return '';
}
// Create the html table
$html = "<table style=\"border: 1px solid black;\">\n";
// Loop through the routes and add them as rows to the table
... | php | private function getHypertextHtml($routes = [])
{
// Check if we have routes
if (!$routes) {
return '';
}
// Create the html table
$html = "<table style=\"border: 1px solid black;\">\n";
// Loop through the routes and add them as rows to the table
... | [
"private",
"function",
"getHypertextHtml",
"(",
"$",
"routes",
"=",
"[",
"]",
")",
"{",
"// Check if we have routes",
"if",
"(",
"!",
"$",
"routes",
")",
"{",
"return",
"''",
";",
"}",
"// Create the html table",
"$",
"html",
"=",
"\"<table style=\\\"border: 1px... | Generates the html for the hypertext routes.
@param optional array $routes The hypertext routes.
@return string The hypertext routes html table. | [
"Generates",
"the",
"html",
"for",
"the",
"hypertext",
"routes",
"."
] | 326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Response/Types/HTML.php#L83-L103 |
198,725 | timostamm/web-resource | src/FileResource.php | FileResource.fromResource | public static function fromResource(ResourceInterface $resource, $path)
{
if ($resource instanceof FileResourceInterface) {
return $resource;
}
file_put_contents($path, $resource->getStream());
$attr = [
'mimetype' => $resource->getMimetype(),
'lastmodified' => $resource->getLastModified(),
'filena... | php | public static function fromResource(ResourceInterface $resource, $path)
{
if ($resource instanceof FileResourceInterface) {
return $resource;
}
file_put_contents($path, $resource->getStream());
$attr = [
'mimetype' => $resource->getMimetype(),
'lastmodified' => $resource->getLastModified(),
'filena... | [
"public",
"static",
"function",
"fromResource",
"(",
"ResourceInterface",
"$",
"resource",
",",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"resource",
"instanceof",
"FileResourceInterface",
")",
"{",
"return",
"$",
"resource",
";",
"}",
"file_put_contents",
"(",
"... | Converts any resource to a local resource.
@param ResourceInterface $resource
@param string $path
@return FileResource | [
"Converts",
"any",
"resource",
"to",
"a",
"local",
"resource",
"."
] | 4c60e679093990585ee2f0a00029ab0a218573b8 | https://github.com/timostamm/web-resource/blob/4c60e679093990585ee2f0a00029ab0a218573b8/src/FileResource.php#L26-L38 |
198,726 | agentmedia/phine-core | src/Core/Logic/Access/Backend/RightsFinder.php | RightsFinder.FindContentRights | static function FindContentRights(Content $content)
{
$result = null;
$currContent = $content;
do
{
$result = $currContent->GetUserGroupRights();
$currContent = ContentTreeUtil::ParentOf($currContent);
}
while (!$result && $currContent);
... | php | static function FindContentRights(Content $content)
{
$result = null;
$currContent = $content;
do
{
$result = $currContent->GetUserGroupRights();
$currContent = ContentTreeUtil::ParentOf($currContent);
}
while (!$result && $currContent);
... | [
"static",
"function",
"FindContentRights",
"(",
"Content",
"$",
"content",
")",
"{",
"$",
"result",
"=",
"null",
";",
"$",
"currContent",
"=",
"$",
"content",
";",
"do",
"{",
"$",
"result",
"=",
"$",
"currContent",
"->",
"GetUserGroupRights",
"(",
")",
"... | Finds the content rigths by searching in element tree
@param Content $content The content
@return BackendContentRights The rights of the contents | [
"Finds",
"the",
"content",
"rigths",
"by",
"searching",
"in",
"element",
"tree"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/RightsFinder.php#L17-L32 |
198,727 | agentmedia/phine-core | src/Core/Logic/Access/Backend/RightsFinder.php | RightsFinder.FindPageRights | static function FindPageRights(Page $page)
{
$currPage = $page;
$result = null;
do
{
$result = $currPage->GetUserGroupRights();
$currPage = $currPage->GetParent();
}
while (!$result && $currPage);
if (!$result && $page->GetSite())
... | php | static function FindPageRights(Page $page)
{
$currPage = $page;
$result = null;
do
{
$result = $currPage->GetUserGroupRights();
$currPage = $currPage->GetParent();
}
while (!$result && $currPage);
if (!$result && $page->GetSite())
... | [
"static",
"function",
"FindPageRights",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"currPage",
"=",
"$",
"page",
";",
"$",
"result",
"=",
"null",
";",
"do",
"{",
"$",
"result",
"=",
"$",
"currPage",
"->",
"GetUserGroupRights",
"(",
")",
";",
"$",
"curr... | Gets the rights of the page
@param Page $page
@return BackendPageRights | [
"Gets",
"the",
"rights",
"of",
"the",
"page"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Access/Backend/RightsFinder.php#L85-L104 |
198,728 | Kris-Kuiper/sFire-Framework | src/Hash/HashTrait.php | HashTrait.hash | public static function hash($data) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
return hash(se... | php | public static function hash($data) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
return hash(se... | [
"public",
"static",
"function",
"hash",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"data",
")",
"&&",
"false",
"===",
"is_numeric",
"(",
"$",
"data",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'... | Hashes text and returns it
@param string $data
@return string | [
"Hashes",
"text",
"and",
"returns",
"it"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Hash/HashTrait.php#L67-L74 |
198,729 | Kris-Kuiper/sFire-Framework | src/Hash/HashTrait.php | HashTrait.validateHash | public static function validateHash($data, $hash) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
if(fals... | php | public static function validateHash($data, $hash) {
if(false === is_string($data) && false === is_numeric($data)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or number, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
}
if(fals... | [
"public",
"static",
"function",
"validateHash",
"(",
"$",
"data",
",",
"$",
"hash",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"data",
")",
"&&",
"false",
"===",
"is_numeric",
"(",
"$",
"data",
")",
")",
"{",
"return",
"trigger_error",... | Verifies that data matches a hash
@param string $data
@param string $hash
@return boolean | [
"Verifies",
"that",
"data",
"matches",
"a",
"hash"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Hash/HashTrait.php#L83-L94 |
198,730 | Kris-Kuiper/sFire-Framework | src/Hash/HashTrait.php | HashTrait.hash_equals | private static function hash_equals($expected, $actual) {
$expected = (string) $expected;
$actual = (string) $actual;
if(true === function_exists('hash_equals')) {
return hash_equals($expected, $actual);
}
$lenExpected = mb_strlen($expected, sel... | php | private static function hash_equals($expected, $actual) {
$expected = (string) $expected;
$actual = (string) $actual;
if(true === function_exists('hash_equals')) {
return hash_equals($expected, $actual);
}
$lenExpected = mb_strlen($expected, sel... | [
"private",
"static",
"function",
"hash_equals",
"(",
"$",
"expected",
",",
"$",
"actual",
")",
"{",
"$",
"expected",
"=",
"(",
"string",
")",
"$",
"expected",
";",
"$",
"actual",
"=",
"(",
"string",
")",
"$",
"actual",
";",
"if",
"(",
"true",
"===",
... | Hash equals function for PHP 5.5+
@param string $expected
@param string $actual
@return bool | [
"Hash",
"equals",
"function",
"for",
"PHP",
"5",
".",
"5",
"+"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Hash/HashTrait.php#L103-L124 |
198,731 | duncan3dc/serial | src/Yaml.php | Yaml.decode | public static function decode($string)
{
if (!$string) {
return new ArrayObject();
}
$array = SymfonyYaml::parse($string);
if (!is_array($array)) {
$array = [];
}
return ArrayObject::make($array);
} | php | public static function decode($string)
{
if (!$string) {
return new ArrayObject();
}
$array = SymfonyYaml::parse($string);
if (!is_array($array)) {
$array = [];
}
return ArrayObject::make($array);
} | [
"public",
"static",
"function",
"decode",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"$",
"string",
")",
"{",
"return",
"new",
"ArrayObject",
"(",
")",
";",
"}",
"$",
"array",
"=",
"SymfonyYaml",
"::",
"parse",
"(",
"$",
"string",
")",
";",
"if"... | Convert a yaml string to an array.
{@inheritDoc} | [
"Convert",
"a",
"yaml",
"string",
"to",
"an",
"array",
"."
] | 2e40127a0a364ee1bd6f655b0f5b5d4a035a5716 | https://github.com/duncan3dc/serial/blob/2e40127a0a364ee1bd6f655b0f5b5d4a035a5716/src/Yaml.php#L33-L46 |
198,732 | pdyn/filesystem | Mimetype.php | Mimetype.mime2ext | public static function mime2ext($mime) {
$ext2mime = static::get_mime_map();
$mime2ext = array_flip($ext2mime);
return (isset($mime2ext[$mime])) ? $mime2ext[$mime] : 'unknown';
} | php | public static function mime2ext($mime) {
$ext2mime = static::get_mime_map();
$mime2ext = array_flip($ext2mime);
return (isset($mime2ext[$mime])) ? $mime2ext[$mime] : 'unknown';
} | [
"public",
"static",
"function",
"mime2ext",
"(",
"$",
"mime",
")",
"{",
"$",
"ext2mime",
"=",
"static",
"::",
"get_mime_map",
"(",
")",
";",
"$",
"mime2ext",
"=",
"array_flip",
"(",
"$",
"ext2mime",
")",
";",
"return",
"(",
"isset",
"(",
"$",
"mime2ext... | Get the file extension associated with a given mime type.
@param string $mime The mime type.
@return string The file extension. | [
"Get",
"the",
"file",
"extension",
"associated",
"with",
"a",
"given",
"mime",
"type",
"."
] | e2f780eac166aa60071e601d600133b860ace594 | https://github.com/pdyn/filesystem/blob/e2f780eac166aa60071e601d600133b860ace594/Mimetype.php#L29-L33 |
198,733 | romm/configuration_object | Classes/Validation/Validator/HasValuesValidator.php | HasValuesValidator.isValid | public function isValid($value)
{
$acceptedValues = GeneralUtility::trimExplode('|', $this->options['values']);
if (false === in_array($value, $acceptedValues)) {
$errorMessage = $this->translateErrorMessage('validator.has_values.not_valid', 'configuration_object', [implode(', ', $accep... | php | public function isValid($value)
{
$acceptedValues = GeneralUtility::trimExplode('|', $this->options['values']);
if (false === in_array($value, $acceptedValues)) {
$errorMessage = $this->translateErrorMessage('validator.has_values.not_valid', 'configuration_object', [implode(', ', $accep... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"acceptedValues",
"=",
"GeneralUtility",
"::",
"trimExplode",
"(",
"'|'",
",",
"$",
"this",
"->",
"options",
"[",
"'values'",
"]",
")",
";",
"if",
"(",
"false",
"===",
"in_array",
"(",
... | Checks if the given values is one of the accepted values.
@param mixed $value The value that should be validated. | [
"Checks",
"if",
"the",
"given",
"values",
"is",
"one",
"of",
"the",
"accepted",
"values",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Validation/Validator/HasValuesValidator.php#L34-L42 |
198,734 | ritalin/omelet | src/Annotation/AnnotationConverterAdapter.php | AnnotationConverterAdapter.getMethodAnnotations | public function getMethodAnnotations(\ReflectionMethod $method)
{
return array_merge(
$this->reader->getMethodAnnotations($method),
$this->converter->getMethodAnnotations($method)
);
} | php | public function getMethodAnnotations(\ReflectionMethod $method)
{
return array_merge(
$this->reader->getMethodAnnotations($method),
$this->converter->getMethodAnnotations($method)
);
} | [
"public",
"function",
"getMethodAnnotations",
"(",
"\\",
"ReflectionMethod",
"$",
"method",
")",
"{",
"return",
"array_merge",
"(",
"$",
"this",
"->",
"reader",
"->",
"getMethodAnnotations",
"(",
"$",
"method",
")",
",",
"$",
"this",
"->",
"converter",
"->",
... | Collect method annotations.
@param ReflectionMethod methodName
@return DaoAnnotation[] | [
"Collect",
"method",
"annotations",
"."
] | de8e10b5c1dbc345b1d5ccb8853a2e8a8d6a43df | https://github.com/ritalin/omelet/blob/de8e10b5c1dbc345b1d5ccb8853a2e8a8d6a43df/src/Annotation/AnnotationConverterAdapter.php#L42-L48 |
198,735 | ritalin/omelet | src/Annotation/AnnotationConverterAdapter.php | AnnotationConverterAdapter.getPropertyAnnotations | public function getPropertyAnnotations(\ReflectionProperty $prop)
{
return array_merge(
$this->reader->getPropertyAnnotations($prop),
$this->converter->getPropertyAnnotations($prop)
);
} | php | public function getPropertyAnnotations(\ReflectionProperty $prop)
{
return array_merge(
$this->reader->getPropertyAnnotations($prop),
$this->converter->getPropertyAnnotations($prop)
);
} | [
"public",
"function",
"getPropertyAnnotations",
"(",
"\\",
"ReflectionProperty",
"$",
"prop",
")",
"{",
"return",
"array_merge",
"(",
"$",
"this",
"->",
"reader",
"->",
"getPropertyAnnotations",
"(",
"$",
"prop",
")",
",",
"$",
"this",
"->",
"converter",
"->",... | Collect property annotations.
@param ReflectionProperty methodName
@return EntityFieldAnnotation[] | [
"Collect",
"property",
"annotations",
"."
] | de8e10b5c1dbc345b1d5ccb8853a2e8a8d6a43df | https://github.com/ritalin/omelet/blob/de8e10b5c1dbc345b1d5ccb8853a2e8a8d6a43df/src/Annotation/AnnotationConverterAdapter.php#L57-L63 |
198,736 | phossa/phossa-event | src/Phossa/Event/Variation/CompositeEventManager.php | CompositeEventManager.processEvent | public function processEvent(
Interfaces\EventInterface $event,
callable $callback = null
)/*# : EventManagerInterface */ {
$eventName = $event->getName();
// check self's queue
$queue = $this->matchEventQueue($eventName, $this);
// merge with other managers' queue
... | php | public function processEvent(
Interfaces\EventInterface $event,
callable $callback = null
)/*# : EventManagerInterface */ {
$eventName = $event->getName();
// check self's queue
$queue = $this->matchEventQueue($eventName, $this);
// merge with other managers' queue
... | [
"public",
"function",
"processEvent",
"(",
"Interfaces",
"\\",
"EventInterface",
"$",
"event",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"/*# : EventManagerInterface */",
"{",
"$",
"eventName",
"=",
"$",
"event",
"->",
"getName",
"(",
")",
";",
"// c... | Process events by all managers in the pool
{@inheritDoc} | [
"Process",
"events",
"by",
"all",
"managers",
"in",
"the",
"pool"
] | 0044888fcc9b21584233c73cf20fc160e1b1f295 | https://github.com/phossa/phossa-event/blob/0044888fcc9b21584233c73cf20fc160e1b1f295/src/Phossa/Event/Variation/CompositeEventManager.php#L107-L128 |
198,737 | mikyprog/LocationBundle | Manager/ContinentManager.php | ContinentManager.updateContinent | public function updateContinent(Continent $continent, $andFlush = true)
{
$this->objectManager->persist($continent);
if ($andFlush) {
$this->objectManager->flush();
}
} | php | public function updateContinent(Continent $continent, $andFlush = true)
{
$this->objectManager->persist($continent);
if ($andFlush) {
$this->objectManager->flush();
}
} | [
"public",
"function",
"updateContinent",
"(",
"Continent",
"$",
"continent",
",",
"$",
"andFlush",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"objectManager",
"->",
"persist",
"(",
"$",
"continent",
")",
";",
"if",
"(",
"$",
"andFlush",
")",
"{",
"$",
"... | Updates a Continent.
@param Continent $continent
@param Boolean $andFlush Whether to flush the changes (default true) | [
"Updates",
"a",
"Continent",
"."
] | ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23 | https://github.com/mikyprog/LocationBundle/blob/ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23/Manager/ContinentManager.php#L117-L123 |
198,738 | mikyprog/LocationBundle | Manager/ContinentManager.php | ContinentManager.refreshContinent | public function refreshContinent(Continent $continent)
{
$refreshedContinent = $this->findContinentBy(array('id' => $continent->getId()));
if (null === $refreshedContinent) {
throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $continent->getId()));
... | php | public function refreshContinent(Continent $continent)
{
$refreshedContinent = $this->findContinentBy(array('id' => $continent->getId()));
if (null === $refreshedContinent) {
throw new UsernameNotFoundException(sprintf('User with ID "%d" could not be reloaded.', $continent->getId()));
... | [
"public",
"function",
"refreshContinent",
"(",
"Continent",
"$",
"continent",
")",
"{",
"$",
"refreshedContinent",
"=",
"$",
"this",
"->",
"findContinentBy",
"(",
"array",
"(",
"'id'",
"=>",
"$",
"continent",
"->",
"getId",
"(",
")",
")",
")",
";",
"if",
... | Refreshed a Continent by Continent Instance
@param Continent $continent
@return Ad | [
"Refreshed",
"a",
"Continent",
"by",
"Continent",
"Instance"
] | ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23 | https://github.com/mikyprog/LocationBundle/blob/ffbbc8e6b7c759f0dbf0dec6d36a8f3150322f23/Manager/ContinentManager.php#L144-L152 |
198,739 | 1HappyPlace/ansi-terminal | src/ANSI/Color/Mode.php | Mode.getModeConstant | protected static function getModeConstant($value) {
// if the value coming in, is a integer, ensure it is one of the constants
if (is_int($value)) {
// it can be the number of colors
// if it is less than or equal to 16,
if ($value <= 16) {
... | php | protected static function getModeConstant($value) {
// if the value coming in, is a integer, ensure it is one of the constants
if (is_int($value)) {
// it can be the number of colors
// if it is less than or equal to 16,
if ($value <= 16) {
... | [
"protected",
"static",
"function",
"getModeConstant",
"(",
"$",
"value",
")",
"{",
"// if the value coming in, is a integer, ensure it is one of the constants",
"if",
"(",
"is_int",
"(",
"$",
"value",
")",
")",
"{",
"// it can be the number of colors",
"// if it is less than ... | Helper function to take a value and turn it into a valid constant integer value
@param string | int $value
if int -
if it is any other number, it tries to ascertain the mode based on the number of colors
if string -
if it is one of the constants Mode::XTERM, then it returns that mode
it matches the constant names (suc... | [
"Helper",
"function",
"to",
"take",
"a",
"value",
"and",
"turn",
"it",
"into",
"a",
"valid",
"constant",
"integer",
"value"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Color/Mode.php#L83-L136 |
198,740 | AmericanCouncils/WebServicesBundle | EventListener/WebServiceSubscriber.php | WebServiceSubscriber.onKernelEarlyRequest | public function onKernelEarlyRequest(GetResponseEvent $e)
{
$request = $e->getRequest();
foreach ($this->pathConfig as $regex => $config) {
if (preg_match($regex, $request->getPathInfo())) {
$this->enabled = true;
if (!$this->subscribed) {
... | php | public function onKernelEarlyRequest(GetResponseEvent $e)
{
$request = $e->getRequest();
foreach ($this->pathConfig as $regex => $config) {
if (preg_match($regex, $request->getPathInfo())) {
$this->enabled = true;
if (!$this->subscribed) {
... | [
"public",
"function",
"onKernelEarlyRequest",
"(",
"GetResponseEvent",
"$",
"e",
")",
"{",
"$",
"request",
"=",
"$",
"e",
"->",
"getRequest",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"pathConfig",
"as",
"$",
"regex",
"=>",
"$",
"config",
")",
... | Listens early in the `kernel.request` cycle for incoming requests and checks for a matching path. If a
match is found, the rest of the kernel listeners are registered and the relevant path config is stored
for use in those listeners. | [
"Listens",
"early",
"in",
"the",
"kernel",
".",
"request",
"cycle",
"for",
"incoming",
"requests",
"and",
"checks",
"for",
"a",
"matching",
"path",
".",
"If",
"a",
"match",
"is",
"found",
"the",
"rest",
"of",
"the",
"kernel",
"listeners",
"are",
"registere... | 3f6270ecf31138ba2271a94a407c0d1a05542929 | https://github.com/AmericanCouncils/WebServicesBundle/blob/3f6270ecf31138ba2271a94a407c0d1a05542929/EventListener/WebServiceSubscriber.php#L126-L152 |
198,741 | AmericanCouncils/WebServicesBundle | EventListener/WebServiceSubscriber.php | WebServiceSubscriber.onKernelLateRequest | public function onKernelLateRequest(GetResponseEvent $e)
{
if (!$this->enabled) return;
$req = $e->getRequest();
if (!$config = $req->attributes->get('_ac_web_service', false)) {
return;
}
$config = $this->negotiateResponseFormat($req, $config);
$req->a... | php | public function onKernelLateRequest(GetResponseEvent $e)
{
if (!$this->enabled) return;
$req = $e->getRequest();
if (!$config = $req->attributes->get('_ac_web_service', false)) {
return;
}
$config = $this->negotiateResponseFormat($req, $config);
$req->a... | [
"public",
"function",
"onKernelLateRequest",
"(",
"GetResponseEvent",
"$",
"e",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
";",
"$",
"req",
"=",
"$",
"e",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"!",
"$",
"config",
... | Fires at the end of the `kernel.request` cycle - so listeners should receive a request that has already been
resolved to a controller.
Will throw exceptions if the response format is unknown. | [
"Fires",
"at",
"the",
"end",
"of",
"the",
"kernel",
".",
"request",
"cycle",
"-",
"so",
"listeners",
"should",
"receive",
"a",
"request",
"that",
"has",
"already",
"been",
"resolved",
"to",
"a",
"controller",
"."
] | 3f6270ecf31138ba2271a94a407c0d1a05542929 | https://github.com/AmericanCouncils/WebServicesBundle/blob/3f6270ecf31138ba2271a94a407c0d1a05542929/EventListener/WebServiceSubscriber.php#L161-L179 |
198,742 | AmericanCouncils/WebServicesBundle | EventListener/WebServiceSubscriber.php | WebServiceSubscriber.onKernelResponse | public function onKernelResponse(FilterResponseEvent $e)
{
if (!$this->enabled) return;
$response = $e->getResponse();
//if supression is active, always return 200 no matter what
$config = $e->getRequest()->attributes->get('_ac_web_service');
if (!$config['negotiated']) {... | php | public function onKernelResponse(FilterResponseEvent $e)
{
if (!$this->enabled) return;
$response = $e->getResponse();
//if supression is active, always return 200 no matter what
$config = $e->getRequest()->attributes->get('_ac_web_service');
if (!$config['negotiated']) {... | [
"public",
"function",
"onKernelResponse",
"(",
"FilterResponseEvent",
"$",
"e",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
";",
"$",
"response",
"=",
"$",
"e",
"->",
"getResponse",
"(",
")",
";",
"//if supression is active, always... | Called when a response object has been resolved. | [
"Called",
"when",
"a",
"response",
"object",
"has",
"been",
"resolved",
"."
] | 3f6270ecf31138ba2271a94a407c0d1a05542929 | https://github.com/AmericanCouncils/WebServicesBundle/blob/3f6270ecf31138ba2271a94a407c0d1a05542929/EventListener/WebServiceSubscriber.php#L269-L294 |
198,743 | AmericanCouncils/WebServicesBundle | EventListener/WebServiceSubscriber.php | WebServiceSubscriber.onKernelTerminate | public function onKernelTerminate(PostResponseEvent $e)
{
if (!$this->enabled) return;
$e->getDispatcher()->dispatch(self::API_TERMINATE, $e);
} | php | public function onKernelTerminate(PostResponseEvent $e)
{
if (!$this->enabled) return;
$e->getDispatcher()->dispatch(self::API_TERMINATE, $e);
} | [
"public",
"function",
"onKernelTerminate",
"(",
"PostResponseEvent",
"$",
"e",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enabled",
")",
"return",
";",
"$",
"e",
"->",
"getDispatcher",
"(",
")",
"->",
"dispatch",
"(",
"self",
"::",
"API_TERMINATE",
",... | Called after a response has already been sent. | [
"Called",
"after",
"a",
"response",
"has",
"already",
"been",
"sent",
"."
] | 3f6270ecf31138ba2271a94a407c0d1a05542929 | https://github.com/AmericanCouncils/WebServicesBundle/blob/3f6270ecf31138ba2271a94a407c0d1a05542929/EventListener/WebServiceSubscriber.php#L388-L393 |
198,744 | chee-commerce/CheeModule | src/Chee/Module/Module.php | Module.includes | protected function includes()
{
$moduleInclude = (array) $this->def('include');
$globalInclude = $this->app['config']->get('module::include');
$specificInclude = array($this->name.'.php');
$include = array_merge($moduleInclude, $specificInclude, $globalInclude);
foreach ($inc... | php | protected function includes()
{
$moduleInclude = (array) $this->def('include');
$globalInclude = $this->app['config']->get('module::include');
$specificInclude = array($this->name.'.php');
$include = array_merge($moduleInclude, $specificInclude, $globalInclude);
foreach ($inc... | [
"protected",
"function",
"includes",
"(",
")",
"{",
"$",
"moduleInclude",
"=",
"(",
"array",
")",
"$",
"this",
"->",
"def",
"(",
"'include'",
")",
";",
"$",
"globalInclude",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'mod... | Include some files determined in config.php of CheeModule and module.json of modules | [
"Include",
"some",
"files",
"determined",
"in",
"config",
".",
"php",
"of",
"CheeModule",
"and",
"module",
".",
"json",
"of",
"modules"
] | ccfff426f4ecf8f13687f5acd49246ba4997deee | https://github.com/chee-commerce/CheeModule/blob/ccfff426f4ecf8f13687f5acd49246ba4997deee/src/Chee/Module/Module.php#L56-L67 |
198,745 | chee-commerce/CheeModule | src/Chee/Module/Module.php | Module.registerProviders | protected function registerProviders()
{
$providers = $this->def('provider');
if ($providers)
{
if (is_array($providers))
{
foreach ($providers as $provider)
{
$this->app->register($instance = new $provider($this->a... | php | protected function registerProviders()
{
$providers = $this->def('provider');
if ($providers)
{
if (is_array($providers))
{
foreach ($providers as $provider)
{
$this->app->register($instance = new $provider($this->a... | [
"protected",
"function",
"registerProviders",
"(",
")",
"{",
"$",
"providers",
"=",
"$",
"this",
"->",
"def",
"(",
"'provider'",
")",
";",
"if",
"(",
"$",
"providers",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"providers",
")",
")",
"{",
"foreach",
... | Register service providers of module | [
"Register",
"service",
"providers",
"of",
"module"
] | ccfff426f4ecf8f13687f5acd49246ba4997deee | https://github.com/chee-commerce/CheeModule/blob/ccfff426f4ecf8f13687f5acd49246ba4997deee/src/Chee/Module/Module.php#L72-L90 |
198,746 | mikemirten/DoctrineCriteriaSerializer | src/KatharsisQuery/KatharsisQueryDeserializer.php | KatharsisQueryDeserializer.validatePagination | protected function validatePagination($pagination): void
{
if (! is_array($pagination)) {
throw new InvalidQueryException('Attribute "page" of query must be an array.');
}
$unexpected = array_diff(array_keys($pagination), ['offset', 'limit']);
if (empty($unexpected)) {
... | php | protected function validatePagination($pagination): void
{
if (! is_array($pagination)) {
throw new InvalidQueryException('Attribute "page" of query must be an array.');
}
$unexpected = array_diff(array_keys($pagination), ['offset', 'limit']);
if (empty($unexpected)) {
... | [
"protected",
"function",
"validatePagination",
"(",
"$",
"pagination",
")",
":",
"void",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"pagination",
")",
")",
"{",
"throw",
"new",
"InvalidQueryException",
"(",
"'Attribute \"page\" of query must be an array.'",
")",
"... | Validate pagination definition
@param $pagination
@throws InvalidQueryException | [
"Validate",
"pagination",
"definition"
] | 1016e8781db7b3403be18d6a2168017726c237e1 | https://github.com/mikemirten/DoctrineCriteriaSerializer/blob/1016e8781db7b3403be18d6a2168017726c237e1/src/KatharsisQuery/KatharsisQueryDeserializer.php#L186-L202 |
198,747 | nemundo/core | src/Type/Text/Text.php | Text.substring | public function substring($start, $length = null)
{
if ($length == null) {
$substring = substr($this->value, $start);
} else {
$substring = substr($this->value, $start, $length);
}
$this->value = $substring;
return $this;
} | php | public function substring($start, $length = null)
{
if ($length == null) {
$substring = substr($this->value, $start);
} else {
$substring = substr($this->value, $start, $length);
}
$this->value = $substring;
return $this;
} | [
"public",
"function",
"substring",
"(",
"$",
"start",
",",
"$",
"length",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"length",
"==",
"null",
")",
"{",
"$",
"substring",
"=",
"substr",
"(",
"$",
"this",
"->",
"value",
",",
"$",
"start",
")",
";",
"}",... | Unterschied zu getSubstring !!! | [
"Unterschied",
"zu",
"getSubstring",
"!!!"
] | 5ca14889fdfb9155b52fedb364b34502d14e21ed | https://github.com/nemundo/core/blob/5ca14889fdfb9155b52fedb364b34502d14e21ed/src/Type/Text/Text.php#L36-L50 |
198,748 | FuzeWorks/Core | src/Libraries/Cache/drivers/Cache_file.php | FW_Cache_file.save | public function save($id, $data, $ttl = 60, $raw = FALSE)
{
$contents = array(
'time' => time(),
'ttl' => $ttl,
'data' => $data
);
if (write_file($this->_cache_path.$id, serialize($contents)))
{
chmod($this->_cache_path.$id, 0640);
return TRUE;
}
return FALSE;
} | php | public function save($id, $data, $ttl = 60, $raw = FALSE)
{
$contents = array(
'time' => time(),
'ttl' => $ttl,
'data' => $data
);
if (write_file($this->_cache_path.$id, serialize($contents)))
{
chmod($this->_cache_path.$id, 0640);
return TRUE;
}
return FALSE;
} | [
"public",
"function",
"save",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"ttl",
"=",
"60",
",",
"$",
"raw",
"=",
"FALSE",
")",
"{",
"$",
"contents",
"=",
"array",
"(",
"'time'",
"=>",
"time",
"(",
")",
",",
"'ttl'",
"=>",
"$",
"ttl",
",",
"'... | Save into cache
@param string $id Cache ID
@param mixed $data Data to store
@param int $ttl Time to live in seconds
@param bool $raw Whether to store the raw value (unused)
@return bool TRUE on success, FALSE on failure | [
"Save",
"into",
"cache"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Cache/drivers/Cache_file.php#L105-L120 |
198,749 | FuzeWorks/Core | src/Libraries/Cache/drivers/Cache_file.php | FW_Cache_file.delete | public function delete($id)
{
return file_exists($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE;
} | php | public function delete($id)
{
return file_exists($this->_cache_path.$id) ? unlink($this->_cache_path.$id) : FALSE;
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"return",
"file_exists",
"(",
"$",
"this",
"->",
"_cache_path",
".",
"$",
"id",
")",
"?",
"unlink",
"(",
"$",
"this",
"->",
"_cache_path",
".",
"$",
"id",
")",
":",
"FALSE",
";",
"}"
] | Delete from Cache
@param mixed unique identifier of item in cache
@return bool true on success/false on failure | [
"Delete",
"from",
"Cache"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Cache/drivers/Cache_file.php#L130-L133 |
198,750 | vaccuum/config | source/DirectoryReader.php | DirectoryReader.load | protected function load($path)
{
/** @noinspection PhpIncludeInspection */
$file = require($path);
if (!is_array($file))
{
$message = "{$path} configuration file is not readable.";
throw new ConfigException($message);
}
return $file;
} | php | protected function load($path)
{
/** @noinspection PhpIncludeInspection */
$file = require($path);
if (!is_array($file))
{
$message = "{$path} configuration file is not readable.";
throw new ConfigException($message);
}
return $file;
} | [
"protected",
"function",
"load",
"(",
"$",
"path",
")",
"{",
"/** @noinspection PhpIncludeInspection */",
"$",
"file",
"=",
"require",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"file",
")",
")",
"{",
"$",
"message",
"=",
"\"{$path... | Load configuration file.
@param string $path
@throws ConfigException
@return array | [
"Load",
"configuration",
"file",
"."
] | 9ec496b0dc2584f2e7e2a4e536b2ccef8737c7bd | https://github.com/vaccuum/config/blob/9ec496b0dc2584f2e7e2a4e536b2ccef8737c7bd/source/DirectoryReader.php#L31-L43 |
198,751 | ScaraMVC/Framework | src/Scara/Hashing/OpenSslHasher.php | OpenSslHasher.random_string | public function random_string($length = 32)
{
return substr(str_shuffle(str_repeat(
$x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
ceil($length / strlen($x))
)), 1, $length);
} | php | public function random_string($length = 32)
{
return substr(str_shuffle(str_repeat(
$x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
ceil($length / strlen($x))
)), 1, $length);
} | [
"public",
"function",
"random_string",
"(",
"$",
"length",
"=",
"32",
")",
"{",
"return",
"substr",
"(",
"str_shuffle",
"(",
"str_repeat",
"(",
"$",
"x",
"=",
"'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'",
",",
"ceil",
"(",
"$",
"length",
"/",... | Generates a random string based on given length.
Blatantly taken from StackOverflow: http://stackoverflow.com/a/13212994/1524676
@param int $length
@return string | [
"Generates",
"a",
"random",
"string",
"based",
"on",
"given",
"length",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Hashing/OpenSslHasher.php#L39-L45 |
198,752 | ScaraMVC/Framework | src/Scara/Hashing/OpenSslHasher.php | OpenSslHasher.tokenize | public function tokenize($iv, $string = '')
{
if (empty($string)) {
$string = $this->random_string();
}
return openssl_encrypt($string, 'AES-256-CBC', $this->_config->get('token'), 0, $iv);
} | php | public function tokenize($iv, $string = '')
{
if (empty($string)) {
$string = $this->random_string();
}
return openssl_encrypt($string, 'AES-256-CBC', $this->_config->get('token'), 0, $iv);
} | [
"public",
"function",
"tokenize",
"(",
"$",
"iv",
",",
"$",
"string",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"string",
")",
")",
"{",
"$",
"string",
"=",
"$",
"this",
"->",
"random_string",
"(",
")",
";",
"}",
"return",
"openssl_encrypt... | Generate a token using OpenSSL extensions.
@param string $iv
@param string $string
@return string | [
"Generate",
"a",
"token",
"using",
"OpenSSL",
"extensions",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Hashing/OpenSslHasher.php#L65-L72 |
198,753 | spoom-php/core | src/extension/Helper/Number.php | Number.isInteger | public static function isInteger( $input ): bool {
return self::is( $input ) && (string) (int) $input === (string) $input;
} | php | public static function isInteger( $input ): bool {
return self::is( $input ) && (string) (int) $input === (string) $input;
} | [
"public",
"static",
"function",
"isInteger",
"(",
"$",
"input",
")",
":",
"bool",
"{",
"return",
"self",
"::",
"is",
"(",
"$",
"input",
")",
"&&",
"(",
"string",
")",
"(",
"int",
")",
"$",
"input",
"===",
"(",
"string",
")",
"$",
"input",
";",
"}... | Check if the input is true integer number or can be converted from string into integer
@param mixed $input
@return bool | [
"Check",
"if",
"the",
"input",
"is",
"true",
"integer",
"number",
"or",
"can",
"be",
"converted",
"from",
"string",
"into",
"integer"
] | ea7184213352fa2fad7636927a019e5798734e04 | https://github.com/spoom-php/core/blob/ea7184213352fa2fad7636927a019e5798734e04/src/extension/Helper/Number.php#L33-L35 |
198,754 | spoom-php/core | src/extension/Helper/Number.php | Number.write | public static function write( $input, ?int $precision = null, $default = null ) {
if( !self::is( $input ) ) return $default;
else {
$input = self::cast( $input );
if( is_int( $precision ) ) return number_format( $input, $precision, '.', '' );
else if( is_int( $input ) ) return (string) $input... | php | public static function write( $input, ?int $precision = null, $default = null ) {
if( !self::is( $input ) ) return $default;
else {
$input = self::cast( $input );
if( is_int( $precision ) ) return number_format( $input, $precision, '.', '' );
else if( is_int( $input ) ) return (string) $input... | [
"public",
"static",
"function",
"write",
"(",
"$",
"input",
",",
"?",
"int",
"$",
"precision",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"is",
"(",
"$",
"input",
")",
")",
"return",
"$",
"default",
";"... | Convert numbers to string
@param mixed $input
@param int|null $precision Decimal count if not null
@param mixed $default Non-number inputs results
@return string|mixed | [
"Convert",
"numbers",
"to",
"string"
] | ea7184213352fa2fad7636927a019e5798734e04 | https://github.com/spoom-php/core/blob/ea7184213352fa2fad7636927a019e5798734e04/src/extension/Helper/Number.php#L86-L95 |
198,755 | spoom-php/core | src/extension/Helper/Number.php | Number.equal | public static function equal( $a, $b, int $precision = 0 ): bool {
return self::write( $a, $precision ) === self::write( $b, $precision );
} | php | public static function equal( $a, $b, int $precision = 0 ): bool {
return self::write( $a, $precision ) === self::write( $b, $precision );
} | [
"public",
"static",
"function",
"equal",
"(",
"$",
"a",
",",
"$",
"b",
",",
"int",
"$",
"precision",
"=",
"0",
")",
":",
"bool",
"{",
"return",
"self",
"::",
"write",
"(",
"$",
"a",
",",
"$",
"precision",
")",
"===",
"self",
"::",
"write",
"(",
... | Check if two number is equals. Can handle floats with precision
@param mixed $a
@param mixed $b
@param int $precision Precision used for the check
@return bool | [
"Check",
"if",
"two",
"number",
"is",
"equals",
".",
"Can",
"handle",
"floats",
"with",
"precision"
] | ea7184213352fa2fad7636927a019e5798734e04 | https://github.com/spoom-php/core/blob/ea7184213352fa2fad7636927a019e5798734e04/src/extension/Helper/Number.php#L106-L108 |
198,756 | agentmedia/phine-core | src/Core/Modules/Backend/UsergroupAssignmentForm.php | UsergroupAssignmentForm.BeforeInit | protected function BeforeInit()
{
$this->user = User::Schema()->ByID(Request::GetData('user'));
if (!$this->user || !self::Guard()->Allow(BackendAction::AssignGroups(), $this->user))
{
//TODO: Error message
Response::Redirect(BackendRouter::ModuleUrl(new UserList()));... | php | protected function BeforeInit()
{
$this->user = User::Schema()->ByID(Request::GetData('user'));
if (!$this->user || !self::Guard()->Allow(BackendAction::AssignGroups(), $this->user))
{
//TODO: Error message
Response::Redirect(BackendRouter::ModuleUrl(new UserList()));... | [
"protected",
"function",
"BeforeInit",
"(",
")",
"{",
"$",
"this",
"->",
"user",
"=",
"User",
"::",
"Schema",
"(",
")",
"->",
"ByID",
"(",
"Request",
"::",
"GetData",
"(",
"'user'",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"user",
"||",
... | Gets and checks the requested user
@return boolean False if processing can continue | [
"Gets",
"and",
"checks",
"the",
"requested",
"user"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/UsergroupAssignmentForm.php#L56-L65 |
198,757 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.getComment | public function getComment()
{
if (!$this->_commentFetched) {
$this->_comment = $this->_fetchComment();
$this->_commentFetched = true;
}
return $this->_comment;
} | php | public function getComment()
{
if (!$this->_commentFetched) {
$this->_comment = $this->_fetchComment();
$this->_commentFetched = true;
}
return $this->_comment;
} | [
"public",
"function",
"getComment",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_commentFetched",
")",
"{",
"$",
"this",
"->",
"_comment",
"=",
"$",
"this",
"->",
"_fetchComment",
"(",
")",
";",
"$",
"this",
"->",
"_commentFetched",
"=",
"true",... | Return table comment
@return string table comment | [
"Return",
"table",
"comment"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L142-L149 |
198,758 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.setComment | public function setComment($comment)
{
if ($comment != $this->getComment() and $this->_setComment($comment))
{
$this->_comment = $comment;
}
} | php | public function setComment($comment)
{
if ($comment != $this->getComment() and $this->_setComment($comment))
{
$this->_comment = $comment;
}
} | [
"public",
"function",
"setComment",
"(",
"$",
"comment",
")",
"{",
"if",
"(",
"$",
"comment",
"!=",
"$",
"this",
"->",
"getComment",
"(",
")",
"and",
"$",
"this",
"->",
"_setComment",
"(",
"$",
"comment",
")",
")",
"{",
"$",
"this",
"->",
"_comment",... | Set table comment
@param string $comment table comment | [
"Set",
"table",
"comment"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L155-L161 |
198,759 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable._fetchColumns | protected function _fetchColumns()
{
$columns = $this->_database->query(
'SELECT ' .
implode(',', $this->_informationSchemaColumns) .
' FROM information_schema.columns WHERE table_schema=? AND LOWER(table_name)=? ORDER BY ordinal_position',
array(
... | php | protected function _fetchColumns()
{
$columns = $this->_database->query(
'SELECT ' .
implode(',', $this->_informationSchemaColumns) .
' FROM information_schema.columns WHERE table_schema=? AND LOWER(table_name)=? ORDER BY ordinal_position',
array(
... | [
"protected",
"function",
"_fetchColumns",
"(",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"_database",
"->",
"query",
"(",
"'SELECT '",
".",
"implode",
"(",
"','",
",",
"$",
"this",
"->",
"_informationSchemaColumns",
")",
".",
"' FROM information_schema... | Fetch column information from the database
Invoked by the constructor, the default implementation queries
information_schema.columns for all columns belonging to this table. To
make this functional, subclasses must set
\Nada\Database\AbstractDatabase::$_tableSchema and, if necessary, extend
$_informationSchemaColumns ... | [
"Fetch",
"column",
"information",
"from",
"the",
"database"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L195-L212 |
198,760 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable._fetchConstraints | protected function _fetchConstraints()
{
$constraints = $this->_database->query(
<<<EOT
SELECT kcu.column_name
FROM information_schema.key_column_usage kcu
JOIN information_schema.table_constraints tc
USING (table_schema, table_name, constraint_sch... | php | protected function _fetchConstraints()
{
$constraints = $this->_database->query(
<<<EOT
SELECT kcu.column_name
FROM information_schema.key_column_usage kcu
JOIN information_schema.table_constraints tc
USING (table_schema, table_name, constraint_sch... | [
"protected",
"function",
"_fetchConstraints",
"(",
")",
"{",
"$",
"constraints",
"=",
"$",
"this",
"->",
"_database",
"->",
"query",
"(",
"\n <<<EOT\n SELECT kcu.column_name\n FROM information_schema.key_column_usage kcu\n JOIN information_... | Fetch constraint information from the database
Invoked by the constructor, the default implementation queries
information_schema.table_constraints and information_schema.key_column_usage.
To make this functional, subclasses must set
\Nada\Database\AbstractDatabase::$_tableSchema.
Only primary keys are recognized for ... | [
"Fetch",
"constraint",
"information",
"from",
"the",
"database"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L227-L249 |
198,761 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.requireColumn | public function requireColumn($name)
{
if ($name != strtolower($name)) {
throw new \DomainException('Column name must be lowercase: ' . $name);
}
if (!isset($this->_columns[$name])) {
throw new \RuntimeException('Undefined column: ' . $this->_name . '.' . $name);
... | php | public function requireColumn($name)
{
if ($name != strtolower($name)) {
throw new \DomainException('Column name must be lowercase: ' . $name);
}
if (!isset($this->_columns[$name])) {
throw new \RuntimeException('Undefined column: ' . $this->_name . '.' . $name);
... | [
"public",
"function",
"requireColumn",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"!=",
"strtolower",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"DomainException",
"(",
"'Column name must be lowercase: '",
".",
"$",
"name",
")",
";",
... | Force presence of column
@param string $name Column name to check for, must be lowercase
@throws \RuntimeException if column does not exist
@throws \DomainException if $name is not lowercase | [
"Force",
"presence",
"of",
"column"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L277-L286 |
198,762 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.alter | public function alter($operation)
{
return $this->_database->exec(
'ALTER TABLE ' .
$this->_database->prepareIdentifier($this->_name) .
' ' .
$operation
);
} | php | public function alter($operation)
{
return $this->_database->exec(
'ALTER TABLE ' .
$this->_database->prepareIdentifier($this->_name) .
' ' .
$operation
);
} | [
"public",
"function",
"alter",
"(",
"$",
"operation",
")",
"{",
"return",
"$",
"this",
"->",
"_database",
"->",
"exec",
"(",
"'ALTER TABLE '",
".",
"$",
"this",
"->",
"_database",
"->",
"prepareIdentifier",
"(",
"$",
"this",
"->",
"_name",
")",
".",
"' '... | Compose and execute an ALTER TABLE statement
This method simply appends the given operation to an "ALTER TABLE name "
statement and executes it via exec(). Since the operation syntax is often
DBMS-specific, this method is mostly useful for other NADA methods.
@param string $operation SQL fragment
@return mixed Return ... | [
"Compose",
"and",
"execute",
"an",
"ALTER",
"TABLE",
"statement"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L336-L344 |
198,763 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.addColumn | public final function addColumn(
$name,
$type,
$length=null,
$notnull=false,
$default=null,
$autoIncrement=false,
$comment = null
)
{
return $this->addColumnObject(
$this->_database->createColumn(
$name,
... | php | public final function addColumn(
$name,
$type,
$length=null,
$notnull=false,
$default=null,
$autoIncrement=false,
$comment = null
)
{
return $this->addColumnObject(
$this->_database->createColumn(
$name,
... | [
"public",
"final",
"function",
"addColumn",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"length",
"=",
"null",
",",
"$",
"notnull",
"=",
"false",
",",
"$",
"default",
"=",
"null",
",",
"$",
"autoIncrement",
"=",
"false",
",",
"$",
"comment",
"=",
... | Add a column using parameters
@param string $name Column name
@param string $type Datatype, one of \Nada\Column\AbstractColumn's TYPE_* constants
@param mixed $length Optional length specification
@param bool $notnull NOT NULL constraint (default: FALSE)
@param mixed $default Default value (DEFAULT: NULL)
@param bool $... | [
"Add",
"a",
"column",
"using",
"parameters"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L357-L378 |
198,764 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.addColumnObject | public function addColumnObject($column)
{
$name = $column->getName();
$this->forbidColumn($name);
$sql = 'ADD COLUMN ';
$sql .= $this->_database->prepareIdentifier($name);
$sql .= ' ';
$sql .= $column->getDefinition();
$this->alter($sql);
// Updat... | php | public function addColumnObject($column)
{
$name = $column->getName();
$this->forbidColumn($name);
$sql = 'ADD COLUMN ';
$sql .= $this->_database->prepareIdentifier($name);
$sql .= ' ';
$sql .= $column->getDefinition();
$this->alter($sql);
// Updat... | [
"public",
"function",
"addColumnObject",
"(",
"$",
"column",
")",
"{",
"$",
"name",
"=",
"$",
"column",
"->",
"getName",
"(",
")",
";",
"$",
"this",
"->",
"forbidColumn",
"(",
"$",
"name",
")",
";",
"$",
"sql",
"=",
"'ADD COLUMN '",
";",
"$",
"sql",
... | Add a column using a column object
@param \Nada\Column\AbstractColumn $column Column object
@return \Nada\Column\AbstractColumn object describing the generated column | [
"Add",
"a",
"column",
"using",
"a",
"column",
"object"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L387-L404 |
198,765 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.dropColumn | public function dropColumn($name)
{
$this->requireColumn($name);
$this->alter('DROP COLUMN ' . $this->_database->prepareIdentifier($name));
unset($this->_columns[$name]); // Update column cache
$this->_updateConstraints($name, null);
} | php | public function dropColumn($name)
{
$this->requireColumn($name);
$this->alter('DROP COLUMN ' . $this->_database->prepareIdentifier($name));
unset($this->_columns[$name]); // Update column cache
$this->_updateConstraints($name, null);
} | [
"public",
"function",
"dropColumn",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"requireColumn",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"alter",
"(",
"'DROP COLUMN '",
".",
"$",
"this",
"->",
"_database",
"->",
"prepareIdentifier",
"(",
"$",
... | Drop a column
@param string $name Column name | [
"Drop",
"a",
"column"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L410-L416 |
198,766 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable._updateConstraints | protected function _updateConstraints($oldColumnName, $newColumnName)
{
$columnIndex = null;
foreach ($this->_primaryKey as $index => $column) {
if ($oldColumnName == $column->getName()) {
$columnIndex = $index;
break;
}
}
if ($... | php | protected function _updateConstraints($oldColumnName, $newColumnName)
{
$columnIndex = null;
foreach ($this->_primaryKey as $index => $column) {
if ($oldColumnName == $column->getName()) {
$columnIndex = $index;
break;
}
}
if ($... | [
"protected",
"function",
"_updateConstraints",
"(",
"$",
"oldColumnName",
",",
"$",
"newColumnName",
")",
"{",
"$",
"columnIndex",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"_primaryKey",
"as",
"$",
"index",
"=>",
"$",
"column",
")",
"{",
"if",
... | Update constraints after renaming or dropping a column
This updates affected column names in all constraints and must be called
throm the renameColumn() and dropColumn() implementation.
@param string $oldColumnName Column name before renaming/dropping
@param string $newColumnName Column name after renaming, NULL for ... | [
"Update",
"constraints",
"after",
"renaming",
"or",
"dropping",
"a",
"column"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L457-L474 |
198,767 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.hasIndex | public function hasIndex($columns, $unique=false)
{
if (!is_array($columns)) {
$columns = array($columns);
}
foreach ($this->getIndexes() as $index) {
if ($index->isUnique() == $unique and $index->getColumns() == $columns) {
return true;
}
... | php | public function hasIndex($columns, $unique=false)
{
if (!is_array($columns)) {
$columns = array($columns);
}
foreach ($this->getIndexes() as $index) {
if ($index->isUnique() == $unique and $index->getColumns() == $columns) {
return true;
}
... | [
"public",
"function",
"hasIndex",
"(",
"$",
"columns",
",",
"$",
"unique",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"columns",
")",
")",
"{",
"$",
"columns",
"=",
"array",
"(",
"$",
"columns",
")",
";",
"}",
"foreach",
"(",
"... | Check for presence of index with given properties, ignoring index name
@param mixed $columns Column name or array of column names
@param bool $unique Unique index, default: false
@return bool | [
"Check",
"for",
"presence",
"of",
"index",
"with",
"given",
"properties",
"ignoring",
"index",
"name"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L536-L547 |
198,768 | hschletz/NADA | src/Table/AbstractTable.php | AbstractTable.toArray | public function toArray($assoc=false)
{
$data = array(
'name' => $this->_name,
'comment' => $this->getComment(),
);
foreach ($this->_columns as $name => $column) {
if ($assoc) {
$data['columns'][$name] = $column->toArray();
} el... | php | public function toArray($assoc=false)
{
$data = array(
'name' => $this->_name,
'comment' => $this->getComment(),
);
foreach ($this->_columns as $name => $column) {
if ($assoc) {
$data['columns'][$name] = $column->toArray();
} el... | [
"public",
"function",
"toArray",
"(",
"$",
"assoc",
"=",
"false",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"this",
"->",
"_name",
",",
"'comment'",
"=>",
"$",
"this",
"->",
"getComment",
"(",
")",
",",
")",
";",
"foreach",
"("... | Export table data to an associative array
The returned array has the following elements:
- **name**: the table name
- **columns**: array of columns (numeric or associative, depending on
$assoc). See \Nada\Column\AbstractColumn::toArray() for a description
of keys.
- **primary_key**: array of column names for primary ... | [
"Export",
"table",
"data",
"to",
"an",
"associative",
"array"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Table/AbstractTable.php#L567-L593 |
198,769 | ScaraMVC/Framework | src/Scara/Utils/UrlGenerator.php | UrlGenerator.to | public function to($url)
{
if ($url == '/' && $this->getRoot() == $url) {
return $url;
}
return $this->isValidUrl($url) ? $url : $this->generateUrl($url);
} | php | public function to($url)
{
if ($url == '/' && $this->getRoot() == $url) {
return $url;
}
return $this->isValidUrl($url) ? $url : $this->generateUrl($url);
} | [
"public",
"function",
"to",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"url",
"==",
"'/'",
"&&",
"$",
"this",
"->",
"getRoot",
"(",
")",
"==",
"$",
"url",
")",
"{",
"return",
"$",
"url",
";",
"}",
"return",
"$",
"this",
"->",
"isValidUrl",
"(",... | Generates a URL useful for anchor tags.
@param string $url - URL to generate from
@return string | [
"Generates",
"a",
"URL",
"useful",
"for",
"anchor",
"tags",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Utils/UrlGenerator.php#L57-L64 |
198,770 | ScaraMVC/Framework | src/Scara/Utils/UrlGenerator.php | UrlGenerator.redirect | public function redirect($url)
{
if (!$this->isValidUrl($url)) {
$url = $this->generateUrl($url);
}
header('Location: '.$url);
} | php | public function redirect($url)
{
if (!$this->isValidUrl($url)) {
$url = $this->generateUrl($url);
}
header('Location: '.$url);
} | [
"public",
"function",
"redirect",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidUrl",
"(",
"$",
"url",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"generateUrl",
"(",
"$",
"url",
")",
";",
"}",
"header",
"(",
"'Lo... | Redirect to given URL.
@param string $url - URL to generate from
@return void | [
"Redirect",
"to",
"given",
"URL",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Utils/UrlGenerator.php#L73-L80 |
198,771 | ScaraMVC/Framework | src/Scara/Utils/UrlGenerator.php | UrlGenerator.generateUrl | public function generateUrl($url)
{
$extern = false;
if ((0 === strrpos($url, 'http://'))
|| (0 === strrpos($url, 'https://'))) {
$extern = true;
}
$http = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
if (!$extern) {
return ($this... | php | public function generateUrl($url)
{
$extern = false;
if ((0 === strrpos($url, 'http://'))
|| (0 === strrpos($url, 'https://'))) {
$extern = true;
}
$http = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
if (!$extern) {
return ($this... | [
"public",
"function",
"generateUrl",
"(",
"$",
"url",
")",
"{",
"$",
"extern",
"=",
"false",
";",
"if",
"(",
"(",
"0",
"===",
"strrpos",
"(",
"$",
"url",
",",
"'http://'",
")",
")",
"||",
"(",
"0",
"===",
"strrpos",
"(",
"$",
"url",
",",
"'https:... | Used to generate a URL based on relative or absolute.
@param string $url - URL to generate from
@return string | [
"Used",
"to",
"generate",
"a",
"URL",
"based",
"on",
"relative",
"or",
"absolute",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Utils/UrlGenerator.php#L89-L105 |
198,772 | t-kanstantsin/fileupload | src/formatter/ImagineFactory.php | ImagineFactory.get | public static function get(string $type): ImagineInterface
{
switch ($type) {
case self::GD:
return new GdImagine();
case self::IMAGICK:
return new ImagickImagine();
case self::GMAGICK:
return new GmagickImagine();
... | php | public static function get(string $type): ImagineInterface
{
switch ($type) {
case self::GD:
return new GdImagine();
case self::IMAGICK:
return new ImagickImagine();
case self::GMAGICK:
return new GmagickImagine();
... | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"type",
")",
":",
"ImagineInterface",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"self",
"::",
"GD",
":",
"return",
"new",
"GdImagine",
"(",
")",
";",
"case",
"self",
"::",
"IMAGICK",
... | Create imagine object for given driver
@param string $type
@return ImagineInterface
@throws \Imagine\Exception\RuntimeException
@throws InvalidConfigException | [
"Create",
"imagine",
"object",
"for",
"given",
"driver"
] | d6317a9b9b36d992f09affe3900ef7d7ddfd855f | https://github.com/t-kanstantsin/fileupload/blob/d6317a9b9b36d992f09affe3900ef7d7ddfd855f/src/formatter/ImagineFactory.php#L30-L42 |
198,773 | wearenolte/wp-acf | src/Acf/Transforms/Image.php | Image.get_image_fields | public static function get_image_fields( $field, $attachment_id, $sub_field = false ) {
$size = apply_filters( Filter::IMAGE, false, $field, $sub_field );
if ( ! $size ) {
return $attachment_id;
}
$src = wp_get_attachment_image_src( $attachment_id, $size );
if ( ! $src ) {
return $attachment_id;
}
... | php | public static function get_image_fields( $field, $attachment_id, $sub_field = false ) {
$size = apply_filters( Filter::IMAGE, false, $field, $sub_field );
if ( ! $size ) {
return $attachment_id;
}
$src = wp_get_attachment_image_src( $attachment_id, $size );
if ( ! $src ) {
return $attachment_id;
}
... | [
"public",
"static",
"function",
"get_image_fields",
"(",
"$",
"field",
",",
"$",
"attachment_id",
",",
"$",
"sub_field",
"=",
"false",
")",
"{",
"$",
"size",
"=",
"apply_filters",
"(",
"Filter",
"::",
"IMAGE",
",",
"false",
",",
"$",
"field",
",",
"$",
... | Get image fields.
@param string $field Field
@param int $attachment_id The image id.
@param bool $sub_field Sub field (only if it's a repeater)
@return array | [
"Get",
"image",
"fields",
"."
] | 2f5093438d637fa0eca42ad6d10f6b433ec078b2 | https://github.com/wearenolte/wp-acf/blob/2f5093438d637fa0eca42ad6d10f6b433ec078b2/src/Acf/Transforms/Image.php#L43-L62 |
198,774 | mamasu/mama-parameter | src/parameter/Session.php | Session.setFlashVar | public function setFlashVar($key, $value) {
$this->flashVar[$key] = $value;
$this->set($key, $value);
} | php | public function setFlashVar($key, $value) {
$this->flashVar[$key] = $value;
$this->set($key, $value);
} | [
"public",
"function",
"setFlashVar",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"flashVar",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"
] | Set session var that is only valid for only one request.
@param string $key
@param mixed $value | [
"Set",
"session",
"var",
"that",
"is",
"only",
"valid",
"for",
"only",
"one",
"request",
"."
] | d48529a75d471da2f9f80b9c2ea1fc3d57f0ba4d | https://github.com/mamasu/mama-parameter/blob/d48529a75d471da2f9f80b9c2ea1fc3d57f0ba4d/src/parameter/Session.php#L47-L50 |
198,775 | mamasu/mama-parameter | src/parameter/Session.php | Session.removeFlashVar | public function removeFlashVar() {
foreach ($this->flashVar as $key => $value) {
unset($this->storage[$key]);
}
$this->flashVar = array();
} | php | public function removeFlashVar() {
foreach ($this->flashVar as $key => $value) {
unset($this->storage[$key]);
}
$this->flashVar = array();
} | [
"public",
"function",
"removeFlashVar",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"flashVar",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"key",
"]",
")",
";",
"}",
"$",
"this",
"-... | Remove the FlashVars and the respective vars in the storage var. | [
"Remove",
"the",
"FlashVars",
"and",
"the",
"respective",
"vars",
"in",
"the",
"storage",
"var",
"."
] | d48529a75d471da2f9f80b9c2ea1fc3d57f0ba4d | https://github.com/mamasu/mama-parameter/blob/d48529a75d471da2f9f80b9c2ea1fc3d57f0ba4d/src/parameter/Session.php#L55-L60 |
198,776 | devlabmtl/haven-core | Entity/File/File.php | File.moveToPermanent | public function moveToPermanent() {
// to keep the save as it is, I need to get the path without the filename and also remove the /tmp
$destination_path = str_replace($this->getFileName(), '', $this->getPathName());
// if there is an error when moving the file, an exception will
// be aut... | php | public function moveToPermanent() {
// to keep the save as it is, I need to get the path without the filename and also remove the /tmp
$destination_path = str_replace($this->getFileName(), '', $this->getPathName());
// if there is an error when moving the file, an exception will
// be aut... | [
"public",
"function",
"moveToPermanent",
"(",
")",
"{",
"// to keep the save as it is, I need to get the path without the filename and also remove the /tmp",
"$",
"destination_path",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"getFileName",
"(",
")",
",",
"''",
",",
... | When the file persists, if it is in the tmp subdir, it will be move before save.
@ORM\PostPersist()
@ORM\PostUpdate() | [
"When",
"the",
"file",
"persists",
"if",
"it",
"is",
"in",
"the",
"tmp",
"subdir",
"it",
"will",
"be",
"move",
"before",
"save",
"."
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Entity/File/File.php#L209-L218 |
198,777 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/dispatcher/View.php | View.getRedirect | public function getRedirect()
{
if (!$this->isRedirect())
return null;
if ($this->isPermanentRedirect())
return substr($this->name, 19);
return substr($this->name, 9);
} | php | public function getRedirect()
{
if (!$this->isRedirect())
return null;
if ($this->isPermanentRedirect())
return substr($this->name, 19);
return substr($this->name, 9);
} | [
"public",
"function",
"getRedirect",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isRedirect",
"(",
")",
")",
"return",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"isPermanentRedirect",
"(",
")",
")",
"return",
"substr",
"(",
"$",
"this",
"->",... | Returns the redirect value for this view, providing it's a redirect
@return string | [
"Returns",
"the",
"redirect",
"value",
"for",
"this",
"view",
"providing",
"it",
"s",
"a",
"redirect"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/dispatcher/View.php#L123-L132 |
198,778 | OxfordInfoLabs/kinikit-core | src/Util/Serialisation/XML/XMLToObjectConverter.php | XMLToObjectConverter.convert | public function convert($xmlString) {
$dom = new \DOMDocument ();
$dom->loadXML($xmlString);
$documentElement = $dom->documentElement;
return $documentElement ? $this->convertDOM($dom->documentElement) : $xmlString;
} | php | public function convert($xmlString) {
$dom = new \DOMDocument ();
$dom->loadXML($xmlString);
$documentElement = $dom->documentElement;
return $documentElement ? $this->convertDOM($dom->documentElement) : $xmlString;
} | [
"public",
"function",
"convert",
"(",
"$",
"xmlString",
")",
"{",
"$",
"dom",
"=",
"new",
"\\",
"DOMDocument",
"(",
")",
";",
"$",
"dom",
"->",
"loadXML",
"(",
"$",
"xmlString",
")",
";",
"$",
"documentElement",
"=",
"$",
"dom",
"->",
"documentElement"... | Main conversion API method to convert an XML string into an object tree.
@param unknown_type $xmlString | [
"Main",
"conversion",
"API",
"method",
"to",
"convert",
"an",
"XML",
"string",
"into",
"an",
"object",
"tree",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Serialisation/XML/XMLToObjectConverter.php#L67-L74 |
198,779 | zapheus/zapheus | src/Http/Message/File.php | File.stream | public function stream()
{
$stream = fopen($this->file, 'r');
$stream = $stream === false ? null : $stream;
return new Stream($stream);
} | php | public function stream()
{
$stream = fopen($this->file, 'r');
$stream = $stream === false ? null : $stream;
return new Stream($stream);
} | [
"public",
"function",
"stream",
"(",
")",
"{",
"$",
"stream",
"=",
"fopen",
"(",
"$",
"this",
"->",
"file",
",",
"'r'",
")",
";",
"$",
"stream",
"=",
"$",
"stream",
"===",
"false",
"?",
"null",
":",
"$",
"stream",
";",
"return",
"new",
"Stream",
... | Returns a stream representing the uploaded file.
@return \Zapheus\Http\Message\StreamInterface
@throws \RuntimeException | [
"Returns",
"a",
"stream",
"representing",
"the",
"uploaded",
"file",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Http/Message/File.php#L118-L125 |
198,780 | Game-scan/Core | src/Request/Api/Http/Client.php | Client.getConfig | protected function getConfig()
{
$config = array();
$config['headers'] = $this->headers;
$config['config'] = array(
'curl' => $this->curlConfig
);
$config['query'] = $this->parameters;
$config['cookies'] = true;
return $config;
} | php | protected function getConfig()
{
$config = array();
$config['headers'] = $this->headers;
$config['config'] = array(
'curl' => $this->curlConfig
);
$config['query'] = $this->parameters;
$config['cookies'] = true;
return $config;
} | [
"protected",
"function",
"getConfig",
"(",
")",
"{",
"$",
"config",
"=",
"array",
"(",
")",
";",
"$",
"config",
"[",
"'headers'",
"]",
"=",
"$",
"this",
"->",
"headers",
";",
"$",
"config",
"[",
"'config'",
"]",
"=",
"array",
"(",
"'curl'",
"=>",
"... | Get http request config for guzzle
@return array | [
"Get",
"http",
"request",
"config",
"for",
"guzzle"
] | 777652235678bbd9c3ea20344b998a01359339bd | https://github.com/Game-scan/Core/blob/777652235678bbd9c3ea20344b998a01359339bd/src/Request/Api/Http/Client.php#L96-L106 |
198,781 | itkg/core | src/Itkg/Core/Command/Formatter/CommandLineFormatter.php | CommandLineFormatter.formatException | public function formatException(\Exception $exception, array $record = array())
{
$record['msg'] = $this->normalizeException($exception);
return $this->format($record);
} | php | public function formatException(\Exception $exception, array $record = array())
{
$record['msg'] = $this->normalizeException($exception);
return $this->format($record);
} | [
"public",
"function",
"formatException",
"(",
"\\",
"Exception",
"$",
"exception",
",",
"array",
"$",
"record",
"=",
"array",
"(",
")",
")",
"{",
"$",
"record",
"[",
"'msg'",
"]",
"=",
"$",
"this",
"->",
"normalizeException",
"(",
"$",
"exception",
")",
... | Format exception with normalizer
And replace msg record with formatted exception
@param \Exception $exception
@param array $record
@return array|mixed|string | [
"Format",
"exception",
"with",
"normalizer",
"And",
"replace",
"msg",
"record",
"with",
"formatted",
"exception"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Command/Formatter/CommandLineFormatter.php#L33-L38 |
198,782 | cubicmushroom/valueobjects | src/Structure/KeyValuePair.php | KeyValuePair.fromNative | public static function fromNative()
{
$args = func_get_args();
if (count($args) != 2) {
throw new \BadMethodCallException('This methods expects two arguments. One for the key and one for the value.');
}
$keyString = \strval($args[0]);
$valueString = \strval($a... | php | public static function fromNative()
{
$args = func_get_args();
if (count($args) != 2) {
throw new \BadMethodCallException('This methods expects two arguments. One for the key and one for the value.');
}
$keyString = \strval($args[0]);
$valueString = \strval($a... | [
"public",
"static",
"function",
"fromNative",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"!=",
"2",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'This methods expects two a... | Returns a KeyValuePair from native PHP arguments evaluated as strings
@param string $key
@param string $value
@return self
@throws \InvalidArgumentException | [
"Returns",
"a",
"KeyValuePair",
"from",
"native",
"PHP",
"arguments",
"evaluated",
"as",
"strings"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Structure/KeyValuePair.php#L25-L39 |
198,783 | cubicmushroom/valueobjects | src/Structure/KeyValuePair.php | KeyValuePair.sameValueAs | public function sameValueAs(ValueObjectInterface $keyValuePair)
{
if (false === Util::classEquals($this, $keyValuePair)) {
return false;
}
return $this->getKey()->sameValueAs($keyValuePair->getKey()) && $this->getValue()->sameValueAs($keyValuePair->getValue());
} | php | public function sameValueAs(ValueObjectInterface $keyValuePair)
{
if (false === Util::classEquals($this, $keyValuePair)) {
return false;
}
return $this->getKey()->sameValueAs($keyValuePair->getKey()) && $this->getValue()->sameValueAs($keyValuePair->getValue());
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"keyValuePair",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"keyValuePair",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
... | Tells whether two KeyValuePair are equal
@param ValueObjectInterface $keyValuePair
@return bool | [
"Tells",
"whether",
"two",
"KeyValuePair",
"are",
"equal"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Structure/KeyValuePair.php#L59-L66 |
198,784 | Retentio/Boomgo | src/Boomgo/Builder/Definition.php | Definition.fromArray | private function fromArray(array $metadata)
{
// @TODO Throw exception if mandatory parameters Attribute & Key are missing !!
$defaults = array('type' => 'mixed', 'mappedClass' => null);
$data = array_merge($defaults, $metadata);
$type = $data['type'];
$mappedClass = $data[... | php | private function fromArray(array $metadata)
{
// @TODO Throw exception if mandatory parameters Attribute & Key are missing !!
$defaults = array('type' => 'mixed', 'mappedClass' => null);
$data = array_merge($defaults, $metadata);
$type = $data['type'];
$mappedClass = $data[... | [
"private",
"function",
"fromArray",
"(",
"array",
"$",
"metadata",
")",
"{",
"// @TODO Throw exception if mandatory parameters Attribute & Key are missing !!",
"$",
"defaults",
"=",
"array",
"(",
"'type'",
"=>",
"'mixed'",
",",
"'mappedClass'",
"=>",
"null",
")",
";",
... | Import an array of metadata
@param array $metadata
@return void | [
"Import",
"an",
"array",
"of",
"metadata"
] | 95cc53777425dd76cd0034046fa4f9e72c04d73a | https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Builder/Definition.php#L283-L323 |
198,785 | phossa/phossa-route | src/Phossa/Route/Collector/Collector.php | Collector.filtering | protected function filtering(
RouteInterface $route,
RequestInterface $request
) {
foreach ($route->getFilters() as $field => $filter) {
list($grpName, $keyName) = explode('.', $field, 2);
switch ($grpName) {
case 'session':
$agains... | php | protected function filtering(
RouteInterface $route,
RequestInterface $request
) {
foreach ($route->getFilters() as $field => $filter) {
list($grpName, $keyName) = explode('.', $field, 2);
switch ($grpName) {
case 'session':
$agains... | [
"protected",
"function",
"filtering",
"(",
"RouteInterface",
"$",
"route",
",",
"RequestInterface",
"$",
"request",
")",
"{",
"foreach",
"(",
"$",
"route",
"->",
"getFilters",
"(",
")",
"as",
"$",
"field",
"=>",
"$",
"filter",
")",
"{",
"list",
"(",
"$",... | Filtering in route
@param RouteInterface $route
@param RequestInterface $request
@return bool
@access protected | [
"Filtering",
"in",
"route"
] | fdcc1c814b8b1692a60d433d3c085e6c7a923acc | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Collector/Collector.php#L207-L237 |
198,786 | freialib/hlin.tools | src/Response.php | Response.responseCode | function responseCode($code = null) {
if ($code === null) {
return $this->http_response_code;
}
else { // $code !== null, act as setter
$this->http_response_code = $code;
return $this;
}
} | php | function responseCode($code = null) {
if ($code === null) {
return $this->http_response_code;
}
else { // $code !== null, act as setter
$this->http_response_code = $code;
return $this;
}
} | [
"function",
"responseCode",
"(",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"code",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"http_response_code",
";",
"}",
"else",
"{",
"// $code !== null, act as setter",
"$",
"this",
"->",
"http_res... | Equivalent in functionality to http_response_code from PHP
@see http://www.php.net/manual/en/function.http-response-code.php
@return static $this | [
"Equivalent",
"in",
"functionality",
"to",
"http_response_code",
"from",
"PHP"
] | 42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7 | https://github.com/freialib/hlin.tools/blob/42ad9e9fe081918d2ee5d52b72d174ccdcf7cbe7/src/Response.php#L25-L33 |
198,787 | bseddon/XPath20 | Proxy/FloatProxy.php | FloatProxy.getOtherValue | private function getOtherValue( $val )
{
/**
* @var XPath2Item $otherValue
*/
$otherValue = $val->getValue();
return $otherValue instanceof XPath2Item
? $otherValue->getValue()
: $otherValue;
} | php | private function getOtherValue( $val )
{
/**
* @var XPath2Item $otherValue
*/
$otherValue = $val->getValue();
return $otherValue instanceof XPath2Item
? $otherValue->getValue()
: $otherValue;
} | [
"private",
"function",
"getOtherValue",
"(",
"$",
"val",
")",
"{",
"/**\r\n\t\t * @var XPath2Item $otherValue\r\n\t\t */",
"$",
"otherValue",
"=",
"$",
"val",
"->",
"getValue",
"(",
")",
";",
"return",
"$",
"otherValue",
"instanceof",
"XPath2Item",
"?",
"$",
"othe... | Convert an XPath2Item value to a native float or return the original value
@param FloatProxy $val
@return float | [
"Convert",
"an",
"XPath2Item",
"value",
"to",
"a",
"native",
"float",
"or",
"return",
"the",
"original",
"value"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Proxy/FloatProxy.php#L125-L134 |
198,788 | phossa/phossa-route | src/Phossa/Route/Dispatcher.php | Dispatcher.addGet | public function addGet(
/*# string */ $pathPattern,
$handler = null,
array $defaultValues = []
) {
$this->getCollectors()[0]->addGet(
$pathPattern,
$handler,
$defaultValues
);
return $this;
} | php | public function addGet(
/*# string */ $pathPattern,
$handler = null,
array $defaultValues = []
) {
$this->getCollectors()[0]->addGet(
$pathPattern,
$handler,
$defaultValues
);
return $this;
} | [
"public",
"function",
"addGet",
"(",
"/*# string */",
"$",
"pathPattern",
",",
"$",
"handler",
"=",
"null",
",",
"array",
"$",
"defaultValues",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"getCollectors",
"(",
")",
"[",
"0",
"]",
"->",
"addGet",
"(",
... | Add a 'GET,HEAD' route to the first collector
{@inheritDoc} | [
"Add",
"a",
"GET",
"HEAD",
"route",
"to",
"the",
"first",
"collector"
] | fdcc1c814b8b1692a60d433d3c085e6c7a923acc | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Dispatcher.php#L191-L202 |
198,789 | phossa/phossa-route | src/Phossa/Route/Dispatcher.php | Dispatcher.addPost | public function addPost(
/*# string */ $pathPattern,
$handler = null,
array $defaultValues = []
) {
$this->getCollectors()[0]->addPost(
$pathPattern,
$handler,
$defaultValues
);
return $this;
} | php | public function addPost(
/*# string */ $pathPattern,
$handler = null,
array $defaultValues = []
) {
$this->getCollectors()[0]->addPost(
$pathPattern,
$handler,
$defaultValues
);
return $this;
} | [
"public",
"function",
"addPost",
"(",
"/*# string */",
"$",
"pathPattern",
",",
"$",
"handler",
"=",
"null",
",",
"array",
"$",
"defaultValues",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"getCollectors",
"(",
")",
"[",
"0",
"]",
"->",
"addPost",
"(",... | Add a 'POST' route to the first collector
{@inheritDoc} | [
"Add",
"a",
"POST",
"route",
"to",
"the",
"first",
"collector"
] | fdcc1c814b8b1692a60d433d3c085e6c7a923acc | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Dispatcher.php#L209-L220 |
198,790 | phossa/phossa-route | src/Phossa/Route/Dispatcher.php | Dispatcher.matchRoute | protected function matchRoute()/*# : bool */
{
foreach ($this->getCollectors() as $coll) {
if ($coll->matchRoute($this->result)) {
return true;
}
}
return false;
} | php | protected function matchRoute()/*# : bool */
{
foreach ($this->getCollectors() as $coll) {
if ($coll->matchRoute($this->result)) {
return true;
}
}
return false;
} | [
"protected",
"function",
"matchRoute",
"(",
")",
"/*# : bool */",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getCollectors",
"(",
")",
"as",
"$",
"coll",
")",
"{",
"if",
"(",
"$",
"coll",
"->",
"matchRoute",
"(",
"$",
"this",
"->",
"result",
")",
")",
... | Match routes in collectors
@return bool
@access protected | [
"Match",
"routes",
"in",
"collectors"
] | fdcc1c814b8b1692a60d433d3c085e6c7a923acc | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Dispatcher.php#L228-L236 |
198,791 | phossa/phossa-route | src/Phossa/Route/Dispatcher.php | Dispatcher.executeHandler | protected function executeHandler()/*# : bool */
{
// search handler
$handler = $this->result->getHandler();
if (is_null($handler)) {
// matched, but no handler found
return $this->defaultHandler();
} else {
$callable = $this->resolver->resolve($h... | php | protected function executeHandler()/*# : bool */
{
// search handler
$handler = $this->result->getHandler();
if (is_null($handler)) {
// matched, but no handler found
return $this->defaultHandler();
} else {
$callable = $this->resolver->resolve($h... | [
"protected",
"function",
"executeHandler",
"(",
")",
"/*# : bool */",
"{",
"// search handler",
"$",
"handler",
"=",
"$",
"this",
"->",
"result",
"->",
"getHandler",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"handler",
")",
")",
"{",
"// matched, but no... | Execute handler from result
@return bool
@access protected | [
"Execute",
"handler",
"from",
"result"
] | fdcc1c814b8b1692a60d433d3c085e6c7a923acc | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Dispatcher.php#L261-L283 |
198,792 | phossa/phossa-route | src/Phossa/Route/Dispatcher.php | Dispatcher.defaultHandler | protected function defaultHandler()
{
if ($this->runExtensions(self::BEFORE_DEFAULT, $this->result)) {
$status = $this->result->getStatus();
$handler = $this->getHandler($status);
if ($handler) {
$handler($this->result);
} else {
... | php | protected function defaultHandler()
{
if ($this->runExtensions(self::BEFORE_DEFAULT, $this->result)) {
$status = $this->result->getStatus();
$handler = $this->getHandler($status);
if ($handler) {
$handler($this->result);
} else {
... | [
"protected",
"function",
"defaultHandler",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"runExtensions",
"(",
"self",
"::",
"BEFORE_DEFAULT",
",",
"$",
"this",
"->",
"result",
")",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"result",
"->",
"getSt... | Execute dispatcher's default handler
@return false
@access protected | [
"Execute",
"dispatcher",
"s",
"default",
"handler"
] | fdcc1c814b8b1692a60d433d3c085e6c7a923acc | https://github.com/phossa/phossa-route/blob/fdcc1c814b8b1692a60d433d3c085e6c7a923acc/src/Phossa/Route/Dispatcher.php#L291-L304 |
198,793 | mylxsw/FocusPHP | src/MVC/Router.php | Router.isMatched | public function isMatched($pathinfo, $index)
{
$pathinfo = $this->_urlRewrite($pathinfo);
if (!empty($pathinfo)) {
$res = explode('/', $pathinfo);
$this->_controllerName = empty($res[0]) ? $this->_controllerName : ucfirst($res[0]);
if (count($res) >= 2) {
... | php | public function isMatched($pathinfo, $index)
{
$pathinfo = $this->_urlRewrite($pathinfo);
if (!empty($pathinfo)) {
$res = explode('/', $pathinfo);
$this->_controllerName = empty($res[0]) ? $this->_controllerName : ucfirst($res[0]);
if (count($res) >= 2) {
... | [
"public",
"function",
"isMatched",
"(",
"$",
"pathinfo",
",",
"$",
"index",
")",
"{",
"$",
"pathinfo",
"=",
"$",
"this",
"->",
"_urlRewrite",
"(",
"$",
"pathinfo",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"pathinfo",
")",
")",
"{",
"$",
"res",
... | Determine whether the routing rules is matched.
@param string $pathinfo pathinfo
@param int $index rule index
@return bool | [
"Determine",
"whether",
"the",
"routing",
"rules",
"is",
"matched",
"."
] | 33922bacbea66f11f874d991d7308a36cdf5831a | https://github.com/mylxsw/FocusPHP/blob/33922bacbea66f11f874d991d7308a36cdf5831a/src/MVC/Router.php#L43-L80 |
198,794 | mglaman/toolstack-helper | src/Toolstack.php | Toolstack.getStackByType | public static function getStackByType($type)
{
foreach (self::getStacks() as $stack) {
if ($stack->isType($type)) {
return $stack;
}
}
return new Stacks\NullStack();
} | php | public static function getStackByType($type)
{
foreach (self::getStacks() as $stack) {
if ($stack->isType($type)) {
return $stack;
}
}
return new Stacks\NullStack();
} | [
"public",
"static",
"function",
"getStackByType",
"(",
"$",
"type",
")",
"{",
"foreach",
"(",
"self",
"::",
"getStacks",
"(",
")",
"as",
"$",
"stack",
")",
"{",
"if",
"(",
"$",
"stack",
"->",
"isType",
"(",
"$",
"type",
")",
")",
"{",
"return",
"$"... | Returns a stack based on type.
@param $type
@return \mglaman\Toolstack\Stacks\StacksInterface | [
"Returns",
"a",
"stack",
"based",
"on",
"type",
"."
] | 1b3b93ac284a6c77286988b5d41c75509dd3dc20 | https://github.com/mglaman/toolstack-helper/blob/1b3b93ac284a6c77286988b5d41c75509dd3dc20/src/Toolstack.php#L35-L43 |
198,795 | mglaman/toolstack-helper | src/Toolstack.php | Toolstack.inspect | public static function inspect($dir)
{
if (!is_dir($dir)) {
throw new FileNotFoundException(sprintf('Directory "%s" does not exist.', $dir));
}
foreach (self::getStacks() as $stack) {
if ($stack->inspect($dir) === true) {
return $stack;
}
... | php | public static function inspect($dir)
{
if (!is_dir($dir)) {
throw new FileNotFoundException(sprintf('Directory "%s" does not exist.', $dir));
}
foreach (self::getStacks() as $stack) {
if ($stack->inspect($dir) === true) {
return $stack;
}
... | [
"public",
"static",
"function",
"inspect",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dir",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"sprintf",
"(",
"'Directory \"%s\" does not exist.'",
",",
"$",
"dir",
")",
")",
... | Inspects directory with stacks.
@param $dir
@return \mglaman\Toolstack\Stacks\StacksInterface | [
"Inspects",
"directory",
"with",
"stacks",
"."
] | 1b3b93ac284a6c77286988b5d41c75509dd3dc20 | https://github.com/mglaman/toolstack-helper/blob/1b3b93ac284a6c77286988b5d41c75509dd3dc20/src/Toolstack.php#L52-L66 |
198,796 | AnonymPHP/Anonym-Route | AccessDispatcher.php | AccessDispatcher.process | public function process($access = '')
{
if (is_array($access)) {
if (isset($access['name'])) {
$name = $access['name'];
if (isset($this->access[$name])) {
$accessInstance = $this->access[$name];
$accessInstance = new $acces... | php | public function process($access = '')
{
if (is_array($access)) {
if (isset($access['name'])) {
$name = $access['name'];
if (isset($this->access[$name])) {
$accessInstance = $this->access[$name];
$accessInstance = new $acces... | [
"public",
"function",
"process",
"(",
"$",
"access",
"=",
"''",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"access",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"access",
"[",
"'name'",
"]",
")",
")",
"{",
"$",
"name",
"=",
"$",
"access",
"[",... | Process the array
@param string $access the array of route access
@return bool | [
"Process",
"the",
"array"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/AccessDispatcher.php#L54-L81 |
198,797 | DoSomething/mb-toolbox | src/MB_Toolbox_BaseConsumer.php | MB_Toolbox_BaseConsumer.isSerialized | protected function isSerialized($message)
{
$this->statHat->ezCount('MB_Toolbox: MB_Toolbox_BaseConsumer: isSerialized', 1);
return ($message == serialize(false) || @unserialize($message) !== false);
} | php | protected function isSerialized($message)
{
$this->statHat->ezCount('MB_Toolbox: MB_Toolbox_BaseConsumer: isSerialized', 1);
return ($message == serialize(false) || @unserialize($message) !== false);
} | [
"protected",
"function",
"isSerialized",
"(",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"statHat",
"->",
"ezCount",
"(",
"'MB_Toolbox: MB_Toolbox_BaseConsumer: isSerialized'",
",",
"1",
")",
";",
"return",
"(",
"$",
"message",
"==",
"serialize",
"(",
"false",... | Detect if the message is in seralized format.
Originally the Message Broker system used seralization to format messages as all of the producers and
consumers are PHP based applications. To support microservices in other languages a more genaral JSON
format is being used for message formatting.
@param string $message
... | [
"Detect",
"if",
"the",
"message",
"is",
"in",
"seralized",
"format",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox_BaseConsumer.php#L151-L155 |
198,798 | DoSomething/mb-toolbox | src/MB_Toolbox_BaseConsumer.php | MB_Toolbox_BaseConsumer.reportErrorPayload | protected function reportErrorPayload()
{
$errorPayload = $this->message;
unset($errorPayload['payload']);
unset($errorPayload['original']);
echo '-> message: ' . print_r($errorPayload, true), PHP_EOL;
$this->statHat->ezCount('MB_Toolbox: MB_Toolbox_BaseConsumer: reportErrorPayload', 1);
} | php | protected function reportErrorPayload()
{
$errorPayload = $this->message;
unset($errorPayload['payload']);
unset($errorPayload['original']);
echo '-> message: ' . print_r($errorPayload, true), PHP_EOL;
$this->statHat->ezCount('MB_Toolbox: MB_Toolbox_BaseConsumer: reportErrorPayload', 1);
} | [
"protected",
"function",
"reportErrorPayload",
"(",
")",
"{",
"$",
"errorPayload",
"=",
"$",
"this",
"->",
"message",
";",
"unset",
"(",
"$",
"errorPayload",
"[",
"'payload'",
"]",
")",
";",
"unset",
"(",
"$",
"errorPayload",
"[",
"'original'",
"]",
")",
... | Log payload with RabbitMQ objects removed for clarity.
@return null | [
"Log",
"payload",
"with",
"RabbitMQ",
"objects",
"removed",
"for",
"clarity",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox_BaseConsumer.php#L197-L205 |
198,799 | DoSomething/mb-toolbox | src/MB_Toolbox_BaseConsumer.php | MB_Toolbox_BaseConsumer.throttle | protected function throttle($maxMessageRate)
{
$this->throttleMessageCount++;
// Reset the number of processed message by each second
if ($this->throttleSecondStamp != date('s')) {
$this->throttleSecondStamp = date('s');
$this->throttleMessageCount = 0;
}
// Trigger processing delay... | php | protected function throttle($maxMessageRate)
{
$this->throttleMessageCount++;
// Reset the number of processed message by each second
if ($this->throttleSecondStamp != date('s')) {
$this->throttleSecondStamp = date('s');
$this->throttleMessageCount = 0;
}
// Trigger processing delay... | [
"protected",
"function",
"throttle",
"(",
"$",
"maxMessageRate",
")",
"{",
"$",
"this",
"->",
"throttleMessageCount",
"++",
";",
"// Reset the number of processed message by each second",
"if",
"(",
"$",
"this",
"->",
"throttleSecondStamp",
"!=",
"date",
"(",
"'s'",
... | Throddle the rate the consumer processes messages.
@param integer $maxMessageRate
The number of messages to process per second before triggering a "pause". Higher values allow for greater
processing velosity / messages per second.
@return null | [
"Throddle",
"the",
"rate",
"the",
"consumer",
"processes",
"messages",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox_BaseConsumer.php#L216-L236 |
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.