repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.setClientAgent | public function setClientAgent($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->client_agent !== $v) {
$this->client_agent = $v;
$this->modifiedColumns[LoginLogTableMap::COL_CLIENT_AGENT] = true;
}
return $this;
} | php | public function setClientAgent($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->client_agent !== $v) {
$this->client_agent = $v;
$this->modifiedColumns[LoginLogTableMap::COL_CLIENT_AGENT] = true;
}
return $this;
} | [
"public",
"function",
"setClientAgent",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"client_agent",
"!==",
"$",
"v",
")",
"{",
"$"... | Set the value of [client_agent] column.
@param string $v new value
@return $this|\Alchemy\Component\Cerberus\Model\LoginLog The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"client_agent",
"]",
"column",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L718-L730 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.setClientPlatform | public function setClientPlatform($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->client_platform !== $v) {
$this->client_platform = $v;
$this->modifiedColumns[LoginLogTableMap::COL_CLIENT_PLATFORM] = true;
}
return $this;
} | php | public function setClientPlatform($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->client_platform !== $v) {
$this->client_platform = $v;
$this->modifiedColumns[LoginLogTableMap::COL_CLIENT_PLATFORM] = true;
}
return $this;
} | [
"public",
"function",
"setClientPlatform",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"client_platform",
"!==",
"$",
"v",
")",
"{",... | Set the value of [client_platform] column.
@param string $v new value
@return $this|\Alchemy\Component\Cerberus\Model\LoginLog The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"client_platform",
"]",
"column",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L738-L750 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.doInsert | protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[LoginLogTableMap::COL_ID] = true;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . LoginLo... | php | protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[LoginLogTableMap::COL_ID] = true;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . LoginLo... | [
"protected",
"function",
"doInsert",
"(",
"ConnectionInterface",
"$",
"con",
")",
"{",
"$",
"modifiedColumns",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"LoginLogTableMap",
"::",
"COL_ID",
"]",
"="... | Insert the row in the database.
@param ConnectionInterface $con
@throws PropelException
@see doSave() | [
"Insert",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L914-L1012 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.getByPosition | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getType();
break;
case 2:
return $this->getDateTime();
break;
... | php | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getType();
break;
case 2:
return $this->getDateTime();
break;
... | [
"public",
"function",
"getByPosition",
"(",
"$",
"pos",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"return",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"break",
";",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getType",
... | Retrieves a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@return mixed Value of field at $pos | [
"Retrieves",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L1055-L1092 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.toArray | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['LoginLog'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['LoginLog'][$this->getPrimaryKey()] ... | php | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['LoginLog'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['LoginLog'][$this->getPrimaryKey()] ... | [
"public",
"function",
"toArray",
"(",
"$",
"keyType",
"=",
"TableMap",
"::",
"TYPE_PHPNAME",
",",
"$",
"includeLazyLoadColumns",
"=",
"true",
",",
"$",
"alreadyDumpedObjects",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"alreadyDumpedObje... | Exports the object as an array.
You can specify the key type of the array by passing one of the class
type constants.
@param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME,
TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
Defau... | [
"Exports",
"the",
"object",
"as",
"an",
"array",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L1108-L1134 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.setByPosition | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setType($value);
break;
case 2:
$this->setDateTime($value);
br... | php | public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setType($value);
break;
case 2:
$this->setDateTime($value);
br... | [
"public",
"function",
"setByPosition",
"(",
"$",
"pos",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"$",
"this",
"->",
"setId",
"(",
"$",
"value",
")",
";",
"break",
";",
"case",
"1",
":",
"$",
"this",
"-... | Sets a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@param mixed $value field value
@return $this|\Alchemy\Component\Cerberus\Model\LoginLog | [
"Sets",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L1162-L1198 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.fromArray | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
{
$keys = LoginLogTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setType($arr[$keys[1... | php | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
{
$keys = LoginLogTableMap::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setType($arr[$keys[1... | [
"public",
"function",
"fromArray",
"(",
"$",
"arr",
",",
"$",
"keyType",
"=",
"TableMap",
"::",
"TYPE_PHPNAME",
")",
"{",
"$",
"keys",
"=",
"LoginLogTableMap",
"::",
"getFieldNames",
"(",
"$",
"keyType",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
... | Populates the object using an array.
This is particularly useful when populating an object from one of the
request arrays (e.g. $_POST). This method goes through the column
names, checking to see whether a matching key exists in populated
array. If so the setByName() method is called for that column.
You can specify... | [
"Populates",
"the",
"object",
"using",
"an",
"array",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L1217-L1251 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.buildCriteria | public function buildCriteria()
{
$criteria = new Criteria(LoginLogTableMap::DATABASE_NAME);
if ($this->isColumnModified(LoginLogTableMap::COL_ID)) {
$criteria->add(LoginLogTableMap::COL_ID, $this->id);
}
if ($this->isColumnModified(LoginLogTableMap::COL_TYPE)) {
... | php | public function buildCriteria()
{
$criteria = new Criteria(LoginLogTableMap::DATABASE_NAME);
if ($this->isColumnModified(LoginLogTableMap::COL_ID)) {
$criteria->add(LoginLogTableMap::COL_ID, $this->id);
}
if ($this->isColumnModified(LoginLogTableMap::COL_TYPE)) {
... | [
"public",
"function",
"buildCriteria",
"(",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"LoginLogTableMap",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"LoginLogTableMap",
"::",
"COL_ID",
")",
")",
"{",... | Build a Criteria object containing the values of all modified columns in this object.
@return Criteria The Criteria object containing all modified values. | [
"Build",
"a",
"Criteria",
"object",
"containing",
"the",
"values",
"of",
"all",
"modified",
"columns",
"in",
"this",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L1282-L1318 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.buildPkeyCriteria | public function buildPkeyCriteria()
{
$criteria = new Criteria(LoginLogTableMap::DATABASE_NAME);
$criteria->add(LoginLogTableMap::COL_ID, $this->id);
return $criteria;
} | php | public function buildPkeyCriteria()
{
$criteria = new Criteria(LoginLogTableMap::DATABASE_NAME);
$criteria->add(LoginLogTableMap::COL_ID, $this->id);
return $criteria;
} | [
"public",
"function",
"buildPkeyCriteria",
"(",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"LoginLogTableMap",
"::",
"DATABASE_NAME",
")",
";",
"$",
"criteria",
"->",
"add",
"(",
"LoginLogTableMap",
"::",
"COL_ID",
",",
"$",
"this",
"->",
"id",
... | Builds a Criteria object containing the primary key for this object.
Unlike buildCriteria() this method includes the primary key values regardless
of whether or not they have been modified.
@throws LogicException if no primary key is defined
@return Criteria The Criteria object containing value(s) for primary key(s)... | [
"Builds",
"a",
"Criteria",
"object",
"containing",
"the",
"primary",
"key",
"for",
"this",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L1330-L1336 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php | LoginLog.clear | public function clear()
{
$this->id = null;
$this->type = null;
$this->date_time = null;
$this->user_id = null;
$this->username = null;
$this->session_id = null;
$this->client_address = null;
$this->client_ip = null;
$this->client_agent = null;... | php | public function clear()
{
$this->id = null;
$this->type = null;
$this->date_time = null;
$this->user_id = null;
$this->username = null;
$this->session_id = null;
$this->client_address = null;
$this->client_ip = null;
$this->client_agent = null;... | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"null",
";",
"$",
"this",
"->",
"type",
"=",
"null",
";",
"$",
"this",
"->",
"date_time",
"=",
"null",
";",
"$",
"this",
"->",
"user_id",
"=",
"null",
";",
"$",
"this",
... | Clears the current object, sets all attributes to their default values and removes
outgoing references as well as back-references (from other objects to this one. Results probably in a database
change of those foreign objects when you call `save` there). | [
"Clears",
"the",
"current",
"object",
"sets",
"all",
"attributes",
"to",
"their",
"default",
"values",
"and",
"removes",
"outgoing",
"references",
"as",
"well",
"as",
"back",
"-",
"references",
"(",
"from",
"other",
"objects",
"to",
"this",
"one",
".",
"Resu... | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LoginLog.php#L1444-L1461 |
bestit/commercetools-order-export-bundle | src/OrderVisitor.php | OrderVisitor.getNextOrderCollection | private function getNextOrderCollection(int $renderedArticleCount)
{
$count = $this->count();
$logger = $this->getLogger();
$orderCollection = null;
$withPagination = $this->withPagination();
$logger->debug(
'Tries to load the next order collection',
... | php | private function getNextOrderCollection(int $renderedArticleCount)
{
$count = $this->count();
$logger = $this->getLogger();
$orderCollection = null;
$withPagination = $this->withPagination();
$logger->debug(
'Tries to load the next order collection',
... | [
"private",
"function",
"getNextOrderCollection",
"(",
"int",
"$",
"renderedArticleCount",
")",
"{",
"$",
"count",
"=",
"$",
"this",
"->",
"count",
"(",
")",
";",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"orderCollection",
"... | Returns the next order collection or void.
@param int $renderedArticleCount How many articles are rendered allready.
@return OrderCollection|void | [
"Returns",
"the",
"next",
"order",
"collection",
"or",
"void",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/OrderVisitor.php#L151-L174 |
bestit/commercetools-order-export-bundle | src/OrderVisitor.php | OrderVisitor.getTotalCount | private function getTotalCount(): int
{
if ($this->totalCount === -1) {
$this->setTotalCount($this->getLastResponse()->getTotal());
}
return $this->totalCount;
} | php | private function getTotalCount(): int
{
if ($this->totalCount === -1) {
$this->setTotalCount($this->getLastResponse()->getTotal());
}
return $this->totalCount;
} | [
"private",
"function",
"getTotalCount",
"(",
")",
":",
"int",
"{",
"if",
"(",
"$",
"this",
"->",
"totalCount",
"===",
"-",
"1",
")",
"{",
"$",
"this",
"->",
"setTotalCount",
"(",
"$",
"this",
"->",
"getLastResponse",
"(",
")",
"->",
"getTotal",
"(",
... | Returns the total count of found orders.
@return int | [
"Returns",
"the",
"total",
"count",
"of",
"found",
"orders",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/OrderVisitor.php#L206-L213 |
bestit/commercetools-order-export-bundle | src/OrderVisitor.php | OrderVisitor.loadOrderCollection | private function loadOrderCollection(): OrderVisitor
{
$logger = $this->getLogger();
/** @var PagedQueryResponse $response */
$response = $this->getClient()->execute($this->getOrderQuery());
if ($response instanceof ErrorResponse) {
$logger->error('Got error response lo... | php | private function loadOrderCollection(): OrderVisitor
{
$logger = $this->getLogger();
/** @var PagedQueryResponse $response */
$response = $this->getClient()->execute($this->getOrderQuery());
if ($response instanceof ErrorResponse) {
$logger->error('Got error response lo... | [
"private",
"function",
"loadOrderCollection",
"(",
")",
":",
"OrderVisitor",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"/** @var PagedQueryResponse $response */",
"$",
"response",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->... | Loads the order collection.
@return OrderVisitor | [
"Loads",
"the",
"order",
"collection",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/OrderVisitor.php#L219-L239 |
bestit/commercetools-order-export-bundle | src/OrderVisitor.php | OrderVisitor.loadOrderQuery | private function loadOrderQuery(): OrderVisitor
{
$logger = $this->getLogger();
$query = new OrderQueryRequest();
if ($wheres = $this->getDefaultWhere()) {
$logger->debug('Added where-clause to fech orders.', ['predicates' => $wheres]);
array_walk($wheres, function ... | php | private function loadOrderQuery(): OrderVisitor
{
$logger = $this->getLogger();
$query = new OrderQueryRequest();
if ($wheres = $this->getDefaultWhere()) {
$logger->debug('Added where-clause to fech orders.', ['predicates' => $wheres]);
array_walk($wheres, function ... | [
"private",
"function",
"loadOrderQuery",
"(",
")",
":",
"OrderVisitor",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"query",
"=",
"new",
"OrderQueryRequest",
"(",
")",
";",
"if",
"(",
"$",
"wheres",
"=",
"$",
"this",
... | Returns the order query request.
@return OrderVisitor | [
"Returns",
"the",
"order",
"query",
"request",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/OrderVisitor.php#L245-L263 |
bestit/commercetools-order-export-bundle | src/OrderVisitor.php | OrderVisitor.withPagination | private function withPagination(bool $newStatus = true): bool
{
$oldStatus = $this->withPagination;
if (func_num_args()) {
$this->withPagination = $newStatus;
}
return $oldStatus;
} | php | private function withPagination(bool $newStatus = true): bool
{
$oldStatus = $this->withPagination;
if (func_num_args()) {
$this->withPagination = $newStatus;
}
return $oldStatus;
} | [
"private",
"function",
"withPagination",
"(",
"bool",
"$",
"newStatus",
"=",
"true",
")",
":",
"bool",
"{",
"$",
"oldStatus",
"=",
"$",
"this",
"->",
"withPagination",
";",
"if",
"(",
"func_num_args",
"(",
")",
")",
"{",
"$",
"this",
"->",
"withPaginatio... | Sets the pagination status for this list.
@param bool $newStatus
@return bool | [
"Sets",
"the",
"pagination",
"status",
"for",
"this",
"list",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/OrderVisitor.php#L342-L351 |
bestit/commercetools-order-export-bundle | src/OrderVisitor.php | OrderVisitor.yieldOrders | public function yieldOrders()
{
$usedIndex = 0;
$orderCollection = $this->getOrderCollection();
while ($orderCollection && count($orderCollection)) {
foreach ($orderCollection as $order) {
set_time_limit(0);
yield $usedIndex++ => $order;
... | php | public function yieldOrders()
{
$usedIndex = 0;
$orderCollection = $this->getOrderCollection();
while ($orderCollection && count($orderCollection)) {
foreach ($orderCollection as $order) {
set_time_limit(0);
yield $usedIndex++ => $order;
... | [
"public",
"function",
"yieldOrders",
"(",
")",
"{",
"$",
"usedIndex",
"=",
"0",
";",
"$",
"orderCollection",
"=",
"$",
"this",
"->",
"getOrderCollection",
"(",
")",
";",
"while",
"(",
"$",
"orderCollection",
"&&",
"count",
"(",
"$",
"orderCollection",
")",... | Yields all found orders.
@return Generator | [
"Yields",
"all",
"found",
"orders",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/OrderVisitor.php#L357-L371 |
dragosprotung/stc-core | src/Workout/Dumper/FileDumper.php | FileDumper.dump | public function dump(Workout $workout): string
{
$dump = $this->dumper->dump($workout);
file_put_contents($this->outputFile, $dump);
return $dump;
} | php | public function dump(Workout $workout): string
{
$dump = $this->dumper->dump($workout);
file_put_contents($this->outputFile, $dump);
return $dump;
} | [
"public",
"function",
"dump",
"(",
"Workout",
"$",
"workout",
")",
":",
"string",
"{",
"$",
"dump",
"=",
"$",
"this",
"->",
"dumper",
"->",
"dump",
"(",
"$",
"workout",
")",
";",
"file_put_contents",
"(",
"$",
"this",
"->",
"outputFile",
",",
"$",
"d... | {@inheritdoc} | [
"{"
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/FileDumper.php#L38-L45 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/HttpClient/ZF1HttpClient.php | Zend1HttpClient.get | public function get( $uri, array $params = array() )
{
$this->_client->setMethod('GET');
return $this->_request($uri, $params);
} | php | public function get( $uri, array $params = array() )
{
$this->_client->setMethod('GET');
return $this->_request($uri, $params);
} | [
"public",
"function",
"get",
"(",
"$",
"uri",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_client",
"->",
"setMethod",
"(",
"'GET'",
")",
";",
"return",
"$",
"this",
"->",
"_request",
"(",
"$",
"uri",
",",
"... | (non-PHPdoc)
@see \TheTwelve\Foursquare.HttpClient::get()
@param string $uri
@param array $params
@return string|null|boolean | [
"(",
"non",
"-",
"PHPdoc",
")",
"@see",
"\\",
"TheTwelve",
"\\",
"Foursquare",
".",
"HttpClient",
"::",
"get",
"()"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/HttpClient/ZF1HttpClient.php#L23-L27 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/HttpClient/ZF1HttpClient.php | Zend1HttpClient.post | public function post( $uri, array $params = array() )
{
$this->_client->setMethod('POST');
return $this->_request($uri, $params);
} | php | public function post( $uri, array $params = array() )
{
$this->_client->setMethod('POST');
return $this->_request($uri, $params);
} | [
"public",
"function",
"post",
"(",
"$",
"uri",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_client",
"->",
"setMethod",
"(",
"'POST'",
")",
";",
"return",
"$",
"this",
"->",
"_request",
"(",
"$",
"uri",
",",
... | (non-PHPdoc)
@see TheTwelve\Foursquare.HttpClient::post()
@param string $uri
@param array $params
@return string|null|boolean | [
"(",
"non",
"-",
"PHPdoc",
")",
"@see",
"TheTwelve",
"\\",
"Foursquare",
".",
"HttpClient",
"::",
"post",
"()"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/HttpClient/ZF1HttpClient.php#L37-L41 |
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/HttpClient/ZF1HttpClient.php | Zend1HttpClient._request | protected function _request( $uri, array $params = array() )
{
$this->_client->setUri($uri);
$this->_client->setParameterGet($params);
try {
$response = $this->_client->request();
} catch (Exception $e) {
return null;
}
if ( $response->getSta... | php | protected function _request( $uri, array $params = array() )
{
$this->_client->setUri($uri);
$this->_client->setParameterGet($params);
try {
$response = $this->_client->request();
} catch (Exception $e) {
return null;
}
if ( $response->getSta... | [
"protected",
"function",
"_request",
"(",
"$",
"uri",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"_client",
"->",
"setUri",
"(",
"$",
"uri",
")",
";",
"$",
"this",
"->",
"_client",
"->",
"setParameterGet",
"(",
... | Process request
@param string $uri
@param array $params
@return string|null|boolean | [
"Process",
"request"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/HttpClient/ZF1HttpClient.php#L50-L66 |
ua1-labs/firebug | Fire/Bug.php | Bug.addPanel | public function addPanel(Panel $panel)
{
$id = $panel->getId();
if (!empty($this->_panels[$id])) {
throw new BugException('[FireBug] No panels exist with ID "' . $id . '".');
}
$this->_panels[$id] = $panel;
} | php | public function addPanel(Panel $panel)
{
$id = $panel->getId();
if (!empty($this->_panels[$id])) {
throw new BugException('[FireBug] No panels exist with ID "' . $id . '".');
}
$this->_panels[$id] = $panel;
} | [
"public",
"function",
"addPanel",
"(",
"Panel",
"$",
"panel",
")",
"{",
"$",
"id",
"=",
"$",
"panel",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"_panels",
"[",
"$",
"id",
"]",
")",
")",
"{",
"throw",
"new",
... | Adds a Fire\Bug\Panel object to the the array of panels.
@param \Fire\Bug\Panel $panel The panel you are adding to FireBug
@return void | [
"Adds",
"a",
"Fire",
"\\",
"Bug",
"\\",
"Panel",
"object",
"to",
"the",
"the",
"array",
"of",
"panels",
"."
] | train | https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug.php#L113-L120 |
ua1-labs/firebug | Fire/Bug.php | Bug.timer | public function timer($start = null)
{
if ($start) {
$end = microtime(true);
return round(($end - $start) * 1000, 4);
} else {
return microtime(true);
}
} | php | public function timer($start = null)
{
if ($start) {
$end = microtime(true);
return round(($end - $start) * 1000, 4);
} else {
return microtime(true);
}
} | [
"public",
"function",
"timer",
"(",
"$",
"start",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"start",
")",
"{",
"$",
"end",
"=",
"microtime",
"(",
"true",
")",
";",
"return",
"round",
"(",
"(",
"$",
"end",
"-",
"$",
"start",
")",
"*",
"1000",
",",
... | Method used to measure the amount of time that passed in milliseconds.
If you pass in a $start time, then you will be returned time length from
the start time. If you don't pass anything in, a start time will be returned.
@param float|null $start The start time.
@return float | [
"Method",
"used",
"to",
"measure",
"the",
"amount",
"of",
"time",
"that",
"passed",
"in",
"milliseconds",
".",
"If",
"you",
"pass",
"in",
"a",
"$start",
"time",
"then",
"you",
"will",
"be",
"returned",
"time",
"length",
"from",
"the",
"start",
"time",
".... | train | https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug.php#L148-L156 |
ua1-labs/firebug | Fire/Bug.php | Bug.render | public function render()
{
if ($this->_enabled) {
if (php_sapi_name() === 'cli') {
echo 'FireBug: ' . $this->getLoadTime() . ' milliseconds' . "\n";
} else {
ob_start();
include $this->_template;
$debugPanel = ob_get_con... | php | public function render()
{
if ($this->_enabled) {
if (php_sapi_name() === 'cli') {
echo 'FireBug: ' . $this->getLoadTime() . ' milliseconds' . "\n";
} else {
ob_start();
include $this->_template;
$debugPanel = ob_get_con... | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_enabled",
")",
"{",
"if",
"(",
"php_sapi_name",
"(",
")",
"===",
"'cli'",
")",
"{",
"echo",
"'FireBug: '",
".",
"$",
"this",
"->",
"getLoadTime",
"(",
")",
".",
"' millise... | Method used to render FireBug.
@return void | [
"Method",
"used",
"to",
"render",
"FireBug",
"."
] | train | https://github.com/ua1-labs/firebug/blob/70a45b2c0bbf64978641eb07e5f3cddfc1951162/Fire/Bug.php#L174-L188 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Widgets/SimpleContact.php | SimpleContact.getData | public function getData($options)
{
if (!empty($options) &&
array_key_exists('contact', $options) &&
!empty($options['contact'])
) {
$id = $options['contact'];
$contact = $this->em->getRepository(
$this->contactEntityName
)-... | php | public function getData($options)
{
if (!empty($options) &&
array_key_exists('contact', $options) &&
!empty($options['contact'])
) {
$id = $options['contact'];
$contact = $this->em->getRepository(
$this->contactEntityName
)-... | [
"public",
"function",
"getData",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
")",
"&&",
"array_key_exists",
"(",
"'contact'",
",",
"$",
"options",
")",
"&&",
"!",
"empty",
"(",
"$",
"options",
"[",
"'contact'",
"]",
"... | returns data to render template
@param array $options
@throws WidgetException
@return array | [
"returns",
"data",
"to",
"render",
"template"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Widgets/SimpleContact.php#L65-L91 |
comelyio/comely | src/Comely/IO/DependencyInjection/DependencyInjectionContainer.php | DependencyInjectionContainer.add | public function add(string $key, $object)
{
$key = self::ProcessKey(__METHOD__, $key);
$objectType = gettype($object);
switch ($objectType) {
case "object":
$this->repository->push($object, $key);
return true;
case "string":
... | php | public function add(string $key, $object)
{
$key = self::ProcessKey(__METHOD__, $key);
$objectType = gettype($object);
switch ($objectType) {
case "object":
$this->repository->push($object, $key);
return true;
case "string":
... | [
"public",
"function",
"add",
"(",
"string",
"$",
"key",
",",
"$",
"object",
")",
"{",
"$",
"key",
"=",
"self",
"::",
"ProcessKey",
"(",
"__METHOD__",
",",
"$",
"key",
")",
";",
"$",
"objectType",
"=",
"gettype",
"(",
"$",
"object",
")",
";",
"switc... | Store an instance or add new server
If second argument is an instance, it will be stored as-is.
If second argument is a class name (string), it will be added as service
and instance to Service will be returned
@param string $key
@param $object
@return Service|bool
@throws DependencyInjectionException
@throws Excepti... | [
"Store",
"an",
"instance",
"or",
"add",
"new",
"server"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/DependencyInjection/DependencyInjectionContainer.php#L75-L90 |
nicoSWD/put.io-api-v2 | src/PutIO/Engines/HTTP/CurlEngine.php | CurlEngine.request | public function request(
$method,
$url,
array $params = [],
$outFile = '',
$returnBool = \false,
$arrayKey = '',
$verifyPeer = \true
) {
$this->verifyPeer = $verifyPeer;
list($url, $options) = $this->configureRequestOptions($url, $method, $para... | php | public function request(
$method,
$url,
array $params = [],
$outFile = '',
$returnBool = \false,
$arrayKey = '',
$verifyPeer = \true
) {
$this->verifyPeer = $verifyPeer;
list($url, $options) = $this->configureRequestOptions($url, $method, $para... | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"outFile",
"=",
"''",
",",
"$",
"returnBool",
"=",
"\\",
"false",
",",
"$",
"arrayKey",
"=",
"''",
",",
"$",
"verifyPeer",
... | Makes an HTTP request to put.io's API and returns the response.
@param string $method
@param string $url
@param array $params
@param string $outFile
@param bool $returnBool
@param string $arrayKey
@param bool $verifyPeer
@return array|bool
@throws LocalStorageException
@throws RemoteConnectionException | [
"Makes",
"an",
"HTTP",
"request",
"to",
"put",
".",
"io",
"s",
"API",
"and",
"returns",
"the",
"response",
"."
] | train | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/HTTP/CurlEngine.php#L68-L86 |
bocharsky-bw/FileNamingResolver | src/NamingStrategy/ContentHashNamingStrategy.php | ContentHashNamingStrategy.provideName | public function provideName(FileInfo $srcFileInfo)
{
if (!$srcFileInfo->isFile()) {
throw new \InvalidArgumentException(sprintf(
'The source file does not exist on "%s" specified path.',
$srcFileInfo->toString()
));
}
$hash = hash_file(... | php | public function provideName(FileInfo $srcFileInfo)
{
if (!$srcFileInfo->isFile()) {
throw new \InvalidArgumentException(sprintf(
'The source file does not exist on "%s" specified path.',
$srcFileInfo->toString()
));
}
$hash = hash_file(... | [
"public",
"function",
"provideName",
"(",
"FileInfo",
"$",
"srcFileInfo",
")",
"{",
"if",
"(",
"!",
"$",
"srcFileInfo",
"->",
"isFile",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The source file does not exist on... | {@inheritdoc}
@throws \InvalidArgumentException If source file does not exist | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/NamingStrategy/ContentHashNamingStrategy.php#L17-L30 |
nicoSWD/put.io-api-v2 | src/PutIO/Engines/HTTP/NativeEngine.php | NativeEngine.request | public function request(
$method,
$url,
array $params = [],
$outFile = '',
$returnBool = \false,
$arrayKey = '',
$verifyPeer = \true
) {
list($url, $contextOptions) = $this->configureRequestOptions($url, $method, $params, $verifyPeer);
$fp = @... | php | public function request(
$method,
$url,
array $params = [],
$outFile = '',
$returnBool = \false,
$arrayKey = '',
$verifyPeer = \true
) {
list($url, $contextOptions) = $this->configureRequestOptions($url, $method, $params, $verifyPeer);
$fp = @... | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"outFile",
"=",
"''",
",",
"$",
"returnBool",
"=",
"\\",
"false",
",",
"$",
"arrayKey",
"=",
"''",
",",
"$",
"verifyPeer",
... | Makes an HTTP request to put.io's API and returns the response.
Relies on native PHP functions.
NOTE!! Due to restrictions, files must be loaded into the memory when
uploading. I don't recommend uploading large files using native
functions. Only use this if you absolutely must! Otherwise, the cURL
engine is much bette... | [
"Makes",
"an",
"HTTP",
"request",
"to",
"put",
".",
"io",
"s",
"API",
"and",
"returns",
"the",
"response",
".",
"Relies",
"on",
"native",
"PHP",
"functions",
"."
] | train | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/HTTP/NativeEngine.php#L57-L72 |
codeburnerframework/router | src/Matcher.php | Matcher.match | public function match($httpMethod, $path)
{
$path = $this->parsePath($path);
if (($route = $this->collector->findStaticRoute($httpMethod, $path)) ||
($route = $this->matchDynamicRoute($httpMethod, $path))) {
$route->setMatcher($this);
return $route;
}
... | php | public function match($httpMethod, $path)
{
$path = $this->parsePath($path);
if (($route = $this->collector->findStaticRoute($httpMethod, $path)) ||
($route = $this->matchDynamicRoute($httpMethod, $path))) {
$route->setMatcher($this);
return $route;
}
... | [
"public",
"function",
"match",
"(",
"$",
"httpMethod",
",",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"parsePath",
"(",
"$",
"path",
")",
";",
"if",
"(",
"(",
"$",
"route",
"=",
"$",
"this",
"->",
"collector",
"->",
"findStaticRou... | Find a route that matches the given arguments.
@param string $httpMethod
@param string $path
@throws NotFoundException
@throws MethodNotAllowedException
@return Route | [
"Find",
"a",
"route",
"that",
"matches",
"the",
"given",
"arguments",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L71-L83 |
codeburnerframework/router | src/Matcher.php | Matcher.matchDynamicRoute | protected function matchDynamicRoute($httpMethod, $path)
{
if ($routes = $this->collector->findDynamicRoutes($httpMethod, $path)) {
// cache the parser reference
$this->parser = $this->collector->getParser();
// chunk routes for smaller regex groups using the Sturges' For... | php | protected function matchDynamicRoute($httpMethod, $path)
{
if ($routes = $this->collector->findDynamicRoutes($httpMethod, $path)) {
// cache the parser reference
$this->parser = $this->collector->getParser();
// chunk routes for smaller regex groups using the Sturges' For... | [
"protected",
"function",
"matchDynamicRoute",
"(",
"$",
"httpMethod",
",",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"routes",
"=",
"$",
"this",
"->",
"collector",
"->",
"findDynamicRoutes",
"(",
"$",
"httpMethod",
",",
"$",
"path",
")",
")",
"{",
"// cache... | Find and return the request dynamic route based on the compiled data and Path.
@param string $httpMethod
@param string $path
@return Route|false If the request match an array with the action and parameters will
be returned otherwise a false will. | [
"Find",
"and",
"return",
"the",
"request",
"dynamic",
"route",
"based",
"on",
"the",
"compiled",
"data",
"and",
"Path",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L95-L120 |
codeburnerframework/router | src/Matcher.php | Matcher.buildRoute | protected function buildRoute(Route $route)
{
if ($route->getBlock()) {
return $route;
}
list($pattern, $params) = $this->parsePlaceholders($route->getPattern());
return $route->setPatternWithoutReset($pattern)->setParams($params)->setBlock(true);
} | php | protected function buildRoute(Route $route)
{
if ($route->getBlock()) {
return $route;
}
list($pattern, $params) = $this->parsePlaceholders($route->getPattern());
return $route->setPatternWithoutReset($pattern)->setParams($params)->setBlock(true);
} | [
"protected",
"function",
"buildRoute",
"(",
"Route",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"route",
"->",
"getBlock",
"(",
")",
")",
"{",
"return",
"$",
"route",
";",
"}",
"list",
"(",
"$",
"pattern",
",",
"$",
"params",
")",
"=",
"$",
"this",
... | Parse the dynamic segments of the pattern and replace then for
corresponding regex.
@param Route $route
@return Route | [
"Parse",
"the",
"dynamic",
"segments",
"of",
"the",
"pattern",
"and",
"replace",
"then",
"for",
"corresponding",
"regex",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L130-L138 |
codeburnerframework/router | src/Matcher.php | Matcher.buildGroup | protected function buildGroup(array $routes)
{
$groupCount = (int) $map = $regex = [];
foreach ($routes as $route) {
$params = $route->getParams();
$paramsCount = count($params);
$groupCount = max($groupCount, $paramsCount) + 1;
$... | php | protected function buildGroup(array $routes)
{
$groupCount = (int) $map = $regex = [];
foreach ($routes as $route) {
$params = $route->getParams();
$paramsCount = count($params);
$groupCount = max($groupCount, $paramsCount) + 1;
$... | [
"protected",
"function",
"buildGroup",
"(",
"array",
"$",
"routes",
")",
"{",
"$",
"groupCount",
"=",
"(",
"int",
")",
"$",
"map",
"=",
"$",
"regex",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"params",
... | Group several dynamic routes patterns into one big regex and maps
the routes to the pattern positions in the big regex.
@param Route[] $routes
@return array | [
"Group",
"several",
"dynamic",
"routes",
"patterns",
"into",
"one",
"big",
"regex",
"and",
"maps",
"the",
"routes",
"to",
"the",
"pattern",
"positions",
"in",
"the",
"big",
"regex",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L148-L161 |
codeburnerframework/router | src/Matcher.php | Matcher.parsePlaceholders | protected function parsePlaceholders($pattern)
{
$params = [];
$parser = $this->parser;
preg_match_all("~" . $parser::DYNAMIC_REGEX . "~x", $pattern, $matches, PREG_SET_ORDER);
foreach ((array) $matches as $key => $match) {
$pattern = str_replace($match[0], isset($match... | php | protected function parsePlaceholders($pattern)
{
$params = [];
$parser = $this->parser;
preg_match_all("~" . $parser::DYNAMIC_REGEX . "~x", $pattern, $matches, PREG_SET_ORDER);
foreach ((array) $matches as $key => $match) {
$pattern = str_replace($match[0], isset($match... | [
"protected",
"function",
"parsePlaceholders",
"(",
"$",
"pattern",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"parser",
"=",
"$",
"this",
"->",
"parser",
";",
"preg_match_all",
"(",
"\"~\"",
".",
"$",
"parser",
"::",
"DYNAMIC_REGEX",
".",
"\"~x\""... | Parse an route pattern seeking for parameters and build the route regex.
@param string $pattern
@return array 0 => new route regex, 1 => map of parameter names | [
"Parse",
"an",
"route",
"pattern",
"seeking",
"for",
"parameters",
"and",
"build",
"the",
"route",
"regex",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L170-L183 |
codeburnerframework/router | src/Matcher.php | Matcher.parsePath | protected function parsePath($path)
{
$path = parse_url(substr(strstr(";" . $path, ";" . $this->basepath), strlen(";" . $this->basepath)), PHP_URL_PATH);
if ($path === false) {
throw new Exception("Seriously malformed URL passed to route matcher.");
}
return $path;
... | php | protected function parsePath($path)
{
$path = parse_url(substr(strstr(";" . $path, ";" . $this->basepath), strlen(";" . $this->basepath)), PHP_URL_PATH);
if ($path === false) {
throw new Exception("Seriously malformed URL passed to route matcher.");
}
return $path;
... | [
"protected",
"function",
"parsePath",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"parse_url",
"(",
"substr",
"(",
"strstr",
"(",
"\";\"",
".",
"$",
"path",
",",
"\";\"",
".",
"$",
"this",
"->",
"basepath",
")",
",",
"strlen",
"(",
"\";\"",
".",
... | Get only the path of a given url.
@param string $path The given URL
@throws Exception
@return string | [
"Get",
"only",
"the",
"path",
"of",
"a",
"given",
"url",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L194-L203 |
codeburnerframework/router | src/Matcher.php | Matcher.matchSimilarRoute | protected function matchSimilarRoute($httpMethod, $path)
{
$dm = [];
if (($sm = $this->checkStaticRouteInOtherMethods($httpMethod, $path))
|| ($dm = $this->checkDynamicRouteInOtherMethods($httpMethod, $path))) {
throw new MethodNotAllowedException($httpMethod, $path, arr... | php | protected function matchSimilarRoute($httpMethod, $path)
{
$dm = [];
if (($sm = $this->checkStaticRouteInOtherMethods($httpMethod, $path))
|| ($dm = $this->checkDynamicRouteInOtherMethods($httpMethod, $path))) {
throw new MethodNotAllowedException($httpMethod, $path, arr... | [
"protected",
"function",
"matchSimilarRoute",
"(",
"$",
"httpMethod",
",",
"$",
"path",
")",
"{",
"$",
"dm",
"=",
"[",
"]",
";",
"if",
"(",
"(",
"$",
"sm",
"=",
"$",
"this",
"->",
"checkStaticRouteInOtherMethods",
"(",
"$",
"httpMethod",
",",
"$",
"pat... | Generate an HTTP error request with method not allowed or not found.
@param string $httpMethod
@param string $path
@throws NotFoundException
@throws MethodNotAllowedException | [
"Generate",
"an",
"HTTP",
"error",
"request",
"with",
"method",
"not",
"allowed",
"or",
"not",
"found",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L215-L225 |
codeburnerframework/router | src/Matcher.php | Matcher.checkStaticRouteInOtherMethods | protected function checkStaticRouteInOtherMethods($targetHttpMethod, $path)
{
return array_filter($this->getHttpMethodsBut($targetHttpMethod), function ($httpMethod) use ($path) {
return (bool) $this->collector->findStaticRoute($httpMethod, $path);
});
} | php | protected function checkStaticRouteInOtherMethods($targetHttpMethod, $path)
{
return array_filter($this->getHttpMethodsBut($targetHttpMethod), function ($httpMethod) use ($path) {
return (bool) $this->collector->findStaticRoute($httpMethod, $path);
});
} | [
"protected",
"function",
"checkStaticRouteInOtherMethods",
"(",
"$",
"targetHttpMethod",
",",
"$",
"path",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"getHttpMethodsBut",
"(",
"$",
"targetHttpMethod",
")",
",",
"function",
"(",
"$",
"httpMethod",
... | Verify if a static route match in another method than the requested.
@param string $targetHttpMethod The HTTP method that must not be checked
@param string $path The Path that must be matched.
@return array | [
"Verify",
"if",
"a",
"static",
"route",
"match",
"in",
"another",
"method",
"than",
"the",
"requested",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L236-L241 |
codeburnerframework/router | src/Matcher.php | Matcher.checkDynamicRouteInOtherMethods | protected function checkDynamicRouteInOtherMethods($targetHttpMethod, $path)
{
return array_filter($this->getHttpMethodsBut($targetHttpMethod), function ($httpMethod) use ($path) {
return (bool) $this->matchDynamicRoute($httpMethod, $path);
});
} | php | protected function checkDynamicRouteInOtherMethods($targetHttpMethod, $path)
{
return array_filter($this->getHttpMethodsBut($targetHttpMethod), function ($httpMethod) use ($path) {
return (bool) $this->matchDynamicRoute($httpMethod, $path);
});
} | [
"protected",
"function",
"checkDynamicRouteInOtherMethods",
"(",
"$",
"targetHttpMethod",
",",
"$",
"path",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"getHttpMethodsBut",
"(",
"$",
"targetHttpMethod",
")",
",",
"function",
"(",
"$",
"httpMethod",... | Verify if a dynamic route match in another method than the requested.
@param string $targetHttpMethod The HTTP method that must not be checked
@param string $path The Path that must be matched.
@return array | [
"Verify",
"if",
"a",
"dynamic",
"route",
"match",
"in",
"another",
"method",
"than",
"the",
"requested",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Matcher.php#L252-L257 |
gregorybesson/PlaygroundCore | src/Controller/Frontend/SwitchLocaleController.php | SwitchLocaleController.switchAction | public function switchAction()
{
$lang = $this->getEvent()->getRouteMatch()->getParam('lang');
$context = $this->getEvent()->getRouteMatch()->getParam('area');
$redirect = (!empty($this->getEvent()->getRouteMatch()->getParam('redirect')))? urldecode($this->getEvent()->getRouteMatch()->getPar... | php | public function switchAction()
{
$lang = $this->getEvent()->getRouteMatch()->getParam('lang');
$context = $this->getEvent()->getRouteMatch()->getParam('area');
$redirect = (!empty($this->getEvent()->getRouteMatch()->getParam('redirect')))? urldecode($this->getEvent()->getRouteMatch()->getPar... | [
"public",
"function",
"switchAction",
"(",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"getEvent",
"(",
")",
"->",
"getRouteMatch",
"(",
")",
"->",
"getParam",
"(",
"'lang'",
")",
";",
"$",
"context",
"=",
"$",
"this",
"->",
"getEvent",
"(",
")",
... | switchAction : permet de switcher de langue en fonction d'un context (back/front)
locale : locale pour switch
context : (back/front)
referer : retour à la page
@return Redirect $redirect redirect to referer | [
"switchAction",
":",
"permet",
"de",
"switcher",
"de",
"langue",
"en",
"fonction",
"d",
"un",
"context",
"(",
"back",
"/",
"front",
")",
"locale",
":",
"locale",
"pour",
"switch",
"context",
":",
"(",
"back",
"/",
"front",
")",
"referer",
":",
"retour",
... | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Controller/Frontend/SwitchLocaleController.php#L34-L44 |
okvpn/fixture-bundle | src/Tools/FixtureDatabaseChecker.php | FixtureDatabaseChecker.tablesExist | public static function tablesExist(Connection $connection, $tables)
{
$result = false;
if (!empty($tables)) {
try {
$connection->connect();
$result = $connection->getSchemaManager()->tablesExist($tables);
} catch (\PDOException $e) {
... | php | public static function tablesExist(Connection $connection, $tables)
{
$result = false;
if (!empty($tables)) {
try {
$connection->connect();
$result = $connection->getSchemaManager()->tablesExist($tables);
} catch (\PDOException $e) {
... | [
"public",
"static",
"function",
"tablesExist",
"(",
"Connection",
"$",
"connection",
",",
"$",
"tables",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"tables",
")",
")",
"{",
"try",
"{",
"$",
"connection",
"->",
"con... | @param Connection $connection
@param string[]|string|null $tables
@return bool
@internal | [
"@param",
"Connection",
"$connection",
"@param",
"string",
"[]",
"|string|null",
"$tables"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Tools/FixtureDatabaseChecker.php#L17-L30 |
JustBlackBird/jms-serializer-strict-json | src/Exception/TypeMismatchException.php | TypeMismatchException.fromValue | public static function fromValue(
$expected_type,
$actual_value,
DeserializationContext $context = null
) {
if (null !== $context && count($context->getCurrentPath()) > 0) {
$property = sprintf('property "%s" to be ', implode('.', $context->getCurrentPath()));
} e... | php | public static function fromValue(
$expected_type,
$actual_value,
DeserializationContext $context = null
) {
if (null !== $context && count($context->getCurrentPath()) > 0) {
$property = sprintf('property "%s" to be ', implode('.', $context->getCurrentPath()));
} e... | [
"public",
"static",
"function",
"fromValue",
"(",
"$",
"expected_type",
",",
"$",
"actual_value",
",",
"DeserializationContext",
"$",
"context",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"context",
"&&",
"count",
"(",
"$",
"context",
"->",
"get... | A handy method for building exception instance.
@param string $expected_type
@param mixed $actual_value
@param DeserializationContext|null $context
@return TypeMismatchException | [
"A",
"handy",
"method",
"for",
"building",
"exception",
"instance",
"."
] | train | https://github.com/JustBlackBird/jms-serializer-strict-json/blob/db1d1473ccb0de32dfb12ec89c89e028a515d61e/src/Exception/TypeMismatchException.php#L33-L51 |
tequila/mongodb-php-lib | src/Traits/ExecuteCommandTrait.php | ExecuteCommandTrait.executeCommand | private function executeCommand(array $command, array $options)
{
return $this
->getCommandExecutor()
->executeCommand(
$this->manager,
$this->databaseName,
$command,
$options
);
} | php | private function executeCommand(array $command, array $options)
{
return $this
->getCommandExecutor()
->executeCommand(
$this->manager,
$this->databaseName,
$command,
$options
);
} | [
"private",
"function",
"executeCommand",
"(",
"array",
"$",
"command",
",",
"array",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"getCommandExecutor",
"(",
")",
"->",
"executeCommand",
"(",
"$",
"this",
"->",
"manager",
",",
"$",
"this",
"->",
... | @param array $command
@param array $options
@return Cursor | [
"@param",
"array",
"$command",
"@param",
"array",
"$options"
] | train | https://github.com/tequila/mongodb-php-lib/blob/49a25f45268df358f5ceb40a655d9a7ddc6db4f7/src/Traits/ExecuteCommandTrait.php#L15-L25 |
avto-dev/app-version-laravel | src/AppVersionServiceProvider.php | AppVersionServiceProvider.register | public function register()
{
$this->initializeConfigs();
$this->registerAppVersionManager();
$this->registerHelpers();
$this->registerBlade();
if ($this->app->runningInConsole()) {
$this->registerArtisanCommands();
}
} | php | public function register()
{
$this->initializeConfigs();
$this->registerAppVersionManager();
$this->registerHelpers();
$this->registerBlade();
if ($this->app->runningInConsole()) {
$this->registerArtisanCommands();
}
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"initializeConfigs",
"(",
")",
";",
"$",
"this",
"->",
"registerAppVersionManager",
"(",
")",
";",
"$",
"this",
"->",
"registerHelpers",
"(",
")",
";",
"$",
"this",
"->",
"registerBlade",
... | Register any application services.
@return void | [
"Register",
"any",
"application",
"services",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionServiceProvider.php#L44-L57 |
avto-dev/app-version-laravel | src/AppVersionServiceProvider.php | AppVersionServiceProvider.registerAppVersionManager | protected function registerAppVersionManager()
{
$this->app->singleton(AppVersionManager::class, function (Application $app) {
$config = (array) $app
->make('config')
->get(static::getConfigRootKeyName());
return new AppVersionManager($config);
... | php | protected function registerAppVersionManager()
{
$this->app->singleton(AppVersionManager::class, function (Application $app) {
$config = (array) $app
->make('config')
->get(static::getConfigRootKeyName());
return new AppVersionManager($config);
... | [
"protected",
"function",
"registerAppVersionManager",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"AppVersionManager",
"::",
"class",
",",
"function",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"(",
"array",
")",
"$"... | Register version manager instance.
@return void | [
"Register",
"version",
"manager",
"instance",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionServiceProvider.php#L64-L76 |
avto-dev/app-version-laravel | src/AppVersionServiceProvider.php | AppVersionServiceProvider.registerBlade | protected function registerBlade()
{
$this->app->afterResolving('blade.compiler', function (BladeCompiler $blade) {
$blade->directive('app_version', function () {
return "<?php echo resolve('" . AppVersionManagerContract::class . "')->formatted(); ?>";
});
... | php | protected function registerBlade()
{
$this->app->afterResolving('blade.compiler', function (BladeCompiler $blade) {
$blade->directive('app_version', function () {
return "<?php echo resolve('" . AppVersionManagerContract::class . "')->formatted(); ?>";
});
... | [
"protected",
"function",
"registerBlade",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"afterResolving",
"(",
"'blade.compiler'",
",",
"function",
"(",
"BladeCompiler",
"$",
"blade",
")",
"{",
"$",
"blade",
"->",
"directive",
"(",
"'app_version'",
",",
"fu... | Register Blade directives. | [
"Register",
"Blade",
"directives",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionServiceProvider.php#L81-L96 |
avto-dev/app-version-laravel | src/AppVersionServiceProvider.php | AppVersionServiceProvider.initializeConfigs | protected function initializeConfigs()
{
$this->mergeConfigFrom(static::getConfigPath(), static::getConfigRootKeyName());
$this->publishes([
realpath(static::getConfigPath()) => config_path(basename(static::getConfigPath())),
], 'config');
} | php | protected function initializeConfigs()
{
$this->mergeConfigFrom(static::getConfigPath(), static::getConfigRootKeyName());
$this->publishes([
realpath(static::getConfigPath()) => config_path(basename(static::getConfigPath())),
], 'config');
} | [
"protected",
"function",
"initializeConfigs",
"(",
")",
"{",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"static",
"::",
"getConfigPath",
"(",
")",
",",
"static",
"::",
"getConfigRootKeyName",
"(",
")",
")",
";",
"$",
"this",
"->",
"publishes",
"(",
"[",
"r... | Initialize configs.
@return void | [
"Initialize",
"configs",
"."
] | train | https://github.com/avto-dev/app-version-laravel/blob/5cbf9df5981cadd2d5148c49c834cc17fb903c3f/src/AppVersionServiceProvider.php#L113-L120 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/ContentElement/ButtonsElement.php | ButtonsElement.compile | protected function compile()
{
if (!$this->bootstrap_buttonStyle) {
$this->bootstrap_buttonStyle = 'btn-default';
}
$buttons = Factory::createFromFieldset($this->bootstrap_buttons);
$buttons->eachChild(array($this, 'addButtonStyle'));
$this->Template->buttons = ... | php | protected function compile()
{
if (!$this->bootstrap_buttonStyle) {
$this->bootstrap_buttonStyle = 'btn-default';
}
$buttons = Factory::createFromFieldset($this->bootstrap_buttons);
$buttons->eachChild(array($this, 'addButtonStyle'));
$this->Template->buttons = ... | [
"protected",
"function",
"compile",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"bootstrap_buttonStyle",
")",
"{",
"$",
"this",
"->",
"bootstrap_buttonStyle",
"=",
"'btn-default'",
";",
"}",
"$",
"buttons",
"=",
"Factory",
"::",
"createFromFieldset",
"... | Compile the button toolbar.
@return void | [
"Compile",
"the",
"button",
"toolbar",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/ContentElement/ButtonsElement.php#L35-L45 |
contao-bootstrap/buttons | src/Netzmacht/Bootstrap/Buttons/ContentElement/ButtonsElement.php | ButtonsElement.addButtonStyle | public function addButtonStyle($child)
{
if ($child instanceof Group || $child instanceof Toolbar) {
$child->eachChild(array($this, 'addButtonStyle'));
} else {
$class = $child->getAttribute('class');
$class = array_filter($class, function ($item) {
... | php | public function addButtonStyle($child)
{
if ($child instanceof Group || $child instanceof Toolbar) {
$child->eachChild(array($this, 'addButtonStyle'));
} else {
$class = $child->getAttribute('class');
$class = array_filter($class, function ($item) {
... | [
"public",
"function",
"addButtonStyle",
"(",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"instanceof",
"Group",
"||",
"$",
"child",
"instanceof",
"Toolbar",
")",
"{",
"$",
"child",
"->",
"eachChild",
"(",
"array",
"(",
"$",
"this",
",",
"'addButtonS... | Add button style.
@param mixed $child Current child.
@return void | [
"Add",
"button",
"style",
"."
] | train | https://github.com/contao-bootstrap/buttons/blob/f573a24c19ec059aae528a12ba46dfc993844201/src/Netzmacht/Bootstrap/Buttons/ContentElement/ButtonsElement.php#L54-L68 |
datasift/datasift-php | examples/consume-stream.php | EventHandler.onInteraction | public function onInteraction($consumer, $interaction, $hash)
{
if (!isset($interaction['interaction']['content'])) {
$interaction['interaction']['content'] = 'No interaction.content for this interaction';
}
echo $hash.': '.$interaction['interaction']['content'].PHP_EOL.'--'.PHP_EOL;
} | php | public function onInteraction($consumer, $interaction, $hash)
{
if (!isset($interaction['interaction']['content'])) {
$interaction['interaction']['content'] = 'No interaction.content for this interaction';
}
echo $hash.': '.$interaction['interaction']['content'].PHP_EOL.'--'.PHP_EOL;
} | [
"public",
"function",
"onInteraction",
"(",
"$",
"consumer",
",",
"$",
"interaction",
",",
"$",
"hash",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"interaction",
"[",
"'interaction'",
"]",
"[",
"'content'",
"]",
")",
")",
"{",
"$",
"interaction",
"["... | Handle incoming data.
@param DataSift_StreamConsumer $consumer The consumer object.
@param array $interaction The interaction data.
@param string $hash The stream hash. | [
"Handle",
"incoming",
"data",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/examples/consume-stream.php#L62-L68 |
stubbles/stubbles-webapp-core | src/main/php/session/storage/NativeSessionStorage.php | NativeSessionStorage.putValue | public function putValue(string $key, $value): SessionStorage
{
$this->init();
$_SESSION[$key] = $value;
return $this;
} | php | public function putValue(string $key, $value): SessionStorage
{
$this->init();
$_SESSION[$key] = $value;
return $this;
} | [
"public",
"function",
"putValue",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
":",
"SessionStorage",
"{",
"$",
"this",
"->",
"init",
"(",
")",
";",
"$",
"_SESSION",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
... | stores a value associated with the key
@param string $key key to store value under
@param mixed $value data to store
@return \stubbles\webapp\session\storage\SessionStorage | [
"stores",
"a",
"value",
"associated",
"with",
"the",
"key"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/session/storage/NativeSessionStorage.php#L149-L154 |
nathancox/silverstripe-hasoneautocompletefield | src/forms/HasOneAutocompleteField.php | HasOneAutocompleteField.search | public function search(HTTPRequest $request)
{
// Check form field state
if($this->isDisabled() || $this->isReadonly()) {
return $this->httpError(403);
}
$query = $request->getVar('query');
// use callbacks if they're set, otherwise used this class's methods for... | php | public function search(HTTPRequest $request)
{
// Check form field state
if($this->isDisabled() || $this->isReadonly()) {
return $this->httpError(403);
}
$query = $request->getVar('query');
// use callbacks if they're set, otherwise used this class's methods for... | [
"public",
"function",
"search",
"(",
"HTTPRequest",
"$",
"request",
")",
"{",
"// Check form field state",
"if",
"(",
"$",
"this",
"->",
"isDisabled",
"(",
")",
"||",
"$",
"this",
"->",
"isReadonly",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"http... | The action that handles AJAX search requests
@param SS_HTTPRequest $request
@return json | [
"The",
"action",
"that",
"handles",
"AJAX",
"search",
"requests"
] | train | https://github.com/nathancox/silverstripe-hasoneautocompletefield/blob/862a971723dfc053ddb9c155defa32ab2bcd870e/src/forms/HasOneAutocompleteField.php#L83-L106 |
nathancox/silverstripe-hasoneautocompletefield | src/forms/HasOneAutocompleteField.php | HasOneAutocompleteField.getResults | protected function getResults($query)
{
$searchFields = ($this->getSearchFields() ?: singleton($this->sourceObject)->stat('searchable_fields'));
if(!$searchFields) {
throw new Exception(
sprintf('HasOneAutocompleteField: No searchable fields could be found for class "%s... | php | protected function getResults($query)
{
$searchFields = ($this->getSearchFields() ?: singleton($this->sourceObject)->stat('searchable_fields'));
if(!$searchFields) {
throw new Exception(
sprintf('HasOneAutocompleteField: No searchable fields could be found for class "%s... | [
"protected",
"function",
"getResults",
"(",
"$",
"query",
")",
"{",
"$",
"searchFields",
"=",
"(",
"$",
"this",
"->",
"getSearchFields",
"(",
")",
"?",
":",
"singleton",
"(",
"$",
"this",
"->",
"sourceObject",
")",
"->",
"stat",
"(",
"'searchable_fields'",... | Takes the search term and returns a DataList
@param string $query
@return DataList | [
"Takes",
"the",
"search",
"term",
"and",
"returns",
"a",
"DataList"
] | train | https://github.com/nathancox/silverstripe-hasoneautocompletefield/blob/862a971723dfc053ddb9c155defa32ab2bcd870e/src/forms/HasOneAutocompleteField.php#L113-L138 |
nathancox/silverstripe-hasoneautocompletefield | src/forms/HasOneAutocompleteField.php | HasOneAutocompleteField.processResults | protected function processResults($results)
{
$json = array();
foreach($results as $result) {
$name = $result->{$this->labelField};
$json[$result->ID] = array(
'name' => $name,
'currentString' => $this->getCurrentItemText($result)
... | php | protected function processResults($results)
{
$json = array();
foreach($results as $result) {
$name = $result->{$this->labelField};
$json[$result->ID] = array(
'name' => $name,
'currentString' => $this->getCurrentItemText($result)
... | [
"protected",
"function",
"processResults",
"(",
"$",
"results",
")",
"{",
"$",
"json",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"results",
"as",
"$",
"result",
")",
"{",
"$",
"name",
"=",
"$",
"result",
"->",
"{",
"$",
"this",
"->",
"label... | Takes the DataList of search results and returns the json to be sent to the front end.
@param DataList
@return json | [
"Takes",
"the",
"DataList",
"of",
"search",
"results",
"and",
"returns",
"the",
"json",
"to",
"be",
"sent",
"to",
"the",
"front",
"end",
"."
] | train | https://github.com/nathancox/silverstripe-hasoneautocompletefield/blob/862a971723dfc053ddb9c155defa32ab2bcd870e/src/forms/HasOneAutocompleteField.php#L145-L158 |
nathancox/silverstripe-hasoneautocompletefield | src/forms/HasOneAutocompleteField.php | HasOneAutocompleteField.getItem | function getItem()
{
$sourceObject = $this->sourceObject;
if ($this->value !== null) {
$item = $sourceObject::get()->byID($this->value);
} else {
$item = $sourceObject::create();
}
return $item;
} | php | function getItem()
{
$sourceObject = $this->sourceObject;
if ($this->value !== null) {
$item = $sourceObject::get()->byID($this->value);
} else {
$item = $sourceObject::create();
}
return $item;
} | [
"function",
"getItem",
"(",
")",
"{",
"$",
"sourceObject",
"=",
"$",
"this",
"->",
"sourceObject",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"!==",
"null",
")",
"{",
"$",
"item",
"=",
"$",
"sourceObject",
"::",
"get",
"(",
")",
"->",
"byID",
"(",... | Get the currently selected object
@return DataObject | [
"Get",
"the",
"currently",
"selected",
"object"
] | train | https://github.com/nathancox/silverstripe-hasoneautocompletefield/blob/862a971723dfc053ddb9c155defa32ab2bcd870e/src/forms/HasOneAutocompleteField.php#L302-L311 |
nathancox/silverstripe-hasoneautocompletefield | src/forms/HasOneAutocompleteField.php | HasOneAutocompleteField.getCurrentItemText | function getCurrentItemText($item = null)
{
$text = $this->getDefaultText();
if (is_null($item)) {
$item = $this->getItem();
}
if ($item && $item->ID > 0) {
$labelField = $this->labelField;
if (isset($item->$labelField)) {
$text =... | php | function getCurrentItemText($item = null)
{
$text = $this->getDefaultText();
if (is_null($item)) {
$item = $this->getItem();
}
if ($item && $item->ID > 0) {
$labelField = $this->labelField;
if (isset($item->$labelField)) {
$text =... | [
"function",
"getCurrentItemText",
"(",
"$",
"item",
"=",
"null",
")",
"{",
"$",
"text",
"=",
"$",
"this",
"->",
"getDefaultText",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"item",
")",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"getItem",
... | Return the text to be dislayed next to the "Edit" button indicating the currently selected item.
By default is displays $labelField and wraps it in a link if the object has the Link() method.
@param DataObjext $item
@return string | [
"Return",
"the",
"text",
"to",
"be",
"dislayed",
"next",
"to",
"the",
"Edit",
"button",
"indicating",
"the",
"currently",
"selected",
"item",
".",
"By",
"default",
"is",
"displays",
"$labelField",
"and",
"wraps",
"it",
"in",
"a",
"link",
"if",
"the",
"obje... | train | https://github.com/nathancox/silverstripe-hasoneautocompletefield/blob/862a971723dfc053ddb9c155defa32ab2bcd870e/src/forms/HasOneAutocompleteField.php#L320-L342 |
dragosprotung/stc-core | src/Workout/SportGuesser.php | SportGuesser.guess | public static function guess(string $code) : string
{
switch (strtolower(trim($code))) {
case SportMapperInterface::RUNNING:
case 'run':
return SportMapperInterface::RUNNING;
case SportMapperInterface::CYCLING_SPORT:
case 'cycling':
... | php | public static function guess(string $code) : string
{
switch (strtolower(trim($code))) {
case SportMapperInterface::RUNNING:
case 'run':
return SportMapperInterface::RUNNING;
case SportMapperInterface::CYCLING_SPORT:
case 'cycling':
... | [
"public",
"static",
"function",
"guess",
"(",
"string",
"$",
"code",
")",
":",
"string",
"{",
"switch",
"(",
"strtolower",
"(",
"trim",
"(",
"$",
"code",
")",
")",
")",
"{",
"case",
"SportMapperInterface",
"::",
"RUNNING",
":",
"case",
"'run'",
":",
"r... | Get the sport code from the tracker sport code.
@param string $code The code from the tracker.
@return string | [
"Get",
"the",
"sport",
"code",
"from",
"the",
"tracker",
"sport",
"code",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/SportGuesser.php#L18-L34 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.bootSluggableTrait | public static function bootSluggableTrait()
{
// cache config for this model
static::$slugsTable = config('pxlcms.slugs.table', 'cms_slugs');
static::$slugsColumn = config('pxlcms.slugs.column', 'slug');
static::$slugsEntryKey = config('pxlcms.slugs.keys.entry', 'ent... | php | public static function bootSluggableTrait()
{
// cache config for this model
static::$slugsTable = config('pxlcms.slugs.table', 'cms_slugs');
static::$slugsColumn = config('pxlcms.slugs.column', 'slug');
static::$slugsEntryKey = config('pxlcms.slugs.keys.entry', 'ent... | [
"public",
"static",
"function",
"bootSluggableTrait",
"(",
")",
"{",
"// cache config for this model",
"static",
"::",
"$",
"slugsTable",
"=",
"config",
"(",
"'pxlcms.slugs.table'",
",",
"'cms_slugs'",
")",
";",
"static",
"::",
"$",
"slugsColumn",
"=",
"config",
"... | Caches config on model boot | [
"Caches",
"config",
"on",
"model",
"boot"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L32-L41 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.scopeWhereSlug | public function scopeWhereSlug($scope, $slug, $locale = null, $forHasQuery = false)
{
/** @var CmsModel|SluggableTrait $model */
$model = new static;
if ($model->storeSlugLocally()) {
return $this->CviebrockScopeWhereSlug($scope, $slug);
}
// build scope with jo... | php | public function scopeWhereSlug($scope, $slug, $locale = null, $forHasQuery = false)
{
/** @var CmsModel|SluggableTrait $model */
$model = new static;
if ($model->storeSlugLocally()) {
return $this->CviebrockScopeWhereSlug($scope, $slug);
}
// build scope with jo... | [
"public",
"function",
"scopeWhereSlug",
"(",
"$",
"scope",
",",
"$",
"slug",
",",
"$",
"locale",
"=",
"null",
",",
"$",
"forHasQuery",
"=",
"false",
")",
"{",
"/** @var CmsModel|SluggableTrait $model */",
"$",
"model",
"=",
"new",
"static",
";",
"if",
"(",
... | Query scope for finding a model by its slug.
@param Builder $scope
@param string $slug
@param string $locale if not set, matches for any locale
@param bool $forHasQuery if true, the scope is part of a has relation subquery
@return mixed | [
"Query",
"scope",
"for",
"finding",
"a",
"model",
"by",
"its",
"slug",
"."
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L91-L122 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.setSlug | protected function setSlug($slug)
{
$config = $this->getSluggableConfig();
$save_to = $config['save_to'];
if ($this->storeSlugLocally()) {
$this->setAttribute($save_to, $slug);
return;
}
$this->setSlugInCmsTable($slug);
} | php | protected function setSlug($slug)
{
$config = $this->getSluggableConfig();
$save_to = $config['save_to'];
if ($this->storeSlugLocally()) {
$this->setAttribute($save_to, $slug);
return;
}
$this->setSlugInCmsTable($slug);
} | [
"protected",
"function",
"setSlug",
"(",
"$",
"slug",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getSluggableConfig",
"(",
")",
";",
"$",
"save_to",
"=",
"$",
"config",
"[",
"'save_to'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"storeSlugLocally"... | Set the slug manually.
@param string $slug | [
"Set",
"the",
"slug",
"manually",
"."
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L130-L141 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.needsSlugging | protected function needsSlugging()
{
/** @var CmsModel|SluggableTrait $this */
if ($this->storeSlugLocally()) {
return $this->CviebrockNeedsSlugging();
}
$config = $this->getSluggableConfig();
$on_update = $config['on_update'];
// check stored slug i... | php | protected function needsSlugging()
{
/** @var CmsModel|SluggableTrait $this */
if ($this->storeSlugLocally()) {
return $this->CviebrockNeedsSlugging();
}
$config = $this->getSluggableConfig();
$on_update = $config['on_update'];
// check stored slug i... | [
"protected",
"function",
"needsSlugging",
"(",
")",
"{",
"/** @var CmsModel|SluggableTrait $this */",
"if",
"(",
"$",
"this",
"->",
"storeSlugLocally",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"CviebrockNeedsSlugging",
"(",
")",
";",
"}",
"$",
"config",
... | Determines whether the model needs slugging.
@return bool | [
"Determines",
"whether",
"the",
"model",
"needs",
"slugging",
"."
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L148-L163 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.getExistingSlugs | protected function getExistingSlugs($slug)
{
// check for existing slugs in the slugs table or locally?
if ($this->storeSlugLocally()) {
return $this->cviebrockGetExistingSlugs($slug);
}
return $this->getAllSlugsForModuleFromCmsTable($slug);
} | php | protected function getExistingSlugs($slug)
{
// check for existing slugs in the slugs table or locally?
if ($this->storeSlugLocally()) {
return $this->cviebrockGetExistingSlugs($slug);
}
return $this->getAllSlugsForModuleFromCmsTable($slug);
} | [
"protected",
"function",
"getExistingSlugs",
"(",
"$",
"slug",
")",
"{",
"// check for existing slugs in the slugs table or locally?",
"if",
"(",
"$",
"this",
"->",
"storeSlugLocally",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cviebrockGetExistingSlugs",
"(",
... | Get all existing slugs that are similar to the given slug.
@param string $slug
@return array | [
"Get",
"all",
"existing",
"slugs",
"that",
"are",
"similar",
"to",
"the",
"given",
"slug",
"."
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L171-L179 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.getSlugRecordFromCmsTable | protected function getSlugRecordFromCmsTable()
{
/** @var CmsModel|SluggableTrait $this */
$languageId = $this->storeSlugForLanguageId();
$entryId = $this->isTranslationModel()
? $this->getAttribute(config('pxlcms.translatable.translation_foreign_key'))
: $this-... | php | protected function getSlugRecordFromCmsTable()
{
/** @var CmsModel|SluggableTrait $this */
$languageId = $this->storeSlugForLanguageId();
$entryId = $this->isTranslationModel()
? $this->getAttribute(config('pxlcms.translatable.translation_foreign_key'))
: $this-... | [
"protected",
"function",
"getSlugRecordFromCmsTable",
"(",
")",
"{",
"/** @var CmsModel|SluggableTrait $this */",
"$",
"languageId",
"=",
"$",
"this",
"->",
"storeSlugForLanguageId",
"(",
")",
";",
"$",
"entryId",
"=",
"$",
"this",
"->",
"isTranslationModel",
"(",
"... | Returns current slug from CMS slugs table
@return object|null | [
"Returns",
"current",
"slug",
"from",
"CMS",
"slugs",
"table"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L186-L222 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.findRecordIdForSlugFromCmsTable | public function findRecordIdForSlugFromCmsTable($slug, $locale = null, $limitToLanguage = false)
{
/** @var CmsModel|SluggableTrait $this */
$existing = DB::table(static::$slugsTable)
->select([ static::$slugsEntryKey . ' as entry' ])
->where(static::$slugsModuleKey, $this->... | php | public function findRecordIdForSlugFromCmsTable($slug, $locale = null, $limitToLanguage = false)
{
/** @var CmsModel|SluggableTrait $this */
$existing = DB::table(static::$slugsTable)
->select([ static::$slugsEntryKey . ' as entry' ])
->where(static::$slugsModuleKey, $this->... | [
"public",
"function",
"findRecordIdForSlugFromCmsTable",
"(",
"$",
"slug",
",",
"$",
"locale",
"=",
"null",
",",
"$",
"limitToLanguage",
"=",
"false",
")",
"{",
"/** @var CmsModel|SluggableTrait $this */",
"$",
"existing",
"=",
"DB",
"::",
"table",
"(",
"static",
... | Returns the entry/model ID for a given slug
@param string $slug
@param string $locale the locale to limit for (if null, set limitToLanguage)
@param bool $limitToLanguage if set, limits search to current language
@return int|null | [
"Returns",
"the",
"entry",
"/",
"model",
"ID",
"for",
"a",
"given",
"slug"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L232-L257 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.getAllSlugsForModuleFromCmsTable | protected function getAllSlugsForModuleFromCmsTable($likeSlug = null, $limitToLanguage = true)
{
/** @var CmsModel|SluggableTrait $this */
$config = $this->getSluggableConfig();
$includeTrashed = $config['include_trashed'];
$separator = $config['separator'];
$... | php | protected function getAllSlugsForModuleFromCmsTable($likeSlug = null, $limitToLanguage = true)
{
/** @var CmsModel|SluggableTrait $this */
$config = $this->getSluggableConfig();
$includeTrashed = $config['include_trashed'];
$separator = $config['separator'];
$... | [
"protected",
"function",
"getAllSlugsForModuleFromCmsTable",
"(",
"$",
"likeSlug",
"=",
"null",
",",
"$",
"limitToLanguage",
"=",
"true",
")",
"{",
"/** @var CmsModel|SluggableTrait $this */",
"$",
"config",
"=",
"$",
"this",
"->",
"getSluggableConfig",
"(",
")",
";... | Returns current slugs for this module from CMS slugs table
@param string $likeSlug if set, only returns slugs that are like the string
@param bool $limitToLanguage if true, only returns matches within the language
@return null|object | [
"Returns",
"current",
"slugs",
"for",
"this",
"module",
"from",
"CMS",
"slugs",
"table"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L266-L297 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.setSlugInCmsTable | protected function setSlugInCmsTable($slug)
{
/** @var CmsModel|SluggableTrait $this */
$existing = $this->getSlugRecordFromCmsTable();
$languageId = $this->storeSlugForLanguageId();
// update if exists
if ($existing) {
DB::table(static::$slugsTable)
... | php | protected function setSlugInCmsTable($slug)
{
/** @var CmsModel|SluggableTrait $this */
$existing = $this->getSlugRecordFromCmsTable();
$languageId = $this->storeSlugForLanguageId();
// update if exists
if ($existing) {
DB::table(static::$slugsTable)
... | [
"protected",
"function",
"setSlugInCmsTable",
"(",
"$",
"slug",
")",
"{",
"/** @var CmsModel|SluggableTrait $this */",
"$",
"existing",
"=",
"$",
"this",
"->",
"getSlugRecordFromCmsTable",
"(",
")",
";",
"$",
"languageId",
"=",
"$",
"this",
"->",
"storeSlugForLangua... | Update / store slug in dedicated table
@param string $slug | [
"Update",
"/",
"store",
"slug",
"in",
"dedicated",
"table"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L317-L348 |
czim/laravel-pxlcms | src/Sluggable/SluggableTrait.php | SluggableTrait.storeSlugForLanguageId | protected function storeSlugForLanguageId()
{
/** @var CmsModel|SluggableTrait $this */
$config = $this->getSluggableConfig();
$languageKey = array_get($config, 'language_key');
$localeKey = array_get($config, 'locale_key');
if ($languageKey) {
return $th... | php | protected function storeSlugForLanguageId()
{
/** @var CmsModel|SluggableTrait $this */
$config = $this->getSluggableConfig();
$languageKey = array_get($config, 'language_key');
$localeKey = array_get($config, 'locale_key');
if ($languageKey) {
return $th... | [
"protected",
"function",
"storeSlugForLanguageId",
"(",
")",
"{",
"/** @var CmsModel|SluggableTrait $this */",
"$",
"config",
"=",
"$",
"this",
"->",
"getSluggableConfig",
"(",
")",
";",
"$",
"languageKey",
"=",
"array_get",
"(",
"$",
"config",
",",
"'language_key'"... | Returns the language_id to store slugs for
@return string | [
"Returns",
"the",
"language_id",
"to",
"store",
"slugs",
"for"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Sluggable/SluggableTrait.php#L365-L382 |
GokulSrinivas/Sangria | src/Sangria/LDAPAuth.php | LDAPAuth.auth | public static function auth($user_name, $user_pass)
{
try
{
$ldap_server_address = __SANGRIA_LDAP_SERVER_ADDR__;
$ldapconn = \ldap_connect($ldap_server_address)
or $this->throwException("Could not connect to LDAP Server");
\ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
\ldap_set_op... | php | public static function auth($user_name, $user_pass)
{
try
{
$ldap_server_address = __SANGRIA_LDAP_SERVER_ADDR__;
$ldapconn = \ldap_connect($ldap_server_address)
or $this->throwException("Could not connect to LDAP Server");
\ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
\ldap_set_op... | [
"public",
"static",
"function",
"auth",
"(",
"$",
"user_name",
",",
"$",
"user_pass",
")",
"{",
"try",
"{",
"$",
"ldap_server_address",
"=",
"__SANGRIA_LDAP_SERVER_ADDR__",
";",
"$",
"ldapconn",
"=",
"\\",
"ldap_connect",
"(",
"$",
"ldap_server_address",
")",
... | [auth Tries to authenticate a user with an LDAP server]
@param string $user_name [username]
@param string $user_pass [password]
@return boolean [true if authenticated, false if not] | [
"[",
"auth",
"Tries",
"to",
"authenticate",
"a",
"user",
"with",
"an",
"LDAP",
"server",
"]"
] | train | https://github.com/GokulSrinivas/Sangria/blob/e69076655da30ef74b9b6f4a7b7317b3d37d5710/src/Sangria/LDAPAuth.php#L25-L50 |
Wonail/wocenter | actions/FlushCache.php | FlushCache.flushCache | protected function flushCache(Module $current = null)
{
$message = '';
if ($current === null) {
$current = Yii::$app;
}
$modules = $current->getModules();
foreach ($modules as $moduleName => $module) {
if (is_array($module)) {
$module =... | php | protected function flushCache(Module $current = null)
{
$message = '';
if ($current === null) {
$current = Yii::$app;
}
$modules = $current->getModules();
foreach ($modules as $moduleName => $module) {
if (is_array($module)) {
$module =... | [
"protected",
"function",
"flushCache",
"(",
"Module",
"$",
"current",
"=",
"null",
")",
"{",
"$",
"message",
"=",
"''",
";",
"if",
"(",
"$",
"current",
"===",
"null",
")",
"{",
"$",
"current",
"=",
"Yii",
"::",
"$",
"app",
";",
"}",
"$",
"modules",... | Recursive flush all app cache
@param null|Module $current Current Module
@return string execute message | [
"Recursive",
"flush",
"all",
"app",
"cache"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/actions/FlushCache.php#L40-L73 |
Wonail/wocenter | actions/FlushCache.php | FlushCache.flushAssets | protected function flushAssets()
{
$message = '';
$except = [Yii::getAlias('@webroot/assets/.gitignore'), Yii::getAlias('@webroot/assets/index.html')];
$dir = Yii::getAlias('@webroot/assets');
$it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
... | php | protected function flushAssets()
{
$message = '';
$except = [Yii::getAlias('@webroot/assets/.gitignore'), Yii::getAlias('@webroot/assets/index.html')];
$dir = Yii::getAlias('@webroot/assets');
$it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
... | [
"protected",
"function",
"flushAssets",
"(",
")",
"{",
"$",
"message",
"=",
"''",
";",
"$",
"except",
"=",
"[",
"Yii",
"::",
"getAlias",
"(",
"'@webroot/assets/.gitignore'",
")",
",",
"Yii",
"::",
"getAlias",
"(",
"'@webroot/assets/index.html'",
")",
"]",
";... | Flush webroot/assets/
@return string execute message | [
"Flush",
"webroot",
"/",
"assets",
"/"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/actions/FlushCache.php#L80-L110 |
phramework/jsonapi | src/Viewers/JSONAPI.php | JSONAPI.view | public function view($parameters)
{
self::header();
if (!is_object($parameters)) {
$parameters = (object)$parameters;
}
//Include JSON API version object
$parameters->jsonapi = (object)[
'version' => '1.0'
];
echo json_encode($parame... | php | public function view($parameters)
{
self::header();
if (!is_object($parameters)) {
$parameters = (object)$parameters;
}
//Include JSON API version object
$parameters->jsonapi = (object)[
'version' => '1.0'
];
echo json_encode($parame... | [
"public",
"function",
"view",
"(",
"$",
"parameters",
")",
"{",
"self",
"::",
"header",
"(",
")",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"parameters",
"=",
"(",
"object",
")",
"$",
"parameters",
";",
"}",
"//I... | Send output
@param object|array $parameters Output to display as json | [
"Send",
"output"
] | train | https://github.com/phramework/jsonapi/blob/af20882a8b6f6e5be9c8e09e5b87f6c23a4b0726/src/Viewers/JSONAPI.php#L39-L53 |
JoffreyPoreeCoding/MongoDB-ODM | src/Tools/ArrayModifier.php | ArrayModifier.clearNullValues | public static function clearNullValues(&$array)
{
foreach ($array as $key => &$value) {
if (null === $value) {
unset($array[$key]);
} else if (is_array($value)) {
self::clearNullValues($value);
if (empty($value)) {
u... | php | public static function clearNullValues(&$array)
{
foreach ($array as $key => &$value) {
if (null === $value) {
unset($array[$key]);
} else if (is_array($value)) {
self::clearNullValues($value);
if (empty($value)) {
u... | [
"public",
"static",
"function",
"clearNullValues",
"(",
"&",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"unset",
"(",
"$",
"array",
... | Clear all null values of an array (and sub-arrays)
@param array $array Array to clear
@return array Array cleaned | [
"Clear",
"all",
"null",
"values",
"of",
"an",
"array",
"(",
"and",
"sub",
"-",
"arrays",
")"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/ArrayModifier.php#L20-L34 |
JoffreyPoreeCoding/MongoDB-ODM | src/Tools/ArrayModifier.php | ArrayModifier.aggregate | public static function aggregate($array, $specialKeys = self::SPECIALS_KEYS, $prefix = '')
{
$new = [];
foreach ($array as $key => $value) {
$newKey = (!empty($prefix)) ? $prefix . '.' . $key : $key;
if (!in_array($key, $specialKeys, true) && !in_array($key, array_keys($speci... | php | public static function aggregate($array, $specialKeys = self::SPECIALS_KEYS, $prefix = '')
{
$new = [];
foreach ($array as $key => $value) {
$newKey = (!empty($prefix)) ? $prefix . '.' . $key : $key;
if (!in_array($key, $specialKeys, true) && !in_array($key, array_keys($speci... | [
"public",
"static",
"function",
"aggregate",
"(",
"$",
"array",
",",
"$",
"specialKeys",
"=",
"self",
"::",
"SPECIALS_KEYS",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"new",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=... | Aggregate an array to dot notation
@param array $array Input array
@param array $specialKeys array of key to not aggregate
@param string $prefix prefix
@return array | [
"Aggregate",
"an",
"array",
"to",
"dot",
"notation"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/ArrayModifier.php#L44-L67 |
JoffreyPoreeCoding/MongoDB-ODM | src/Tools/ArrayModifier.php | ArrayModifier.disaggregate | public static function disaggregate($array)
{
$new = [];
foreach ($array as $key => $val) {
if (false !== strpos($key, ".")) {
list($realKey, $aggregated) = explode(".", $key, 2);
$values = self::getDisaggregatedValues(preg_grep("/^$realKey/", array_keys($... | php | public static function disaggregate($array)
{
$new = [];
foreach ($array as $key => $val) {
if (false !== strpos($key, ".")) {
list($realKey, $aggregated) = explode(".", $key, 2);
$values = self::getDisaggregatedValues(preg_grep("/^$realKey/", array_keys($... | [
"public",
"static",
"function",
"disaggregate",
"(",
"$",
"array",
")",
"{",
"$",
"new",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"key",
",",
... | Disaggreate a dot notation array to an multi-dimensionnal array
@param array $array Dot notation array
@return void | [
"Disaggreate",
"a",
"dot",
"notation",
"array",
"to",
"an",
"multi",
"-",
"dimensionnal",
"array"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/ArrayModifier.php#L75-L89 |
JoffreyPoreeCoding/MongoDB-ODM | src/Tools/ArrayModifier.php | ArrayModifier.getDisaggregatedValues | private static function getDisaggregatedValues($keys, $array)
{
$values = [];
foreach ($keys as $key) {
$realKey = explode(".", $key, 2)[1];
$values[$realKey] = $array[$key];
}
return $values;
} | php | private static function getDisaggregatedValues($keys, $array)
{
$values = [];
foreach ($keys as $key) {
$realKey = explode(".", $key, 2)[1];
$values[$realKey] = $array[$key];
}
return $values;
} | [
"private",
"static",
"function",
"getDisaggregatedValues",
"(",
"$",
"keys",
",",
"$",
"array",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"realKey",
"=",
"explode",
"(",
"\".\"",
",",
... | Get values of disaggregated array
@param array $keys Key
@param array $array Array to disaggegate
@return array | [
"Get",
"values",
"of",
"disaggregated",
"array"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Tools/ArrayModifier.php#L98-L106 |
acasademont/wurfl | WURFL/Handlers/Handler.php | WURFL_Handlers_Handler.filter | public function filter($userAgent, $deviceID)
{
if ($this->canHandle($userAgent)) {
$this->updateUserAgentsWithDeviceIDMap($userAgent, $deviceID);
return null;
}
if (isset($this->nextHandler)) {
return $this->nextHandler->filter($userAgent, $deviceID);
... | php | public function filter($userAgent, $deviceID)
{
if ($this->canHandle($userAgent)) {
$this->updateUserAgentsWithDeviceIDMap($userAgent, $deviceID);
return null;
}
if (isset($this->nextHandler)) {
return $this->nextHandler->filter($userAgent, $deviceID);
... | [
"public",
"function",
"filter",
"(",
"$",
"userAgent",
",",
"$",
"deviceID",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canHandle",
"(",
"$",
"userAgent",
")",
")",
"{",
"$",
"this",
"->",
"updateUserAgentsWithDeviceIDMap",
"(",
"$",
"userAgent",
",",
"$",... | Classifies the given $userAgent and specified $deviceID
@param string $userAgent
@param string $deviceID
@return null | [
"Classifies",
"the",
"given",
"$userAgent",
"and",
"specified",
"$deviceID"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Handler.php#L130-L140 |
acasademont/wurfl | WURFL/Handlers/Handler.php | WURFL_Handlers_Handler.persistData | public function persistData()
{
// we sort the array first, useful for doing ris match
if (!empty($this->userAgentsWithDeviceID)) {
ksort($this->userAgentsWithDeviceID);
$this->persistenceProvider->save($this->getPrefix(), $this->userAgentsWithDeviceID);
}
} | php | public function persistData()
{
// we sort the array first, useful for doing ris match
if (!empty($this->userAgentsWithDeviceID)) {
ksort($this->userAgentsWithDeviceID);
$this->persistenceProvider->save($this->getPrefix(), $this->userAgentsWithDeviceID);
}
} | [
"public",
"function",
"persistData",
"(",
")",
"{",
"// we sort the array first, useful for doing ris match",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
")",
"{",
"ksort",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
... | Saves the classified user agents in the persistence provider | [
"Saves",
"the",
"classified",
"user",
"agents",
"in",
"the",
"persistence",
"provider"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Handler.php#L179-L186 |
acasademont/wurfl | WURFL/Handlers/Handler.php | WURFL_Handlers_Handler.getUserAgentsWithDeviceId | public function getUserAgentsWithDeviceId()
{
if (!isset($this->userAgentsWithDeviceID)) {
$this->userAgentsWithDeviceID = $this->persistenceProvider->load($this->getPrefix());
}
return $this->userAgentsWithDeviceID;
} | php | public function getUserAgentsWithDeviceId()
{
if (!isset($this->userAgentsWithDeviceID)) {
$this->userAgentsWithDeviceID = $this->persistenceProvider->load($this->getPrefix());
}
return $this->userAgentsWithDeviceID;
} | [
"public",
"function",
"getUserAgentsWithDeviceId",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"userAgentsWithDeviceID",
")",
")",
"{",
"$",
"this",
"->",
"userAgentsWithDeviceID",
"=",
"$",
"this",
"->",
"persistenceProvider",
"->",
"load"... | Returns a list of User Agents with their Device IDs
@return array User agents and device IDs | [
"Returns",
"a",
"list",
"of",
"User",
"Agents",
"with",
"their",
"Device",
"IDs"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Handler.php#L192-L198 |
acasademont/wurfl | WURFL/Handlers/Handler.php | WURFL_Handlers_Handler.match | public function match(WURFL_Request_GenericRequest $request)
{
if ($this->canHandle($request->userAgentNormalized)) {
return $this->applyMatch($request);
}
if (isset($this->nextHandler)) {
return $this->nextHandler->match($request);
}
... | php | public function match(WURFL_Request_GenericRequest $request)
{
if ($this->canHandle($request->userAgentNormalized)) {
return $this->applyMatch($request);
}
if (isset($this->nextHandler)) {
return $this->nextHandler->match($request);
}
... | [
"public",
"function",
"match",
"(",
"WURFL_Request_GenericRequest",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"canHandle",
"(",
"$",
"request",
"->",
"userAgentNormalized",
")",
")",
"{",
"return",
"$",
"this",
"->",
"applyMatch",
"(",
"$",
"... | Finds the device id for the given request - if it is not found it
delegates to the next available handler
@param WURFL_Request_GenericRequest $request
@return string WURFL Device ID for matching device | [
"Finds",
"the",
"device",
"id",
"for",
"the",
"given",
"request",
"-",
"if",
"it",
"is",
"not",
"found",
"it",
"delegates",
"to",
"the",
"next",
"available",
"handler"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Handler.php#L211-L222 |
acasademont/wurfl | WURFL/Handlers/Handler.php | WURFL_Handlers_Handler.applyMatch | public function applyMatch(WURFL_Request_GenericRequest $request)
{
$class_name = get_class($this);
$request->matchInfo->matcher = $class_name;
$start_time = microtime(true);
$request->matchInfo->cleaned_user_agent = $request->userAgentNormalized;
$userAgent = $this->normaliz... | php | public function applyMatch(WURFL_Request_GenericRequest $request)
{
$class_name = get_class($this);
$request->matchInfo->matcher = $class_name;
$start_time = microtime(true);
$request->matchInfo->cleaned_user_agent = $request->userAgentNormalized;
$userAgent = $this->normaliz... | [
"public",
"function",
"applyMatch",
"(",
"WURFL_Request_GenericRequest",
"$",
"request",
")",
"{",
"$",
"class_name",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"request",
"->",
"matchInfo",
"->",
"matcher",
"=",
"$",
"class_name",
";",
"$",
"start_t... | Template method to apply matching system to user agent
@param WURFL_Request_GenericRequest $request
@return string Device ID | [
"Template",
"method",
"to",
"apply",
"matching",
"system",
"to",
"user",
"agent"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Handler.php#L230-L288 |
acasademont/wurfl | WURFL/Handlers/Handler.php | WURFL_Handlers_Handler.lookForMatchingUserAgent | public function lookForMatchingUserAgent($userAgent)
{
$tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
return WURFL_Handlers_Utils::risMatch(array_keys($this->userAgentsWithDeviceID), $userAgent, $tolerance);
} | php | public function lookForMatchingUserAgent($userAgent)
{
$tolerance = WURFL_Handlers_Utils::firstSlash($userAgent);
return WURFL_Handlers_Utils::risMatch(array_keys($this->userAgentsWithDeviceID), $userAgent, $tolerance);
} | [
"public",
"function",
"lookForMatchingUserAgent",
"(",
"$",
"userAgent",
")",
"{",
"$",
"tolerance",
"=",
"WURFL_Handlers_Utils",
"::",
"firstSlash",
"(",
"$",
"userAgent",
")",
";",
"return",
"WURFL_Handlers_Utils",
"::",
"risMatch",
"(",
"array_keys",
"(",
"$",
... | Find a matching WURFL device from the given $userAgent. Override this method to give an alternative way to do the matching
@param string $userAgent
@return string | [
"Find",
"a",
"matching",
"WURFL",
"device",
"from",
"the",
"given",
"$userAgent",
".",
"Override",
"this",
"method",
"to",
"give",
"an",
"alternative",
"way",
"to",
"do",
"the",
"matching"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Handler.php#L328-L332 |
acasademont/wurfl | WURFL/Handlers/Handler.php | WURFL_Handlers_Handler.applyRecoveryCatchAllMatch | public function applyRecoveryCatchAllMatch($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowserHeavyDutyAnalysis($userAgent)) {
return WURFL_Constants::GENERIC_WEB_BROWSER;
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'CoreMedia')) {
return 'apple_ipho... | php | public function applyRecoveryCatchAllMatch($userAgent)
{
if (WURFL_Handlers_Utils::isDesktopBrowserHeavyDutyAnalysis($userAgent)) {
return WURFL_Constants::GENERIC_WEB_BROWSER;
}
if (WURFL_Handlers_Utils::checkIfContains($userAgent, 'CoreMedia')) {
return 'apple_ipho... | [
"public",
"function",
"applyRecoveryCatchAllMatch",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"WURFL_Handlers_Utils",
"::",
"isDesktopBrowserHeavyDutyAnalysis",
"(",
"$",
"userAgent",
")",
")",
"{",
"return",
"WURFL_Constants",
"::",
"GENERIC_WEB_BROWSER",
";",
"}",... | Applies Catch-All match
@param string $userAgent
@return string WURFL deviceID | [
"Applies",
"Catch",
"-",
"All",
"match"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Handler.php#L369-L445 |
AbuseIO/parser-spamcop | src/Spamcop.php | Spamcop.parse | public function parse()
{
$reports = [ ];
if ($this->parsedMail->getHeader('subject') == "[SpamCop] summary report") {
$this->feedName = 'summary';
$reports = $this->parseSummaryReport();
} elseif ($this->parsedMail->getHeader('subject') == "[SpamCop] Alert") {
... | php | public function parse()
{
$reports = [ ];
if ($this->parsedMail->getHeader('subject') == "[SpamCop] summary report") {
$this->feedName = 'summary';
$reports = $this->parseSummaryReport();
} elseif ($this->parsedMail->getHeader('subject') == "[SpamCop] Alert") {
... | [
"public",
"function",
"parse",
"(",
")",
"{",
"$",
"reports",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"parsedMail",
"->",
"getHeader",
"(",
"'subject'",
")",
"==",
"\"[SpamCop] summary report\"",
")",
"{",
"$",
"this",
"->",
"feedName",
"=",
... | Parse attachments
@return array Returns array with failed or success data
(See parser-common/src/Parser.php) for more info. | [
"Parse",
"attachments"
] | train | https://github.com/AbuseIO/parser-spamcop/blob/6745d54bfee747b66af6e7332a59d554de3d8253/src/Spamcop.php#L31-L98 |
AbuseIO/parser-spamcop | src/Spamcop.php | Spamcop.parseSummaryReport | public function parseSummaryReport()
{
$reports = [ ];
preg_match_all(
"/^\s*".
"(?<ip>[a-f0-9:\.]+)\s+".
"(?<date>\w+\s+\d+\s\d+)h\/".
"(?<days>\d+)\s+".
"(?<trap>\d+)\s+".
"(?<user>\d+)\s+".
"(?<mole>\d+)\s+".
... | php | public function parseSummaryReport()
{
$reports = [ ];
preg_match_all(
"/^\s*".
"(?<ip>[a-f0-9:\.]+)\s+".
"(?<date>\w+\s+\d+\s\d+)h\/".
"(?<days>\d+)\s+".
"(?<trap>\d+)\s+".
"(?<user>\d+)\s+".
"(?<mole>\d+)\s+".
... | [
"public",
"function",
"parseSummaryReport",
"(",
")",
"{",
"$",
"reports",
"=",
"[",
"]",
";",
"preg_match_all",
"(",
"\"/^\\s*\"",
".",
"\"(?<ip>[a-f0-9:\\.]+)\\s+\"",
".",
"\"(?<date>\\w+\\s+\\d+\\s\\d+)h\\/\"",
".",
"\"(?<days>\\d+)\\s+\"",
".",
"\"(?<trap>\\d+)\\s+\""... | This is a spamcop formatted summery with a multiple incidents
@return array $reports | [
"This",
"is",
"a",
"spamcop",
"formatted",
"summery",
"with",
"a",
"multiple",
"incidents"
] | train | https://github.com/AbuseIO/parser-spamcop/blob/6745d54bfee747b66af6e7332a59d554de3d8253/src/Spamcop.php#L105-L141 |
AbuseIO/parser-spamcop | src/Spamcop.php | Spamcop.parseAlerts | public function parseAlerts()
{
$reports = [ ];
preg_match_all(
'/\s*(?<ip>[a-f0-9:\.]+)/',
// Someone from spamcop found it funny to prefix IPv6 addresses, so lets strip that off
str_replace('IPv6 ', '', $this->parsedMail->getMessageBody()),
$matche... | php | public function parseAlerts()
{
$reports = [ ];
preg_match_all(
'/\s*(?<ip>[a-f0-9:\.]+)/',
// Someone from spamcop found it funny to prefix IPv6 addresses, so lets strip that off
str_replace('IPv6 ', '', $this->parsedMail->getMessageBody()),
$matche... | [
"public",
"function",
"parseAlerts",
"(",
")",
"{",
"$",
"reports",
"=",
"[",
"]",
";",
"preg_match_all",
"(",
"'/\\s*(?<ip>[a-f0-9:\\.]+)/'",
",",
"// Someone from spamcop found it funny to prefix IPv6 addresses, so lets strip that off",
"str_replace",
"(",
"'IPv6 '",
",",
... | This is a spamcop formatted alert with a multiple incidents
@return array $reports | [
"This",
"is",
"a",
"spamcop",
"formatted",
"alert",
"with",
"a",
"multiple",
"incidents"
] | train | https://github.com/AbuseIO/parser-spamcop/blob/6745d54bfee747b66af6e7332a59d554de3d8253/src/Spamcop.php#L149-L179 |
AbuseIO/parser-spamcop | src/Spamcop.php | Spamcop.parseSpamReportCustom | public function parseSpamReportCustom()
{
$reports = [ ];
$body = $this->parsedMail->getMessageBody();
// Grab the message part from the body
preg_match(
'/(\[ SpamCop V[0-9\.\]\ ]*+)\r?\n(?<message>.*)\r?\n\[ Offending message \]/s',
$body,
$mat... | php | public function parseSpamReportCustom()
{
$reports = [ ];
$body = $this->parsedMail->getMessageBody();
// Grab the message part from the body
preg_match(
'/(\[ SpamCop V[0-9\.\]\ ]*+)\r?\n(?<message>.*)\r?\n\[ Offending message \]/s',
$body,
$mat... | [
"public",
"function",
"parseSpamReportCustom",
"(",
")",
"{",
"$",
"reports",
"=",
"[",
"]",
";",
"$",
"body",
"=",
"$",
"this",
"->",
"parsedMail",
"->",
"getMessageBody",
"(",
")",
";",
"// Grab the message part from the body",
"preg_match",
"(",
"'/(\\[ SpamC... | This is a spamcop formatted mail with a single incident
@return array $reports | [
"This",
"is",
"a",
"spamcop",
"formatted",
"mail",
"with",
"a",
"single",
"incident"
] | train | https://github.com/AbuseIO/parser-spamcop/blob/6745d54bfee747b66af6e7332a59d554de3d8253/src/Spamcop.php#L187-L261 |
AbuseIO/parser-spamcop | src/Spamcop.php | Spamcop.parseSpamReportArf | public function parseSpamReportArf()
{
$reports = [ ];
//Seriously spamcop? Newlines arent in the CL specifications
$this->arfMail['report'] = str_replace("\r", "", $this->arfMail['report']);
preg_match_all('/([\w\-]+): (.*)[ ]*\r?\n/', $this->arfMail['report'], $regs);
$re... | php | public function parseSpamReportArf()
{
$reports = [ ];
//Seriously spamcop? Newlines arent in the CL specifications
$this->arfMail['report'] = str_replace("\r", "", $this->arfMail['report']);
preg_match_all('/([\w\-]+): (.*)[ ]*\r?\n/', $this->arfMail['report'], $regs);
$re... | [
"public",
"function",
"parseSpamReportArf",
"(",
")",
"{",
"$",
"reports",
"=",
"[",
"]",
";",
"//Seriously spamcop? Newlines arent in the CL specifications",
"$",
"this",
"->",
"arfMail",
"[",
"'report'",
"]",
"=",
"str_replace",
"(",
"\"\\r\"",
",",
"\"\"",
",",... | This is a ARF mail with a single incident
@return array $reports | [
"This",
"is",
"a",
"ARF",
"mail",
"with",
"a",
"single",
"incident"
] | train | https://github.com/AbuseIO/parser-spamcop/blob/6745d54bfee747b66af6e7332a59d554de3d8253/src/Spamcop.php#L269-L333 |
vincentchalamon/VinceCmsSonataAdminBundle | Controller/MenuController.php | MenuController.upAction | public function upAction(Request $request)
{
/** @var MenuRepository $repo */
$repo = $this->get('vince_cms.repository.menu');
/** @var Menu $menu */
$menu = $repo->find($request->get('id'));
if ($menu->getParent()) {
$repo->moveUp($menu);
}
retur... | php | public function upAction(Request $request)
{
/** @var MenuRepository $repo */
$repo = $this->get('vince_cms.repository.menu');
/** @var Menu $menu */
$menu = $repo->find($request->get('id'));
if ($menu->getParent()) {
$repo->moveUp($menu);
}
retur... | [
"public",
"function",
"upAction",
"(",
"Request",
"$",
"request",
")",
"{",
"/** @var MenuRepository $repo */",
"$",
"repo",
"=",
"$",
"this",
"->",
"get",
"(",
"'vince_cms.repository.menu'",
")",
";",
"/** @var Menu $menu */",
"$",
"menu",
"=",
"$",
"repo",
"->... | Move menu up
@author Vincent Chalamon <vincentchalamon@gmail.com>
@param Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Move",
"menu",
"up"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Controller/MenuController.php#L31-L42 |
vincentchalamon/VinceCmsSonataAdminBundle | Controller/MenuController.php | MenuController.downAction | public function downAction(Request $request)
{
/** @var MenuRepository $repo */
$repo = $this->get('vince_cms.repository.menu');
/** @var Menu $menu */
$menu = $repo->find($request->get('id'));
if ($menu->getParent()) {
$repo->moveDown($menu);
}
r... | php | public function downAction(Request $request)
{
/** @var MenuRepository $repo */
$repo = $this->get('vince_cms.repository.menu');
/** @var Menu $menu */
$menu = $repo->find($request->get('id'));
if ($menu->getParent()) {
$repo->moveDown($menu);
}
r... | [
"public",
"function",
"downAction",
"(",
"Request",
"$",
"request",
")",
"{",
"/** @var MenuRepository $repo */",
"$",
"repo",
"=",
"$",
"this",
"->",
"get",
"(",
"'vince_cms.repository.menu'",
")",
";",
"/** @var Menu $menu */",
"$",
"menu",
"=",
"$",
"repo",
"... | Move menu down
@author Vincent Chalamon <vincentchalamon@gmail.com>
@param Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Move",
"menu",
"down"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Controller/MenuController.php#L53-L64 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/TraitIsValid.php | TraitIsValid.setIsValid | public function setIsValid($isValid)
{
if (is_bool($isValid)) {
$this->isValid = $isValid;
} else {
throw new \InvalidArgumentException(
"Invalid value '" . $isValid . "' for argument 'isValid' given."
);
}
return $this;
} | php | public function setIsValid($isValid)
{
if (is_bool($isValid)) {
$this->isValid = $isValid;
} else {
throw new \InvalidArgumentException(
"Invalid value '" . $isValid . "' for argument 'isValid' given."
);
}
return $this;
} | [
"public",
"function",
"setIsValid",
"(",
"$",
"isValid",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"isValid",
")",
")",
"{",
"$",
"this",
"->",
"isValid",
"=",
"$",
"isValid",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"("... | Sets the validation status.
@param bool $isValid
@return $this | [
"Sets",
"the",
"validation",
"status",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/TraitIsValid.php#L22-L33 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/TraitIsValid.php | TraitIsValid.addValidationError | public function addValidationError($errorMessage)
{
if (is_string($errorMessage)) {
$this->validationErrors[] = $errorMessage;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($errorMessage). "' for argument 'errorMessage' given."
... | php | public function addValidationError($errorMessage)
{
if (is_string($errorMessage)) {
$this->validationErrors[] = $errorMessage;
} else {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($errorMessage). "' for argument 'errorMessage' given."
... | [
"public",
"function",
"addValidationError",
"(",
"$",
"errorMessage",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"errorMessage",
")",
")",
"{",
"$",
"this",
"->",
"validationErrors",
"[",
"]",
"=",
"$",
"errorMessage",
";",
"}",
"else",
"{",
"throw",
"n... | Adds a validation error message.
@param string $errorMessage
@return $this | [
"Adds",
"a",
"validation",
"error",
"message",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/TraitIsValid.php#L51-L62 |
activecollab/databasestructure | src/Field/Composite/ParentField.php | ParentField.getFields | public function getFields()
{
$type_field = (new ScalarStringField($this->type_field_name));
$id_field = (new IntegerField($this->name, 0))->size($this->getSize())->unsigned();
if ($this->isRequired()) {
$type_field->required();
$id_field->required();
}
... | php | public function getFields()
{
$type_field = (new ScalarStringField($this->type_field_name));
$id_field = (new IntegerField($this->name, 0))->size($this->getSize())->unsigned();
if ($this->isRequired()) {
$type_field->required();
$id_field->required();
}
... | [
"public",
"function",
"getFields",
"(",
")",
"{",
"$",
"type_field",
"=",
"(",
"new",
"ScalarStringField",
"(",
"$",
"this",
"->",
"type_field_name",
")",
")",
";",
"$",
"id_field",
"=",
"(",
"new",
"IntegerField",
"(",
"$",
"this",
"->",
"name",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/ParentField.php#L88-L99 |
activecollab/databasestructure | src/Field/Composite/ParentField.php | ParentField.getBaseClassMethods | public function getBaseClassMethods($indent, array &$result)
{
$type_getter_name = 'get' . Inflector::classify($this->type_field_name);
$type_setter_name = 'set' . Inflector::classify($this->type_field_name);
$id_getter_name = 'get' . Inflector::classify($this->name);
$id_setter_nam... | php | public function getBaseClassMethods($indent, array &$result)
{
$type_getter_name = 'get' . Inflector::classify($this->type_field_name);
$type_setter_name = 'set' . Inflector::classify($this->type_field_name);
$id_getter_name = 'get' . Inflector::classify($this->name);
$id_setter_nam... | [
"public",
"function",
"getBaseClassMethods",
"(",
"$",
"indent",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"type_getter_name",
"=",
"'get'",
".",
"Inflector",
"::",
"classify",
"(",
"$",
"this",
"->",
"type_field_name",
")",
";",
"$",
"type_setter_nam... | Return methods that this field needs to inject in base class.
@param string $indent
@param array $result | [
"Return",
"methods",
"that",
"this",
"field",
"needs",
"to",
"inject",
"in",
"base",
"class",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/ParentField.php#L107-L186 |
activecollab/databasestructure | src/Field/Composite/ParentField.php | ParentField.onAddedToType | public function onAddedToType(TypeInterface &$type)
{
parent::onAddedToType($type);
if ($this->getAddIndex()) {
$type->addIndex(new Index($this->relation_name, [$this->type_field_name, $this->name]));
$type->addIndex(new Index($this->name));
}
$type->seriali... | php | public function onAddedToType(TypeInterface &$type)
{
parent::onAddedToType($type);
if ($this->getAddIndex()) {
$type->addIndex(new Index($this->relation_name, [$this->type_field_name, $this->name]));
$type->addIndex(new Index($this->name));
}
$type->seriali... | [
"public",
"function",
"onAddedToType",
"(",
"TypeInterface",
"&",
"$",
"type",
")",
"{",
"parent",
"::",
"onAddedToType",
"(",
"$",
"type",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getAddIndex",
"(",
")",
")",
"{",
"$",
"type",
"->",
"addIndex",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/ParentField.php#L191-L201 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.filterByDateTime | public function filterByDateTime($dateTime = null, $comparison = null)
{
if (is_array($dateTime)) {
$useMinMax = false;
if (isset($dateTime['min'])) {
$this->addUsingAlias(LogTableMap::COL_DATE_TIME, $dateTime['min'], Criteria::GREATER_EQUAL);
$useMinM... | php | public function filterByDateTime($dateTime = null, $comparison = null)
{
if (is_array($dateTime)) {
$useMinMax = false;
if (isset($dateTime['min'])) {
$this->addUsingAlias(LogTableMap::COL_DATE_TIME, $dateTime['min'], Criteria::GREATER_EQUAL);
$useMinM... | [
"public",
"function",
"filterByDateTime",
"(",
"$",
"dateTime",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"dateTime",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",... | Filter the query on the date_time column
Example usage:
<code>
$query->filterByDateTime('2011-03-14'); // WHERE date_time = '2011-03-14'
$query->filterByDateTime('now'); // WHERE date_time = '2011-03-14'
$query->filterByDateTime(array('max' => 'yesterday')); // WHERE date_time > '2011-03-13'
</code>
@param mixed ... | [
"Filter",
"the",
"query",
"on",
"the",
"date_time",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L346-L367 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.filterByLogText | public function filterByLogText($logText = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($logText)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $logText)) {
$logText = str_replace('*', '%', $logText);
... | php | public function filterByLogText($logText = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($logText)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $logText)) {
$logText = str_replace('*', '%', $logText);
... | [
"public",
"function",
"filterByLogText",
"(",
"$",
"logText",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"logText",
")",
")",
"{",
"$",
"comparis... | Filter the query on the log_text column
Example usage:
<code>
$query->filterByLogText('fooValue'); // WHERE log_text = 'fooValue'
$query->filterByLogText('%fooValue%'); // WHERE log_text LIKE '%fooValue%'
</code>
@param string $logText The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@para... | [
"Filter",
"the",
"query",
"on",
"the",
"log_text",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L384-L396 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.filterByUserId | public function filterByUserId($userId = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($userId)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $userId)) {
$userId = str_replace('*', '%', $userId);
... | php | public function filterByUserId($userId = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($userId)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $userId)) {
$userId = str_replace('*', '%', $userId);
... | [
"public",
"function",
"filterByUserId",
"(",
"$",
"userId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"userId",
")",
")",
"{",
"$",
"comparison"... | Filter the query on the user_id column
Example usage:
<code>
$query->filterByUserId('fooValue'); // WHERE user_id = 'fooValue'
$query->filterByUserId('%fooValue%'); // WHERE user_id LIKE '%fooValue%'
</code>
@param string $userId The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param ... | [
"Filter",
"the",
"query",
"on",
"the",
"user_id",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L413-L425 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.filterByUsername | public function filterByUsername($username = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($username)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $username)) {
$username = str_replace('*', '%', $username);
... | php | public function filterByUsername($username = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($username)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $username)) {
$username = str_replace('*', '%', $username);
... | [
"public",
"function",
"filterByUsername",
"(",
"$",
"username",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"username",
")",
")",
"{",
"$",
"compa... | Filter the query on the username column
Example usage:
<code>
$query->filterByUsername('fooValue'); // WHERE username = 'fooValue'
$query->filterByUsername('%fooValue%'); // WHERE username LIKE '%fooValue%'
</code>
@param string $username The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@p... | [
"Filter",
"the",
"query",
"on",
"the",
"username",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L442-L454 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.filterBySessionId | public function filterBySessionId($sessionId = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($sessionId)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $sessionId)) {
$sessionId = str_replace('*', '%', $sessionId... | php | public function filterBySessionId($sessionId = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($sessionId)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $sessionId)) {
$sessionId = str_replace('*', '%', $sessionId... | [
"public",
"function",
"filterBySessionId",
"(",
"$",
"sessionId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"sessionId",
")",
")",
"{",
"$",
"co... | Filter the query on the session_id column
Example usage:
<code>
$query->filterBySessionId('fooValue'); // WHERE session_id = 'fooValue'
$query->filterBySessionId('%fooValue%'); // WHERE session_id LIKE '%fooValue%'
</code>
@param string $sessionId The value to use as filter.
Accepts wildcards (* and % trigger a... | [
"Filter",
"the",
"query",
"on",
"the",
"session_id",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L471-L483 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.filterByClientAgent | public function filterByClientAgent($clientAgent = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientAgent)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientAgent)) {
$clientAgent = str_replace('*', '%', ... | php | public function filterByClientAgent($clientAgent = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientAgent)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientAgent)) {
$clientAgent = str_replace('*', '%', ... | [
"public",
"function",
"filterByClientAgent",
"(",
"$",
"clientAgent",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"clientAgent",
")",
")",
"{",
"$",... | Filter the query on the client_agent column
Example usage:
<code>
$query->filterByClientAgent('fooValue'); // WHERE client_agent = 'fooValue'
$query->filterByClientAgent('%fooValue%'); // WHERE client_agent LIKE '%fooValue%'
</code>
@param string $clientAgent The value to use as filter.
Accepts wildcards (* and... | [
"Filter",
"the",
"query",
"on",
"the",
"client_agent",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L558-L570 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.filterByClientPlatform | public function filterByClientPlatform($clientPlatform = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientPlatform)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientPlatform)) {
$clientPlatform = str_rep... | php | public function filterByClientPlatform($clientPlatform = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($clientPlatform)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $clientPlatform)) {
$clientPlatform = str_rep... | [
"public",
"function",
"filterByClientPlatform",
"(",
"$",
"clientPlatform",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"clientPlatform",
")",
")",
"{... | Filter the query on the client_platform column
Example usage:
<code>
$query->filterByClientPlatform('fooValue'); // WHERE client_platform = 'fooValue'
$query->filterByClientPlatform('%fooValue%'); // WHERE client_platform LIKE '%fooValue%'
</code>
@param string $clientPlatform The value to use as filter.
Accept... | [
"Filter",
"the",
"query",
"on",
"the",
"client_platform",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L587-L599 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php | LogQuery.prune | public function prune($log = null)
{
if ($log) {
$this->addUsingAlias(LogTableMap::COL_ID, $log->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | php | public function prune($log = null)
{
if ($log) {
$this->addUsingAlias(LogTableMap::COL_ID, $log->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | [
"public",
"function",
"prune",
"(",
"$",
"log",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"log",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"LogTableMap",
"::",
"COL_ID",
",",
"$",
"log",
"->",
"getId",
"(",
")",
",",
"Criteria",
"::",
"NOT_EQ... | Exclude object from result
@param ChildLog $log Object to remove from the list of results
@return $this|ChildLogQuery The current query, for fluid interface | [
"Exclude",
"object",
"from",
"result"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/LogQuery.php#L608-L615 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.