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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1HappyPlace/ansi-terminal | src/ANSI/Color/Color.php | Color.next | public function next() {
// if this is a valid name
if ($this->isValid()) {
// find it on the index of colors
$colorNames = Colors::getW3CIndex();
// get the position of the name in the color index
$pos = array_search($this->name,$colorNames);
... | php | public function next() {
// if this is a valid name
if ($this->isValid()) {
// find it on the index of colors
$colorNames = Colors::getW3CIndex();
// get the position of the name in the color index
$pos = array_search($this->name,$colorNames);
... | [
"public",
"function",
"next",
"(",
")",
"{",
"// if this is a valid name",
"if",
"(",
"$",
"this",
"->",
"isValid",
"(",
")",
")",
"{",
"// find it on the index of colors",
"$",
"colorNames",
"=",
"Colors",
"::",
"getW3CIndex",
"(",
")",
";",
"// get the positio... | Return the next name on the main Colors name index
@return string | null - return null if this color is not valid, otherwise, return the next name or
the first name, if this is the last name | [
"Return",
"the",
"next",
"name",
"on",
"the",
"main",
"Colors",
"name",
"index"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Color/Color.php#L540-L583 | train |
gplcart/ga_report | controllers/Settings.php | Settings.editSettings | public function editSettings()
{
$this->setTitleEditSettings();
$this->setBreadcrumbEditSettings();
$this->setData('stores', $this->store->getList());
$this->setData('credentials', $this->getCredentialSettings());
$this->setData('handlers', $this->report_model->getHandlers()... | php | public function editSettings()
{
$this->setTitleEditSettings();
$this->setBreadcrumbEditSettings();
$this->setData('stores', $this->store->getList());
$this->setData('credentials', $this->getCredentialSettings());
$this->setData('handlers', $this->report_model->getHandlers()... | [
"public",
"function",
"editSettings",
"(",
")",
"{",
"$",
"this",
"->",
"setTitleEditSettings",
"(",
")",
";",
"$",
"this",
"->",
"setBreadcrumbEditSettings",
"(",
")",
";",
"$",
"this",
"->",
"setData",
"(",
"'stores'",
",",
"$",
"this",
"->",
"store",
... | Route page callback
Displays the module settings page | [
"Route",
"page",
"callback",
"Displays",
"the",
"module",
"settings",
"page"
] | 856a480e394bb3feaeea4785ccccad56abaac499 | https://github.com/gplcart/ga_report/blob/856a480e394bb3feaeea4785ccccad56abaac499/controllers/Settings.php#L42-L54 | train |
gplcart/ga_report | controllers/Settings.php | Settings.validateGaProfileSettings | protected function validateGaProfileSettings()
{
$profiles = $this->getSubmitted('ga_profile_id', array());
if (empty($profiles)) {
$this->setError('ga_profile_id', $this->text('Profile ID is required'));
return false;
}
$stores = $this->store->getList();
... | php | protected function validateGaProfileSettings()
{
$profiles = $this->getSubmitted('ga_profile_id', array());
if (empty($profiles)) {
$this->setError('ga_profile_id', $this->text('Profile ID is required'));
return false;
}
$stores = $this->store->getList();
... | [
"protected",
"function",
"validateGaProfileSettings",
"(",
")",
"{",
"$",
"profiles",
"=",
"$",
"this",
"->",
"getSubmitted",
"(",
"'ga_profile_id'",
",",
"array",
"(",
")",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"profiles",
")",
")",
"{",
"$",
"this",
... | Validates Google Analytics profiles | [
"Validates",
"Google",
"Analytics",
"profiles"
] | 856a480e394bb3feaeea4785ccccad56abaac499 | https://github.com/gplcart/ga_report/blob/856a480e394bb3feaeea4785ccccad56abaac499/controllers/Settings.php#L136-L161 | train |
eliasis-framework/complement | src/Traits/ComplementImport.php | ComplementImport.install | public function install()
{
if (! isset($this->complement['installation-files'])) {
self::$errors[] = [
'message' => $this->complement['path']['root']
];
return false;
}
$this->deleteDirectory();
$this->changeState();
$in... | php | public function install()
{
if (! isset($this->complement['installation-files'])) {
self::$errors[] = [
'message' => $this->complement['path']['root']
];
return false;
}
$this->deleteDirectory();
$this->changeState();
$in... | [
"public",
"function",
"install",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"complement",
"[",
"'installation-files'",
"]",
")",
")",
"{",
"self",
"::",
"$",
"errors",
"[",
"]",
"=",
"[",
"'message'",
"=>",
"$",
"this",
"->",
"... | Complement installation handler.
@uses \Eliasis\Complement\Traits\ComplementState->changeState()
@uses \Eliasis\Complement\Complement->$complement
@return bool | [
"Complement",
"installation",
"handler",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementImport.php#L67-L98 | train |
eliasis-framework/complement | src/Traits/ComplementImport.php | ComplementImport.remove | public function remove()
{
$this->setState('uninstall');
$this->changeState();
if (! $this->deleteDirectory()) {
$this->setState('uninstalled');
}
return true;
} | php | public function remove()
{
$this->setState('uninstall');
$this->changeState();
if (! $this->deleteDirectory()) {
$this->setState('uninstalled');
}
return true;
} | [
"public",
"function",
"remove",
"(",
")",
"{",
"$",
"this",
"->",
"setState",
"(",
"'uninstall'",
")",
";",
"$",
"this",
"->",
"changeState",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"deleteDirectory",
"(",
")",
")",
"{",
"$",
"this",
"->"... | Delete complement.
@uses \Eliasis\Complement\Traits\ComplementState->getState()
@uses \Eliasis\Complement\Traits\ComplementState->setState()
@uses \Eliasis\Complement\Traits\ComplementState->changeState()
@return bool true | [
"Delete",
"complement",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementImport.php#L109-L120 | train |
eliasis-framework/complement | src/Traits/ComplementImport.php | ComplementImport.deleteDirectory | private function deleteDirectory()
{
$path = $this->complement['path']['root'];
if (! $this->validateRoute($path)) {
return false;
}
$isUninstall = ($this->getState() === 'inactive');
if (! File::deleteDirRecursively($path) && $isUninstall) {
$type ... | php | private function deleteDirectory()
{
$path = $this->complement['path']['root'];
if (! $this->validateRoute($path)) {
return false;
}
$isUninstall = ($this->getState() === 'inactive');
if (! File::deleteDirRecursively($path) && $isUninstall) {
$type ... | [
"private",
"function",
"deleteDirectory",
"(",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"complement",
"[",
"'path'",
"]",
"[",
"'root'",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"validateRoute",
"(",
"$",
"path",
")",
")",
"{",
"return",
... | Delete complement directory.
@uses \Eliasis\Complement\Complement->$complement
@uses \Eliasis\Complement\Complement::$errors
@uses \Eliasis\Complement\Traits\ComplementHandler::getType()
@uses \Josantonius\File\File::deleteDirRecursively()
@return string → complement state | [
"Delete",
"complement",
"directory",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementImport.php#L132-L153 | train |
eliasis-framework/complement | src/Traits/ComplementImport.php | ComplementImport.installComplement | private function installComplement($complement, $path, $slug, $root = true)
{
$path = ($root) ? $path : $path . key($complement) . '/';
if (! $this->validateRoute($path)) {
return false;
}
if (! File::createDir($path)) {
$msg = "The directory exists or could... | php | private function installComplement($complement, $path, $slug, $root = true)
{
$path = ($root) ? $path : $path . key($complement) . '/';
if (! $this->validateRoute($path)) {
return false;
}
if (! File::createDir($path)) {
$msg = "The directory exists or could... | [
"private",
"function",
"installComplement",
"(",
"$",
"complement",
",",
"$",
"path",
",",
"$",
"slug",
",",
"$",
"root",
"=",
"true",
")",
"{",
"$",
"path",
"=",
"(",
"$",
"root",
")",
"?",
"$",
"path",
":",
"$",
"path",
".",
"key",
"(",
"$",
... | Install complement.
@param array $complement → complement files
@param string $path → complement path
@param string $slug → complement slug
@param bool $root → root folder
@uses \Eliasis\Framework\App::COMPLEMENT_URL()
@uses \Eliasis\Complement\Traits\ComplementHandler::getType()
@uses \Josantoni... | [
"Install",
"complement",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementImport.php#L169-L205 | train |
eliasis-framework/complement | src/Traits/ComplementImport.php | ComplementImport.saveRemoteFile | private function saveRemoteFile($fileUrl, $filePath)
{
if (! $file = @file_get_contents($fileUrl)) {
self::$errors[] = [
'message' => 'Error to download file: ' . $fileUrl
];
return false;
}
if (! @file_put_contents($filePath, $file)) {
... | php | private function saveRemoteFile($fileUrl, $filePath)
{
if (! $file = @file_get_contents($fileUrl)) {
self::$errors[] = [
'message' => 'Error to download file: ' . $fileUrl
];
return false;
}
if (! @file_put_contents($filePath, $file)) {
... | [
"private",
"function",
"saveRemoteFile",
"(",
"$",
"fileUrl",
",",
"$",
"filePath",
")",
"{",
"if",
"(",
"!",
"$",
"file",
"=",
"@",
"file_get_contents",
"(",
"$",
"fileUrl",
")",
")",
"{",
"self",
"::",
"$",
"errors",
"[",
"]",
"=",
"[",
"'message'"... | Save remote file.
@param string $fileUrl → remote file url
@param string $filePath → file path to save
@return bool | [
"Save",
"remote",
"file",
"."
] | d50e92cf01600ff4573bf1761c312069044748c3 | https://github.com/eliasis-framework/complement/blob/d50e92cf01600ff4573bf1761c312069044748c3/src/Traits/ComplementImport.php#L215-L234 | train |
modulusphp/security | Remember.php | Remember.boot | public function boot()
{
if (!is_dir(Remember::$tokensDir)) {
mkdir(Remember::$tokensDir, 0777, true);
}
$this->hasTokens();
$this->configure();
$this->start();
} | php | public function boot()
{
if (!is_dir(Remember::$tokensDir)) {
mkdir(Remember::$tokensDir, 0777, true);
}
$this->hasTokens();
$this->configure();
$this->start();
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"Remember",
"::",
"$",
"tokensDir",
")",
")",
"{",
"mkdir",
"(",
"Remember",
"::",
"$",
"tokensDir",
",",
"0777",
",",
"true",
")",
";",
"}",
"$",
"this",
"->",
"hasTokens"... | Boot remember me component
@return void | [
"Boot",
"remember",
"me",
"component"
] | 7a0b7f7a23f682588a3582b810d61266f7c14567 | https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Remember.php#L46-L55 | train |
modulusphp/security | Remember.php | Remember.hasTokens | public function hasTokens()
{
if (!is_writable(Remember::$tokensDir) || !is_dir(Remember::$tokensDir)) {
$tokens = Remember::$tokensDir;
return $this->exception("'$tokens' does not exist or is not writable by the web server");
}
} | php | public function hasTokens()
{
if (!is_writable(Remember::$tokensDir) || !is_dir(Remember::$tokensDir)) {
$tokens = Remember::$tokensDir;
return $this->exception("'$tokens' does not exist or is not writable by the web server");
}
} | [
"public",
"function",
"hasTokens",
"(",
")",
"{",
"if",
"(",
"!",
"is_writable",
"(",
"Remember",
"::",
"$",
"tokensDir",
")",
"||",
"!",
"is_dir",
"(",
"Remember",
"::",
"$",
"tokensDir",
")",
")",
"{",
"$",
"tokens",
"=",
"Remember",
"::",
"$",
"to... | Check if the tokens directory exists or is writable
@return void | [
"Check",
"if",
"the",
"tokens",
"directory",
"exists",
"or",
"is",
"writable"
] | 7a0b7f7a23f682588a3582b810d61266f7c14567 | https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Remember.php#L62-L68 | train |
modulusphp/security | Remember.php | Remember.configure | public function configure()
{
$tokenGenerator = new DefaultToken(94, DefaultToken::FORMAT_BASE64);
$expire = strtotime(Remember::$expire, 0);
$cookie = new PHPCookie("application_session", $expire, "/", "", true, true);
Remember::$storage = new FileStorage(Remember::$tokensDir);
Remember::$remem... | php | public function configure()
{
$tokenGenerator = new DefaultToken(94, DefaultToken::FORMAT_BASE64);
$expire = strtotime(Remember::$expire, 0);
$cookie = new PHPCookie("application_session", $expire, "/", "", true, true);
Remember::$storage = new FileStorage(Remember::$tokensDir);
Remember::$remem... | [
"public",
"function",
"configure",
"(",
")",
"{",
"$",
"tokenGenerator",
"=",
"new",
"DefaultToken",
"(",
"94",
",",
"DefaultToken",
"::",
"FORMAT_BASE64",
")",
";",
"$",
"expire",
"=",
"strtotime",
"(",
"Remember",
"::",
"$",
"expire",
",",
"0",
")",
";... | Configure remember me
@return void | [
"Configure",
"remember",
"me"
] | 7a0b7f7a23f682588a3582b810d61266f7c14567 | https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Remember.php#L75-L84 | train |
modulusphp/security | Remember.php | Remember.start | public function start()
{
$rememberMe = Remember::$rememberMe;
$loginResult = $rememberMe->login();
if ($loginResult->isSuccess()) {
$_SESSION['_uas'] = $loginResult->getCredential();
$_SESSION['remembered_by_cookie'] = true;
return;
}
if ($loginResult->hasPossibleManipulation(... | php | public function start()
{
$rememberMe = Remember::$rememberMe;
$loginResult = $rememberMe->login();
if ($loginResult->isSuccess()) {
$_SESSION['_uas'] = $loginResult->getCredential();
$_SESSION['remembered_by_cookie'] = true;
return;
}
if ($loginResult->hasPossibleManipulation(... | [
"public",
"function",
"start",
"(",
")",
"{",
"$",
"rememberMe",
"=",
"Remember",
"::",
"$",
"rememberMe",
";",
"$",
"loginResult",
"=",
"$",
"rememberMe",
"->",
"login",
"(",
")",
";",
"if",
"(",
"$",
"loginResult",
"->",
"isSuccess",
"(",
")",
")",
... | Start remember me
@return void | [
"Start",
"remember",
"me"
] | 7a0b7f7a23f682588a3582b810d61266f7c14567 | https://github.com/modulusphp/security/blob/7a0b7f7a23f682588a3582b810d61266f7c14567/Remember.php#L91-L115 | train |
MosaicPHP/Common | src/Arr.php | Arr.unwrap | public static function unwrap(array $input, $default = null)
{
if (count($input) > 1) {
return $input;
}
return ! empty($input) ? current($input) : $default;
} | php | public static function unwrap(array $input, $default = null)
{
if (count($input) > 1) {
return $input;
}
return ! empty($input) ? current($input) : $default;
} | [
"public",
"static",
"function",
"unwrap",
"(",
"array",
"$",
"input",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"input",
")",
">",
"1",
")",
"{",
"return",
"$",
"input",
";",
"}",
"return",
"!",
"empty",
"(",
"$",
... | Unwraps a single item array into the item. If the array contains more than one item, it will be returned as-is.
A default value can be provided, and will be used when an empty array is given.
@param array $input
@param mixed|null $default
@return mixed | [
"Unwraps",
"a",
"single",
"item",
"array",
"into",
"the",
"item",
".",
"If",
"the",
"array",
"contains",
"more",
"than",
"one",
"item",
"it",
"will",
"be",
"returned",
"as",
"-",
"is",
".",
"A",
"default",
"value",
"can",
"be",
"provided",
"and",
"will... | f8b347f11401fb34e32f66ca3cec0cd9e743c0d4 | https://github.com/MosaicPHP/Common/blob/f8b347f11401fb34e32f66ca3cec0cd9e743c0d4/src/Arr.php#L32-L39 | train |
PenoaksDev/Milky-Framework | src/Milky/Binding/ServiceResolver.php | ServiceResolver.resolveClass | public function resolveClass( $class )
{
if ( !is_string( $class ) )
throw new ResolverException( "Class must be a string" );
// Check if a class has been mapped to a key
if ( array_key_exists( $class, $this->classAlias ) )
try
{
return $this->resolve( null, $this->classAlias[$class] );
}
cat... | php | public function resolveClass( $class )
{
if ( !is_string( $class ) )
throw new ResolverException( "Class must be a string" );
// Check if a class has been mapped to a key
if ( array_key_exists( $class, $this->classAlias ) )
try
{
return $this->resolve( null, $this->classAlias[$class] );
}
cat... | [
"public",
"function",
"resolveClass",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"class",
")",
")",
"throw",
"new",
"ResolverException",
"(",
"\"Class must be a string\"",
")",
";",
"// Check if a class has been mapped to a key",
"if",
"("... | Called the a class needs resolving.
Each registered resolver will be called for this purpose, the first to return non-false will succeed.
@param string $class | [
"Called",
"the",
"a",
"class",
"needs",
"resolving",
".",
"Each",
"registered",
"resolver",
"will",
"be",
"called",
"for",
"this",
"purpose",
"the",
"first",
"to",
"return",
"non",
"-",
"false",
"will",
"succeed",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Binding/ServiceResolver.php#L159-L183 | train |
gilbertsoft/typo3-gscacheconfig | Classes/Extension/Configurator.php | Configurator.additionalConfiguration | public static function additionalConfiguration($extensionKey)
{
// Get the configuration
$extConf = self::getSanitizedExtConf($extensionKey);
if ($extConf['cachingConfigEnable'] == 1) {
self::handleCachingConfiguration($extConf);
}
} | php | public static function additionalConfiguration($extensionKey)
{
// Get the configuration
$extConf = self::getSanitizedExtConf($extensionKey);
if ($extConf['cachingConfigEnable'] == 1) {
self::handleCachingConfiguration($extConf);
}
} | [
"public",
"static",
"function",
"additionalConfiguration",
"(",
"$",
"extensionKey",
")",
"{",
"// Get the configuration",
"$",
"extConf",
"=",
"self",
"::",
"getSanitizedExtConf",
"(",
"$",
"extensionKey",
")",
";",
"if",
"(",
"$",
"extConf",
"[",
"'cachingConfig... | Called from additionalConfiguration.php.
@param string $extensionKey Extension key
@return void | [
"Called",
"from",
"additionalConfiguration",
".",
"php",
"."
] | dc6c3131b9e3d714b6c79c802c09ef1d165296d1 | https://github.com/gilbertsoft/typo3-gscacheconfig/blob/dc6c3131b9e3d714b6c79c802c09ef1d165296d1/Classes/Extension/Configurator.php#L177-L185 | train |
polusphp/polus | src/Traits/ResponseTrait.php | ResponseTrait.setResponseBody | public function setResponseBody($data)
{
if (!is_string($data)) {
$data = json_encode($data, \JSON_PRETTY_PRINT);
}
$this->response->getBody()->write($data);
return $this;
} | php | public function setResponseBody($data)
{
if (!is_string($data)) {
$data = json_encode($data, \JSON_PRETTY_PRINT);
}
$this->response->getBody()->write($data);
return $this;
} | [
"public",
"function",
"setResponseBody",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"json_encode",
"(",
"$",
"data",
",",
"\\",
"JSON_PRETTY_PRINT",
")",
";",
"}",
"$",
"this",
"->",
... | Set response body if is not string json_encode
@param mixed $data
@return $this | [
"Set",
"response",
"body",
"if",
"is",
"not",
"string",
"json_encode"
] | 2de7c13e6ceaa8104a48172957cdb166e64bf342 | https://github.com/polusphp/polus/blob/2de7c13e6ceaa8104a48172957cdb166e64bf342/src/Traits/ResponseTrait.php#L35-L42 | train |
olobu/olobu | fs/upload.php | Upload._curl | protected function _curl($data, $url)
{
//kalo tidak ada library curl, langsung gagal
if ( ! function_exists("curl_init")) {
return array(
"output" => NULL,
"status" => -1
);
}
$data_string = json_encode($data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($cur... | php | protected function _curl($data, $url)
{
//kalo tidak ada library curl, langsung gagal
if ( ! function_exists("curl_init")) {
return array(
"output" => NULL,
"status" => -1
);
}
$data_string = json_encode($data);
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($cur... | [
"protected",
"function",
"_curl",
"(",
"$",
"data",
",",
"$",
"url",
")",
"{",
"//kalo tidak ada library curl, langsung gagal",
"if",
"(",
"!",
"function_exists",
"(",
"\"curl_init\"",
")",
")",
"{",
"return",
"array",
"(",
"\"output\"",
"=>",
"NULL",
",",
"\"... | request berupa CURL | [
"request",
"berupa",
"CURL"
] | 05bea2bff63d3e38b458fb42e8f07f1d850ae211 | https://github.com/olobu/olobu/blob/05bea2bff63d3e38b458fb42e8f07f1d850ae211/fs/upload.php#L308-L343 | train |
AndyDune/DateTime | src/DateTime.php | DateTime.setAction | public function setAction(AbstractAction $action) : DateTime
{
$this->action = $action;
$this->action->setDateTime($this);
return $this;
} | php | public function setAction(AbstractAction $action) : DateTime
{
$this->action = $action;
$this->action->setDateTime($this);
return $this;
} | [
"public",
"function",
"setAction",
"(",
"AbstractAction",
"$",
"action",
")",
":",
"DateTime",
"{",
"$",
"this",
"->",
"action",
"=",
"$",
"action",
";",
"$",
"this",
"->",
"action",
"->",
"setDateTime",
"(",
"$",
"this",
")",
";",
"return",
"$",
"this... | Set strategy pattern action for modification array.
Action callable object resieves whole array in container and return array ro replace.
@param AbstractAction $action
@return $this | [
"Set",
"strategy",
"pattern",
"action",
"for",
"modification",
"array",
".",
"Action",
"callable",
"object",
"resieves",
"whole",
"array",
"in",
"container",
"and",
"return",
"array",
"ro",
"replace",
"."
] | 4f49f449b23072ac6d2ae0f1ea4b8e34804b760f | https://github.com/AndyDune/DateTime/blob/4f49f449b23072ac6d2ae0f1ea4b8e34804b760f/src/DateTime.php#L78-L83 | train |
AndyDune/DateTime | src/DateTime.php | DateTime.add | public function add($interval) : DateTime
{
if ($interval instanceof DateInterval) {
$this->value->add($interval);
return $this;
}
$i = $this->tryToCreateIntervalByDesignators($interval);
if (!$i) {
$i = DateInterval::createFromDateString($interva... | php | public function add($interval) : DateTime
{
if ($interval instanceof DateInterval) {
$this->value->add($interval);
return $this;
}
$i = $this->tryToCreateIntervalByDesignators($interval);
if (!$i) {
$i = DateInterval::createFromDateString($interva... | [
"public",
"function",
"add",
"(",
"$",
"interval",
")",
":",
"DateTime",
"{",
"if",
"(",
"$",
"interval",
"instanceof",
"DateInterval",
")",
"{",
"$",
"this",
"->",
"value",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"return",
"$",
"this",
";",
"}"... | Performs dates arithmetic.
http://php.net/manual/en/datetime.formats.relative.php
Each duration period is represented by an integer value followed by a period
designator. If the duration contains time elements, that portion of the
specification is preceded by the letter T.
Period Designators: Y - years, M - months, D... | [
"Performs",
"dates",
"arithmetic",
"."
] | 4f49f449b23072ac6d2ae0f1ea4b8e34804b760f | https://github.com/AndyDune/DateTime/blob/4f49f449b23072ac6d2ae0f1ea4b8e34804b760f/src/DateTime.php#L155-L170 | train |
AndyDune/DateTime | src/DateTime.php | DateTime.getDateMonday | public function getDateMonday($format = 'Y-m-d')
{
$weekDay = $this->format('N') - 1;
$dateTime = clone $this;
if ($weekDay) {
$dateTime->add(sprintf('- %d days', $weekDay));
}
if ($format) {
return $dateTime->format($format);
}
return ... | php | public function getDateMonday($format = 'Y-m-d')
{
$weekDay = $this->format('N') - 1;
$dateTime = clone $this;
if ($weekDay) {
$dateTime->add(sprintf('- %d days', $weekDay));
}
if ($format) {
return $dateTime->format($format);
}
return ... | [
"public",
"function",
"getDateMonday",
"(",
"$",
"format",
"=",
"'Y-m-d'",
")",
"{",
"$",
"weekDay",
"=",
"$",
"this",
"->",
"format",
"(",
"'N'",
")",
"-",
"1",
";",
"$",
"dateTime",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"$",
"weekDay",
")",
... | Returns monday date.
@param string $format
@return string|DateTime returns DateTime if empty param $format | [
"Returns",
"monday",
"date",
"."
] | 4f49f449b23072ac6d2ae0f1ea4b8e34804b760f | https://github.com/AndyDune/DateTime/blob/4f49f449b23072ac6d2ae0f1ea4b8e34804b760f/src/DateTime.php#L209-L220 | train |
ApatisArchive/ArrayStorage | src/CollectionSerializable.php | CollectionSerializable.unserialize | public function unserialize($serialized)
{
$serialized = @unserialize($serialized);
if (!is_array($serialized)) {
throw new \InvalidArgumentException(
'Invalid argument 1, arguments must be serialized of array.',
E_USER_ERROR
);
}
... | php | public function unserialize($serialized)
{
$serialized = @unserialize($serialized);
if (!is_array($serialized)) {
throw new \InvalidArgumentException(
'Invalid argument 1, arguments must be serialized of array.',
E_USER_ERROR
);
}
... | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"$",
"serialized",
"=",
"@",
"unserialize",
"(",
"$",
"serialized",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"serialized",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgument... | Un-serialize Magic Method
@param string $serialized | [
"Un",
"-",
"serialize",
"Magic",
"Method"
] | 4f6515164352f2997275278b89884fc1e885e7d9 | https://github.com/ApatisArchive/ArrayStorage/blob/4f6515164352f2997275278b89884fc1e885e7d9/src/CollectionSerializable.php#L27-L38 | train |
RudyMas/Emvc_Email | src/Email.php | Email.setup | public function setup(string $host, string $username, string $password, string $security, bool $use_smtp = true): void
{
$this->use_smtp = $use_smtp;
$this->email_host = $host;
$this->email_username = $username;
$this->email_password = $password;
$this->email_security = $secu... | php | public function setup(string $host, string $username, string $password, string $security, bool $use_smtp = true): void
{
$this->use_smtp = $use_smtp;
$this->email_host = $host;
$this->email_username = $username;
$this->email_password = $password;
$this->email_security = $secu... | [
"public",
"function",
"setup",
"(",
"string",
"$",
"host",
",",
"string",
"$",
"username",
",",
"string",
"$",
"password",
",",
"string",
"$",
"security",
",",
"bool",
"$",
"use_smtp",
"=",
"true",
")",
":",
"void",
"{",
"$",
"this",
"->",
"use_smtp",
... | Use this function when you use it in your own project
@param string $host
@param string $username
@param string $password
@param string $security
@param bool $use_smtp | [
"Use",
"this",
"function",
"when",
"you",
"use",
"it",
"in",
"your",
"own",
"project"
] | 9ac2380c6863549fdc30ea64e446bbc6a9ebbb06 | https://github.com/RudyMas/Emvc_Email/blob/9ac2380c6863549fdc30ea64e446bbc6a9ebbb06/src/Email.php#L49-L56 | train |
RudyMas/Emvc_Email | src/Email.php | Email.emvc_config | public function emvc_config(): void
{
$this->use_smtp = USE_SMTP;
$this->email_host = EMAIL_HOST;
$this->email_username = EMAIL_USERNAME;
$this->email_password = EMAIL_PASSWORD;
$this->email_security = EMAIL_SECURITY;
} | php | public function emvc_config(): void
{
$this->use_smtp = USE_SMTP;
$this->email_host = EMAIL_HOST;
$this->email_username = EMAIL_USERNAME;
$this->email_password = EMAIL_PASSWORD;
$this->email_security = EMAIL_SECURITY;
} | [
"public",
"function",
"emvc_config",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"use_smtp",
"=",
"USE_SMTP",
";",
"$",
"this",
"->",
"email_host",
"=",
"EMAIL_HOST",
";",
"$",
"this",
"->",
"email_username",
"=",
"EMAIL_USERNAME",
";",
"$",
"this",
"... | Use this function when you use it in the EasyMVC framework | [
"Use",
"this",
"function",
"when",
"you",
"use",
"it",
"in",
"the",
"EasyMVC",
"framework"
] | 9ac2380c6863549fdc30ea64e446bbc6a9ebbb06 | https://github.com/RudyMas/Emvc_Email/blob/9ac2380c6863549fdc30ea64e446bbc6a9ebbb06/src/Email.php#L61-L68 | train |
RudyMas/Emvc_Email | src/Email.php | Email.setTextMessage | public function setTextMessage(array $to,
string $subject,
string $body,
array $attachment = null,
array $cc = null,
array $bcc = EMAIL_BCC): voi... | php | public function setTextMessage(array $to,
string $subject,
string $body,
array $attachment = null,
array $cc = null,
array $bcc = EMAIL_BCC): voi... | [
"public",
"function",
"setTextMessage",
"(",
"array",
"$",
"to",
",",
"string",
"$",
"subject",
",",
"string",
"$",
"body",
",",
"array",
"$",
"attachment",
"=",
"null",
",",
"array",
"$",
"cc",
"=",
"null",
",",
"array",
"$",
"bcc",
"=",
"EMAIL_BCC",
... | Prepare a plain text E-mail
@param array $to
@param string $subject
@param string $body
@param array|null $attachment
@param array|null $cc
@param array $bcc | [
"Prepare",
"a",
"plain",
"text",
"E",
"-",
"mail"
] | 9ac2380c6863549fdc30ea64e446bbc6a9ebbb06 | https://github.com/RudyMas/Emvc_Email/blob/9ac2380c6863549fdc30ea64e446bbc6a9ebbb06/src/Email.php#L90-L118 | train |
RudyMas/Emvc_Email | src/Email.php | Email.sendMail | public function sendMail(): void
{
if ($this->use_smtp) {
$mailer = new SmtpMailer([
'host' => $this->email_host,
'username' => $this->email_username,
'password' => $this->email_password,
'secure' => $this->email_security
... | php | public function sendMail(): void
{
if ($this->use_smtp) {
$mailer = new SmtpMailer([
'host' => $this->email_host,
'username' => $this->email_username,
'password' => $this->email_password,
'secure' => $this->email_security
... | [
"public",
"function",
"sendMail",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"use_smtp",
")",
"{",
"$",
"mailer",
"=",
"new",
"SmtpMailer",
"(",
"[",
"'host'",
"=>",
"$",
"this",
"->",
"email_host",
",",
"'username'",
"=>",
"$",
"this"... | Use this after your E-mail has been prepared | [
"Use",
"this",
"after",
"your",
"E",
"-",
"mail",
"has",
"been",
"prepared"
] | 9ac2380c6863549fdc30ea64e446bbc6a9ebbb06 | https://github.com/RudyMas/Emvc_Email/blob/9ac2380c6863549fdc30ea64e446bbc6a9ebbb06/src/Email.php#L163-L176 | train |
RudyMas/Emvc_Email | src/Email.php | Email.emvcRenderHtml | public function emvcRenderHtml(string $latteFile, array $data): string
{
$latte = new Engine();
$latte->setTempDirectory($_SERVER['DOCUMENT_ROOT'] . BASE_URL . '/tmp/latte');
return $latte->renderToString($_SERVER['DOCUMENT_ROOT'] . BASE_URL . '/private/latte/' . $latteFile, $data);
} | php | public function emvcRenderHtml(string $latteFile, array $data): string
{
$latte = new Engine();
$latte->setTempDirectory($_SERVER['DOCUMENT_ROOT'] . BASE_URL . '/tmp/latte');
return $latte->renderToString($_SERVER['DOCUMENT_ROOT'] . BASE_URL . '/private/latte/' . $latteFile, $data);
} | [
"public",
"function",
"emvcRenderHtml",
"(",
"string",
"$",
"latteFile",
",",
"array",
"$",
"data",
")",
":",
"string",
"{",
"$",
"latte",
"=",
"new",
"Engine",
"(",
")",
";",
"$",
"latte",
"->",
"setTempDirectory",
"(",
"$",
"_SERVER",
"[",
"'DOCUMENT_R... | Use Latte for rendering HTML E-mails in the EasyMVC framework
@param string $latteFile
@param array $data
@return string | [
"Use",
"Latte",
"for",
"rendering",
"HTML",
"E",
"-",
"mails",
"in",
"the",
"EasyMVC",
"framework"
] | 9ac2380c6863549fdc30ea64e446bbc6a9ebbb06 | https://github.com/RudyMas/Emvc_Email/blob/9ac2380c6863549fdc30ea64e446bbc6a9ebbb06/src/Email.php#L185-L190 | train |
RudyMas/Emvc_Email | src/Email.php | Email.renderHtml | public function renderHtml(string $latteFile, array $data, string $tempFolderLatte = '/tmp/latte'): string
{
$latte = new Engine();
$latte->setTempDirectory($tempFolderLatte);
return $latte->renderToString($latteFile, $data);
} | php | public function renderHtml(string $latteFile, array $data, string $tempFolderLatte = '/tmp/latte'): string
{
$latte = new Engine();
$latte->setTempDirectory($tempFolderLatte);
return $latte->renderToString($latteFile, $data);
} | [
"public",
"function",
"renderHtml",
"(",
"string",
"$",
"latteFile",
",",
"array",
"$",
"data",
",",
"string",
"$",
"tempFolderLatte",
"=",
"'/tmp/latte'",
")",
":",
"string",
"{",
"$",
"latte",
"=",
"new",
"Engine",
"(",
")",
";",
"$",
"latte",
"->",
... | Use Latte for rendering HTML E-mails in your own project
@param string $latteFile
@param array $data
@param string $tempFolderLatte
@return string | [
"Use",
"Latte",
"for",
"rendering",
"HTML",
"E",
"-",
"mails",
"in",
"your",
"own",
"project"
] | 9ac2380c6863549fdc30ea64e446bbc6a9ebbb06 | https://github.com/RudyMas/Emvc_Email/blob/9ac2380c6863549fdc30ea64e446bbc6a9ebbb06/src/Email.php#L200-L205 | train |
netbull/CoreBundle | Utils/PrintLabels.php | PrintLabels.labelSetFormat | public function labelSetFormat($format, $unit)
{
$this->format = $format;
$this->paperSize = $this->getFormatValue('paper-size');
$this->orientation = $this->getFormatValue('orientation');
$this->fontName = $this->getFormatValue('font-name');
$this->charSize = $this->getForma... | php | public function labelSetFormat($format, $unit)
{
$this->format = $format;
$this->paperSize = $this->getFormatValue('paper-size');
$this->orientation = $this->getFormatValue('orientation');
$this->fontName = $this->getFormatValue('font-name');
$this->charSize = $this->getForma... | [
"public",
"function",
"labelSetFormat",
"(",
"$",
"format",
",",
"$",
"unit",
")",
"{",
"$",
"this",
"->",
"format",
"=",
"$",
"format",
";",
"$",
"this",
"->",
"paperSize",
"=",
"$",
"this",
"->",
"getFormatValue",
"(",
"'paper-size'",
")",
";",
"$",
... | initialize label format settings.
@param $format
@param $unit | [
"initialize",
"label",
"format",
"settings",
"."
] | 0bacc1d9e4733b6da613027400c48421e5a14645 | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Utils/PrintLabels.php#L137-L157 | train |
netbull/CoreBundle | Utils/PrintLabels.php | PrintLabels.addPdfLabel | public function addPdfLabel(string $text)
{
if ($this->countX == $this->xNumber) {
// Page full, we start a new one
$this->AddPage();
$this->countX = 0;
$this->countY = 0;
}
$posX = $this->marginLeft + ($this->countX * ($this->width + $this->x... | php | public function addPdfLabel(string $text)
{
if ($this->countX == $this->xNumber) {
// Page full, we start a new one
$this->AddPage();
$this->countX = 0;
$this->countY = 0;
}
$posX = $this->marginLeft + ($this->countX * ($this->width + $this->x... | [
"public",
"function",
"addPdfLabel",
"(",
"string",
"$",
"text",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"countX",
"==",
"$",
"this",
"->",
"xNumber",
")",
"{",
"// Page full, we start a new one",
"$",
"this",
"->",
"AddPage",
"(",
")",
";",
"$",
"this",... | Print a label.
@param string $text | [
"Print",
"a",
"label",
"."
] | 0bacc1d9e4733b6da613027400c48421e5a14645 | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Utils/PrintLabels.php#L206-L228 | train |
linpax/microphp-framework | src/file/Type.php | Type.arrayWalkRecursive | public static function arrayWalkRecursive(array $data, callable $function)
{
if (!is_array($data)) {
return call_user_func($function, $data);
}
foreach ($data as $k => &$item) {
$item = self::arrayWalkRecursive($data[$k], $function);
}
return $data;
... | php | public static function arrayWalkRecursive(array $data, callable $function)
{
if (!is_array($data)) {
return call_user_func($function, $data);
}
foreach ($data as $k => &$item) {
$item = self::arrayWalkRecursive($data[$k], $function);
}
return $data;
... | [
"public",
"static",
"function",
"arrayWalkRecursive",
"(",
"array",
"$",
"data",
",",
"callable",
"$",
"function",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"function",
",",
"$",
"data",
... | Array walk recursive
@access public
@param array $data array to walk
@param callable $function callable function
@return array|mixed
@static | [
"Array",
"walk",
"recursive"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/file/Type.php#L70-L81 | train |
linpax/microphp-framework | src/file/Type.php | Type.getSubArrayFromArrayByKeys | public static function getSubArrayFromArrayByKeys(array $array, array $keys)
{
$result = [];
foreach ($keys as $key) {
if (array_key_exists($key, $array)) {
$result[$key] = $array[$key];
}
}
return $result;
} | php | public static function getSubArrayFromArrayByKeys(array $array, array $keys)
{
$result = [];
foreach ($keys as $key) {
if (array_key_exists($key, $array)) {
$result[$key] = $array[$key];
}
}
return $result;
} | [
"public",
"static",
"function",
"getSubArrayFromArrayByKeys",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"keys",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(... | Get SubArray from array by keys
@access public
@param array $array
@param array $keys
@return array
@static | [
"Get",
"SubArray",
"from",
"array",
"by",
"keys"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/file/Type.php#L94-L105 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Map/M2PTableMap.php | M2PTableMap.doDelete | public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(M2PTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = ... | php | public static function doDelete($values, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(M2PTableMap::DATABASE_NAME);
}
if ($values instanceof Criteria) {
// rename for clarity
$criteria = ... | [
"public",
"static",
"function",
"doDelete",
"(",
"$",
"values",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getW... | Performs a DELETE on the database, given a M2P or Criteria object OR a primary key value.
@param mixed $values Criteria or M2P object or primary key or array of primary keys
which is used to create the DELETE statement
@param ConnectionInterface $con the connection to use
@return int The num... | [
"Performs",
"a",
"DELETE",
"on",
"the",
"database",
"given",
"a",
"M2P",
"or",
"Criteria",
"object",
"OR",
"a",
"primary",
"key",
"value",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Map/M2PTableMap.php#L404-L442 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Map/M2PTableMap.php | M2PTableMap.doInsert | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(M2PTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for ... | php | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(M2PTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename for ... | [
"public",
"static",
"function",
"doInsert",
"(",
"$",
"criteria",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"con",
")",
"{",
"$",
"con",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"ge... | Performs an INSERT on the database, given a M2P or Criteria object.
@param mixed $criteria Criteria or M2P object containing data that is used to create the INSERT statement.
@param ConnectionInterface $con the ConnectionInterface connection to use
@return mixed The new primary key.
@throws Pro... | [
"Performs",
"an",
"INSERT",
"on",
"the",
"database",
"given",
"a",
"M2P",
"or",
"Criteria",
"object",
"."
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Map/M2PTableMap.php#L464-L485 | train |
fiiSoft/fiisoft-logger | src/Logger/Reader/LogsMonitor/AbstractLogsMonitor.php | AbstractLogsMonitor.filterByLevel | final public function filterByLevel($level, array $levels = [])
{
if ($level !== $this->minLevel) {
$this->minLevel = $level;
$this->consumer = null;
}
if (!empty($levels)) {
$this->levels = $levels;
$this->consumer = null;
}
... | php | final public function filterByLevel($level, array $levels = [])
{
if ($level !== $this->minLevel) {
$this->minLevel = $level;
$this->consumer = null;
}
if (!empty($levels)) {
$this->levels = $levels;
$this->consumer = null;
}
... | [
"final",
"public",
"function",
"filterByLevel",
"(",
"$",
"level",
",",
"array",
"$",
"levels",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"level",
"!==",
"$",
"this",
"->",
"minLevel",
")",
"{",
"$",
"this",
"->",
"minLevel",
"=",
"$",
"level",
";",... | One can set minimum level of logs that will be streamed to OutputWriter by this LogsMonitor.
This is optional and if method is not call, all available logs are supposed to be streamed.
If second param is not empty then use this set of levels instead of defaults.
The list of Levels must be ordered from the most to the ... | [
"One",
"can",
"set",
"minimum",
"level",
"of",
"logs",
"that",
"will",
"be",
"streamed",
"to",
"OutputWriter",
"by",
"this",
"LogsMonitor",
".",
"This",
"is",
"optional",
"and",
"if",
"method",
"is",
"not",
"call",
"all",
"available",
"logs",
"are",
"suppo... | 3d2eb9d18a785ec119d2fbeb9d34b74265e7dcf5 | https://github.com/fiiSoft/fiisoft-logger/blob/3d2eb9d18a785ec119d2fbeb9d34b74265e7dcf5/src/Logger/Reader/LogsMonitor/AbstractLogsMonitor.php#L66-L79 | train |
fiiSoft/fiisoft-logger | src/Logger/Reader/LogsMonitor/AbstractLogsMonitor.php | AbstractLogsMonitor.filterByContext | final public function filterByContext(array $context)
{
if ($context !== $this->withContext) {
$this->withContext = $context;
$this->consumer = null;
}
return $this;
} | php | final public function filterByContext(array $context)
{
if ($context !== $this->withContext) {
$this->withContext = $context;
$this->consumer = null;
}
return $this;
} | [
"final",
"public",
"function",
"filterByContext",
"(",
"array",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"context",
"!==",
"$",
"this",
"->",
"withContext",
")",
"{",
"$",
"this",
"->",
"withContext",
"=",
"$",
"context",
";",
"$",
"this",
"->",
"cons... | One can set context that is required to stream logs to OutputWriter by this LogsMonitor.
This is optional and if method is not call, all available logs are supposed to be streamed.
@param array $context
@return $this fluent interface | [
"One",
"can",
"set",
"context",
"that",
"is",
"required",
"to",
"stream",
"logs",
"to",
"OutputWriter",
"by",
"this",
"LogsMonitor",
".",
"This",
"is",
"optional",
"and",
"if",
"method",
"is",
"not",
"call",
"all",
"available",
"logs",
"are",
"supposed",
"... | 3d2eb9d18a785ec119d2fbeb9d34b74265e7dcf5 | https://github.com/fiiSoft/fiisoft-logger/blob/3d2eb9d18a785ec119d2fbeb9d34b74265e7dcf5/src/Logger/Reader/LogsMonitor/AbstractLogsMonitor.php#L88-L96 | train |
fiiSoft/fiisoft-logger | src/Logger/Reader/LogsMonitor/AbstractLogsMonitor.php | AbstractLogsMonitor.setOutputWriter | final public function setOutputWriter(OutputWriter $outputWriter)
{
if ($outputWriter !== $this->outputWriter) {
$this->outputWriter = $outputWriter;
$this->consumer = null;
}
return $this;
} | php | final public function setOutputWriter(OutputWriter $outputWriter)
{
if ($outputWriter !== $this->outputWriter) {
$this->outputWriter = $outputWriter;
$this->consumer = null;
}
return $this;
} | [
"final",
"public",
"function",
"setOutputWriter",
"(",
"OutputWriter",
"$",
"outputWriter",
")",
"{",
"if",
"(",
"$",
"outputWriter",
"!==",
"$",
"this",
"->",
"outputWriter",
")",
"{",
"$",
"this",
"->",
"outputWriter",
"=",
"$",
"outputWriter",
";",
"$",
... | Call of this method is required before logs are streamed to OutputWriter.
@param OutputWriter $outputWriter
@return $this fluent interface | [
"Call",
"of",
"this",
"method",
"is",
"required",
"before",
"logs",
"are",
"streamed",
"to",
"OutputWriter",
"."
] | 3d2eb9d18a785ec119d2fbeb9d34b74265e7dcf5 | https://github.com/fiiSoft/fiisoft-logger/blob/3d2eb9d18a785ec119d2fbeb9d34b74265e7dcf5/src/Logger/Reader/LogsMonitor/AbstractLogsMonitor.php#L104-L112 | train |
Kris-Kuiper/sFire-Framework | src/Image/Color.php | Color.name | public static function name($color) {
if(false === is_string($color)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($color)), E_USER_ERROR);
}
if(1 !== preg_match('#^[0-9a-fA-F]{6,6}$#', $color)) {
return trigger_error(sprintf... | php | public static function name($color) {
if(false === is_string($color)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($color)), E_USER_ERROR);
}
if(1 !== preg_match('#^[0-9a-fA-F]{6,6}$#', $color)) {
return trigger_error(sprintf... | [
"public",
"static",
"function",
"name",
"(",
"$",
"color",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"color",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
"... | Convert a hexadecimal color to color name in human language
@param string $color
@return null|stdClass Object | [
"Convert",
"a",
"hexadecimal",
"color",
"to",
"color",
"name",
"in",
"human",
"language"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Color.php#L28-L78 | train |
Kris-Kuiper/sFire-Framework | src/Image/Color.php | Color.index | private static function index() {
$colors = ColorList :: get('colors');
foreach($colors as $hex => $color) {
$rgb = static :: rgb($hex);
$hsl = static :: hsl($hex);
$shade = ColorList :: get(['shades', $color['s']]);
$base = ColorList :: get(['base', $shade['b']]);
static :: $... | php | private static function index() {
$colors = ColorList :: get('colors');
foreach($colors as $hex => $color) {
$rgb = static :: rgb($hex);
$hsl = static :: hsl($hex);
$shade = ColorList :: get(['shades', $color['s']]);
$base = ColorList :: get(['base', $shade['b']]);
static :: $... | [
"private",
"static",
"function",
"index",
"(",
")",
"{",
"$",
"colors",
"=",
"ColorList",
"::",
"get",
"(",
"'colors'",
")",
";",
"foreach",
"(",
"$",
"colors",
"as",
"$",
"hex",
"=>",
"$",
"color",
")",
"{",
"$",
"rgb",
"=",
"static",
"::",
"rgb",... | Initialise all colors | [
"Initialise",
"all",
"colors"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Color.php#L84-L119 | train |
Kris-Kuiper/sFire-Framework | src/Image/Color.php | Color.rgb | private static function rgb($color) {
return (object) [
'r' => intval(hexdec(substr($color, 0, 2))),
'g' => intval(hexdec(substr($color, 2, 2))),
'b' => intval(hexdec(substr($color, 4, 2)))
];
} | php | private static function rgb($color) {
return (object) [
'r' => intval(hexdec(substr($color, 0, 2))),
'g' => intval(hexdec(substr($color, 2, 2))),
'b' => intval(hexdec(substr($color, 4, 2)))
];
} | [
"private",
"static",
"function",
"rgb",
"(",
"$",
"color",
")",
"{",
"return",
"(",
"object",
")",
"[",
"'r'",
"=>",
"intval",
"(",
"hexdec",
"(",
"substr",
"(",
"$",
"color",
",",
"0",
",",
"2",
")",
")",
")",
",",
"'g'",
"=>",
"intval",
"(",
... | Convert hexadecimal color to RGB
@param string $color
@return stdClass Object | [
"Convert",
"hexadecimal",
"color",
"to",
"RGB"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Color.php#L127-L135 | train |
Kris-Kuiper/sFire-Framework | src/Image/Color.php | Color.hsl | private static function hsl($color) {
$r = intval(hexdec(substr($color, 0, 2))) / 255;
$g = intval(hexdec(substr($color, 2, 2))) / 255;
$b = intval(hexdec(substr($color, 4, 2))) / 255;
$min = min($r, $g, $b);
$max = max($r, $g, $b);
$delta = $max - $min;
$l = ($min + $max) / 2;
$s = 0... | php | private static function hsl($color) {
$r = intval(hexdec(substr($color, 0, 2))) / 255;
$g = intval(hexdec(substr($color, 2, 2))) / 255;
$b = intval(hexdec(substr($color, 4, 2))) / 255;
$min = min($r, $g, $b);
$max = max($r, $g, $b);
$delta = $max - $min;
$l = ($min + $max) / 2;
$s = 0... | [
"private",
"static",
"function",
"hsl",
"(",
"$",
"color",
")",
"{",
"$",
"r",
"=",
"intval",
"(",
"hexdec",
"(",
"substr",
"(",
"$",
"color",
",",
"0",
",",
"2",
")",
")",
")",
"/",
"255",
";",
"$",
"g",
"=",
"intval",
"(",
"hexdec",
"(",
"s... | Convert hexadecimal color to HSL
@param string $color
@return stdClass Object | [
"Convert",
"hexadecimal",
"color",
"to",
"HSL"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Image/Color.php#L143-L183 | train |
koolkode/lexer | src/AbstractToken.php | AbstractToken.serialize | public function serialize(SerializedTokenIterator $it)
{
$it->append($this->type);
$it->append($this->text);
} | php | public function serialize(SerializedTokenIterator $it)
{
$it->append($this->type);
$it->append($this->text);
} | [
"public",
"function",
"serialize",
"(",
"SerializedTokenIterator",
"$",
"it",
")",
"{",
"$",
"it",
"->",
"append",
"(",
"$",
"this",
"->",
"type",
")",
";",
"$",
"it",
"->",
"append",
"(",
"$",
"this",
"->",
"text",
")",
";",
"}"
] | Serialize the token into the given token interation.
@param SerializedTokenIterator $it | [
"Serialize",
"the",
"token",
"into",
"the",
"given",
"token",
"interation",
"."
] | 1f33fb4e95bf3b6b21c63187e503bbe612a1646c | https://github.com/koolkode/lexer/blob/1f33fb4e95bf3b6b21c63187e503bbe612a1646c/src/AbstractToken.php#L129-L133 | train |
koolkode/lexer | src/AbstractToken.php | AbstractToken.getTypeName | public static function getTypeName($type)
{
static $ref = [];
$key = static::class;
if(empty($ref[$key]))
{
$ref[$key] = new \ReflectionClass($key);
}
foreach($ref[$key]->getConstants() as $k => $v)
{
if($v === $type && strpos($k, 'T_') === 0)
{
return $k;
}
}
return static:... | php | public static function getTypeName($type)
{
static $ref = [];
$key = static::class;
if(empty($ref[$key]))
{
$ref[$key] = new \ReflectionClass($key);
}
foreach($ref[$key]->getConstants() as $k => $v)
{
if($v === $type && strpos($k, 'T_') === 0)
{
return $k;
}
}
return static:... | [
"public",
"static",
"function",
"getTypeName",
"(",
"$",
"type",
")",
"{",
"static",
"$",
"ref",
"=",
"[",
"]",
";",
"$",
"key",
"=",
"static",
"::",
"class",
";",
"if",
"(",
"empty",
"(",
"$",
"ref",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
... | Get a human-readable name of the given token type.
@param integer $type
@return string | [
"Get",
"a",
"human",
"-",
"readable",
"name",
"of",
"the",
"given",
"token",
"type",
"."
] | 1f33fb4e95bf3b6b21c63187e503bbe612a1646c | https://github.com/koolkode/lexer/blob/1f33fb4e95bf3b6b21c63187e503bbe612a1646c/src/AbstractToken.php#L141-L161 | train |
Erdiko/doctrine | src/EntityManager.php | EntityManager.getEntityManager | public static function getEntityManager($db = null, $context = 'shared')
{
// Get db config info from file
$dbConfig = \erdiko\core\Helper::getConfig("database", $context);
if($db == null)
$db = $dbConfig['default'];
$dbParams = $dbConfig['connections'][$db];
$dbP... | php | public static function getEntityManager($db = null, $context = 'shared')
{
// Get db config info from file
$dbConfig = \erdiko\core\Helper::getConfig("database", $context);
if($db == null)
$db = $dbConfig['default'];
$dbParams = $dbConfig['connections'][$db];
$dbP... | [
"public",
"static",
"function",
"getEntityManager",
"(",
"$",
"db",
"=",
"null",
",",
"$",
"context",
"=",
"'shared'",
")",
"{",
"// Get db config info from file",
"$",
"dbConfig",
"=",
"\\",
"erdiko",
"\\",
"core",
"\\",
"Helper",
"::",
"getConfig",
"(",
"\... | Get Doctrine entity manager
@param string $db, default to the 'default' database in the config
@param string | [
"Get",
"Doctrine",
"entity",
"manager"
] | b8fdba2f34a67c862cafc0448d1d613a2fa4da16 | https://github.com/Erdiko/doctrine/blob/b8fdba2f34a67c862cafc0448d1d613a2fa4da16/src/EntityManager.php#L18-L34 | train |
Erdiko/doctrine | src/EntityManager.php | EntityManager.update | public static function update($entity)
{
$entityManager = self::getEntityManager();
$entity = $entityManager->merge($entity);
$entityManager->flush(); // transact
return $entity;
} | php | public static function update($entity)
{
$entityManager = self::getEntityManager();
$entity = $entityManager->merge($entity);
$entityManager->flush(); // transact
return $entity;
} | [
"public",
"static",
"function",
"update",
"(",
"$",
"entity",
")",
"{",
"$",
"entityManager",
"=",
"self",
"::",
"getEntityManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"entityManager",
"->",
"merge",
"(",
"$",
"entity",
")",
";",
"$",
"entityManager... | Update a single record
Convenience method to update a row.
You should use the Doctrine EntityManager directly to take control of the Entity merge process.
@note do we need this? | [
"Update",
"a",
"single",
"record",
"Convenience",
"method",
"to",
"update",
"a",
"row",
".",
"You",
"should",
"use",
"the",
"Doctrine",
"EntityManager",
"directly",
"to",
"take",
"control",
"of",
"the",
"Entity",
"merge",
"process",
"."
] | b8fdba2f34a67c862cafc0448d1d613a2fa4da16 | https://github.com/Erdiko/doctrine/blob/b8fdba2f34a67c862cafc0448d1d613a2fa4da16/src/EntityManager.php#L42-L49 | train |
sil-project/SeedBatchBundle | src/Entity/Plot.php | Plot.addSeedBatch | public function addSeedBatch(\Librinfo\SeedBatchBundle\Entity\SeedBatch $seedBatch)
{
$this->seedBatches[] = $seedBatch;
return $this;
} | php | public function addSeedBatch(\Librinfo\SeedBatchBundle\Entity\SeedBatch $seedBatch)
{
$this->seedBatches[] = $seedBatch;
return $this;
} | [
"public",
"function",
"addSeedBatch",
"(",
"\\",
"Librinfo",
"\\",
"SeedBatchBundle",
"\\",
"Entity",
"\\",
"SeedBatch",
"$",
"seedBatch",
")",
"{",
"$",
"this",
"->",
"seedBatches",
"[",
"]",
"=",
"$",
"seedBatch",
";",
"return",
"$",
"this",
";",
"}"
] | Add seedBatch.
@param \Librinfo\SeedBatchBundle\Entity\SeedBatch $seedBatch
@return Plot | [
"Add",
"seedBatch",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/Plot.php#L114-L119 | train |
sil-project/SeedBatchBundle | src/Entity/Plot.php | Plot.removeSeedBatch | public function removeSeedBatch(\Librinfo\SeedBatchBundle\Entity\SeedBatch $seedBatch)
{
return $this->seedBatches->removeElement($seedBatch);
} | php | public function removeSeedBatch(\Librinfo\SeedBatchBundle\Entity\SeedBatch $seedBatch)
{
return $this->seedBatches->removeElement($seedBatch);
} | [
"public",
"function",
"removeSeedBatch",
"(",
"\\",
"Librinfo",
"\\",
"SeedBatchBundle",
"\\",
"Entity",
"\\",
"SeedBatch",
"$",
"seedBatch",
")",
"{",
"return",
"$",
"this",
"->",
"seedBatches",
"->",
"removeElement",
"(",
"$",
"seedBatch",
")",
";",
"}"
] | Remove seedBatch.
@param \Librinfo\SeedBatchBundle\Entity\SeedBatch $seedBatch
@return bool tRUE if this collection contained the specified element, FALSE otherwise | [
"Remove",
"seedBatch",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/Plot.php#L128-L131 | train |
sil-project/SeedBatchBundle | src/Entity/Plot.php | Plot.setProducer | public function setProducer(\Librinfo\CRMBundle\Entity\Organism $producer = null)
{
$this->producer = $producer;
return $this;
} | php | public function setProducer(\Librinfo\CRMBundle\Entity\Organism $producer = null)
{
$this->producer = $producer;
return $this;
} | [
"public",
"function",
"setProducer",
"(",
"\\",
"Librinfo",
"\\",
"CRMBundle",
"\\",
"Entity",
"\\",
"Organism",
"$",
"producer",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"producer",
"=",
"$",
"producer",
";",
"return",
"$",
"this",
";",
"}"
] | Set producer.
@param \Librinfo\CRMBundle\Entity\Organism $producer
@return Plot | [
"Set",
"producer",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/Plot.php#L150-L155 | train |
sil-project/SeedBatchBundle | src/Entity/Plot.php | Plot.addCertification | public function addCertification(\Librinfo\SeedBatchBundle\Entity\Certification $certifications)
{
$this->certifications[] = $certifications;
return $this;
} | php | public function addCertification(\Librinfo\SeedBatchBundle\Entity\Certification $certifications)
{
$this->certifications[] = $certifications;
return $this;
} | [
"public",
"function",
"addCertification",
"(",
"\\",
"Librinfo",
"\\",
"SeedBatchBundle",
"\\",
"Entity",
"\\",
"Certification",
"$",
"certifications",
")",
"{",
"$",
"this",
"->",
"certifications",
"[",
"]",
"=",
"$",
"certifications",
";",
"return",
"$",
"th... | Add certifications.
@param \Librinfo\SeedBatchBundle\Entity\Certification $certifications
@return Plot | [
"Add",
"certifications",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/Plot.php#L188-L193 | train |
sil-project/SeedBatchBundle | src/Entity/Plot.php | Plot.removeCertification | public function removeCertification(\Librinfo\SeedBatchBundle\Entity\Certification $certification)
{
$this->certifications->removeElement($certification);
} | php | public function removeCertification(\Librinfo\SeedBatchBundle\Entity\Certification $certification)
{
$this->certifications->removeElement($certification);
} | [
"public",
"function",
"removeCertification",
"(",
"\\",
"Librinfo",
"\\",
"SeedBatchBundle",
"\\",
"Entity",
"\\",
"Certification",
"$",
"certification",
")",
"{",
"$",
"this",
"->",
"certifications",
"->",
"removeElement",
"(",
"$",
"certification",
")",
";",
"... | Remove certification.
@param \Librinfo\SeedBatchBundle\Entity\Certification $certification | [
"Remove",
"certification",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/Plot.php#L200-L203 | train |
mrstroz/yii2-wavecms-form | models/FormSettings.php | FormSettings.replaceTags | public function replaceTags($model)
{
if (isset($model->attributes)) {
foreach ($model->attributes as $key => $attribute) {
if (in_array($key, $this->dataAttributes)) {
$val = Yii::$app->formatter->asDatetime($model->{$key}, 'short');
} else {
... | php | public function replaceTags($model)
{
if (isset($model->attributes)) {
foreach ($model->attributes as $key => $attribute) {
if (in_array($key, $this->dataAttributes)) {
$val = Yii::$app->formatter->asDatetime($model->{$key}, 'short');
} else {
... | [
"public",
"function",
"replaceTags",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"model",
"->",
"attributes",
")",
")",
"{",
"foreach",
"(",
"$",
"model",
"->",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"attribute",
")",
"{",
"if",
... | Replace tags by values in text and subject field
@param Form $model
@throws \yii\base\InvalidArgumentException
@throws \yii\base\InvalidConfigException
@throws \yii\base\InvalidParamException
@throws \Exception | [
"Replace",
"tags",
"by",
"values",
"in",
"text",
"and",
"subject",
"field"
] | 9ada0dbbe07b2281fb20905f7cfd07e4075bd065 | https://github.com/mrstroz/yii2-wavecms-form/blob/9ada0dbbe07b2281fb20905f7cfd07e4075bd065/models/FormSettings.php#L125-L150 | train |
mrstroz/yii2-wavecms-form | models/FormSettings.php | FormSettings.replaceExtraTag | public function replaceExtraTag($tag, $value)
{
$this->subject = str_replace('{' . $tag . '}', $value, $this->subject);
$this->user_subject = str_replace('{' . $tag . '}', $value, $this->user_subject);
$this->text = str_replace('{' . $tag . '}', $value, $this->text);
$this->user_text... | php | public function replaceExtraTag($tag, $value)
{
$this->subject = str_replace('{' . $tag . '}', $value, $this->subject);
$this->user_subject = str_replace('{' . $tag . '}', $value, $this->user_subject);
$this->text = str_replace('{' . $tag . '}', $value, $this->text);
$this->user_text... | [
"public",
"function",
"replaceExtraTag",
"(",
"$",
"tag",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"subject",
"=",
"str_replace",
"(",
"'{'",
".",
"$",
"tag",
".",
"'}'",
",",
"$",
"value",
",",
"$",
"this",
"->",
"subject",
")",
";",
"$",
... | Replace additional tags in email subject and text
@param $tag
@param $value | [
"Replace",
"additional",
"tags",
"in",
"email",
"subject",
"and",
"text"
] | 9ada0dbbe07b2281fb20905f7cfd07e4075bd065 | https://github.com/mrstroz/yii2-wavecms-form/blob/9ada0dbbe07b2281fb20905f7cfd07e4075bd065/models/FormSettings.php#L157-L163 | train |
Soneritics/Database | Soneritics/Database/Query/Count.php | Count.fields | public function fields($fields)
{
if (!is_string($fields)) {
throw new FatalException('Only strings are allowed in COUNT query');
}
$this->fields = sprintf(
'COUNT(%s)',
DatabaseConnectionFactory::get()->quoteIdentifier($fields)
);
... | php | public function fields($fields)
{
if (!is_string($fields)) {
throw new FatalException('Only strings are allowed in COUNT query');
}
$this->fields = sprintf(
'COUNT(%s)',
DatabaseConnectionFactory::get()->quoteIdentifier($fields)
);
... | [
"public",
"function",
"fields",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"fields",
")",
")",
"{",
"throw",
"new",
"FatalException",
"(",
"'Only strings are allowed in COUNT query'",
")",
";",
"}",
"$",
"this",
"->",
"fields",
"=... | Set the field to count.
@param $fields
@return $this
@throws FatalException | [
"Set",
"the",
"field",
"to",
"count",
"."
] | 20cb74f2a2ee8d9161d3144b5c061a6da11cd066 | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/Query/Count.php#L47-L59 | train |
libreworks/caridea-container | src/Provider.php | Provider.get | public function get(Container $container)
{
if ($this->singleton) {
if ($this->instance === null) {
$f = $this->factory;
$this->instance = $f($container);
}
return $this->instance;
} else {
$f = $this->factory;
... | php | public function get(Container $container)
{
if ($this->singleton) {
if ($this->instance === null) {
$f = $this->factory;
$this->instance = $f($container);
}
return $this->instance;
} else {
$f = $this->factory;
... | [
"public",
"function",
"get",
"(",
"Container",
"$",
"container",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"singleton",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"instance",
"===",
"null",
")",
"{",
"$",
"f",
"=",
"$",
"this",
"->",
"factory",
";",
"... | Gets the value instance.
@param \Caridea\Container\Container $container The owning container
@return mixed The value instance | [
"Gets",
"the",
"value",
"instance",
"."
] | b93087ff5bf49f5885025da691575093335bfe8f | https://github.com/libreworks/caridea-container/blob/b93087ff5bf49f5885025da691575093335bfe8f/src/Provider.php#L70-L82 | train |
bytic/MediaLibrary | src/Loaders/AbstractLoader.php | AbstractLoader.loadMedia | public function loadMedia()
{
$files = $this->getMediaFiles();
foreach ($files as $file) {
$mediaFile = $this->getCollection()->newMedia();
$mediaFile->setFile($file);
$this->appendMediaInCollection($mediaFile);
}
} | php | public function loadMedia()
{
$files = $this->getMediaFiles();
foreach ($files as $file) {
$mediaFile = $this->getCollection()->newMedia();
$mediaFile->setFile($file);
$this->appendMediaInCollection($mediaFile);
}
} | [
"public",
"function",
"loadMedia",
"(",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"getMediaFiles",
"(",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"$",
"mediaFile",
"=",
"$",
"this",
"->",
"getCollection",
"(",
")",
... | Load media for a collection | [
"Load",
"media",
"for",
"a",
"collection"
] | c52783e726b512184bd72e04d829d6f93242a61d | https://github.com/bytic/MediaLibrary/blob/c52783e726b512184bd72e04d829d6f93242a61d/src/Loaders/AbstractLoader.php#L47-L56 | train |
Palmabit-IT/library | src/Palmabit/Library/ImportExport/Reader.php | Reader.istantiateObjects | public function istantiateObjects()
{
$this->validateObjectClassName();
$objects_iterator = new ArrayIterator;
$this->appendObjectDataToIterator($objects_iterator);
$this->objects_istantiated = $objects_iterator;
return $this->objects_istantiated;
} | php | public function istantiateObjects()
{
$this->validateObjectClassName();
$objects_iterator = new ArrayIterator;
$this->appendObjectDataToIterator($objects_iterator);
$this->objects_istantiated = $objects_iterator;
return $this->objects_istantiated;
} | [
"public",
"function",
"istantiateObjects",
"(",
")",
"{",
"$",
"this",
"->",
"validateObjectClassName",
"(",
")",
";",
"$",
"objects_iterator",
"=",
"new",
"ArrayIterator",
";",
"$",
"this",
"->",
"appendObjectDataToIterator",
"(",
"$",
"objects_iterator",
")",
... | Assuming that we can pass all the proprieties to that object as an array
we istantiate each of that StdClass as a IstantiatedObject
@return \ArrayIterator
@throws \Exception | [
"Assuming",
"that",
"we",
"can",
"pass",
"all",
"the",
"proprieties",
"to",
"that",
"object",
"as",
"an",
"array",
"we",
"istantiate",
"each",
"of",
"that",
"StdClass",
"as",
"a",
"IstantiatedObject"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/ImportExport/Reader.php#L53-L63 | train |
TomK/CronParser | src/CronParser.php | CronParser.isDue | public static function isDue($pattern, \DateTime $time = null)
{
if($time === null)
{
$time = new \DateTime();
}
// trim time back to last round minute
$time->setTime($time->format('H'), $time->format('i'));
$expression = Expression::createFromPattern($pattern);
foreach(self::$_for... | php | public static function isDue($pattern, \DateTime $time = null)
{
if($time === null)
{
$time = new \DateTime();
}
// trim time back to last round minute
$time->setTime($time->format('H'), $time->format('i'));
$expression = Expression::createFromPattern($pattern);
foreach(self::$_for... | [
"public",
"static",
"function",
"isDue",
"(",
"$",
"pattern",
",",
"\\",
"DateTime",
"$",
"time",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"time",
"===",
"null",
")",
"{",
"$",
"time",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"}",
"// trim time b... | Returns true if the time matches the pattern supplied.
Time defaults to current time.
@param $pattern
@param \DateTime $time
@return bool | [
"Returns",
"true",
"if",
"the",
"time",
"matches",
"the",
"pattern",
"supplied",
".",
"Time",
"defaults",
"to",
"current",
"time",
"."
] | cdb1133e49ac2f68b45665f6df2a551bfb9824c1 | https://github.com/TomK/CronParser/blob/cdb1133e49ac2f68b45665f6df2a551bfb9824c1/src/CronParser.php#L142-L199 | train |
ezra-obiwale/dSCore | src/Form/Fieldset.php | Fieldset.getAttributes | final public function getAttributes($parsed = false) {
if (!is_array($this->attributes)) {
$this->attributes = array();
}
return ($parsed) ? $this->parseAttributes() : $this->attributes;
} | php | final public function getAttributes($parsed = false) {
if (!is_array($this->attributes)) {
$this->attributes = array();
}
return ($parsed) ? $this->parseAttributes() : $this->attributes;
} | [
"final",
"public",
"function",
"getAttributes",
"(",
"$",
"parsed",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"attributes",
")",
")",
"{",
"$",
"this",
"->",
"attributes",
"=",
"array",
"(",
")",
";",
"}",
"return",
... | Fetches the attributes of the fieldset
@param boolean $parsed
@return string|array | [
"Fetches",
"the",
"attributes",
"of",
"the",
"fieldset"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Fieldset.php#L106-L111 | train |
ezra-obiwale/dSCore | src/Form/Fieldset.php | Fieldset.setModel | final public function setModel(IModel $model) {
$this->model = $model;
$this->setData($model->toArray(false, true));
return $this;
} | php | final public function setModel(IModel $model) {
$this->model = $model;
$this->setData($model->toArray(false, true));
return $this;
} | [
"final",
"public",
"function",
"setModel",
"(",
"IModel",
"$",
"model",
")",
"{",
"$",
"this",
"->",
"model",
"=",
"$",
"model",
";",
"$",
"this",
"->",
"setData",
"(",
"$",
"model",
"->",
"toArray",
"(",
"false",
",",
"true",
")",
")",
";",
"retur... | Maps the form to a model
@param IModel $model
@return Form | [
"Maps",
"the",
"form",
"to",
"a",
"model"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Fieldset.php#L132-L136 | train |
ezra-obiwale/dSCore | src/Form/Fieldset.php | Fieldset.getModel | public function getModel() {
if (!$this->model)
return null;
$data = $this->data;
if ($this->isValid() && $this->model) {
foreach ($this->fieldsets as $name) {
if (!isset($this->elements[$name]))
continue;
$fieldset = ... | php | public function getModel() {
if (!$this->model)
return null;
$data = $this->data;
if ($this->isValid() && $this->model) {
foreach ($this->fieldsets as $name) {
if (!isset($this->elements[$name]))
continue;
$fieldset = ... | [
"public",
"function",
"getModel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"model",
")",
"return",
"null",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"data",
";",
"if",
"(",
"$",
"this",
"->",
"isValid",
"(",
")",
"&&",
"$",
"this",
"->... | Fetches the populated model
@return IModel | [
"Fetches",
"the",
"populated",
"model"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Fieldset.php#L146-L164 | train |
ezra-obiwale/dSCore | src/Form/Fieldset.php | Fieldset.add | public function add($element) {
if ((is_object($element) && !is_a($element, 'DScribe\Form\Element')) ||
(!is_object($element) && !is_array($element)))
throw new Exception('Form elements must be either an array or an object subclass of DScribe\Form\Element');
else if (is_array... | php | public function add($element) {
if ((is_object($element) && !is_a($element, 'DScribe\Form\Element')) ||
(!is_object($element) && !is_array($element)))
throw new Exception('Form elements must be either an array or an object subclass of DScribe\Form\Element');
else if (is_array... | [
"public",
"function",
"add",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"(",
"is_object",
"(",
"$",
"element",
")",
"&&",
"!",
"is_a",
"(",
"$",
"element",
",",
"'DScribe\\Form\\Element'",
")",
")",
"||",
"(",
"!",
"is_object",
"(",
"$",
"element",
")... | Adds an element to the fieldset
@param array | \DScribe\Form\Element $element
@return Fieldset
@throws Exception | [
"Adds",
"an",
"element",
"to",
"the",
"fieldset"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Fieldset.php#L183-L215 | train |
ezra-obiwale/dSCore | src/Form/Fieldset.php | Fieldset.setData | final public function setData($data) {
if ((is_object($data) && !is_a($data, 'Object')) || (!is_object($data) && !is_array($data)))
throw new \Exception('Data must be either an array or an object that extends Object: ' . gettype($data));
$data = is_array($data) ? $data : $data->toArray();
... | php | final public function setData($data) {
if ((is_object($data) && !is_a($data, 'Object')) || (!is_object($data) && !is_array($data)))
throw new \Exception('Data must be either an array or an object that extends Object: ' . gettype($data));
$data = is_array($data) ? $data : $data->toArray();
... | [
"final",
"public",
"function",
"setData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"(",
"is_object",
"(",
"$",
"data",
")",
"&&",
"!",
"is_a",
"(",
"$",
"data",
",",
"'Object'",
")",
")",
"||",
"(",
"!",
"is_object",
"(",
"$",
"data",
")",
"&&",
... | Sets data to validate
@param \Object | array $data
@return Fieldset|Element
@throws Exception | [
"Sets",
"data",
"to",
"validate"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Fieldset.php#L278-L290 | train |
ezra-obiwale/dSCore | src/Form/Fieldset.php | Fieldset.getData | final public function getData($toArray = false) {
if (is_null($this->valid))
throw new \Exception('Form must be validated before you can get data');
if ($toArray)
return ($this->data) ? $this->data : array();
else
return ($this->data) ? new \Object($this->dat... | php | final public function getData($toArray = false) {
if (is_null($this->valid))
throw new \Exception('Form must be validated before you can get data');
if ($toArray)
return ($this->data) ? $this->data : array();
else
return ($this->data) ? new \Object($this->dat... | [
"final",
"public",
"function",
"getData",
"(",
"$",
"toArray",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"valid",
")",
")",
"throw",
"new",
"\\",
"Exception",
"(",
"'Form must be validated before you can get data'",
")",
";",
"if"... | Fetches the filtered data
@return Object | [
"Fetches",
"the",
"filtered",
"data"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Fieldset.php#L296-L304 | train |
ezra-obiwale/dSCore | src/Form/Fieldset.php | Fieldset.render | public function render() {
$rendered = '';
foreach ($this->elements as $element) {
if (!method_exists($this, 'openTag')) {
$element->name = $this->multiple ?
$element->name . '[]' :
$this->getName() . '[' . $element->name . ']';... | php | public function render() {
$rendered = '';
foreach ($this->elements as $element) {
if (!method_exists($this, 'openTag')) {
$element->name = $this->multiple ?
$element->name . '[]' :
$this->getName() . '[' . $element->name . ']';... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"rendered",
"=",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"'openTag'",
")",
")",
"{",
"$",
... | Renders the elements of the fieldset out
@return string | [
"Renders",
"the",
"elements",
"of",
"the",
"fieldset",
"out"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Form/Fieldset.php#L315-L328 | train |
Polosa/shade-framework-core | app/Converter.php | Converter.formatBytes | public static function formatBytes($bytes, $precision = 2)
{
if ($bytes < 1024) {
return $bytes.' B';
} elseif ($bytes < 1048576) {
return round($bytes / 1024, $precision).' KB';
} elseif ($bytes < 1073741824) {
return round($bytes / 1048576, $precision).'... | php | public static function formatBytes($bytes, $precision = 2)
{
if ($bytes < 1024) {
return $bytes.' B';
} elseif ($bytes < 1048576) {
return round($bytes / 1024, $precision).' KB';
} elseif ($bytes < 1073741824) {
return round($bytes / 1048576, $precision).'... | [
"public",
"static",
"function",
"formatBytes",
"(",
"$",
"bytes",
",",
"$",
"precision",
"=",
"2",
")",
"{",
"if",
"(",
"$",
"bytes",
"<",
"1024",
")",
"{",
"return",
"$",
"bytes",
".",
"' B'",
";",
"}",
"elseif",
"(",
"$",
"bytes",
"<",
"1048576",... | Convert size in bytes to human readable format
@param integer $bytes Size in Bytes
@param integer $precision Number of decimal digits to round to
@return string | [
"Convert",
"size",
"in",
"bytes",
"to",
"human",
"readable",
"format"
] | d735d3e8e0616fb9cf4ffc25b8425762ed07940f | https://github.com/Polosa/shade-framework-core/blob/d735d3e8e0616fb9cf4ffc25b8425762ed07940f/app/Converter.php#L28-L41 | train |
congraphcms/core | Bus/CommandDispatcher.php | CommandDispatcher.validate | public function validate($command)
{
if ($command instanceof SelfValidating) {
return $this->container->call([$command, 'validate']);
}
$validatorClass = $this->getValidatorClass($command);
if(!$validatorClass) {
return;
}
$validator = $this->container->make($validatorClass);
$... | php | public function validate($command)
{
if ($command instanceof SelfValidating) {
return $this->container->call([$command, 'validate']);
}
$validatorClass = $this->getValidatorClass($command);
if(!$validatorClass) {
return;
}
$validator = $this->container->make($validatorClass);
$... | [
"public",
"function",
"validate",
"(",
"$",
"command",
")",
"{",
"if",
"(",
"$",
"command",
"instanceof",
"SelfValidating",
")",
"{",
"return",
"$",
"this",
"->",
"container",
"->",
"call",
"(",
"[",
"$",
"command",
",",
"'validate'",
"]",
")",
";",
"}... | Validate a command with its appropriate validator.
@param mixed $command
@return mixed | [
"Validate",
"a",
"command",
"with",
"its",
"appropriate",
"validator",
"."
] | d017d3951b446fb2ac93b8fcee120549bb125b17 | https://github.com/congraphcms/core/blob/d017d3951b446fb2ac93b8fcee120549bb125b17/Bus/CommandDispatcher.php#L150-L165 | train |
koolkode/stream | src/ChunkDecodedInputStream.php | ChunkDecodedInputStream.loadBuffer | protected function loadBuffer()
{
$this->remainder = 0;
if($this->ended)
{
return;
}
while(!$this->stream->eof() && strlen($this->buffer) < self::BUFFER_SIZE)
{
$this->buffer .= $this->stream->read(self::BUFFER_SIZE);
}
$m = NULL;
if(preg_match("'^\r?\n?([a-fA-F0-9]+).*\r\n'", $this... | php | protected function loadBuffer()
{
$this->remainder = 0;
if($this->ended)
{
return;
}
while(!$this->stream->eof() && strlen($this->buffer) < self::BUFFER_SIZE)
{
$this->buffer .= $this->stream->read(self::BUFFER_SIZE);
}
$m = NULL;
if(preg_match("'^\r?\n?([a-fA-F0-9]+).*\r\n'", $this... | [
"protected",
"function",
"loadBuffer",
"(",
")",
"{",
"$",
"this",
"->",
"remainder",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"ended",
")",
"{",
"return",
";",
"}",
"while",
"(",
"!",
"$",
"this",
"->",
"stream",
"->",
"eof",
"(",
")",
"&&",... | Load data of the next chunk into memory. | [
"Load",
"data",
"of",
"the",
"next",
"chunk",
"into",
"memory",
"."
] | 05e83efd76e1cb9e40a972711986b4a7e38bc141 | https://github.com/koolkode/stream/blob/05e83efd76e1cb9e40a972711986b4a7e38bc141/src/ChunkDecodedInputStream.php#L148-L193 | train |
spoom-php/core | src/extension/Helper/Wrapper.php | Wrapper.wrap | protected function wrap( StorageInterface $input, array $definition ) {
foreach( $definition as $property => $class ) {
// wrap the whole value in a class, or every subvalue
$is_array = $class{0} == '[' && $class{1} == ']';
/** @var self $class */
$class = ltrim( $class, '[]' );
// c... | php | protected function wrap( StorageInterface $input, array $definition ) {
foreach( $definition as $property => $class ) {
// wrap the whole value in a class, or every subvalue
$is_array = $class{0} == '[' && $class{1} == ']';
/** @var self $class */
$class = ltrim( $class, '[]' );
// c... | [
"protected",
"function",
"wrap",
"(",
"StorageInterface",
"$",
"input",
",",
"array",
"$",
"definition",
")",
"{",
"foreach",
"(",
"$",
"definition",
"as",
"$",
"property",
"=>",
"$",
"class",
")",
"{",
"// wrap the whole value in a class, or every subvalue",
"$",... | Wrap input elements in classes
@param StorageInterface $input
@param array $definition Defined operations
@throws \TypeError | [
"Wrap",
"input",
"elements",
"in",
"classes"
] | ea7184213352fa2fad7636927a019e5798734e04 | https://github.com/spoom-php/core/blob/ea7184213352fa2fad7636927a019e5798734e04/src/extension/Helper/Wrapper.php#L76-L100 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/SQLLiteCacheStore.php | SQLLiteCacheStore.getData | protected function getData($key)
{
$query = $this->db->query("SELECT value FROM cache WHERE key='" . $this->key($key) . "' AND expire >= datetime('now')");
return $query->fetch();
} | php | protected function getData($key)
{
$query = $this->db->query("SELECT value FROM cache WHERE key='" . $this->key($key) . "' AND expire >= datetime('now')");
return $query->fetch();
} | [
"protected",
"function",
"getData",
"(",
"$",
"key",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"db",
"->",
"query",
"(",
"\"SELECT value FROM cache WHERE key='\"",
".",
"$",
"this",
"->",
"key",
"(",
"$",
"key",
")",
".",
"\"' AND expire >= datetime('n... | Retrieves the data from the database
@param string $key The key to retrieve
@return array An array containing 'key', 'value', and 'expire' keys | [
"Retrieves",
"the",
"data",
"from",
"the",
"database"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/SQLLiteCacheStore.php#L79-L83 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/stores/SQLLiteCacheStore.php | SQLLiteCacheStore.writeData | protected function writeData($key, $value, $ttl)
{
if (!is_numeric($ttl) || $ttl < 0)
throw new CacheException('TTL invalid: '. $ttl);
if ($ttl == 0)
$expiration = "datetime('now', '+100 years')"; // This will make the cache expire after you die, so it's effectively forever.... | php | protected function writeData($key, $value, $ttl)
{
if (!is_numeric($ttl) || $ttl < 0)
throw new CacheException('TTL invalid: '. $ttl);
if ($ttl == 0)
$expiration = "datetime('now', '+100 years')"; // This will make the cache expire after you die, so it's effectively forever.... | [
"protected",
"function",
"writeData",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"ttl",
")",
"||",
"$",
"ttl",
"<",
"0",
")",
"throw",
"new",
"CacheException",
"(",
"'TTL invalid: '",
".",
... | Writes the data to the database
@param string $key The key to write
@param string $value The value to store
@param integer $ttl The length of time in seconds for the data to live.
@return boolean true if successful | [
"Writes",
"the",
"data",
"to",
"the",
"database"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/stores/SQLLiteCacheStore.php#L94-L107 | train |
naucon/Utility | src/IteratorAbstract.php | IteratorAbstract.previous | public function previous()
{
$this->_itemValid = true;
if (!prev($this->_items)) {
$this->_itemValid = false;
} else {
$this->_itemPosition--;
}
} | php | public function previous()
{
$this->_itemValid = true;
if (!prev($this->_items)) {
$this->_itemValid = false;
} else {
$this->_itemPosition--;
}
} | [
"public",
"function",
"previous",
"(",
")",
"{",
"$",
"this",
"->",
"_itemValid",
"=",
"true",
";",
"if",
"(",
"!",
"prev",
"(",
"$",
"this",
"->",
"_items",
")",
")",
"{",
"$",
"this",
"->",
"_itemValid",
"=",
"false",
";",
"}",
"else",
"{",
"$"... | set previous item as current item
@return void | [
"set",
"previous",
"item",
"as",
"current",
"item"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/IteratorAbstract.php#L131-L140 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/feedparser/FeedParser.php | FeedParser.parseFeed | public function parseFeed($url, $nativeOrder = false, $force = false)
{
require_once PATH_SYSTEM.'/vendors/SimplePie.php';
$feed = new SimplePie();
$feed->set_timeout($this->timeout);
$feed->set_feed_url($url);
$feed->enable_order_by_date(!$nativeOrder);
$feed->force... | php | public function parseFeed($url, $nativeOrder = false, $force = false)
{
require_once PATH_SYSTEM.'/vendors/SimplePie.php';
$feed = new SimplePie();
$feed->set_timeout($this->timeout);
$feed->set_feed_url($url);
$feed->enable_order_by_date(!$nativeOrder);
$feed->force... | [
"public",
"function",
"parseFeed",
"(",
"$",
"url",
",",
"$",
"nativeOrder",
"=",
"false",
",",
"$",
"force",
"=",
"false",
")",
"{",
"require_once",
"PATH_SYSTEM",
".",
"'/vendors/SimplePie.php'",
";",
"$",
"feed",
"=",
"new",
"SimplePie",
"(",
")",
";",
... | Opens an RSS feed, parses and loads the contents.
@param string $url The URL of the RSS feed
@param bool $nativeOrder If true, disable order by date to preserve native ordering
@param bool $force Force SimplePie to parse the feed despite errors
@return object An object that encapsulates the feed con... | [
"Opens",
"an",
"RSS",
"feed",
"parses",
"and",
"loads",
"the",
"contents",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/feedparser/FeedParser.php#L61-L86 | train |
Linkvalue-Interne/MajoraGeneratorBundle | src/Majora/Bundle/GeneratorBundle/Generator/ContentModifier/AbstractContentModifier.php | AbstractContentModifier.setUp | public function setUp(
$kernelDir,
FileLocatorInterface $fileLocator
)
{
$this->kernelDir = realpath($kernelDir);
$this->fileLocator = $fileLocator;
} | php | public function setUp(
$kernelDir,
FileLocatorInterface $fileLocator
)
{
$this->kernelDir = realpath($kernelDir);
$this->fileLocator = $fileLocator;
} | [
"public",
"function",
"setUp",
"(",
"$",
"kernelDir",
",",
"FileLocatorInterface",
"$",
"fileLocator",
")",
"{",
"$",
"this",
"->",
"kernelDir",
"=",
"realpath",
"(",
"$",
"kernelDir",
")",
";",
"$",
"this",
"->",
"fileLocator",
"=",
"$",
"fileLocator",
";... | abstract class setting up method
@param string $kernelDir
@param FileLocatorInterface $fileLocator | [
"abstract",
"class",
"setting",
"up",
"method"
] | 9f745c1f64e913df90d86b4fd0770121c563552d | https://github.com/Linkvalue-Interne/MajoraGeneratorBundle/blob/9f745c1f64e913df90d86b4fd0770121c563552d/src/Majora/Bundle/GeneratorBundle/Generator/ContentModifier/AbstractContentModifier.php#L22-L29 | train |
Linkvalue-Interne/MajoraGeneratorBundle | src/Majora/Bundle/GeneratorBundle/Generator/ContentModifier/AbstractContentModifier.php | AbstractContentModifier.resolveTargetFilePath | protected function resolveTargetFilePath($target, $basePath)
{
switch (true) {
// resource
case strpos($target, '@') === 0:
$targetPath = $this->fileLocator->locate($target);
break;
// kernel related
case strpos($target, '/') ... | php | protected function resolveTargetFilePath($target, $basePath)
{
switch (true) {
// resource
case strpos($target, '@') === 0:
$targetPath = $this->fileLocator->locate($target);
break;
// kernel related
case strpos($target, '/') ... | [
"protected",
"function",
"resolveTargetFilePath",
"(",
"$",
"target",
",",
"$",
"basePath",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"// resource",
"case",
"strpos",
"(",
"$",
"target",
",",
"'@'",
")",
"===",
"0",
":",
"$",
"targetPath",
"=",
"$",
"... | resolve given target file path
@param string $target
@param string $basePath
@return string
@throws \InvalidArgumentException if path cannot be resolved | [
"resolve",
"given",
"target",
"file",
"path"
] | 9f745c1f64e913df90d86b4fd0770121c563552d | https://github.com/Linkvalue-Interne/MajoraGeneratorBundle/blob/9f745c1f64e913df90d86b4fd0770121c563552d/src/Majora/Bundle/GeneratorBundle/Generator/ContentModifier/AbstractContentModifier.php#L41-L73 | train |
makinacorpus/drupal-apubsub | src/Backend/TypeRegistry.php | TypeRegistry.getTypeId | public function getTypeId($type, $createIfMissing = true)
{
if (null === $this->types) {
$this->loadCache();
}
if (false === ($key = array_search($type, $this->types, true))) {
if (!$createIfMissing) {
return null;
}
try {
... | php | public function getTypeId($type, $createIfMissing = true)
{
if (null === $this->types) {
$this->loadCache();
}
if (false === ($key = array_search($type, $this->types, true))) {
if (!$createIfMissing) {
return null;
}
try {
... | [
"public",
"function",
"getTypeId",
"(",
"$",
"type",
",",
"$",
"createIfMissing",
"=",
"true",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"types",
")",
"{",
"$",
"this",
"->",
"loadCache",
"(",
")",
";",
"}",
"if",
"(",
"false",
"===",
... | Get type identifier
@param string $type
Message type
@param boolean $createIfMissing
Create it if missing
@return int Message type id | [
"Get",
"type",
"identifier"
] | 534fbecf67c880996ae02210c0bfdb3e0d3699b6 | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/TypeRegistry.php#L53-L86 | train |
makinacorpus/drupal-apubsub | src/Backend/TypeRegistry.php | TypeRegistry.getType | public function getType($id)
{
if (null === $id) {
// The caller might call us using a row from database that contains
// a strict null, it is useless for us to do any query since null
// typed messages are valid by the MessageInterface signature
return null;
... | php | public function getType($id)
{
if (null === $id) {
// The caller might call us using a row from database that contains
// a strict null, it is useless for us to do any query since null
// typed messages are valid by the MessageInterface signature
return null;
... | [
"public",
"function",
"getType",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"id",
")",
"{",
"// The caller might call us using a row from database that contains",
"// a strict null, it is useless for us to do any query since null",
"// typed messages are valid by th... | Get type from identifier
@param int $id Message type id
@return string Message type | [
"Get",
"type",
"from",
"identifier"
] | 534fbecf67c880996ae02210c0bfdb3e0d3699b6 | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/TypeRegistry.php#L95-L125 | train |
makinacorpus/drupal-apubsub | src/Backend/TypeRegistry.php | TypeRegistry.convertQueryCondition | public function convertQueryCondition($value)
{
// First fetch the type
if (null === $value) {
return 0;
}
if (!is_array($value)) {
$value = [$value];
}
$hasOperator = false;
// FIXME Sorry for this
if (!Misc::isIndexed($valu... | php | public function convertQueryCondition($value)
{
// First fetch the type
if (null === $value) {
return 0;
}
if (!is_array($value)) {
$value = [$value];
}
$hasOperator = false;
// FIXME Sorry for this
if (!Misc::isIndexed($valu... | [
"public",
"function",
"convertQueryCondition",
"(",
"$",
"value",
")",
"{",
"// First fetch the type",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value"... | Convert given query condition value which is supposed to contain types
identifiers to integer identifiers
This function will take care of awaited query format | [
"Convert",
"given",
"query",
"condition",
"value",
"which",
"is",
"supposed",
"to",
"contain",
"types",
"identifiers",
"to",
"integer",
"identifiers"
] | 534fbecf67c880996ae02210c0bfdb3e0d3699b6 | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Backend/TypeRegistry.php#L133-L177 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/interfaces/FileCache.php | FileCache.getUsingFileTimestamps | public function getUsingFileTimestamps($key)
{
$value = $this->get($this->cacheKey($key));
$timestamps = $this->get($this->cachetskey($key));
if ($value !== false && $timestamps !== false) {
foreach ($timestamps as $file => $timestamp) {
if (filemtime($file) !=... | php | public function getUsingFileTimestamps($key)
{
$value = $this->get($this->cacheKey($key));
$timestamps = $this->get($this->cachetskey($key));
if ($value !== false && $timestamps !== false) {
foreach ($timestamps as $file => $timestamp) {
if (filemtime($file) !=... | [
"public",
"function",
"getUsingFileTimestamps",
"(",
"$",
"key",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"this",
"->",
"cacheKey",
"(",
"$",
"key",
")",
")",
";",
"$",
"timestamps",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
... | get cache using key, but check associated timestamps on cached file array
@param string $key The key of the cache item to retrieve
@return mixed the value of the stored cache item | [
"get",
"cache",
"using",
"key",
"but",
"check",
"associated",
"timestamps",
"on",
"cached",
"file",
"array"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/interfaces/FileCache.php#L46-L63 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/interfaces/FileCache.php | FileCache.putUsingFileTimestamps | public function putUsingFileTimestamps($key, $value, array $filenames, $duration = null)
{
if (empty($duration))
$duration = 0;
$files = array();
foreach ($filenames as $file) {
$files[$file] = filemtime($file);
}
$timestamps = md5($files);
... | php | public function putUsingFileTimestamps($key, $value, array $filenames, $duration = null)
{
if (empty($duration))
$duration = 0;
$files = array();
foreach ($filenames as $file) {
$files[$file] = filemtime($file);
}
$timestamps = md5($files);
... | [
"public",
"function",
"putUsingFileTimestamps",
"(",
"$",
"key",
",",
"$",
"value",
",",
"array",
"$",
"filenames",
",",
"$",
"duration",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"duration",
")",
")",
"$",
"duration",
"=",
"0",
";",
"$",
... | put cache value into cache store using timestamps of supplied files as a
tie on the validity of the cache
@param string $key The key for the cache
@param string $value The Value to store
@param array $filenames An array of filenames to update
@param string $duration The time-to-live for the cache data
@re... | [
"put",
"cache",
"value",
"into",
"cache",
"store",
"using",
"timestamps",
"of",
"supplied",
"files",
"as",
"a",
"tie",
"on",
"the",
"validity",
"of",
"the",
"cache"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/interfaces/FileCache.php#L77-L94 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/caching/interfaces/FileCache.php | FileCache.getFileContents | public function getFileContents($filename)
{
$cachecontents = $this->get($this->cachefilekey($filename));
// $timestamp = $this->get($this->cachefiletskey($filename));
if ($cachecontents !== false && is_array($cachecontents)) {
$contents = array_key_exists('v', $cachecontents)?... | php | public function getFileContents($filename)
{
$cachecontents = $this->get($this->cachefilekey($filename));
// $timestamp = $this->get($this->cachefiletskey($filename));
if ($cachecontents !== false && is_array($cachecontents)) {
$contents = array_key_exists('v', $cachecontents)?... | [
"public",
"function",
"getFileContents",
"(",
"$",
"filename",
")",
"{",
"$",
"cachecontents",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"this",
"->",
"cachefilekey",
"(",
"$",
"filename",
")",
")",
";",
"// $timestamp = $this->get($this->cachefiletskey($fil... | return the file contents, but cache the results indefinitely, break cache
if timestamp changes
@param string $filename The filename to load
@return string the contents of the file specified. | [
"return",
"the",
"file",
"contents",
"but",
"cache",
"the",
"results",
"indefinitely",
"break",
"cache",
"if",
"timestamp",
"changes"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/caching/interfaces/FileCache.php#L104-L127 | train |
Montage-Inc/php-montage | src/Montage.php | Montage.request | public function request($type, $url, $args = [])
{
$response = $this->getHTTPClient()
->$type($url, $args)
->getBody()
->getContents();
return json_decode($response);
} | php | public function request($type, $url, $args = [])
{
$response = $this->getHTTPClient()
->$type($url, $args)
->getBody()
->getContents();
return json_decode($response);
} | [
"public",
"function",
"request",
"(",
"$",
"type",
",",
"$",
"url",
",",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getHTTPClient",
"(",
")",
"->",
"$",
"type",
"(",
"$",
"url",
",",
"$",
"args",
")",
"->",
... | Our main request method to Montage. Uses Guzzle under
the hood to make the request, and will return the
json_decoded response from Montage.
@param $type
@param $url
@param array $args
@return mixed | [
"Our",
"main",
"request",
"method",
"to",
"Montage",
".",
"Uses",
"Guzzle",
"under",
"the",
"hood",
"to",
"make",
"the",
"request",
"and",
"will",
"return",
"the",
"json_decoded",
"response",
"from",
"Montage",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Montage.php#L76-L84 | train |
Montage-Inc/php-montage | src/Montage.php | Montage.auth | public function auth($user = null, $password = null)
{
if ($this->token) return $this;
if (is_null($user) || is_null($password))
{
throw new MontageAuthException('Must provide a username and password.');
}
try {
$response = $this->request('post', $th... | php | public function auth($user = null, $password = null)
{
if ($this->token) return $this;
if (is_null($user) || is_null($password))
{
throw new MontageAuthException('Must provide a username and password.');
}
try {
$response = $this->request('post', $th... | [
"public",
"function",
"auth",
"(",
"$",
"user",
"=",
"null",
",",
"$",
"password",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"token",
")",
"return",
"$",
"this",
";",
"if",
"(",
"is_null",
"(",
"$",
"user",
")",
"||",
"is_null",
"(",
... | Authenticate with Montage and set the local token.
@param null $user
@param null $password
@return $this
@throws MontageAuthException | [
"Authenticate",
"with",
"Montage",
"and",
"set",
"the",
"local",
"token",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Montage.php#L94-L117 | train |
Montage-Inc/php-montage | src/Montage.php | Montage.url | public function url($endpoint, $schema = null, $doc_id = null, $file_id = null)
{
return sprintf('api/v%d/%s', $this->version, $this->endpoint(
$endpoint,
$schema,
$doc_id,
$file_id
));
} | php | public function url($endpoint, $schema = null, $doc_id = null, $file_id = null)
{
return sprintf('api/v%d/%s', $this->version, $this->endpoint(
$endpoint,
$schema,
$doc_id,
$file_id
));
} | [
"public",
"function",
"url",
"(",
"$",
"endpoint",
",",
"$",
"schema",
"=",
"null",
",",
"$",
"doc_id",
"=",
"null",
",",
"$",
"file_id",
"=",
"null",
")",
"{",
"return",
"sprintf",
"(",
"'api/v%d/%s'",
",",
"$",
"this",
"->",
"version",
",",
"$",
... | Gets a formatted Montage endpoint, prefixed with api version.
@param $endpoint
@param null $schema
@param null $doc_id
@param null $file_id
@return string
@throws MontageUnknownEndpointException | [
"Gets",
"a",
"formatted",
"Montage",
"endpoint",
"prefixed",
"with",
"api",
"version",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Montage.php#L159-L167 | train |
Montage-Inc/php-montage | src/Montage.php | Montage.getHTTPClient | private function getHTTPClient()
{
$config = [
'base_uri' => sprintf(
'http://%s.%s/',
$this->subdomain,
$this->domain
),
'headers' => [
'Accept' => 'application/json',
'User-Agent' => sprintf... | php | private function getHTTPClient()
{
$config = [
'base_uri' => sprintf(
'http://%s.%s/',
$this->subdomain,
$this->domain
),
'headers' => [
'Accept' => 'application/json',
'User-Agent' => sprintf... | [
"private",
"function",
"getHTTPClient",
"(",
")",
"{",
"$",
"config",
"=",
"[",
"'base_uri'",
"=>",
"sprintf",
"(",
"'http://%s.%s/'",
",",
"$",
"this",
"->",
"subdomain",
",",
"$",
"this",
"->",
"domain",
")",
",",
"'headers'",
"=>",
"[",
"'Accept'",
"=... | Does what it says. Gets a guzzle client, with an Authorization header
set in case of an existing token.
@return Client | [
"Does",
"what",
"it",
"says",
".",
"Gets",
"a",
"guzzle",
"client",
"with",
"an",
"Authorization",
"header",
"set",
"in",
"case",
"of",
"an",
"existing",
"token",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Montage.php#L175-L202 | train |
Montage-Inc/php-montage | src/Montage.php | Montage.endpoint | private function endpoint($endpoint, $schema = null, $doc_id = null, $file_id = null)
{
$endpoints = [
'auth' => 'auth/',
'user' => 'auth/user/',
'schema-list' => 'schemas/',
'schema-detail' => 'schemas/%s/',
'document-query' => 'schemas/%s/query/'... | php | private function endpoint($endpoint, $schema = null, $doc_id = null, $file_id = null)
{
$endpoints = [
'auth' => 'auth/',
'user' => 'auth/user/',
'schema-list' => 'schemas/',
'schema-detail' => 'schemas/%s/',
'document-query' => 'schemas/%s/query/'... | [
"private",
"function",
"endpoint",
"(",
"$",
"endpoint",
",",
"$",
"schema",
"=",
"null",
",",
"$",
"doc_id",
"=",
"null",
",",
"$",
"file_id",
"=",
"null",
")",
"{",
"$",
"endpoints",
"=",
"[",
"'auth'",
"=>",
"'auth/'",
",",
"'user'",
"=>",
"'auth/... | Creates a formatted Montage API endpoint string.
@param $endpoint
@param null $schema
@param null $doc_id
@param null $file_id
@return string
@throws MontageUnknownEndpointException | [
"Creates",
"a",
"formatted",
"Montage",
"API",
"endpoint",
"string",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Montage.php#L214-L245 | train |
Montage-Inc/php-montage | src/Montage.php | Montage.schemas | public function schemas($schemaName = null)
{
if (is_null($schemaName)) {
$url = $this->url('schema-list');
return $this->request('get', $url);
}
return $this->schema($schemaName);
} | php | public function schemas($schemaName = null)
{
if (is_null($schemaName)) {
$url = $this->url('schema-list');
return $this->request('get', $url);
}
return $this->schema($schemaName);
} | [
"public",
"function",
"schemas",
"(",
"$",
"schemaName",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"schemaName",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"url",
"(",
"'schema-list'",
")",
";",
"return",
"$",
"this",
"->",
"re... | Get a list of all schemas for the given users token.
@return mixed | [
"Get",
"a",
"list",
"of",
"all",
"schemas",
"for",
"the",
"given",
"users",
"token",
"."
] | bcd526985447a31c7e5b74555058e167242b23ed | https://github.com/Montage-Inc/php-montage/blob/bcd526985447a31c7e5b74555058e167242b23ed/src/Montage.php#L252-L260 | train |
Innmind/Math | src/Geometry/Theorem/Pythagora.php | Pythagora.hypotenuse | public static function hypotenuse(
Segment $a,
Segment $b
): Segment {
$hypotenuse = $a
->length()
->power(new Integer(2))
->add($b->length()->power(new Integer(2)))
->squareRoot();
return new Segment($hypotenuse);
} | php | public static function hypotenuse(
Segment $a,
Segment $b
): Segment {
$hypotenuse = $a
->length()
->power(new Integer(2))
->add($b->length()->power(new Integer(2)))
->squareRoot();
return new Segment($hypotenuse);
} | [
"public",
"static",
"function",
"hypotenuse",
"(",
"Segment",
"$",
"a",
",",
"Segment",
"$",
"b",
")",
":",
"Segment",
"{",
"$",
"hypotenuse",
"=",
"$",
"a",
"->",
"length",
"(",
")",
"->",
"power",
"(",
"new",
"Integer",
"(",
"2",
")",
")",
"->",
... | Compute the hypotenuse for adjacent sides A and B | [
"Compute",
"the",
"hypotenuse",
"for",
"adjacent",
"sides",
"A",
"and",
"B"
] | ac9ad4dd1852c145e90f5edc0f38a873b125a50b | https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Geometry/Theorem/Pythagora.php#L19-L30 | train |
Innmind/Math | src/Geometry/Theorem/Pythagora.php | Pythagora.adjacentSide | public static function adjacentSide(
Segment $hypotenuse,
Segment $adjacentSide
): Segment {
$side = $hypotenuse
->length()
->power(new Integer(2))
->subtract($adjacentSide->length()->power(new Integer(2)))
->squareRoot();
return new S... | php | public static function adjacentSide(
Segment $hypotenuse,
Segment $adjacentSide
): Segment {
$side = $hypotenuse
->length()
->power(new Integer(2))
->subtract($adjacentSide->length()->power(new Integer(2)))
->squareRoot();
return new S... | [
"public",
"static",
"function",
"adjacentSide",
"(",
"Segment",
"$",
"hypotenuse",
",",
"Segment",
"$",
"adjacentSide",
")",
":",
"Segment",
"{",
"$",
"side",
"=",
"$",
"hypotenuse",
"->",
"length",
"(",
")",
"->",
"power",
"(",
"new",
"Integer",
"(",
"2... | Compute a side A or B from the hypotenuse and one side | [
"Compute",
"a",
"side",
"A",
"or",
"B",
"from",
"the",
"hypotenuse",
"and",
"one",
"side"
] | ac9ad4dd1852c145e90f5edc0f38a873b125a50b | https://github.com/Innmind/Math/blob/ac9ad4dd1852c145e90f5edc0f38a873b125a50b/src/Geometry/Theorem/Pythagora.php#L35-L46 | train |
kambalabs/KmbDomain | src/KmbDomain/Service/RevisionFactory.php | RevisionFactory.createFromImportedData | public function createFromImportedData($data)
{
$revision = new Revision();
$revision->setReleasedAt(new \DateTime($data['released_at']));
$revision->setReleasedBy($data['released_by']);
$revision->setComment($data['comment']);
foreach ($data['groups'] as $groupData) {
... | php | public function createFromImportedData($data)
{
$revision = new Revision();
$revision->setReleasedAt(new \DateTime($data['released_at']));
$revision->setReleasedBy($data['released_by']);
$revision->setComment($data['comment']);
foreach ($data['groups'] as $groupData) {
... | [
"public",
"function",
"createFromImportedData",
"(",
"$",
"data",
")",
"{",
"$",
"revision",
"=",
"new",
"Revision",
"(",
")",
";",
"$",
"revision",
"->",
"setReleasedAt",
"(",
"new",
"\\",
"DateTime",
"(",
"$",
"data",
"[",
"'released_at'",
"]",
")",
")... | Create Revision instance from imported data.
@param array $data
@return Revision | [
"Create",
"Revision",
"instance",
"from",
"imported",
"data",
"."
] | b1631bd936c6c6798076b51dfaebd706e1bdc8c2 | https://github.com/kambalabs/KmbDomain/blob/b1631bd936c6c6798076b51dfaebd706e1bdc8c2/src/KmbDomain/Service/RevisionFactory.php#L36-L46 | train |
Wedeto/DB | src/Driver/Driver.php | Driver.identQuote | public function identQuote(string $name)
{
return $this->iquotechar . str_replace($this->iquotechar, $this->iquotechar . $this->iquotechar, $name) . $this->iquotechar;
} | php | public function identQuote(string $name)
{
return $this->iquotechar . str_replace($this->iquotechar, $this->iquotechar . $this->iquotechar, $name) . $this->iquotechar;
} | [
"public",
"function",
"identQuote",
"(",
"string",
"$",
"name",
")",
"{",
"return",
"$",
"this",
"->",
"iquotechar",
".",
"str_replace",
"(",
"$",
"this",
"->",
"iquotechar",
",",
"$",
"this",
"->",
"iquotechar",
".",
"$",
"this",
"->",
"iquotechar",
","... | Quote the name of an identity
@param $name string The name to quote
@return string The quoted name | [
"Quote",
"the",
"name",
"of",
"an",
"identity"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Driver/Driver.php#L89-L92 | train |
Wedeto/DB | src/Driver/Driver.php | Driver.getName | public function getName($entity, $quote = true)
{
if (is_object($entity))
$entity = $entity->getName();
if (!is_string($entity))
throw new InvalidTypeException("Provide a string or a object with a getName method");
$entity = $this->table_prefix . $entity;
retu... | php | public function getName($entity, $quote = true)
{
if (is_object($entity))
$entity = $entity->getName();
if (!is_string($entity))
throw new InvalidTypeException("Provide a string or a object with a getName method");
$entity = $this->table_prefix . $entity;
retu... | [
"public",
"function",
"getName",
"(",
"$",
"entity",
",",
"$",
"quote",
"=",
"true",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"entity",
")",
")",
"$",
"entity",
"=",
"$",
"entity",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"is_string",
"... | Return the identity name quoted and prefixed with the configured prefix.
@param $entity mixed A string with the name or a Table, Index or ForeignKey
object with a getName method.
@return string The quoted, prefixed name | [
"Return",
"the",
"identity",
"name",
"quoted",
"and",
"prefixed",
"with",
"the",
"configured",
"prefix",
"."
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Driver/Driver.php#L101-L109 | train |
Wedeto/DB | src/Driver/Driver.php | Driver.truncateTable | public function truncateTable($table)
{
$query = "TRUNCATE " . $this->getName($table->getName());
$this->db->exec($query);
return $this;
} | php | public function truncateTable($table)
{
$query = "TRUNCATE " . $this->getName($table->getName());
$this->db->exec($query);
return $this;
} | [
"public",
"function",
"truncateTable",
"(",
"$",
"table",
")",
"{",
"$",
"query",
"=",
"\"TRUNCATE \"",
".",
"$",
"this",
"->",
"getName",
"(",
"$",
"table",
"->",
"getName",
"(",
")",
")",
";",
"$",
"this",
"->",
"db",
"->",
"exec",
"(",
"$",
"que... | Remove all rows from the table
@param $table mixed The table from which to remove
@return Driver Provides fluent interface | [
"Remove",
"all",
"rows",
"from",
"the",
"table"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Driver/Driver.php#L183-L188 | train |
Wedeto/DB | src/Driver/Driver.php | Driver.toSQL | public function toSQL(Parameters $params, Query\Clause $clause, bool $inner_clause = false)
{
$params->setDriver($this);
return $clause->toSQL($params, $inner_clause);
} | php | public function toSQL(Parameters $params, Query\Clause $clause, bool $inner_clause = false)
{
$params->setDriver($this);
return $clause->toSQL($params, $inner_clause);
} | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"Query",
"\\",
"Clause",
"$",
"clause",
",",
"bool",
"$",
"inner_clause",
"=",
"false",
")",
"{",
"$",
"params",
"->",
"setDriver",
"(",
"$",
"this",
")",
";",
"return",
"$",
"clause... | Write an query clause as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@param Clause $clause The clause to write
@param bool $inner_clause Whether this is a inner or outer clause. An
inner clause will be wrapped in braces when
it's a binary operator.
@return string The g... | [
"Write",
"an",
"query",
"clause",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Driver/Driver.php#L267-L271 | train |
cubicmushroom/valueobjects | src/DateTime/Time.php | Time.fromNative | public static function fromNative()
{
$args = func_get_args();
$hour = new Hour($args[0]);
$minute = new Minute($args[1]);
$second = new Second($args[2]);
return new static($hour, $minute, $second);
} | php | public static function fromNative()
{
$args = func_get_args();
$hour = new Hour($args[0]);
$minute = new Minute($args[1]);
$second = new Second($args[2]);
return new static($hour, $minute, $second);
} | [
"public",
"static",
"function",
"fromNative",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"hour",
"=",
"new",
"Hour",
"(",
"$",
"args",
"[",
"0",
"]",
")",
";",
"$",
"minute",
"=",
"new",
"Minute",
"(",
"$",
"args",
"[",... | Returns a nee Time object from native int hour, minute and second
@param int $hour
@param int $minute
@param int $second
@return self | [
"Returns",
"a",
"nee",
"Time",
"object",
"from",
"native",
"int",
"hour",
"minute",
"and",
"second"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/DateTime/Time.php#L27-L36 | train |
cubicmushroom/valueobjects | src/DateTime/Time.php | Time.fromNativeDateTime | public static function fromNativeDateTime(\DateTime $time)
{
$hour = \intval($time->format('G'));
$minute = \intval($time->format('i'));
$second = \intval($time->format('s'));
return static::fromNative($hour, $minute, $second);
} | php | public static function fromNativeDateTime(\DateTime $time)
{
$hour = \intval($time->format('G'));
$minute = \intval($time->format('i'));
$second = \intval($time->format('s'));
return static::fromNative($hour, $minute, $second);
} | [
"public",
"static",
"function",
"fromNativeDateTime",
"(",
"\\",
"DateTime",
"$",
"time",
")",
"{",
"$",
"hour",
"=",
"\\",
"intval",
"(",
"$",
"time",
"->",
"format",
"(",
"'G'",
")",
")",
";",
"$",
"minute",
"=",
"\\",
"intval",
"(",
"$",
"time",
... | Returns a new Time from a native PHP \DateTime
@param \DateTime $time
@return self | [
"Returns",
"a",
"new",
"Time",
"from",
"a",
"native",
"PHP",
"\\",
"DateTime"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/DateTime/Time.php#L44-L51 | train |
cubicmushroom/valueobjects | src/DateTime/Time.php | Time.sameValueAs | public function sameValueAs(ValueObjectInterface $time)
{
if (false === Util::classEquals($this, $time)) {
return false;
}
return $this->getHour()->sameValueAs($time->getHour()) && $this->getMinute()->sameValueAs($time->getMinute()) && $this->getSecond()->sameValueAs($time->getS... | php | public function sameValueAs(ValueObjectInterface $time)
{
if (false === Util::classEquals($this, $time)) {
return false;
}
return $this->getHour()->sameValueAs($time->getHour()) && $this->getMinute()->sameValueAs($time->getMinute()) && $this->getSecond()->sameValueAs($time->getS... | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"time",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"time",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->"... | Tells whether two Time are equal by comparing their values
@param ValueObjectInterface $time
@return bool | [
"Tells",
"whether",
"two",
"Time",
"are",
"equal",
"by",
"comparing",
"their",
"values"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/DateTime/Time.php#L97-L104 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Stream/Stream.php | Stream.factory | public static function factory($resource = '', $size = null)
{
$type = gettype($resource);
if ($type == 'string') {
$stream = fopen('php://temp', 'r+');
if ($resource !== '') {
fwrite($stream, $resource);
fseek($stream, 0);
}
... | php | public static function factory($resource = '', $size = null)
{
$type = gettype($resource);
if ($type == 'string') {
$stream = fopen('php://temp', 'r+');
if ($resource !== '') {
fwrite($stream, $resource);
fseek($stream, 0);
}
... | [
"public",
"static",
"function",
"factory",
"(",
"$",
"resource",
"=",
"''",
",",
"$",
"size",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"gettype",
"(",
"$",
"resource",
")",
";",
"if",
"(",
"$",
"type",
"==",
"'string'",
")",
"{",
"$",
"stream",
"... | Create a new stream based on the input type
@param resource|string|StreamInterface $resource Entity body data
@param int $size Size of the data contained in the resource
@return Stream
@throws \InvalidArgumentException if the $resource arg is not valid. | [
"Create",
"a",
"new",
"stream",
"based",
"on",
"the",
"input",
"type"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Stream/Stream.php#L41-L67 | train |
opis-colibri/core | src/Module.php | Module.getModuleInfo | protected function getModuleInfo(): array
{
if ($this->moduleInfo === null) {
$this->moduleInfo = $this->package()->getExtra()['module'] ?? [];
}
return $this->moduleInfo;
} | php | protected function getModuleInfo(): array
{
if ($this->moduleInfo === null) {
$this->moduleInfo = $this->package()->getExtra()['module'] ?? [];
}
return $this->moduleInfo;
} | [
"protected",
"function",
"getModuleInfo",
"(",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"moduleInfo",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"moduleInfo",
"=",
"$",
"this",
"->",
"package",
"(",
")",
"->",
"getExtra",
"(",
")",
"[",... | Resolve module info
@return array | [
"Resolve",
"module",
"info"
] | 77efaf8e2034293588d3759e0b8711e96757d954 | https://github.com/opis-colibri/core/blob/77efaf8e2034293588d3759e0b8711e96757d954/src/Module.php#L330-L337 | train |
opis-colibri/core | src/Module.php | Module.resolveTitle | protected function resolveTitle(): string
{
$title = trim($this->getModuleInfo()['title'] ?? '');
if (empty($title)) {
$name = substr($this->name, strpos($this->name, '/') + 1);
$name = array_map(function ($value) {
return strtolower($value);
}, e... | php | protected function resolveTitle(): string
{
$title = trim($this->getModuleInfo()['title'] ?? '');
if (empty($title)) {
$name = substr($this->name, strpos($this->name, '/') + 1);
$name = array_map(function ($value) {
return strtolower($value);
}, e... | [
"protected",
"function",
"resolveTitle",
"(",
")",
":",
"string",
"{",
"$",
"title",
"=",
"trim",
"(",
"$",
"this",
"->",
"getModuleInfo",
"(",
")",
"[",
"'title'",
"]",
"??",
"''",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"title",
")",
")",
"{",
... | Resolve module's title
@return string | [
"Resolve",
"module",
"s",
"title"
] | 77efaf8e2034293588d3759e0b8711e96757d954 | https://github.com/opis-colibri/core/blob/77efaf8e2034293588d3759e0b8711e96757d954/src/Module.php#L344-L357 | train |
opis-colibri/core | src/Module.php | Module.resolveDirectory | protected function resolveDirectory(string $name): string
{
$dir = rtrim($this->manager->vendorDir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$dir .= rtrim(implode(DIRECTORY_SEPARATOR, explode('/', $name)), DIRECTORY_SEPARATOR);
return $dir;
} | php | protected function resolveDirectory(string $name): string
{
$dir = rtrim($this->manager->vendorDir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$dir .= rtrim(implode(DIRECTORY_SEPARATOR, explode('/', $name)), DIRECTORY_SEPARATOR);
return $dir;
} | [
"protected",
"function",
"resolveDirectory",
"(",
"string",
"$",
"name",
")",
":",
"string",
"{",
"$",
"dir",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"manager",
"->",
"vendorDir",
"(",
")",
",",
"DIRECTORY_SEPARATOR",
")",
".",
"DIRECTORY_SEPARATOR",
";",
"$... | Resolve module's directory
@param string $name
@return string | [
"Resolve",
"module",
"s",
"directory"
] | 77efaf8e2034293588d3759e0b8711e96757d954 | https://github.com/opis-colibri/core/blob/77efaf8e2034293588d3759e0b8711e96757d954/src/Module.php#L375-L380 | train |
opis-colibri/core | src/Module.php | Module.resolveCollector | protected function resolveCollector(): ?string
{
$value = $this->getModuleInfo()['collector'] ?? null;
return is_string($value) ? $value : null;
} | php | protected function resolveCollector(): ?string
{
$value = $this->getModuleInfo()['collector'] ?? null;
return is_string($value) ? $value : null;
} | [
"protected",
"function",
"resolveCollector",
"(",
")",
":",
"?",
"string",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getModuleInfo",
"(",
")",
"[",
"'collector'",
"]",
"??",
"null",
";",
"return",
"is_string",
"(",
"$",
"value",
")",
"?",
"$",
"value... | Resolve collector class
@return string|null | [
"Resolve",
"collector",
"class"
] | 77efaf8e2034293588d3759e0b8711e96757d954 | https://github.com/opis-colibri/core/blob/77efaf8e2034293588d3759e0b8711e96757d954/src/Module.php#L387-L392 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.