repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
opis-colibri/core | src/Module.php | Module.resolveInstaller | protected function resolveInstaller(): ?string
{
$value = $this->getModuleInfo()['installer'] ?? null;
return is_string($value) ? $value : null;
} | php | protected function resolveInstaller(): ?string
{
$value = $this->getModuleInfo()['installer'] ?? null;
return is_string($value) ? $value : null;
} | [
"protected",
"function",
"resolveInstaller",
"(",
")",
":",
"?",
"string",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getModuleInfo",
"(",
")",
"[",
"'installer'",
"]",
"??",
"null",
";",
"return",
"is_string",
"(",
"$",
"value",
")",
"?",
"$",
"value... | Resolve installer class
@return string|null | [
"Resolve",
"installer",
"class"
] | 77efaf8e2034293588d3759e0b8711e96757d954 | https://github.com/opis-colibri/core/blob/77efaf8e2034293588d3759e0b8711e96757d954/src/Module.php#L399-L404 | train |
opis-colibri/core | src/Module.php | Module.resolveAssets | protected function resolveAssets(): ?string
{
$module = $this->getModuleInfo();
if (!isset($module['assets'])) {
return null;
}
$directory = $this->directory() . DIRECTORY_SEPARATOR . trim($module['assets'], DIRECTORY_SEPARATOR);
return is_dir($directory) ? realpa... | php | protected function resolveAssets(): ?string
{
$module = $this->getModuleInfo();
if (!isset($module['assets'])) {
return null;
}
$directory = $this->directory() . DIRECTORY_SEPARATOR . trim($module['assets'], DIRECTORY_SEPARATOR);
return is_dir($directory) ? realpa... | [
"protected",
"function",
"resolveAssets",
"(",
")",
":",
"?",
"string",
"{",
"$",
"module",
"=",
"$",
"this",
"->",
"getModuleInfo",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"module",
"[",
"'assets'",
"]",
")",
")",
"{",
"return",
"null",
... | Resolve assets dir
@return string|null | [
"Resolve",
"assets",
"dir"
] | 77efaf8e2034293588d3759e0b8711e96757d954 | https://github.com/opis-colibri/core/blob/77efaf8e2034293588d3759e0b8711e96757d954/src/Module.php#L411-L419 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initTableTypes | private function initTableTypes()
{
$this->tableTypes = [];
foreach ($this->loadTableTypes() as $type) {
if (!$type instanceof TableTypeInterface) {
throw new UnexpectedTypeException($type, TableTypeInterface::class);
}
$this->tableTypes[get_clas... | php | private function initTableTypes()
{
$this->tableTypes = [];
foreach ($this->loadTableTypes() as $type) {
if (!$type instanceof TableTypeInterface) {
throw new UnexpectedTypeException($type, TableTypeInterface::class);
}
$this->tableTypes[get_clas... | [
"private",
"function",
"initTableTypes",
"(",
")",
"{",
"$",
"this",
"->",
"tableTypes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadTableTypes",
"(",
")",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"type",
"instanceof",
"Table... | Initializes the table types.
@throws UnexpectedTypeException if any registered type is not an instance of TableTypeInterface | [
"Initializes",
"the",
"table",
"types",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L432-L443 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initTableTypeExtensions | private function initTableTypeExtensions()
{
$this->tableTypeExtensions = [];
foreach ($this->loadTableTypeExtensions() as $extension) {
if (!$extension instanceof TableTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, TableTypeExtensionInterface::c... | php | private function initTableTypeExtensions()
{
$this->tableTypeExtensions = [];
foreach ($this->loadTableTypeExtensions() as $extension) {
if (!$extension instanceof TableTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, TableTypeExtensionInterface::c... | [
"private",
"function",
"initTableTypeExtensions",
"(",
")",
"{",
"$",
"this",
"->",
"tableTypeExtensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadTableTypeExtensions",
"(",
")",
"as",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"$",
... | Initializes the table type extensions.
@throws UnexpectedTypeException if any registered type extension is not
an instance of FormTypeExtensionInterface | [
"Initializes",
"the",
"table",
"type",
"extensions",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L451-L464 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initColumnTypes | private function initColumnTypes()
{
$this->columnTypes = [];
foreach ($this->loadColumnTypes() as $type) {
if (!$type instanceof ColumnTypeInterface) {
throw new UnexpectedTypeException($type, ColumnTypeInterface::class);
}
$this->columnTypes[ge... | php | private function initColumnTypes()
{
$this->columnTypes = [];
foreach ($this->loadColumnTypes() as $type) {
if (!$type instanceof ColumnTypeInterface) {
throw new UnexpectedTypeException($type, ColumnTypeInterface::class);
}
$this->columnTypes[ge... | [
"private",
"function",
"initColumnTypes",
"(",
")",
"{",
"$",
"this",
"->",
"columnTypes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadColumnTypes",
"(",
")",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"type",
"instanceof",
"Co... | Initializes the column types.
@throws UnexpectedTypeException if any registered type is not an instance of ColumnTypeInterface | [
"Initializes",
"the",
"column",
"types",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L471-L482 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initColumnTypeExtensions | private function initColumnTypeExtensions()
{
$this->columnTypeExtensions = [];
foreach ($this->loadColumnTypeExtensions() as $extension) {
if (!$extension instanceof ColumnTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, ColumnTypeExtensionInterfa... | php | private function initColumnTypeExtensions()
{
$this->columnTypeExtensions = [];
foreach ($this->loadColumnTypeExtensions() as $extension) {
if (!$extension instanceof ColumnTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, ColumnTypeExtensionInterfa... | [
"private",
"function",
"initColumnTypeExtensions",
"(",
")",
"{",
"$",
"this",
"->",
"columnTypeExtensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadColumnTypeExtensions",
"(",
")",
"as",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"$",... | Initializes the column type extensions.
@throws UnexpectedTypeException if any registered type extension is not
an instance of FormTypeExtensionInterface | [
"Initializes",
"the",
"column",
"type",
"extensions",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L490-L503 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initFilterTypes | private function initFilterTypes()
{
$this->filterTypes = [];
foreach ($this->loadFilterTypes() as $type) {
if (!$type instanceof FilterTypeInterface) {
throw new UnexpectedTypeException($type, FilterTypeInterface::class);
}
$this->filterTypes[ge... | php | private function initFilterTypes()
{
$this->filterTypes = [];
foreach ($this->loadFilterTypes() as $type) {
if (!$type instanceof FilterTypeInterface) {
throw new UnexpectedTypeException($type, FilterTypeInterface::class);
}
$this->filterTypes[ge... | [
"private",
"function",
"initFilterTypes",
"(",
")",
"{",
"$",
"this",
"->",
"filterTypes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadFilterTypes",
"(",
")",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"type",
"instanceof",
"Fi... | Initializes the filter types.
@throws UnexpectedTypeException if any registered type is not an instance of FilterTypeInterface | [
"Initializes",
"the",
"filter",
"types",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L510-L521 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initFilterTypeExtensions | private function initFilterTypeExtensions()
{
$this->filterTypeExtensions = [];
foreach ($this->loadFilterTypeExtensions() as $extension) {
if (!$extension instanceof FilterTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, FilterTypeExtensionInterfa... | php | private function initFilterTypeExtensions()
{
$this->filterTypeExtensions = [];
foreach ($this->loadFilterTypeExtensions() as $extension) {
if (!$extension instanceof FilterTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, FilterTypeExtensionInterfa... | [
"private",
"function",
"initFilterTypeExtensions",
"(",
")",
"{",
"$",
"this",
"->",
"filterTypeExtensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadFilterTypeExtensions",
"(",
")",
"as",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"$",... | Initializes the filter type extensions.
@throws UnexpectedTypeException if any registered type extension is not
an instance of FormTypeExtensionInterface | [
"Initializes",
"the",
"filter",
"type",
"extensions",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L529-L542 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initActionTypes | private function initActionTypes()
{
$this->actionTypes = [];
foreach ($this->loadActionTypes() as $type) {
if (!$type instanceof ActionTypeInterface) {
throw new UnexpectedTypeException($type, ActionTypeInterface::class);
}
$this->actionTypes[ge... | php | private function initActionTypes()
{
$this->actionTypes = [];
foreach ($this->loadActionTypes() as $type) {
if (!$type instanceof ActionTypeInterface) {
throw new UnexpectedTypeException($type, ActionTypeInterface::class);
}
$this->actionTypes[ge... | [
"private",
"function",
"initActionTypes",
"(",
")",
"{",
"$",
"this",
"->",
"actionTypes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadActionTypes",
"(",
")",
"as",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"type",
"instanceof",
"Ac... | Initializes the action types.
@throws UnexpectedTypeException if any registered type is not an instance of ActionTypeInterface | [
"Initializes",
"the",
"action",
"types",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L549-L560 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initActionTypeExtensions | private function initActionTypeExtensions()
{
$this->actionTypeExtensions = [];
foreach ($this->loadActionTypeExtensions() as $extension) {
if (!$extension instanceof ActionTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, ActionTypeExtensionInterfa... | php | private function initActionTypeExtensions()
{
$this->actionTypeExtensions = [];
foreach ($this->loadActionTypeExtensions() as $extension) {
if (!$extension instanceof ActionTypeExtensionInterface) {
throw new UnexpectedTypeException($extension, ActionTypeExtensionInterfa... | [
"private",
"function",
"initActionTypeExtensions",
"(",
")",
"{",
"$",
"this",
"->",
"actionTypeExtensions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadActionTypeExtensions",
"(",
")",
"as",
"$",
"extension",
")",
"{",
"if",
"(",
"!",
"$",... | Initializes the action type extensions.
@throws UnexpectedTypeException if any registered type extension is not
an instance of FormTypeExtensionInterface | [
"Initializes",
"the",
"action",
"type",
"extensions",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L568-L581 | train |
ekyna/Table | Extension/AbstractTableExtension.php | AbstractTableExtension.initAdapterFactories | private function initAdapterFactories()
{
$this->adapterFactories = [];
foreach ($this->loadAdapterFactories() as $adapter) {
if (!$adapter instanceof AdapterFactoryInterface) {
throw new UnexpectedTypeException($adapter, AdapterFactoryInterface::class);
}
... | php | private function initAdapterFactories()
{
$this->adapterFactories = [];
foreach ($this->loadAdapterFactories() as $adapter) {
if (!$adapter instanceof AdapterFactoryInterface) {
throw new UnexpectedTypeException($adapter, AdapterFactoryInterface::class);
}
... | [
"private",
"function",
"initAdapterFactories",
"(",
")",
"{",
"$",
"this",
"->",
"adapterFactories",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadAdapterFactories",
"(",
")",
"as",
"$",
"adapter",
")",
"{",
"if",
"(",
"!",
"$",
"adapter",
... | Initializes the adapter factories.
@throws UnexpectedTypeException if any registered adapter factory is not an instance of AdapterFactoryInterface | [
"Initializes",
"the",
"adapter",
"factories",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Extension/AbstractTableExtension.php#L588-L599 | train |
squareproton/Bond | src/Bond/Pg/Catalog/Repository/Type.php | Type.getEnumOptions | public function getEnumOptions( $oid )
{
$query = new Query(
"SELECT enumlabel FROM pg_enum WHERE enumtypid = %oid:int%",
array(
'oid' => $oid
)
);
return $this->db->query( $query )->fetch();
} | php | public function getEnumOptions( $oid )
{
$query = new Query(
"SELECT enumlabel FROM pg_enum WHERE enumtypid = %oid:int%",
array(
'oid' => $oid
)
);
return $this->db->query( $query )->fetch();
} | [
"public",
"function",
"getEnumOptions",
"(",
"$",
"oid",
")",
"{",
"$",
"query",
"=",
"new",
"Query",
"(",
"\"SELECT enumlabel FROM pg_enum WHERE enumtypid = %oid:int%\"",
",",
"array",
"(",
"'oid'",
"=>",
"$",
"oid",
")",
")",
";",
"return",
"$",
"this",
"->"... | Get array of enum options
@return array() | [
"Get",
"array",
"of",
"enum",
"options"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/Repository/Type.php#L96-L108 | train |
squareproton/Bond | src/Bond/Pg/Catalog/Repository/Type.php | Type.findByName | public function findByName( $name )
{
$result = $this->db->query(
new Query( <<<SQL
SELECT
t.oid AS oid,
t.typname AS name,
n.nspname as "schema",
t.typlen AS length,
t.typtype AS type,
t.typcategory AS category,
t.typarray AS "arrayType",
t.typdefault AS default... | php | public function findByName( $name )
{
$result = $this->db->query(
new Query( <<<SQL
SELECT
t.oid AS oid,
t.typname AS name,
n.nspname as "schema",
t.typlen AS length,
t.typtype AS type,
t.typcategory AS category,
t.typarray AS "arrayType",
t.typdefault AS default... | [
"public",
"function",
"findByName",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"db",
"->",
"query",
"(",
"new",
"Query",
"(",
" <<<SQL\nSELECT\n t.oid AS oid,\n t.typname AS name,\n n.nspname as \"schema\",\n t.typlen AS length,\n t.ty... | Init a type by it's name. Most likely used for enum types
@return Type|null | [
"Init",
"a",
"type",
"by",
"it",
"s",
"name",
".",
"Most",
"likely",
"used",
"for",
"enum",
"types"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Catalog/Repository/Type.php#L114-L146 | train |
ornament-orm/core | src/State.php | State.isDirty | public function isDirty() : bool
{
foreach ($this->__state as $prop => $val) {
if ($this->isModified($prop)) {
return true;
}
}
return false;
} | php | public function isDirty() : bool
{
foreach ($this->__state as $prop => $val) {
if ($this->isModified($prop)) {
return true;
}
}
return false;
} | [
"public",
"function",
"isDirty",
"(",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"__state",
"as",
"$",
"prop",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isModified",
"(",
"$",
"prop",
")",
")",
"{",
"return",
"true... | Returns true if any of the model's properties was modified.
@return bool | [
"Returns",
"true",
"if",
"any",
"of",
"the",
"model",
"s",
"properties",
"was",
"modified",
"."
] | b573c89d11a183c2e0e11afe8b6fdd56b2cd5ba8 | https://github.com/ornament-orm/core/blob/b573c89d11a183c2e0e11afe8b6fdd56b2cd5ba8/src/State.php#L14-L22 | train |
linpax/microphp-framework | src/file/FileHelper.php | FileHelper.removeDir | public static function removeDir($path)
{
if (is_file($path)) {
unlink($path);
} else {
foreach (scandir($path) as $dir) {
if ($dir === '.' || $dir === '..') {
continue;
}
static::removeDir($path.'/'.$dir);
... | php | public static function removeDir($path)
{
if (is_file($path)) {
unlink($path);
} else {
foreach (scandir($path) as $dir) {
if ($dir === '.' || $dir === '..') {
continue;
}
static::removeDir($path.'/'.$dir);
... | [
"public",
"static",
"function",
"removeDir",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"path",
")",
")",
"{",
"unlink",
"(",
"$",
"path",
")",
";",
"}",
"else",
"{",
"foreach",
"(",
"scandir",
"(",
"$",
"path",
")",
"as",
"$",
... | Recursive remove dir
@access public
@param string $path path to remove
@return void
@static | [
"Recursive",
"remove",
"dir"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/file/FileHelper.php#L63-L78 | train |
linpax/microphp-framework | src/file/FileHelper.php | FileHelper.recurseCopyIfEdited | public static function recurseCopyIfEdited($src = '', $dst = '', array $excludes = ['php'])
{
if (!is_dir($dst) && (!mkdir($dst) && !is_dir($dst))) {
throw new Exception('Copy dir error, access denied for path: '.$dst);
}
$dir = opendir($src);
if (!$dir) {
th... | php | public static function recurseCopyIfEdited($src = '', $dst = '', array $excludes = ['php'])
{
if (!is_dir($dst) && (!mkdir($dst) && !is_dir($dst))) {
throw new Exception('Copy dir error, access denied for path: '.$dst);
}
$dir = opendir($src);
if (!$dir) {
th... | [
"public",
"static",
"function",
"recurseCopyIfEdited",
"(",
"$",
"src",
"=",
"''",
",",
"$",
"dst",
"=",
"''",
",",
"array",
"$",
"excludes",
"=",
"[",
"'php'",
"]",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"dst",
")",
"&&",
"(",
"!",
"mkdir... | Recursive copy files if edited
@access public
@param string $src source path
@param string $dst destination path
@param array $excludes excludes extensions
@return void
@throws Exception
@static | [
"Recursive",
"copy",
"files",
"if",
"edited"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/file/FileHelper.php#L125-L159 | train |
Wedeto/HTTP | src/Session.php | Session.start | public function start()
{
if ($this->active)
return $this;
if (PHP_SAPI === "cli")
{
$this->startCLISession();
}
else
{
// @codeCoverageIgnoreStart
$this->startHTTPSession();
// @codeCoverageIgnoreEnd
... | php | public function start()
{
if ($this->active)
return $this;
if (PHP_SAPI === "cli")
{
$this->startCLISession();
}
else
{
// @codeCoverageIgnoreStart
$this->startHTTPSession();
// @codeCoverageIgnoreEnd
... | [
"public",
"function",
"start",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"active",
")",
"return",
"$",
"this",
";",
"if",
"(",
"PHP_SAPI",
"===",
"\"cli\"",
")",
"{",
"$",
"this",
"->",
"startCLISession",
"(",
")",
";",
"}",
"else",
"{",
"// @co... | Actually start the session
@return Session Provide fluent interface | [
"Actually",
"start",
"the",
"session"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Session.php#L130-L150 | train |
Wedeto/HTTP | src/Session.php | Session.setSessionID | public function setSessionID(string $session_id)
{
if (!defined('WEDETO_TEST') || WEDETO_TEST === 0)
throw new \RuntimeException("Cannot change the session ID");
$this->session_id = $session_id;
return $this;
} | php | public function setSessionID(string $session_id)
{
if (!defined('WEDETO_TEST') || WEDETO_TEST === 0)
throw new \RuntimeException("Cannot change the session ID");
$this->session_id = $session_id;
return $this;
} | [
"public",
"function",
"setSessionID",
"(",
"string",
"$",
"session_id",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"'WEDETO_TEST'",
")",
"||",
"WEDETO_TEST",
"===",
"0",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Cannot change the session ID\"",
")",
... | Change the session ID, useful for tests. Disallowed in normal operation.
@return Session Provide fluent interface
@codeCoverageIgnore | [
"Change",
"the",
"session",
"ID",
"useful",
"for",
"tests",
".",
"Disallowed",
"in",
"normal",
"operation",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Session.php#L175-L182 | train |
Wedeto/HTTP | src/Session.php | Session.startHTTPSession | public function startHTTPSession()
{
// @codeCoverageIgnoreStart
// Safety measure - can't test this without replacing PHP
if (session_status() === PHP_SESSION_DISABLED)
throw new \RuntimeException("Sesssions are disabled");
// @codeCoverageIgnoreEnd
if (session_... | php | public function startHTTPSession()
{
// @codeCoverageIgnoreStart
// Safety measure - can't test this without replacing PHP
if (session_status() === PHP_SESSION_DISABLED)
throw new \RuntimeException("Sesssions are disabled");
// @codeCoverageIgnoreEnd
if (session_... | [
"public",
"function",
"startHTTPSession",
"(",
")",
"{",
"// @codeCoverageIgnoreStart",
"// Safety measure - can't test this without replacing PHP",
"if",
"(",
"session_status",
"(",
")",
"===",
"PHP_SESSION_DISABLED",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"... | Set up a HTTP session using cookies and the PHP session machinery
@return Session Provides fluent interface | [
"Set",
"up",
"a",
"HTTP",
"session",
"using",
"cookies",
"and",
"the",
"PHP",
"session",
"machinery"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Session.php#L204-L257 | train |
Wedeto/HTTP | src/Session.php | Session.secureSession | private function secureSession()
{
$expired = false;
if ($this->has('session_mgmt', 'destroyed'))
{
$when = $this->get('session_mgmt', 'destroyed');
$ua = $this->get('session_mgmt', 'last_ua');
$ip = $this->get('session_mgmt', 'last_ip');
$now... | php | private function secureSession()
{
$expired = false;
if ($this->has('session_mgmt', 'destroyed'))
{
$when = $this->get('session_mgmt', 'destroyed');
$ua = $this->get('session_mgmt', 'last_ua');
$ip = $this->get('session_mgmt', 'last_ip');
$now... | [
"private",
"function",
"secureSession",
"(",
")",
"{",
"$",
"expired",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"'session_mgmt'",
",",
"'destroyed'",
")",
")",
"{",
"$",
"when",
"=",
"$",
"this",
"->",
"get",
"(",
"'session_mgmt'",
... | Secure the session
This method checks if the session was destroyed, and if so, if a redirect to a new
session should be done. The new session ID is stored and will be sent to the client iff:
- Less than 1 minute has passed since the previous session was destroyed
- The client has the same user agent and IP-address as... | [
"Secure",
"the",
"session"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Session.php#L271-L344 | train |
Wedeto/HTTP | src/Session.php | Session.resetID | public function resetID()
{
if (session_status() === PHP_SESSION_ACTIVE)
{
$this->set('session_mgmt', 'destroyed', time());
$auth = $this->get('authentication');
if ($auth)
unset($this['authentication']);
$new_session_id = self::create... | php | public function resetID()
{
if (session_status() === PHP_SESSION_ACTIVE)
{
$this->set('session_mgmt', 'destroyed', time());
$auth = $this->get('authentication');
if ($auth)
unset($this['authentication']);
$new_session_id = self::create... | [
"public",
"function",
"resetID",
"(",
")",
"{",
"if",
"(",
"session_status",
"(",
")",
"===",
"PHP_SESSION_ACTIVE",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"'session_mgmt'",
",",
"'destroyed'",
",",
"time",
"(",
")",
")",
";",
"$",
"auth",
"=",
"$",
... | Should be called when the session ID should be changed, for example
after logging in or out.
@return Session Provides fluent interface | [
"Should",
"be",
"called",
"when",
"the",
"session",
"ID",
"should",
"be",
"changed",
"for",
"example",
"after",
"logging",
"in",
"or",
"out",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Session.php#L351-L382 | train |
Wedeto/HTTP | src/Session.php | Session.create_new_id | private static function create_new_id(string $prefix = "Wedeto")
{
if (version_compare(PHP_VERSION, '7.1.0') > 0)
return session_create_id($prefix);
return $prefix . bin2hex(random_bytes(16));
} | php | private static function create_new_id(string $prefix = "Wedeto")
{
if (version_compare(PHP_VERSION, '7.1.0') > 0)
return session_create_id($prefix);
return $prefix . bin2hex(random_bytes(16));
} | [
"private",
"static",
"function",
"create_new_id",
"(",
"string",
"$",
"prefix",
"=",
"\"Wedeto\"",
")",
"{",
"if",
"(",
"version_compare",
"(",
"PHP_VERSION",
",",
"'7.1.0'",
")",
">",
"0",
")",
"return",
"session_create_id",
"(",
"$",
"prefix",
")",
";",
... | Helper function. PHP 7.1 introduces session_create_id function. This
is used in PHP 7.1 but a fallback using random_bytes is used on
PHP 7.0.
@param string $prefix A prefix to prepend to the session ID
@return string A hexadecimal session ID | [
"Helper",
"function",
".",
"PHP",
"7",
".",
"1",
"introduces",
"session_create_id",
"function",
".",
"This",
"is",
"used",
"in",
"PHP",
"7",
".",
"1",
"but",
"a",
"fallback",
"using",
"random_bytes",
"is",
"used",
"on",
"PHP",
"7",
".",
"0",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Session.php#L392-L397 | train |
Wedeto/HTTP | src/Session.php | Session.destroy | public function destroy()
{
if ($this->active)
{
$this->clear();
if (session_status() === PHP_SESSION_ACTIVE)
session_commit();
$this->active = false;
}
return $this;
} | php | public function destroy()
{
if ($this->active)
{
$this->clear();
if (session_status() === PHP_SESSION_ACTIVE)
session_commit();
$this->active = false;
}
return $this;
} | [
"public",
"function",
"destroy",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"active",
")",
"{",
"$",
"this",
"->",
"clear",
"(",
")",
";",
"if",
"(",
"session_status",
"(",
")",
"===",
"PHP_SESSION_ACTIVE",
")",
"session_commit",
"(",
")",
";",
"$"... | Should be called when the session should be cleared and destroyed.
@return Wedeto\HTTP\Session Provides fluent interface | [
"Should",
"be",
"called",
"when",
"the",
"session",
"should",
"be",
"cleared",
"and",
"destroyed",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/Session.php#L450-L460 | train |
jenskooij/cloudcontrol | src/cc/ResponseHeaders.php | ResponseHeaders.init | public static function init()
{
self::add(self::HEADER_SET_COOKIE, '__Host-sess=' . session_id() . '; path=' . Request::$subfolders . '; Secure; HttpOnly; SameSite;');
if (Request::isSecure()) {
self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_... | php | public static function init()
{
self::add(self::HEADER_SET_COOKIE, '__Host-sess=' . session_id() . '; path=' . Request::$subfolders . '; Secure; HttpOnly; SameSite;');
if (Request::isSecure()) {
self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_... | [
"public",
"static",
"function",
"init",
"(",
")",
"{",
"self",
"::",
"add",
"(",
"self",
"::",
"HEADER_SET_COOKIE",
",",
"'__Host-sess='",
".",
"session_id",
"(",
")",
".",
"'; path='",
".",
"Request",
"::",
"$",
"subfolders",
".",
"'; Secure; HttpOnly; SameSi... | Adds content security policy headers | [
"Adds",
"content",
"security",
"policy",
"headers"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/ResponseHeaders.php#L79-L94 | train |
phata/widgetfy | src/Site/Youtube.php | Youtube.parseParams | public static function parseParams($url_parsed) {
$vid = FALSE; $url_seperator = FALSE;
if (preg_match('/^\/watch$/', $url_parsed['path'])) {
// new Youtube utilizes fragment part instead of query
$fragment_regex = '/^\!v\=([a-zA-Z0-9]+).*$/';
if (isset($url_parsed... | php | public static function parseParams($url_parsed) {
$vid = FALSE; $url_seperator = FALSE;
if (preg_match('/^\/watch$/', $url_parsed['path'])) {
// new Youtube utilizes fragment part instead of query
$fragment_regex = '/^\!v\=([a-zA-Z0-9]+).*$/';
if (isset($url_parsed... | [
"public",
"static",
"function",
"parseParams",
"(",
"$",
"url_parsed",
")",
"{",
"$",
"vid",
"=",
"FALSE",
";",
"$",
"url_seperator",
"=",
"FALSE",
";",
"if",
"(",
"preg_match",
"(",
"'/^\\/watch$/'",
",",
"$",
"url_parsed",
"[",
"'path'",
"]",
")",
")",... | helper function
extract video id and other parameters from url
@param string[] $url_parsed result of parse_url($url) | [
"helper",
"function",
"extract",
"video",
"id",
"and",
"other",
"parameters",
"from",
"url"
] | 00102c35ec5267b42c627f1e34b8e64a7dd3590c | https://github.com/phata/widgetfy/blob/00102c35ec5267b42c627f1e34b8e64a7dd3590c/src/Site/Youtube.php#L200-L255 | train |
PageBoost/hipchat-php-v2 | src/PageBoost/HipChatV2/Resources/Rooms.php | Rooms.update | public function update($name, $is_public, $is_archived, $is_guest_accessible, $topic, $owner_user_id)
{
$queryParams = array(
'name' => $name,
'privacy' => (($is_public === true) ? 'public' : 'private' ),
'is_archived' => $is_archived,
'is_guest_accessible' =>... | php | public function update($name, $is_public, $is_archived, $is_guest_accessible, $topic, $owner_user_id)
{
$queryParams = array(
'name' => $name,
'privacy' => (($is_public === true) ? 'public' : 'private' ),
'is_archived' => $is_archived,
'is_guest_accessible' =>... | [
"public",
"function",
"update",
"(",
"$",
"name",
",",
"$",
"is_public",
",",
"$",
"is_archived",
",",
"$",
"is_guest_accessible",
",",
"$",
"topic",
",",
"$",
"owner_user_id",
")",
"{",
"$",
"queryParams",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"name",... | Update room
All values are required!
@param string $name
@param bool $is_public
@param bool $is_archived
@param bool $is_guest_accessible
@param string $topic
@param int|string $owner_user_id | [
"Update",
"room",
"All",
"values",
"are",
"required!"
] | 47625e17fba273b7cc916268d972b4ca8cc48c0c | https://github.com/PageBoost/hipchat-php-v2/blob/47625e17fba273b7cc916268d972b4ca8cc48c0c/src/PageBoost/HipChatV2/Resources/Rooms.php#L89-L106 | train |
PageBoost/hipchat-php-v2 | src/PageBoost/HipChatV2/Resources/Rooms.php | Rooms.setTopic | public function setTopic($topic)
{
$queryParams = array(
'topic' => $topic,
);
$room_id_or_name = $this->getId();
$response = $this->request->put('room/'.$room_id_or_name.'/topic', $queryParams);
return $this->request->returnResponseObject($response);
} | php | public function setTopic($topic)
{
$queryParams = array(
'topic' => $topic,
);
$room_id_or_name = $this->getId();
$response = $this->request->put('room/'.$room_id_or_name.'/topic', $queryParams);
return $this->request->returnResponseObject($response);
} | [
"public",
"function",
"setTopic",
"(",
"$",
"topic",
")",
"{",
"$",
"queryParams",
"=",
"array",
"(",
"'topic'",
"=>",
"$",
"topic",
",",
")",
";",
"$",
"room_id_or_name",
"=",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"$",
"response",
"=",
"$",
"... | Set room topic
@param string $topic | [
"Set",
"room",
"topic"
] | 47625e17fba273b7cc916268d972b4ca8cc48c0c | https://github.com/PageBoost/hipchat-php-v2/blob/47625e17fba273b7cc916268d972b4ca8cc48c0c/src/PageBoost/HipChatV2/Resources/Rooms.php#L123-L133 | train |
netlogix/Netlogix.Crud | Classes/Netlogix/Crud/Controller/RestController.php | RestController.errorAction | public function errorAction() {
$validationResults = $this->arguments->getValidationResults()->getFlattenedErrors();
$result = array();
/** @var \Neos\Error\Messages\Error $validationResult */
foreach ($validationResults as $key => $validationResult) {
/** @var \Neos\Flow\Validation\Error $error */
forea... | php | public function errorAction() {
$validationResults = $this->arguments->getValidationResults()->getFlattenedErrors();
$result = array();
/** @var \Neos\Error\Messages\Error $validationResult */
foreach ($validationResults as $key => $validationResult) {
/** @var \Neos\Flow\Validation\Error $error */
forea... | [
"public",
"function",
"errorAction",
"(",
")",
"{",
"$",
"validationResults",
"=",
"$",
"this",
"->",
"arguments",
"->",
"getValidationResults",
"(",
")",
"->",
"getFlattenedErrors",
"(",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"/** @var \\Neos... | Return validation results as json | [
"Return",
"validation",
"results",
"as",
"json"
] | 61438827ba6b0a7a63cd2f08a294967ed5928144 | https://github.com/netlogix/Netlogix.Crud/blob/61438827ba6b0a7a63cd2f08a294967ed5928144/Classes/Netlogix/Crud/Controller/RestController.php#L252-L281 | train |
chalasr/RCHCapistranoBundle | Command/Deploy/SetupCommand.php | SetupCommand.interact | protected function interact(InputInterface $input, OutputInterface $output)
{
$questionHelper = $this->getHelper('question');
$formatter = $this->getHelper('formatter');
$rootDir = $this->getRootDir();
$fs = new Filesystem();
$appPath = explode('/', $rootDir);
$appNam... | php | protected function interact(InputInterface $input, OutputInterface $output)
{
$questionHelper = $this->getHelper('question');
$formatter = $this->getHelper('formatter');
$rootDir = $this->getRootDir();
$fs = new Filesystem();
$appPath = explode('/', $rootDir);
$appNam... | [
"protected",
"function",
"interact",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"questionHelper",
"=",
"$",
"this",
"->",
"getHelper",
"(",
"'question'",
")",
";",
"$",
"formatter",
"=",
"$",
"this",
"->",
"g... | Configures deployment.
@param InputInterface $input
@param OutputInterface $output
@return OutputInterface | [
"Configures",
"deployment",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Command/Deploy/SetupCommand.php#L62-L89 | train |
chalasr/RCHCapistranoBundle | Command/Deploy/SetupCommand.php | SetupCommand.initConfig | protected function initConfig(Filesystem $fs, $rootDir)
{
$bundleDir = $this->getBundleVendorDir();
$path = $this->getCapistranoDir();
if (!$fs->exists($path.'/deploy.rb') || !$fs->exists($path.'/deploy/production.rb')) {
return $fs->mirror($bundleDir.'/Resources/config/capistra... | php | protected function initConfig(Filesystem $fs, $rootDir)
{
$bundleDir = $this->getBundleVendorDir();
$path = $this->getCapistranoDir();
if (!$fs->exists($path.'/deploy.rb') || !$fs->exists($path.'/deploy/production.rb')) {
return $fs->mirror($bundleDir.'/Resources/config/capistra... | [
"protected",
"function",
"initConfig",
"(",
"Filesystem",
"$",
"fs",
",",
"$",
"rootDir",
")",
"{",
"$",
"bundleDir",
"=",
"$",
"this",
"->",
"getBundleVendorDir",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getCapistranoDir",
"(",
")",
";",
"... | Dump capistrano configuration skin from Resources directory.
@param Filesystem $fs
@param string $rootDir Application root dir | [
"Dump",
"capistrano",
"configuration",
"skin",
"from",
"Resources",
"directory",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Command/Deploy/SetupCommand.php#L97-L111 | train |
chalasr/RCHCapistranoBundle | Command/Deploy/SetupCommand.php | SetupCommand.configureDeploy | protected function configureDeploy(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $appName)
{
$data = [];
$properties = array(
'application' => array(
'helper' => $appName,
'label' => 'Application',
... | php | protected function configureDeploy(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $appName)
{
$data = [];
$properties = array(
'application' => array(
'helper' => $appName,
'label' => 'Application',
... | [
"protected",
"function",
"configureDeploy",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"QuestionHelper",
"$",
"questionHelper",
",",
"$",
"appName",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"properties",
"=",
"arr... | Configure deploy.rb capistrano file.
@param InputInterface $input
@param OutputInterface $output
@param QuestionHelper $questionHelper
@param string $appName
@return array | [
"Configure",
"deploy",
".",
"rb",
"capistrano",
"file",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Command/Deploy/SetupCommand.php#L123-L159 | train |
chalasr/RCHCapistranoBundle | Command/Deploy/SetupCommand.php | SetupCommand.checkComposer | protected function checkComposer(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $deployData)
{
$question = new Question('<info>Download composer</info> [<comment>yes</comment>]: ', 'yes');
$question->setAutocompleterValues(['yes', 'no']);
$downloadComposer = ... | php | protected function checkComposer(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $deployData)
{
$question = new Question('<info>Download composer</info> [<comment>yes</comment>]: ', 'yes');
$question->setAutocompleterValues(['yes', 'no']);
$downloadComposer = ... | [
"protected",
"function",
"checkComposer",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"QuestionHelper",
"$",
"questionHelper",
",",
"$",
"deployData",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"'<info>Download com... | Check need of composer.
@param InputInterface $input
@param OutputInterface $output
@param QuestionHelper $questionHelper
@param array $deployData
@return bool | [
"Check",
"need",
"of",
"composer",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Command/Deploy/SetupCommand.php#L171-L179 | train |
chalasr/RCHCapistranoBundle | Command/Deploy/SetupCommand.php | SetupCommand.checkSchemaUpdate | protected function checkSchemaUpdate(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $deployData)
{
$question = new Question('<info>Update database schema</info> [<comment>yes</comment>]: ', 'yes');
$question->setAutocompleterValues(['yes', 'no']);
$wantDump =... | php | protected function checkSchemaUpdate(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $deployData)
{
$question = new Question('<info>Update database schema</info> [<comment>yes</comment>]: ', 'yes');
$question->setAutocompleterValues(['yes', 'no']);
$wantDump =... | [
"protected",
"function",
"checkSchemaUpdate",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"QuestionHelper",
"$",
"questionHelper",
",",
"$",
"deployData",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"'<info>Update d... | Check for database schema update.
@param InputInterface $input
@param OutputInterface $output
@param QuestionHelper $questionHelper
@param array $deployData
@return bool | [
"Check",
"for",
"database",
"schema",
"update",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Command/Deploy/SetupCommand.php#L191-L199 | train |
chalasr/RCHCapistranoBundle | Command/Deploy/SetupCommand.php | SetupCommand.configureSSH | protected function configureSSH(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $deployData)
{
$serverOptions = [
'domain' => [
'helper' => $deployData['ssh_user'],
'label' => 'Domain name',
],
];
$sshOp... | php | protected function configureSSH(InputInterface $input, OutputInterface $output, QuestionHelper $questionHelper, $deployData)
{
$serverOptions = [
'domain' => [
'helper' => $deployData['ssh_user'],
'label' => 'Domain name',
],
];
$sshOp... | [
"protected",
"function",
"configureSSH",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"QuestionHelper",
"$",
"questionHelper",
",",
"$",
"deployData",
")",
"{",
"$",
"serverOptions",
"=",
"[",
"'domain'",
"=>",
"[",
"'helper'"... | Configure SSH options for production staging.
@param InputInterface $input
@param OutputInterface $output
@param QuestionHelper $questionHelper
@param array $deployData
@return array The production staging configuration | [
"Configure",
"SSH",
"options",
"for",
"production",
"staging",
"."
] | c4a4cbaa2bc05f33bf431fd3afe6cac39947640e | https://github.com/chalasr/RCHCapistranoBundle/blob/c4a4cbaa2bc05f33bf431fd3afe6cac39947640e/Command/Deploy/SetupCommand.php#L211-L256 | train |
PenoaksDev/Milky-Framework | src/Milky/Helpers/Func.php | Func.randomStr | public static function randomStr( $base )
{
$result = "";
if ( is_int( $base ) )
for ( $i = 0; $i < $base; $i++ )
$result .= static::$randomCharMap[random_int( 0, count( static::$randomCharMap ) )];
else
for ( $i = 0; $i < strlen( $base ); $i++ )
$result .= static::randomChar( $base[$i] );
retu... | php | public static function randomStr( $base )
{
$result = "";
if ( is_int( $base ) )
for ( $i = 0; $i < $base; $i++ )
$result .= static::$randomCharMap[random_int( 0, count( static::$randomCharMap ) )];
else
for ( $i = 0; $i < strlen( $base ); $i++ )
$result .= static::randomChar( $base[$i] );
retu... | [
"public",
"static",
"function",
"randomStr",
"(",
"$",
"base",
")",
"{",
"$",
"result",
"=",
"\"\"",
";",
"if",
"(",
"is_int",
"(",
"$",
"base",
")",
")",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"base",
";",
"$",
"i",
"++",
... | Scrambles of string of characters but keeps the results either uppercase, lowercase, or numeric
@param string|int $base | [
"Scrambles",
"of",
"string",
"of",
"characters",
"but",
"keeps",
"the",
"results",
"either",
"uppercase",
"lowercase",
"or",
"numeric"
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Helpers/Func.php#L106-L118 | train |
PenoaksDev/Milky-Framework | src/Milky/Helpers/Func.php | Func.randomChars | public static function randomChars( $seed, $len )
{
$result = '';
for ( $i = 0; $i < $len; $i++ )
$result .= $seed[random_int( 0, strlen( $seed ) )];
return $result;
} | php | public static function randomChars( $seed, $len )
{
$result = '';
for ( $i = 0; $i < $len; $i++ )
$result .= $seed[random_int( 0, strlen( $seed ) )];
return $result;
} | [
"public",
"static",
"function",
"randomChars",
"(",
"$",
"seed",
",",
"$",
"len",
")",
"{",
"$",
"result",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"len",
";",
"$",
"i",
"++",
")",
"$",
"result",
".=",
"$",
"... | Randomizes from the provided seed
@param string $seed
@param int $len
@return string | [
"Randomizes",
"from",
"the",
"provided",
"seed"
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Helpers/Func.php#L127-L135 | train |
PenoaksDev/Milky-Framework | src/Milky/Helpers/Func.php | Func.randomChar | public static function randomChar( $char )
{
if ( strlen( $char ) == 0 )
return '';
$char = ord( $char );
if ( $char > 64 && $char < 91 ) // Uppercase
return static::randomCharRange( 65, 90 );
if ( $char > 96 && $char < 123 ) // Lowercase
return static::randomCharRange( 97, 122 );
if ( $char > 4... | php | public static function randomChar( $char )
{
if ( strlen( $char ) == 0 )
return '';
$char = ord( $char );
if ( $char > 64 && $char < 91 ) // Uppercase
return static::randomCharRange( 65, 90 );
if ( $char > 96 && $char < 123 ) // Lowercase
return static::randomCharRange( 97, 122 );
if ( $char > 4... | [
"public",
"static",
"function",
"randomChar",
"(",
"$",
"char",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"char",
")",
"==",
"0",
")",
"return",
"''",
";",
"$",
"char",
"=",
"ord",
"(",
"$",
"char",
")",
";",
"if",
"(",
"$",
"char",
">",
"64",
... | Randomizes the first character of string, preserves uppercase, lowercase, and numeric.
@param string $char
@return string | [
"Randomizes",
"the",
"first",
"character",
"of",
"string",
"preserves",
"uppercase",
"lowercase",
"and",
"numeric",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Helpers/Func.php#L143-L160 | train |
PenoaksDev/Milky-Framework | src/Milky/Helpers/Func.php | Func.randomCharRange | public static function randomCharRange( $start, $end )
{
if ( count( static::$randomCharMap ) == 0 )
static::populate();
return chr( random_int( $start, $end ) );
} | php | public static function randomCharRange( $start, $end )
{
if ( count( static::$randomCharMap ) == 0 )
static::populate();
return chr( random_int( $start, $end ) );
} | [
"public",
"static",
"function",
"randomCharRange",
"(",
"$",
"start",
",",
"$",
"end",
")",
"{",
"if",
"(",
"count",
"(",
"static",
"::",
"$",
"randomCharMap",
")",
"==",
"0",
")",
"static",
"::",
"populate",
"(",
")",
";",
"return",
"chr",
"(",
"ran... | Returns a random character within the specified range
@param int $start
@param int $end
@return string | [
"Returns",
"a",
"random",
"character",
"within",
"the",
"specified",
"range"
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Helpers/Func.php#L169-L175 | train |
PenoaksDev/Milky-Framework | src/Milky/Helpers/Func.php | Func.stacktrace | public static function stacktrace( $stack = null, $withPre = false )
{
if ( is_null( $stack ) )
$stack = debug_backtrace();
$output = $withPre ? '<pre>' : '';
$stackLen = count( $stack );
for ( $i = 1; $i < $stackLen; $i++ )
{
$entry = $stack[$i];
$func = $entry['function'] . '(';
$argsLen = co... | php | public static function stacktrace( $stack = null, $withPre = false )
{
if ( is_null( $stack ) )
$stack = debug_backtrace();
$output = $withPre ? '<pre>' : '';
$stackLen = count( $stack );
for ( $i = 1; $i < $stackLen; $i++ )
{
$entry = $stack[$i];
$func = $entry['function'] . '(';
$argsLen = co... | [
"public",
"static",
"function",
"stacktrace",
"(",
"$",
"stack",
"=",
"null",
",",
"$",
"withPre",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"stack",
")",
")",
"$",
"stack",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"output",
"=",
"... | Creates a human readable stack trace
@param null $stack
@return string | [
"Creates",
"a",
"human",
"readable",
"stack",
"trace"
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Helpers/Func.php#L183-L226 | train |
kambalabs/KmbPuppetDb | src/KmbPuppetDb/Service/NodeStatistics.php | NodeStatistics.processStatistics | protected function processStatistics($query = null)
{
$this->unchangedCount = 0;
$this->changedCount = 0;
$this->failedCount = 0;
$this->nodesCountByOS = [];
$this->nodesPercentageByOS = [];
$this->recentlyRebootedNodes = [];
$nodes = $this->getNodeService()->... | php | protected function processStatistics($query = null)
{
$this->unchangedCount = 0;
$this->changedCount = 0;
$this->failedCount = 0;
$this->nodesCountByOS = [];
$this->nodesPercentageByOS = [];
$this->recentlyRebootedNodes = [];
$nodes = $this->getNodeService()->... | [
"protected",
"function",
"processStatistics",
"(",
"$",
"query",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"unchangedCount",
"=",
"0",
";",
"$",
"this",
"->",
"changedCount",
"=",
"0",
";",
"$",
"this",
"->",
"failedCount",
"=",
"0",
";",
"$",
"this",
... | Browse all nodes and process all the statistics
@param \KmbPuppetDb\Query\Query|array $query | [
"Browse",
"all",
"nodes",
"and",
"process",
"all",
"the",
"statistics"
] | df56a275cf00f4402cf121a2e99149168f1f8b2d | https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Service/NodeStatistics.php#L221-L253 | train |
AlexanderPoellmann/Laravel-Settings | src/Driver/FileDriver.php | FileDriver.setPath | public function setPath($path)
{
if ( ! $this->files->exists($path) ) {
$result = $this->files->put($path, '{}');
if ( $result === false ) {
throw new NotWritableException("Could not write to $path.");
}
}
if ( ! $this->files->isWritable($path) ) {
throw new NotWritableException("$path is not wr... | php | public function setPath($path)
{
if ( ! $this->files->exists($path) ) {
$result = $this->files->put($path, '{}');
if ( $result === false ) {
throw new NotWritableException("Could not write to $path.");
}
}
if ( ! $this->files->isWritable($path) ) {
throw new NotWritableException("$path is not wr... | [
"public",
"function",
"setPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"files",
"->",
"put",
"(",
"$",
"path",
",",
"'{}'"... | Set the path for the JSON file.
@param string $path
@throws NotWritableException | [
"Set",
"the",
"path",
"for",
"the",
"JSON",
"file",
"."
] | bf06f78cbbf86adb8576a29caae496d1e03b32ab | https://github.com/AlexanderPoellmann/Laravel-Settings/blob/bf06f78cbbf86adb8576a29caae496d1e03b32ab/src/Driver/FileDriver.php#L38-L52 | train |
Torann/skosh-generator | src/Twig/AbstractExtension.php | AbstractExtension.isCurrent | public function isCurrent($page, $pattern)
{
// Remove site URL from string
$page = str_replace($this->getBuilder()->app->getSetting('url'), '', $page);
return str_is($pattern, $page);
} | php | public function isCurrent($page, $pattern)
{
// Remove site URL from string
$page = str_replace($this->getBuilder()->app->getSetting('url'), '', $page);
return str_is($pattern, $page);
} | [
"public",
"function",
"isCurrent",
"(",
"$",
"page",
",",
"$",
"pattern",
")",
"{",
"// Remove site URL from string",
"$",
"page",
"=",
"str_replace",
"(",
"$",
"this",
"->",
"getBuilder",
"(",
")",
"->",
"app",
"->",
"getSetting",
"(",
"'url'",
")",
",",
... | Is given URL the current page?
@param $page
@param $pattern
@return bool | [
"Is",
"given",
"URL",
"the",
"current",
"page?"
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Twig/AbstractExtension.php#L43-L49 | train |
mmethner/engine | src/Core/Exception.php | Exception.collect | private static function collect()
{
$message = '';
$message .= sprintf("\r\nURL: %s\r\n", $_SERVER['REQUEST_URI']);
if (!empty($_POST)) {
$message .= "\r\n";
foreach ($_POST as $key => $value) {
if (in_array($key, [
'password',
... | php | private static function collect()
{
$message = '';
$message .= sprintf("\r\nURL: %s\r\n", $_SERVER['REQUEST_URI']);
if (!empty($_POST)) {
$message .= "\r\n";
foreach ($_POST as $key => $value) {
if (in_array($key, [
'password',
... | [
"private",
"static",
"function",
"collect",
"(",
")",
"{",
"$",
"message",
"=",
"''",
";",
"$",
"message",
".=",
"sprintf",
"(",
"\"\\r\\nURL: %s\\r\\n\"",
",",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"_P... | collects data for current request
@return string | [
"collects",
"data",
"for",
"current",
"request"
] | 89e1bcc644cf8cc3712a67ef1697da2ca4008f74 | https://github.com/mmethner/engine/blob/89e1bcc644cf8cc3712a67ef1697da2ca4008f74/src/Core/Exception.php#L53-L111 | train |
Stinger-Soft/TwigExtensions | src/StingerSoft/TwigExtensions/DoctrineExtensions.php | DoctrineExtensions.setDoctrineFunctions | public function setDoctrineFunctions(\StingerSoft\DoctrineCommons\Utils\DoctrineFunctionsInterface $doctrineFunctions = null) {
$this->doctrineFunctions = $doctrineFunctions;
} | php | public function setDoctrineFunctions(\StingerSoft\DoctrineCommons\Utils\DoctrineFunctionsInterface $doctrineFunctions = null) {
$this->doctrineFunctions = $doctrineFunctions;
} | [
"public",
"function",
"setDoctrineFunctions",
"(",
"\\",
"StingerSoft",
"\\",
"DoctrineCommons",
"\\",
"Utils",
"\\",
"DoctrineFunctionsInterface",
"$",
"doctrineFunctions",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"doctrineFunctions",
"=",
"$",
"doctrineFunctions",
... | Set the doctrine commons functions to be used by the twig extension.
@param \StingerSoft\DoctrineCommons\Utils\DoctrineFunctionsInterface $doctrineFunctions | [
"Set",
"the",
"doctrine",
"commons",
"functions",
"to",
"be",
"used",
"by",
"the",
"twig",
"extension",
"."
] | 7bfce337b0dd33106e22f80b221338451a02d7c5 | https://github.com/Stinger-Soft/TwigExtensions/blob/7bfce337b0dd33106e22f80b221338451a02d7c5/src/StingerSoft/TwigExtensions/DoctrineExtensions.php#L23-L25 | train |
Stinger-Soft/TwigExtensions | src/StingerSoft/TwigExtensions/DoctrineExtensions.php | DoctrineExtensions.unproxifyFilter | public function unproxifyFilter($object) {
if($this->hasDoctrineFunctions() && method_exists($this->doctrineFunctions, 'unproxifyFilter')) {
return $this->doctrineFunctions->unproxifyFilter($object);
}
return $object;
} | php | public function unproxifyFilter($object) {
if($this->hasDoctrineFunctions() && method_exists($this->doctrineFunctions, 'unproxifyFilter')) {
return $this->doctrineFunctions->unproxifyFilter($object);
}
return $object;
} | [
"public",
"function",
"unproxifyFilter",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasDoctrineFunctions",
"(",
")",
"&&",
"method_exists",
"(",
"$",
"this",
"->",
"doctrineFunctions",
",",
"'unproxifyFilter'",
")",
")",
"{",
"return",
"$",... | Transforms the given doctrine proxy object into a 'real' entity
@param object $object
@return object|NULL | [
"Transforms",
"the",
"given",
"doctrine",
"proxy",
"object",
"into",
"a",
"real",
"entity"
] | 7bfce337b0dd33106e22f80b221338451a02d7c5 | https://github.com/Stinger-Soft/TwigExtensions/blob/7bfce337b0dd33106e22f80b221338451a02d7c5/src/StingerSoft/TwigExtensions/DoctrineExtensions.php#L70-L75 | train |
Soneritics/Database | Soneritics/Database/DatabaseConnectionFactory.php | DatabaseConnectionFactory.create | public static function create($id, array $config)
{
static::$databaseConnections[$id] = static::createDatabaseConnection($config);
if (static::$activeDatabaseConnection === null) {
static::select($id);
}
} | php | public static function create($id, array $config)
{
static::$databaseConnections[$id] = static::createDatabaseConnection($config);
if (static::$activeDatabaseConnection === null) {
static::select($id);
}
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"id",
",",
"array",
"$",
"config",
")",
"{",
"static",
"::",
"$",
"databaseConnections",
"[",
"$",
"id",
"]",
"=",
"static",
"::",
"createDatabaseConnection",
"(",
"$",
"config",
")",
";",
"if",
"(",
... | Set a database connection.
@param string $id
@param array $config | [
"Set",
"a",
"database",
"connection",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnectionFactory.php#L53-L60 | train |
Soneritics/Database | Soneritics/Database/DatabaseConnectionFactory.php | DatabaseConnectionFactory.get | public static function get($id = null)
{
if ($id === null && static::$activeDatabaseConnection === null) {
throw new MissingDatabaseConnectionException('No databases defined.');
}
if ($id === null) {
return static::$databaseConnections[static::$activeDatabaseConnecti... | php | public static function get($id = null)
{
if ($id === null && static::$activeDatabaseConnection === null) {
throw new MissingDatabaseConnectionException('No databases defined.');
}
if ($id === null) {
return static::$databaseConnections[static::$activeDatabaseConnecti... | [
"public",
"static",
"function",
"get",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"null",
"&&",
"static",
"::",
"$",
"activeDatabaseConnection",
"===",
"null",
")",
"{",
"throw",
"new",
"MissingDatabaseConnectionException",
"(",
"'... | Get a database connection.
@param null $id
@return IDatabaseConnection
@throws MissingDatabaseConnectionException | [
"Get",
"a",
"database",
"connection",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseConnectionFactory.php#L68-L79 | train |
jenskooij/cloudcontrol | src/components/MultiComponent.php | MultiComponent.run | public function run(Storage $storage)
{
parent::run($storage);
$components = $this->getParametersWithoutNamespace();
foreach ($components as $namespace => $component) {
$this->loadComponent($namespace, $component);
}
} | php | public function run(Storage $storage)
{
parent::run($storage);
$components = $this->getParametersWithoutNamespace();
foreach ($components as $namespace => $component) {
$this->loadComponent($namespace, $component);
}
} | [
"public",
"function",
"run",
"(",
"Storage",
"$",
"storage",
")",
"{",
"parent",
"::",
"run",
"(",
"$",
"storage",
")",
";",
"$",
"components",
"=",
"$",
"this",
"->",
"getParametersWithoutNamespace",
"(",
")",
";",
"foreach",
"(",
"$",
"components",
"as... | Runs all components that are set
@param Storage $storage | [
"Runs",
"all",
"components",
"that",
"are",
"set"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/MultiComponent.php#L40-L49 | train |
jenskooij/cloudcontrol | src/components/MultiComponent.php | MultiComponent.loadComponent | private function loadComponent($namespace, $component)
{
$fullyQualifiedCloudControlComponent = '\\CloudControl\\Cms\\components\\' . $component;
$fullyQualifiedComponent = '\\components\\' . $component;
if (class_exists($fullyQualifiedCloudControlComponent, true)) {
$this->runCo... | php | private function loadComponent($namespace, $component)
{
$fullyQualifiedCloudControlComponent = '\\CloudControl\\Cms\\components\\' . $component;
$fullyQualifiedComponent = '\\components\\' . $component;
if (class_exists($fullyQualifiedCloudControlComponent, true)) {
$this->runCo... | [
"private",
"function",
"loadComponent",
"(",
"$",
"namespace",
",",
"$",
"component",
")",
"{",
"$",
"fullyQualifiedCloudControlComponent",
"=",
"'\\\\CloudControl\\\\Cms\\\\components\\\\'",
".",
"$",
"component",
";",
"$",
"fullyQualifiedComponent",
"=",
"'\\\\component... | Tries to determine component class name and wheter it exists
@param $namespace String
@param $component String | [
"Tries",
"to",
"determine",
"component",
"class",
"name",
"and",
"wheter",
"it",
"exists"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/MultiComponent.php#L57-L66 | train |
jenskooij/cloudcontrol | src/components/MultiComponent.php | MultiComponent.runComponent | private function runComponent($namespace, $fullyQualifiedComponent)
{
$parameters = $this->getParametersForNameSpace($namespace);
$parameters[self::PARAMETER_MULTI_COMPONENT] = $this;
$component = new $fullyQualifiedComponent('', $this->request, $parameters, $this->matchedSitemapItem);
... | php | private function runComponent($namespace, $fullyQualifiedComponent)
{
$parameters = $this->getParametersForNameSpace($namespace);
$parameters[self::PARAMETER_MULTI_COMPONENT] = $this;
$component = new $fullyQualifiedComponent('', $this->request, $parameters, $this->matchedSitemapItem);
... | [
"private",
"function",
"runComponent",
"(",
"$",
"namespace",
",",
"$",
"fullyQualifiedComponent",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"getParametersForNameSpace",
"(",
"$",
"namespace",
")",
";",
"$",
"parameters",
"[",
"self",
"::",
"PARAMET... | Instantiates the component and runs it
@param $namespace String
@param $fullyQualifiedComponent String | [
"Instantiates",
"the",
"component",
"and",
"runs",
"it"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/MultiComponent.php#L74-L86 | train |
jenskooij/cloudcontrol | src/components/MultiComponent.php | MultiComponent.getParametersForNameSpace | private function getParametersForNameSpace($namespace)
{
$parameters = array();
foreach ($this->parameters as $key => $value) {
if (0 === strpos($key, $namespace . ':')) {
$parameters[substr($key, strlen($namespace) + 1)] = $value;
}
}
return $... | php | private function getParametersForNameSpace($namespace)
{
$parameters = array();
foreach ($this->parameters as $key => $value) {
if (0 === strpos($key, $namespace . ':')) {
$parameters[substr($key, strlen($namespace) + 1)] = $value;
}
}
return $... | [
"private",
"function",
"getParametersForNameSpace",
"(",
"$",
"namespace",
")",
"{",
"$",
"parameters",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"0",
"===",... | Retrieves all parameters for the given namespace
@param $namespace
@return array | [
"Retrieves",
"all",
"parameters",
"for",
"the",
"given",
"namespace"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/MultiComponent.php#L94-L103 | train |
jenskooij/cloudcontrol | src/components/MultiComponent.php | MultiComponent.getParametersWithoutNamespace | private function getParametersWithoutNamespace()
{
$parameters = array();
foreach ($this->parameters as $key => $value) {
if (strpos($key, ':') === false) {
$parameters[$key] = $value;
}
}
return $parameters;
} | php | private function getParametersWithoutNamespace()
{
$parameters = array();
foreach ($this->parameters as $key => $value) {
if (strpos($key, ':') === false) {
$parameters[$key] = $value;
}
}
return $parameters;
} | [
"private",
"function",
"getParametersWithoutNamespace",
"(",
")",
"{",
"$",
"parameters",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"parameters",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"key"... | Retrieves all parameters that have no namespace
@return array | [
"Retrieves",
"all",
"parameters",
"that",
"have",
"no",
"namespace"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/components/MultiComponent.php#L110-L119 | train |
Mandarin-Medien/MMCmfRoutingBundle | Resolver/NodeResolver.php | NodeResolver.resolve | public function resolve(NodeRouteInterface $route)
{
foreach($this->classes as $class) {
$qb = $this->manager->createQueryBuilder()
->select('n')
->from($class, 'n')
->join('n.routes', 'r')
->where('r.id = :route')
... | php | public function resolve(NodeRouteInterface $route)
{
foreach($this->classes as $class) {
$qb = $this->manager->createQueryBuilder()
->select('n')
->from($class, 'n')
->join('n.routes', 'r')
->where('r.id = :route')
... | [
"public",
"function",
"resolve",
"(",
"NodeRouteInterface",
"$",
"route",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"classes",
"as",
"$",
"class",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"manager",
"->",
"createQueryBuilder",
"(",
")",
"->",
"s... | loads the Node by the given NodeRouteInterface
@param NodeRouteInterface $route
@return mixed|null | [
"loads",
"the",
"Node",
"by",
"the",
"given",
"NodeRouteInterface"
] | 7db1b03f5e120bd473486c0be6ab76c6146cd2d0 | https://github.com/Mandarin-Medien/MMCmfRoutingBundle/blob/7db1b03f5e120bd473486c0be6ab76c6146cd2d0/Resolver/NodeResolver.php#L43-L60 | train |
Mandarin-Medien/MMCmfRoutingBundle | Resolver/NodeResolver.php | NodeResolver.getRoutableNodeClasses | protected function getRoutableNodeClasses()
{
$metadata = $this->manager->getClassMetadata(Node::class);
$routables = array_values(array_filter($metadata->subClasses, function($subNode) {
$reflection = new \ReflectionClass($subNode);
return $reflection->implementsInterface(Ro... | php | protected function getRoutableNodeClasses()
{
$metadata = $this->manager->getClassMetadata(Node::class);
$routables = array_values(array_filter($metadata->subClasses, function($subNode) {
$reflection = new \ReflectionClass($subNode);
return $reflection->implementsInterface(Ro... | [
"protected",
"function",
"getRoutableNodeClasses",
"(",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"manager",
"->",
"getClassMetadata",
"(",
"Node",
"::",
"class",
")",
";",
"$",
"routables",
"=",
"array_values",
"(",
"array_filter",
"(",
"$",
"metad... | builds a list of all classes implementing RoutableNodeInterface
@return array | [
"builds",
"a",
"list",
"of",
"all",
"classes",
"implementing",
"RoutableNodeInterface"
] | 7db1b03f5e120bd473486c0be6ab76c6146cd2d0 | https://github.com/Mandarin-Medien/MMCmfRoutingBundle/blob/7db1b03f5e120bd473486c0be6ab76c6146cd2d0/Resolver/NodeResolver.php#L67-L76 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DateFilterer.php | DateFilterer.format | protected function format()
{
if (($this->getParameter('value') == null || $this->getParameter('value') == "0"))
return '';
elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Meta) {
$dateTime = $this->getParameter('value');
... | php | protected function format()
{
if (($this->getParameter('value') == null || $this->getParameter('value') == "0"))
return '';
elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Meta) {
$dateTime = $this->getParameter('value');
... | [
"protected",
"function",
"format",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
"==",
"null",
"||",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
"==",
"\"0\"",
")",
")",
"return",
"''",
";",
"elsei... | Returns the date in a specified format
Expected Params:
value integer (optional) If specified, we'll use this as the date value. Can also be 'now' to use the current time
nonbreaking string (optional) If 'true', then the resultant string will contain 's instead of spaces
format string The format for... | [
"Returns",
"the",
"date",
"in",
"a",
"specified",
"format"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DateFilterer.php#L68-L105 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DateFilterer.php | DateFilterer.ago | protected function ago()
{
$threshold = $this->getParameter('threshold');
if (($this->getParameter('value') == null || $this->getParameter('value') == "0"))
return '';
elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Meta) {
$... | php | protected function ago()
{
$threshold = $this->getParameter('threshold');
if (($this->getParameter('value') == null || $this->getParameter('value') == "0"))
return '';
elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Meta) {
$... | [
"protected",
"function",
"ago",
"(",
")",
"{",
"$",
"threshold",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'threshold'",
")",
";",
"if",
"(",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
"==",
"null",
"||",
"$",
"this",
"->",
"get... | Displays a short text description of how long ago the specified timestamp was current.
Expected Params:
value LocalDate (optional) If specified and 'strdate' is null, use this as the timestamp
strdate string (optional) A string to use to create the timestamp
threshold integer (optional) If the value is olde... | [
"Displays",
"a",
"short",
"text",
"description",
"of",
"how",
"long",
"ago",
"the",
"specified",
"timestamp",
"was",
"current",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DateFilterer.php#L118-L183 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DateFilterer.php | DateFilterer.heartbeatAgo | protected function heartbeatAgo()
{
if ($this->getParameter('value') != null) {
$min = $this->getParameter('value');
if ($min < 60)
return $min.' min ago';
elseif ($min < 1440)
return floor($min / 60).' hrs '.($min % 60 > 0 ? floor($min % ... | php | protected function heartbeatAgo()
{
if ($this->getParameter('value') != null) {
$min = $this->getParameter('value');
if ($min < 60)
return $min.' min ago';
elseif ($min < 1440)
return floor($min / 60).' hrs '.($min % 60 > 0 ? floor($min % ... | [
"protected",
"function",
"heartbeatAgo",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
"!=",
"null",
")",
"{",
"$",
"min",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
";",
"if",
"(",
"$",
"min",
... | Displays the specified minutes in a logical format
Example:
for 'value' = 1586 => '1 days 2 hours ago'
Expected Params:
value string The number of minutes ago
@return string | [
"Displays",
"the",
"specified",
"minutes",
"in",
"a",
"logical",
"format"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DateFilterer.php#L196-L208 | train |
fridge-project/dbal | src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php | NamedQueryRewriter.determinePlaceholderPositions | private static function determinePlaceholderPositions($query, $placeholder)
{
// Placeholder positions.
$placeholderPositions = array();
// TRUE if we are in an escaped section else FALSE.
$escaped = false;
// The placeholder length.
$placeholderLength = strlen($pla... | php | private static function determinePlaceholderPositions($query, $placeholder)
{
// Placeholder positions.
$placeholderPositions = array();
// TRUE if we are in an escaped section else FALSE.
$escaped = false;
// The placeholder length.
$placeholderLength = strlen($pla... | [
"private",
"static",
"function",
"determinePlaceholderPositions",
"(",
"$",
"query",
",",
"$",
"placeholder",
")",
"{",
"// Placeholder positions.",
"$",
"placeholderPositions",
"=",
"array",
"(",
")",
";",
"// TRUE if we are in an escaped section else FALSE.",
"$",
"esca... | Determines the placeholder positions in the query.
Example:
- parameters:
- query: SELECT * FROM foo WHERE foo IN (:foo) AND bar IN (:foo)
^ (32) ^ (50)
- placeholder: :foo
- result:
- placeholderPositions: array(32, 50)
@param string $query The query.
@param string $placeholder The placeholder.
@th... | [
"Determines",
"the",
"placeholder",
"positions",
"in",
"the",
"query",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php#L108-L143 | train |
fridge-project/dbal | src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php | NamedQueryRewriter.generateNewPlaceholders | private static function generateNewPlaceholders($placeholder, $count)
{
$newPlaceholders = array();
for ($index = 1; $index <= $count; $index++) {
$newPlaceholders[] = $placeholder.$index;
}
return $newPlaceholders;
} | php | private static function generateNewPlaceholders($placeholder, $count)
{
$newPlaceholders = array();
for ($index = 1; $index <= $count; $index++) {
$newPlaceholders[] = $placeholder.$index;
}
return $newPlaceholders;
} | [
"private",
"static",
"function",
"generateNewPlaceholders",
"(",
"$",
"placeholder",
",",
"$",
"count",
")",
"{",
"$",
"newPlaceholders",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"index",
"=",
"1",
";",
"$",
"index",
"<=",
"$",
"count",
";",
"$",
... | Generates the new placeholders according to the placeholder and the number of parameter.
Example:
- parameters:
- placeholder: :foo
- count: 3
- result:
- newPlaceholders: array(':foo1', ':foo2', ':foo3')
@param string $placeholder The placeholder.
@param integer $count The number of parameter.
@return array ... | [
"Generates",
"the",
"new",
"placeholders",
"according",
"to",
"the",
"placeholder",
"and",
"the",
"number",
"of",
"parameter",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php#L160-L169 | train |
fridge-project/dbal | src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php | NamedQueryRewriter.rewriteQuery | private static function rewriteQuery(
$query,
array $placeholderPositions,
$placeholderLength,
array $newPlaceholders
) {
// The position gap produced by the rewrite.
$positionGap = 0;
// Generates new placeholders and his length.
$placeholders = impl... | php | private static function rewriteQuery(
$query,
array $placeholderPositions,
$placeholderLength,
array $newPlaceholders
) {
// The position gap produced by the rewrite.
$positionGap = 0;
// Generates new placeholders and his length.
$placeholders = impl... | [
"private",
"static",
"function",
"rewriteQuery",
"(",
"$",
"query",
",",
"array",
"$",
"placeholderPositions",
",",
"$",
"placeholderLength",
",",
"array",
"$",
"newPlaceholders",
")",
"{",
"// The position gap produced by the rewrite.",
"$",
"positionGap",
"=",
"0",
... | Rewrites the named query according to the placeholder length and positions and the new placeholders.
Example:
- parameters:
- query; SELECT * FROM foo WHERE foo IN (:foo) AND bar IN (:foo)
- placeholderPositions: array(32, 50)
- placeholderLength: 4
- newPlaceholders: array(':foo1', ':foo2', ':foo3')
- result:
- rewri... | [
"Rewrites",
"the",
"named",
"query",
"according",
"to",
"the",
"placeholder",
"length",
"and",
"positions",
"and",
"the",
"new",
"placeholders",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php#L190-L216 | train |
fridge-project/dbal | src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php | NamedQueryRewriter.rewriteParameterAndType | private static function rewriteParameterAndType(
array $parameters,
array $types,
$parameter,
array $newPlaceholders
) {
// Extract the fridge type.
$type = static::extractType($types[$parameter]);
// Iterate new placeholders to rewrite each one.
fore... | php | private static function rewriteParameterAndType(
array $parameters,
array $types,
$parameter,
array $newPlaceholders
) {
// Extract the fridge type.
$type = static::extractType($types[$parameter]);
// Iterate new placeholders to rewrite each one.
fore... | [
"private",
"static",
"function",
"rewriteParameterAndType",
"(",
"array",
"$",
"parameters",
",",
"array",
"$",
"types",
",",
"$",
"parameter",
",",
"array",
"$",
"newPlaceholders",
")",
"{",
"// Extract the fridge type.",
"$",
"type",
"=",
"static",
"::",
"extr... | Rewrites the query parameter & type by expanding them according to the parameter and the new placeholders.
Example:
- parameters:
- parameters: array('foo' => array(1, 3, 5))
- types: array('foo' => 'integer[]')
- parameter: foo
- newPlaceholders: array(':foo1', ':foo2', ':foo3')
- result:
- rewrittenParameters: array... | [
"Rewrites",
"the",
"query",
"parameter",
"&",
"type",
"by",
"expanding",
"them",
"according",
"to",
"the",
"parameter",
"and",
"the",
"new",
"placeholders",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Query/Rewriter/NamedQueryRewriter.php#L238-L263 | train |
nice-php/benchmark | src/ResultPrinter/MarkdownPrinter.php | MarkdownPrinter.printBenchmarkIntro | public function printBenchmarkIntro(Benchmark $benchmark)
{
printf("## %s\n", $benchmark->getName());
if ($description = $benchmark->getDescription()) {
printf("%s\n", $description);
}
print("\n");
printf(
"This benchmark consists of %s tests. Each tes... | php | public function printBenchmarkIntro(Benchmark $benchmark)
{
printf("## %s\n", $benchmark->getName());
if ($description = $benchmark->getDescription()) {
printf("%s\n", $description);
}
print("\n");
printf(
"This benchmark consists of %s tests. Each tes... | [
"public",
"function",
"printBenchmarkIntro",
"(",
"Benchmark",
"$",
"benchmark",
")",
"{",
"printf",
"(",
"\"## %s\\n\"",
",",
"$",
"benchmark",
"->",
"getName",
"(",
")",
")",
";",
"if",
"(",
"$",
"description",
"=",
"$",
"benchmark",
"->",
"getDescription"... | Outputs an introduction prior to test execution
@param Benchmark $benchmark | [
"Outputs",
"an",
"introduction",
"prior",
"to",
"test",
"execution"
] | 2084c77dbb88cd76006abbfe85b2b704f6bbd1cf | https://github.com/nice-php/benchmark/blob/2084c77dbb88cd76006abbfe85b2b704f6bbd1cf/src/ResultPrinter/MarkdownPrinter.php#L28-L41 | train |
spiffyjr/spiffy-package | src/PackageManager.php | PackageManager.writeCache | public function writeCache()
{
$cacheFile = $this->getCacheFile();
if (!$cacheFile) {
return;
}
if (is_writeable(dirname($cacheFile))) {
file_put_contents(
$cacheFile,
sprintf(
'<?php return %s;',
... | php | public function writeCache()
{
$cacheFile = $this->getCacheFile();
if (!$cacheFile) {
return;
}
if (is_writeable(dirname($cacheFile))) {
file_put_contents(
$cacheFile,
sprintf(
'<?php return %s;',
... | [
"public",
"function",
"writeCache",
"(",
")",
"{",
"$",
"cacheFile",
"=",
"$",
"this",
"->",
"getCacheFile",
"(",
")",
";",
"if",
"(",
"!",
"$",
"cacheFile",
")",
"{",
"return",
";",
"}",
"if",
"(",
"is_writeable",
"(",
"dirname",
"(",
"$",
"cacheFil... | Writes config to filesystem. | [
"Writes",
"config",
"to",
"filesystem",
"."
] | 42ca8a687efb2d06ecb3d4e0c09456d938a2bc09 | https://github.com/spiffyjr/spiffy-package/blob/42ca8a687efb2d06ecb3d4e0c09456d938a2bc09/src/PackageManager.php#L183-L199 | train |
TiMESPLiNTER/tsFramework | src/ch/timesplinter/controller/StaticPageController.php | StaticPageController.getPage | public function getPage()
{
$pageData = $this->core->getSettings()->pagedata;
$routeID = $this->route->id;
$this->logger->info('Requested route: ' . $routeID);
$this->logger->debug('Route info', array($this->route));
if(isset($pageData->$routeID->active))
$this->view->addActiveHtmlId($pageData->$routeID... | php | public function getPage()
{
$pageData = $this->core->getSettings()->pagedata;
$routeID = $this->route->id;
$this->logger->info('Requested route: ' . $routeID);
$this->logger->debug('Route info', array($this->route));
if(isset($pageData->$routeID->active))
$this->view->addActiveHtmlId($pageData->$routeID... | [
"public",
"function",
"getPage",
"(",
")",
"{",
"$",
"pageData",
"=",
"$",
"this",
"->",
"core",
"->",
"getSettings",
"(",
")",
"->",
"pagedata",
";",
"$",
"routeID",
"=",
"$",
"this",
"->",
"route",
"->",
"id",
";",
"$",
"this",
"->",
"logger",
"-... | Displays a template based page by rendering a template file which is generated by route name plus .html ending
@throws \UnexpectedValueException
@return \HttpResponse The response object with content, headers, HTTP status code, etc. | [
"Displays",
"a",
"template",
"based",
"page",
"by",
"rendering",
"a",
"template",
"file",
"which",
"is",
"generated",
"by",
"route",
"name",
"plus",
".",
"html",
"ending"
] | b3b9fd98f6d456a9e571015877ecca203786fd0c | https://github.com/TiMESPLiNTER/tsFramework/blob/b3b9fd98f6d456a9e571015877ecca203786fd0c/src/ch/timesplinter/controller/StaticPageController.php#L49-L69 | train |
ZendExperts/phpids | lib/IDS/Log/File.php | IDS_Log_File.execute | public function execute(IDS_Report $data)
{
/*
* In case the data has been modified before it might be necessary
* to convert it to string since we can't store array or object
* into a file
*/
$data = $this->prepareData($data);
if (is_string($data)) ... | php | public function execute(IDS_Report $data)
{
/*
* In case the data has been modified before it might be necessary
* to convert it to string since we can't store array or object
* into a file
*/
$data = $this->prepareData($data);
if (is_string($data)) ... | [
"public",
"function",
"execute",
"(",
"IDS_Report",
"$",
"data",
")",
"{",
"/*\n * In case the data has been modified before it might be necessary \n * to convert it to string since we can't store array or object \n * into a file\n */",
"$",
"data",
"=",
"$... | Stores given data into a file
@param object $data IDS_Report
@throws Exception if the logfile isn't writeable
@return boolean | [
"Stores",
"given",
"data",
"into",
"a",
"file"
] | f30df04eea47b94d056e2ae9ec8fea1c626f1c03 | https://github.com/ZendExperts/phpids/blob/f30df04eea47b94d056e2ae9ec8fea1c626f1c03/lib/IDS/Log/File.php#L177-L220 | train |
modulusphp/utility | View.php | View.isCalledByWhoops | public static function isCalledByWhoops() : bool
{
/**
* Get trace
*/
$trace = debug_backtrace();
$trace = end($trace);
return isset($trace['class']) && $trace['class'] == 'Whoops\Run';
} | php | public static function isCalledByWhoops() : bool
{
/**
* Get trace
*/
$trace = debug_backtrace();
$trace = end($trace);
return isset($trace['class']) && $trace['class'] == 'Whoops\Run';
} | [
"public",
"static",
"function",
"isCalledByWhoops",
"(",
")",
":",
"bool",
"{",
"/**\n * Get trace\n */",
"$",
"trace",
"=",
"debug_backtrace",
"(",
")",
";",
"$",
"trace",
"=",
"end",
"(",
"$",
"trace",
")",
";",
"return",
"isset",
"(",
"$",
"trac... | Check if this is an exception
@return bool | [
"Check",
"if",
"this",
"is",
"an",
"exception"
] | c1e127539b13d3ec8381e41c64b881e0701807f5 | https://github.com/modulusphp/utility/blob/c1e127539b13d3ec8381e41c64b881e0701807f5/View.php#L46-L56 | train |
Hnto/nuki | src/Skeletons/Processes/Event.php | Event.notify | public function notify() {
foreach($this->watchers as $watcher) {
if ($this->stopNotify === true) {
break;
}
$watcher->update($this);
}
} | php | public function notify() {
foreach($this->watchers as $watcher) {
if ($this->stopNotify === true) {
break;
}
$watcher->update($this);
}
} | [
"public",
"function",
"notify",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"watchers",
"as",
"$",
"watcher",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"stopNotify",
"===",
"true",
")",
"{",
"break",
";",
"}",
"$",
"watcher",
"->",
"update",
"(... | Notify all available watchers | [
"Notify",
"all",
"available",
"watchers"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Skeletons/Processes/Event.php#L102-L110 | train |
Kris-Kuiper/sFire-Framework | src/Validator/File/Validator.php | Validator.isRequired | private function isRequired($field, $file) {
if(true === isset($this -> required[$field])) {
if(false === $this -> required[$field] && (null === $file || trim($file['tmp_name']) === '')) {
return true;
}
}
return false;
} | php | private function isRequired($field, $file) {
if(true === isset($this -> required[$field])) {
if(false === $this -> required[$field] && (null === $file || trim($file['tmp_name']) === '')) {
return true;
}
}
return false;
} | [
"private",
"function",
"isRequired",
"(",
"$",
"field",
",",
"$",
"file",
")",
"{",
"if",
"(",
"true",
"===",
"isset",
"(",
"$",
"this",
"->",
"required",
"[",
"$",
"field",
"]",
")",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"requi... | Evaluates if file is required or not
@param $field string
@param $file null | string
@return boolean | [
"Evaluates",
"if",
"file",
"is",
"required",
"or",
"not"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/File/Validator.php#L141-L151 | train |
Kris-Kuiper/sFire-Framework | src/Validator/File/Validator.php | Validator.getFile | private function getFile($field, $prefix) {
//Prefix
if(null !== $prefix) {
$field = $prefix . '[' . $field . ']';
}
//Get the value
$helper = new StringToArray();
$data = $helper -> execute($field, null, $this -> getData());
return $data;
} | php | private function getFile($field, $prefix) {
//Prefix
if(null !== $prefix) {
$field = $prefix . '[' . $field . ']';
}
//Get the value
$helper = new StringToArray();
$data = $helper -> execute($field, null, $this -> getData());
return $data;
} | [
"private",
"function",
"getFile",
"(",
"$",
"field",
",",
"$",
"prefix",
")",
"{",
"//Prefix\r",
"if",
"(",
"null",
"!==",
"$",
"prefix",
")",
"{",
"$",
"field",
"=",
"$",
"prefix",
".",
"'['",
".",
"$",
"field",
".",
"']'",
";",
"}",
"//Get the va... | Returns the file array for a given field
@param string $field
@param string $prefix
@return mixed | [
"Returns",
"the",
"file",
"array",
"for",
"a",
"given",
"field"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Validator/File/Validator.php#L215-L227 | train |
Wedeto/FileFormats | src/INI/Writer.php | Writer.writeParameter | private static function writeParameter($file_handle, $name, $parameter, $depth = 0)
{
if ($depth > 1)
throw new \DomainException("Cannot nest arrays more than once in INI-file");
$str = "";
if (WF::is_array_like($parameter))
{
foreach ($parameter as $key => $... | php | private static function writeParameter($file_handle, $name, $parameter, $depth = 0)
{
if ($depth > 1)
throw new \DomainException("Cannot nest arrays more than once in INI-file");
$str = "";
if (WF::is_array_like($parameter))
{
foreach ($parameter as $key => $... | [
"private",
"static",
"function",
"writeParameter",
"(",
"$",
"file_handle",
",",
"$",
"name",
",",
"$",
"parameter",
",",
"$",
"depth",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"depth",
">",
"1",
")",
"throw",
"new",
"\\",
"DomainException",
"(",
"\"Cannot ... | Recursive function that writes a parameter or a series of parameters
to the INI file
@param $name string The name of the parameter
@param $parameter mixed The parameter to write | [
"Recursive",
"function",
"that",
"writes",
"a",
"parameter",
"or",
"a",
"series",
"of",
"parameters",
"to",
"the",
"INI",
"file"
] | 65b71fbd38a2ee6b504622aca4f4047ce9d31e9f | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/INI/Writer.php#L167-L193 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/http/Request.php | Request.getAcceptedEncodings | public function getAcceptedEncodings()
{
if (null === $this->encodings) {
if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
$this->encodings = strtolower(trim($_SERVER['HTTP_ACCEPT_ENCODING']));
} else {
$this->encodings = '';
}
}
... | php | public function getAcceptedEncodings()
{
if (null === $this->encodings) {
if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
$this->encodings = strtolower(trim($_SERVER['HTTP_ACCEPT_ENCODING']));
} else {
$this->encodings = '';
}
}
... | [
"public",
"function",
"getAcceptedEncodings",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"encodings",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'HTTP_ACCEPT_ENCODING'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"encodings",
... | Returns the encodings the client accepts.
from HTTP_ACCEPT_ENCODING
@return string | [
"Returns",
"the",
"encodings",
"the",
"client",
"accepts",
".",
"from",
"HTTP_ACCEPT_ENCODING"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/http/Request.php#L231-L242 | train |
byjg/serializer | src/BinderObject.php | BinderObject.toArrayFrom | public static function toArrayFrom($source, $firstLevel = false, $excludeClasses = [], $propertyPattern = null)
{
// Prepare the source object type
$object = new SerializerObject($source);
$object->setStopFirstLevel($firstLevel);
$object->setDoNotParse($excludeClasses);
if (!... | php | public static function toArrayFrom($source, $firstLevel = false, $excludeClasses = [], $propertyPattern = null)
{
// Prepare the source object type
$object = new SerializerObject($source);
$object->setStopFirstLevel($firstLevel);
$object->setDoNotParse($excludeClasses);
if (!... | [
"public",
"static",
"function",
"toArrayFrom",
"(",
"$",
"source",
",",
"$",
"firstLevel",
"=",
"false",
",",
"$",
"excludeClasses",
"=",
"[",
"]",
",",
"$",
"propertyPattern",
"=",
"null",
")",
"{",
"// Prepare the source object type",
"$",
"object",
"=",
"... | Get all properties from a source object as an associative array
@param mixed $source
@param bool $firstLevel
@param array $excludeClasses
@param array|null $propertyPattern
@return array
@throws \ByJG\Serializer\Exception\InvalidArgumentException | [
"Get",
"all",
"properties",
"from",
"a",
"source",
"object",
"as",
"an",
"associative",
"array"
] | 035f9df69b3ad8af6fbe737da25d70d84b358f0f | https://github.com/byjg/serializer/blob/035f9df69b3ad8af6fbe737da25d70d84b358f0f/src/BinderObject.php#L78-L93 | train |
byjg/serializer | src/BinderObject.php | BinderObject.setPropValue | protected function setPropValue($obj, $propName, $value)
{
if (method_exists($obj, 'set' . $propName)) {
$obj->{'set' . $propName}($value);
} elseif (isset($obj->{$propName}) || $obj instanceof stdClass) {
$obj->{$propName} = $value;
} else {
// Check if s... | php | protected function setPropValue($obj, $propName, $value)
{
if (method_exists($obj, 'set' . $propName)) {
$obj->{'set' . $propName}($value);
} elseif (isset($obj->{$propName}) || $obj instanceof stdClass) {
$obj->{$propName} = $value;
} else {
// Check if s... | [
"protected",
"function",
"setPropValue",
"(",
"$",
"obj",
",",
"$",
"propName",
",",
"$",
"value",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"obj",
",",
"'set'",
".",
"$",
"propName",
")",
")",
"{",
"$",
"obj",
"->",
"{",
"'set'",
".",
"$",
... | Set the property value
@param mixed $obj
@param string $propName
@param string $value | [
"Set",
"the",
"property",
"value"
] | 035f9df69b3ad8af6fbe737da25d70d84b358f0f | https://github.com/byjg/serializer/blob/035f9df69b3ad8af6fbe737da25d70d84b358f0f/src/BinderObject.php#L102-L125 | train |
zhaoxianfang/tools | src/Symfony/Component/Config/Util/XmlUtils.php | XmlUtils.convertDomElementToArray | public static function convertDomElementToArray(\DOMElement $element, $checkPrefix = true)
{
$prefix = (string) $element->prefix;
$empty = true;
$config = array();
foreach ($element->attributes as $name => $node) {
if ($checkPrefix && !in_array((string) $node->prefix, arr... | php | public static function convertDomElementToArray(\DOMElement $element, $checkPrefix = true)
{
$prefix = (string) $element->prefix;
$empty = true;
$config = array();
foreach ($element->attributes as $name => $node) {
if ($checkPrefix && !in_array((string) $node->prefix, arr... | [
"public",
"static",
"function",
"convertDomElementToArray",
"(",
"\\",
"DOMElement",
"$",
"element",
",",
"$",
"checkPrefix",
"=",
"true",
")",
"{",
"$",
"prefix",
"=",
"(",
"string",
")",
"$",
"element",
"->",
"prefix",
";",
"$",
"empty",
"=",
"true",
"... | Converts a \DOMElement object to a PHP array.
The following rules applies during the conversion:
* Each tag is converted to a key value or an array
if there is more than one "value"
* The content of a tag is set under a "value" key (<foo>bar</foo>)
if the tag also has some nested tags
* The attributes are converted... | [
"Converts",
"a",
"\\",
"DOMElement",
"object",
"to",
"a",
"PHP",
"array",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Util/XmlUtils.php#L157-L206 | train |
zhaoxianfang/tools | src/Symfony/Component/Config/Util/XmlUtils.php | XmlUtils.phpize | public static function phpize($value)
{
$value = (string) $value;
$lowercaseValue = strtolower($value);
switch (true) {
case 'null' === $lowercaseValue:
return;
case ctype_digit($value):
$raw = $value;
$cast = (int) $va... | php | public static function phpize($value)
{
$value = (string) $value;
$lowercaseValue = strtolower($value);
switch (true) {
case 'null' === $lowercaseValue:
return;
case ctype_digit($value):
$raw = $value;
$cast = (int) $va... | [
"public",
"static",
"function",
"phpize",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"(",
"string",
")",
"$",
"value",
";",
"$",
"lowercaseValue",
"=",
"strtolower",
"(",
"$",
"value",
")",
";",
"switch",
"(",
"true",
")",
"{",
"case",
"'null'",... | Converts an xml value to a PHP type.
@param mixed $value
@return mixed | [
"Converts",
"an",
"xml",
"value",
"to",
"a",
"PHP",
"type",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Util/XmlUtils.php#L215-L248 | train |
AltCtrlSupr/ACSPanel-Wordpress | Controller/WPSetupController.php | WPSetupController.indexAction | public function indexAction()
{
$em = $this->getDoctrine()->getManager();
//
// IF is admin can see all the hosts, if is user only their ones...
if (true === $this->get('security.context')->isGranted('ROLE_SUPER_ADMIN')) {
$entities = $em->getRepository('ACSACSPanelWordpr... | php | public function indexAction()
{
$em = $this->getDoctrine()->getManager();
//
// IF is admin can see all the hosts, if is user only their ones...
if (true === $this->get('security.context')->isGranted('ROLE_SUPER_ADMIN')) {
$entities = $em->getRepository('ACSACSPanelWordpr... | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"//",
"// IF is admin can see all the hosts, if is user only their ones...",
"if",
"(",
"true",
"===",
"$",
"this",... | Lists all WPSetup entities. | [
"Lists",
"all",
"WPSetup",
"entities",
"."
] | b8d1daff071d8dd51afa24813162b37548610041 | https://github.com/AltCtrlSupr/ACSPanel-Wordpress/blob/b8d1daff071d8dd51afa24813162b37548610041/Controller/WPSetupController.php#L25-L47 | train |
AltCtrlSupr/ACSPanel-Wordpress | Controller/WPSetupController.php | WPSetupController.newAction | public function newAction()
{
$entity = new WPSetup();
$form = $this->createForm(new WPSetupType($this->container), $entity);
return $this->render('ACSACSPanelWordpressBundle:WPSetup:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
... | php | public function newAction()
{
$entity = new WPSetup();
$form = $this->createForm(new WPSetupType($this->container), $entity);
return $this->render('ACSACSPanelWordpressBundle:WPSetup:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
... | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"entity",
"=",
"new",
"WPSetup",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"WPSetupType",
"(",
"$",
"this",
"->",
"container",
")",
",",
"$",
"entity",
")",
... | Displays a form to create a new WPSetup entity. | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"WPSetup",
"entity",
"."
] | b8d1daff071d8dd51afa24813162b37548610041 | https://github.com/AltCtrlSupr/ACSPanel-Wordpress/blob/b8d1daff071d8dd51afa24813162b37548610041/Controller/WPSetupController.php#L74-L83 | train |
AltCtrlSupr/ACSPanel-Wordpress | Controller/WPSetupController.php | WPSetupController.createAction | public function createAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$entity = new WPSetup();
$form = $this->createForm(new WPSetupType($this->container), $entity);
$form->bind($request);
if ($form->isValid()) {
$user = $this->get('securi... | php | public function createAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$entity = new WPSetup();
$form = $this->createForm(new WPSetupType($this->container), $entity);
$form->bind($request);
if ($form->isValid()) {
$user = $this->get('securi... | [
"public",
"function",
"createAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"new",
"WPSetup",
"(",
")",
";",
"$",
"form",
"=",
"$... | Creates a new WPSetup entity. | [
"Creates",
"a",
"new",
"WPSetup",
"entity",
"."
] | b8d1daff071d8dd51afa24813162b37548610041 | https://github.com/AltCtrlSupr/ACSPanel-Wordpress/blob/b8d1daff071d8dd51afa24813162b37548610041/Controller/WPSetupController.php#L89-L144 | train |
AltCtrlSupr/ACSPanel-Wordpress | Controller/WPSetupController.php | WPSetupController.editAction | public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ACSACSPanelWordpressBundle:WPSetup')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find WPSetup entity.');
}
$editForm = $thi... | php | public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ACSACSPanelWordpressBundle:WPSetup')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find WPSetup entity.');
}
$editForm = $thi... | [
"public",
"function",
"editAction",
"(",
"$",
"id",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"'ACSACSPanelWordpressBundle:WPSetup'",
... | Displays a form to edit an existing WPSetup entity. | [
"Displays",
"a",
"form",
"to",
"edit",
"an",
"existing",
"WPSetup",
"entity",
"."
] | b8d1daff071d8dd51afa24813162b37548610041 | https://github.com/AltCtrlSupr/ACSPanel-Wordpress/blob/b8d1daff071d8dd51afa24813162b37548610041/Controller/WPSetupController.php#L150-L168 | train |
AltCtrlSupr/ACSPanel-Wordpress | Controller/WPSetupController.php | WPSetupController.updateAction | public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ACSACSPanelWordpressBundle:WPSetup')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find WPSetup entity.');
}
... | php | public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ACSACSPanelWordpressBundle:WPSetup')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find WPSetup entity.');
}
... | [
"public",
"function",
"updateAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
... | Edits an existing WPSetup entity. | [
"Edits",
"an",
"existing",
"WPSetup",
"entity",
"."
] | b8d1daff071d8dd51afa24813162b37548610041 | https://github.com/AltCtrlSupr/ACSPanel-Wordpress/blob/b8d1daff071d8dd51afa24813162b37548610041/Controller/WPSetupController.php#L174-L200 | train |
aztech-digital/phinject | src/ParameterContainer.php | ParameterContainer.validateParameter | protected function validateParameter($key, $value)
{
if ($this->isSafeValue($value)) {
return true;
}
$this->enforceNonObjectValue($key, $value);
$this->enforceMultidimensionalArrayOfScalars($key, $value);
return true;
} | php | protected function validateParameter($key, $value)
{
if ($this->isSafeValue($value)) {
return true;
}
$this->enforceNonObjectValue($key, $value);
$this->enforceMultidimensionalArrayOfScalars($key, $value);
return true;
} | [
"protected",
"function",
"validateParameter",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSafeValue",
"(",
"$",
"value",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"this",
"->",
"enforceNonObjectValue",
"(",
"$",... | Check that the value to bind is a scalar, or an array multi-dimensional of scalars
@param string $key
@param mixed $value
@return boolean
@throws IllegalTypeException | [
"Check",
"that",
"the",
"value",
"to",
"bind",
"is",
"a",
"scalar",
"or",
"an",
"array",
"multi",
"-",
"dimensional",
"of",
"scalars"
] | 1bb2fb3b5ef44e62f168af71134c613c48b58d95 | https://github.com/aztech-digital/phinject/blob/1bb2fb3b5ef44e62f168af71134c613c48b58d95/src/ParameterContainer.php#L112-L122 | train |
nails/module-geo-ip | src/Service/GeoIp.php | GeoIp.getDriverInstance | public function getDriverInstance($sSlug = null)
{
$oDriverService = Factory::service('Driver', 'nails/module-geo-ip');
$sEnabledDriver = appSetting($oDriverService->getSettingKey(), 'nails/module-geo-ip');
$oEnabledDriver = $oDriverService->getEnabled();
if (empty($sEnabledDriver) ... | php | public function getDriverInstance($sSlug = null)
{
$oDriverService = Factory::service('Driver', 'nails/module-geo-ip');
$sEnabledDriver = appSetting($oDriverService->getSettingKey(), 'nails/module-geo-ip');
$oEnabledDriver = $oDriverService->getEnabled();
if (empty($sEnabledDriver) ... | [
"public",
"function",
"getDriverInstance",
"(",
"$",
"sSlug",
"=",
"null",
")",
"{",
"$",
"oDriverService",
"=",
"Factory",
"::",
"service",
"(",
"'Driver'",
",",
"'nails/module-geo-ip'",
")",
";",
"$",
"sEnabledDriver",
"=",
"appSetting",
"(",
"$",
"oDriverSe... | Returns an instance of the driver
@param string $sSlug The driver's slug
@throws GeoIpDriverException
@return \Nails\GeoIp\Interfaces\Driver | [
"Returns",
"an",
"instance",
"of",
"the",
"driver"
] | 1c73513e18ae490c37d4e5f5fddd071c95d850ce | https://github.com/nails/module-geo-ip/blob/1c73513e18ae490c37d4e5f5fddd071c95d850ce/src/Service/GeoIp.php#L54-L83 | train |
nails/module-geo-ip | src/Service/GeoIp.php | GeoIp.lookup | public function lookup($sIp = '')
{
$sIp = trim($sIp);
if (empty($sIp) && !empty($_SERVER['REMOTE_ADDR'])) {
$sIp = $_SERVER['REMOTE_ADDR'];
}
$oCache = $this->getCache($sIp);
if (!empty($oCache)) {
return $oCache;
}
$oIp = $this->o... | php | public function lookup($sIp = '')
{
$sIp = trim($sIp);
if (empty($sIp) && !empty($_SERVER['REMOTE_ADDR'])) {
$sIp = $_SERVER['REMOTE_ADDR'];
}
$oCache = $this->getCache($sIp);
if (!empty($oCache)) {
return $oCache;
}
$oIp = $this->o... | [
"public",
"function",
"lookup",
"(",
"$",
"sIp",
"=",
"''",
")",
"{",
"$",
"sIp",
"=",
"trim",
"(",
"$",
"sIp",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sIp",
")",
"&&",
"!",
"empty",
"(",
"$",
"_SERVER",
"[",
"'REMOTE_ADDR'",
"]",
")",
")",
... | Return all information about a given IP
@param string $sIp The IP to get details for
@throws GeoIpException
@return \Nails\GeoIp\Result\Ip | [
"Return",
"all",
"information",
"about",
"a",
"given",
"IP"
] | 1c73513e18ae490c37d4e5f5fddd071c95d850ce | https://github.com/nails/module-geo-ip/blob/1c73513e18ae490c37d4e5f5fddd071c95d850ce/src/Service/GeoIp.php#L95-L118 | train |
phpgears/event | src/Time/FixedTimeProvider.php | FixedTimeProvider.setCurrentTime | public function setCurrentTime(\DateTimeImmutable $fixedTime): void
{
$this->fixedTime = $fixedTime->setTimezone($this->timeZone);
} | php | public function setCurrentTime(\DateTimeImmutable $fixedTime): void
{
$this->fixedTime = $fixedTime->setTimezone($this->timeZone);
} | [
"public",
"function",
"setCurrentTime",
"(",
"\\",
"DateTimeImmutable",
"$",
"fixedTime",
")",
":",
"void",
"{",
"$",
"this",
"->",
"fixedTime",
"=",
"$",
"fixedTime",
"->",
"setTimezone",
"(",
"$",
"this",
"->",
"timeZone",
")",
";",
"}"
] | Set fixed date.
@param \DateTimeImmutable $fixedTime | [
"Set",
"fixed",
"date",
"."
] | 9b25301837748a67b3b48cc46ad837c859c4522d | https://github.com/phpgears/event/blob/9b25301837748a67b3b48cc46ad837c859c4522d/src/Time/FixedTimeProvider.php#L50-L53 | train |
eureka-framework/component-config | src/Config/Config.php | Config.load | public function load($file, $namespace = '', $parser = null, $env = null)
{
$config = [];
$this->currentFile = $file;
//~ Check in cache
if (is_object($this->cache)) {
$config = $this->cache->get('Eureka.Component.Config.Test.' . $env . '.' . md5($file) . '.cache');
... | php | public function load($file, $namespace = '', $parser = null, $env = null)
{
$config = [];
$this->currentFile = $file;
//~ Check in cache
if (is_object($this->cache)) {
$config = $this->cache->get('Eureka.Component.Config.Test.' . $env . '.' . md5($file) . '.cache');
... | [
"public",
"function",
"load",
"(",
"$",
"file",
",",
"$",
"namespace",
"=",
"''",
",",
"$",
"parser",
"=",
"null",
",",
"$",
"env",
"=",
"null",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"currentFile",
"=",
"$",
"file",
";... | Get config value for config var specified.
@param string $file
@param string $namespace
@param object $parser File parser
@param string $env
@return $this
@throws \Exception | [
"Get",
"config",
"value",
"for",
"config",
"var",
"specified",
"."
] | ae3f17683fb3e96641b65375c6cca6a3139ae85e | https://github.com/eureka-framework/component-config/blob/ae3f17683fb3e96641b65375c6cca6a3139ae85e/src/Config/Config.php#L294-L341 | train |
eureka-framework/component-config | src/Config/Config.php | Config.loadYamlFromDirectory | public function loadYamlFromDirectory($directory, $namespace = 'global.', $environment = null)
{
if ($environment === null) {
$environment = $this->environment;
}
foreach (glob($directory . '/*.yml') as $filename) {
$this->load($filename, $namespace . basename($filen... | php | public function loadYamlFromDirectory($directory, $namespace = 'global.', $environment = null)
{
if ($environment === null) {
$environment = $this->environment;
}
foreach (glob($directory . '/*.yml') as $filename) {
$this->load($filename, $namespace . basename($filen... | [
"public",
"function",
"loadYamlFromDirectory",
"(",
"$",
"directory",
",",
"$",
"namespace",
"=",
"'global.'",
",",
"$",
"environment",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"environment",
"===",
"null",
")",
"{",
"$",
"environment",
"=",
"$",
"this",
"... | Load yaml files froem given directory.
@param string $directory
@param string $namespace
@param null|string $environment
@return $this | [
"Load",
"yaml",
"files",
"froem",
"given",
"directory",
"."
] | ae3f17683fb3e96641b65375c6cca6a3139ae85e | https://github.com/eureka-framework/component-config/blob/ae3f17683fb3e96641b65375c6cca6a3139ae85e/src/Config/Config.php#L351-L362 | train |
eureka-framework/component-config | src/Config/Config.php | Config.replaceReferences | private function replaceReferences(array &$config)
{
foreach ($config as $key => &$value) {
if (is_array($value)) {
$this->replaceReferences($value);
continue;
}
//~ Not string, skip
if (!is_string($value)) {
co... | php | private function replaceReferences(array &$config)
{
foreach ($config as $key => &$value) {
if (is_array($value)) {
$this->replaceReferences($value);
continue;
}
//~ Not string, skip
if (!is_string($value)) {
co... | [
"private",
"function",
"replaceReferences",
"(",
"array",
"&",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"config",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
... | Replace references values in all configurations.
@param array $config
@return void | [
"Replace",
"references",
"values",
"in",
"all",
"configurations",
"."
] | ae3f17683fb3e96641b65375c6cca6a3139ae85e | https://github.com/eureka-framework/component-config/blob/ae3f17683fb3e96641b65375c6cca6a3139ae85e/src/Config/Config.php#L370-L394 | train |
nattreid/tracking | src/Model/TrackingPages/TrackingPagesMapper.php | TrackingPagesMapper.findCalculateDate | public function findCalculateDate(Range $interval): array
{
$result = [];
if (!isset($this->isCalculated[(string) $interval])) {
$this->isCalculated[(string) $interval] = true;
// dopocita posledni den
if ($interval->to->format('Y-m-d') >= (new DateTime)->format('Y-m-d')) {
$last = $this->connection-... | php | public function findCalculateDate(Range $interval): array
{
$result = [];
if (!isset($this->isCalculated[(string) $interval])) {
$this->isCalculated[(string) $interval] = true;
// dopocita posledni den
if ($interval->to->format('Y-m-d') >= (new DateTime)->format('Y-m-d')) {
$last = $this->connection-... | [
"public",
"function",
"findCalculateDate",
"(",
"Range",
"$",
"interval",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"isCalculated",
"[",
"(",
"string",
")",
"$",
"interval",
"]",
")",
... | Vrati datum, ktere je treba prepocitat
@param Range $interval
@return DateTime[]
@throws QueryException | [
"Vrati",
"datum",
"ktere",
"je",
"treba",
"prepocitat"
] | 5fc7c993c08774945405c79a393584ef2ed589f7 | https://github.com/nattreid/tracking/blob/5fc7c993c08774945405c79a393584ef2ed589f7/src/Model/TrackingPages/TrackingPagesMapper.php#L62-L100 | train |
phpffcms/ffcms-core | src/Helper/Type/Any.php | Any.isBool | public static function isBool(&$var = null): bool
{
// will return true for "1", true, "on", "yes", false for 0, "false", "off", 'no', '', NULL FOR ANY OTHER VALUE!!!
$parse = filter_var($var, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
if ($parse !== null) {
$var = $parse;... | php | public static function isBool(&$var = null): bool
{
// will return true for "1", true, "on", "yes", false for 0, "false", "off", 'no', '', NULL FOR ANY OTHER VALUE!!!
$parse = filter_var($var, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
if ($parse !== null) {
$var = $parse;... | [
"public",
"static",
"function",
"isBool",
"(",
"&",
"$",
"var",
"=",
"null",
")",
":",
"bool",
"{",
"// will return true for \"1\", true, \"on\", \"yes\", false for 0, \"false\", \"off\", 'no', '', NULL FOR ANY OTHER VALUE!!!",
"$",
"parse",
"=",
"filter_var",
"(",
"$",
"va... | Check if var is boolean and parseBool by ref
@param mixed $var
@return bool | [
"Check",
"if",
"var",
"is",
"boolean",
"and",
"parseBool",
"by",
"ref"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/Type/Any.php#L93-L102 | train |
VTacius/ldapPM | src/Controlador/ldapAccess.php | ldapAccess.obtenerConfiguracionDominio | protected function obtenerConfiguracionDominio($destino, $fichero){
$yaml = new \Symfony\Component\Yaml\Parser();
$valor = $yaml->parse(file_get_contents($fichero));
$parametros = $valor['ldapPM'];
if ($parametros['solo_default']) {
// TODO: Implementar esto
}else{
... | php | protected function obtenerConfiguracionDominio($destino, $fichero){
$yaml = new \Symfony\Component\Yaml\Parser();
$valor = $yaml->parse(file_get_contents($fichero));
$parametros = $valor['ldapPM'];
if ($parametros['solo_default']) {
// TODO: Implementar esto
}else{
... | [
"protected",
"function",
"obtenerConfiguracionDominio",
"(",
"$",
"destino",
",",
"$",
"fichero",
")",
"{",
"$",
"yaml",
"=",
"new",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"Yaml",
"\\",
"Parser",
"(",
")",
";",
"$",
"valor",
"=",
"$",
"yaml",
"->",
... | Recoge la configuracion del dominio dado
@param string $destino
@param string $fichero
@return array | [
"Recoge",
"la",
"configuracion",
"del",
"dominio",
"dado"
] | 728af24cd0a5ca4fbed76ffb52aa4800b118879f | https://github.com/VTacius/ldapPM/blob/728af24cd0a5ca4fbed76ffb52aa4800b118879f/src/Controlador/ldapAccess.php#L129-L138 | train |
rougin/blueprint | src/Application.php | Application.run | public function run($console = false)
{
$commands = $this->commands;
is_string($commands) && $commands = $this->classes();
foreach ((array) $commands as $command) {
$item = $this->container->get($command);
$this->console->add($instance = $item);
}
... | php | public function run($console = false)
{
$commands = $this->commands;
is_string($commands) && $commands = $this->classes();
foreach ((array) $commands as $command) {
$item = $this->container->get($command);
$this->console->add($instance = $item);
}
... | [
"public",
"function",
"run",
"(",
"$",
"console",
"=",
"false",
")",
"{",
"$",
"commands",
"=",
"$",
"this",
"->",
"commands",
";",
"is_string",
"(",
"$",
"commands",
")",
"&&",
"$",
"commands",
"=",
"$",
"this",
"->",
"classes",
"(",
")",
";",
"fo... | Runs the console instance.
@param boolean $console
@return \Symfony\Component\Console\Application | [
"Runs",
"the",
"console",
"instance",
"."
] | 02dab857b0fab60e060632f11f73e24467483e5b | https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Application.php#L164-L179 | train |
rougin/blueprint | src/Application.php | Application.classes | protected function classes()
{
list($items, $pattern) = array(array(), '/\\.[^.\\s]{3,4}$/');
$files = glob($this->commands . '/*.php');
$path = strlen($this->commands . DIRECTORY_SEPARATOR);
foreach ((array) $files as $file) {
$substring = substr($file, $path);
... | php | protected function classes()
{
list($items, $pattern) = array(array(), '/\\.[^.\\s]{3,4}$/');
$files = glob($this->commands . '/*.php');
$path = strlen($this->commands . DIRECTORY_SEPARATOR);
foreach ((array) $files as $file) {
$substring = substr($file, $path);
... | [
"protected",
"function",
"classes",
"(",
")",
"{",
"list",
"(",
"$",
"items",
",",
"$",
"pattern",
")",
"=",
"array",
"(",
"array",
"(",
")",
",",
"'/\\\\.[^.\\\\s]{3,4}$/'",
")",
";",
"$",
"files",
"=",
"glob",
"(",
"$",
"this",
"->",
"commands",
".... | Returns an array of command classes.
@return string[] | [
"Returns",
"an",
"array",
"of",
"command",
"classes",
"."
] | 02dab857b0fab60e060632f11f73e24467483e5b | https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Application.php#L186-L207 | train |
rougin/blueprint | src/Application.php | Application.parse | protected function parse($file)
{
$search = '%%CURRENT_DIRECTORY%%';
$yaml = file_get_contents($file);
$yaml = str_replace($search, $this->root, $yaml);
$result = Yaml::parse($yaml);
$this->commands = $result['paths']['commands'];
$this->namespace = $result['name... | php | protected function parse($file)
{
$search = '%%CURRENT_DIRECTORY%%';
$yaml = file_get_contents($file);
$yaml = str_replace($search, $this->root, $yaml);
$result = Yaml::parse($yaml);
$this->commands = $result['paths']['commands'];
$this->namespace = $result['name... | [
"protected",
"function",
"parse",
"(",
"$",
"file",
")",
"{",
"$",
"search",
"=",
"'%%CURRENT_DIRECTORY%%'",
";",
"$",
"yaml",
"=",
"file_get_contents",
"(",
"$",
"file",
")",
";",
"$",
"yaml",
"=",
"str_replace",
"(",
"$",
"search",
",",
"$",
"this",
... | Parses the YAML file.
@param string $file
@return void | [
"Parses",
"the",
"YAML",
"file",
"."
] | 02dab857b0fab60e060632f11f73e24467483e5b | https://github.com/rougin/blueprint/blob/02dab857b0fab60e060632f11f73e24467483e5b/src/Application.php#L215-L230 | train |
DreadLabs/app-migration-migrator-phinx | src/Migrator.php | Migrator.needsToRun | public function needsToRun()
{
$this->initializeVersions();
if (empty($this->migratedVersions) && empty($this->availableVersions)) {
return false;
}
$needsToRun = $this->hasUnmigratedVersions();
return $needsToRun;
} | php | public function needsToRun()
{
$this->initializeVersions();
if (empty($this->migratedVersions) && empty($this->availableVersions)) {
return false;
}
$needsToRun = $this->hasUnmigratedVersions();
return $needsToRun;
} | [
"public",
"function",
"needsToRun",
"(",
")",
"{",
"$",
"this",
"->",
"initializeVersions",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"migratedVersions",
")",
"&&",
"empty",
"(",
"$",
"this",
"->",
"availableVersions",
")",
")",
"{",
"... | Flags if migrations need to be executed
@return bool | [
"Flags",
"if",
"migrations",
"need",
"to",
"be",
"executed"
] | a43e437fcc4e3dff7becf7114bc65b78099d0977 | https://github.com/DreadLabs/app-migration-migrator-phinx/blob/a43e437fcc4e3dff7becf7114bc65b78099d0977/src/Migrator.php#L74-L85 | train |
DreadLabs/app-migration-migrator-phinx | src/Migrator.php | Migrator.initializeVersions | private function initializeVersions()
{
$env = $this->manager->getEnvironment($this->environment);
$this->migratedVersions = $env->getVersions();
$this->availableVersions = $this->manager->getMigrations();
$this->currentVersion = $env->getCurrentVersion();
} | php | private function initializeVersions()
{
$env = $this->manager->getEnvironment($this->environment);
$this->migratedVersions = $env->getVersions();
$this->availableVersions = $this->manager->getMigrations();
$this->currentVersion = $env->getCurrentVersion();
} | [
"private",
"function",
"initializeVersions",
"(",
")",
"{",
"$",
"env",
"=",
"$",
"this",
"->",
"manager",
"->",
"getEnvironment",
"(",
"$",
"this",
"->",
"environment",
")",
";",
"$",
"this",
"->",
"migratedVersions",
"=",
"$",
"env",
"->",
"getVersions",... | Initializes the migrated, available and current versions
@return void | [
"Initializes",
"the",
"migrated",
"available",
"and",
"current",
"versions"
] | a43e437fcc4e3dff7becf7114bc65b78099d0977 | https://github.com/DreadLabs/app-migration-migrator-phinx/blob/a43e437fcc4e3dff7becf7114bc65b78099d0977/src/Migrator.php#L92-L99 | train |
DreadLabs/app-migration-migrator-phinx | src/Migrator.php | Migrator.hasUnmigratedVersions | private function hasUnmigratedVersions()
{
$needsToRun = false;
foreach ($this->availableVersions as $migration) {
$isTargetMigrated = in_array($migration->getVersion(), $this->migratedVersions);
if ($isTargetMigrated) {
continue;
}
... | php | private function hasUnmigratedVersions()
{
$needsToRun = false;
foreach ($this->availableVersions as $migration) {
$isTargetMigrated = in_array($migration->getVersion(), $this->migratedVersions);
if ($isTargetMigrated) {
continue;
}
... | [
"private",
"function",
"hasUnmigratedVersions",
"(",
")",
"{",
"$",
"needsToRun",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"availableVersions",
"as",
"$",
"migration",
")",
"{",
"$",
"isTargetMigrated",
"=",
"in_array",
"(",
"$",
"migration",
"-... | Flags if unmigrated versions exists
@return bool | [
"Flags",
"if",
"unmigrated",
"versions",
"exists"
] | a43e437fcc4e3dff7becf7114bc65b78099d0977 | https://github.com/DreadLabs/app-migration-migrator-phinx/blob/a43e437fcc4e3dff7becf7114bc65b78099d0977/src/Migrator.php#L106-L122 | train |
agentmedia/phine-core | src/Core/Modules/Backend/UserForm.php | UserForm.AddPasswordField | private function AddPasswordField()
{
$name = 'Password';
$this->AddField(Input::Password($name));
//Password needs contain lower case letter, upper case letter, and a digit
//$validator = new RegExp('/((?=.*\d)(?=.*[a-z])(?=.*[A-Z]))/');
//$this->AddValidator($name,... | php | private function AddPasswordField()
{
$name = 'Password';
$this->AddField(Input::Password($name));
//Password needs contain lower case letter, upper case letter, and a digit
//$validator = new RegExp('/((?=.*\d)(?=.*[a-z])(?=.*[A-Z]))/');
//$this->AddValidator($name,... | [
"private",
"function",
"AddPasswordField",
"(",
")",
"{",
"$",
"name",
"=",
"'Password'",
";",
"$",
"this",
"->",
"AddField",
"(",
"Input",
"::",
"Password",
"(",
"$",
"name",
")",
")",
";",
"//Password needs contain lower case letter, upper case letter, and a digit... | Adds the password field | [
"Adds",
"the",
"password",
"field"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/UserForm.php#L104-L117 | train |
stubbles/stubbles-webapp-session | src/main/php/WebSession.php | WebSession.removeValue | public function removeValue($key)
{
if (!$this->isValid()) {
throw new \LogicException('Session is in an invalid state.');
}
if ($this->storage->hasValue($key)) {
$this->storage->removeValue($key);
return true;
}
return false;
} | php | public function removeValue($key)
{
if (!$this->isValid()) {
throw new \LogicException('Session is in an invalid state.');
}
if ($this->storage->hasValue($key)) {
$this->storage->removeValue($key);
return true;
}
return false;
} | [
"public",
"function",
"removeValue",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Session is in an invalid state.'",
")",
";",
"}",
"if",
"(",
"$",
"this",
"... | removes a value from the session
@param string $key key where value is stored under
@return bool true if value existed and was removed, else false
@throws \LogicException | [
"removes",
"a",
"value",
"from",
"the",
"session"
] | 2976fa28995bfb6ad00e3eac59ad689dd7892450 | https://github.com/stubbles/stubbles-webapp-session/blob/2976fa28995bfb6ad00e3eac59ad689dd7892450/src/main/php/WebSession.php#L223-L235 | train |
stubbles/stubbles-webapp-session | src/main/php/WebSession.php | WebSession.valueKeys | public function valueKeys()
{
if (!$this->isValid()) {
throw new \LogicException('Session is in an invalid state.');
}
return array_values(
array_filter(
$this->storage->valueKeys(),
function($valueKey)
... | php | public function valueKeys()
{
if (!$this->isValid()) {
throw new \LogicException('Session is in an invalid state.');
}
return array_values(
array_filter(
$this->storage->valueKeys(),
function($valueKey)
... | [
"public",
"function",
"valueKeys",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Session is in an invalid state.'",
")",
";",
"}",
"return",
"array_values",
"(",
"array_filter"... | return an array of all keys registered in this session
@return string[]
@throws \LogicException | [
"return",
"an",
"array",
"of",
"all",
"keys",
"registered",
"in",
"this",
"session"
] | 2976fa28995bfb6ad00e3eac59ad689dd7892450 | https://github.com/stubbles/stubbles-webapp-session/blob/2976fa28995bfb6ad00e3eac59ad689dd7892450/src/main/php/WebSession.php#L243-L258 | train |
stubbles/stubbles-dbal | src/main/php/Databases.php | Databases.get | public function get(string $name = null): Database
{
return new Database($this->connections->get($name));
} | php | public function get(string $name = null): Database
{
return new Database($this->connections->get($name));
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"name",
"=",
"null",
")",
":",
"Database",
"{",
"return",
"new",
"Database",
"(",
"$",
"this",
"->",
"connections",
"->",
"get",
"(",
"$",
"name",
")",
")",
";",
"}"
] | returns the database
If a name is provided and a connection with this name exists this
connection will be used. If fallback is enabled and the named
connection does not exist the default connection will be used, if
fallback is disabled a DatabaseException will be thrown.
If no name is provided the default connection ... | [
"returns",
"the",
"database"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/Databases.php#L51-L54 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.