id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
197,700 | cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/CollectionPersister.php | CollectionPersister.getQueryPathAndParent | public function getQueryPathAndParent(PersistentCollectionInterface $coll, QueryBuilder $qb = null)
{
$collMapping = $coll->getMapping();
$parent = $coll->getOwner();
$paths[] = [$collMapping->name, null];
while (($association = $this->uow->getParentAssociation($parent)) !=... | php | public function getQueryPathAndParent(PersistentCollectionInterface $coll, QueryBuilder $qb = null)
{
$collMapping = $coll->getMapping();
$parent = $coll->getOwner();
$paths[] = [$collMapping->name, null];
while (($association = $this->uow->getParentAssociation($parent)) !=... | [
"public",
"function",
"getQueryPathAndParent",
"(",
"PersistentCollectionInterface",
"$",
"coll",
",",
"QueryBuilder",
"$",
"qb",
"=",
"null",
")",
"{",
"$",
"collMapping",
"=",
"$",
"coll",
"->",
"getMapping",
"(",
")",
";",
"$",
"parent",
"=",
"$",
"coll",... | Create and return a QueryBuilder and Path instance representing the provided
collection's document path, along with the top-level document.
@param PersistentCollectionInterface $coll
@param QueryBuilder|null $qb
@return mixed[] list($qb, $path, $parent) | [
"Create",
"and",
"return",
"a",
"QueryBuilder",
"and",
"Path",
"instance",
"representing",
"the",
"provided",
"collection",
"s",
"document",
"path",
"along",
"with",
"the",
"top",
"-",
"level",
"document",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/CollectionPersister.php#L176-L215 |
197,701 | iqg/UtilsBundle | Utils/StringUtil.php | StringUtil.randomStr | public function randomStr( $length = 16 )
{
$arr = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z'));
$str = '';
$arr_len = count($arr);
for ($i = 0; $i < $length; $i++)
{
$rand = mt_rand(0, $arr_len-1);
$str.=$arr[$rand];
}
... | php | public function randomStr( $length = 16 )
{
$arr = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z'));
$str = '';
$arr_len = count($arr);
for ($i = 0; $i < $length; $i++)
{
$rand = mt_rand(0, $arr_len-1);
$str.=$arr[$rand];
}
... | [
"public",
"function",
"randomStr",
"(",
"$",
"length",
"=",
"16",
")",
"{",
"$",
"arr",
"=",
"array_merge",
"(",
"range",
"(",
"0",
",",
"9",
")",
",",
"range",
"(",
"'a'",
",",
"'z'",
")",
",",
"range",
"(",
"'A'",
",",
"'Z'",
")",
")",
";",
... | generate a random string include uppercase and lowercase letters and numbers | [
"generate",
"a",
"random",
"string",
"include",
"uppercase",
"and",
"lowercase",
"letters",
"and",
"numbers"
] | ef1ed67fc5dc8605d9828f8ecba0e4645faf8bc8 | https://github.com/iqg/UtilsBundle/blob/ef1ed67fc5dc8605d9828f8ecba0e4645faf8bc8/Utils/StringUtil.php#L78-L91 |
197,702 | stubbles/stubbles-dbal | src/main/php/config/ArrayBasedDatabaseConfigurations.php | ArrayBasedDatabaseConfigurations.get | public function get(string $id): DatabaseConfiguration
{
if (isset($this->configurations[$id])) {
return $this->configurations[$id];
}
throw new \OutOfBoundsException(
'No database configuration known for database requested with id '
. $id
... | php | public function get(string $id): DatabaseConfiguration
{
if (isset($this->configurations[$id])) {
return $this->configurations[$id];
}
throw new \OutOfBoundsException(
'No database configuration known for database requested with id '
. $id
... | [
"public",
"function",
"get",
"(",
"string",
"$",
"id",
")",
":",
"DatabaseConfiguration",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"configurations",
"[",
"$",
"id",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"configurations",
"[",
"$",
... | returns database configuration for given id
@param string $id id of configuration to return
@return \stubbles\db\config\DatabaseConfiguration
@throws \OutOfBoundsException in case no config for given id exists | [
"returns",
"database",
"configuration",
"for",
"given",
"id"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/config/ArrayBasedDatabaseConfigurations.php#L54-L64 |
197,703 | Zazalt/Databaser | src/Engine/PostgreSQL.php | PostgreSQL.getTables | public function getTables()
{
$statement = $this->connection->prepare("SELECT * FROM information_schema.tables WHERE table_catalog = :database AND table_schema = 'public'");
$statement->execute([
':database' => $this->Databaser->database
]);
return $statement->fetchAll(\... | php | public function getTables()
{
$statement = $this->connection->prepare("SELECT * FROM information_schema.tables WHERE table_catalog = :database AND table_schema = 'public'");
$statement->execute([
':database' => $this->Databaser->database
]);
return $statement->fetchAll(\... | [
"public",
"function",
"getTables",
"(",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
"\"SELECT * FROM information_schema.tables WHERE table_catalog = :database AND table_schema = 'public'\"",
")",
";",
"$",
"statement",
"->",
"ex... | Get all tables for a database | [
"Get",
"all",
"tables",
"for",
"a",
"database"
] | 245eccd6ee960435b1c7fa5031d8f3db4ef557f2 | https://github.com/Zazalt/Databaser/blob/245eccd6ee960435b1c7fa5031d8f3db4ef557f2/src/Engine/PostgreSQL.php#L69-L77 |
197,704 | Zazalt/Databaser | src/Engine/PostgreSQL.php | PostgreSQL.getTableRows | public function getTableRows(string $tableName)
{
$statement = $this->connection->prepare("SELECT * FROM information_schema.columns WHERE table_catalog = :database AND table_name = :table");
$statement->execute([
':database' => $this->Databaser->database,
':table' => $tabl... | php | public function getTableRows(string $tableName)
{
$statement = $this->connection->prepare("SELECT * FROM information_schema.columns WHERE table_catalog = :database AND table_name = :table");
$statement->execute([
':database' => $this->Databaser->database,
':table' => $tabl... | [
"public",
"function",
"getTableRows",
"(",
"string",
"$",
"tableName",
")",
"{",
"$",
"statement",
"=",
"$",
"this",
"->",
"connection",
"->",
"prepare",
"(",
"\"SELECT * FROM information_schema.columns WHERE table_catalog = :database AND table_name = :table\"",
")",
";",
... | Get all rows for all tables | [
"Get",
"all",
"rows",
"for",
"all",
"tables"
] | 245eccd6ee960435b1c7fa5031d8f3db4ef557f2 | https://github.com/Zazalt/Databaser/blob/245eccd6ee960435b1c7fa5031d8f3db4ef557f2/src/Engine/PostgreSQL.php#L82-L91 |
197,705 | Erebot/CallableWrapper | src/CallableWrapper.php | CallableWrapper.wrap | public static function wrap($callable)
{
$parts = explode('::', static::represent($callable));
if (count($parts) == 1) {
// We wrapped a function.
$reflector = new \ReflectionFunction($callable);
} else {
if (!is_array($callable)) {
... | php | public static function wrap($callable)
{
$parts = explode('::', static::represent($callable));
if (count($parts) == 1) {
// We wrapped a function.
$reflector = new \ReflectionFunction($callable);
} else {
if (!is_array($callable)) {
... | [
"public",
"static",
"function",
"wrap",
"(",
"$",
"callable",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'::'",
",",
"static",
"::",
"represent",
"(",
"$",
"callable",
")",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"==",
"1",
")",
... | Wraps an existing callable piece of code.
\param mixed $callable
Callable piece of code to wrap.
\retval Erebot::CallableInterface
An object of a class implementing the
Erebot::CallableInterface is returned.
The precise type of the object will usually vary
between calls as new types are created on-the-fly
if needed. | [
"Wraps",
"an",
"existing",
"callable",
"piece",
"of",
"code",
"."
] | 28b427e7471d21ed60d9feee3886ff3b43b78d33 | https://github.com/Erebot/CallableWrapper/blob/28b427e7471d21ed60d9feee3886ff3b43b78d33/src/CallableWrapper.php#L90-L157 |
197,706 | Erebot/CallableWrapper | src/CallableWrapper.php | CallableWrapper.initialize | public static function initialize()
{
static $initialized = false;
static $structures = array();
if (defined('T_CALLABLE')) {
return;
}
if (!$initialized) {
spl_autoload_register(
function ($class) {
$parts = arr... | php | public static function initialize()
{
static $initialized = false;
static $structures = array();
if (defined('T_CALLABLE')) {
return;
}
if (!$initialized) {
spl_autoload_register(
function ($class) {
$parts = arr... | [
"public",
"static",
"function",
"initialize",
"(",
")",
"{",
"static",
"$",
"initialized",
"=",
"false",
";",
"static",
"$",
"structures",
"=",
"array",
"(",
")",
";",
"if",
"(",
"defined",
"(",
"'T_CALLABLE'",
")",
")",
"{",
"return",
";",
"}",
"if",
... | Initialize the wrapper.
\param bool $existing
(optional) Whether to inject the wrapper inside existing
namespaces. You don't need to pass this argument: the wrapper
already does so internally when needed.
\note
This method must be called before using any of the wrapper's
other methods. It registers an autoloader that... | [
"Initialize",
"the",
"wrapper",
"."
] | 28b427e7471d21ed60d9feee3886ff3b43b78d33 | https://github.com/Erebot/CallableWrapper/blob/28b427e7471d21ed60d9feee3886ff3b43b78d33/src/CallableWrapper.php#L180-L235 |
197,707 | zeageorge/php-object | src/Object/Event.php | Event.subscribe | public function subscribe($handler, $priority = Event::DEFAULT_CALLBACKS_PRIORITY)
{
$_priority = \is_int($priority) ? $priority : self::DEFAULT_CALLBACKS_PRIORITY;
if (!($_priority >= self::DEFAULT_CALLBACKS_MAX_PRIORITY && $_priority <= self::DEFAULT_CALLBACKS_MIN_PRIORITY)) {
$_pr... | php | public function subscribe($handler, $priority = Event::DEFAULT_CALLBACKS_PRIORITY)
{
$_priority = \is_int($priority) ? $priority : self::DEFAULT_CALLBACKS_PRIORITY;
if (!($_priority >= self::DEFAULT_CALLBACKS_MAX_PRIORITY && $_priority <= self::DEFAULT_CALLBACKS_MIN_PRIORITY)) {
$_pr... | [
"public",
"function",
"subscribe",
"(",
"$",
"handler",
",",
"$",
"priority",
"=",
"Event",
"::",
"DEFAULT_CALLBACKS_PRIORITY",
")",
"{",
"$",
"_priority",
"=",
"\\",
"is_int",
"(",
"$",
"priority",
")",
"?",
"$",
"priority",
":",
"self",
"::",
"DEFAULT_CA... | Subscribe to this event.
The event handler must be a valid PHP callback. The following are
some examples:
~~~
function ($event) { ... } // anonymous function
[$object, 'handleClick'] // $object->handleClick()
['Page', 'handleClick'] // Page::handleClick()
'handleClick' // global function handleClick()
... | [
"Subscribe",
"to",
"this",
"event",
"."
] | 760bffd226c67ea3b9d898f0c6d76fb209ade72f | https://github.com/zeageorge/php-object/blob/760bffd226c67ea3b9d898f0c6d76fb209ade72f/src/Object/Event.php#L145-L181 |
197,708 | Weblab-nl/curl | src/Request.php | Request.setPostFields | public function setPostFields($value) {
if (is_array($value)) {
return $this->setOption(CURLOPT_POSTFIELDS, http_build_query($value));
} else {
return $this->setOption(CURLOPT_POSTFIELDS, $value);
}
} | php | public function setPostFields($value) {
if (is_array($value)) {
return $this->setOption(CURLOPT_POSTFIELDS, http_build_query($value));
} else {
return $this->setOption(CURLOPT_POSTFIELDS, $value);
}
} | [
"public",
"function",
"setPostFields",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"setOption",
"(",
"CURLOPT_POSTFIELDS",
",",
"http_build_query",
"(",
"$",
"value",
")",
")",
";",
... | Set post fields
@param array|string $value Array should be in key => value format. String === json
@return Request | [
"Set",
"post",
"fields"
] | e2879ab970e0d8161d5a49b46805bc36a8ba94a9 | https://github.com/Weblab-nl/curl/blob/e2879ab970e0d8161d5a49b46805bc36a8ba94a9/src/Request.php#L78-L84 |
197,709 | Weblab-nl/curl | src/Request.php | Request.doesFileExist | public function doesFileExist($url) {
// Setup connection
$ch = curl_init($url);
// We don't want to download the file, we just want to know if the file exists
curl_setopt($ch, CURLOPT_NOBODY, true);
// Execute cURL
curl_exec($ch);
// Get the HTTP status code
... | php | public function doesFileExist($url) {
// Setup connection
$ch = curl_init($url);
// We don't want to download the file, we just want to know if the file exists
curl_setopt($ch, CURLOPT_NOBODY, true);
// Execute cURL
curl_exec($ch);
// Get the HTTP status code
... | [
"public",
"function",
"doesFileExist",
"(",
"$",
"url",
")",
"{",
"// Setup connection",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"url",
")",
";",
"// We don't want to download the file, we just want to know if the file exists",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURL... | Checks if a file exists
@return bool | [
"Checks",
"if",
"a",
"file",
"exists"
] | e2879ab970e0d8161d5a49b46805bc36a8ba94a9 | https://github.com/Weblab-nl/curl/blob/e2879ab970e0d8161d5a49b46805bc36a8ba94a9/src/Request.php#L273-L291 |
197,710 | Weblab-nl/curl | src/Request.php | Request.getStatus | public function getStatus(string $url) {
// Setup connection
$resource = curl_init($url);
// Setup cURL options
curl_setopt($resource, CURLOPT_NOBODY, true);
curl_setopt($resource, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($resource,CURLOPT_HEADER,true);
curl_seto... | php | public function getStatus(string $url) {
// Setup connection
$resource = curl_init($url);
// Setup cURL options
curl_setopt($resource, CURLOPT_NOBODY, true);
curl_setopt($resource, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($resource,CURLOPT_HEADER,true);
curl_seto... | [
"public",
"function",
"getStatus",
"(",
"string",
"$",
"url",
")",
"{",
"// Setup connection",
"$",
"resource",
"=",
"curl_init",
"(",
"$",
"url",
")",
";",
"// Setup cURL options",
"curl_setopt",
"(",
"$",
"resource",
",",
"CURLOPT_NOBODY",
",",
"true",
")",
... | Get the response code of a url
@return bool | [
"Get",
"the",
"response",
"code",
"of",
"a",
"url"
] | e2879ab970e0d8161d5a49b46805bc36a8ba94a9 | https://github.com/Weblab-nl/curl/blob/e2879ab970e0d8161d5a49b46805bc36a8ba94a9/src/Request.php#L298-L327 |
197,711 | Weblab-nl/curl | src/Request.php | Request.run | public function run() {
// Setup connection
$resource = curl_init();
// Set cURL options
foreach ($this->settings as $option => $setting) {
curl_setopt($resource, $option, $setting);
}
// Process headers
$headers = [];
foreach ($this->headers... | php | public function run() {
// Setup connection
$resource = curl_init();
// Set cURL options
foreach ($this->settings as $option => $setting) {
curl_setopt($resource, $option, $setting);
}
// Process headers
$headers = [];
foreach ($this->headers... | [
"public",
"function",
"run",
"(",
")",
"{",
"// Setup connection",
"$",
"resource",
"=",
"curl_init",
"(",
")",
";",
"// Set cURL options",
"foreach",
"(",
"$",
"this",
"->",
"settings",
"as",
"$",
"option",
"=>",
"$",
"setting",
")",
"{",
"curl_setopt",
"... | Actually executes the cURL request
@return Result | [
"Actually",
"executes",
"the",
"cURL",
"request"
] | e2879ab970e0d8161d5a49b46805bc36a8ba94a9 | https://github.com/Weblab-nl/curl/blob/e2879ab970e0d8161d5a49b46805bc36a8ba94a9/src/Request.php#L334-L379 |
197,712 | werx/core | src/Database.php | Database.init | public static function init($config = null)
{
$defaults = [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'mysql',
'username' => 'root',
'password' => null,
'log_queries' => true,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' ... | php | public static function init($config = null)
{
$defaults = [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'mysql',
'username' => 'root',
'password' => null,
'log_queries' => true,
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' ... | [
"public",
"static",
"function",
"init",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"$",
"defaults",
"=",
"[",
"'driver'",
"=>",
"'mysql'",
",",
"'host'",
"=>",
"'localhost'",
",",
"'database'",
"=>",
"'mysql'",
",",
"'username'",
"=>",
"'root'",
",",
"'p... | Initialize the connection to the database.
@param null $config | [
"Initialize",
"the",
"connection",
"to",
"the",
"database",
"."
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Database.php#L18-L77 |
197,713 | werx/core | src/Database.php | Database.parseDsn | public static function parseDsn($string = null)
{
$opts = null;
if (!empty($string)) {
$dsn = new DSN($string);
$port = empty($dsn->getFirstPort()) ? '' : (':' . $dsn->getFirstPort());
$password = empty($dsn->getPassword()) ? null : $dsn->getPassword();
$opts = [
'driver' => $dsn->getProtocol(),... | php | public static function parseDsn($string = null)
{
$opts = null;
if (!empty($string)) {
$dsn = new DSN($string);
$port = empty($dsn->getFirstPort()) ? '' : (':' . $dsn->getFirstPort());
$password = empty($dsn->getPassword()) ? null : $dsn->getPassword();
$opts = [
'driver' => $dsn->getProtocol(),... | [
"public",
"static",
"function",
"parseDsn",
"(",
"$",
"string",
"=",
"null",
")",
"{",
"$",
"opts",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"string",
")",
")",
"{",
"$",
"dsn",
"=",
"new",
"DSN",
"(",
"$",
"string",
")",
";",
"$",
... | Take a string DSN and parse it into an array of its pieces
@param null $string
@return array|null | [
"Take",
"a",
"string",
"DSN",
"and",
"parse",
"it",
"into",
"an",
"array",
"of",
"its",
"pieces"
] | 9ab7a9f7a8c02e1d41ca40301afada8129ea0a79 | https://github.com/werx/core/blob/9ab7a9f7a8c02e1d41ca40301afada8129ea0a79/src/Database.php#L100-L120 |
197,714 | wb-crowdfusion/crowdfusion | system/core/classes/nodedb/events/AbstractBulkCountsHandler.php | AbstractBulkCountsHandler.commit | public function commit() {
if(empty($this->NodeCounts)) {
$this->Logger->debug(__FUNCTION__ .'-> No nodes to change counts on.');
return;
}
foreach($this->NodeCounts as $nodeRefUrl => $count) {
$nodeRef = $this->NodeRefService->parseFromString($nodeRefUrl);
... | php | public function commit() {
if(empty($this->NodeCounts)) {
$this->Logger->debug(__FUNCTION__ .'-> No nodes to change counts on.');
return;
}
foreach($this->NodeCounts as $nodeRefUrl => $count) {
$nodeRef = $this->NodeRefService->parseFromString($nodeRefUrl);
... | [
"public",
"function",
"commit",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"NodeCounts",
")",
")",
"{",
"$",
"this",
"->",
"Logger",
"->",
"debug",
"(",
"__FUNCTION__",
".",
"'-> No nodes to change counts on.'",
")",
";",
"return",
";",
"... | Update all meta on nodes queued
@return void | [
"Update",
"all",
"meta",
"on",
"nodes",
"queued"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/events/AbstractBulkCountsHandler.php#L34-L53 |
197,715 | wb-crowdfusion/crowdfusion | system/core/classes/nodedb/events/AbstractBulkCountsHandler.php | AbstractBulkCountsHandler.increment | public function increment(NodeRef $nodeRef, NodeRef $extNodeRef, $tag)
{
$nodeRefUrl = $nodeRef->getRefURL();
if(!isset($this->NodeCounts[$nodeRefUrl]))
$this->NodeCounts[$nodeRefUrl] = 0;
$this->NodeCounts[$nodeRefUrl]++;
$this->Logger->debug(__FUNCTION__ ."-> Incremen... | php | public function increment(NodeRef $nodeRef, NodeRef $extNodeRef, $tag)
{
$nodeRefUrl = $nodeRef->getRefURL();
if(!isset($this->NodeCounts[$nodeRefUrl]))
$this->NodeCounts[$nodeRefUrl] = 0;
$this->NodeCounts[$nodeRefUrl]++;
$this->Logger->debug(__FUNCTION__ ."-> Incremen... | [
"public",
"function",
"increment",
"(",
"NodeRef",
"$",
"nodeRef",
",",
"NodeRef",
"$",
"extNodeRef",
",",
"$",
"tag",
")",
"{",
"$",
"nodeRefUrl",
"=",
"$",
"nodeRef",
"->",
"getRefURL",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->"... | Queue a node to have its meta incremented
@param NodeRef $nodeRef
@param NodeRef $extNodeRef
@param $tag | [
"Queue",
"a",
"node",
"to",
"have",
"its",
"meta",
"incremented"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/nodedb/events/AbstractBulkCountsHandler.php#L62-L71 |
197,716 | arrounded/core | src/Composers/AbstractComposer.php | AbstractComposer.getWebpackAssets | protected function getWebpackAssets()
{
$assets = public_path('builds/manifest.json');
$assets = file_get_contents($assets);
$assets = json_decode($assets, true);
return $assets;
} | php | protected function getWebpackAssets()
{
$assets = public_path('builds/manifest.json');
$assets = file_get_contents($assets);
$assets = json_decode($assets, true);
return $assets;
} | [
"protected",
"function",
"getWebpackAssets",
"(",
")",
"{",
"$",
"assets",
"=",
"public_path",
"(",
"'builds/manifest.json'",
")",
";",
"$",
"assets",
"=",
"file_get_contents",
"(",
"$",
"assets",
")",
";",
"$",
"assets",
"=",
"json_decode",
"(",
"$",
"asset... | Get the manifest of assets compiled by Webpack.
@return array | [
"Get",
"the",
"manifest",
"of",
"assets",
"compiled",
"by",
"Webpack",
"."
] | 9573d9ae63f5173bdfd51077ce065e9e8c176ac4 | https://github.com/arrounded/core/blob/9573d9ae63f5173bdfd51077ce065e9e8c176ac4/src/Composers/AbstractComposer.php#L28-L35 |
197,717 | arrounded/core | src/Composers/AbstractComposer.php | AbstractComposer.makeMenu | protected function makeMenu($menu)
{
$links = [];
foreach ($menu as $key => $item) {
// Rebuild from associative array
if (is_string($item)) {
$item = [$key, $item];
}
list($endpoint, $label) = $item;
$attributes = array_ge... | php | protected function makeMenu($menu)
{
$links = [];
foreach ($menu as $key => $item) {
// Rebuild from associative array
if (is_string($item)) {
$item = [$key, $item];
}
list($endpoint, $label) = $item;
$attributes = array_ge... | [
"protected",
"function",
"makeMenu",
"(",
"$",
"menu",
")",
"{",
"$",
"links",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"menu",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"// Rebuild from associative array",
"if",
"(",
"is_string",
"(",
"$",
"item"... | Make a menu from a list of links.
@param array $menu
@return array | [
"Make",
"a",
"menu",
"from",
"a",
"list",
"of",
"links",
"."
] | 9573d9ae63f5173bdfd51077ce065e9e8c176ac4 | https://github.com/arrounded/core/blob/9573d9ae63f5173bdfd51077ce065e9e8c176ac4/src/Composers/AbstractComposer.php#L44-L78 |
197,718 | arrounded/core | src/Composers/AbstractComposer.php | AbstractComposer.isOnPage | protected function isOnPage($page, $loose = true)
{
$page = $loose ? $page : '^'.$page.'$';
$page = str_replace('#', '\#', $page);
return (bool) preg_match('#'.$page.'#', $this->request->path());
} | php | protected function isOnPage($page, $loose = true)
{
$page = $loose ? $page : '^'.$page.'$';
$page = str_replace('#', '\#', $page);
return (bool) preg_match('#'.$page.'#', $this->request->path());
} | [
"protected",
"function",
"isOnPage",
"(",
"$",
"page",
",",
"$",
"loose",
"=",
"true",
")",
"{",
"$",
"page",
"=",
"$",
"loose",
"?",
"$",
"page",
":",
"'^'",
".",
"$",
"page",
".",
"'$'",
";",
"$",
"page",
"=",
"str_replace",
"(",
"'#'",
",",
... | Check if a string matches the given url.
@param string $page
@param bool $loose
@return bool | [
"Check",
"if",
"a",
"string",
"matches",
"the",
"given",
"url",
"."
] | 9573d9ae63f5173bdfd51077ce065e9e8c176ac4 | https://github.com/arrounded/core/blob/9573d9ae63f5173bdfd51077ce065e9e8c176ac4/src/Composers/AbstractComposer.php#L88-L94 |
197,719 | arrounded/core | src/Composers/AbstractComposer.php | AbstractComposer.translate | protected function translate($string)
{
$translated = $this->app['translator']->get($string);
return is_string($translated) ? $translated : $string;
} | php | protected function translate($string)
{
$translated = $this->app['translator']->get($string);
return is_string($translated) ? $translated : $string;
} | [
"protected",
"function",
"translate",
"(",
"$",
"string",
")",
"{",
"$",
"translated",
"=",
"$",
"this",
"->",
"app",
"[",
"'translator'",
"]",
"->",
"get",
"(",
"$",
"string",
")",
";",
"return",
"is_string",
"(",
"$",
"translated",
")",
"?",
"$",
"... | Act on a string to translate it.
@param string $string
@return string | [
"Act",
"on",
"a",
"string",
"to",
"translate",
"it",
"."
] | 9573d9ae63f5173bdfd51077ce065e9e8c176ac4 | https://github.com/arrounded/core/blob/9573d9ae63f5173bdfd51077ce065e9e8c176ac4/src/Composers/AbstractComposer.php#L103-L108 |
197,720 | squareproton/Bond | src/Bond/Container/FindFilterComponentMulti.php | FindFilterComponentMulti.check | public function check( $obj )
{
foreach( $this->findFilterComponents as $findFilterComponent ) {
if( $findFilterComponent->check($obj) ) {
return true;
}
}
return false;
} | php | public function check( $obj )
{
foreach( $this->findFilterComponents as $findFilterComponent ) {
if( $findFilterComponent->check($obj) ) {
return true;
}
}
return false;
} | [
"public",
"function",
"check",
"(",
"$",
"obj",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"findFilterComponents",
"as",
"$",
"findFilterComponent",
")",
"{",
"if",
"(",
"$",
"findFilterComponent",
"->",
"check",
"(",
"$",
"obj",
")",
")",
"{",
"return... | Pass a entity through a filter. Does it match?
@param mixed $object we're going to filter on
@return bool | [
"Pass",
"a",
"entity",
"through",
"a",
"filter",
".",
"Does",
"it",
"match?"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container/FindFilterComponentMulti.php#L56-L64 |
197,721 | gplcart/cli | controllers/commands/Cache.php | Cache.cmdGetCache | public function cmdGetCache()
{
$id = $this->getParam(0);
if (empty($id)) {
$this->errorAndExit($this->text('Invalid command'));
}
$result = $this->cache->get($id);
if (!isset($result)) {
$this->errorAndExit($this->text('Unexpected result'));
... | php | public function cmdGetCache()
{
$id = $this->getParam(0);
if (empty($id)) {
$this->errorAndExit($this->text('Invalid command'));
}
$result = $this->cache->get($id);
if (!isset($result)) {
$this->errorAndExit($this->text('Unexpected result'));
... | [
"public",
"function",
"cmdGetCache",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"errorAndExit",
"(",
"$",
"this",
"->",
"text",
"(",
"'... | Callback for "cache-get" command | [
"Callback",
"for",
"cache",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cache.php#L40-L56 |
197,722 | gplcart/cli | controllers/commands/Cache.php | Cache.cmdClearCache | public function cmdClearCache()
{
$id = $this->getParam(0);
$all = $this->getParam('all');
if (!isset($id) && empty($all)) {
$this->errorAndExit($this->text('Invalid command'));
}
$result = false;
if (isset($id)) {
$pattern = $this->getParam... | php | public function cmdClearCache()
{
$id = $this->getParam(0);
$all = $this->getParam('all');
if (!isset($id) && empty($all)) {
$this->errorAndExit($this->text('Invalid command'));
}
$result = false;
if (isset($id)) {
$pattern = $this->getParam... | [
"public",
"function",
"cmdClearCache",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"$",
"all",
"=",
"$",
"this",
"->",
"getParam",
"(",
"'all'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"id",
")",
"&&",... | Callback for "cache-clear" command | [
"Callback",
"for",
"cache",
"-",
"clear",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Cache.php#L61-L88 |
197,723 | synaq/SynaqCurlBundle | Curl/Wrapper.php | Wrapper.setRequestOptions | private function setRequestOptions($url, $vars, $options = array())
{
curl_setopt($this->request, CURLOPT_URL, $url);
if (!empty($vars)) {
curl_setopt($this->request, CURLOPT_POSTFIELDS, $vars);
}
# Set some default CURL options
curl_setopt($this->request, CURLOP... | php | private function setRequestOptions($url, $vars, $options = array())
{
curl_setopt($this->request, CURLOPT_URL, $url);
if (!empty($vars)) {
curl_setopt($this->request, CURLOPT_POSTFIELDS, $vars);
}
# Set some default CURL options
curl_setopt($this->request, CURLOP... | [
"private",
"function",
"setRequestOptions",
"(",
"$",
"url",
",",
"$",
"vars",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"curl_setopt",
"(",
"$",
"this",
"->",
"request",
",",
"CURLOPT_URL",
",",
"$",
"url",
")",
";",
"if",
"(",
"!",
"... | Sets the CURLOPT options for the current request
@param string $url
@param string $vars
@return void
@access protected | [
"Sets",
"the",
"CURLOPT",
"options",
"for",
"the",
"current",
"request"
] | 3bfb4ef7693ea621c31b9a32565a23c7d99f8a14 | https://github.com/synaq/SynaqCurlBundle/blob/3bfb4ef7693ea621c31b9a32565a23c7d99f8a14/Curl/Wrapper.php#L316-L343 |
197,724 | synaq/SynaqCurlBundle | Curl/Wrapper.php | Wrapper.setRequestHeaders | private function setRequestHeaders($headers = array()) {
foreach ($this->headers as $key => $value) {
$headers[] = $key . ': ' . $value;
}
curl_setopt($this->request, CURLOPT_HTTPHEADER, $headers);
} | php | private function setRequestHeaders($headers = array()) {
foreach ($this->headers as $key => $value) {
$headers[] = $key . ': ' . $value;
}
curl_setopt($this->request, CURLOPT_HTTPHEADER, $headers);
} | [
"private",
"function",
"setRequestHeaders",
"(",
"$",
"headers",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"headers",
"[",
"]",
"=",
"$",
"key",
".",
"': '",... | Formats and adds custom headers to the current request
@param array $headers
@return void
@access protected | [
"Formats",
"and",
"adds",
"custom",
"headers",
"to",
"the",
"current",
"request"
] | 3bfb4ef7693ea621c31b9a32565a23c7d99f8a14 | https://github.com/synaq/SynaqCurlBundle/blob/3bfb4ef7693ea621c31b9a32565a23c7d99f8a14/Curl/Wrapper.php#L352-L357 |
197,725 | story75/Bonefish-Router | src/FastRoute.php | FastRoute.addRoutes | public function addRoutes(array $routes = [])
{
foreach($routes as $route)
{
if ($route instanceof RouteInterface) $this->routes[] = $route;
}
} | php | public function addRoutes(array $routes = [])
{
foreach($routes as $route)
{
if ($route instanceof RouteInterface) $this->routes[] = $route;
}
} | [
"public",
"function",
"addRoutes",
"(",
"array",
"$",
"routes",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"route",
"instanceof",
"RouteInterface",
")",
"$",
"this",
"->",
"routes",
"[",
"]",... | Add all routes which are available
@param RouteInterface[] $routes
@return void | [
"Add",
"all",
"routes",
"which",
"are",
"available"
] | bb16960c9442303ceeb0c9d14b14be62018de05d | https://github.com/story75/Bonefish-Router/blob/bb16960c9442303ceeb0c9d14b14be62018de05d/src/FastRoute.php#L69-L75 |
197,726 | story75/Bonefish-Router | src/FastRoute.php | FastRoute.dispatch | public function dispatch(Request $request)
{
if (ltrim($_SERVER['REQUEST_URI'], '/') === '') {
return new DispatcherResult(200, $this->defaultHandler);
}
$dispatcher = $this->getDispatcher();
$match = $dispatcher->dispatch($request->getMethod(), $_SERVER['REQUEST_URI'])... | php | public function dispatch(Request $request)
{
if (ltrim($_SERVER['REQUEST_URI'], '/') === '') {
return new DispatcherResult(200, $this->defaultHandler);
}
$dispatcher = $this->getDispatcher();
$match = $dispatcher->dispatch($request->getMethod(), $_SERVER['REQUEST_URI'])... | [
"public",
"function",
"dispatch",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"ltrim",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
",",
"'/'",
")",
"===",
"''",
")",
"{",
"return",
"new",
"DispatcherResult",
"(",
"200",
",",
"$",
"this",
... | Once called the router should examine the current request by request method and url
and find a matching route. If no route was find dispatch a http error instead.
Dispatch means in this context that the router will use the RouteCallbackDTO in the Route
and call the controller with the correct action and pass the param... | [
"Once",
"called",
"the",
"router",
"should",
"examine",
"the",
"current",
"request",
"by",
"request",
"method",
"and",
"url",
"and",
"find",
"a",
"matching",
"route",
".",
"If",
"no",
"route",
"was",
"find",
"dispatch",
"a",
"http",
"error",
"instead",
"."... | bb16960c9442303ceeb0c9d14b14be62018de05d | https://github.com/story75/Bonefish-Router/blob/bb16960c9442303ceeb0c9d14b14be62018de05d/src/FastRoute.php#L110-L146 |
197,727 | netlogix/Netlogix.Crud | Classes/Netlogix/Crud/Utility/ArrayUtility.php | ArrayUtility.flatten | static public function flatten(array $array, $prefix = '', $keepEmptyArrayNode = TRUE, $segmentationCharacter = self::SEGMENTATION_CHARACTER) {
$flatArray = array();
foreach ($array as $key => $value) {
// Ensure there is no trailling dot:
$key = rtrim($key, $segmentationCharacter);
if (!is_array($value) |... | php | static public function flatten(array $array, $prefix = '', $keepEmptyArrayNode = TRUE, $segmentationCharacter = self::SEGMENTATION_CHARACTER) {
$flatArray = array();
foreach ($array as $key => $value) {
// Ensure there is no trailling dot:
$key = rtrim($key, $segmentationCharacter);
if (!is_array($value) |... | [
"static",
"public",
"function",
"flatten",
"(",
"array",
"$",
"array",
",",
"$",
"prefix",
"=",
"''",
",",
"$",
"keepEmptyArrayNode",
"=",
"TRUE",
",",
"$",
"segmentationCharacter",
"=",
"self",
"::",
"SEGMENTATION_CHARACTER",
")",
"{",
"$",
"flatArray",
"="... | Converts a multidimensional array to a flat representation.
See unit tests for more details
Example:
- array:
array(
'first.' => array(
'second' => 1
)
)
- result:
array(
'first.second' => 1
)
Example:
- array:
array(
'first' => array(
'second' => 1
)
)
- result:
array(
'first.second' => 1
)
@param array $array The... | [
"Converts",
"a",
"multidimensional",
"array",
"to",
"a",
"flat",
"representation",
"."
] | 61438827ba6b0a7a63cd2f08a294967ed5928144 | https://github.com/netlogix/Netlogix.Crud/blob/61438827ba6b0a7a63cd2f08a294967ed5928144/Classes/Netlogix/Crud/Utility/ArrayUtility.php#L61-L73 |
197,728 | Saritasa/php-eloquent-custom | src/Entity.php | Entity.getAttributeValue | public function getAttributeValue($key)
{
$value = $this->getAttributeFromArray($key);
// check if it's a enum
if (isset($this->enums[$key]) && is_scalar($value)) {
$enumClass = $this->enums[$key];
return new $enumClass($value);
}
return parent::getAtt... | php | public function getAttributeValue($key)
{
$value = $this->getAttributeFromArray($key);
// check if it's a enum
if (isset($this->enums[$key]) && is_scalar($value)) {
$enumClass = $this->enums[$key];
return new $enumClass($value);
}
return parent::getAtt... | [
"public",
"function",
"getAttributeValue",
"(",
"$",
"key",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getAttributeFromArray",
"(",
"$",
"key",
")",
";",
"// check if it's a enum",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"enums",
"[",
"$",
"key... | Gets the value of attribute,
taking enums typecast into consideration
@param string $key Name of attribute
@return mixed | [
"Gets",
"the",
"value",
"of",
"attribute",
"taking",
"enums",
"typecast",
"into",
"consideration"
] | 54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a | https://github.com/Saritasa/php-eloquent-custom/blob/54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a/src/Entity.php#L41-L50 |
197,729 | Saritasa/php-eloquent-custom | src/Entity.php | Entity.setAttribute | public function setAttribute($key, $value)
{
// check if it's a enum
if (isset($this->enums[$key]) && is_scalar($value)) {
$enumClass = $this->enums[$key];
$this->attributes[$key] = new $enumClass($value);
} else {
parent::setAttribute($key, $value);
... | php | public function setAttribute($key, $value)
{
// check if it's a enum
if (isset($this->enums[$key]) && is_scalar($value)) {
$enumClass = $this->enums[$key];
$this->attributes[$key] = new $enumClass($value);
} else {
parent::setAttribute($key, $value);
... | [
"public",
"function",
"setAttribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"// check if it's a enum",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"enums",
"[",
"$",
"key",
"]",
")",
"&&",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"$",
... | Sets the value of attribute,
taking enums typecast into consideration
@param string $key Name of the attribute
@param mixed $value Value of the attribute to set
@return $this | [
"Sets",
"the",
"value",
"of",
"attribute",
"taking",
"enums",
"typecast",
"into",
"consideration"
] | 54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a | https://github.com/Saritasa/php-eloquent-custom/blob/54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a/src/Entity.php#L60-L70 |
197,730 | Saritasa/php-eloquent-custom | src/Entity.php | Entity.getEnumValidationRule | protected static function getEnumValidationRule(string $enumClass) : array
{
if (!is_a($enumClass, Enum::class, true)) {
throw new \UnexpectedValueException('Class is not enum');
}
return array_merge(['in'], $enumClass::getConstants());
} | php | protected static function getEnumValidationRule(string $enumClass) : array
{
if (!is_a($enumClass, Enum::class, true)) {
throw new \UnexpectedValueException('Class is not enum');
}
return array_merge(['in'], $enumClass::getConstants());
} | [
"protected",
"static",
"function",
"getEnumValidationRule",
"(",
"string",
"$",
"enumClass",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"enumClass",
",",
"Enum",
"::",
"class",
",",
"true",
")",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedV... | Gets validation rule for given enum class
@deprecated Should use Rule::enum($enumClass)
@param string $enumClass Enum class name
@return array | [
"Gets",
"validation",
"rule",
"for",
"given",
"enum",
"class"
] | 54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a | https://github.com/Saritasa/php-eloquent-custom/blob/54a2479f1d6e9cddac14dd8e473ab6a99dc6a82a/src/Entity.php#L80-L87 |
197,731 | stubbles/stubbles-dbal | src/main/php/DatabaseConnections.php | DatabaseConnections.get | public function get(string $name = null): DatabaseConnection
{
if (null == $name) {
$name = DatabaseConfiguration::DEFAULT_ID;
}
if (isset($this->connections[$name])) {
return $this->connections[$name];
}
$this->connections[$name] = new PdoDatabaseCo... | php | public function get(string $name = null): DatabaseConnection
{
if (null == $name) {
$name = DatabaseConfiguration::DEFAULT_ID;
}
if (isset($this->connections[$name])) {
return $this->connections[$name];
}
$this->connections[$name] = new PdoDatabaseCo... | [
"public",
"function",
"get",
"(",
"string",
"$",
"name",
"=",
"null",
")",
":",
"DatabaseConnection",
"{",
"if",
"(",
"null",
"==",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"DatabaseConfiguration",
"::",
"DEFAULT_ID",
";",
"}",
"if",
"(",
"isset",
"(",... | returns the connection
If a name is provided and a connection with this name exists this
connection will be returned. If fallback is enabled and the named
connection does not exist the default connection will be returned, if
fallback is disabled a DatabaseException will be thrown.
If no name is provided the default c... | [
"returns",
"the",
"connection"
] | b42a589025a9e511b40a2798ac84df94d6451c36 | https://github.com/stubbles/stubbles-dbal/blob/b42a589025a9e511b40a2798ac84df94d6451c36/src/main/php/DatabaseConnections.php#L58-L72 |
197,732 | geniv/nette-identity-authorizator | src/Drivers/ArrayDriver.php | ArrayDriver.init | protected function init()
{
if ($this->policy != self::POLICY_NONE) {
// set role
foreach ($this->_role as $role) {
$this->role[$role] = ['id' => $role, 'role' => $role];
$this->permission->addRole($role);
}
// set resource
... | php | protected function init()
{
if ($this->policy != self::POLICY_NONE) {
// set role
foreach ($this->_role as $role) {
$this->role[$role] = ['id' => $role, 'role' => $role];
$this->permission->addRole($role);
}
// set resource
... | [
"protected",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"policy",
"!=",
"self",
"::",
"POLICY_NONE",
")",
"{",
"// set role",
"foreach",
"(",
"$",
"this",
"->",
"_role",
"as",
"$",
"role",
")",
"{",
"$",
"this",
"->",
"role",
... | Init data. | [
"Init",
"data",
"."
] | f7db1cd589d022b6443f24a59432098a343d4639 | https://github.com/geniv/nette-identity-authorizator/blob/f7db1cd589d022b6443f24a59432098a343d4639/src/Drivers/ArrayDriver.php#L44-L124 |
197,733 | PitonCMS/Session | src/SessionHandler.php | SessionHandler.setFlashData | public function setFlashData($newdata, $value = '')
{
if (is_string($newdata)) {
$newdata = [$newdata => $value];
}
if (!empty($newdata)) {
foreach ($newdata as $key => $val) {
$this->newFlashData[$key] = $val;
}
}
} | php | public function setFlashData($newdata, $value = '')
{
if (is_string($newdata)) {
$newdata = [$newdata => $value];
}
if (!empty($newdata)) {
foreach ($newdata as $key => $val) {
$this->newFlashData[$key] = $val;
}
}
} | [
"public",
"function",
"setFlashData",
"(",
"$",
"newdata",
",",
"$",
"value",
"=",
"''",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"newdata",
")",
")",
"{",
"$",
"newdata",
"=",
"[",
"$",
"newdata",
"=>",
"$",
"value",
"]",
";",
"}",
"if",
"(",... | Set Flash Data
Set flash data that will persist only until next request
@param mixed $newdata Flash data array or string (key)
@param string $value Value for single key | [
"Set",
"Flash",
"Data"
] | ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed | https://github.com/PitonCMS/Session/blob/ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed/src/SessionHandler.php#L240-L251 |
197,734 | PitonCMS/Session | src/SessionHandler.php | SessionHandler.getFlashData | public function getFlashData($key = null)
{
if ($key === null) {
return $this->lastFlashData;
}
return isset($this->lastFlashData[$key]) ? $this->lastFlashData[$key] : null;
} | php | public function getFlashData($key = null)
{
if ($key === null) {
return $this->lastFlashData;
}
return isset($this->lastFlashData[$key]) ? $this->lastFlashData[$key] : null;
} | [
"public",
"function",
"getFlashData",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"lastFlashData",
";",
"}",
"return",
"isset",
"(",
"$",
"this",
"->",
"lastFlashData",
"[",
"$"... | Get Flash Data
Returns flash data
@param string $key Flash data array key
@return mixed Value or array | [
"Get",
"Flash",
"Data"
] | ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed | https://github.com/PitonCMS/Session/blob/ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed/src/SessionHandler.php#L260-L267 |
197,735 | PitonCMS/Session | src/SessionHandler.php | SessionHandler.write | private function write()
{
$sessionData['data'] = $this->data;
$sessionData['flash'] = $this->newFlashData;
// Write session data to database
$stmt = $this->db->prepare("UPDATE {$this->tableName} SET data = ? WHERE session_id = ?");
$stmt->execute([json_encode($sessionData),... | php | private function write()
{
$sessionData['data'] = $this->data;
$sessionData['flash'] = $this->newFlashData;
// Write session data to database
$stmt = $this->db->prepare("UPDATE {$this->tableName} SET data = ? WHERE session_id = ?");
$stmt->execute([json_encode($sessionData),... | [
"private",
"function",
"write",
"(",
")",
"{",
"$",
"sessionData",
"[",
"'data'",
"]",
"=",
"$",
"this",
"->",
"data",
";",
"$",
"sessionData",
"[",
"'flash'",
"]",
"=",
"$",
"this",
"->",
"newFlashData",
";",
"// Write session data to database",
"$",
"stm... | Write Session Data
Writes session data to the database.
@return void | [
"Write",
"Session",
"Data"
] | ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed | https://github.com/PitonCMS/Session/blob/ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed/src/SessionHandler.php#L377-L385 |
197,736 | PitonCMS/Session | src/SessionHandler.php | SessionHandler.cleanExpired | private function cleanExpired()
{
// 10% chance to clean the database of expired sessions
if (mt_rand(1, 10) == 1) {
$expiredTime = $this->now - $this->secondsUntilExpiration;
$stmt = $this->db->prepare("DELETE FROM {$this->tableName} WHERE time_updated < {$expiredTime}");
... | php | private function cleanExpired()
{
// 10% chance to clean the database of expired sessions
if (mt_rand(1, 10) == 1) {
$expiredTime = $this->now - $this->secondsUntilExpiration;
$stmt = $this->db->prepare("DELETE FROM {$this->tableName} WHERE time_updated < {$expiredTime}");
... | [
"private",
"function",
"cleanExpired",
"(",
")",
"{",
"// 10% chance to clean the database of expired sessions",
"if",
"(",
"mt_rand",
"(",
"1",
",",
"10",
")",
"==",
"1",
")",
"{",
"$",
"expiredTime",
"=",
"$",
"this",
"->",
"now",
"-",
"$",
"this",
"->",
... | Clean Old Sessions
Removes expired sessions from the database
@return void | [
"Clean",
"Old",
"Sessions"
] | ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed | https://github.com/PitonCMS/Session/blob/ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed/src/SessionHandler.php#L412-L420 |
197,737 | PitonCMS/Session | src/SessionHandler.php | SessionHandler.generateId | private function generateId()
{
$randomNumber = mt_rand(0, mt_getrandmax());
$ipAddressFragment = md5(substr($this->ipAddress, 0, 5));
$timestamp = md5(microtime(true) . $this->now);
return hash('sha256', $randomNumber . $ipAddressFragment . $this->salt . $timestamp);
} | php | private function generateId()
{
$randomNumber = mt_rand(0, mt_getrandmax());
$ipAddressFragment = md5(substr($this->ipAddress, 0, 5));
$timestamp = md5(microtime(true) . $this->now);
return hash('sha256', $randomNumber . $ipAddressFragment . $this->salt . $timestamp);
} | [
"private",
"function",
"generateId",
"(",
")",
"{",
"$",
"randomNumber",
"=",
"mt_rand",
"(",
"0",
",",
"mt_getrandmax",
"(",
")",
")",
";",
"$",
"ipAddressFragment",
"=",
"md5",
"(",
"substr",
"(",
"$",
"this",
"->",
"ipAddress",
",",
"0",
",",
"5",
... | Generate New Session ID
Create a unique session ID
@return string | [
"Generate",
"New",
"Session",
"ID"
] | ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed | https://github.com/PitonCMS/Session/blob/ac7fdb75e9fab92941ee28cff5ae29952a7ca5ed/src/SessionHandler.php#L428-L435 |
197,738 | froq/froq-collection | src/Collection.php | Collection.hasValue | public function hasValue($value, bool $strict = false): bool
{
return in_array($value, $this->data, $strict);
} | php | public function hasValue($value, bool $strict = false): bool
{
return in_array($value, $this->data, $strict);
} | [
"public",
"function",
"hasValue",
"(",
"$",
"value",
",",
"bool",
"$",
"strict",
"=",
"false",
")",
":",
"bool",
"{",
"return",
"in_array",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"data",
",",
"$",
"strict",
")",
";",
"}"
] | Has value.
@param any $value
@param bool $strict
@return bool | [
"Has",
"value",
"."
] | 0d5e89a820d805af69835d3269d3ec45ad02716e | https://github.com/froq/froq-collection/blob/0d5e89a820d805af69835d3269d3ec45ad02716e/src/Collection.php#L250-L253 |
197,739 | froq/froq-collection | src/Collection.php | Collection.pullAll | public function pullAll(array $keys, $valueDefault = null): array
{
return Arrays::pullAll($this->data, $keys, $valueDefault);
} | php | public function pullAll(array $keys, $valueDefault = null): array
{
return Arrays::pullAll($this->data, $keys, $valueDefault);
} | [
"public",
"function",
"pullAll",
"(",
"array",
"$",
"keys",
",",
"$",
"valueDefault",
"=",
"null",
")",
":",
"array",
"{",
"return",
"Arrays",
"::",
"pullAll",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"keys",
",",
"$",
"valueDefault",
")",
";",
"}"
... | Pull all.
@param array $keys
@param any $valueDefault
@return any
@since 3.0 | [
"Pull",
"all",
"."
] | 0d5e89a820d805af69835d3269d3ec45ad02716e | https://github.com/froq/froq-collection/blob/0d5e89a820d805af69835d3269d3ec45ad02716e/src/Collection.php#L274-L277 |
197,740 | frameworkwtf/auth | src/Auth/Middleware/RBAC.php | RBAC.isAllowed | protected function isAllowed(ServerRequestInterface $request, string $role): bool
{
$route = $request->getAttribute('route');
// Get config string like 'routes./home.second.rbac.anonymous' to get rbac config for route with name "second" in route group "home"
$config = 'routes.'.$route->getGr... | php | protected function isAllowed(ServerRequestInterface $request, string $role): bool
{
$route = $request->getAttribute('route');
// Get config string like 'routes./home.second.rbac.anonymous' to get rbac config for route with name "second" in route group "home"
$config = 'routes.'.$route->getGr... | [
"protected",
"function",
"isAllowed",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"string",
"$",
"role",
")",
":",
"bool",
"{",
"$",
"route",
"=",
"$",
"request",
"->",
"getAttribute",
"(",
"'route'",
")",
";",
"// Get config string like 'routes./home.seco... | Check if request allowed for current user.
@param ServerRequestInterface $request
@param string $role
@return bool | [
"Check",
"if",
"request",
"allowed",
"for",
"current",
"user",
"."
] | 2535d19ee326d1b491e36a341fe06d00bcc0731e | https://github.com/frameworkwtf/auth/blob/2535d19ee326d1b491e36a341fe06d00bcc0731e/src/Auth/Middleware/RBAC.php#L57-L67 |
197,741 | prolic/HumusMvc | src/HumusMvc/Service/FrontControllerFactory.php | FrontControllerFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$frontController = FrontController::getInstance();
// handle injections
$frontController->setDispatcher($serviceLocator->get('Dispatcher'));
$frontController->setRequest($serviceLocator->get('Request'));
... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$frontController = FrontController::getInstance();
// handle injections
$frontController->setDispatcher($serviceLocator->get('Dispatcher'));
$frontController->setRequest($serviceLocator->get('Request'));
... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"frontController",
"=",
"FrontController",
"::",
"getInstance",
"(",
")",
";",
"// handle injections",
"$",
"frontController",
"->",
"setDispatcher",
"(",
"$",... | Create front controller service
@param ServiceLocatorInterface $serviceLocator
@return FrontController | [
"Create",
"front",
"controller",
"service"
] | 09e8c6422d84b57745cc643047e10761be2a21a7 | https://github.com/prolic/HumusMvc/blob/09e8c6422d84b57745cc643047e10761be2a21a7/src/HumusMvc/Service/FrontControllerFactory.php#L61-L117 |
197,742 | WellCommerce/PageBundle | Controller/Front/PageController.php | PageController.findOr404 | protected function findOr404(Request $request, array $criteria = [])
{
// check whether request contains ID attribute
if (!$request->attributes->has('id')) {
throw new \LogicException('Request does not have "id" attribute set.');
}
$criteria['id'] = $request->attributes-... | php | protected function findOr404(Request $request, array $criteria = [])
{
// check whether request contains ID attribute
if (!$request->attributes->has('id')) {
throw new \LogicException('Request does not have "id" attribute set.');
}
$criteria['id'] = $request->attributes-... | [
"protected",
"function",
"findOr404",
"(",
"Request",
"$",
"request",
",",
"array",
"$",
"criteria",
"=",
"[",
"]",
")",
"{",
"// check whether request contains ID attribute",
"if",
"(",
"!",
"$",
"request",
"->",
"attributes",
"->",
"has",
"(",
"'id'",
")",
... | Returns resource by ID parameter
@param Request $request
@param array $criteria
@return mixed | [
"Returns",
"resource",
"by",
"ID",
"parameter"
] | c9a1e8c8c52177e3b82f246fd38a4598214aa222 | https://github.com/WellCommerce/PageBundle/blob/c9a1e8c8c52177e3b82f246fd38a4598214aa222/Controller/Front/PageController.php#L59-L73 |
197,743 | theomessin/ts-framework | src/Node/Client.php | Client.iconDownload | public function iconDownload()
{
if ($this->iconIsLocal("client_icon_id") || $this["client_icon_id"] == 0) {
return;
}
$download = $this->getParent()->transferInitDownload(
rand(0x0000, 0xFFFF),
0,
$this->iconGetName("client_icon_id")
... | php | public function iconDownload()
{
if ($this->iconIsLocal("client_icon_id") || $this["client_icon_id"] == 0) {
return;
}
$download = $this->getParent()->transferInitDownload(
rand(0x0000, 0xFFFF),
0,
$this->iconGetName("client_icon_id")
... | [
"public",
"function",
"iconDownload",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"iconIsLocal",
"(",
"\"client_icon_id\"",
")",
"||",
"$",
"this",
"[",
"\"client_icon_id\"",
"]",
"==",
"0",
")",
"{",
"return",
";",
"}",
"$",
"download",
"=",
"$",
"th... | Downloads and returns the clients icon file content.
@return TeamSpeak3_Helper_String | [
"Downloads",
"and",
"returns",
"the",
"clients",
"icon",
"file",
"content",
"."
] | d60e36553241db05cb05ef19e749866cc977437c | https://github.com/theomessin/ts-framework/blob/d60e36553241db05cb05ef19e749866cc977437c/src/Node/Client.php#L350-L364 |
197,744 | congraphcms/core | Helpers/FileHelper.php | FileHelper.uploadsUrl | public static function uploadsUrl($url = ''){
$url = Config::get('congraph::congraph.uploads_url') . '/' . $url;
$rtrim = !empty($url);
$url = url(self::normalizeUrl($url, $rtrim));
return $url;
} | php | public static function uploadsUrl($url = ''){
$url = Config::get('congraph::congraph.uploads_url') . '/' . $url;
$rtrim = !empty($url);
$url = url(self::normalizeUrl($url, $rtrim));
return $url;
} | [
"public",
"static",
"function",
"uploadsUrl",
"(",
"$",
"url",
"=",
"''",
")",
"{",
"$",
"url",
"=",
"Config",
"::",
"get",
"(",
"'congraph::congraph.uploads_url'",
")",
".",
"'/'",
".",
"$",
"url",
";",
"$",
"rtrim",
"=",
"!",
"empty",
"(",
"$",
"ur... | Get uploads url from config and optionally concatonates
given url to uploads url
@param string $url - optional url
@return string | [
"Get",
"uploads",
"url",
"from",
"config",
"and",
"optionally",
"concatonates",
"given",
"url",
"to",
"uploads",
"url"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/FileHelper.php#L38-L44 |
197,745 | congraphcms/core | Helpers/FileHelper.php | FileHelper.normalizePath | public static function normalizePath($path, $rtrim = true){
$path = trim($path);
// replace every back slash with forward slash
$path = str_replace('\\', '/', $path);
// replace all double slashes with single
$path = preg_replace( '/\/+/', '==DS==', $path );
// trim slashes on begining
$segments = explod... | php | public static function normalizePath($path, $rtrim = true){
$path = trim($path);
// replace every back slash with forward slash
$path = str_replace('\\', '/', $path);
// replace all double slashes with single
$path = preg_replace( '/\/+/', '==DS==', $path );
// trim slashes on begining
$segments = explod... | [
"public",
"static",
"function",
"normalizePath",
"(",
"$",
"path",
",",
"$",
"rtrim",
"=",
"true",
")",
"{",
"$",
"path",
"=",
"trim",
"(",
"$",
"path",
")",
";",
"// replace every back slash with forward slash",
"$",
"path",
"=",
"str_replace",
"(",
"'\\\\'... | Normalizes path slashes when mixed between path and url conversion
It takes string with mixed or doubled slashes and converts them
to single slashes dependent on system beacose of use of DIRECTORY_SEPARATOR const,
and optionally trims right slash.
There are two parameters,
string that will be normalized and optional ... | [
"Normalizes",
"path",
"slashes",
"when",
"mixed",
"between",
"path",
"and",
"url",
"conversion"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/FileHelper.php#L79-L95 |
197,746 | congraphcms/core | Helpers/FileHelper.php | FileHelper.normalizeUrl | public static function normalizeUrl($url, $rtrim = true){
$url = trim($url);
// replace every back slash with forward slash
$url = str_replace('\\', '/', $url);
// replace all double slashes with single
$url = preg_replace( '/\/+/', '==DS==', $url );
// trim slashes on begining
$segments = explode('==DS=... | php | public static function normalizeUrl($url, $rtrim = true){
$url = trim($url);
// replace every back slash with forward slash
$url = str_replace('\\', '/', $url);
// replace all double slashes with single
$url = preg_replace( '/\/+/', '==DS==', $url );
// trim slashes on begining
$segments = explode('==DS=... | [
"public",
"static",
"function",
"normalizeUrl",
"(",
"$",
"url",
",",
"$",
"rtrim",
"=",
"true",
")",
"{",
"$",
"url",
"=",
"trim",
"(",
"$",
"url",
")",
";",
"// replace every back slash with forward slash",
"$",
"url",
"=",
"str_replace",
"(",
"'\\\\'",
... | Normalizes url slashes when mixed between path and url conversion
It takes string with mixed or doubled slashes and converts them
to single forward slashes, and optionally trims right slash
There are two parameters,
string that will be normalized and optional rtrim flag
@param string $url - string to be normalized
@... | [
"Normalizes",
"url",
"slashes",
"when",
"mixed",
"between",
"path",
"and",
"url",
"conversion"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/FileHelper.php#L110-L124 |
197,747 | congraphcms/core | Helpers/FileHelper.php | FileHelper.uniqueFilename | public static function uniqueFilename($path) {
// get directory
$dir = self::getDirectory($path);
// get filename
$filename = self::getFileName($path);
// sanitize the file name before we begin processing
$filename = self::sanitizeFileName($filename);
// separate the filename into a name and extension
... | php | public static function uniqueFilename($path) {
// get directory
$dir = self::getDirectory($path);
// get filename
$filename = self::getFileName($path);
// sanitize the file name before we begin processing
$filename = self::sanitizeFileName($filename);
// separate the filename into a name and extension
... | [
"public",
"static",
"function",
"uniqueFilename",
"(",
"$",
"path",
")",
"{",
"// get directory",
"$",
"dir",
"=",
"self",
"::",
"getDirectory",
"(",
"$",
"path",
")",
";",
"// get filename",
"$",
"filename",
"=",
"self",
"::",
"getFileName",
"(",
"$",
"pa... | Get a filename that is sanitized and unique for the given directory.
If the filename is not unique, then a number will be added to the filename
before the extension, and will continue adding numbers until the filename is
unique.
@param string $path
@return string | [
"Get",
"a",
"filename",
"that",
"is",
"sanitized",
"and",
"unique",
"for",
"the",
"given",
"directory",
"."
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/FileHelper.php#L166-L207 |
197,748 | congraphcms/core | Helpers/FileHelper.php | FileHelper.sanitizeFileName | public static function sanitizeFileName( $filename ) {
$special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));
$filename = str_replace($special_chars, '', $filename);
$filename = preg_replace('/[\s-]+/', '-', $f... | php | public static function sanitizeFileName( $filename ) {
$special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));
$filename = str_replace($special_chars, '', $filename);
$filename = preg_replace('/[\s-]+/', '-', $f... | [
"public",
"static",
"function",
"sanitizeFileName",
"(",
"$",
"filename",
")",
"{",
"$",
"special_chars",
"=",
"array",
"(",
"\"?\"",
",",
"\"[\"",
",",
"\"]\"",
",",
"\"/\"",
",",
"\"\\\\\"",
",",
"\"=\"",
",",
"\"<\"",
",",
"\">\"",
",",
"\":\"",
",",
... | Sanitizes a filename replacing whitespace with dashes
Removes special characters that are illegal in filenames on certain
operating systems and special characters requiring special escaping
to manipulate at the command line. Replaces spaces and consecutive
dashes with a single dash. Trim period, dash and underscore fr... | [
"Sanitizes",
"a",
"filename",
"replacing",
"whitespace",
"with",
"dashes"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/FileHelper.php#L222-L230 |
197,749 | congraphcms/core | Helpers/FileHelper.php | FileHelper.getFileName | public static function getFileName( $path, $includeExtension = true )
{
$option = ($includeExtension)?PATHINFO_BASENAME:PATHINFO_FILENAME;
return pathinfo($path, $option);
} | php | public static function getFileName( $path, $includeExtension = true )
{
$option = ($includeExtension)?PATHINFO_BASENAME:PATHINFO_FILENAME;
return pathinfo($path, $option);
} | [
"public",
"static",
"function",
"getFileName",
"(",
"$",
"path",
",",
"$",
"includeExtension",
"=",
"true",
")",
"{",
"$",
"option",
"=",
"(",
"$",
"includeExtension",
")",
"?",
"PATHINFO_BASENAME",
":",
"PATHINFO_FILENAME",
";",
"return",
"pathinfo",
"(",
"... | Extracts filename from path, with or without extension
You can optionally specify if you want extensino to be included
Defaults to extension included
@param string $path from wich filename will be extracted
@param boolean $includeExtension flag for including extension
@return string extracted filename | [
"Extracts",
"filename",
"from",
"path",
"with",
"or",
"without",
"extension"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Helpers/FileHelper.php#L242-L246 |
197,750 | ingro/Rest | src/Ingruz/Rest/Controllers/RestIlluminateController.php | AbstractIlluminateApiController.index | public function index()
{
$options = $this->getQueryHelperOptions();
$items = $this->repo->allPaged($options);
if ( ! $items)
{
return $this->respondNotFound('Unable to fetch the selected resources');
}
$response = [
'data' => [],
... | php | public function index()
{
$options = $this->getQueryHelperOptions();
$items = $this->repo->allPaged($options);
if ( ! $items)
{
return $this->respondNotFound('Unable to fetch the selected resources');
}
$response = [
'data' => [],
... | [
"public",
"function",
"index",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getQueryHelperOptions",
"(",
")",
";",
"$",
"items",
"=",
"$",
"this",
"->",
"repo",
"->",
"allPaged",
"(",
"$",
"options",
")",
";",
"if",
"(",
"!",
"$",
"items... | Return items in a paged way
@return mixed | [
"Return",
"items",
"in",
"a",
"paged",
"way"
] | 922bed071b8ea41feb067d97a3e283f944a86cb8 | https://github.com/ingro/Rest/blob/922bed071b8ea41feb067d97a3e283f944a86cb8/src/Ingruz/Rest/Controllers/RestIlluminateController.php#L79-L112 |
197,751 | ingro/Rest | src/Ingruz/Rest/Controllers/RestIlluminateController.php | AbstractIlluminateApiController.show | public function show($id)
{
$item = $this->repo->getById($id);
if ( ! $item)
{
return $this->respondNotFound();
}
$resource = new Fractal\Resource\Item($item, new $this->transformerClass);
return $this->fractal->createData($resource)->toArray();
} | php | public function show($id)
{
$item = $this->repo->getById($id);
if ( ! $item)
{
return $this->respondNotFound();
}
$resource = new Fractal\Resource\Item($item, new $this->transformerClass);
return $this->fractal->createData($resource)->toArray();
} | [
"public",
"function",
"show",
"(",
"$",
"id",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"repo",
"->",
"getById",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"item",
")",
"{",
"return",
"$",
"this",
"->",
"respondNotFound",
"(",
")",
";"... | Return an item by it's id
@param $id
@return mixed | [
"Return",
"an",
"item",
"by",
"it",
"s",
"id"
] | 922bed071b8ea41feb067d97a3e283f944a86cb8 | https://github.com/ingro/Rest/blob/922bed071b8ea41feb067d97a3e283f944a86cb8/src/Ingruz/Rest/Controllers/RestIlluminateController.php#L120-L131 |
197,752 | congraphcms/core | Repositories/Collection.php | Collection.setDefaultModel | public function setDefaultModel($model)
{
if(is_string($model))
{
$model = new ReflectionClass($model);
$model = $model->newInstanceWithoutConstructor();
}
if( $model instanceof Model)
{
$this->defaultModel = get_class($model);
return;
}
throw new \InvalidArgumentException('Collection defau... | php | public function setDefaultModel($model)
{
if(is_string($model))
{
$model = new ReflectionClass($model);
$model = $model->newInstanceWithoutConstructor();
}
if( $model instanceof Model)
{
$this->defaultModel = get_class($model);
return;
}
throw new \InvalidArgumentException('Collection defau... | [
"public",
"function",
"setDefaultModel",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"model",
")",
")",
"{",
"$",
"model",
"=",
"new",
"ReflectionClass",
"(",
"$",
"model",
")",
";",
"$",
"model",
"=",
"$",
"model",
"->",
"newInsta... | Set default model class
@param Congraph\Core\Repositories\Model|string $model
@throws \InvalidArgumentException | [
"Set",
"default",
"model",
"class"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/Collection.php#L98-L113 |
197,753 | congraphcms/core | Repositories/Collection.php | Collection.checkItems | protected function checkItems(array $data)
{
foreach ($data as &$item)
{
if( ! $item instanceof Model )
{
$item = new $this->defaultModel($item);
}
}
return $data;
} | php | protected function checkItems(array $data)
{
foreach ($data as &$item)
{
if( ! $item instanceof Model )
{
$item = new $this->defaultModel($item);
}
}
return $data;
} | [
"protected",
"function",
"checkItems",
"(",
"array",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"&",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"$",
"item",
"instanceof",
"Model",
")",
"{",
"$",
"item",
"=",
"new",
"$",
"this",
"->",
"... | Check if all items are instance of Model
if not, create new Model for each item
@param array $data
@return array | [
"Check",
"if",
"all",
"items",
"are",
"instance",
"of",
"Model",
"if",
"not",
"create",
"new",
"Model",
"for",
"each",
"item"
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Repositories/Collection.php#L182-L193 |
197,754 | phospr/DoubleEntryBundle | Model/JournalHandler.php | JournalHandler.findJournalForId | public function findJournalForId($id)
{
$dql = '
SELECT j,p
FROM %s j
LEFT JOIN j.postings p
WHERE j.id = :id
AND j.organization = :organization
';
return $this->em
->createQuery(sprintf($dql, $this->j... | php | public function findJournalForId($id)
{
$dql = '
SELECT j,p
FROM %s j
LEFT JOIN j.postings p
WHERE j.id = :id
AND j.organization = :organization
';
return $this->em
->createQuery(sprintf($dql, $this->j... | [
"public",
"function",
"findJournalForId",
"(",
"$",
"id",
")",
"{",
"$",
"dql",
"=",
"'\n SELECT j,p\n FROM %s j\n LEFT JOIN j.postings p\n WHERE j.id = :id\n AND j.organization = :organization\n '",
";",
"retu... | Find Journal for id
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@param int $id
@return Journal | [
"Find",
"Journal",
"for",
"id"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/JournalHandler.php#L98-L114 |
197,755 | phospr/DoubleEntryBundle | Model/JournalHandler.php | JournalHandler.createJournal | public function createJournal()
{
$journal = new $this->journalFqcn();
$journal->setOrganization($this->oh->getOrganization());
return $journal;
} | php | public function createJournal()
{
$journal = new $this->journalFqcn();
$journal->setOrganization($this->oh->getOrganization());
return $journal;
} | [
"public",
"function",
"createJournal",
"(",
")",
"{",
"$",
"journal",
"=",
"new",
"$",
"this",
"->",
"journalFqcn",
"(",
")",
";",
"$",
"journal",
"->",
"setOrganization",
"(",
"$",
"this",
"->",
"oh",
"->",
"getOrganization",
"(",
")",
")",
";",
"retu... | Create new Journal
@author Tom Haskins-Vaughan <tom@tomhv.uk>
@since 0.8.0
@return Journal | [
"Create",
"new",
"Journal"
] | d9c421f30922b461483731983c59beb26047fb7f | https://github.com/phospr/DoubleEntryBundle/blob/d9c421f30922b461483731983c59beb26047fb7f/Model/JournalHandler.php#L124-L130 |
197,756 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.addRoute | public function addRoute($expression, $route)
{
//Detect command expression
if (strpos($expression, '*') !== false) {
return $this->addRegexpRoute($expression, $route);
} else {
return $this->addSimpleRoute($expression, $route);
}
} | php | public function addRoute($expression, $route)
{
//Detect command expression
if (strpos($expression, '*') !== false) {
return $this->addRegexpRoute($expression, $route);
} else {
return $this->addSimpleRoute($expression, $route);
}
} | [
"public",
"function",
"addRoute",
"(",
"$",
"expression",
",",
"$",
"route",
")",
"{",
"//Detect command expression",
"if",
"(",
"strpos",
"(",
"$",
"expression",
",",
"'*'",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"addRegexpRoute",
"("... | Add new route.
@param string $expression Either simple expression, or RegExp describing route.
@param string $route Route name.
@return bool True, if route has been set, false otherwise. | [
"Add",
"new",
"route",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L55-L63 |
197,757 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.addRegexpRoute | private function addRegexpRoute($expression, $route)
{
$expression = '|^'.str_replace(array('*', '\\'), array('.*', '\\\\'), $expression).'$|i';
if (array_key_exists($expression, $this->regexpRoutes) && $this->regexpRoutes[$expression] == $route) {
return false;
}
$this->... | php | private function addRegexpRoute($expression, $route)
{
$expression = '|^'.str_replace(array('*', '\\'), array('.*', '\\\\'), $expression).'$|i';
if (array_key_exists($expression, $this->regexpRoutes) && $this->regexpRoutes[$expression] == $route) {
return false;
}
$this->... | [
"private",
"function",
"addRegexpRoute",
"(",
"$",
"expression",
",",
"$",
"route",
")",
"{",
"$",
"expression",
"=",
"'|^'",
".",
"str_replace",
"(",
"array",
"(",
"'*'",
",",
"'\\\\'",
")",
",",
"array",
"(",
"'.*'",
",",
"'\\\\\\\\'",
")",
",",
"$",... | Add new regexp route.
@param string $expression RegExp describing route.
@param string $route Route name.
@return bool True, if route has been set, false otherwise. | [
"Add",
"new",
"regexp",
"route",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L73-L81 |
197,758 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.addSimpleRoute | private function addSimpleRoute($expression, $route)
{
if (array_key_exists($expression, $this->simpleRoutes) && $this->simpleRoutes[$expression] == $route) {
return false;
}
$this->simpleRoutes[$expression] = (string) $route;
return true;
} | php | private function addSimpleRoute($expression, $route)
{
if (array_key_exists($expression, $this->simpleRoutes) && $this->simpleRoutes[$expression] == $route) {
return false;
}
$this->simpleRoutes[$expression] = (string) $route;
return true;
} | [
"private",
"function",
"addSimpleRoute",
"(",
"$",
"expression",
",",
"$",
"route",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"expression",
",",
"$",
"this",
"->",
"simpleRoutes",
")",
"&&",
"$",
"this",
"->",
"simpleRoutes",
"[",
"$",
"expression... | Add new simple route.
@param string $expression Simple route expression.
@param string $route Route name.
@return bool True, if route has been set, false otherwise. | [
"Add",
"new",
"simple",
"route",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L91-L98 |
197,759 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.doDetect | private function doDetect($className, $performInterfaceDetection = true)
{
$detection = $this->doDetectByRoutes($className);
if ($detection) {
return $detection;
}
//Nothing is found so far. We will check all of the class interfaces and base classes.
//First - che... | php | private function doDetect($className, $performInterfaceDetection = true)
{
$detection = $this->doDetectByRoutes($className);
if ($detection) {
return $detection;
}
//Nothing is found so far. We will check all of the class interfaces and base classes.
//First - che... | [
"private",
"function",
"doDetect",
"(",
"$",
"className",
",",
"$",
"performInterfaceDetection",
"=",
"true",
")",
"{",
"$",
"detection",
"=",
"$",
"this",
"->",
"doDetectByRoutes",
"(",
"$",
"className",
")",
";",
"if",
"(",
"$",
"detection",
")",
"{",
... | Detect pool.
@param string $className
@param boolean $performInterfaceDetection
@return DetectionInterface | [
"Detect",
"pool",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L146-L170 |
197,760 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.doDetectByRoutes | private function doDetectByRoutes($className)
{
//If we have entry for a command class, we should always return it, as it is most specific.
if (!empty($this->simpleRoutes[$className])) {
return new ClassDetection($this->simpleRoutes[$className]);
}
//Now, we should check,... | php | private function doDetectByRoutes($className)
{
//If we have entry for a command class, we should always return it, as it is most specific.
if (!empty($this->simpleRoutes[$className])) {
return new ClassDetection($this->simpleRoutes[$className]);
}
//Now, we should check,... | [
"private",
"function",
"doDetectByRoutes",
"(",
"$",
"className",
")",
"{",
"//If we have entry for a command class, we should always return it, as it is most specific.",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"simpleRoutes",
"[",
"$",
"className",
"]",
")",
"... | Perform detection based on class name and routes registered for this class.
@param string $className
@return ClassDetection|null | [
"Perform",
"detection",
"based",
"on",
"class",
"name",
"and",
"routes",
"registered",
"for",
"this",
"class",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L179-L191 |
197,761 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.doDetectByInterfaces | private function doDetectByInterfaces($className)
{
$interfaces = $this->getOrderedInterfaces($className);
foreach ($interfaces as $interface) {
$candidate = $this->doDetectByRoutes($interface);
if ($candidate) {
return $candidate;
}
}
... | php | private function doDetectByInterfaces($className)
{
$interfaces = $this->getOrderedInterfaces($className);
foreach ($interfaces as $interface) {
$candidate = $this->doDetectByRoutes($interface);
if ($candidate) {
return $candidate;
}
}
... | [
"private",
"function",
"doDetectByInterfaces",
"(",
"$",
"className",
")",
"{",
"$",
"interfaces",
"=",
"$",
"this",
"->",
"getOrderedInterfaces",
"(",
"$",
"className",
")",
";",
"foreach",
"(",
"$",
"interfaces",
"as",
"$",
"interface",
")",
"{",
"$",
"c... | Perform detection based on class interfaces.
@param string $className
@return DetectionInterface|null | [
"Perform",
"detection",
"based",
"on",
"class",
"interfaces",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L200-L211 |
197,762 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.getOrderedInterfaces | private function getOrderedInterfaces($className)
{
$interfacesArr = $this->prepareClassTreeInterfaces($className);
$interfaces = array();
foreach ($interfacesArr as $classInterfaces) {
foreach ($classInterfaces as $interface) {
if (array_search($interface, $inter... | php | private function getOrderedInterfaces($className)
{
$interfacesArr = $this->prepareClassTreeInterfaces($className);
$interfaces = array();
foreach ($interfacesArr as $classInterfaces) {
foreach ($classInterfaces as $interface) {
if (array_search($interface, $inter... | [
"private",
"function",
"getOrderedInterfaces",
"(",
"$",
"className",
")",
"{",
"$",
"interfacesArr",
"=",
"$",
"this",
"->",
"prepareClassTreeInterfaces",
"(",
"$",
"className",
")",
";",
"$",
"interfaces",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
... | Get a list of class interfaces ordered by plase of interface declaration.
The list is ordered by place of interface declaration. Interfaces declared on most child class are first,
while those in base class(es) - last.
@param string $className
@return array | [
"Get",
"a",
"list",
"of",
"class",
"interfaces",
"ordered",
"by",
"plase",
"of",
"interface",
"declaration",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L223-L236 |
197,763 | Gendoria/command-queue | src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php | RouteDetector.prepareClassTreeInterfaces | private function prepareClassTreeInterfaces($className)
{
$interfacesArr = array();
$reflection = new ReflectionClass($className);
$interfacesArr[] = $reflection->getInterfaceNames();
if (empty($interfacesArr[0])) {
return array();
}
$classParents = class_... | php | private function prepareClassTreeInterfaces($className)
{
$interfacesArr = array();
$reflection = new ReflectionClass($className);
$interfacesArr[] = $reflection->getInterfaceNames();
if (empty($interfacesArr[0])) {
return array();
}
$classParents = class_... | [
"private",
"function",
"prepareClassTreeInterfaces",
"(",
"$",
"className",
")",
"{",
"$",
"interfacesArr",
"=",
"array",
"(",
")",
";",
"$",
"reflection",
"=",
"new",
"ReflectionClass",
"(",
"$",
"className",
")",
";",
"$",
"interfacesArr",
"[",
"]",
"=",
... | Prepares all interfaces for given class and its parents.
@param string $className
@return array | [
"Prepares",
"all",
"interfaces",
"for",
"given",
"class",
"and",
"its",
"parents",
"."
] | 4e1094570705942f2ce3b2c976b5b251c3c84b40 | https://github.com/Gendoria/command-queue/blob/4e1094570705942f2ce3b2c976b5b251c3c84b40/src/Gendoria/CommandQueue/RouteDetection/Detector/RouteDetector.php#L244-L262 |
197,764 | WellBloud/sovacore-core | src/model/AdminModule/repository/BaseRepository.php | BaseRepository.findAllTreeItems | public function findAllTreeItems($publishedOnly = false)
{
$filter = $publishedOnly ? ['published' => true] : [];
return $this->repository->findBy($filter, ['lft' => 'ASC']);
} | php | public function findAllTreeItems($publishedOnly = false)
{
$filter = $publishedOnly ? ['published' => true] : [];
return $this->repository->findBy($filter, ['lft' => 'ASC']);
} | [
"public",
"function",
"findAllTreeItems",
"(",
"$",
"publishedOnly",
"=",
"false",
")",
"{",
"$",
"filter",
"=",
"$",
"publishedOnly",
"?",
"[",
"'published'",
"=>",
"true",
"]",
":",
"[",
"]",
";",
"return",
"$",
"this",
"->",
"repository",
"->",
"findB... | Returns all items in tree structure
@param type $publishedOnly returns only published items
@return type | [
"Returns",
"all",
"items",
"in",
"tree",
"structure"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/AdminModule/repository/BaseRepository.php#L26-L30 |
197,765 | WellBloud/sovacore-core | src/model/AdminModule/repository/BaseRepository.php | BaseRepository.getUniqueAlias | public function getUniqueAlias($entity,
string $titleProperty = 'title',
string $titleValue = null,
string $aliasColumn = 'seoTitle'): string
{
$alias = Strings::webalize($titleValue ?? $entity->{$titleProperty});
$id = $entity->id ?? null;
while (!$this->seoTitleIsUn... | php | public function getUniqueAlias($entity,
string $titleProperty = 'title',
string $titleValue = null,
string $aliasColumn = 'seoTitle'): string
{
$alias = Strings::webalize($titleValue ?? $entity->{$titleProperty});
$id = $entity->id ?? null;
while (!$this->seoTitleIsUn... | [
"public",
"function",
"getUniqueAlias",
"(",
"$",
"entity",
",",
"string",
"$",
"titleProperty",
"=",
"'title'",
",",
"string",
"$",
"titleValue",
"=",
"null",
",",
"string",
"$",
"aliasColumn",
"=",
"'seoTitle'",
")",
":",
"string",
"{",
"$",
"alias",
"="... | Returns unique seo alias for entity
@param entity $entity
@param string $titleProperty
@param string $titleValue
@param string $aliasColumn
@return string entity seo title | [
"Returns",
"unique",
"seo",
"alias",
"for",
"entity"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/AdminModule/repository/BaseRepository.php#L80-L99 |
197,766 | WellBloud/sovacore-core | src/model/AdminModule/repository/BaseRepository.php | BaseRepository.seoTitleIsUnique | private function seoTitleIsUnique($id,
string $generatedAlias,
string $aliasColumn = 'seoTitle'): bool
{
$alias = Strings::webalize($generatedAlias);
if ($id === null) {
$results = $this->repository->findBy([$aliasColumn => $alias]);
} else {
$results ... | php | private function seoTitleIsUnique($id,
string $generatedAlias,
string $aliasColumn = 'seoTitle'): bool
{
$alias = Strings::webalize($generatedAlias);
if ($id === null) {
$results = $this->repository->findBy([$aliasColumn => $alias]);
} else {
$results ... | [
"private",
"function",
"seoTitleIsUnique",
"(",
"$",
"id",
",",
"string",
"$",
"generatedAlias",
",",
"string",
"$",
"aliasColumn",
"=",
"'seoTitle'",
")",
":",
"bool",
"{",
"$",
"alias",
"=",
"Strings",
"::",
"webalize",
"(",
"$",
"generatedAlias",
")",
"... | Checks if seo title is unique.
@param int|NULL $id
@param string $generatedAlias
@param string $aliasColumn
@return boolean | [
"Checks",
"if",
"seo",
"title",
"is",
"unique",
"."
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/AdminModule/repository/BaseRepository.php#L108-L119 |
197,767 | WellBloud/sovacore-core | src/model/AdminModule/repository/BaseRepository.php | BaseRepository.removeImage | public function removeImage($entityId)
{
if (!$entityId) {
return false;
}
$delete = '
UPDATE ' . $this->repository->getClassName() . ' a
SET a.image = NULL
WHERE a.id = ' . $entityId . '
';
$q = $this->query($delete);
$q->execute(... | php | public function removeImage($entityId)
{
if (!$entityId) {
return false;
}
$delete = '
UPDATE ' . $this->repository->getClassName() . ' a
SET a.image = NULL
WHERE a.id = ' . $entityId . '
';
$q = $this->query($delete);
$q->execute(... | [
"public",
"function",
"removeImage",
"(",
"$",
"entityId",
")",
"{",
"if",
"(",
"!",
"$",
"entityId",
")",
"{",
"return",
"false",
";",
"}",
"$",
"delete",
"=",
"'\n UPDATE '",
".",
"$",
"this",
"->",
"repository",
"->",
"getClassName",
"(",
")",
... | Sets image to NULL
@param string $entityId | [
"Sets",
"image",
"to",
"NULL"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/AdminModule/repository/BaseRepository.php#L125-L138 |
197,768 | WellBloud/sovacore-core | src/model/AdminModule/repository/BaseRepository.php | BaseRepository.getNewMaxId | public function getNewMaxId($entityClassname): int
{
$maxId = $this->em->createQueryBuilder()
->select('MAX(e.id) + 1')
->from($entityClassname, 'e')
->getQuery()
->getSingleScalarResult();
return (int) $maxId;
} | php | public function getNewMaxId($entityClassname): int
{
$maxId = $this->em->createQueryBuilder()
->select('MAX(e.id) + 1')
->from($entityClassname, 'e')
->getQuery()
->getSingleScalarResult();
return (int) $maxId;
} | [
"public",
"function",
"getNewMaxId",
"(",
"$",
"entityClassname",
")",
":",
"int",
"{",
"$",
"maxId",
"=",
"$",
"this",
"->",
"em",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'MAX(e.id) + 1'",
")",
"->",
"from",
"(",
"$",
"entityClassname"... | Returns new MAX ID for entity
@param string $entityClassname
@return int | [
"Returns",
"new",
"MAX",
"ID",
"for",
"entity"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/AdminModule/repository/BaseRepository.php#L145-L153 |
197,769 | WellBloud/sovacore-core | src/model/AdminModule/repository/BaseRepository.php | BaseRepository.rebuildTree | public function rebuildTree($entityClass = '',
$parentEntity)
{
if ($entityClass === '') {
throw new Exception('messages.error.classNameNotProvided');
}
if ($parentEntity === null) {
throw new Exception('messages.error.cantRemakeTree');
}
$dqlL... | php | public function rebuildTree($entityClass = '',
$parentEntity)
{
if ($entityClass === '') {
throw new Exception('messages.error.classNameNotProvided');
}
if ($parentEntity === null) {
throw new Exception('messages.error.cantRemakeTree');
}
$dqlL... | [
"public",
"function",
"rebuildTree",
"(",
"$",
"entityClass",
"=",
"''",
",",
"$",
"parentEntity",
")",
"{",
"if",
"(",
"$",
"entityClass",
"===",
"''",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'messages.error.classNameNotProvided'",
")",
";",
"}",
"if",... | Rebuilds a tree structure by setting lft and rgt values across the rest of the tree
@param type $entityClass Class with defined entity
@param type $parentEntity Entity object
@throws Exception | [
"Rebuilds",
"a",
"tree",
"structure",
"by",
"setting",
"lft",
"and",
"rgt",
"values",
"across",
"the",
"rest",
"of",
"the",
"tree"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/AdminModule/repository/BaseRepository.php#L196-L220 |
197,770 | WellBloud/sovacore-core | src/model/AdminModule/repository/BaseRepository.php | BaseRepository.deleteTreeItem | public function deleteTreeItem($entityClass = '',
$id)
{
if ($entityClass === '') {
throw new Exception('messages.error.classNameNotProvided');
}
$entity = $this->findById($id);
$difference = $entity->rgt - $entity->lft + 1;
$deleteTree = '
... | php | public function deleteTreeItem($entityClass = '',
$id)
{
if ($entityClass === '') {
throw new Exception('messages.error.classNameNotProvided');
}
$entity = $this->findById($id);
$difference = $entity->rgt - $entity->lft + 1;
$deleteTree = '
... | [
"public",
"function",
"deleteTreeItem",
"(",
"$",
"entityClass",
"=",
"''",
",",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"entityClass",
"===",
"''",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'messages.error.classNameNotProvided'",
")",
";",
"}",
"$",
"enti... | Deletes a tree node and updates rest of the tree
@param type $entityClass Class with defined entity
@param type $id | [
"Deletes",
"a",
"tree",
"node",
"and",
"updates",
"rest",
"of",
"the",
"tree"
] | 1816a0d7cd3ec4a90d64e301fc2469d171ad217f | https://github.com/WellBloud/sovacore-core/blob/1816a0d7cd3ec4a90d64e301fc2469d171ad217f/src/model/AdminModule/repository/BaseRepository.php#L227-L259 |
197,771 | aztech-labs/skwal | src/Query/Select.php | Select.deriveColumn | public function deriveColumn($index)
{
$this->validateColumnIndex($index);
$column = new DerivedColumn($this->columns[$index]->getAlias());
return $column->setTable($this);
} | php | public function deriveColumn($index)
{
$this->validateColumnIndex($index);
$column = new DerivedColumn($this->columns[$index]->getAlias());
return $column->setTable($this);
} | [
"public",
"function",
"deriveColumn",
"(",
"$",
"index",
")",
"{",
"$",
"this",
"->",
"validateColumnIndex",
"(",
"$",
"index",
")",
";",
"$",
"column",
"=",
"new",
"DerivedColumn",
"(",
"$",
"this",
"->",
"columns",
"[",
"$",
"index",
"]",
"->",
"getA... | Derives an expression in the query's select clause as a column of the query's associated resultset.
@param int $index
@throws \OutOfRangeException
@return multitype:\Aztech\Skwal\Expression\AliasExpression | [
"Derives",
"an",
"expression",
"in",
"the",
"query",
"s",
"select",
"clause",
"as",
"a",
"column",
"of",
"the",
"query",
"s",
"associated",
"resultset",
"."
] | cf637c5ddb69f6579ba28a61af9c39639081dc16 | https://github.com/aztech-labs/skwal/blob/cf637c5ddb69f6579ba28a61af9c39639081dc16/src/Query/Select.php#L196-L203 |
197,772 | aztech-labs/skwal | src/Query/Select.php | Select.deriveColumns | public function deriveColumns()
{
$derived = array();
for ($i = 0; $i < count($this->columns); $i ++) {
$derived[] = $this->deriveColumn($i);
}
return $derived;
} | php | public function deriveColumns()
{
$derived = array();
for ($i = 0; $i < count($this->columns); $i ++) {
$derived[] = $this->deriveColumn($i);
}
return $derived;
} | [
"public",
"function",
"deriveColumns",
"(",
")",
"{",
"$",
"derived",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"this",
"->",
"columns",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"deriv... | Derives all expressions in the query's select clause as columns of the query's associated resultset.
@return multitype:Ambigous <\Aztech\Skwal\Query\multitype:\Aztech\Skwal\Expression\AliasExpression, \Aztech\Skwal\Expression\DerivedColumn> | [
"Derives",
"all",
"expressions",
"in",
"the",
"query",
"s",
"select",
"clause",
"as",
"columns",
"of",
"the",
"query",
"s",
"associated",
"resultset",
"."
] | cf637c5ddb69f6579ba28a61af9c39639081dc16 | https://github.com/aztech-labs/skwal/blob/cf637c5ddb69f6579ba28a61af9c39639081dc16/src/Query/Select.php#L210-L219 |
197,773 | valu-digital/valusetup | src/ValuSetup/Setup/SetupUtilsOptions.php | SetupUtilsOptions.setModuleDirs | public function setModuleDirs($dirs) {
if(!is_array($dirs) && !($dirs instanceof \Traversable)){
throw new \InvalidArgumentException('Invalid argument $dirs; array or instance of Traversable expected');
}
$this->moduleDirs = array();
foreach($dirs as $dir){
if(!is_dir($... | php | public function setModuleDirs($dirs) {
if(!is_array($dirs) && !($dirs instanceof \Traversable)){
throw new \InvalidArgumentException('Invalid argument $dirs; array or instance of Traversable expected');
}
$this->moduleDirs = array();
foreach($dirs as $dir){
if(!is_dir($... | [
"public",
"function",
"setModuleDirs",
"(",
"$",
"dirs",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"dirs",
")",
"&&",
"!",
"(",
"$",
"dirs",
"instanceof",
"\\",
"Traversable",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | Set module directories
@param array $moduleDirs | [
"Set",
"module",
"directories"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SetupUtilsOptions.php#L56-L71 |
197,774 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.isValidFieldOccurrence | public static function isValidFieldOccurrence ($arg)
{
if ($arg === null || ctype_digit($arg)) {
$arg = (int)$arg;
}
return is_int($arg) && $arg >= 0 && $arg < 100;
} | php | public static function isValidFieldOccurrence ($arg)
{
if ($arg === null || ctype_digit($arg)) {
$arg = (int)$arg;
}
return is_int($arg) && $arg >= 0 && $arg < 100;
} | [
"public",
"static",
"function",
"isValidFieldOccurrence",
"(",
"$",
"arg",
")",
"{",
"if",
"(",
"$",
"arg",
"===",
"null",
"||",
"ctype_digit",
"(",
"$",
"arg",
")",
")",
"{",
"$",
"arg",
"=",
"(",
"int",
")",
"$",
"arg",
";",
"}",
"return",
"is_in... | Return TRUE if argument is a valid field occurrence.
Argument is casted to int iff it is either null or a numeric string.
@param mixed $arg Variable to check
@return boolean TRUE if argument is a valid field occurrence | [
"Return",
"TRUE",
"if",
"argument",
"is",
"a",
"valid",
"field",
"occurrence",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L60-L66 |
197,775 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.match | public static function match ($reBody)
{
if (strpos($reBody, '#') !== false) {
$reBody = str_replace('#', '\#', $reBody);
}
$regexp = "#{$reBody}#D";
return function (Field $field) use ($regexp) {
return (bool)preg_match($regexp, $field->getShorthand());
... | php | public static function match ($reBody)
{
if (strpos($reBody, '#') !== false) {
$reBody = str_replace('#', '\#', $reBody);
}
$regexp = "#{$reBody}#D";
return function (Field $field) use ($regexp) {
return (bool)preg_match($regexp, $field->getShorthand());
... | [
"public",
"static",
"function",
"match",
"(",
"$",
"reBody",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"reBody",
",",
"'#'",
")",
"!==",
"false",
")",
"{",
"$",
"reBody",
"=",
"str_replace",
"(",
"'#'",
",",
"'\\#'",
",",
"$",
"reBody",
")",
";",
... | Return predicate that matches a field shorthand against a regular
expression.
@param string $reBody Body of regular expression
@return callback Predicate | [
"Return",
"predicate",
"that",
"matches",
"a",
"field",
"shorthand",
"against",
"a",
"regular",
"expression",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L75-L84 |
197,776 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.factory | public static function factory (array $field)
{
foreach (array('tag', 'occurrence', 'subfields') as $index) {
if (!array_key_exists($index, $field)) {
throw new InvalidArgumentException("Missing '{$index}' index in field array");
}
}
return new Field(... | php | public static function factory (array $field)
{
foreach (array('tag', 'occurrence', 'subfields') as $index) {
if (!array_key_exists($index, $field)) {
throw new InvalidArgumentException("Missing '{$index}' index in field array");
}
}
return new Field(... | [
"public",
"static",
"function",
"factory",
"(",
"array",
"$",
"field",
")",
"{",
"foreach",
"(",
"array",
"(",
"'tag'",
",",
"'occurrence'",
",",
"'subfields'",
")",
"as",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"index",
"... | Return a new field based on its array representation.
@throws InvalidArgumentException Missing `tag', `occurrene', or `subfields' index
@param array $field Array representation of a field
@return \HAB\Pica\Record\Field A shiny new field | [
"Return",
"a",
"new",
"field",
"based",
"on",
"its",
"array",
"representation",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L93-L103 |
197,777 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.setSubfields | public function setSubfields (array $subfields)
{
$this->_subfields = array();
foreach ($subfields as $subfield) {
$this->addSubfield($subfield);
}
} | php | public function setSubfields (array $subfields)
{
$this->_subfields = array();
foreach ($subfields as $subfield) {
$this->addSubfield($subfield);
}
} | [
"public",
"function",
"setSubfields",
"(",
"array",
"$",
"subfields",
")",
"{",
"$",
"this",
"->",
"_subfields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"subfields",
"as",
"$",
"subfield",
")",
"{",
"$",
"this",
"->",
"addSubfield",
"(",
"$",... | Set the field subfields.
Replaces the subfield list with subfields in argument.
@param array $subfields Subfields
@return void | [
"Set",
"the",
"field",
"subfields",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L174-L180 |
197,778 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.addSubfield | public function addSubfield (\HAB\Pica\Record\Subfield $subfield)
{
if (in_array($subfield, $this->getSubfields(), true)) {
throw new InvalidArgumentException("Cannot add subfield: Subfield already part of the subfield list");
}
$this->_subfields []= $subfield;
} | php | public function addSubfield (\HAB\Pica\Record\Subfield $subfield)
{
if (in_array($subfield, $this->getSubfields(), true)) {
throw new InvalidArgumentException("Cannot add subfield: Subfield already part of the subfield list");
}
$this->_subfields []= $subfield;
} | [
"public",
"function",
"addSubfield",
"(",
"\\",
"HAB",
"\\",
"Pica",
"\\",
"Record",
"\\",
"Subfield",
"$",
"subfield",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"subfield",
",",
"$",
"this",
"->",
"getSubfields",
"(",
")",
",",
"true",
")",
")",
"{... | Add a subfield to the end of the subfield list.
@throws InvalidArgumentException Subfield already present in subfield list
@param \HAB\Pica\Record\Subfield $subfield Subfield to add
@return void | [
"Add",
"a",
"subfield",
"to",
"the",
"end",
"of",
"the",
"subfield",
"list",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L189-L195 |
197,779 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.removeSubfield | public function removeSubfield (\HAB\Pica\Record\Subfield $subfield)
{
$index = array_search($subfield, $this->_subfields, true);
if ($index === false) {
throw new InvalidArgumentException("Cannot remove subfield: Subfield not part of the subfield list");
}
unset($this->... | php | public function removeSubfield (\HAB\Pica\Record\Subfield $subfield)
{
$index = array_search($subfield, $this->_subfields, true);
if ($index === false) {
throw new InvalidArgumentException("Cannot remove subfield: Subfield not part of the subfield list");
}
unset($this->... | [
"public",
"function",
"removeSubfield",
"(",
"\\",
"HAB",
"\\",
"Pica",
"\\",
"Record",
"\\",
"Subfield",
"$",
"subfield",
")",
"{",
"$",
"index",
"=",
"array_search",
"(",
"$",
"subfield",
",",
"$",
"this",
"->",
"_subfields",
",",
"true",
")",
";",
"... | Remove a subfield.
@throws InvalidArgumentException Subfield is not part of the subfield list
@param \HAB\Pica\Record\Subfield $subfield Subfield to delete
@return void | [
"Remove",
"a",
"subfield",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L204-L211 |
197,780 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.getSubfields | public function getSubfields ()
{
if (func_num_args() === 0) {
return $this->_subfields;
} else {
$selected = array();
$codes = array();
$subfields = $this->getSubfields();
array_walk($subfields, function ($value, $index) use (&$codes) { $... | php | public function getSubfields ()
{
if (func_num_args() === 0) {
return $this->_subfields;
} else {
$selected = array();
$codes = array();
$subfields = $this->getSubfields();
array_walk($subfields, function ($value, $index) use (&$codes) { $... | [
"public",
"function",
"getSubfields",
"(",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"===",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"_subfields",
";",
"}",
"else",
"{",
"$",
"selected",
"=",
"array",
"(",
")",
";",
"$",
"codes",
"=",
"arr... | Return the field's subfields.
Returns all subfields when called with no arguments.
Otherwise the returned array is constructed as follows:
Each argument is interpreted as a subfield code. The nth element of the
returned array maps to the nth argument in the function call and contains
NULL if the field does not have ... | [
"Return",
"the",
"field",
"s",
"subfields",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L228-L248 |
197,781 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.getNthSubfield | public function getNthSubfield ($code, $n)
{
$count = 0;
foreach ($this->getSubfields() as $subfield) {
if ($subfield->getCode() == $code) {
if ($count == $n) {
return $subfield;
}
$count++;
}
}
... | php | public function getNthSubfield ($code, $n)
{
$count = 0;
foreach ($this->getSubfields() as $subfield) {
if ($subfield->getCode() == $code) {
if ($count == $n) {
return $subfield;
}
$count++;
}
}
... | [
"public",
"function",
"getNthSubfield",
"(",
"$",
"code",
",",
"$",
"n",
")",
"{",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getSubfields",
"(",
")",
"as",
"$",
"subfield",
")",
"{",
"if",
"(",
"$",
"subfield",
"->",
"getCode... | Return the nth occurrence of a subfield with specified code.
@param string $code Subfield code
@param integer $n Zero-based subfield index
@return \HAB\Pica\record\Subfield|null The requested subfield or NULL if
none exists | [
"Return",
"the",
"nth",
"occurrence",
"of",
"a",
"subfield",
"with",
"specified",
"code",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L258-L270 |
197,782 | dmj/PicaRecord | src/HAB/Pica/Record/Field.php | Field.getSubfieldsWithCode | public function getSubfieldsWithCode ($code)
{
return array_filter($this->_subfields, function (Subfield $s) use ($code) { return $s->getCode() == $code; });
} | php | public function getSubfieldsWithCode ($code)
{
return array_filter($this->_subfields, function (Subfield $s) use ($code) { return $s->getCode() == $code; });
} | [
"public",
"function",
"getSubfieldsWithCode",
"(",
"$",
"code",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"_subfields",
",",
"function",
"(",
"Subfield",
"$",
"s",
")",
"use",
"(",
"$",
"code",
")",
"{",
"return",
"$",
"s",
"->",
"get... | Return all subfields with the specified code.
@param string $code Subfield code
@return array | [
"Return",
"all",
"subfields",
"with",
"the",
"specified",
"code",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/Field.php#L293-L296 |
197,783 | fridge-project/dbal | src/Fridge/DBAL/Schema/Check.php | Check.setDefinition | public function setDefinition($definition)
{
if ($definition instanceof Expression) {
$definition = (string) $definition;
}
$this->definition = $definition;
} | php | public function setDefinition($definition)
{
if ($definition instanceof Expression) {
$definition = (string) $definition;
}
$this->definition = $definition;
} | [
"public",
"function",
"setDefinition",
"(",
"$",
"definition",
")",
"{",
"if",
"(",
"$",
"definition",
"instanceof",
"Expression",
")",
"{",
"$",
"definition",
"=",
"(",
"string",
")",
"$",
"definition",
";",
"}",
"$",
"this",
"->",
"definition",
"=",
"$... | Set the definition.
@param string|\Fridge\DBAL\Query\Expression\Expression $definition The definition. | [
"Set",
"the",
"definition",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Schema/Check.php#L58-L65 |
197,784 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Client.php | Client.getDefaultAdapter | private function getDefaultAdapter()
{
if (extension_loaded('curl')) {
$this->parallelAdapter = new MultiAdapter($this->messageFactory);
$this->adapter = function_exists('curl_reset')
? new CurlAdapter($this->messageFactory)
: $this->parallelAdapter;
... | php | private function getDefaultAdapter()
{
if (extension_loaded('curl')) {
$this->parallelAdapter = new MultiAdapter($this->messageFactory);
$this->adapter = function_exists('curl_reset')
? new CurlAdapter($this->messageFactory)
: $this->parallelAdapter;
... | [
"private",
"function",
"getDefaultAdapter",
"(",
")",
"{",
"if",
"(",
"extension_loaded",
"(",
"'curl'",
")",
")",
"{",
"$",
"this",
"->",
"parallelAdapter",
"=",
"new",
"MultiAdapter",
"(",
"$",
"this",
"->",
"messageFactory",
")",
";",
"$",
"this",
"->",... | Create a default adapter to use based on the environment
@throws \RuntimeException | [
"Create",
"a",
"default",
"adapter",
"to",
"use",
"based",
"on",
"the",
"environment"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Client.php#L292-L311 |
197,785 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Client.php | Client.mergeDefaults | private function mergeDefaults(&$options)
{
// Merging optimization for when no headers are present
if (!isset($options['headers'])
|| !isset($this->defaults['headers'])) {
$options = array_replace_recursive($this->defaults, $options);
return null;
}
... | php | private function mergeDefaults(&$options)
{
// Merging optimization for when no headers are present
if (!isset($options['headers'])
|| !isset($this->defaults['headers'])) {
$options = array_replace_recursive($this->defaults, $options);
return null;
}
... | [
"private",
"function",
"mergeDefaults",
"(",
"&",
"$",
"options",
")",
"{",
"// Merging optimization for when no headers are present",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'headers'",
"]",
")",
"||",
"!",
"isset",
"(",
"$",
"this",
"->",
"defaul... | Merges default options into the array passed by reference and returns
an array of headers that need to be merged in after the request is
created.
@param array $options Options to modify by reference
@return array|null | [
"Merges",
"default",
"options",
"into",
"the",
"array",
"passed",
"by",
"reference",
"and",
"returns",
"an",
"array",
"of",
"headers",
"that",
"need",
"to",
"be",
"merged",
"in",
"after",
"the",
"request",
"is",
"created",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Client.php#L382-L396 |
197,786 | mrbase/Smesg | src/Smesg/Adapter/PhpStreamAdapter.php | PhpStreamAdapter.build | protected function build()
{
$content = '';
if (isset($this->parameters) && is_array($this->parameters)) {
$content = http_build_query($this->parameters);
}
if (isset($this->body)) {
$content = $this->body;
}
$content_type = 'application/x-www... | php | protected function build()
{
$content = '';
if (isset($this->parameters) && is_array($this->parameters)) {
$content = http_build_query($this->parameters);
}
if (isset($this->body)) {
$content = $this->body;
}
$content_type = 'application/x-www... | [
"protected",
"function",
"build",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"parameters",
")",
"&&",
"is_array",
"(",
"$",
"this",
"->",
"parameters",
")",
")",
"{",
"$",
"content",
"=",
"http_build_qu... | Ready the request for transport
@return PhpStreamAdapter | [
"Ready",
"the",
"request",
"for",
"transport"
] | e9692ed5915f5a9cd4dca0df875935a2c528e128 | https://github.com/mrbase/Smesg/blob/e9692ed5915f5a9cd4dca0df875935a2c528e128/src/Smesg/Adapter/PhpStreamAdapter.php#L159-L186 |
197,787 | mrbase/Smesg | src/Smesg/Adapter/PhpStreamAdapter.php | PhpStreamAdapter.sendRequest | protected function sendRequest()
{
$context = stream_context_create($this->request);
$response = trim(file_get_contents($this->endpoint, FALSE, $context));
$this->response = new Response($http_response_header, $response, $this->request);
return $this->response;
} | php | protected function sendRequest()
{
$context = stream_context_create($this->request);
$response = trim(file_get_contents($this->endpoint, FALSE, $context));
$this->response = new Response($http_response_header, $response, $this->request);
return $this->response;
} | [
"protected",
"function",
"sendRequest",
"(",
")",
"{",
"$",
"context",
"=",
"stream_context_create",
"(",
"$",
"this",
"->",
"request",
")",
";",
"$",
"response",
"=",
"trim",
"(",
"file_get_contents",
"(",
"$",
"this",
"->",
"endpoint",
",",
"FALSE",
",",... | Sends the actual request and returns the response.
@param array $request The stream_wraper options from wich to build the request
@return mixed | [
"Sends",
"the",
"actual",
"request",
"and",
"returns",
"the",
"response",
"."
] | e9692ed5915f5a9cd4dca0df875935a2c528e128 | https://github.com/mrbase/Smesg/blob/e9692ed5915f5a9cd4dca0df875935a2c528e128/src/Smesg/Adapter/PhpStreamAdapter.php#L195-L202 |
197,788 | geoffadams/bedrest-core | library/BedRest/Resource/Mapping/ResourceMetadata.php | ResourceMetadata.setSubResources | public function setSubResources(array $subResources)
{
foreach ($subResources as $name => $mapping) {
if (!is_string($name) || !is_array($mapping)) {
throw Exception::invalidSubResources($this->className);
}
if (!isset($mapping['fieldName'])) {
... | php | public function setSubResources(array $subResources)
{
foreach ($subResources as $name => $mapping) {
if (!is_string($name) || !is_array($mapping)) {
throw Exception::invalidSubResources($this->className);
}
if (!isset($mapping['fieldName'])) {
... | [
"public",
"function",
"setSubResources",
"(",
"array",
"$",
"subResources",
")",
"{",
"foreach",
"(",
"$",
"subResources",
"as",
"$",
"name",
"=>",
"$",
"mapping",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
"||",
"!",
"is_array",
"("... | Sets the set of allowable sub-resources.
@param array $subResources
@throws \BedRest\Resource\Mapping\Exception | [
"Sets",
"the",
"set",
"of",
"allowable",
"sub",
"-",
"resources",
"."
] | a77bf8b7492dfbfb720b201f7ec91a4f03417b5c | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Resource/Mapping/ResourceMetadata.php#L131-L148 |
197,789 | attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/MediaQuery.php | MediaQuery.format | public function format(array $response)
{
$car = '<br />';
$format = '';
foreach ($response as $media) {
$format .= '<div class="media">'
. '<img src="' . $media->getThumburl() . '"'
. ' width="' . $media->getThumbwidth() . '"'
. ' height="' . ... | php | public function format(array $response)
{
$car = '<br />';
$format = '';
foreach ($response as $media) {
$format .= '<div class="media">'
. '<img src="' . $media->getThumburl() . '"'
. ' width="' . $media->getThumbwidth() . '"'
. ' height="' . ... | [
"public",
"function",
"format",
"(",
"array",
"$",
"response",
")",
"{",
"$",
"car",
"=",
"'<br />'",
";",
"$",
"format",
"=",
"''",
";",
"foreach",
"(",
"$",
"response",
"as",
"$",
"media",
")",
"{",
"$",
"format",
".=",
"'<div class=\"media\">'",
"."... | format a media response as an HTML string
@param array $response
@return string | [
"format",
"a",
"media",
"response",
"as",
"an",
"HTML",
"string"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/MediaQuery.php#L109-L124 |
197,790 | ZFrapid/zfrapid-core | src/Task/AbstractTask.php | AbstractTask.filterCamelCaseToUnderscore | public function filterCamelCaseToUnderscore($text)
{
$text = StaticFilter::execute($text, 'Word\CamelCaseToUnderscore');
$text = StaticFilter::execute($text, 'StringToLower');
return $text;
} | php | public function filterCamelCaseToUnderscore($text)
{
$text = StaticFilter::execute($text, 'Word\CamelCaseToUnderscore');
$text = StaticFilter::execute($text, 'StringToLower');
return $text;
} | [
"public",
"function",
"filterCamelCaseToUnderscore",
"(",
"$",
"text",
")",
"{",
"$",
"text",
"=",
"StaticFilter",
"::",
"execute",
"(",
"$",
"text",
",",
"'Word\\CamelCaseToUnderscore'",
")",
";",
"$",
"text",
"=",
"StaticFilter",
"::",
"execute",
"(",
"$",
... | Filter camel case to underscore
@param string $text
@return string | [
"Filter",
"camel",
"case",
"to",
"underscore"
] | 8be56b82f9f5a687619a2b2175fcaa66ad3d2233 | https://github.com/ZFrapid/zfrapid-core/blob/8be56b82f9f5a687619a2b2175fcaa66ad3d2233/src/Task/AbstractTask.php#L86-L92 |
197,791 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.doLoadClassMetadata | protected function doLoadClassMetadata($type)
{
if (false === $this->classMetadataExists($type)) {
return null;
}
$className = $this->getClassNameForType($type);
return $this->mf->getMetadataFor($className);
} | php | protected function doLoadClassMetadata($type)
{
if (false === $this->classMetadataExists($type)) {
return null;
}
$className = $this->getClassNameForType($type);
return $this->mf->getMetadataFor($className);
} | [
"protected",
"function",
"doLoadClassMetadata",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"classMetadataExists",
"(",
"$",
"type",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"className",
"=",
"$",
"this",
"->",
"get... | Loads Doctrine ClassMetadata for an entity type.
@param string $type
@return ClassMetadata|null | [
"Loads",
"Doctrine",
"ClassMetadata",
"for",
"an",
"entity",
"type",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php#L64-L72 |
197,792 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.classMetadataExists | protected function classMetadataExists($type)
{
$className = $this->getClassNameForType($type);
try {
$metadata = $this->mf->getMetadataFor($className);
return true;
} catch (MappingException $e) {
return false;
}
return false === $this->sh... | php | protected function classMetadataExists($type)
{
$className = $this->getClassNameForType($type);
try {
$metadata = $this->mf->getMetadataFor($className);
return true;
} catch (MappingException $e) {
return false;
}
return false === $this->sh... | [
"protected",
"function",
"classMetadataExists",
"(",
"$",
"type",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"getClassNameForType",
"(",
"$",
"type",
")",
";",
"try",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"mf",
"->",
"getMetadataFor",
"(... | Determines if Doctrine ClassMetadata exists for an entity type.
@param string $type
@return bool | [
"Determines",
"if",
"Doctrine",
"ClassMetadata",
"exists",
"for",
"an",
"entity",
"type",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php#L80-L90 |
197,793 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.getTypeForClassName | protected function getTypeForClassName($className)
{
if (empty($this->rootNamespace)) {
return $className;
}
return $this->stripNamespace($this->rootNamespace, $className);
} | php | protected function getTypeForClassName($className)
{
if (empty($this->rootNamespace)) {
return $className;
}
return $this->stripNamespace($this->rootNamespace, $className);
} | [
"protected",
"function",
"getTypeForClassName",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"rootNamespace",
")",
")",
"{",
"return",
"$",
"className",
";",
"}",
"return",
"$",
"this",
"->",
"stripNamespace",
"(",
"$",
"t... | Gets the entity type from a Doctrine class name.
@param string $className
@return string | [
"Gets",
"the",
"entity",
"type",
"from",
"a",
"Doctrine",
"class",
"name",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php#L142-L148 |
197,794 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php | AbstractDoctrineDriver.getClassNameForType | protected function getClassNameForType($type)
{
if (!empty($this->rootNamespace) && strstr($type, $this->rootNamespace)) {
$type = $this->stripNamespace($this->rootNamespace, $type);
}
if (!empty($this->rootNamespace)) {
return sprintf('%s\\%s', $this->rootNamespace, ... | php | protected function getClassNameForType($type)
{
if (!empty($this->rootNamespace) && strstr($type, $this->rootNamespace)) {
$type = $this->stripNamespace($this->rootNamespace, $type);
}
if (!empty($this->rootNamespace)) {
return sprintf('%s\\%s', $this->rootNamespace, ... | [
"protected",
"function",
"getClassNameForType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"rootNamespace",
")",
"&&",
"strstr",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"rootNamespace",
")",
")",
"{",
"$",
"type",
... | Gets the Doctrine class name from an entity type.
@param string $type
@return string | [
"Gets",
"the",
"Doctrine",
"class",
"name",
"from",
"an",
"entity",
"type",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/Metadata/Driver/AbstractDoctrineDriver.php#L161-L170 |
197,795 | AnonymPHP/Anonym-Route | ActionDispatcher.php | ActionDispatcher.dispatch | public function dispatch($action = [], $group = null)
{
// convert string type to array
if (is_string($action)) {
$action = [
'_controller' => $action
];
}
// find and register route group
$this->registerGroup($group, $action);
... | php | public function dispatch($action = [], $group = null)
{
// convert string type to array
if (is_string($action)) {
$action = [
'_controller' => $action
];
}
// find and register route group
$this->registerGroup($group, $action);
... | [
"public",
"function",
"dispatch",
"(",
"$",
"action",
"=",
"[",
"]",
",",
"$",
"group",
"=",
"null",
")",
"{",
"// convert string type to array",
"if",
"(",
"is_string",
"(",
"$",
"action",
")",
")",
"{",
"$",
"action",
"=",
"[",
"'_controller'",
"=>",
... | Dispatch a action from array
@param array|string $action
@param array|null $group
@return mixed | [
"Dispatch",
"a",
"action",
"from",
"array"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/ActionDispatcher.php#L85-L123 |
197,796 | AnonymPHP/Anonym-Route | ActionDispatcher.php | ActionDispatcher.findMiddleware | protected function findMiddleware($action)
{
if (is_array($action) && isset($action['_middleware'])) {
return $action['_middleware'];
} elseif (isset($this->group['_middleware'])) {
return $this->group['_middleware'];
}
return false;
} | php | protected function findMiddleware($action)
{
if (is_array($action) && isset($action['_middleware'])) {
return $action['_middleware'];
} elseif (isset($this->group['_middleware'])) {
return $this->group['_middleware'];
}
return false;
} | [
"protected",
"function",
"findMiddleware",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"action",
")",
"&&",
"isset",
"(",
"$",
"action",
"[",
"'_middleware'",
"]",
")",
")",
"{",
"return",
"$",
"action",
"[",
"'_middleware'",
"]",
";... | find and return middleware
@param array $action
@return mixed | [
"find",
"and",
"return",
"middleware"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/ActionDispatcher.php#L131-L140 |
197,797 | AnonymPHP/Anonym-Route | ActionDispatcher.php | ActionDispatcher.findControllerAndMethod | protected function findControllerAndMethod(array $action)
{
if (isset($action['_controller']) || $action['uses']) {
$controller = isset($action['_controller']) ? $action['_controller'] : $action['uses'];
if (strstr($controller, ':')) {
list($controller, $method) = ex... | php | protected function findControllerAndMethod(array $action)
{
if (isset($action['_controller']) || $action['uses']) {
$controller = isset($action['_controller']) ? $action['_controller'] : $action['uses'];
if (strstr($controller, ':')) {
list($controller, $method) = ex... | [
"protected",
"function",
"findControllerAndMethod",
"(",
"array",
"$",
"action",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"action",
"[",
"'_controller'",
"]",
")",
"||",
"$",
"action",
"[",
"'uses'",
"]",
")",
"{",
"$",
"controller",
"=",
"isset",
"(",
... | find controller, method and namespace in action variable
@param array $action
@return array
@throws ControllerException | [
"find",
"controller",
"method",
"and",
"namespace",
"in",
"action",
"variable"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/ActionDispatcher.php#L160-L179 |
197,798 | AnonymPHP/Anonym-Route | ActionDispatcher.php | ActionDispatcher.findNamespaceInController | protected function findNamespaceInController(&$controller)
{
if (strstr($controller, '\\')) {
$namespace = explode('\\', $controller);
$controller = end($namespace);
$namespace = rtrim(join('\\', array_slice($namespace, 0, count($namespace) - 1)), '\\');
} else {
... | php | protected function findNamespaceInController(&$controller)
{
if (strstr($controller, '\\')) {
$namespace = explode('\\', $controller);
$controller = end($namespace);
$namespace = rtrim(join('\\', array_slice($namespace, 0, count($namespace) - 1)), '\\');
} else {
... | [
"protected",
"function",
"findNamespaceInController",
"(",
"&",
"$",
"controller",
")",
"{",
"if",
"(",
"strstr",
"(",
"$",
"controller",
",",
"'\\\\'",
")",
")",
"{",
"$",
"namespace",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"controller",
")",
";",
"$"... | find namespace in controller
@param string $controller
@return array|string | [
"find",
"namespace",
"in",
"controller"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/ActionDispatcher.php#L187-L198 |
197,799 | AnonymPHP/Anonym-Route | ActionDispatcher.php | ActionDispatcher.handleResponse | private function handleResponse($response)
{
if ($response instanceof View) {
$content = $response->render();
} elseif ($response instanceof Response) {
$content = $response->getContent();
} elseif ($response instanceof Request) {
$content = $response->ge... | php | private function handleResponse($response)
{
if ($response instanceof View) {
$content = $response->render();
} elseif ($response instanceof Response) {
$content = $response->getContent();
} elseif ($response instanceof Request) {
$content = $response->ge... | [
"private",
"function",
"handleResponse",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"response",
"instanceof",
"View",
")",
"{",
"$",
"content",
"=",
"$",
"response",
"->",
"render",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"response",
"instanceof",
... | Handler the controller returned value
@param ViewExecuteInterface|Response|Request|string $response
@return string|bool | [
"Handler",
"the",
"controller",
"returned",
"value"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/ActionDispatcher.php#L206-L222 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.