repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sellerlabs/injected | src/SellerLabs/Injected/InjectedTrait.php | InjectedTrait.mockDependencies | protected function mockDependencies()
{
$dependencies = $this->getDependencyMapping();
foreach ($dependencies as $interface => $memberName) {
if (!isset($this->$memberName)) {
$this->$memberName = Mockery::mock($interface);
}
// Update with the a... | php | protected function mockDependencies()
{
$dependencies = $this->getDependencyMapping();
foreach ($dependencies as $interface => $memberName) {
if (!isset($this->$memberName)) {
$this->$memberName = Mockery::mock($interface);
}
// Update with the a... | [
"protected",
"function",
"mockDependencies",
"(",
")",
"{",
"$",
"dependencies",
"=",
"$",
"this",
"->",
"getDependencyMapping",
"(",
")",
";",
"foreach",
"(",
"$",
"dependencies",
"as",
"$",
"interface",
"=>",
"$",
"memberName",
")",
"{",
"if",
"(",
"!",
... | Mock all dependencies that were not set yet
@return array
@throws Exception | [
"Mock",
"all",
"dependencies",
"that",
"were",
"not",
"set",
"yet"
] | 89f90334ccc392c67c79fb1eba258b34cfa9edd6 | https://github.com/sellerlabs/injected/blob/89f90334ccc392c67c79fb1eba258b34cfa9edd6/src/SellerLabs/Injected/InjectedTrait.php#L77-L91 | train |
hal-platform/hal-core | src/VersionControl/GitHub/GitHubDownloader.php | GitHubDownloader.download | public function download(Application $application, string $commit, string $targetFile): bool
{
$username = $application->parameter('gh.owner');
$repository = $application->parameter('gh.repo');
if (!$username || !$repository) {
throw new VCSException(self::ERR_APP_MISCONFIGURED)... | php | public function download(Application $application, string $commit, string $targetFile): bool
{
$username = $application->parameter('gh.owner');
$repository = $application->parameter('gh.repo');
if (!$username || !$repository) {
throw new VCSException(self::ERR_APP_MISCONFIGURED)... | [
"public",
"function",
"download",
"(",
"Application",
"$",
"application",
",",
"string",
"$",
"commit",
",",
"string",
"$",
"targetFile",
")",
":",
"bool",
"{",
"$",
"username",
"=",
"$",
"application",
"->",
"parameter",
"(",
"'gh.owner'",
")",
";",
"$",
... | Get content of archives in a repository
@link http://developer.github.com/v3/repos/contents/
@param Application $application
@param string $commit
@param string $targetFile
@throws VCSException
@return bool | [
"Get",
"content",
"of",
"archives",
"in",
"a",
"repository"
] | 30d456f8392fc873301ad4217d2ae90436c67090 | https://github.com/hal-platform/hal-core/blob/30d456f8392fc873301ad4217d2ae90436c67090/src/VersionControl/GitHub/GitHubDownloader.php#L47-L75 | train |
openclerk/users | src/UserOAuth2.php | UserOAuth2.auth | static function auth(ProviderInterface $provider) {
if (!require_get("code", false)) {
redirect($provider->getAuthorizationUrl());
return false;
} else {
// optionally check for abuse etc
if (!\Openclerk\Events::trigger('oauth2_auth', $provider)) {
throw new UserAuthenticationExc... | php | static function auth(ProviderInterface $provider) {
if (!require_get("code", false)) {
redirect($provider->getAuthorizationUrl());
return false;
} else {
// optionally check for abuse etc
if (!\Openclerk\Events::trigger('oauth2_auth', $provider)) {
throw new UserAuthenticationExc... | [
"static",
"function",
"auth",
"(",
"ProviderInterface",
"$",
"provider",
")",
"{",
"if",
"(",
"!",
"require_get",
"(",
"\"code\"",
",",
"false",
")",
")",
"{",
"redirect",
"(",
"$",
"provider",
"->",
"getAuthorizationUrl",
"(",
")",
")",
";",
"return",
"... | Execute OAuth2 authentication and return the user. | [
"Execute",
"OAuth2",
"authentication",
"and",
"return",
"the",
"user",
"."
] | 550c7610c154a2f6655ce65a2df377ccb207bc6d | https://github.com/openclerk/users/blob/550c7610c154a2f6655ce65a2df377ccb207bc6d/src/UserOAuth2.php#L66-L83 | train |
openclerk/users | src/UserOAuth2.php | UserOAuth2.removeIdentity | static function removeIdentity(\Db\Connection $db, User $user, $provider, $uid) {
if (!$user) {
throw new \InvalidArgumentException("No user provided.");
}
$q = $db->prepare("DELETE FROM user_oauth2_identities WHERE user_id=? AND provider=? AND uid=? LIMIT 1");
return $q->execute(array($user->get... | php | static function removeIdentity(\Db\Connection $db, User $user, $provider, $uid) {
if (!$user) {
throw new \InvalidArgumentException("No user provided.");
}
$q = $db->prepare("DELETE FROM user_oauth2_identities WHERE user_id=? AND provider=? AND uid=? LIMIT 1");
return $q->execute(array($user->get... | [
"static",
"function",
"removeIdentity",
"(",
"\\",
"Db",
"\\",
"Connection",
"$",
"db",
",",
"User",
"$",
"user",
",",
"$",
"provider",
",",
"$",
"uid",
")",
"{",
"if",
"(",
"!",
"$",
"user",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
... | Remove the given OAuth2 identity from the given user. | [
"Remove",
"the",
"given",
"OAuth2",
"identity",
"from",
"the",
"given",
"user",
"."
] | 550c7610c154a2f6655ce65a2df377ccb207bc6d | https://github.com/openclerk/users/blob/550c7610c154a2f6655ce65a2df377ccb207bc6d/src/UserOAuth2.php#L178-L186 | train |
PHPColibri/framework | Database/Query.php | Query.select | public static function select(array $columns = ['*'], ...$joinsColumns)
{
$query = new static(Query\Type::SELECT);
$query->columns['t'] = $columns;
$alias = 'j1';
foreach ($joinsColumns as $joinColumns) {
$query->columns[$alias] = (array)$joinColumns;
... | php | public static function select(array $columns = ['*'], ...$joinsColumns)
{
$query = new static(Query\Type::SELECT);
$query->columns['t'] = $columns;
$alias = 'j1';
foreach ($joinsColumns as $joinColumns) {
$query->columns[$alias] = (array)$joinColumns;
... | [
"public",
"static",
"function",
"select",
"(",
"array",
"$",
"columns",
"=",
"[",
"'*'",
"]",
",",
"...",
"$",
"joinsColumns",
")",
"{",
"$",
"query",
"=",
"new",
"static",
"(",
"Query",
"\\",
"Type",
"::",
"SELECT",
")",
";",
"$",
"query",
"->",
"... | Creates instance of select-type Query.
@param array $columns
@param array $joinsColumns
@return static | [
"Creates",
"instance",
"of",
"select",
"-",
"type",
"Query",
"."
] | 7e5b77141da5e5e7c63afc83592671321ac52f36 | https://github.com/PHPColibri/framework/blob/7e5b77141da5e5e7c63afc83592671321ac52f36/Database/Query.php#L68-L80 | train |
schpill/thin | src/Temp.php | Temp.getTmpPath | protected function getTmpPath()
{
$tmpDir = sys_get_temp_dir();
if (!empty($this->prefix)) {
$tmpDir .= DIRECTORY_SEPARATOR . $this->prefix;
}
$tmpDir .= DIRECTORY_SEPARATOR . uniqid('run-', true);
return $tmpDir;
} | php | protected function getTmpPath()
{
$tmpDir = sys_get_temp_dir();
if (!empty($this->prefix)) {
$tmpDir .= DIRECTORY_SEPARATOR . $this->prefix;
}
$tmpDir .= DIRECTORY_SEPARATOR . uniqid('run-', true);
return $tmpDir;
} | [
"protected",
"function",
"getTmpPath",
"(",
")",
"{",
"$",
"tmpDir",
"=",
"sys_get_temp_dir",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"prefix",
")",
")",
"{",
"$",
"tmpDir",
".=",
"DIRECTORY_SEPARATOR",
".",
"$",
"this",
"->",
... | Get path to temp directory
@return string | [
"Get",
"path",
"to",
"temp",
"directory"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Temp.php#L64-L75 | train |
schpill/thin | src/Temp.php | Temp.createTmpFile | public function createTmpFile($suffix = null, $preserve = false)
{
$this->initRunFolder();
$file = uniqid();
if ($suffix) {
$file .= '-' . $suffix;
}
$fileInfo = new \SplFileInfo($this->tmpRunFolder . DIRECTORY_SEPARATOR . $file);
... | php | public function createTmpFile($suffix = null, $preserve = false)
{
$this->initRunFolder();
$file = uniqid();
if ($suffix) {
$file .= '-' . $suffix;
}
$fileInfo = new \SplFileInfo($this->tmpRunFolder . DIRECTORY_SEPARATOR . $file);
... | [
"public",
"function",
"createTmpFile",
"(",
"$",
"suffix",
"=",
"null",
",",
"$",
"preserve",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"initRunFolder",
"(",
")",
";",
"$",
"file",
"=",
"uniqid",
"(",
")",
";",
"if",
"(",
"$",
"suffix",
")",
"{",
... | Create empty file in TMP directory
@param string $suffix filename suffix
@param bool $preserve
@throws \Exception
@return \SplFileInfo | [
"Create",
"empty",
"file",
"in",
"TMP",
"directory"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Temp.php#L95-L116 | train |
schpill/thin | src/Temp.php | Temp.createFile | public function createFile($fileName, $preserve = false)
{
$this->initRunFolder();
$fileInfo = new \SplFileInfo($this->tmpRunFolder . DIRECTORY_SEPARATOR . $fileName);
$this->filesystem->touch($fileInfo);
$this->files[] = array(
'file' => $file... | php | public function createFile($fileName, $preserve = false)
{
$this->initRunFolder();
$fileInfo = new \SplFileInfo($this->tmpRunFolder . DIRECTORY_SEPARATOR . $fileName);
$this->filesystem->touch($fileInfo);
$this->files[] = array(
'file' => $file... | [
"public",
"function",
"createFile",
"(",
"$",
"fileName",
",",
"$",
"preserve",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"initRunFolder",
"(",
")",
";",
"$",
"fileInfo",
"=",
"new",
"\\",
"SplFileInfo",
"(",
"$",
"this",
"->",
"tmpRunFolder",
".",
"D... | Creates named temporary file
@param $fileName
@param bool $preserve
@return \SplFileInfo
@throws \Exception | [
"Creates",
"named",
"temporary",
"file"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Temp.php#L126-L142 | train |
Vyki/mva-dbm | src/Mva/Dbm/Query/QueryProcessor.php | QueryProcessor.processUpdate | public function processUpdate(array $data)
{
$set = $this->formatCmd('set');
$data[$set] = isset($data[$set]) ? $data[$set] : [];
foreach ($data as $index => $value) {
if (substr($index, 0, 1) !== $this->cmd) {
$data[$set][$index] = $value;
unset($data[$index]);
continue;
}
$ckey = subst... | php | public function processUpdate(array $data)
{
$set = $this->formatCmd('set');
$data[$set] = isset($data[$set]) ? $data[$set] : [];
foreach ($data as $index => $value) {
if (substr($index, 0, 1) !== $this->cmd) {
$data[$set][$index] = $value;
unset($data[$index]);
continue;
}
$ckey = subst... | [
"public",
"function",
"processUpdate",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"set",
"=",
"$",
"this",
"->",
"formatCmd",
"(",
"'set'",
")",
";",
"$",
"data",
"[",
"$",
"set",
"]",
"=",
"isset",
"(",
"$",
"data",
"[",
"$",
"set",
"]",
")",
"... | Process update data
@param array ['a' => 1, 'b%s' => 2, '$set' => ['c%i' => '3'], '$unset' => ['d', 'e'], ...]
@return array ['$set' => ['a' => 1, 'b' => '2', 'c' => 3], '$unset' => ['d' => '', 'e' => ''], ...] | [
"Process",
"update",
"data"
] | 587d840e0620331a9f63a6867f3400a293a9d3c6 | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Query/QueryProcessor.php#L98-L128 | train |
Vyki/mva-dbm | src/Mva/Dbm/Query/QueryProcessor.php | QueryProcessor.processCondition | public function processCondition(array $conditions, $depth = 0)
{
if (empty($conditions)) {
return [];
}
$parsed = [];
foreach ($conditions as $key => $condition) {
if (is_int($key)) {
if ($depth > 0 && is_array($condition)) {
throw new InvalidArgumentException('Too deep sets of condition!');
... | php | public function processCondition(array $conditions, $depth = 0)
{
if (empty($conditions)) {
return [];
}
$parsed = [];
foreach ($conditions as $key => $condition) {
if (is_int($key)) {
if ($depth > 0 && is_array($condition)) {
throw new InvalidArgumentException('Too deep sets of condition!');
... | [
"public",
"function",
"processCondition",
"(",
"array",
"$",
"conditions",
",",
"$",
"depth",
"=",
"0",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"conditions",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"parsed",
"=",
"[",
"]",
";",
"foreach",... | Process sets of conditions and merges them by AND operator
@param array in format [['a' => 1], ['b IN' => [1, 2]], [...]] or ['a' => 1, 'b IN' => [1, 2], ...]
@param array single condition ['a' => 1] or multiple condition ['$and' => ['a' => 1, 'b' => ['$in' => [1, 2]]], ...] | [
"Process",
"sets",
"of",
"conditions",
"and",
"merges",
"them",
"by",
"AND",
"operator"
] | 587d840e0620331a9f63a6867f3400a293a9d3c6 | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Query/QueryProcessor.php#L135-L159 | train |
Vyki/mva-dbm | src/Mva/Dbm/Query/QueryProcessor.php | QueryProcessor.parseCondition | private function parseCondition($condition, $parameters = [])
{
if (strpos($condition, ' ')) {
$match = preg_match('~^
(.+)\s ## identifier
(
(?:\$\w+) | ## $mongoOperator
(?:[A-Z]+(?:_[A-Z]+)*) | ## NAMED_OPERATOR or
(?:[\<\>\!]?\=|\>|\<\>?) ... | php | private function parseCondition($condition, $parameters = [])
{
if (strpos($condition, ' ')) {
$match = preg_match('~^
(.+)\s ## identifier
(
(?:\$\w+) | ## $mongoOperator
(?:[A-Z]+(?:_[A-Z]+)*) | ## NAMED_OPERATOR or
(?:[\<\>\!]?\=|\>|\<\>?) ... | [
"private",
"function",
"parseCondition",
"(",
"$",
"condition",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"condition",
",",
"' '",
")",
")",
"{",
"$",
"match",
"=",
"preg_match",
"(",
"'~^\n\t\t\t\t(.+)\\s ... | Parses single condition
@param $condition string
@param $parameters mixed
@throws InvalidArgumentException | [
"Parses",
"single",
"condition"
] | 587d840e0620331a9f63a6867f3400a293a9d3c6 | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Query/QueryProcessor.php#L167-L219 | train |
Vyki/mva-dbm | src/Mva/Dbm/Query/QueryProcessor.php | QueryProcessor.parseDeepCondition | private function parseDeepCondition(array $parameters, $toArray = FALSE)
{
$opcond = [];
foreach ($parameters as $key => $param) {
$ccond = is_int($key) ? $this->parseCondition($param) : $this->parseCondition($key, $param);
if ($toArray) {
$opcond[] = $ccond;
} else {
reset($ccond);
$opcond[... | php | private function parseDeepCondition(array $parameters, $toArray = FALSE)
{
$opcond = [];
foreach ($parameters as $key => $param) {
$ccond = is_int($key) ? $this->parseCondition($param) : $this->parseCondition($key, $param);
if ($toArray) {
$opcond[] = $ccond;
} else {
reset($ccond);
$opcond[... | [
"private",
"function",
"parseDeepCondition",
"(",
"array",
"$",
"parameters",
",",
"$",
"toArray",
"=",
"FALSE",
")",
"{",
"$",
"opcond",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"key",
"=>",
"$",
"param",
")",
"{",
"$",
"cco... | Parses inner conditions
@param array
@param bool indicates that output should be list | [
"Parses",
"inner",
"conditions"
] | 587d840e0620331a9f63a6867f3400a293a9d3c6 | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Query/QueryProcessor.php#L226-L242 | train |
Vyki/mva-dbm | src/Mva/Dbm/Query/QueryProcessor.php | QueryProcessor.processData | public function processData(array $data, $expand = FALSE)
{
$return = [];
foreach ($data as $key => $item) {
list($modified, $key) = $this->doubledModifier($key, '%');
if ($modified && preg_match('#^(.*)%(\w+(?:\[\])?)$#', $key, $parts)) {
$key = $parts[1];
$item = $this->processModifier($parts[2],... | php | public function processData(array $data, $expand = FALSE)
{
$return = [];
foreach ($data as $key => $item) {
list($modified, $key) = $this->doubledModifier($key, '%');
if ($modified && preg_match('#^(.*)%(\w+(?:\[\])?)$#', $key, $parts)) {
$key = $parts[1];
$item = $this->processModifier($parts[2],... | [
"public",
"function",
"processData",
"(",
"array",
"$",
"data",
",",
"$",
"expand",
"=",
"FALSE",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"list",
"(",
"$",
"modified... | Formats data types by modifiers
@param array ['name' => 'roman', 'age%i' => '27', 'numbers%i[]' => ['1', 2, 2.3]]
@return array | [
"Formats",
"data",
"types",
"by",
"modifiers"
] | 587d840e0620331a9f63a6867f3400a293a9d3c6 | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Query/QueryProcessor.php#L294-L318 | train |
Vyki/mva-dbm | src/Mva/Dbm/Query/QueryProcessor.php | QueryProcessor.processLikeOperator | protected function processLikeOperator($value)
{
$value = preg_quote($value);
$value = substr($value, 0, 1) === '%' ? (substr($value, -1, 1) === '%' ? substr($value, 1, -1) : substr($value, 1) . '$') : (substr($value, -1, 1) === '%' ? '^' . substr($value, 0, -1) : $value);
return '/' . $value . '/i';
} | php | protected function processLikeOperator($value)
{
$value = preg_quote($value);
$value = substr($value, 0, 1) === '%' ? (substr($value, -1, 1) === '%' ? substr($value, 1, -1) : substr($value, 1) . '$') : (substr($value, -1, 1) === '%' ? '^' . substr($value, 0, -1) : $value);
return '/' . $value . '/i';
} | [
"protected",
"function",
"processLikeOperator",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"preg_quote",
"(",
"$",
"value",
")",
";",
"$",
"value",
"=",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"1",
")",
"===",
"'%'",
"?",
"(",
"substr",
"(... | Converts SQL LIKE to MongoRegex
@param string value with wildcard - %test, test%, %test% | [
"Converts",
"SQL",
"LIKE",
"to",
"MongoRegex"
] | 587d840e0620331a9f63a6867f3400a293a9d3c6 | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Query/QueryProcessor.php#L419-L425 | train |
Vyki/mva-dbm | src/Mva/Dbm/Query/QueryProcessor.php | QueryProcessor.processArray | protected function processArray($modifier, array &$values)
{
foreach ($values as &$item) {
$item = $this->processModifier($modifier, $item);
}
} | php | protected function processArray($modifier, array &$values)
{
foreach ($values as &$item) {
$item = $this->processModifier($modifier, $item);
}
} | [
"protected",
"function",
"processArray",
"(",
"$",
"modifier",
",",
"array",
"&",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"&",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"processModifier",
"(",
"$",
"modifier",
... | Applies modifier to the inner array via reference
@param string modifier
@param array sets of values | [
"Applies",
"modifier",
"to",
"the",
"inner",
"array",
"via",
"reference"
] | 587d840e0620331a9f63a6867f3400a293a9d3c6 | https://github.com/Vyki/mva-dbm/blob/587d840e0620331a9f63a6867f3400a293a9d3c6/src/Mva/Dbm/Query/QueryProcessor.php#L433-L438 | train |
dotkernel/dot-session | src/ConfigProvider.php | ConfigProvider.getDependencyConfig | public function getDependencyConfig(): array
{
return [
'aliases' => [
SessionManager::class => ManagerInterface::class,
],
'factories' => [
ConfigInterface::class => SessionConfigFactory::class,
ManagerInterface::class => S... | php | public function getDependencyConfig(): array
{
return [
'aliases' => [
SessionManager::class => ManagerInterface::class,
],
'factories' => [
ConfigInterface::class => SessionConfigFactory::class,
ManagerInterface::class => S... | [
"public",
"function",
"getDependencyConfig",
"(",
")",
":",
"array",
"{",
"return",
"[",
"'aliases'",
"=>",
"[",
"SessionManager",
"::",
"class",
"=>",
"ManagerInterface",
"::",
"class",
",",
"]",
",",
"'factories'",
"=>",
"[",
"ConfigInterface",
"::",
"class"... | Merge our config with Zend Session dependencies
@return array | [
"Merge",
"our",
"config",
"with",
"Zend",
"Session",
"dependencies"
] | 9808072c807a9cc708a0cae5475a29f70e3f450e | https://github.com/dotkernel/dot-session/blob/9808072c807a9cc708a0cae5475a29f70e3f450e/src/ConfigProvider.php#L70-L88 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.& | public function & SetView (\MvcCore\IView & $view) {
parent::SetView($view);
if (self::$appRoot === NULL) self::$appRoot = $this->request->GetAppRoot();
if (self::$basePath === NULL) self::$basePath = $this->request->GetBasePath();
if (self::$scriptName === NULL) self::$scriptName = ltrim($this->request->GetSc... | php | public function & SetView (\MvcCore\IView & $view) {
parent::SetView($view);
if (self::$appRoot === NULL) self::$appRoot = $this->request->GetAppRoot();
if (self::$basePath === NULL) self::$basePath = $this->request->GetBasePath();
if (self::$scriptName === NULL) self::$scriptName = ltrim($this->request->GetSc... | [
"public",
"function",
"&",
"SetView",
"(",
"\\",
"MvcCore",
"\\",
"IView",
"&",
"$",
"view",
")",
"{",
"parent",
"::",
"SetView",
"(",
"$",
"view",
")",
";",
"if",
"(",
"self",
"::",
"$",
"appRoot",
"===",
"NULL",
")",
"self",
"::",
"$",
"appRoot",... | Insert a \MvcCore\View in each helper constructing
@param \MvcCore\View|\MvcCore\IView $view
@return \MvcCore\Ext\Views\Helpers\AbstractHelper | [
"Insert",
"a",
"\\",
"MvcCore",
"\\",
"View",
"in",
"each",
"helper",
"constructing"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L150-L184 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.CssJsFileUrl | public function CssJsFileUrl ($path = '') {
$result = '';
if (self::$assetsUrlCompletion) {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: 'PHAR', 'SFU', 'PHP_STRICT_PACKAGE', 'PHP_PRESERVE_PACKAGE', 'PHP_PRESERVE_HDD'
$result = $this->view->AssetUrl($path);
} else {
// for \MvcCore\... | php | public function CssJsFileUrl ($path = '') {
$result = '';
if (self::$assetsUrlCompletion) {
// for \MvcCore\Application::GetInstance()->GetCompiled() equal to: 'PHAR', 'SFU', 'PHP_STRICT_PACKAGE', 'PHP_PRESERVE_PACKAGE', 'PHP_PRESERVE_HDD'
$result = $this->view->AssetUrl($path);
} else {
// for \MvcCore\... | [
"public",
"function",
"CssJsFileUrl",
"(",
"$",
"path",
"=",
"''",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"self",
"::",
"$",
"assetsUrlCompletion",
")",
"{",
"// for \\MvcCore\\Application::GetInstance()->GetCompiled() equal to: 'PHAR', 'SFU', 'PHP_STRICT_P... | Completes CSS or JS file url.
If application compile mode is in development state or packed in strict HDD mode,
there is generated standard URL with \MvcCore\Request->GetBasePath() (current app location)
plus called $path param. Because those application compile modes presume by default,
that those files are placed be... | [
"Completes",
"CSS",
"or",
"JS",
"file",
"url",
"."
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L301-L311 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.filterItemsForNotPossibleMinifiedAndPossibleMinifiedItems | protected function filterItemsForNotPossibleMinifiedAndPossibleMinifiedItems ($items) {
$itemsToRenderMinimized = [];
$itemsToRenderSeparately = []; // some configurations is not possible to render together and minimized
// go for every item to complete existing combinations in attributes
foreach ($items as & $... | php | protected function filterItemsForNotPossibleMinifiedAndPossibleMinifiedItems ($items) {
$itemsToRenderMinimized = [];
$itemsToRenderSeparately = []; // some configurations is not possible to render together and minimized
// go for every item to complete existing combinations in attributes
foreach ($items as & $... | [
"protected",
"function",
"filterItemsForNotPossibleMinifiedAndPossibleMinifiedItems",
"(",
"$",
"items",
")",
"{",
"$",
"itemsToRenderMinimized",
"=",
"[",
"]",
";",
"$",
"itemsToRenderSeparately",
"=",
"[",
"]",
";",
"// some configurations is not possible to render together... | Look for every item to render if there is any 'doNotMinify' record to render item separately
@param array $items
@return array[] $itemsToRenderMinimized $itemsToRenderSeparately | [
"Look",
"for",
"every",
"item",
"to",
"render",
"if",
"there",
"is",
"any",
"doNotMinify",
"record",
"to",
"render",
"item",
"separately"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L326-L354 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.addFileModificationImprintToHrefUrl | protected function addFileModificationImprintToHrefUrl ($url, $path) {
$questionMarkPos = strpos($url, '?');
$separator = ($questionMarkPos === FALSE) ? '?' : '&';
$strippedUrl = $questionMarkPos !== FALSE ? substr($url, $questionMarkPos) : $url ;
$srcPath = $this->getAppRoot() . substr($strippedUrl, strlen(sel... | php | protected function addFileModificationImprintToHrefUrl ($url, $path) {
$questionMarkPos = strpos($url, '?');
$separator = ($questionMarkPos === FALSE) ? '?' : '&';
$strippedUrl = $questionMarkPos !== FALSE ? substr($url, $questionMarkPos) : $url ;
$srcPath = $this->getAppRoot() . substr($strippedUrl, strlen(sel... | [
"protected",
"function",
"addFileModificationImprintToHrefUrl",
"(",
"$",
"url",
",",
"$",
"path",
")",
"{",
"$",
"questionMarkPos",
"=",
"strpos",
"(",
"$",
"url",
",",
"'?'",
")",
";",
"$",
"separator",
"=",
"(",
"$",
"questionMarkPos",
"===",
"FALSE",
"... | Add to href URL file modification param by original file
@param string $url
@param string $path
@return string | [
"Add",
"to",
"href",
"URL",
"file",
"modification",
"param",
"by",
"original",
"file"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L362-L377 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.getIndentString | protected function getIndentString($indent = 0) {
$indentStr = '';
if (is_numeric($indent)) {
$indInt = intval($indent);
if ($indInt > 0) {
$i = 0;
while ($i < $indInt) {
$indentStr .= "\t";
$i += 1;
}
}
} else if (is_string($indent)) {
$indentStr = $indent;
}
return $indentS... | php | protected function getIndentString($indent = 0) {
$indentStr = '';
if (is_numeric($indent)) {
$indInt = intval($indent);
if ($indInt > 0) {
$i = 0;
while ($i < $indInt) {
$indentStr .= "\t";
$i += 1;
}
}
} else if (is_string($indent)) {
$indentStr = $indent;
}
return $indentS... | [
"protected",
"function",
"getIndentString",
"(",
"$",
"indent",
"=",
"0",
")",
"{",
"$",
"indentStr",
"=",
"''",
";",
"if",
"(",
"is_numeric",
"(",
"$",
"indent",
")",
")",
"{",
"$",
"indInt",
"=",
"intval",
"(",
"$",
"indent",
")",
";",
"if",
"(",... | Get indent string
@param string|int $indent
@return string | [
"Get",
"indent",
"string"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L384-L399 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.getTmpDir | protected function getTmpDir() {
if (!self::$tmpDir) {
$tmpDir = $this->getAppRoot() . self::$globalOptions['tmpDir'];
if (!\MvcCore\Application::GetInstance()->GetCompiled()) {
if (!is_dir($tmpDir)) mkdir($tmpDir, 0777, TRUE);
if (!is_writable($tmpDir)) {
try {
@chmod($tmpDir, 0777);
} ... | php | protected function getTmpDir() {
if (!self::$tmpDir) {
$tmpDir = $this->getAppRoot() . self::$globalOptions['tmpDir'];
if (!\MvcCore\Application::GetInstance()->GetCompiled()) {
if (!is_dir($tmpDir)) mkdir($tmpDir, 0777, TRUE);
if (!is_writable($tmpDir)) {
try {
@chmod($tmpDir, 0777);
} ... | [
"protected",
"function",
"getTmpDir",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"tmpDir",
")",
"{",
"$",
"tmpDir",
"=",
"$",
"this",
"->",
"getAppRoot",
"(",
")",
".",
"self",
"::",
"$",
"globalOptions",
"[",
"'tmpDir'",
"]",
";",
"if",
"("... | Return and store application document root from controller view request object
@throws \Exception
@return string | [
"Return",
"and",
"store",
"application",
"document",
"root",
"from",
"controller",
"view",
"request",
"object"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L414-L431 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.saveFileContent | protected function saveFileContent ($fullPath = '', & $fileContent = '') {
$toolClass = \MvcCore\Application::GetInstance()->GetToolClass();
$toolClass::SingleProcessWrite($fullPath, $fileContent);
@chmod($fullPath, 0766);
} | php | protected function saveFileContent ($fullPath = '', & $fileContent = '') {
$toolClass = \MvcCore\Application::GetInstance()->GetToolClass();
$toolClass::SingleProcessWrite($fullPath, $fileContent);
@chmod($fullPath, 0766);
} | [
"protected",
"function",
"saveFileContent",
"(",
"$",
"fullPath",
"=",
"''",
",",
"&",
"$",
"fileContent",
"=",
"''",
")",
"{",
"$",
"toolClass",
"=",
"\\",
"MvcCore",
"\\",
"Application",
"::",
"GetInstance",
"(",
")",
"->",
"GetToolClass",
"(",
")",
";... | Save atomically file content in full path by 1 MB to not overflow any memory limits
@param string $fullPath
@param string $fileContent
@return void | [
"Save",
"atomically",
"file",
"content",
"in",
"full",
"path",
"by",
"1",
"MB",
"to",
"not",
"overflow",
"any",
"memory",
"limits"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L439-L443 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.log | protected function log ($msg = '', $logType = 'debug') {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::Log($msg, $logType);
}
} | php | protected function log ($msg = '', $logType = 'debug') {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::Log($msg, $logType);
}
} | [
"protected",
"function",
"log",
"(",
"$",
"msg",
"=",
"''",
",",
"$",
"logType",
"=",
"'debug'",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"loggingAndExceptions",
")",
"{",
"\\",
"MvcCore",
"\\",
"Debug",
"::",
"Log",
"(",
"$",
"msg",
",",
"$",
"logT... | Log any render messages with optional log file name
@param string $msg
@param string $logType
@return void | [
"Log",
"any",
"render",
"messages",
"with",
"optional",
"log",
"file",
"name"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L451-L455 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.warning | protected function warning ($msg) {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::BarDump('[' . get_class($this) . '] ' . $msg, \MvcCore\IDebug::DEBUG);
}
} | php | protected function warning ($msg) {
if (self::$loggingAndExceptions) {
\MvcCore\Debug::BarDump('[' . get_class($this) . '] ' . $msg, \MvcCore\IDebug::DEBUG);
}
} | [
"protected",
"function",
"warning",
"(",
"$",
"msg",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"loggingAndExceptions",
")",
"{",
"\\",
"MvcCore",
"\\",
"Debug",
"::",
"BarDump",
"(",
"'['",
".",
"get_class",
"(",
"$",
"this",
")",
".",
"'] '",
".",
"$"... | Throw exception with given message with actual helper class name before
@param string $msg
@return void | [
"Throw",
"exception",
"with",
"given",
"message",
"with",
"actual",
"helper",
"class",
"name",
"before"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L474-L478 | train |
mvccore/ext-view-helper-assets | src/MvcCore/Ext/Views/Helpers/Assets.php | Assets.getTmpFileFullPathByPartFilesInfo | protected function getTmpFileFullPathByPartFilesInfo ($filesGroupInfo = [], $minify = FALSE, $extension = '') {
return implode('', [
$this->getTmpDir(),
'/' . ($minify ? 'minified' : 'rendered') . '_' . $extension . '_',
md5(implode(',', $filesGroupInfo) . '_' . $minify),
'.' . $extension
]);
} | php | protected function getTmpFileFullPathByPartFilesInfo ($filesGroupInfo = [], $minify = FALSE, $extension = '') {
return implode('', [
$this->getTmpDir(),
'/' . ($minify ? 'minified' : 'rendered') . '_' . $extension . '_',
md5(implode(',', $filesGroupInfo) . '_' . $minify),
'.' . $extension
]);
} | [
"protected",
"function",
"getTmpFileFullPathByPartFilesInfo",
"(",
"$",
"filesGroupInfo",
"=",
"[",
"]",
",",
"$",
"minify",
"=",
"FALSE",
",",
"$",
"extension",
"=",
"''",
")",
"{",
"return",
"implode",
"(",
"''",
",",
"[",
"$",
"this",
"->",
"getTmpDir",... | Complete items group tmp directory file name by group source files info
@param array $filesGroupInfo
@param boolean $minify
@return string | [
"Complete",
"items",
"group",
"tmp",
"directory",
"file",
"name",
"by",
"group",
"source",
"files",
"info"
] | 5672575aca6d63f2340c912f9b9754bbb896d97b | https://github.com/mvccore/ext-view-helper-assets/blob/5672575aca6d63f2340c912f9b9754bbb896d97b/src/MvcCore/Ext/Views/Helpers/Assets.php#L497-L504 | train |
schpill/thin | src/Multithread.php | Multithread.run | public function run($jobs)
{
$lenTab = count($jobs);
for ($i = 0 ; $i < $lenTab ; $i++) {
$jobID = rand(0, 100);
while (count($this->currentJobs) >= $this->maxProcesses) {
sleep($this->sleepTime);
}
$lau... | php | public function run($jobs)
{
$lenTab = count($jobs);
for ($i = 0 ; $i < $lenTab ; $i++) {
$jobID = rand(0, 100);
while (count($this->currentJobs) >= $this->maxProcesses) {
sleep($this->sleepTime);
}
$lau... | [
"public",
"function",
"run",
"(",
"$",
"jobs",
")",
"{",
"$",
"lenTab",
"=",
"count",
"(",
"$",
"jobs",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"lenTab",
";",
"$",
"i",
"++",
")",
"{",
"$",
"jobID",
"=",
"rand",
... | Run the Daemon | [
"Run",
"the",
"Daemon"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Multithread.php#L24-L39 | train |
schpill/thin | src/Multithread.php | Multithread.launchJob | protected function launchJob($jobID)
{
$pid = pcntl_fork();
if ($pid == -1) {
error_log('Could not launch new job, exiting');
echo 'Could not launch new job, exiting';
return false;
} else if ($pid) {
$this->curr... | php | protected function launchJob($jobID)
{
$pid = pcntl_fork();
if ($pid == -1) {
error_log('Could not launch new job, exiting');
echo 'Could not launch new job, exiting';
return false;
} else if ($pid) {
$this->curr... | [
"protected",
"function",
"launchJob",
"(",
"$",
"jobID",
")",
"{",
"$",
"pid",
"=",
"pcntl_fork",
"(",
")",
";",
"if",
"(",
"$",
"pid",
"==",
"-",
"1",
")",
"{",
"error_log",
"(",
"'Could not launch new job, exiting'",
")",
";",
"echo",
"'Could not launch ... | Launch a job from the job queue | [
"Launch",
"a",
"job",
"from",
"the",
"job",
"queue"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Multithread.php#L83-L101 | train |
rzajac/php-test-helper | src/Database/Driver/MySQL.php | MySQL.getTableNames | protected function getTableNames(): array
{
$dbName = $this->config[DbItf::DB_CFG_DATABASE];
$resp = $this->dbRunQuery(sprintf('SHOW FULL TABLES FROM `%s`', $dbName));
$tableAndViewNames = [];
while ($row = $resp->fetch_assoc()) {
$tableAndViewNames[] = array_change_key_... | php | protected function getTableNames(): array
{
$dbName = $this->config[DbItf::DB_CFG_DATABASE];
$resp = $this->dbRunQuery(sprintf('SHOW FULL TABLES FROM `%s`', $dbName));
$tableAndViewNames = [];
while ($row = $resp->fetch_assoc()) {
$tableAndViewNames[] = array_change_key_... | [
"protected",
"function",
"getTableNames",
"(",
")",
":",
"array",
"{",
"$",
"dbName",
"=",
"$",
"this",
"->",
"config",
"[",
"DbItf",
"::",
"DB_CFG_DATABASE",
"]",
";",
"$",
"resp",
"=",
"$",
"this",
"->",
"dbRunQuery",
"(",
"sprintf",
"(",
"'SHOW FULL T... | Return table and view names form the database.
@throws DatabaseEx
@return array | [
"Return",
"table",
"and",
"view",
"names",
"form",
"the",
"database",
"."
] | 37280e9ff639b25cf9413909cc080c5d8deb311c | https://github.com/rzajac/php-test-helper/blob/37280e9ff639b25cf9413909cc080c5d8deb311c/src/Database/Driver/MySQL.php#L164-L175 | train |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.slashDirname | public static function slashDirname($dirname = null)
{
if (is_null($dirname) || empty($dirname)) {
return '';
}
return rtrim($dirname, '/ '.DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
} | php | public static function slashDirname($dirname = null)
{
if (is_null($dirname) || empty($dirname)) {
return '';
}
return rtrim($dirname, '/ '.DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
} | [
"public",
"static",
"function",
"slashDirname",
"(",
"$",
"dirname",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"dirname",
")",
"||",
"empty",
"(",
"$",
"dirname",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"rtrim",
"(",
"$",
"d... | Get a dirname with one and only trailing slash
@param string $dirname
@return string | [
"Get",
"a",
"dirname",
"with",
"one",
"and",
"only",
"trailing",
"slash"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L43-L49 | train |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.isGitClone | public static function isGitClone($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
$dir_path = self::slashDirname($path).'.git';
return (bool) (file_exists($dir_path) && is_dir($dir_path));
} | php | public static function isGitClone($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
$dir_path = self::slashDirname($path).'.git';
return (bool) (file_exists($dir_path) && is_dir($dir_path));
} | [
"public",
"static",
"function",
"isGitClone",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"path",
")",
"||",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"dir_path",
"=",
"self",
"::",
"... | Test if a path seems to be a git clone
@param string $path
@return bool | [
"Test",
"if",
"a",
"path",
"seems",
"to",
"be",
"a",
"git",
"clone"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L57-L64 | train |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.isDotPath | public static function isDotPath($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
return (bool) ('.'===substr(basename($path), 0, 1));
} | php | public static function isDotPath($path = null)
{
if (is_null($path) || empty($path)) {
return false;
}
return (bool) ('.'===substr(basename($path), 0, 1));
} | [
"public",
"static",
"function",
"isDotPath",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"path",
")",
"||",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"bool",
")",
"(",
"'.'"... | Test if a filename seems to have a dot as first character
@param string $path
@return bool | [
"Test",
"if",
"a",
"filename",
"seems",
"to",
"have",
"a",
"dot",
"as",
"first",
"character"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L72-L78 | train |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.remove | public static function remove($path, $parent = true)
{
$ok = true;
if (true===self::ensureExists($path)) {
if (false===@is_dir($path) || true===is_link($path)) {
return @unlink($path);
}
$iterator = new \RecursiveIteratorIterator(
n... | php | public static function remove($path, $parent = true)
{
$ok = true;
if (true===self::ensureExists($path)) {
if (false===@is_dir($path) || true===is_link($path)) {
return @unlink($path);
}
$iterator = new \RecursiveIteratorIterator(
n... | [
"public",
"static",
"function",
"remove",
"(",
"$",
"path",
",",
"$",
"parent",
"=",
"true",
")",
"{",
"$",
"ok",
"=",
"true",
";",
"if",
"(",
"true",
"===",
"self",
"::",
"ensureExists",
"(",
"$",
"path",
")",
")",
"{",
"if",
"(",
"false",
"==="... | Try to remove a path
@param string $path
@param bool $parent
@return bool | [
"Try",
"to",
"remove",
"a",
"path"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L117-L144 | train |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.parseIni | public static function parseIni($path)
{
if (true===@file_exists($path)) {
$data = parse_ini_file($path, true);
if ($data && !empty($data)) {
return $data;
}
}
return false;
} | php | public static function parseIni($path)
{
if (true===@file_exists($path)) {
$data = parse_ini_file($path, true);
if ($data && !empty($data)) {
return $data;
}
}
return false;
} | [
"public",
"static",
"function",
"parseIni",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"true",
"===",
"@",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"data",
"=",
"parse_ini_file",
"(",
"$",
"path",
",",
"true",
")",
";",
"if",
"(",
"$",
"d... | Read and parse a INI content file
@param $path
@return array|bool | [
"Read",
"and",
"parse",
"a",
"INI",
"content",
"file"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L152-L161 | train |
wdbo/webdocbook | src/WebDocBook/Filesystem/Helper.php | Helper.parseJson | public static function parseJson($path)
{
if (true===@file_exists($path)) {
$ctt = file_get_contents($path);
if ($ctt!==false) {
$data = json_decode($ctt, true);
if ($data && !empty($data)) {
return $data;
}
... | php | public static function parseJson($path)
{
if (true===@file_exists($path)) {
$ctt = file_get_contents($path);
if ($ctt!==false) {
$data = json_decode($ctt, true);
if ($data && !empty($data)) {
return $data;
}
... | [
"public",
"static",
"function",
"parseJson",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"true",
"===",
"@",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"ctt",
"=",
"file_get_contents",
"(",
"$",
"path",
")",
";",
"if",
"(",
"$",
"ctt",
"!==",
... | Read and parse a JSON content file
@param $path
@return bool|mixed | [
"Read",
"and",
"parse",
"a",
"JSON",
"content",
"file"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Filesystem/Helper.php#L169-L181 | train |
PhoxPHP/Glider | src/Console/Command/Migration.php | Migration.create | protected function create(Array $arguments=[])
{
$migrationsDirectory = $this->cmd->getConfigOpt('migrations_storage');
$templateTags = [];
$migrationName = $this->cmd->question('Migration filename?');
$filename = trim($migrationName);
$path = $migrationsDirectory . '/' . $filename . '.php';
i... | php | protected function create(Array $arguments=[])
{
$migrationsDirectory = $this->cmd->getConfigOpt('migrations_storage');
$templateTags = [];
$migrationName = $this->cmd->question('Migration filename?');
$filename = trim($migrationName);
$path = $migrationsDirectory . '/' . $filename . '.php';
i... | [
"protected",
"function",
"create",
"(",
"Array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"migrationsDirectory",
"=",
"$",
"this",
"->",
"cmd",
"->",
"getConfigOpt",
"(",
"'migrations_storage'",
")",
";",
"$",
"templateTags",
"=",
"[",
"]",
";",
"... | Creates a migration.
@param $arguments <Array>
@access protected
@return <void> | [
"Creates",
"a",
"migration",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Console/Command/Migration.php#L145-L177 | train |
PhoxPHP/Glider | src/Console/Command/Migration.php | Migration.processMigration | protected function processMigration(Array $arguments)
{
$migrationClass = $arguments[0];
$migration = Model::findByclass_name($migrationClass);
if (!$migration) {
throw new MigrationClassNotFoundException(
sprintf(
'Migration class [%s] does not exist',
$migrationClass
)
);
... | php | protected function processMigration(Array $arguments)
{
$migrationClass = $arguments[0];
$migration = Model::findByclass_name($migrationClass);
if (!$migration) {
throw new MigrationClassNotFoundException(
sprintf(
'Migration class [%s] does not exist',
$migrationClass
)
);
... | [
"protected",
"function",
"processMigration",
"(",
"Array",
"$",
"arguments",
")",
"{",
"$",
"migrationClass",
"=",
"$",
"arguments",
"[",
"0",
"]",
";",
"$",
"migration",
"=",
"Model",
"::",
"findByclass_name",
"(",
"$",
"migrationClass",
")",
";",
"if",
"... | Processes a specific migration.
@param $arguments <Array>
@access protected
@return <void> | [
"Processes",
"a",
"specific",
"migration",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Console/Command/Migration.php#L199-L218 | train |
iwyg/xmlconf | src/Thapp/XmlConf/Cache/Cache.php | Cache.getCacheModificationDate | protected function getCacheModificationDate($file)
{
$storageKey = $this->getStorageKey() . '.lasmodified';
$filemtime = filemtime($file);
$lastmodified = $this->storage->has($storageKey) ? $this->storage->get($storageKey) : $filemtime - 1;
return array($filemtime, $lastmodifie... | php | protected function getCacheModificationDate($file)
{
$storageKey = $this->getStorageKey() . '.lasmodified';
$filemtime = filemtime($file);
$lastmodified = $this->storage->has($storageKey) ? $this->storage->get($storageKey) : $filemtime - 1;
return array($filemtime, $lastmodifie... | [
"protected",
"function",
"getCacheModificationDate",
"(",
"$",
"file",
")",
"{",
"$",
"storageKey",
"=",
"$",
"this",
"->",
"getStorageKey",
"(",
")",
".",
"'.lasmodified'",
";",
"$",
"filemtime",
"=",
"filemtime",
"(",
"$",
"file",
")",
";",
"$",
"lastmod... | Returns the modification date of a given file and the the
date of the last cache write.
@access protected
@return array | [
"Returns",
"the",
"modification",
"date",
"of",
"a",
"given",
"file",
"and",
"the",
"the",
"date",
"of",
"the",
"last",
"cache",
"write",
"."
] | 1d8a657073f3fd46dacfb6bf5d173f9d5283661b | https://github.com/iwyg/xmlconf/blob/1d8a657073f3fd46dacfb6bf5d173f9d5283661b/src/Thapp/XmlConf/Cache/Cache.php#L97-L104 | train |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.create | public function create(array $metadata = array())
{
if (is_file($this->file)) {
return false;
}
$this->createTemporaryFolder();
file_put_contents($this->file, $this->placeholderContent($metadata), LOCK_EX);
return true;
} | php | public function create(array $metadata = array())
{
if (is_file($this->file)) {
return false;
}
$this->createTemporaryFolder();
file_put_contents($this->file, $this->placeholderContent($metadata), LOCK_EX);
return true;
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"metadata",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"this",
"->",
"file",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"createTemporaryFolder",
"(",
")",
... | Creates the file. It creates a placeholder file with some metadata on it and will
create all the temporary files and folders.
Writing without creating first will throw an exception. Creating twice will not throw an
exception but will return false. That means it is OK to call `create()` before calling
`write()`. Ideall... | [
"Creates",
"the",
"file",
".",
"It",
"creates",
"a",
"placeholder",
"file",
"with",
"some",
"metadata",
"on",
"it",
"and",
"will",
"create",
"all",
"the",
"temporary",
"files",
"and",
"folders",
"."
] | 13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L72-L82 | train |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.createTemporaryFolder | protected function createTemporaryFolder()
{
Util::mkdir($this->blocks);
Util::mkdir(dirname($this->file));
file_put_contents($this->tmp . '.lock', '', LOCK_EX);
} | php | protected function createTemporaryFolder()
{
Util::mkdir($this->blocks);
Util::mkdir(dirname($this->file));
file_put_contents($this->tmp . '.lock', '', LOCK_EX);
} | [
"protected",
"function",
"createTemporaryFolder",
"(",
")",
"{",
"Util",
"::",
"mkdir",
"(",
"$",
"this",
"->",
"blocks",
")",
";",
"Util",
"::",
"mkdir",
"(",
"dirname",
"(",
"$",
"this",
"->",
"file",
")",
")",
";",
"file_put_contents",
"(",
"$",
"th... | Creates the needed temporary files and folders in prepartion for
the file writer. | [
"Creates",
"the",
"needed",
"temporary",
"files",
"and",
"folders",
"in",
"prepartion",
"for",
"the",
"file",
"writer",
"."
] | 13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L88-L93 | train |
crodas/ConcurrentFileWriter | src/ConcurrentFileWriter/ConcurrentFileWriter.php | ConcurrentFileWriter.getWroteBlocks | public function getWroteBlocks()
{
if (!is_dir($this->blocks)) {
throw new RuntimeException("cannot obtain the blocks ({$this->blocks})");
}
$files = array_filter(array_map(function($file) {
$basename = basename($file);
if (!is_numeric($basename)) {
... | php | public function getWroteBlocks()
{
if (!is_dir($this->blocks)) {
throw new RuntimeException("cannot obtain the blocks ({$this->blocks})");
}
$files = array_filter(array_map(function($file) {
$basename = basename($file);
if (!is_numeric($basename)) {
... | [
"public",
"function",
"getWroteBlocks",
"(",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"blocks",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"cannot obtain the blocks ({$this->blocks})\"",
")",
";",
"}",
"$",
"files",
"=",
"ar... | Returns all the wrote blocks of files. All the blocks are sorted by their offset.
@return array | [
"Returns",
"all",
"the",
"wrote",
"blocks",
"of",
"files",
".",
"All",
"the",
"blocks",
"are",
"sorted",
"by",
"their",
"offset",
"."
] | 13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a | https://github.com/crodas/ConcurrentFileWriter/blob/13f88d8c2daf5fe9c70f8be6aeb3d862cd2a5e5a/src/ConcurrentFileWriter/ConcurrentFileWriter.php#L139-L161 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.