repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
acasademont/wurfl | WURFL/WURFLManagerFactory.php | WURFL_WURFLManagerFactory.deviceRepository | private function deviceRepository($persistenceStorage, $userAgentHandlerChain)
{
$devicePatcher = new WURFL_Xml_DevicePatcher();
$deviceRepositoryBuilder = new WURFL_DeviceRepositoryBuilder($persistenceStorage, $userAgentHandlerChain, $devicePatcher);
return $deviceRepositoryBuilder->build($... | php | private function deviceRepository($persistenceStorage, $userAgentHandlerChain)
{
$devicePatcher = new WURFL_Xml_DevicePatcher();
$deviceRepositoryBuilder = new WURFL_DeviceRepositoryBuilder($persistenceStorage, $userAgentHandlerChain, $devicePatcher);
return $deviceRepositoryBuilder->build($... | [
"private",
"function",
"deviceRepository",
"(",
"$",
"persistenceStorage",
",",
"$",
"userAgentHandlerChain",
")",
"{",
"$",
"devicePatcher",
"=",
"new",
"WURFL_Xml_DevicePatcher",
"(",
")",
";",
"$",
"deviceRepositoryBuilder",
"=",
"new",
"WURFL_DeviceRepositoryBuilder... | Returns a WURFL device repository
@param WURFL_Storage_Base $persistenceStorage
@param WURFL_UserAgentHandlerChain $userAgentHandlerChain
@return WURFL_CustomDeviceRepository Device repository
@see WURFL_DeviceRepositoryBuilder::build() | [
"Returns",
"a",
"WURFL",
"device",
"repository"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/WURFLManagerFactory.php#L173-L178 |
fuzz-productions/laravel-api-data | src/Schema/SchemaUtility.php | SchemaUtility.commentTable | public static function commentTable($table, $comment, $connection = null)
{
if (is_null($connection)) {
$connection = DB::connection();
}
if ($connection->getDriverName() === 'sqlite') {
return;
}
$connection->statement(
sprintf(
'ALTER TABLE `%s` COMMENT = "%s"', $table, addslashes($comment)
... | php | public static function commentTable($table, $comment, $connection = null)
{
if (is_null($connection)) {
$connection = DB::connection();
}
if ($connection->getDriverName() === 'sqlite') {
return;
}
$connection->statement(
sprintf(
'ALTER TABLE `%s` COMMENT = "%s"', $table, addslashes($comment)
... | [
"public",
"static",
"function",
"commentTable",
"(",
"$",
"table",
",",
"$",
"comment",
",",
"$",
"connection",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"connection",
")",
")",
"{",
"$",
"connection",
"=",
"DB",
"::",
"connection",
"(",
... | Add a comment at the level of a table.
@param string $table
@param string $comment
@param Connection $connection
@return void | [
"Add",
"a",
"comment",
"at",
"the",
"level",
"of",
"a",
"table",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Schema/SchemaUtility.php#L18-L33 |
fuzz-productions/laravel-api-data | src/Schema/SchemaUtility.php | SchemaUtility.describeTable | public static function describeTable($table, $connection = null)
{
if (is_null($connection)) {
$connection = DB::connection();
}
if ($connection->getDriverName() === 'sqlite') {
$result = $connection->select(sprintf('PRAGMA table_info(%s)', $table));
$column_key = 'name';
} else {
$result = $conne... | php | public static function describeTable($table, $connection = null)
{
if (is_null($connection)) {
$connection = DB::connection();
}
if ($connection->getDriverName() === 'sqlite') {
$result = $connection->select(sprintf('PRAGMA table_info(%s)', $table));
$column_key = 'name';
} else {
$result = $conne... | [
"public",
"static",
"function",
"describeTable",
"(",
"$",
"table",
",",
"$",
"connection",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"connection",
")",
")",
"{",
"$",
"connection",
"=",
"DB",
"::",
"connection",
"(",
")",
";",
"}",
"if"... | Describe a table's columns.
@param string $table
@param Connection $connection
@return array | [
"Describe",
"a",
"table",
"s",
"columns",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Schema/SchemaUtility.php#L42-L65 |
okvpn/fixture-bundle | src/Migration/Loader/DataFixturesLoader.php | DataFixturesLoader.isFixtureAlreadyLoaded | protected function isFixtureAlreadyLoaded($fixtureObject)
{
if (!$this->loadedFixtures) {
$this->loadedFixtures = [];
$loadedFixtures = $this->em->getRepository('OkvpnFixtureBundle:DataFixture')->findAll();
/** @var DataFixture $fixture */
foreach ($loadedFix... | php | protected function isFixtureAlreadyLoaded($fixtureObject)
{
if (!$this->loadedFixtures) {
$this->loadedFixtures = [];
$loadedFixtures = $this->em->getRepository('OkvpnFixtureBundle:DataFixture')->findAll();
/** @var DataFixture $fixture */
foreach ($loadedFix... | [
"protected",
"function",
"isFixtureAlreadyLoaded",
"(",
"$",
"fixtureObject",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"loadedFixtures",
")",
"{",
"$",
"this",
"->",
"loadedFixtures",
"=",
"[",
"]",
";",
"$",
"loadedFixtures",
"=",
"$",
"this",
"->",
... | Determines whether the given data fixture is already loaded or not
@param object $fixtureObject
@return bool | [
"Determines",
"whether",
"the",
"given",
"data",
"fixture",
"is",
"already",
"loaded",
"or",
"not"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Migration/Loader/DataFixturesLoader.php#L81-L109 |
fuelphp/display | src/Parser/Php.php | Php.parse | public function parse($file, array $data = [])
{
$obCleanRoom = function ($__file, $__data)
{
extract($__data, EXTR_REFS);
ob_start();
try
{
// Load the view within the current scope
include $__file;
}
catch (Exception $exception)
{
// Delete the output buffer
ob_end_clean();
... | php | public function parse($file, array $data = [])
{
$obCleanRoom = function ($__file, $__data)
{
extract($__data, EXTR_REFS);
ob_start();
try
{
// Load the view within the current scope
include $__file;
}
catch (Exception $exception)
{
// Delete the output buffer
ob_end_clean();
... | [
"public",
"function",
"parse",
"(",
"$",
"file",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"obCleanRoom",
"=",
"function",
"(",
"$",
"__file",
",",
"$",
"__data",
")",
"{",
"extract",
"(",
"$",
"__data",
",",
"EXTR_REFS",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Parser/Php.php#L23-L49 |
WebDevTmas/date-repetition | src/DateRepetition/HourlyDateRepetition.php | HourlyDateRepetition.setMinute | public function setMinute($minute)
{
if(! in_array($minute, range(0, 59))) {
throw new InvalidArgumentException('Minute must be between 0 and 59');
}
$this->minute = $minute;
return $this;
} | php | public function setMinute($minute)
{
if(! in_array($minute, range(0, 59))) {
throw new InvalidArgumentException('Minute must be between 0 and 59');
}
$this->minute = $minute;
return $this;
} | [
"public",
"function",
"setMinute",
"(",
"$",
"minute",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"minute",
",",
"range",
"(",
"0",
",",
"59",
")",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Minute must be between 0 and 59'",
")... | Sets minutes in repetition
@param integer minutes
@return this | [
"Sets",
"minutes",
"in",
"repetition"
] | train | https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/HourlyDateRepetition.php#L59-L66 |
Atlantic18/CoralCoreBundle | Service/Connector/AbstractConnector.php | AbstractConnector.doPostRequest | public function doPostRequest($uri, $data = null)
{
return $this->doRequest(Request::POST, $uri, $data);
} | php | public function doPostRequest($uri, $data = null)
{
return $this->doRequest(Request::POST, $uri, $data);
} | [
"public",
"function",
"doPostRequest",
"(",
"$",
"uri",
",",
"$",
"data",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"doRequest",
"(",
"Request",
"::",
"POST",
",",
"$",
"uri",
",",
"$",
"data",
")",
";",
"}"
] | Create POST request to CORAL backend
@param string $uri Service URI
@param array $data Datat to be sent
@return JsonResponse Response | [
"Create",
"POST",
"request",
"to",
"CORAL",
"backend"
] | train | https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Service/Connector/AbstractConnector.php#L26-L29 |
etki/opencart-core-installer | src/FileJunglist.php | FileJunglist.saveModifiedFiles | public function saveModifiedFiles($installPath)
{
DebugPrinter::log('Saving modified items');
$tmpRoot = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
$installPath = trim($installPath, '\\/') . DIRECTORY_SEPARATOR;
$fsm = new Filesystem;
DebugPrinter::log(
'Items to s... | php | public function saveModifiedFiles($installPath)
{
DebugPrinter::log('Saving modified items');
$tmpRoot = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
$installPath = trim($installPath, '\\/') . DIRECTORY_SEPARATOR;
$fsm = new Filesystem;
DebugPrinter::log(
'Items to s... | [
"public",
"function",
"saveModifiedFiles",
"(",
"$",
"installPath",
")",
"{",
"DebugPrinter",
"::",
"log",
"(",
"'Saving modified items'",
")",
";",
"$",
"tmpRoot",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
";",
"$",
"installPath",
"=",
"tri... | Saves config files during install.
@param string $installPath Opencart install path.
@return void
@since 0.1.0 | [
"Saves",
"config",
"files",
"during",
"install",
"."
] | train | https://github.com/etki/opencart-core-installer/blob/e651c94982afe966cd36977bbdc2ff4f7e785475/src/FileJunglist.php#L58-L84 |
etki/opencart-core-installer | src/FileJunglist.php | FileJunglist.restoreModifiedFiles | public function restoreModifiedFiles($installPath)
{
DebugPrinter::log('Restoring modified items');
$tmpRoot = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
$installPath = trim($installPath, '\\/') . DIRECTORY_SEPARATOR;
$fsm = new Filesystem;
DebugPrinter::log(
'Item... | php | public function restoreModifiedFiles($installPath)
{
DebugPrinter::log('Restoring modified items');
$tmpRoot = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
$installPath = trim($installPath, '\\/') . DIRECTORY_SEPARATOR;
$fsm = new Filesystem;
DebugPrinter::log(
'Item... | [
"public",
"function",
"restoreModifiedFiles",
"(",
"$",
"installPath",
")",
"{",
"DebugPrinter",
"::",
"log",
"(",
"'Restoring modified items'",
")",
";",
"$",
"tmpRoot",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
";",
"$",
"installPath",
"=",
... | Restores previously saved config files.
@param string $installPath Opencart installation path.
@return void
@since 0.1.1 | [
"Restores",
"previously",
"saved",
"config",
"files",
"."
] | train | https://github.com/etki/opencart-core-installer/blob/e651c94982afe966cd36977bbdc2ff4f7e785475/src/FileJunglist.php#L94-L119 |
etki/opencart-core-installer | src/FileJunglist.php | FileJunglist.setPermissions | protected function setPermissions($installPath, $basePerms = 0644)
{
$fsm = new Filesystem;
foreach ($this->chmodNodes as $fsNode) {
$path = $installPath . DIRECTORY_SEPARATOR . $fsNode;
$isFile = is_file($path);
$isDir = is_dir($path);
if (!$isFile &&... | php | protected function setPermissions($installPath, $basePerms = 0644)
{
$fsm = new Filesystem;
foreach ($this->chmodNodes as $fsNode) {
$path = $installPath . DIRECTORY_SEPARATOR . $fsNode;
$isFile = is_file($path);
$isDir = is_dir($path);
if (!$isFile &&... | [
"protected",
"function",
"setPermissions",
"(",
"$",
"installPath",
",",
"$",
"basePerms",
"=",
"0644",
")",
"{",
"$",
"fsm",
"=",
"new",
"Filesystem",
";",
"foreach",
"(",
"$",
"this",
"->",
"chmodNodes",
"as",
"$",
"fsNode",
")",
"{",
"$",
"path",
"=... | Sets Opencart folder permissions as required in manual.
@param string $installPath Opencart install path.
@param int $basePerms Base permissions. Please note that all
directories permissions will be masked by 111
(this will set all three ugo executive bits).
@return void
@since 0.1.1 | [
"Sets",
"Opencart",
"folder",
"permissions",
"as",
"required",
"in",
"manual",
"."
] | train | https://github.com/etki/opencart-core-installer/blob/e651c94982afe966cd36977bbdc2ff4f7e785475/src/FileJunglist.php#L132-L151 |
etki/opencart-core-installer | src/FileJunglist.php | FileJunglist.rotateInstalledFiles | public function rotateInstalledFiles($installPath)
{
$fsm = new Filesystem;
$tempDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('oci-');
DebugPrinter::log('Rotating files using `%s` dir', $tempDir);
// unzipped contents may or may not contain `upload.*` directory,
//... | php | public function rotateInstalledFiles($installPath)
{
$fsm = new Filesystem;
$tempDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('oci-');
DebugPrinter::log('Rotating files using `%s` dir', $tempDir);
// unzipped contents may or may not contain `upload.*` directory,
//... | [
"public",
"function",
"rotateInstalledFiles",
"(",
"$",
"installPath",
")",
"{",
"$",
"fsm",
"=",
"new",
"Filesystem",
";",
"$",
"tempDir",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"DIRECTORY_SEPARATOR",
".",
"uniqid",
"(",
"'oci-'",
")",
";",
"DebugPrinter",
... | Moves installed files out of `upload` dir.
@param string $installPath Opencart installation path.
@return void
@since 0.1.0 | [
"Moves",
"installed",
"files",
"out",
"of",
"upload",
"dir",
"."
] | train | https://github.com/etki/opencart-core-installer/blob/e651c94982afe966cd36977bbdc2ff4f7e785475/src/FileJunglist.php#L161-L181 |
etki/opencart-core-installer | src/FileJunglist.php | FileJunglist.copyConfigFiles | public function copyConfigFiles($installPath)
{
$filesystem = new Filesystem;
$configFiles = array('/config', '/admin/config',);
foreach ($configFiles as $configFile) {
$source = $installPath . $configFile . '-dist.php';
$target = $installPath . $configFile . '.php';
... | php | public function copyConfigFiles($installPath)
{
$filesystem = new Filesystem;
$configFiles = array('/config', '/admin/config',);
foreach ($configFiles as $configFile) {
$source = $installPath . $configFile . '-dist.php';
$target = $installPath . $configFile . '.php';
... | [
"public",
"function",
"copyConfigFiles",
"(",
"$",
"installPath",
")",
"{",
"$",
"filesystem",
"=",
"new",
"Filesystem",
";",
"$",
"configFiles",
"=",
"array",
"(",
"'/config'",
",",
"'/admin/config'",
",",
")",
";",
"foreach",
"(",
"$",
"configFiles",
"as",... | Copies configuration files from their dists as specified by installation
notes.
@param string $installPath Opencart installation path.
@return void
@since 0.1.0 | [
"Copies",
"configuration",
"files",
"from",
"their",
"dists",
"as",
"specified",
"by",
"installation",
"notes",
"."
] | train | https://github.com/etki/opencart-core-installer/blob/e651c94982afe966cd36977bbdc2ff4f7e785475/src/FileJunglist.php#L192-L208 |
muxtor/yii2-pkk5-module | src/controllers/Pkk5Controller.php | Pkk5Controller.actionIndex | public function actionIndex()
{
$model = new ParseForm();
if ($model->load(Yii::$app->request->post())) {
if ($model->parse()) {
$this->refresh();
}
}
$searchModel = new Pkk5kadastrSearch();
$dataProvider = $searchModel->search(Yii::$a... | php | public function actionIndex()
{
$model = new ParseForm();
if ($model->load(Yii::$app->request->post())) {
if ($model->parse()) {
$this->refresh();
}
}
$searchModel = new Pkk5kadastrSearch();
$dataProvider = $searchModel->search(Yii::$a... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"ParseForm",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
")",
")",
")",
"{",
"if",
"(",
"$... | Lists all Pkk5kadastr models.
@return mixed | [
"Lists",
"all",
"Pkk5kadastr",
"models",
"."
] | train | https://github.com/muxtor/yii2-pkk5-module/blob/09be77ddd171c66df53ec89d229d0cc5c0a9ad94/src/controllers/Pkk5Controller.php#L45-L62 |
esperecyan/dictionary-php | src/validator/LightweightMarkupValidator.php | LightweightMarkupValidator.isURLWithHTTPScheme | public static function isURLWithHTTPScheme(string $value): bool
{
try {
$url = new URL($value);
} catch (TypeError $exception) {
return false;
}
return in_array($url->protocol, ['http:', 'https:']);
} | php | public static function isURLWithHTTPScheme(string $value): bool
{
try {
$url = new URL($value);
} catch (TypeError $exception) {
return false;
}
return in_array($url->protocol, ['http:', 'https:']);
} | [
"public",
"static",
"function",
"isURLWithHTTPScheme",
"(",
"string",
"$",
"value",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"url",
"=",
"new",
"URL",
"(",
"$",
"value",
")",
";",
"}",
"catch",
"(",
"TypeError",
"$",
"exception",
")",
"{",
"return",
"... | 与えられた文字列が絶対URL、または素片付き絶対URL、かつスキームが「http」「https」のいずれかであれば真を返します。
@param string $value
@return bool | [
"与えられた文字列が絶対URL、または素片付き絶対URL、かつスキームが「http」「https」のいずれかであれば真を返します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/LightweightMarkupValidator.php#L69-L77 |
esperecyan/dictionary-php | src/validator/LightweightMarkupValidator.php | LightweightMarkupValidator.createHTMLFilter | protected function createHTMLFilter(): HTMLFilter
{
$filter = new HTMLFilter(
$this->source ? static::SOURCE_WHITELIST : static::DESCRIPTION_WHITELIST,
['before' => $this->source ? null : function (\DOMElement $body): void {
foreach (['img', 'audio', 'video'] as $elem... | php | protected function createHTMLFilter(): HTMLFilter
{
$filter = new HTMLFilter(
$this->source ? static::SOURCE_WHITELIST : static::DESCRIPTION_WHITELIST,
['before' => $this->source ? null : function (\DOMElement $body): void {
foreach (['img', 'audio', 'video'] as $elem... | [
"protected",
"function",
"createHTMLFilter",
"(",
")",
":",
"HTMLFilter",
"{",
"$",
"filter",
"=",
"new",
"HTMLFilter",
"(",
"$",
"this",
"->",
"source",
"?",
"static",
"::",
"SOURCE_WHITELIST",
":",
"static",
"::",
"DESCRIPTION_WHITELIST",
",",
"[",
"'before'... | HTMLフィルターを生成します。
@return HTMLFilter | [
"HTMLフィルターを生成します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/LightweightMarkupValidator.php#L108-L130 |
Wonail/wocenter | traits/ExtensionTrait.php | ExtensionTrait.runMigrate | protected function runMigrate($type)
{
if (FileHelper::isDir(Yii::getAlias($this->migrationPath))) {
$action = "migrate/";
switch ($type) {
case 'up':
$action .= 'up';
break;
case 'down':
$act... | php | protected function runMigrate($type)
{
if (FileHelper::isDir(Yii::getAlias($this->migrationPath))) {
$action = "migrate/";
switch ($type) {
case 'up':
$action .= 'up';
break;
case 'down':
$act... | [
"protected",
"function",
"runMigrate",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"FileHelper",
"::",
"isDir",
"(",
"Yii",
"::",
"getAlias",
"(",
"$",
"this",
"->",
"migrationPath",
")",
")",
")",
"{",
"$",
"action",
"=",
"\"migrate/\"",
";",
"switch",
"("... | 执行migrate操作
@param string $type 操作类型 | [
"执行migrate操作"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/traits/ExtensionTrait.php#L25-L46 |
pipelinersales/pipeliner-php-sdk | src/PipelinerSales/ApiClient/Http/Response.php | Response.decodeJson | public function decodeJson($assoc = false)
{
$result = json_decode($this->body, $assoc);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new PipelinerHttpException($this, "Error while parsing returned JSON");
}
return $result;
} | php | public function decodeJson($assoc = false)
{
$result = json_decode($this->body, $assoc);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new PipelinerHttpException($this, "Error while parsing returned JSON");
}
return $result;
} | [
"public",
"function",
"decodeJson",
"(",
"$",
"assoc",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"body",
",",
"$",
"assoc",
")",
";",
"if",
"(",
"json_last_error",
"(",
")",
"!==",
"JSON_ERROR_NONE",
")",
"{",
... | Decodes the response's body into an object.
@param boolean $assoc when true, returned objects will be converted into associative arrays.
@return \stdClass|array
@throws PipelinerHttpException on error while decoding the json string | [
"Decodes",
"the",
"response",
"s",
"body",
"into",
"an",
"object",
"."
] | train | https://github.com/pipelinersales/pipeliner-php-sdk/blob/a020149ffde815be17634542010814cf854c3d5f/src/PipelinerSales/ApiClient/Http/Response.php#L70-L79 |
huasituo/hstcms | src/Console/Commands/HstcmsInfoCommand.php | HstcmsInfoCommand.handle | public function handle()
{
$t = $this->option('t');
switch ($t) {
case 'version':
$this->info($this->hstcms->version());
break;
default:
$this->info('Welcome to use Hstcms');
$this->info('https://www.huasituo.com... | php | public function handle()
{
$t = $this->option('t');
switch ($t) {
case 'version':
$this->info($this->hstcms->version());
break;
default:
$this->info('Welcome to use Hstcms');
$this->info('https://www.huasituo.com... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"t",
"=",
"$",
"this",
"->",
"option",
"(",
"'t'",
")",
";",
"switch",
"(",
"$",
"t",
")",
"{",
"case",
"'version'",
":",
"$",
"this",
"->",
"info",
"(",
"$",
"this",
"->",
"hstcms",
"->",
"ve... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HstcmsInfoCommand.php#L50-L62 |
kabirbaidhya/AwesomeCache | src/ConfigurableObject.php | ConfigurableObject.config | public static function config($config = null)
{
if(is_array($config)) {
# Setting Configurations
static::$config = $config + static::$config;
$pathWithoutTrailingSlash = rtrim(static::$config['directory'], '/');
static::$config['directory'] = $pathWithoutTrailingSlash.'/';
} elseif(is_string... | php | public static function config($config = null)
{
if(is_array($config)) {
# Setting Configurations
static::$config = $config + static::$config;
$pathWithoutTrailingSlash = rtrim(static::$config['directory'], '/');
static::$config['directory'] = $pathWithoutTrailingSlash.'/';
} elseif(is_string... | [
"public",
"static",
"function",
"config",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"config",
")",
")",
"{",
"# Setting Configurations",
"static",
"::",
"$",
"config",
"=",
"$",
"config",
"+",
"static",
"::",
"$",
"con... | Gets/Sets the Caching configurations
Getting:
$allConfig = Cache::config();
$configValue = Cache::config('configName');
Setting:
$config = array();
Cache::config($config);
@param mixed $config (optional)
@return mixed | [
"Gets",
"/",
"Sets",
"the",
"Caching",
"configurations"
] | train | https://github.com/kabirbaidhya/AwesomeCache/blob/ecf6293f3bcb3855133b1a8962c53170af1ebc32/src/ConfigurableObject.php#L31-L52 |
czim/laravel-pxlcms | src/Generator/ModelWriter.php | ModelWriter.appendRelatedModelsToModelData | protected function appendRelatedModelsToModelData(array $model)
{
$relationships = array_merge(
array_get($model, 'relationships.normal'),
array_get($model, 'relationships.reverse')
);
$model['related_models'] = [];
foreach ($relationships as $name => $relat... | php | protected function appendRelatedModelsToModelData(array $model)
{
$relationships = array_merge(
array_get($model, 'relationships.normal'),
array_get($model, 'relationships.reverse')
);
$model['related_models'] = [];
foreach ($relationships as $name => $relat... | [
"protected",
"function",
"appendRelatedModelsToModelData",
"(",
"array",
"$",
"model",
")",
"{",
"$",
"relationships",
"=",
"array_merge",
"(",
"array_get",
"(",
"$",
"model",
",",
"'relationships.normal'",
")",
",",
"array_get",
"(",
"$",
"model",
",",
"'relati... | Append 'related' model data for related models
@param array $model
@return array | [
"Append",
"related",
"model",
"data",
"for",
"related",
"models"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/ModelWriter.php#L145-L164 |
czim/laravel-pxlcms | src/Generator/ModelWriter.php | ModelWriter.makeTranslatedDataFromModelData | protected function makeTranslatedDataFromModelData(array $model)
{
// translated model is sluggable if model is, but on translated property or column
$sluggable = ($model['sluggable'] && array_get($model, 'sluggable_setup.translated'));
return [
'module' => $model... | php | protected function makeTranslatedDataFromModelData(array $model)
{
// translated model is sluggable if model is, but on translated property or column
$sluggable = ($model['sluggable'] && array_get($model, 'sluggable_setup.translated'));
return [
'module' => $model... | [
"protected",
"function",
"makeTranslatedDataFromModelData",
"(",
"array",
"$",
"model",
")",
"{",
"// translated model is sluggable if model is, but on translated property or column",
"$",
"sluggable",
"=",
"(",
"$",
"model",
"[",
"'sluggable'",
"]",
"&&",
"array_get",
"(",... | Make model data array for translation model
@param array $model
@return array | [
"Make",
"model",
"data",
"array",
"for",
"translation",
"model"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/ModelWriter.php#L173-L216 |
vcn/enum | src/Enum/Matcher.php | Matcher.whenMatch | private function whenMatch(Enum $enum, Match $match)
{
if (!$enum instanceof $this->subject) {
$classSubject = get_class($this->subject);
$classArgument = get_class($enum);
throw new InvalidArgumentException(
"This map is already mapping an instance of {... | php | private function whenMatch(Enum $enum, Match $match)
{
if (!$enum instanceof $this->subject) {
$classSubject = get_class($this->subject);
$classArgument = get_class($enum);
throw new InvalidArgumentException(
"This map is already mapping an instance of {... | [
"private",
"function",
"whenMatch",
"(",
"Enum",
"$",
"enum",
",",
"Match",
"$",
"match",
")",
"{",
"if",
"(",
"!",
"$",
"enum",
"instanceof",
"$",
"this",
"->",
"subject",
")",
"{",
"$",
"classSubject",
"=",
"get_class",
"(",
"$",
"this",
"->",
"sub... | @param Enum $enum
@param Match $match
@return Matcher | [
"@param",
"Enum",
"$enum",
"@param",
"Match",
"$match"
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum/Matcher.php#L54-L76 |
vcn/enum | src/Enum/Matcher.php | Matcher.when | public function when(Enum $enum, $value)
{
/** @noinspection PhpInternalEntityUsedInspection */
return $this->whenMatch($enum, new Match\Value($value));
} | php | public function when(Enum $enum, $value)
{
/** @noinspection PhpInternalEntityUsedInspection */
return $this->whenMatch($enum, new Match\Value($value));
} | [
"public",
"function",
"when",
"(",
"Enum",
"$",
"enum",
",",
"$",
"value",
")",
"{",
"/** @noinspection PhpInternalEntityUsedInspection */",
"return",
"$",
"this",
"->",
"whenMatch",
"(",
"$",
"enum",
",",
"new",
"Match",
"\\",
"Value",
"(",
"$",
"value",
")... | Maps an Enum instance to a value.
<br/>
If the subject of this map is equal to the given instance, `get()` will return this value.
<br/>
By chaining this method, a total case distinction can be expressed, for example:
<br/>
```
$fruit
->when(Fruit::BANANA(), 'banana')
->when(Fruit::APPLE(), 'apple')
->get();
```
... | [
"Maps",
"an",
"Enum",
"instance",
"to",
"a",
"value",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum/Matcher.php#L117-L121 |
vcn/enum | src/Enum/Matcher.php | Matcher.whenDo | public function whenDo(Enum $enum, $callable)
{
if (!is_callable($callable)) {
$type = is_object($callable) ? get_class($callable) : gettype($callable);
throw new InvalidArgumentException(
"Expected input argument to be callable, {$type} given. " .
"I... | php | public function whenDo(Enum $enum, $callable)
{
if (!is_callable($callable)) {
$type = is_object($callable) ? get_class($callable) : gettype($callable);
throw new InvalidArgumentException(
"Expected input argument to be callable, {$type} given. " .
"I... | [
"public",
"function",
"whenDo",
"(",
"Enum",
"$",
"enum",
",",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callable",
")",
")",
"{",
"$",
"type",
"=",
"is_object",
"(",
"$",
"callable",
")",
"?",
"get_class",
"(",
"$",
"cal... | Like `Matcher::when()`, but let a callback provide the value.
<br/>
Use this to lazily provide mapped values, or produce side effects when matched:
```
$fruit
->whenDo(
Fruit::BANANA(),
function () {
return new LargeHadronCollider();
}
)
->whenDo(
Fruit::APPLE(),
function () use ($logger) {
$logger->critical("I don'... | [
"Like",
"Matcher",
"::",
"when",
"()",
"but",
"let",
"a",
"callback",
"provide",
"the",
"value",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum/Matcher.php#L172-L184 |
vcn/enum | src/Enum/Matcher.php | Matcher.orElseMatch | private function orElseMatch(Match $match)
{
return array_key_exists($this->subject->getName(), $this->matches)
? $this->matches[$this->subject->getName()]->get()
: $match->get();
} | php | private function orElseMatch(Match $match)
{
return array_key_exists($this->subject->getName(), $this->matches)
? $this->matches[$this->subject->getName()]->get()
: $match->get();
} | [
"private",
"function",
"orElseMatch",
"(",
"Match",
"$",
"match",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"this",
"->",
"subject",
"->",
"getName",
"(",
")",
",",
"$",
"this",
"->",
"matches",
")",
"?",
"$",
"this",
"->",
"matches",
"[",
"$",... | @param Match $match
@return mixed | [
"@param",
"Match",
"$match"
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum/Matcher.php#L191-L196 |
vcn/enum | src/Enum/Matcher.php | Matcher.orElseDo | public function orElseDo($callable)
{
if (!is_callable($callable)) {
$type = is_object($callable) ? get_class($callable) : gettype($callable);
throw new InvalidArgumentException(
"Expected input argument to be callable, {$type} given. " .
"If you want... | php | public function orElseDo($callable)
{
if (!is_callable($callable)) {
$type = is_object($callable) ? get_class($callable) : gettype($callable);
throw new InvalidArgumentException(
"Expected input argument to be callable, {$type} given. " .
"If you want... | [
"public",
"function",
"orElseDo",
"(",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callable",
")",
")",
"{",
"$",
"type",
"=",
"is_object",
"(",
"$",
"callable",
")",
"?",
"get_class",
"(",
"$",
"callable",
")",
":",
"gettype... | Like `Matcher::orElse()`, but let a callback provide the surrogate.
<br/>
Use this to lazily provide a surrogate, or produce side effects when no match is found:
<br/>
```
$fruit
->when(Fruit::BANANA(), 'banana')
->when(Fruit::APPLE(), 'apple')
->orElseDo(
function () {
printf('Expected either a banana or apple.');... | [
"Like",
"Matcher",
"::",
"orElse",
"()",
"but",
"let",
"a",
"callback",
"provide",
"the",
"surrogate",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum/Matcher.php#L286-L298 |
vcn/enum | src/Enum/Matcher.php | Matcher.get | public function get()
{
return array_key_exists($this->subject->getName(), $this->matches)
? $this->matches[$this->subject->getName()]->get()
: $this->surrogate->get();
} | php | public function get()
{
return array_key_exists($this->subject->getName(), $this->matches)
? $this->matches[$this->subject->getName()]->get()
: $this->surrogate->get();
} | [
"public",
"function",
"get",
"(",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"this",
"->",
"subject",
"->",
"getName",
"(",
")",
",",
"$",
"this",
"->",
"matches",
")",
"?",
"$",
"this",
"->",
"matches",
"[",
"$",
"this",
"->",
"subject",
"->"... | Provides the value the instance of the mapped subject is mapped to, or throws a runtime exception if the instance
has not been mapped to anything.
<br/>
For example:
<br/>
```
$fruit
->when(Fruit::BANANA(), 'banana')
->when(Fruit::APPLE(), 'apple')
->get();
```
<br/>
will yield:
<br/>
`'banana'` if `$fruit = Fr... | [
"Provides",
"the",
"value",
"the",
"instance",
"of",
"the",
"mapped",
"subject",
"is",
"mapped",
"to",
"or",
"throws",
"a",
"runtime",
"exception",
"if",
"the",
"instance",
"has",
"not",
"been",
"mapped",
"to",
"anything",
"."
] | train | https://github.com/vcn/enum/blob/ced38687b6140858956778140915d5d5a6397f23/src/Enum/Matcher.php#L350-L355 |
withfatpanda/illuminate-wordpress | src/WordPress/Models/ProfileSection.php | ProfileSection.factory | static function factory(Plugin $plugin, $type)
{
$plugin->validator->extend('can_edit', function($attribute, $value, $parameters, $validator) {
if (empty($value)) {
return false;
}
$current_user = wp_get_current_user();
if (empty($current_user)) {
return false;
}
if ($attribute === 'user_... | php | static function factory(Plugin $plugin, $type)
{
$plugin->validator->extend('can_edit', function($attribute, $value, $parameters, $validator) {
if (empty($value)) {
return false;
}
$current_user = wp_get_current_user();
if (empty($current_user)) {
return false;
}
if ($attribute === 'user_... | [
"static",
"function",
"factory",
"(",
"Plugin",
"$",
"plugin",
",",
"$",
"type",
")",
"{",
"$",
"plugin",
"->",
"validator",
"->",
"extend",
"(",
"'can_edit'",
",",
"function",
"(",
"$",
"attribute",
",",
"$",
"value",
",",
"$",
"parameters",
",",
"$",... | Create a profile section of the given type, and associate it with the
given Plugin
@param Plugin
@param String A classname of some class that implements ProfileSectionContract
@return PluginSectionContract implementation
@throws Exception If given class does not implement ProfileSectionContract | [
"Create",
"a",
"profile",
"section",
"of",
"the",
"given",
"type",
"and",
"associate",
"it",
"with",
"the",
"given",
"Plugin"
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Models/ProfileSection.php#L23-L69 |
link0/profiler | src/Link0/Profiler/PersistenceHandler/FilesystemHandler.php | FilesystemHandler.getList | public function getList()
{
$identifiers = array();
$fileList = $this->filesystem->listFiles($this->getPath());
foreach ($fileList as $file) {
$identifiers[] = $file['filename'];
}
return $identifiers;
} | php | public function getList()
{
$identifiers = array();
$fileList = $this->filesystem->listFiles($this->getPath());
foreach ($fileList as $file) {
$identifiers[] = $file['filename'];
}
return $identifiers;
} | [
"public",
"function",
"getList",
"(",
")",
"{",
"$",
"identifiers",
"=",
"array",
"(",
")",
";",
"$",
"fileList",
"=",
"$",
"this",
"->",
"filesystem",
"->",
"listFiles",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"... | Returns a list of Identifier strings
Unfortunately the list() method is reserved
@return string[] | [
"Returns",
"a",
"list",
"of",
"Identifier",
"strings",
"Unfortunately",
"the",
"list",
"()",
"method",
"is",
"reserved"
] | train | https://github.com/link0/profiler/blob/0573073ff029743734de747619ab65ab2476052d/src/Link0/Profiler/PersistenceHandler/FilesystemHandler.php#L91-L101 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.filterByName | public function filterByName($name = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($name)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $name)) {
$name = str_replace('*', '%', $name);
$comparison... | php | public function filterByName($name = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($name)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $name)) {
$name = str_replace('*', '%', $name);
$comparison... | [
"public",
"function",
"filterByName",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
"$",
"comparison",
"=... | Filter the query on the name column
Example usage:
<code>
$query->filterByName('fooValue'); // WHERE name = 'fooValue'
$query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
</code>
@param string $name The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $compari... | [
"Filter",
"the",
"query",
"on",
"the",
"name",
"column"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L311-L323 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.filterByPermissionRelatedByParentId | public function filterByPermissionRelatedByParentId($permission, $comparison = null)
{
if ($permission instanceof \Alchemy\Component\Cerberus\Model\Permission) {
return $this
->addUsingAlias(PermissionTableMap::COL_PARENT_ID, $permission->getId(), $comparison);
} elseif (... | php | public function filterByPermissionRelatedByParentId($permission, $comparison = null)
{
if ($permission instanceof \Alchemy\Component\Cerberus\Model\Permission) {
return $this
->addUsingAlias(PermissionTableMap::COL_PARENT_ID, $permission->getId(), $comparison);
} elseif (... | [
"public",
"function",
"filterByPermissionRelatedByParentId",
"(",
"$",
"permission",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"permission",
"instanceof",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Permission... | Filter the query by a related \Alchemy\Component\Cerberus\Model\Permission object
@param \Alchemy\Component\Cerberus\Model\Permission|ObjectCollection $permission The related object(s) to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildPermis... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Permission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L520-L535 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.usePermissionRelatedByParentIdQuery | public function usePermissionRelatedByParentIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinPermissionRelatedByParentId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'PermissionRelatedByParentId', '\Alchemy\Component\Cerb... | php | public function usePermissionRelatedByParentIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinPermissionRelatedByParentId($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'PermissionRelatedByParentId', '\Alchemy\Component\Cerb... | [
"public",
"function",
"usePermissionRelatedByParentIdQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"LEFT_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinPermissionRelatedByParentId",
"(",
"$",
"relationAlias",
",",
... | Use the PermissionRelatedByParentId relation Permission object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Alchemy\Component\Cer... | [
"Use",
"the",
"PermissionRelatedByParentId",
"relation",
"Permission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L580-L585 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.filterByPermissionRelatedById | public function filterByPermissionRelatedById($permission, $comparison = null)
{
if ($permission instanceof \Alchemy\Component\Cerberus\Model\Permission) {
return $this
->addUsingAlias(PermissionTableMap::COL_ID, $permission->getParentId(), $comparison);
} elseif ($permis... | php | public function filterByPermissionRelatedById($permission, $comparison = null)
{
if ($permission instanceof \Alchemy\Component\Cerberus\Model\Permission) {
return $this
->addUsingAlias(PermissionTableMap::COL_ID, $permission->getParentId(), $comparison);
} elseif ($permis... | [
"public",
"function",
"filterByPermissionRelatedById",
"(",
"$",
"permission",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"permission",
"instanceof",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Permission",
"... | Filter the query by a related \Alchemy\Component\Cerberus\Model\Permission object
@param \Alchemy\Component\Cerberus\Model\Permission|ObjectCollection $permission the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildPermissi... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"Permission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L595-L608 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.usePermissionRelatedByIdQuery | public function usePermissionRelatedByIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinPermissionRelatedById($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'PermissionRelatedById', '\Alchemy\Component\Cerberus\Model\Permiss... | php | public function usePermissionRelatedByIdQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinPermissionRelatedById($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'PermissionRelatedById', '\Alchemy\Component\Cerberus\Model\Permiss... | [
"public",
"function",
"usePermissionRelatedByIdQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"LEFT_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinPermissionRelatedById",
"(",
"$",
"relationAlias",
",",
"$",
"joi... | Use the PermissionRelatedById relation Permission object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Alchemy\Component\Cerberus\... | [
"Use",
"the",
"PermissionRelatedById",
"relation",
"Permission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L653-L658 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.filterByRolePermission | public function filterByRolePermission($rolePermission, $comparison = null)
{
if ($rolePermission instanceof \Alchemy\Component\Cerberus\Model\RolePermission) {
return $this
->addUsingAlias(PermissionTableMap::COL_ID, $rolePermission->getPermissionId(), $comparison);
} el... | php | public function filterByRolePermission($rolePermission, $comparison = null)
{
if ($rolePermission instanceof \Alchemy\Component\Cerberus\Model\RolePermission) {
return $this
->addUsingAlias(PermissionTableMap::COL_ID, $rolePermission->getPermissionId(), $comparison);
} el... | [
"public",
"function",
"filterByRolePermission",
"(",
"$",
"rolePermission",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"rolePermission",
"instanceof",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"RolePermission"... | Filter the query by a related \Alchemy\Component\Cerberus\Model\RolePermission object
@param \Alchemy\Component\Cerberus\Model\RolePermission|ObjectCollection $rolePermission the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return C... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"Alchemy",
"\\",
"Component",
"\\",
"Cerberus",
"\\",
"Model",
"\\",
"RolePermission",
"object"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L668-L681 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.filterByRole | public function filterByRole($role, $comparison = Criteria::EQUAL)
{
return $this
->useRolePermissionQuery()
->filterByRole($role, $comparison)
->endUse();
} | php | public function filterByRole($role, $comparison = Criteria::EQUAL)
{
return $this
->useRolePermissionQuery()
->filterByRole($role, $comparison)
->endUse();
} | [
"public",
"function",
"filterByRole",
"(",
"$",
"role",
",",
"$",
"comparison",
"=",
"Criteria",
"::",
"EQUAL",
")",
"{",
"return",
"$",
"this",
"->",
"useRolePermissionQuery",
"(",
")",
"->",
"filterByRole",
"(",
"$",
"role",
",",
"$",
"comparison",
")",
... | Filter the query by a related Role object
using the role_permission table as cross reference
@param Role $role the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildPermissionQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"Role",
"object",
"using",
"the",
"role_permission",
"table",
"as",
"cross",
"reference"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L742-L748 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php | PermissionQuery.prune | public function prune($permission = null)
{
if ($permission) {
$this->addUsingAlias(PermissionTableMap::COL_ID, $permission->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | php | public function prune($permission = null)
{
if ($permission) {
$this->addUsingAlias(PermissionTableMap::COL_ID, $permission->getId(), Criteria::NOT_EQUAL);
}
return $this;
} | [
"public",
"function",
"prune",
"(",
"$",
"permission",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"permission",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"PermissionTableMap",
"::",
"COL_ID",
",",
"$",
"permission",
"->",
"getId",
"(",
")",
",",
"... | Exclude object from result
@param ChildPermission $permission Object to remove from the list of results
@return $this|ChildPermissionQuery The current query, for fluid interface | [
"Exclude",
"object",
"from",
"result"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/PermissionQuery.php#L757-L764 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Checker/SerializedDataChecker.php | SerializedDataChecker.add | public function add(Resource $resource)
{
$this->storer->add(
serialize($resource->getMetadata('data')),
$resource
);
} | php | public function add(Resource $resource)
{
$this->storer->add(
serialize($resource->getMetadata('data')),
$resource
);
} | [
"public",
"function",
"add",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"this",
"->",
"storer",
"->",
"add",
"(",
"serialize",
"(",
"$",
"resource",
"->",
"getMetadata",
"(",
"'data'",
")",
")",
",",
"$",
"resource",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Checker/SerializedDataChecker.php#L39-L45 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Checker/SerializedDataChecker.php | SerializedDataChecker.check | public function check(Resource $resource)
{
if (!$this->storer->has($resource)) {
return false;
}
return $this->storer->get($resource) == serialize($resource->getMetadata('data'));
} | php | public function check(Resource $resource)
{
if (!$this->storer->has($resource)) {
return false;
}
return $this->storer->get($resource) == serialize($resource->getMetadata('data'));
} | [
"public",
"function",
"check",
"(",
"Resource",
"$",
"resource",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"storer",
"->",
"has",
"(",
"$",
"resource",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"storer",
"->",
"get... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Checker/SerializedDataChecker.php#L50-L57 |
movoin/one-swoole | src/Validation/Validators/EmailValidator.php | EmailValidator.validate | protected function validate(array $attributes, string $name, array $parameters): bool
{
if (isset($parameters['domain']) && ! Assert::email($attributes[$name], $parameters['domain'])) {
$this->addError($name, $parameters, '%s 超出允许邮箱范围');
return false;
}
if (! Assert... | php | protected function validate(array $attributes, string $name, array $parameters): bool
{
if (isset($parameters['domain']) && ! Assert::email($attributes[$name], $parameters['domain'])) {
$this->addError($name, $parameters, '%s 超出允许邮箱范围');
return false;
}
if (! Assert... | [
"protected",
"function",
"validate",
"(",
"array",
"$",
"attributes",
",",
"string",
"$",
"name",
",",
"array",
"$",
"parameters",
")",
":",
"bool",
"{",
"if",
"(",
"isset",
"(",
"$",
"parameters",
"[",
"'domain'",
"]",
")",
"&&",
"!",
"Assert",
"::",
... | 校验规则
@param array $attributes
@param string $name
@param array $parameters
@return bool | [
"校验规则"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validators/EmailValidator.php#L28-L43 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.setStatusCode | public function setStatusCode(int $statusCode, string $reasonPhrase = null): Response
{
$this->status->setCode($statusCode, $reasonPhrase);
return $this;
} | php | public function setStatusCode(int $statusCode, string $reasonPhrase = null): Response
{
$this->status->setCode($statusCode, $reasonPhrase);
return $this;
} | [
"public",
"function",
"setStatusCode",
"(",
"int",
"$",
"statusCode",
",",
"string",
"$",
"reasonPhrase",
"=",
"null",
")",
":",
"Response",
"{",
"$",
"this",
"->",
"status",
"->",
"setCode",
"(",
"$",
"statusCode",
",",
"$",
"reasonPhrase",
")",
";",
"r... | sets the status code to be send
This needs only to be done if another status code then the default one
200 OK should be send.
@param int $statusCode
@param string $reasonPhrase optional
@return \stubbles\webapp\Response | [
"sets",
"the",
"status",
"code",
"to",
"be",
"send"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L136-L140 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.addHeader | public function addHeader(string $name, string $value): Response
{
$this->headers->add($name, $value);
return $this;
} | php | public function addHeader(string $name, string $value): Response
{
$this->headers->add($name, $value);
return $this;
} | [
"public",
"function",
"addHeader",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"value",
")",
":",
"Response",
"{",
"$",
"this",
"->",
"headers",
"->",
"add",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | add a header to the response
@param string $name the name of the header
@param string $value the value of the header
@return \stubbles\webapp\Response | [
"add",
"a",
"header",
"to",
"the",
"response"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L171-L175 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.containsHeader | public function containsHeader(string $name, string $value = null): bool
{
if ($this->headers->contain($name)) {
if (null !== $value) {
return $value === $this->headers[$name];
}
return true;
}
return false;
} | php | public function containsHeader(string $name, string $value = null): bool
{
if ($this->headers->contain($name)) {
if (null !== $value) {
return $value === $this->headers[$name];
}
return true;
}
return false;
} | [
"public",
"function",
"containsHeader",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"value",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"headers",
"->",
"contain",
"(",
"$",
"name",
")",
")",
"{",
"if",
"(",
"null",
"!=="... | check if response contains a certain header
@param string $name name of header to check
@param string $value optional if given the value is checked as well
@return bool
@since 4.0.0 | [
"check",
"if",
"response",
"contains",
"a",
"certain",
"header"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L196-L207 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.addCookie | public function addCookie(Cookie $cookie): Response
{
$this->cookies[$cookie->name()] = $cookie;
return $this;
} | php | public function addCookie(Cookie $cookie): Response
{
$this->cookies[$cookie->name()] = $cookie;
return $this;
} | [
"public",
"function",
"addCookie",
"(",
"Cookie",
"$",
"cookie",
")",
":",
"Response",
"{",
"$",
"this",
"->",
"cookies",
"[",
"$",
"cookie",
"->",
"name",
"(",
")",
"]",
"=",
"$",
"cookie",
";",
"return",
"$",
"this",
";",
"}"
] | add a cookie to the response
@param \stubbles\webapp\response\Cookie $cookie the cookie to set
@return \stubbles\webapp\Response | [
"add",
"a",
"cookie",
"to",
"the",
"response"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L215-L219 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.removeCookie | public function removeCookie(string $name): Response
{
$this->addCookie(
Cookie::create($name, 'remove')->expiringAt(time() - 86400)
);
return $this;
} | php | public function removeCookie(string $name): Response
{
$this->addCookie(
Cookie::create($name, 'remove')->expiringAt(time() - 86400)
);
return $this;
} | [
"public",
"function",
"removeCookie",
"(",
"string",
"$",
"name",
")",
":",
"Response",
"{",
"$",
"this",
"->",
"addCookie",
"(",
"Cookie",
"::",
"create",
"(",
"$",
"name",
",",
"'remove'",
")",
"->",
"expiringAt",
"(",
"time",
"(",
")",
"-",
"86400",... | removes cookie with given name
@param string $name
@return \stubbles\webapp\Response
@since 2.0.0 | [
"removes",
"cookie",
"with",
"given",
"name"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L228-L234 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.containsCookie | public function containsCookie(string $name, string $value = null): bool
{
if (isset($this->cookies[$name])) {
if (null !== $value) {
return $this->cookies[$name]->value() === $value;
}
return true;
}
return false;
} | php | public function containsCookie(string $name, string $value = null): bool
{
if (isset($this->cookies[$name])) {
if (null !== $value) {
return $this->cookies[$name]->value() === $value;
}
return true;
}
return false;
} | [
"public",
"function",
"containsCookie",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"value",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cookies",
"[",
"$",
"name",
"]",
")",
")",
"{",
"if",
"(",
"null",
"... | checks if response contains a certain cookie
@param string $name name of cookie to check
@param string $value optional if given the value is checked as well
@return bool
@since 4.0.0 | [
"checks",
"if",
"response",
"contains",
"a",
"certain",
"cookie"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L244-L255 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.methodNotAllowed | public function methodNotAllowed(string $requestMethod, array $allowedMethods): Error
{
$this->status->methodNotAllowed($allowedMethods);
return Error::methodNotAllowed($requestMethod, $allowedMethods);
} | php | public function methodNotAllowed(string $requestMethod, array $allowedMethods): Error
{
$this->status->methodNotAllowed($allowedMethods);
return Error::methodNotAllowed($requestMethod, $allowedMethods);
} | [
"public",
"function",
"methodNotAllowed",
"(",
"string",
"$",
"requestMethod",
",",
"array",
"$",
"allowedMethods",
")",
":",
"Error",
"{",
"$",
"this",
"->",
"status",
"->",
"methodNotAllowed",
"(",
"$",
"allowedMethods",
")",
";",
"return",
"Error",
"::",
... | creates a 405 Method Not Allowed message
@param string $requestMethod
@param string[] $allowedMethods
@return \stubbles\webapp\response\Error
@since 2.0.0 | [
"creates",
"a",
"405",
"Method",
"Not",
"Allowed",
"message"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L334-L338 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.send | public function send(OutputStream $out = null)
{
$this->sendHead();
if ($this->requestAllowsBody() && null != $this->resource) {
$out = (null === $out ? new StandardOutputStream() : $out);
$this->mimeType->serialize(
$this->resource,
$o... | php | public function send(OutputStream $out = null)
{
$this->sendHead();
if ($this->requestAllowsBody() && null != $this->resource) {
$out = (null === $out ? new StandardOutputStream() : $out);
$this->mimeType->serialize(
$this->resource,
$o... | [
"public",
"function",
"send",
"(",
"OutputStream",
"$",
"out",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"sendHead",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"requestAllowsBody",
"(",
")",
"&&",
"null",
"!=",
"$",
"this",
"->",
"resource",
")",
... | sends response
In case no output stream is passed it will create a
stubbles\streams\StandardOutputStream where the response body will be
written to.
The output stream is returned. In case no output stream was passed and
the request doesn't allow a response body or no resource for the response
body was set the return v... | [
"sends",
"response"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L391-L403 |
stubbles/stubbles-webapp-core | src/main/php/response/WebResponse.php | WebResponse.sendHead | private function sendHead(): Response
{
$this->header($this->status->line($this->version, $this->sapi));
foreach ($this->headers as $name => $value) {
$this->header($name . ': ' . $value);
}
foreach ($this->cookies as $cookie) {
$cookie->send();
}
... | php | private function sendHead(): Response
{
$this->header($this->status->line($this->version, $this->sapi));
foreach ($this->headers as $name => $value) {
$this->header($name . ': ' . $value);
}
foreach ($this->cookies as $cookie) {
$cookie->send();
}
... | [
"private",
"function",
"sendHead",
"(",
")",
":",
"Response",
"{",
"$",
"this",
"->",
"header",
"(",
"$",
"this",
"->",
"status",
"->",
"line",
"(",
"$",
"this",
"->",
"version",
",",
"$",
"this",
"->",
"sapi",
")",
")",
";",
"foreach",
"(",
"$",
... | sends head only
@return \stubbles\webapp\Response | [
"sends",
"head",
"only"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/WebResponse.php#L421-L438 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Comparator.php | Comparator.compare | public function compare(NumericTypeInterface $a, NumericTypeInterface $b)
{
return $this->compEngine->compare($a, $b);
} | php | public function compare(NumericTypeInterface $a, NumericTypeInterface $b)
{
return $this->compEngine->compare($a, $b);
} | [
"public",
"function",
"compare",
"(",
"NumericTypeInterface",
"$",
"a",
",",
"NumericTypeInterface",
"$",
"b",
")",
"{",
"return",
"$",
"this",
"->",
"compEngine",
"->",
"compare",
"(",
"$",
"a",
",",
"$",
"b",
")",
";",
"}"
] | a == b = 0
a < b = -1
a > b = 1
@param NumericTypeInterface $a
@param NumericTypeInterface $b
@return int | [
"a",
"==",
"b",
"=",
"0",
"a",
"<",
"b",
"=",
"-",
"1",
"a",
">",
"b",
"=",
"1"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Comparator.php#L77-L80 |
FrenchFrogs/framework | src/Panel/Renderer/Bootstrap.php | Bootstrap.panel | public function panel(Panel\Panel\Panel $panel)
{
$html = '';
//@todo Action render
$actions = '';
foreach($panel->getActions() as $action) {
$actions .= $action->render() . PHP_EOL;
}
$html .= html('div', ['class' => 'pull-right'], $actions);
... | php | public function panel(Panel\Panel\Panel $panel)
{
$html = '';
//@todo Action render
$actions = '';
foreach($panel->getActions() as $action) {
$actions .= $action->render() . PHP_EOL;
}
$html .= html('div', ['class' => 'pull-right'], $actions);
... | [
"public",
"function",
"panel",
"(",
"Panel",
"\\",
"Panel",
"\\",
"Panel",
"$",
"panel",
")",
"{",
"$",
"html",
"=",
"''",
";",
"//@todo Action render",
"$",
"actions",
"=",
"''",
";",
"foreach",
"(",
"$",
"panel",
"->",
"getActions",
"(",
")",
"as",
... | Main renderer
@param \FrenchFrogs\Panel\Panel\Panel $panel | [
"Main",
"renderer"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Panel/Renderer/Bootstrap.php#L28-L56 |
FrenchFrogs/framework | src/Panel/Renderer/Bootstrap.php | Bootstrap.selectremote | public function selectremote(Panel\Action\SelectRemote $action)
{
$element = $action->getElement();
$element->addAttribute('id', $element->getName());
$element->addClass('select2-remote input-callback');
$element->addAttribute('data-css', 'form-control input-large input-sm');
... | php | public function selectremote(Panel\Action\SelectRemote $action)
{
$element = $action->getElement();
$element->addAttribute('id', $element->getName());
$element->addClass('select2-remote input-callback');
$element->addAttribute('data-css', 'form-control input-large input-sm');
... | [
"public",
"function",
"selectremote",
"(",
"Panel",
"\\",
"Action",
"\\",
"SelectRemote",
"$",
"action",
")",
"{",
"$",
"element",
"=",
"$",
"action",
"->",
"getElement",
"(",
")",
";",
"$",
"element",
"->",
"addAttribute",
"(",
"'id'",
",",
"$",
"elemen... | Render a Select 2
@param \FrenchFrogs\Panel\Action\SelectRemote $action | [
"Render",
"a",
"Select",
"2"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Panel/Renderer/Bootstrap.php#L109-L123 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.listSubscriptions | public static function listSubscriptions(
$user,
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_CREATED_AT,
$order_dir = self::ORDERDIR_ASC,
$include_finished = false,
$hash_type = false,
$hash = false
) {
if ($page < 1) {
thr... | php | public static function listSubscriptions(
$user,
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_CREATED_AT,
$order_dir = self::ORDERDIR_ASC,
$include_finished = false,
$hash_type = false,
$hash = false
) {
if ($page < 1) {
thr... | [
"public",
"static",
"function",
"listSubscriptions",
"(",
"$",
"user",
",",
"$",
"page",
"=",
"1",
",",
"$",
"per_page",
"=",
"20",
",",
"$",
"order_by",
"=",
"self",
"::",
"ORDERBY_CREATED_AT",
",",
"$",
"order_dir",
"=",
"self",
"::",
"ORDERDIR_ASC",
"... | Get a page of push subscriptions in the given user's account, where
each page contains up to per_page items. Results will be ordered
according to the supplied ordering parameters.
@param DataSift_User $user The user.
@param int $page The page number to fetch.
@param int $per... | [
"Get",
"a",
"page",
"of",
"push",
"subscriptions",
"in",
"the",
"given",
"user",
"s",
"account",
"where",
"each",
"page",
"contains",
"up",
"to",
"per_page",
"items",
".",
"Results",
"will",
"be",
"ordered",
"according",
"to",
"the",
"supplied",
"ordering",
... | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L94-L135 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.listByPlaybackId | public static function listByPlaybackId(
$user,
$playback_id,
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_CREATED_AT,
$order_dir = self::ORDERDIR_ASC,
$include_finished = false,
$hash_type = false,
$hash = false
) {
return self... | php | public static function listByPlaybackId(
$user,
$playback_id,
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_CREATED_AT,
$order_dir = self::ORDERDIR_ASC,
$include_finished = false,
$hash_type = false,
$hash = false
) {
return self... | [
"public",
"static",
"function",
"listByPlaybackId",
"(",
"$",
"user",
",",
"$",
"playback_id",
",",
"$",
"page",
"=",
"1",
",",
"$",
"per_page",
"=",
"20",
",",
"$",
"order_by",
"=",
"self",
"::",
"ORDERBY_CREATED_AT",
",",
"$",
"order_dir",
"=",
"self",... | Get a page of push subscriptions to the given stream playback_id, where
each page contains up to per_page items. Results will be ordered
according to the supplied ordering parameters.
@param DataSift_User $user The user.
@param string $playback_id The Historics playback ID.
@param int ... | [
"Get",
"a",
"page",
"of",
"push",
"subscriptions",
"to",
"the",
"given",
"stream",
"playback_id",
"where",
"each",
"page",
"contains",
"up",
"to",
"per_page",
"items",
".",
"Results",
"will",
"be",
"ordered",
"according",
"to",
"the",
"supplied",
"ordering",
... | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L200-L221 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.getLogs | public static function getLogs(
$user,
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_REQUEST_TIME,
$order_dir = self::ORDERDIR_ASC,
$id = false
) {
if ($page < 1) {
throw new DataSift_Exception_InvalidData('The specified page number is inval... | php | public static function getLogs(
$user,
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_REQUEST_TIME,
$order_dir = self::ORDERDIR_ASC,
$id = false
) {
if ($page < 1) {
throw new DataSift_Exception_InvalidData('The specified page number is inval... | [
"public",
"static",
"function",
"getLogs",
"(",
"$",
"user",
",",
"$",
"page",
"=",
"1",
",",
"$",
"per_page",
"=",
"20",
",",
"$",
"order_by",
"=",
"self",
"::",
"ORDERBY_REQUEST_TIME",
",",
"$",
"order_dir",
"=",
"self",
"::",
"ORDERDIR_ASC",
",",
"$... | Page through recent push subscription log entries, specifying the sort
order.
@param DataSift_User $user The user making the request.
@param int $page Which page to fetch.
@param int $per_page Based on this page size.
@param string $order_by Which field to sort by.
@param string ... | [
"Page",
"through",
"recent",
"push",
"subscription",
"log",
"entries",
"specifying",
"the",
"sort",
"order",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L239-L273 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.init | protected function init($data)
{
if (! isset($data['id'])) {
throw new DataSift_Exception_InvalidData('No id found');
}
$this->_id = $data['id'];
if (! isset($data['name'])) {
throw new DataSift_Exception_InvalidData('No name found');
}
$this-... | php | protected function init($data)
{
if (! isset($data['id'])) {
throw new DataSift_Exception_InvalidData('No id found');
}
$this->_id = $data['id'];
if (! isset($data['name'])) {
throw new DataSift_Exception_InvalidData('No name found');
}
$this-... | [
"protected",
"function",
"init",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'id'",
"]",
")",
")",
"{",
"throw",
"new",
"DataSift_Exception_InvalidData",
"(",
"'No id found'",
")",
";",
"}",
"$",
"this",
"->",
"_id",
... | Extract data from an array.
@param array $data An array containing the subscription data.
@throws DataSift_Exception_InvalidData | [
"Extract",
"data",
"from",
"an",
"array",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L342-L395 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.parseOutputParams | protected function parseOutputParams($params, $prefix = '')
{
$retval = array();
foreach ($params as $key => $val) {
if (is_array($val)) {
$retval = array_merge($retval, $this->parseOutputParams($val, $prefix . $key . '.'));
} else {
$retval[$p... | php | protected function parseOutputParams($params, $prefix = '')
{
$retval = array();
foreach ($params as $key => $val) {
if (is_array($val)) {
$retval = array_merge($retval, $this->parseOutputParams($val, $prefix . $key . '.'));
} else {
$retval[$p... | [
"protected",
"function",
"parseOutputParams",
"(",
"$",
"params",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"retval",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"is_array... | Recursive method to parse the output_params as received from the API
into the flattened, dot-notation used by the client libraries.
@param array $params The parameters to parse.
@param string $prefix The current key prefix.
@return array | [
"Recursive",
"method",
"to",
"parse",
"the",
"output_params",
"as",
"received",
"from",
"the",
"API",
"into",
"the",
"flattened",
"dot",
"-",
"notation",
"used",
"by",
"the",
"client",
"libraries",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L406-L417 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.setOutputParam | public function setOutputParam($key, $val)
{
if ($this->isDeleted()) {
throw new DataSift_Exception_InvalidData('Cannot modify a deleted subscription');
}
parent::setOutputParam($key, $val);
} | php | public function setOutputParam($key, $val)
{
if ($this->isDeleted()) {
throw new DataSift_Exception_InvalidData('Cannot modify a deleted subscription');
}
parent::setOutputParam($key, $val);
} | [
"public",
"function",
"setOutputParam",
"(",
"$",
"key",
",",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDeleted",
"(",
")",
")",
"{",
"throw",
"new",
"DataSift_Exception_InvalidData",
"(",
"'Cannot modify a deleted subscription'",
")",
";",
"}",
... | Set an output parameter. Checks to see if the subscription has been
deleted, and if not calls the base class to set the parameter.
@param string $key The output parameter to set.
@param string $val The value to which to set it.
@throws DataSift_Exception_InvalidData | [
"Set",
"an",
"output",
"parameter",
".",
"Checks",
"to",
"see",
"if",
"the",
"subscription",
"has",
"been",
"deleted",
"and",
"if",
"not",
"calls",
"the",
"base",
"class",
"to",
"set",
"the",
"parameter",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L460-L466 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.save | public function save()
{
// Can only update the name and output_params
$params = array('id' => $this->getId(), 'name' => $this->getName());
foreach ($this->_output_params as $key => $val) {
$params[DataSift_Push_Definition::OUTPUT_PARAMS_PREFIX . $key] = $val;
}
... | php | public function save()
{
// Can only update the name and output_params
$params = array('id' => $this->getId(), 'name' => $this->getName());
foreach ($this->_output_params as $key => $val) {
$params[DataSift_Push_Definition::OUTPUT_PARAMS_PREFIX . $key] = $val;
}
... | [
"public",
"function",
"save",
"(",
")",
"{",
"// Can only update the name and output_params",
"$",
"params",
"=",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
",",
"'name'",
"=>",
"$",
"this",
"->",
"getName",
"(",
")",
")",
";",
"fo... | Save changes to the name and output_parameters of this subscription.
@throws DataSift_Exception_InvalidData
@throws DataSift_Exception_APIError
@throws DataSift_Exception_AccessDenied | [
"Save",
"changes",
"to",
"the",
"name",
"and",
"output_parameters",
"of",
"this",
"subscription",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L557-L567 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.delete | public function delete()
{
$this->_user->post('push/delete', array('id' => $this->getId()));
// The delete API call doesn't return the object, so set the status
// manually
$this->_status = self::STATUS_DELETED;
} | php | public function delete()
{
$this->_user->post('push/delete', array('id' => $this->getId()));
// The delete API call doesn't return the object, so set the status
// manually
$this->_status = self::STATUS_DELETED;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"_user",
"->",
"post",
"(",
"'push/delete'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"this",
"->",
"getId",
"(",
")",
")",
")",
";",
"// The delete API call doesn't return the object, so set the s... | Delete this subscription.
@throws DataSift_Exception_APIError
@throws DataSift_Exception_AccessDenied | [
"Delete",
"this",
"subscription",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L611-L617 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.pull | public function pull($size = 20971520, $cursor = false)
{
//Check that the output type of this subscription is a pull
if (strtolower($this->_output_type) != 'pull') {
throw new DataSift_Exception_InvalidData("Output type is not pull");
}
$params = array('id' => $this->ge... | php | public function pull($size = 20971520, $cursor = false)
{
//Check that the output type of this subscription is a pull
if (strtolower($this->_output_type) != 'pull') {
throw new DataSift_Exception_InvalidData("Output type is not pull");
}
$params = array('id' => $this->ge... | [
"public",
"function",
"pull",
"(",
"$",
"size",
"=",
"20971520",
",",
"$",
"cursor",
"=",
"false",
")",
"{",
"//Check that the output type of this subscription is a pull",
"if",
"(",
"strtolower",
"(",
"$",
"this",
"->",
"_output_type",
")",
"!=",
"'pull'",
")",... | Pull data from this subscription.
@param int $size The maximum amount of data that DataSift will send in a single batch.
Can be any value from 1 byte through 20971520 bytes.
@param string $cursor A pointer into the Push queue associated with the current Push subscription.
@return array
@throws DataSift_Exception_Inva... | [
"Pull",
"data",
"from",
"this",
"subscription",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L631-L645 |
datasift/datasift-php | lib/DataSift/Push/Subscription.php | DataSift_Push_Subscription.getLog | public function getLog(
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_REQUEST_TIME,
$order_dir = self::ORDERDIR_DESC
) {
return self::getLogs($this->_user, $page, $per_page, $order_by, $order_dir, $this->getId());
} | php | public function getLog(
$page = 1,
$per_page = 20,
$order_by = self::ORDERBY_REQUEST_TIME,
$order_dir = self::ORDERDIR_DESC
) {
return self::getLogs($this->_user, $page, $per_page, $order_by, $order_dir, $this->getId());
} | [
"public",
"function",
"getLog",
"(",
"$",
"page",
"=",
"1",
",",
"$",
"per_page",
"=",
"20",
",",
"$",
"order_by",
"=",
"self",
"::",
"ORDERBY_REQUEST_TIME",
",",
"$",
"order_dir",
"=",
"self",
"::",
"ORDERDIR_DESC",
")",
"{",
"return",
"self",
"::",
"... | Get a page of the log for this subscription order as specified.
@param int $page The page to get.
@param int $per_page The number of entries per page.
@param string $order_by By which field to order the entries.
@param string $order_dir The direction of the sorting ("asc" or "desc").
@return array
@throw... | [
"Get",
"a",
"page",
"of",
"the",
"log",
"for",
"this",
"subscription",
"order",
"as",
"specified",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Subscription.php#L660-L667 |
JoffreyPoreeCoding/MongoDB-ODM | src/Iterator/DocumentIterator.php | DocumentIterator.rewind | public function rewind()
{
if (!$this->rewindable && !$this->firstCross) {
throw new \Exception('Unable to traverse not rewindable iterator multiple time');
}
$this->firstCross = false;
$this->position = 0;
} | php | public function rewind()
{
if (!$this->rewindable && !$this->firstCross) {
throw new \Exception('Unable to traverse not rewindable iterator multiple time');
}
$this->firstCross = false;
$this->position = 0;
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"rewindable",
"&&",
"!",
"$",
"this",
"->",
"firstCross",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Unable to traverse not rewindable iterator multiple time'",
")",
";"... | Rewinds the Iterator to the first element.
@return void | [
"Rewinds",
"the",
"Iterator",
"to",
"the",
"first",
"element",
"."
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Iterator/DocumentIterator.php#L154-L161 |
JoffreyPoreeCoding/MongoDB-ODM | src/Iterator/DocumentIterator.php | DocumentIterator.valid | public function valid()
{
if (isset($this->objects[$this->position])) {
return true;
}
if ($this->currentData == null) {
return false;
}
return $this->generator->valid();
} | php | public function valid()
{
if (isset($this->objects[$this->position])) {
return true;
}
if ($this->currentData == null) {
return false;
}
return $this->generator->valid();
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"this",
"->",
"position",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"currentData",
"==",
"null",
")... | Checks if there is a current element after calls to rewind() or next().
@return bool | [
"Checks",
"if",
"there",
"is",
"a",
"current",
"element",
"after",
"calls",
"to",
"rewind",
"()",
"or",
"next",
"()",
"."
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Iterator/DocumentIterator.php#L168-L179 |
JoffreyPoreeCoding/MongoDB-ODM | src/Iterator/DocumentIterator.php | DocumentIterator.current | public function current()
{
if ($this->valid() && !isset($this->objects[$this->position])) {
$class = $this->objectClass;
$object = new $class();
$this->hydrator->hydrate($object, $this->currentData);
$this->classMetadata->getEventManager()->execute(EventManag... | php | public function current()
{
if ($this->valid() && !isset($this->objects[$this->position])) {
$class = $this->objectClass;
$object = new $class();
$this->hydrator->hydrate($object, $this->currentData);
$this->classMetadata->getEventManager()->execute(EventManag... | [
"public",
"function",
"current",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"valid",
"(",
")",
"&&",
"!",
"isset",
"(",
"$",
"this",
"->",
"objects",
"[",
"$",
"this",
"->",
"position",
"]",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->"... | Returns the current element.
@return mixed | [
"Returns",
"the",
"current",
"element",
"."
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Iterator/DocumentIterator.php#L196-L219 |
JoffreyPoreeCoding/MongoDB-ODM | src/Iterator/DocumentIterator.php | DocumentIterator.count | public function count()
{
if (!isset($this->count)) {
$this->count = $this->repository->count($this->query);
}
return $this->count;
} | php | public function count()
{
if (!isset($this->count)) {
$this->count = $this->repository->count($this->query);
}
return $this->count;
} | [
"public",
"function",
"count",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"count",
")",
")",
"{",
"$",
"this",
"->",
"count",
"=",
"$",
"this",
"->",
"repository",
"->",
"count",
"(",
"$",
"this",
"->",
"query",
")",
";",
"... | Count number of document from collection
@return integer | [
"Count",
"number",
"of",
"document",
"from",
"collection"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Iterator/DocumentIterator.php#L260-L266 |
belgattitude/soluble-metadata | src/Soluble/Metadata/Reader/PdoMysqlMetadataReader.php | PdoMysqlMetadataReader.readColumnsMetadata | protected function readColumnsMetadata(string $sql): ColumnsMetadata
{
$metadata = new ColumnsMetadata();
$fields = $this->readFields($sql);
$type_map = PdoMysqlMapping::getDatatypeMapping();
foreach ($fields as $idx => $field) {
$name = $field['name'];
$tab... | php | protected function readColumnsMetadata(string $sql): ColumnsMetadata
{
$metadata = new ColumnsMetadata();
$fields = $this->readFields($sql);
$type_map = PdoMysqlMapping::getDatatypeMapping();
foreach ($fields as $idx => $field) {
$name = $field['name'];
$tab... | [
"protected",
"function",
"readColumnsMetadata",
"(",
"string",
"$",
"sql",
")",
":",
"ColumnsMetadata",
"{",
"$",
"metadata",
"=",
"new",
"ColumnsMetadata",
"(",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"readFields",
"(",
"$",
"sql",
")",
";",
"$... | {@inheritdoc}
@throws \Soluble\Metadata\Exception\ConnectionException
@throws \Soluble\Metadata\Exception\EmptyQueryException
@throws \Soluble\Metadata\Exception\InvalidQueryException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/belgattitude/soluble-metadata/blob/6285461c40a619070f601184d58e6c772b769d5c/src/Soluble/Metadata/Reader/PdoMysqlMetadataReader.php#L64-L148 |
belgattitude/soluble-metadata | src/Soluble/Metadata/Reader/PdoMysqlMetadataReader.php | PdoMysqlMetadataReader.readFields | protected function readFields(string $sql): array
{
if (trim($sql) === '') {
throw new Exception\EmptyQueryException('Cannot read fields for an empty query');
}
$sql = $this->getEmptiedQuery($sql);
$stmt = $this->pdo->prepare($sql);
if ($stmt->execute() !== true... | php | protected function readFields(string $sql): array
{
if (trim($sql) === '') {
throw new Exception\EmptyQueryException('Cannot read fields for an empty query');
}
$sql = $this->getEmptiedQuery($sql);
$stmt = $this->pdo->prepare($sql);
if ($stmt->execute() !== true... | [
"protected",
"function",
"readFields",
"(",
"string",
"$",
"sql",
")",
":",
"array",
"{",
"if",
"(",
"trim",
"(",
"$",
"sql",
")",
"===",
"''",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"EmptyQueryException",
"(",
"'Cannot read fields for an empty query'",
... | Read fields from pdo source.
@return array<int, array>
@throws Exception\ConnectionException
@throws \Soluble\Metadata\Exception\EmptyQueryException
@throws \Soluble\Metadata\Exception\InvalidQueryException | [
"Read",
"fields",
"from",
"pdo",
"source",
"."
] | train | https://github.com/belgattitude/soluble-metadata/blob/6285461c40a619070f601184d58e6c772b769d5c/src/Soluble/Metadata/Reader/PdoMysqlMetadataReader.php#L159-L185 |
WellCommerce/OrderBundle | Calculator/SalesSummaryCalculator.php | SalesSummaryCalculator.filterCurrentItems | protected function filterCurrentItems(Collection $collection)
{
$endDate = new DateTime();
$format = $this->configuration->getGroupByDateFormat();
$identifier = $endDate->format($format);
return $collection->filter(function (ReportRow $row) use ($identifier) {
ret... | php | protected function filterCurrentItems(Collection $collection)
{
$endDate = new DateTime();
$format = $this->configuration->getGroupByDateFormat();
$identifier = $endDate->format($format);
return $collection->filter(function (ReportRow $row) use ($identifier) {
ret... | [
"protected",
"function",
"filterCurrentItems",
"(",
"Collection",
"$",
"collection",
")",
"{",
"$",
"endDate",
"=",
"new",
"DateTime",
"(",
")",
";",
"$",
"format",
"=",
"$",
"this",
"->",
"configuration",
"->",
"getGroupByDateFormat",
"(",
")",
";",
"$",
... | Filters a collection to get only current items
@param Collection $collection
@return Collection | [
"Filters",
"a",
"collection",
"to",
"get",
"only",
"current",
"items"
] | train | https://github.com/WellCommerce/OrderBundle/blob/d72cfb51eab7a1f66f186900d1e2d533a822c424/Calculator/SalesSummaryCalculator.php#L85-L94 |
php-ddd/command | src/Utils/ClassUtils.php | ClassUtils.shortName | public static function shortName($objectOrNamespace)
{
if (is_object($objectOrNamespace)) {
$objectOrNamespace = get_class($objectOrNamespace);
} elseif (!class_exists($objectOrNamespace)) {
throw new InvalidArgumentException(
sprintf(
'The... | php | public static function shortName($objectOrNamespace)
{
if (is_object($objectOrNamespace)) {
$objectOrNamespace = get_class($objectOrNamespace);
} elseif (!class_exists($objectOrNamespace)) {
throw new InvalidArgumentException(
sprintf(
'The... | [
"public",
"static",
"function",
"shortName",
"(",
"$",
"objectOrNamespace",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"objectOrNamespace",
")",
")",
"{",
"$",
"objectOrNamespace",
"=",
"get_class",
"(",
"$",
"objectOrNamespace",
")",
";",
"}",
"elseif",
"(... | @param object|string $objectOrNamespace
@return string | [
"@param",
"object|string",
"$objectOrNamespace"
] | train | https://github.com/php-ddd/command/blob/dbad1d35c8d740c29c3a28d34f4a787c2b14688a/src/Utils/ClassUtils.php#L16-L32 |
geosocio/http-serializer-bundle | src/DependencyInjection/Compiler/GroupResolverPass.php | GroupResolverPass.process | public function process(ContainerBuilder $container) : void
{
$this->addResolvers(
$container,
'geosocio_http_serializer.request_group_resolver_manager',
'geosocio_http_serializer.request_group_resolver'
);
$this->addResolvers(
$container,
... | php | public function process(ContainerBuilder $container) : void
{
$this->addResolvers(
$container,
'geosocio_http_serializer.request_group_resolver_manager',
'geosocio_http_serializer.request_group_resolver'
);
$this->addResolvers(
$container,
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"$",
"this",
"->",
"addResolvers",
"(",
"$",
"container",
",",
"'geosocio_http_serializer.request_group_resolver_manager'",
",",
"'geosocio_http_serializer.request_group_resol... | {@inheritdoc} | [
"{"
] | train | https://github.com/geosocio/http-serializer-bundle/blob/2ceb24a148204b1f3b14083b202db7e5afff2099/src/DependencyInjection/Compiler/GroupResolverPass.php#L17-L29 |
geosocio/http-serializer-bundle | src/DependencyInjection/Compiler/GroupResolverPass.php | GroupResolverPass.addResolvers | protected function addResolvers(ContainerBuilder $container, string $service, string $tag)
{
if (!$container->has($service)) {
return;
}
$definition = $container->getDefinition($service);
$taggedServices = $container->findTaggedServiceIds($tag);
foreach ($tagged... | php | protected function addResolvers(ContainerBuilder $container, string $service, string $tag)
{
if (!$container->has($service)) {
return;
}
$definition = $container->getDefinition($service);
$taggedServices = $container->findTaggedServiceIds($tag);
foreach ($tagged... | [
"protected",
"function",
"addResolvers",
"(",
"ContainerBuilder",
"$",
"container",
",",
"string",
"$",
"service",
",",
"string",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"has",
"(",
"$",
"service",
")",
")",
"{",
"return",
";",
"}... | Add the Resolvers.
@param ContainerBuilder $container
@param string $service
@param string $tag
@return void | [
"Add",
"the",
"Resolvers",
"."
] | train | https://github.com/geosocio/http-serializer-bundle/blob/2ceb24a148204b1f3b14083b202db7e5afff2099/src/DependencyInjection/Compiler/GroupResolverPass.php#L40-L56 |
jasny/router | src/Router/Runner/Callback.php | Callback.run | public function run(ServerRequestInterface $request, ResponseInterface $response)
{
$route = $request->getAttribute('route');
$callback = !empty($route->fn) ? $route->fn : null;
if (!is_callable($callback)) {
trigger_error("'fn' property of route shoud be a callable", E_USER_NOT... | php | public function run(ServerRequestInterface $request, ResponseInterface $response)
{
$route = $request->getAttribute('route');
$callback = !empty($route->fn) ? $route->fn : null;
if (!is_callable($callback)) {
trigger_error("'fn' property of route shoud be a callable", E_USER_NOT... | [
"public",
"function",
"run",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"route",
"=",
"$",
"request",
"->",
"getAttribute",
"(",
"'route'",
")",
";",
"$",
"callback",
"=",
"!",
"empty",
"(",
"$"... | Use function to handle request and response
@param ServerRequestInterface $request
@param ResponseInterface $response
@return ResponseInterface|mixed | [
"Use",
"function",
"to",
"handle",
"request",
"and",
"response"
] | train | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/Runner/Callback.php#L23-L34 |
stubbles/stubbles-webapp-core | src/main/php/response/Error.php | Error.methodNotAllowed | public static function methodNotAllowed(string $requestMethod, array $allowedMethods): self
{
return new self(
'The given request method '
. strtoupper($requestMethod)
. ' is not valid. Please use one of '
. join(', ', $allowedMethods) . '.',
... | php | public static function methodNotAllowed(string $requestMethod, array $allowedMethods): self
{
return new self(
'The given request method '
. strtoupper($requestMethod)
. ' is not valid. Please use one of '
. join(', ', $allowedMethods) . '.',
... | [
"public",
"static",
"function",
"methodNotAllowed",
"(",
"string",
"$",
"requestMethod",
",",
"array",
"$",
"allowedMethods",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"'The given request method '",
".",
"strtoupper",
"(",
"$",
"requestMethod",
")",
"... | creates error when access to resource with request method is not allowed
@param string $requestMethod actual request method
@param string[] $allowedMethods list of allowed request methods
@return \stubbles\webapp\response\Error | [
"creates",
"error",
"when",
"access",
"to",
"resource",
"with",
"request",
"method",
"is",
"not",
"allowed"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Error.php#L74-L83 |
stubbles/stubbles-webapp-core | src/main/php/response/Error.php | Error.inParams | public static function inParams(ParamErrors $errors, ParamErrorMessages $errorMessages): self
{
return new self(Sequence::of($errors)->map(
function(array $errors, $paramName) use ($errorMessages): array
{
$resolved = ['field' => $paramName, 'errors' => []... | php | public static function inParams(ParamErrors $errors, ParamErrorMessages $errorMessages): self
{
return new self(Sequence::of($errors)->map(
function(array $errors, $paramName) use ($errorMessages): array
{
$resolved = ['field' => $paramName, 'errors' => []... | [
"public",
"static",
"function",
"inParams",
"(",
"ParamErrors",
"$",
"errors",
",",
"ParamErrorMessages",
"$",
"errorMessages",
")",
":",
"self",
"{",
"return",
"new",
"self",
"(",
"Sequence",
"::",
"of",
"(",
"$",
"errors",
")",
"->",
"map",
"(",
"functio... | creates error with given list of param errors
@param \stubbles\input\errors\ParamErrors $errors
@param \stubbles\webapp\response\ParamErrorMessages $errorMessages
@return self
@since 6.2.0 | [
"creates",
"error",
"with",
"given",
"list",
"of",
"param",
"errors"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/Error.php#L141-L158 |
Wonail/wocenter | core/ServiceLocator.php | ServiceLocator.getService | public function getService($serviceName)
{
$service = $serviceName . 'Service';
if (!Yii::$app->has($service, true)) {
/** @var Service $component */
$component = Yii::$app->get($service);
if (!$component instanceof Service) {
throw new InvalidConf... | php | public function getService($serviceName)
{
$service = $serviceName . 'Service';
if (!Yii::$app->has($service, true)) {
/** @var Service $component */
$component = Yii::$app->get($service);
if (!$component instanceof Service) {
throw new InvalidConf... | [
"public",
"function",
"getService",
"(",
"$",
"serviceName",
")",
"{",
"$",
"service",
"=",
"$",
"serviceName",
".",
"'Service'",
";",
"if",
"(",
"!",
"Yii",
"::",
"$",
"app",
"->",
"has",
"(",
"$",
"service",
",",
"true",
")",
")",
"{",
"/** @var Se... | 获取系统顶级服务类
@param string $serviceName 服务名,不带后缀`Service`,如:`passport`、`log`
@return Service|object|null
@throws InvalidConfigException | [
"获取系统顶级服务类"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/core/ServiceLocator.php#L29-L48 |
phramework/validate | src/StringValidator.php | StringValidator.validate | public function validate($value)
{
$return = new ValidateResult($value, false);
if (!is_string($value)) {
//error
$return->errorObject = new IncorrectParametersException([
[
'type' => static::getType(),
'failure' => 'ty... | php | public function validate($value)
{
$return = new ValidateResult($value, false);
if (!is_string($value)) {
//error
$return->errorObject = new IncorrectParametersException([
[
'type' => static::getType(),
'failure' => 'ty... | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"return",
"=",
"new",
"ValidateResult",
"(",
"$",
"value",
",",
"false",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"//error",
"$",
"return",
"->",
"e... | Validate value
@see \Phramework\Validate\ValidateResult for ValidateResult object
@param mixed $value Value to validate
@return ValidateResult
@uses https://secure.php.net/manual/en/function.is-string.php
@uses filter_var with FILTER_VALIDATE_REGEXP for pattern | [
"Validate",
"value"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/StringValidator.php#L89-L152 |
activecollab/databasestructure | src/Association/HasManyViaAssociation.php | HasManyViaAssociation.buildGetFinderMethod | protected function buildGetFinderMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$order_by = $this->getOrderBy() ? '->orderBy(' . var_export($this->ge... | php | protected function buildGetFinderMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$order_by = $this->getOrderBy() ? '->orderBy(' . var_export($this->ge... | [
"protected",
"function",
"buildGetFinderMethod",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"$",
"namespace",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"intermediary_... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasManyViaAssociation.php#L46-L71 |
activecollab/databasestructure | src/Association/HasManyViaAssociation.php | HasManyViaAssociation.buildAddRelatedObjectMethod | public function buildAddRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$target_instance_class = $this->getInstanceClassFrom($namespace, ... | php | public function buildAddRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$target_instance_class = $this->getInstanceClassFrom($namespace, ... | [
"public",
"function",
"buildAddRelatedObjectMethod",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"$",
"namespace",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"intermedi... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasManyViaAssociation.php#L76-L116 |
activecollab/databasestructure | src/Association/HasManyViaAssociation.php | HasManyViaAssociation.buildRemoveRelatedObjectMethod | public function buildRemoveRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$target_instance_class = $this->getInstanceClassFrom($namespac... | php | public function buildRemoveRelatedObjectMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$target_instance_class = $this->getInstanceClassFrom($namespac... | [
"public",
"function",
"buildRemoveRelatedObjectMethod",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"$",
"namespace",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"interm... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasManyViaAssociation.php#L121-L153 |
activecollab/databasestructure | src/Association/HasManyViaAssociation.php | HasManyViaAssociation.buildClearRelatedObjectsMethod | public function buildClearRelatedObjectsMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$intermediary_instance_class = $this->getInstanceClassFrom($nam... | php | public function buildClearRelatedObjectsMethod(StructureInterface $structure, TypeInterface $source_type, TypeInterface $target_type, $namespace, array &$result)
{
$intermediary_type = $structure->getType($this->intermediary_type_name);
$intermediary_instance_class = $this->getInstanceClassFrom($nam... | [
"public",
"function",
"buildClearRelatedObjectsMethod",
"(",
"StructureInterface",
"$",
"structure",
",",
"TypeInterface",
"$",
"source_type",
",",
"TypeInterface",
"$",
"target_type",
",",
"$",
"namespace",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"interm... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Association/HasManyViaAssociation.php#L158-L186 |
prooph/link-app-core | src/Model/ProcessingConfig.php | ProcessingConfig.initializeWithDefaultsIn | public static function initializeWithDefaultsIn(ConfigLocation $configLocation, ConfigWriter $configWriter)
{
$env = Environment::setUp();
$instance = new self(['processing' => array_merge(
$env->getConfig()->toArray(),
[
"connectors" => [],
"... | php | public static function initializeWithDefaultsIn(ConfigLocation $configLocation, ConfigWriter $configWriter)
{
$env = Environment::setUp();
$instance = new self(['processing' => array_merge(
$env->getConfig()->toArray(),
[
"connectors" => [],
"... | [
"public",
"static",
"function",
"initializeWithDefaultsIn",
"(",
"ConfigLocation",
"$",
"configLocation",
",",
"ConfigWriter",
"$",
"configWriter",
")",
"{",
"$",
"env",
"=",
"Environment",
"::",
"setUp",
"(",
")",
";",
"$",
"instance",
"=",
"new",
"self",
"("... | Uses Prooph\Processing\Environment to initialize with its defaults | [
"Uses",
"Prooph",
"\\",
"Processing",
"\\",
"Environment",
"to",
"initialize",
"with",
"its",
"defaults"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Model/ProcessingConfig.php#L80-L103 |
prooph/link-app-core | src/Model/ProcessingConfig.php | ProcessingConfig.configureJavascriptTicker | public function configureJavascriptTicker(array $jsTickerConfig, ConfigWriter $configWriter)
{
$this->assertJsTickerConfig($jsTickerConfig);
$oldConfig = $this->config['processing']['js_ticker'];
$this->config['processing']['js_ticker'] = $jsTickerConfig;
$this->writeConfig($configW... | php | public function configureJavascriptTicker(array $jsTickerConfig, ConfigWriter $configWriter)
{
$this->assertJsTickerConfig($jsTickerConfig);
$oldConfig = $this->config['processing']['js_ticker'];
$this->config['processing']['js_ticker'] = $jsTickerConfig;
$this->writeConfig($configW... | [
"public",
"function",
"configureJavascriptTicker",
"(",
"array",
"$",
"jsTickerConfig",
",",
"ConfigWriter",
"$",
"configWriter",
")",
"{",
"$",
"this",
"->",
"assertJsTickerConfig",
"(",
"$",
"jsTickerConfig",
")",
";",
"$",
"oldConfig",
"=",
"$",
"this",
"->",... | Configure the javascript ticker
@param array $jsTickerConfig
@param ConfigWriter $configWriter | [
"Configure",
"the",
"javascript",
"ticker"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Model/ProcessingConfig.php#L327-L336 |
prooph/link-app-core | src/Model/ProcessingConfig.php | ProcessingConfig.setConfig | private function setConfig(array $config)
{
if (! array_key_exists('processing', $config)) throw new \InvalidArgumentException('Missing the root key processing in configuration');
if (! array_key_exists('node_name', $config['processing'])) throw new... | php | private function setConfig(array $config)
{
if (! array_key_exists('processing', $config)) throw new \InvalidArgumentException('Missing the root key processing in configuration');
if (! array_key_exists('node_name', $config['processing'])) throw new... | [
"private",
"function",
"setConfig",
"(",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'processing'",
",",
"$",
"config",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Missing the root key processing in configuratio... | Assert and set config
@param array $config
@throws \InvalidArgumentException | [
"Assert",
"and",
"set",
"config"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Model/ProcessingConfig.php#L382-L416 |
prooph/link-app-core | src/Model/ProcessingConfig.php | ProcessingConfig.writeConfig | private function writeConfig(ConfigWriter $configWriter)
{
$configWriter->replaceConfigInDirectory(
$this->toArray(),
$this->configLocation->toString() . DIRECTORY_SEPARATOR . self::$configFileName
);
} | php | private function writeConfig(ConfigWriter $configWriter)
{
$configWriter->replaceConfigInDirectory(
$this->toArray(),
$this->configLocation->toString() . DIRECTORY_SEPARATOR . self::$configFileName
);
} | [
"private",
"function",
"writeConfig",
"(",
"ConfigWriter",
"$",
"configWriter",
")",
"{",
"$",
"configWriter",
"->",
"replaceConfigInDirectory",
"(",
"$",
"this",
"->",
"toArray",
"(",
")",
",",
"$",
"this",
"->",
"configLocation",
"->",
"toString",
"(",
")",
... | Write config to file with the help of a config writer
@param ConfigWriter $configWriter | [
"Write",
"config",
"to",
"file",
"with",
"the",
"help",
"of",
"a",
"config",
"writer"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Model/ProcessingConfig.php#L585-L591 |
huasituo/hstcms | src/Libraries/Fields/File.php | File.output_data | public function output_data($data, $field = [])
{
if(!isset($data[$field['fieldname']])) {
return $data;
}
$value = $data[$field['fieldname']];
$data['_'.$field['fieldname']] = $value;
$data[$field['fieldname']] = AttachmentModel::getAttach($value);
$data[$field['fieldname'].'_imgurl'] = $data[$field['... | php | public function output_data($data, $field = [])
{
if(!isset($data[$field['fieldname']])) {
return $data;
}
$value = $data[$field['fieldname']];
$data['_'.$field['fieldname']] = $value;
$data[$field['fieldname']] = AttachmentModel::getAttach($value);
$data[$field['fieldname'].'_imgurl'] = $data[$field['... | [
"public",
"function",
"output_data",
"(",
"$",
"data",
",",
"$",
"field",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"$",
"field",
"[",
"'fieldname'",
"]",
"]",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
... | 字段输出 | [
"字段输出"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/Fields/File.php#L163-L173 |
sanpii/assetic | src/Assetic/Filter/UglifyCssFilter.php | UglifyCssFilter.filterDump | public function filterDump(AssetInterface $asset)
{
$commandline =$this->nodeBin
? array($this->nodeBin, $this->uglifycssBin)
: array($this->uglifycssBin);
if ($this->expandVars) {
array_push($commandline, '--expand-vars');
}
if ($this->uglyComme... | php | public function filterDump(AssetInterface $asset)
{
$commandline =$this->nodeBin
? array($this->nodeBin, $this->uglifycssBin)
: array($this->uglifycssBin);
if ($this->expandVars) {
array_push($commandline, '--expand-vars');
}
if ($this->uglyComme... | [
"public",
"function",
"filterDump",
"(",
"AssetInterface",
"$",
"asset",
")",
"{",
"$",
"commandline",
"=",
"$",
"this",
"->",
"nodeBin",
"?",
"array",
"(",
"$",
"this",
"->",
"nodeBin",
",",
"$",
"this",
"->",
"uglifycssBin",
")",
":",
"array",
"(",
"... | Run the asset through UglifyJs
@see \Assetic\Filter\FilterInterface::filterDump() | [
"Run",
"the",
"asset",
"through",
"UglifyJs"
] | train | https://github.com/sanpii/assetic/blob/5c446eee54cc396cbbd6e252108f430e6e617c95/src/Assetic/Filter/UglifyCssFilter.php#L83-L120 |
syhol/mrcolor | src/SyHolloway/MrColor/Format/Hsl.php | Hsl.toHex | public function toHex()
{
$H = $this->values['hue'] / 360;
$S = $this->values['saturation'];
$L = $this->values['lightness'];
if ($S == 0) {
$r = $L * 255;
$g = $L * 255;
$b = $L * 255;
} else {
$var_2 = ($L < 0.5) ? $L * (1 +... | php | public function toHex()
{
$H = $this->values['hue'] / 360;
$S = $this->values['saturation'];
$L = $this->values['lightness'];
if ($S == 0) {
$r = $L * 255;
$g = $L * 255;
$b = $L * 255;
} else {
$var_2 = ($L < 0.5) ? $L * (1 +... | [
"public",
"function",
"toHex",
"(",
")",
"{",
"$",
"H",
"=",
"$",
"this",
"->",
"values",
"[",
"'hue'",
"]",
"/",
"360",
";",
"$",
"S",
"=",
"$",
"this",
"->",
"values",
"[",
"'saturation'",
"]",
";",
"$",
"L",
"=",
"$",
"this",
"->",
"values",... | Return the corresponding hex color value for the value in this format
@return string (6 characters, hex color value, no hash) | [
"Return",
"the",
"corresponding",
"hex",
"color",
"value",
"for",
"the",
"value",
"in",
"this",
"format"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Format/Hsl.php#L31-L63 |
syhol/mrcolor | src/SyHolloway/MrColor/Format/Hsl.php | Hsl.fromHex | public function fromHex($hex)
{
$R = hexdec($hex[0] . $hex[1]);
$G = hexdec($hex[2] . $hex[3]);
$B = hexdec($hex[4] . $hex[5]);
$HSL = array();
$var_R = ($R / 255);
$var_G = ($G / 255);
$var_B = ($B / 255);
$var_Min = min($var_R, $var_G, $var_B);
... | php | public function fromHex($hex)
{
$R = hexdec($hex[0] . $hex[1]);
$G = hexdec($hex[2] . $hex[3]);
$B = hexdec($hex[4] . $hex[5]);
$HSL = array();
$var_R = ($R / 255);
$var_G = ($G / 255);
$var_B = ($B / 255);
$var_Min = min($var_R, $var_G, $var_B);
... | [
"public",
"function",
"fromHex",
"(",
"$",
"hex",
")",
"{",
"$",
"R",
"=",
"hexdec",
"(",
"$",
"hex",
"[",
"0",
"]",
".",
"$",
"hex",
"[",
"1",
"]",
")",
";",
"$",
"G",
"=",
"hexdec",
"(",
"$",
"hex",
"[",
"2",
"]",
".",
"$",
"hex",
"[",
... | Load the given hex color value into this format
@param string (6 characters, hex color value, no hash) | [
"Load",
"the",
"given",
"hex",
"color",
"value",
"into",
"this",
"format"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Format/Hsl.php#L70-L124 |
syhol/mrcolor | src/SyHolloway/MrColor/Format/Hsl.php | Hsl.hueToRgb | private function hueToRgb($v1, $v2, $vH)
{
if ($vH < 0) {
$vH += 1;
}
if ($vH > 1) {
$vH -= 1;
}
if ((6 * $vH) < 1) {
return ($v1 + ($v2 - $v1) * 6 * $vH);
}
if ((2 * $vH) < 1) {
return $v2;
}
... | php | private function hueToRgb($v1, $v2, $vH)
{
if ($vH < 0) {
$vH += 1;
}
if ($vH > 1) {
$vH -= 1;
}
if ((6 * $vH) < 1) {
return ($v1 + ($v2 - $v1) * 6 * $vH);
}
if ((2 * $vH) < 1) {
return $v2;
}
... | [
"private",
"function",
"hueToRgb",
"(",
"$",
"v1",
",",
"$",
"v2",
",",
"$",
"vH",
")",
"{",
"if",
"(",
"$",
"vH",
"<",
"0",
")",
"{",
"$",
"vH",
"+=",
"1",
";",
"}",
"if",
"(",
"$",
"vH",
">",
"1",
")",
"{",
"$",
"vH",
"-=",
"1",
";",
... | Given a Hue, returns corresponding RGB value
@param float $v1
@param float $v2
@param float $vH
@return float | [
"Given",
"a",
"Hue",
"returns",
"corresponding",
"RGB",
"value"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Format/Hsl.php#L134-L157 |
EcomDev/magento-psr6-bridge | src/Model/CacheItemPool.php | CacheItemPool.getItem | public function getItem($key)
{
$cacheEntry = $this->cacheFrontend->load(
$this->prepareKey($key)
);
if ($cacheEntry !== false) {
$cacheEntry = unserialize($cacheEntry);
return $this->cacheItemFactory->create(['key' => $key, 'isHit' => true, 'value' => $c... | php | public function getItem($key)
{
$cacheEntry = $this->cacheFrontend->load(
$this->prepareKey($key)
);
if ($cacheEntry !== false) {
$cacheEntry = unserialize($cacheEntry);
return $this->cacheItemFactory->create(['key' => $key, 'isHit' => true, 'value' => $c... | [
"public",
"function",
"getItem",
"(",
"$",
"key",
")",
"{",
"$",
"cacheEntry",
"=",
"$",
"this",
"->",
"cacheFrontend",
"->",
"load",
"(",
"$",
"this",
"->",
"prepareKey",
"(",
"$",
"key",
")",
")",
";",
"if",
"(",
"$",
"cacheEntry",
"!==",
"false",
... | Returns a Cache Item representing the specified key.
This method must always return a CacheItemInterface object, even in case of
a cache miss. It MUST NOT return null.
@param string $key
The key for which to return the corresponding Cache Item.
@throws InvalidArgumentException
If the $key string is not a legal value... | [
"Returns",
"a",
"Cache",
"Item",
"representing",
"the",
"specified",
"key",
"."
] | train | https://github.com/EcomDev/magento-psr6-bridge/blob/405c5b455f239fe8dc1b710df5fe9438f09d4715/src/Model/CacheItemPool.php#L113-L125 |
EcomDev/magento-psr6-bridge | src/Model/CacheItemPool.php | CacheItemPool.hasItem | public function hasItem($key)
{
if ($this->cacheFrontend->load($this->prepareKey($key)) !== false) {
return true;
}
return false;
} | php | public function hasItem($key)
{
if ($this->cacheFrontend->load($this->prepareKey($key)) !== false) {
return true;
}
return false;
} | [
"public",
"function",
"hasItem",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheFrontend",
"->",
"load",
"(",
"$",
"this",
"->",
"prepareKey",
"(",
"$",
"key",
")",
")",
"!==",
"false",
")",
"{",
"return",
"true",
";",
"}",
"return"... | Confirms if the cache contains specified cache item.
Note: This method MAY avoid retrieving the cached value for performance reasons.
This could result in a race condition with CacheItemInterface::get(). To avoid
such situation use CacheItemInterface::isHit() instead.
@param string $key
The key for which to check exi... | [
"Confirms",
"if",
"the",
"cache",
"contains",
"specified",
"cache",
"item",
"."
] | train | https://github.com/EcomDev/magento-psr6-bridge/blob/405c5b455f239fe8dc1b710df5fe9438f09d4715/src/Model/CacheItemPool.php#L171-L178 |
EcomDev/magento-psr6-bridge | src/Model/CacheItemPool.php | CacheItemPool.clear | public function clear()
{
if (empty($this->tags)) {
return false;
}
return $this->cacheFrontend->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, $this->tags);
} | php | public function clear()
{
if (empty($this->tags)) {
return false;
}
return $this->cacheFrontend->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, $this->tags);
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"tags",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"cacheFrontend",
"->",
"clean",
"(",
"\\",
"Zend_Cache",
"::",
"CLEANING_MODE_MAT... | Deletes all items in the pool.
@return bool
True if the pool was successfully cleared. False if there was an error. | [
"Deletes",
"all",
"items",
"in",
"the",
"pool",
"."
] | train | https://github.com/EcomDev/magento-psr6-bridge/blob/405c5b455f239fe8dc1b710df5fe9438f09d4715/src/Model/CacheItemPool.php#L186-L193 |
EcomDev/magento-psr6-bridge | src/Model/CacheItemPool.php | CacheItemPool.save | public function save(CacheItemInterface $item)
{
$expirationTime = null;
if ($item instanceof ExtractableCacheLifetimeInterface) {
$expirationTime = $item->getCacheLifetime();
}
return $this->cacheFrontend->save(
serialize((
$item instanceof ... | php | public function save(CacheItemInterface $item)
{
$expirationTime = null;
if ($item instanceof ExtractableCacheLifetimeInterface) {
$expirationTime = $item->getCacheLifetime();
}
return $this->cacheFrontend->save(
serialize((
$item instanceof ... | [
"public",
"function",
"save",
"(",
"CacheItemInterface",
"$",
"item",
")",
"{",
"$",
"expirationTime",
"=",
"null",
";",
"if",
"(",
"$",
"item",
"instanceof",
"ExtractableCacheLifetimeInterface",
")",
"{",
"$",
"expirationTime",
"=",
"$",
"item",
"->",
"getCac... | Persists a cache item immediately.
@param CacheItemInterface $item
The cache item to save.
@return bool
True if the item was successfully persisted. False if there was an error.
@throws InvalidArgumentException | [
"Persists",
"a",
"cache",
"item",
"immediately",
"."
] | train | https://github.com/EcomDev/magento-psr6-bridge/blob/405c5b455f239fe8dc1b710df5fe9438f09d4715/src/Model/CacheItemPool.php#L250-L268 |
EcomDev/magento-psr6-bridge | src/Model/CacheItemPool.php | CacheItemPool.commit | public function commit()
{
foreach ($this->defferedItems as $item) {
$this->save($item);
}
$this->defferedItems = [];
return true;
} | php | public function commit()
{
foreach ($this->defferedItems as $item) {
$this->save($item);
}
$this->defferedItems = [];
return true;
} | [
"public",
"function",
"commit",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"defferedItems",
"as",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"save",
"(",
"$",
"item",
")",
";",
"}",
"$",
"this",
"->",
"defferedItems",
"=",
"[",
"]",
";",
"r... | Persists any deferred cache items.
@return bool
True if all not-yet-saved items were successfully saved or there were none. False otherwise. | [
"Persists",
"any",
"deferred",
"cache",
"items",
"."
] | train | https://github.com/EcomDev/magento-psr6-bridge/blob/405c5b455f239fe8dc1b710df5fe9438f09d4715/src/Model/CacheItemPool.php#L291-L299 |
EcomDev/magento-psr6-bridge | src/Model/CacheItemPool.php | CacheItemPool.prepareKey | private function prepareKey($key)
{
if (!preg_match('/^[a-zA-Z0-9_-]+$/', $key)) {
throw new InvalidArgumentException($key);
}
return $this->keyPrefix . strtr($key, '-', '_');
} | php | private function prepareKey($key)
{
if (!preg_match('/^[a-zA-Z0-9_-]+$/', $key)) {
throw new InvalidArgumentException($key);
}
return $this->keyPrefix . strtr($key, '-', '_');
} | [
"private",
"function",
"prepareKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^[a-zA-Z0-9_-]+$/'",
",",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"$",
"key",
")",
";",
"}",
"return",
"$",
"this",
... | Prepares a key for cache storage
@param string $key
@return string
@throws InvalidArgumentException | [
"Prepares",
"a",
"key",
"for",
"cache",
"storage"
] | train | https://github.com/EcomDev/magento-psr6-bridge/blob/405c5b455f239fe8dc1b710df5fe9438f09d4715/src/Model/CacheItemPool.php#L310-L317 |
movoin/one-swoole | src/FileSystem/Manager.php | Manager.getFileSystem | public function getFileSystem(string $prefix): FileSystem
{
if (! isset($this->fs[$prefix])) {
throw new InvalidArgumentException(
sprintf('The filesystem was not found: "%s"', $prefix)
);
}
return $this->fs[$prefix];
} | php | public function getFileSystem(string $prefix): FileSystem
{
if (! isset($this->fs[$prefix])) {
throw new InvalidArgumentException(
sprintf('The filesystem was not found: "%s"', $prefix)
);
}
return $this->fs[$prefix];
} | [
"public",
"function",
"getFileSystem",
"(",
"string",
"$",
"prefix",
")",
":",
"FileSystem",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fs",
"[",
"$",
"prefix",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
... | 获得指定文件系统实例
@param string $prefix
@return \One\FileSystem\FileSystem
@throws \InvalidArgumentException | [
"获得指定文件系统实例"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Manager.php#L48-L57 |
movoin/one-swoole | src/FileSystem/Manager.php | Manager.mountFileSystems | public function mountFileSystems(array $fileSystems = []): self
{
foreach ($fileSystems as $prefix => $fileSystem) {
$this->mountFileSystem($prefix, $fileSystem);
}
return $this;
} | php | public function mountFileSystems(array $fileSystems = []): self
{
foreach ($fileSystems as $prefix => $fileSystem) {
$this->mountFileSystem($prefix, $fileSystem);
}
return $this;
} | [
"public",
"function",
"mountFileSystems",
"(",
"array",
"$",
"fileSystems",
"=",
"[",
"]",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"fileSystems",
"as",
"$",
"prefix",
"=>",
"$",
"fileSystem",
")",
"{",
"$",
"this",
"->",
"mountFileSystem",
"(",
"$",
... | 批量挂载文件系统
@param array $fileSystems
@return self | [
"批量挂载文件系统"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Manager.php#L66-L73 |
movoin/one-swoole | src/FileSystem/Manager.php | Manager.mountFileSystem | public function mountFileSystem(string $prefix, FileSystem $fileSystem): self
{
if (! Assert::stringNotEmpty($prefix)) {
throw new InvalidArgumentException(
sprintf('"%s" parameter 1 must be string', __METHOD__)
);
}
$this->fs[$prefix] = $fileSystem;
... | php | public function mountFileSystem(string $prefix, FileSystem $fileSystem): self
{
if (! Assert::stringNotEmpty($prefix)) {
throw new InvalidArgumentException(
sprintf('"%s" parameter 1 must be string', __METHOD__)
);
}
$this->fs[$prefix] = $fileSystem;
... | [
"public",
"function",
"mountFileSystem",
"(",
"string",
"$",
"prefix",
",",
"FileSystem",
"$",
"fileSystem",
")",
":",
"self",
"{",
"if",
"(",
"!",
"Assert",
"::",
"stringNotEmpty",
"(",
"$",
"prefix",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException... | 挂载文件系统
@param string $prefix
@param One\FileSystem\FileSystem $fileSystem
@return self
@throws \InvalidArgumentException | [
"挂载文件系统"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Manager.php#L84-L95 |
movoin/one-swoole | src/FileSystem/Manager.php | Manager.listContents | public function listContents(string $directory = '', bool $recursive = false): array
{
list($prefix, $directory) = $this->getPrefixAndPath($directory);
$fs = $this->getFileSystem($prefix);
$list = $fs->listContents($directory, $recursive);
foreach ($list as &$file) {
... | php | public function listContents(string $directory = '', bool $recursive = false): array
{
list($prefix, $directory) = $this->getPrefixAndPath($directory);
$fs = $this->getFileSystem($prefix);
$list = $fs->listContents($directory, $recursive);
foreach ($list as &$file) {
... | [
"public",
"function",
"listContents",
"(",
"string",
"$",
"directory",
"=",
"''",
",",
"bool",
"$",
"recursive",
"=",
"false",
")",
":",
"array",
"{",
"list",
"(",
"$",
"prefix",
",",
"$",
"directory",
")",
"=",
"$",
"this",
"->",
"getPrefixAndPath",
"... | 返回目录内容
@param string $directory
@param bool $recursive
@return array | [
"返回目录内容"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Manager.php#L105-L119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.