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 |
|---|---|---|---|---|---|---|---|---|---|---|
ClanCats/Core | src/bundles/Database/Model.php | Model.__call_property | public function __call_property( $key )
{
$result = parent::__call_property( $key );
// when we recive a relation we execute it and save it
// to the data to avoid mutlitple queries
if ( $result instanceof Model_Relation )
{
return $this->_data_store[$key] = $result->run();
}
return $result;
} | php | public function __call_property( $key )
{
$result = parent::__call_property( $key );
// when we recive a relation we execute it and save it
// to the data to avoid mutlitple queries
if ( $result instanceof Model_Relation )
{
return $this->_data_store[$key] = $result->run();
}
return $result;
} | [
"public",
"function",
"__call_property",
"(",
"$",
"key",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"__call_property",
"(",
"$",
"key",
")",
";",
"// when we recive a relation we execute it and save it",
"// to the data to avoid mutlitple queries",
"if",
"(",
"$",
... | Call a function as a property
@param string $key
@return mixed | [
"Call",
"a",
"function",
"as",
"a",
"property"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model.php#L227-L239 |
ClanCats/Core | src/bundles/Database/Model.php | Model.has_one | protected function has_one( $model, $foreign_key = null, $local_key = null )
{
return new Model_Relation_HasOne( $this, $model, $foreign_key, $local_key );
} | php | protected function has_one( $model, $foreign_key = null, $local_key = null )
{
return new Model_Relation_HasOne( $this, $model, $foreign_key, $local_key );
} | [
"protected",
"function",
"has_one",
"(",
"$",
"model",
",",
"$",
"foreign_key",
"=",
"null",
",",
"$",
"local_key",
"=",
"null",
")",
"{",
"return",
"new",
"Model_Relation_HasOne",
"(",
"$",
"this",
",",
"$",
"model",
",",
"$",
"foreign_key",
",",
"$",
... | Has one releationships
Model Car:
function engine()
{
return $this->has_one( 'Car_Engine', 'car_id', 'id' );
}
@param Model $model
@param mixed $foreign_key
@param mixed $key
@return array | [
"Has",
"one",
"releationships"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model.php#L255-L258 |
ClanCats/Core | src/bundles/Database/Model.php | Model.has_many | protected function has_many( $model, $foreign_key = null, $local_key = null )
{
return new Model_Relation_HasMany( $this, $model, $foreign_key, $local_key );
} | php | protected function has_many( $model, $foreign_key = null, $local_key = null )
{
return new Model_Relation_HasMany( $this, $model, $foreign_key, $local_key );
} | [
"protected",
"function",
"has_many",
"(",
"$",
"model",
",",
"$",
"foreign_key",
"=",
"null",
",",
"$",
"local_key",
"=",
"null",
")",
"{",
"return",
"new",
"Model_Relation_HasMany",
"(",
"$",
"this",
",",
"$",
"model",
",",
"$",
"foreign_key",
",",
"$",... | Has many releationships
Model Car:
function wheels()
{
return $this->has_many( 'Car_Wheel', 'car_id', 'id' );
}
@param Model $model
@param mixed $foreign_key
@param mixed $key
@return array | [
"Has",
"many",
"releationships"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model.php#L274-L277 |
ClanCats/Core | src/bundles/Database/Model.php | Model.belongs_to | protected function belongs_to( $model, $foreign_key = null, $local_key = null )
{
return new Model_Relation_BelongsTo( $this, $model, $foreign_key, $local_key );
} | php | protected function belongs_to( $model, $foreign_key = null, $local_key = null )
{
return new Model_Relation_BelongsTo( $this, $model, $foreign_key, $local_key );
} | [
"protected",
"function",
"belongs_to",
"(",
"$",
"model",
",",
"$",
"foreign_key",
"=",
"null",
",",
"$",
"local_key",
"=",
"null",
")",
"{",
"return",
"new",
"Model_Relation_BelongsTo",
"(",
"$",
"this",
",",
"$",
"model",
",",
"$",
"foreign_key",
",",
... | Belongs To releationships
Model Car_Engine:
function car()
{
return $this->belongs_to( 'Car', 'id', 'car_id' );
}
@param Model $model
@param mixed $foreign_key
@param mixed $key
@return array | [
"Belongs",
"To",
"releationships"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model.php#L293-L296 |
ClanCats/Core | src/bundles/Database/Model.php | Model.with | public static function with( $with, $callback = null )
{
if ( !is_array( $with ) )
{
$with = array( $with );
}
$settings = static::_model();
$query = DB::select( $settings['table'] );
// run the callback
if ( !is_null( $callback ) )
{
call_user_func_array( $callback, array( &$query ) )... | php | public static function with( $with, $callback = null )
{
if ( !is_array( $with ) )
{
$with = array( $with );
}
$settings = static::_model();
$query = DB::select( $settings['table'] );
// run the callback
if ( !is_null( $callback ) )
{
call_user_func_array( $callback, array( &$query ) )... | [
"public",
"static",
"function",
"with",
"(",
"$",
"with",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"with",
")",
")",
"{",
"$",
"with",
"=",
"array",
"(",
"$",
"with",
")",
";",
"}",
"$",
"settings",
"="... | find with an relationship
Person::with( 'cars' );
@param array|string $with
@param callback $callback
@return array | [
"find",
"with",
"an",
"relationship"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model.php#L307-L398 |
ClanCats/Core | src/bundles/Database/Model.php | Model.save | public function save( $fields = null )
{
$settings = static::_model();
// check if we should save just some fields
if ( is_null( $fields ) )
{
$fields = array_keys( $settings['defaults'] );
}
elseif ( !is_array( $fields ) )
{
$fields = array( $fields );
}
$pkey = $this->_data_store[$settin... | php | public function save( $fields = null )
{
$settings = static::_model();
// check if we should save just some fields
if ( is_null( $fields ) )
{
$fields = array_keys( $settings['defaults'] );
}
elseif ( !is_array( $fields ) )
{
$fields = array( $fields );
}
$pkey = $this->_data_store[$settin... | [
"public",
"function",
"save",
"(",
"$",
"fields",
"=",
"null",
")",
"{",
"$",
"settings",
"=",
"static",
"::",
"_model",
"(",
")",
";",
"// check if we should save just some fields",
"if",
"(",
"is_null",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
... | save an model
@param mixed $fields
@return self | [
"save",
"an",
"model"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model.php#L406-L495 |
ClanCats/Core | src/bundles/Database/Model.php | Model.delete | public function delete()
{
$settings = static::_model();
$result = DB::delete( $settings['table'] )
->where( $settings['primary_key'], $this->_data_store[$settings['primary_key']] )
->limit(1)
->run( $settings['handler'] );
$this->_data_store[$cache['primary_key']] = null;
return $result;
} | php | public function delete()
{
$settings = static::_model();
$result = DB::delete( $settings['table'] )
->where( $settings['primary_key'], $this->_data_store[$settings['primary_key']] )
->limit(1)
->run( $settings['handler'] );
$this->_data_store[$cache['primary_key']] = null;
return $result;
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"settings",
"=",
"static",
"::",
"_model",
"(",
")",
";",
"$",
"result",
"=",
"DB",
"::",
"delete",
"(",
"$",
"settings",
"[",
"'table'",
"]",
")",
"->",
"where",
"(",
"$",
"settings",
"[",
"'prim... | Delete the current model from the database
@return DB\Model | [
"Delete",
"the",
"current",
"model",
"from",
"the",
"database"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Database/Model.php#L512-L524 |
aedart/laravel-helpers | src/Traits/Encryption/CryptTrait.php | CryptTrait.getCrypt | public function getCrypt(): ?Encrypter
{
if (!$this->hasCrypt()) {
$this->setCrypt($this->getDefaultCrypt());
}
return $this->crypt;
} | php | public function getCrypt(): ?Encrypter
{
if (!$this->hasCrypt()) {
$this->setCrypt($this->getDefaultCrypt());
}
return $this->crypt;
} | [
"public",
"function",
"getCrypt",
"(",
")",
":",
"?",
"Encrypter",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasCrypt",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setCrypt",
"(",
"$",
"this",
"->",
"getDefaultCrypt",
"(",
")",
")",
";",
"}",
"return",
... | Get crypt
If no crypt has been set, this method will
set and return a default crypt, if any such
value is available
@see getDefaultCrypt()
@return Encrypter|null crypt or null if none crypt has been set | [
"Get",
"crypt"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Encryption/CryptTrait.php#L53-L59 |
slashworks/control-bundle | src/Slashworks/AppBundle/Model/ApiLog.php | ApiLog.create | public static function create($statuscode,$remote_app_id, $last_response){
$aLogs = ApiLogQuery::create()->findByRemoteAppId($remote_app_id);
foreach($aLogs as $oLog){
$oLog->delete();
}
$oApiLog = new ApiLog();
$oApiLog->setRemoteAppId($remote_app_id);
$oAp... | php | public static function create($statuscode,$remote_app_id, $last_response){
$aLogs = ApiLogQuery::create()->findByRemoteAppId($remote_app_id);
foreach($aLogs as $oLog){
$oLog->delete();
}
$oApiLog = new ApiLog();
$oApiLog->setRemoteAppId($remote_app_id);
$oAp... | [
"public",
"static",
"function",
"create",
"(",
"$",
"statuscode",
",",
"$",
"remote_app_id",
",",
"$",
"last_response",
")",
"{",
"$",
"aLogs",
"=",
"ApiLogQuery",
"::",
"create",
"(",
")",
"->",
"findByRemoteAppId",
"(",
"$",
"remote_app_id",
")",
";",
"f... | @param $statuscode
@param $remote_app_id
@param $last_response
@throws \Exception
@throws \PropelException | [
"@param",
"$statuscode",
"@param",
"$remote_app_id",
"@param",
"$last_response"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/ApiLog.php#L23-L37 |
yuncms/framework | src/widgets/CssBlock.php | CssBlock.run | public function run()
{
$block = ob_get_clean();
if ($this->renderInPlace) {
throw new Exception("not implemented yet ! ");
}
$block = trim($block);
$cssBlockPattern = '|^<style[^>]*>(?P<blockContent>.+?)</style>$|is';
if (preg_match($cssBlockPattern, $blo... | php | public function run()
{
$block = ob_get_clean();
if ($this->renderInPlace) {
throw new Exception("not implemented yet ! ");
}
$block = trim($block);
$cssBlockPattern = '|^<style[^>]*>(?P<blockContent>.+?)</style>$|is';
if (preg_match($cssBlockPattern, $blo... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"block",
"=",
"ob_get_clean",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"renderInPlace",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"not implemented yet ! \"",
")",
";",
"}",
"$",
"block",
"=",
"tr... | Ends recording a block.
This method stops output buffering and saves the rendering result as a named block in the view.
@throws Exception | [
"Ends",
"recording",
"a",
"block",
".",
"This",
"method",
"stops",
"output",
"buffering",
"and",
"saves",
"the",
"rendering",
"result",
"as",
"a",
"named",
"block",
"in",
"the",
"view",
"."
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/widgets/CssBlock.php#L39-L51 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/Mvc/Service/ViewHelperManagerFactory.php | ViewHelperManagerFactory.createService | public function createService(ServiceLocatorInterface $serviceLocator)
{
$pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
$plugins = new $pluginManagerClass;
$plugins->setServiceLocator($serviceLocator);
$configuration = $serviceLocator->get('Config');
if (isset($conf... | php | public function createService(ServiceLocatorInterface $serviceLocator)
{
$pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
$plugins = new $pluginManagerClass;
$plugins->setServiceLocator($serviceLocator);
$configuration = $serviceLocator->get('Config');
if (isset($conf... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
")",
"{",
"$",
"pluginManagerClass",
"=",
"static",
"::",
"PLUGIN_MANAGER_CLASS",
";",
"$",
"plugins",
"=",
"new",
"$",
"pluginManagerClass",
";",
"$",
"plugins",
"->",
"... | Create and return the view helper manager
@param ServiceLocatorInterface $serviceLocator
@return ViewHelperInterface
@throws Exception\RuntimeException | [
"Create",
"and",
"return",
"the",
"view",
"helper",
"manager"
] | train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Mvc/Service/ViewHelperManagerFactory.php#L60-L138 |
GrahamDeprecated/CMS-Core | src/Providers/PageProvider.php | PageProvider.navigation | public function navigation()
{
// caching logic
if ($this->validCache($this->nav)) {
// get the value from the class cache
$value = $this->nav;
} else {
// pull from the cache
$value = $this->getCache();
// check if the value is val... | php | public function navigation()
{
// caching logic
if ($this->validCache($this->nav)) {
// get the value from the class cache
$value = $this->nav;
} else {
// pull from the cache
$value = $this->getCache();
// check if the value is val... | [
"public",
"function",
"navigation",
"(",
")",
"{",
"// caching logic",
"if",
"(",
"$",
"this",
"->",
"validCache",
"(",
"$",
"this",
"->",
"nav",
")",
")",
"{",
"// get the value from the class cache",
"$",
"value",
"=",
"$",
"this",
"->",
"nav",
";",
"}",... | Get the page navigation.
@return array | [
"Get",
"the",
"page",
"navigation",
"."
] | train | https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/Providers/PageProvider.php#L51-L74 |
GrahamDeprecated/CMS-Core | src/Providers/PageProvider.php | PageProvider.validCache | protected function validCache($value)
{
if (is_null($value) || !is_array($value) || empty($value)) {
return false;
}
return true;
} | php | protected function validCache($value)
{
if (is_null($value) || !is_array($value) || empty($value)) {
return false;
}
return true;
} | [
"protected",
"function",
"validCache",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
"||",
"!",
"is_array",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",... | Check of the nav var is not corrupt.
@param array $value
@return bool | [
"Check",
"of",
"the",
"nav",
"var",
"is",
"not",
"corrupt",
"."
] | train | https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/Providers/PageProvider.php#L138-L145 |
liugene/framework | src/Env.php | Env.get | public static function get($name, $default = null)
{
$result = getenv(ENV_PREFIX . strtoupper(str_replace('.', '_', $name)));
if (false !== $result) {
if ('false' === $result) {
$result = false;
} elseif ('true' === $result) {
$result = true;
... | php | public static function get($name, $default = null)
{
$result = getenv(ENV_PREFIX . strtoupper(str_replace('.', '_', $name)));
if (false !== $result) {
if ('false' === $result) {
$result = false;
} elseif ('true' === $result) {
$result = true;
... | [
"public",
"static",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"getenv",
"(",
"ENV_PREFIX",
".",
"strtoupper",
"(",
"str_replace",
"(",
"'.'",
",",
"'_'",
",",
"$",
"name",
")",
")",
")",
";... | 获取环境变量值
@access public
@param string $name 环境变量名(支持二级 . 号分割)
@param string $default 默认值
@return mixed | [
"获取环境变量值"
] | train | https://github.com/liugene/framework/blob/450642242442c5884d47552a588a2639923e7289/src/Env.php#L24-L39 |
koriym/Koriym.QueryLocator | src/ApcQueryLocator.php | ApcQueryLocator.get | public function get(string $queryName) : string
{
$sqlId = $this->nameSpace . $queryName;
$sql = apcu_fetch($sqlId);
if (\is_string($sql)) {
return $sql;
}
$sql = $this->query->get($queryName);
apcu_store($sqlId, $sql);
return $sql;
} | php | public function get(string $queryName) : string
{
$sqlId = $this->nameSpace . $queryName;
$sql = apcu_fetch($sqlId);
if (\is_string($sql)) {
return $sql;
}
$sql = $this->query->get($queryName);
apcu_store($sqlId, $sql);
return $sql;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"queryName",
")",
":",
"string",
"{",
"$",
"sqlId",
"=",
"$",
"this",
"->",
"nameSpace",
".",
"$",
"queryName",
";",
"$",
"sql",
"=",
"apcu_fetch",
"(",
"$",
"sqlId",
")",
";",
"if",
"(",
"\\",
"is_s... | {@inheritdoc} | [
"{"
] | train | https://github.com/koriym/Koriym.QueryLocator/blob/4e9b9ecfdd99c4850e39e88204a597af503c3823/src/ApcQueryLocator.php#L40-L51 |
Ocramius/OcraDiCompiler | src/OcraDiCompiler/Di/CompiledInstantiatorsDi.php | CompiledInstantiatorsDi.newInstance | public function newInstance($name, array $params = array(), $isShared = true)
{
if (empty($params) && isset($this->compiledInstantiators[$name])) {
$cb = $this->compiledInstantiators[$name];
return $cb($this, $isShared);
}
return parent::newInstance($name, $params, ... | php | public function newInstance($name, array $params = array(), $isShared = true)
{
if (empty($params) && isset($this->compiledInstantiators[$name])) {
$cb = $this->compiledInstantiators[$name];
return $cb($this, $isShared);
}
return parent::newInstance($name, $params, ... | [
"public",
"function",
"newInstance",
"(",
"$",
"name",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"isShared",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"params",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"compiledIn... | {@inheritDoc} | [
"{"
] | train | https://github.com/Ocramius/OcraDiCompiler/blob/667f4b24771f27fb9c8d6c38ffaf72d9cd55ca4a/src/OcraDiCompiler/Di/CompiledInstantiatorsDi.php#L57-L66 |
shrink0r/workflux | src/Transition/Transition.php | Transition.isActivatedBy | public function isActivatedBy(InputInterface $input, OutputInterface $output): bool
{
foreach ($this->constraints as $constraint) {
if (!$constraint->accepts($input, $output)) {
return false;
}
}
return true;
} | php | public function isActivatedBy(InputInterface $input, OutputInterface $output): bool
{
foreach ($this->constraints as $constraint) {
if (!$constraint->accepts($input, $output)) {
return false;
}
}
return true;
} | [
"public",
"function",
"isActivatedBy",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"constraints",
"as",
"$",
"constraint",
")",
"{",
"if",
"(",
"!",
"$",
"constraint"... | @param InputInterface $input
@param OutputInterface $output
@return bool | [
"@param",
"InputInterface",
"$input",
"@param",
"OutputInterface",
"$output"
] | train | https://github.com/shrink0r/workflux/blob/008f45c64f52b1f795ab7f6ddbfc1a55580254d9/src/Transition/Transition.php#L60-L68 |
neos/doctools | Classes/Command/CommandReferenceCommandController.php | CommandReferenceCommandController.renderCommand | public function renderCommand($reference = null)
{
$references = $reference !== null ? [$reference] : array_keys($this->settings['commandReferences']);
$this->renderReferences($references);
} | php | public function renderCommand($reference = null)
{
$references = $reference !== null ? [$reference] : array_keys($this->settings['commandReferences']);
$this->renderReferences($references);
} | [
"public",
"function",
"renderCommand",
"(",
"$",
"reference",
"=",
"null",
")",
"{",
"$",
"references",
"=",
"$",
"reference",
"!==",
"null",
"?",
"[",
"$",
"reference",
"]",
":",
"array_keys",
"(",
"$",
"this",
"->",
"settings",
"[",
"'commandReferences'"... | Renders command reference documentation from source code.
@param string $reference to render. If not specified all configured references will be rendered
@return void
@throws \Neos\Flow\Mvc\Exception\StopActionException
@throws \Neos\FluidAdaptor\Exception | [
"Renders",
"command",
"reference",
"documentation",
"from",
"source",
"code",
"."
] | train | https://github.com/neos/doctools/blob/726981245a8d59319ee594a582f80a30256df98b/Classes/Command/CommandReferenceCommandController.php#L48-L52 |
neos/doctools | Classes/Command/CommandReferenceCommandController.php | CommandReferenceCommandController.renderReferences | protected function renderReferences($references)
{
foreach ($references as $reference) {
$this->outputLine('Rendering Reference "%s"', [$reference]);
$this->renderReference($reference);
}
} | php | protected function renderReferences($references)
{
foreach ($references as $reference) {
$this->outputLine('Rendering Reference "%s"', [$reference]);
$this->renderReference($reference);
}
} | [
"protected",
"function",
"renderReferences",
"(",
"$",
"references",
")",
"{",
"foreach",
"(",
"$",
"references",
"as",
"$",
"reference",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
"'Rendering Reference \"%s\"'",
",",
"[",
"$",
"reference",
"]",
")",
";... | Render a set of CLI command references to reStructuredText.
@param array $references to render.
@return void
@throws \Neos\Flow\Mvc\Exception\StopActionException
@throws \Neos\FluidAdaptor\Exception | [
"Render",
"a",
"set",
"of",
"CLI",
"command",
"references",
"to",
"reStructuredText",
"."
] | train | https://github.com/neos/doctools/blob/726981245a8d59319ee594a582f80a30256df98b/Classes/Command/CommandReferenceCommandController.php#L84-L90 |
neos/doctools | Classes/Command/CommandReferenceCommandController.php | CommandReferenceCommandController.renderReference | protected function renderReference($reference)
{
if (!isset($this->settings['commandReferences'][$reference])) {
$this->outputLine('Command reference "%s" is not configured', [$reference]);
$this->quit(1);
}
$referenceConfiguration = $this->settings['commandReferences... | php | protected function renderReference($reference)
{
if (!isset($this->settings['commandReferences'][$reference])) {
$this->outputLine('Command reference "%s" is not configured', [$reference]);
$this->quit(1);
}
$referenceConfiguration = $this->settings['commandReferences... | [
"protected",
"function",
"renderReference",
"(",
"$",
"reference",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"settings",
"[",
"'commandReferences'",
"]",
"[",
"$",
"reference",
"]",
")",
")",
"{",
"$",
"this",
"->",
"outputLine",
"(",
... | Render a CLI command reference to reStructuredText.
@param string $reference
@return void
@throws \Neos\Flow\Mvc\Exception\StopActionException
@throws \Neos\FluidAdaptor\Exception | [
"Render",
"a",
"CLI",
"command",
"reference",
"to",
"reStructuredText",
"."
] | train | https://github.com/neos/doctools/blob/726981245a8d59319ee594a582f80a30256df98b/Classes/Command/CommandReferenceCommandController.php#L100-L170 |
netgen/ngopengraph | classes/ngopengraphobjectrelationlist.php | ngOpenGraphObjectRelationList.getData | public function getData()
{
$return = array();
$relations = $this->ContentObjectAttribute->attribute( 'content' );
foreach ( $relations['relation_list'] as $relation )
{
$object = eZContentObject::fetch( $relation['contentobject_id'] );
if ( $object instanceof... | php | public function getData()
{
$return = array();
$relations = $this->ContentObjectAttribute->attribute( 'content' );
foreach ( $relations['relation_list'] as $relation )
{
$object = eZContentObject::fetch( $relation['contentobject_id'] );
if ( $object instanceof... | [
"public",
"function",
"getData",
"(",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"relations",
"=",
"$",
"this",
"->",
"ContentObjectAttribute",
"->",
"attribute",
"(",
"'content'",
")",
";",
"foreach",
"(",
"$",
"relations",
"[",
"'relati... | Returns data for the attribute
@return string | [
"Returns",
"data",
"for",
"the",
"attribute"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/classes/ngopengraphobjectrelationlist.php#L10-L24 |
netgen/ngopengraph | classes/ngopengraphobjectrelationlist.php | ngOpenGraphObjectRelationList.getDataMember | public function getDataMember( $dataMember )
{
if( $dataMember === 'related_images' )
{
$images = array();
$relations = $this->ContentObjectAttribute->attribute( 'content' );
foreach ( $relations['relation_list'] as $relation )
{
$objec... | php | public function getDataMember( $dataMember )
{
if( $dataMember === 'related_images' )
{
$images = array();
$relations = $this->ContentObjectAttribute->attribute( 'content' );
foreach ( $relations['relation_list'] as $relation )
{
$objec... | [
"public",
"function",
"getDataMember",
"(",
"$",
"dataMember",
")",
"{",
"if",
"(",
"$",
"dataMember",
"===",
"'related_images'",
")",
"{",
"$",
"images",
"=",
"array",
"(",
")",
";",
"$",
"relations",
"=",
"$",
"this",
"->",
"ContentObjectAttribute",
"->"... | Returns part of the data for the attribute
@param string $dataMember
@return string | [
"Returns",
"part",
"of",
"the",
"data",
"for",
"the",
"attribute"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/classes/ngopengraphobjectrelationlist.php#L33-L75 |
webforge-labs/psc-cms | lib/Psc/CMS/Roles/NavigationNodeEntity.php | NavigationNodeEntity.onPrePersist | public function onPrePersist() {
$this->generateSlugs();
if (!isset($this->created)) {
$this->created = \Psc\DateTime\DateTime::now();
}
$this->updated = \Psc\DateTime\DateTime::now();
return $this;
} | php | public function onPrePersist() {
$this->generateSlugs();
if (!isset($this->created)) {
$this->created = \Psc\DateTime\DateTime::now();
}
$this->updated = \Psc\DateTime\DateTime::now();
return $this;
} | [
"public",
"function",
"onPrePersist",
"(",
")",
"{",
"$",
"this",
"->",
"generateSlugs",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"created",
")",
")",
"{",
"$",
"this",
"->",
"created",
"=",
"\\",
"Psc",
"\\",
"DateTime",
"\\... | (at)ORM\PrePersist
(at)ORM\PreUpdate | [
"(",
"at",
")",
"ORM",
"\\",
"PrePersist",
"(",
"at",
")",
"ORM",
"\\",
"PreUpdate"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Roles/NavigationNodeEntity.php#L47-L56 |
xinix-technology/norm | src/Norm/Provider/NormProvider.php | NormProvider.initialize | public function initialize()
{
$app = $this->app;
$include = $app->request->get('!include');
if (!empty($include)) {
Norm::options('include', true);
}
$tz = $app->request->get('!tz');
if (!empty($tz)) {
Norm::options('tz', $tz);
}
... | php | public function initialize()
{
$app = $this->app;
$include = $app->request->get('!include');
if (!empty($include)) {
Norm::options('include', true);
}
$tz = $app->request->get('!tz');
if (!empty($tz)) {
Norm::options('tz', $tz);
}
... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"$",
"include",
"=",
"$",
"app",
"->",
"request",
"->",
"get",
"(",
"'!include'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"include",
")",
")",... | Initialize the provider | [
"Initialize",
"the",
"provider"
] | train | https://github.com/xinix-technology/norm/blob/c357f7d3a75d05324dd84b8f6a968a094c53d603/src/Norm/Provider/NormProvider.php#L94-L139 |
Chill-project/Main | Controller/ScopeController.php | ScopeController.createCreateForm | private function createCreateForm(Scope $scope)
{
$form = $this->createForm(new ScopeType(), $scope, array(
'action' => $this->generateUrl('admin_scope_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return $form... | php | private function createCreateForm(Scope $scope)
{
$form = $this->createForm(new ScopeType(), $scope, array(
'action' => $this->generateUrl('admin_scope_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return $form... | [
"private",
"function",
"createCreateForm",
"(",
"Scope",
"$",
"scope",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"ScopeType",
"(",
")",
",",
"$",
"scope",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"generateU... | Creates a form to create a Scope entity.
@param Scope $scope The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"a",
"Scope",
"entity",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/ScopeController.php#L63-L73 |
Chill-project/Main | Controller/ScopeController.php | ScopeController.newAction | public function newAction()
{
$scope = new Scope();
$form = $this->createCreateForm($scope);
return $this->render('ChillMainBundle:Scope:new.html.twig', array(
'entity' => $scope,
'form' => $form->createView(),
));
} | php | public function newAction()
{
$scope = new Scope();
$form = $this->createCreateForm($scope);
return $this->render('ChillMainBundle:Scope:new.html.twig', array(
'entity' => $scope,
'form' => $form->createView(),
));
} | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"scope",
"=",
"new",
"Scope",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"scope",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'ChillMainBundle:Scop... | Displays a form to create a new Scope entity. | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"Scope",
"entity",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/ScopeController.php#L79-L88 |
Chill-project/Main | Controller/ScopeController.php | ScopeController.createEditForm | private function createEditForm(Scope $scope)
{
$form = $this->createForm(new ScopeType(), $scope, array(
'action' => $this->generateUrl('admin_scope_update', array('id' => $scope->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' => 'Upd... | php | private function createEditForm(Scope $scope)
{
$form = $this->createForm(new ScopeType(), $scope, array(
'action' => $this->generateUrl('admin_scope_update', array('id' => $scope->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' => 'Upd... | [
"private",
"function",
"createEditForm",
"(",
"Scope",
"$",
"scope",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"ScopeType",
"(",
")",
",",
"$",
"scope",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"generateUrl... | Creates a form to edit a Scope entity.
@param Scope $scope The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"edit",
"a",
"Scope",
"entity",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/ScopeController.php#L138-L148 |
djgadd/themosis-illuminate | src/Config/ConfigFinder.php | ConfigFinder.addPath | protected function addPath($key, $path)
{
// Iterate through the extensions looking for files in the path
foreach ($this->extensions as $extension) {
// Find all matching files for this extension
foreach (Finder::create()->files()->name("*.{$extension}")->in($path) as $file) {
... | php | protected function addPath($key, $path)
{
// Iterate through the extensions looking for files in the path
foreach ($this->extensions as $extension) {
// Find all matching files for this extension
foreach (Finder::create()->files()->name("*.{$extension}")->in($path) as $file) {
... | [
"protected",
"function",
"addPath",
"(",
"$",
"key",
",",
"$",
"path",
")",
"{",
"// Iterate through the extensions looking for files in the path",
"foreach",
"(",
"$",
"this",
"->",
"extensions",
"as",
"$",
"extension",
")",
"{",
"// Find all matching files for this ex... | When a path is registered any matching files are read in and added to the
config Repository. Calls parent::addPath once finished
@param string $key The file URL if defined or numeric index.
@param string $path
@return $this | [
"When",
"a",
"path",
"is",
"registered",
"any",
"matching",
"files",
"are",
"read",
"in",
"and",
"added",
"to",
"the",
"config",
"Repository",
".",
"Calls",
"parent",
"::",
"addPath",
"once",
"finished"
] | train | https://github.com/djgadd/themosis-illuminate/blob/13ee4c3413cddd85a2f262ac361f35c81da0c53c/src/Config/ConfigFinder.php#L28-L58 |
djgadd/themosis-illuminate | src/Config/ConfigFinder.php | ConfigFinder.fileMatchesMoreSpecificExtension | protected function fileMatchesMoreSpecificExtension(string $filename, string $extension) : bool
{
return array_reduce($this->extensions, function ($match, $compare) use ($filename, $extension) {
if ($match || $compare === $extension || strlen($compare) < strlen($extension)) {
return $match;
... | php | protected function fileMatchesMoreSpecificExtension(string $filename, string $extension) : bool
{
return array_reduce($this->extensions, function ($match, $compare) use ($filename, $extension) {
if ($match || $compare === $extension || strlen($compare) < strlen($extension)) {
return $match;
... | [
"protected",
"function",
"fileMatchesMoreSpecificExtension",
"(",
"string",
"$",
"filename",
",",
"string",
"$",
"extension",
")",
":",
"bool",
"{",
"return",
"array_reduce",
"(",
"$",
"this",
"->",
"extensions",
",",
"function",
"(",
"$",
"match",
",",
"$",
... | Determines if a file matches another more specific extension
@param string $filename
@param string $extension
@return bool | [
"Determines",
"if",
"a",
"file",
"matches",
"another",
"more",
"specific",
"extension"
] | train | https://github.com/djgadd/themosis-illuminate/blob/13ee4c3413cddd85a2f262ac361f35c81da0c53c/src/Config/ConfigFinder.php#L67-L76 |
djgadd/themosis-illuminate | src/Config/ConfigFinder.php | ConfigFinder.getNestedDirectoryDots | protected function getNestedDirectoryDots(string $path, string $filePath) : string
{
if (substr($filePath, -1) !== DIRECTORY_SEPARATOR) {
$filePath = $filePath . DIRECTORY_SEPARATOR;
}
// Generate dots if it's a nested file
if ($nested = trim(str_replace($path, '', $filePath), DIREC... | php | protected function getNestedDirectoryDots(string $path, string $filePath) : string
{
if (substr($filePath, -1) !== DIRECTORY_SEPARATOR) {
$filePath = $filePath . DIRECTORY_SEPARATOR;
}
// Generate dots if it's a nested file
if ($nested = trim(str_replace($path, '', $filePath), DIREC... | [
"protected",
"function",
"getNestedDirectoryDots",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"filePath",
")",
":",
"string",
"{",
"if",
"(",
"substr",
"(",
"$",
"filePath",
",",
"-",
"1",
")",
"!==",
"DIRECTORY_SEPARATOR",
")",
"{",
"$",
"filePath",
... | Generates dots for files in $filePath nested in $path
@param string $path
@param string $filePath
@return string | [
"Generates",
"dots",
"for",
"files",
"in",
"$filePath",
"nested",
"in",
"$path"
] | train | https://github.com/djgadd/themosis-illuminate/blob/13ee4c3413cddd85a2f262ac361f35c81da0c53c/src/Config/ConfigFinder.php#L85-L97 |
djgadd/themosis-illuminate | src/Config/ConfigFinder.php | ConfigFinder.mergeConfigs | protected function mergeConfigs(array $old, array $new) : array
{
foreach ($new as $key => $val) {
if (!array_key_exists($key, $old) || !is_array($old[$key]) || !is_array($val)) {
$old[$key] = $val;
continue;
}
if (is_int($key)) {
$old[] = $val;
... | php | protected function mergeConfigs(array $old, array $new) : array
{
foreach ($new as $key => $val) {
if (!array_key_exists($key, $old) || !is_array($old[$key]) || !is_array($val)) {
$old[$key] = $val;
continue;
}
if (is_int($key)) {
$old[] = $val;
... | [
"protected",
"function",
"mergeConfigs",
"(",
"array",
"$",
"old",
",",
"array",
"$",
"new",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"new",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",... | Recusively merges configs together
@param array $old
@param array $new
@return array | [
"Recusively",
"merges",
"configs",
"together"
] | train | https://github.com/djgadd/themosis-illuminate/blob/13ee4c3413cddd85a2f262ac361f35c81da0c53c/src/Config/ConfigFinder.php#L106-L123 |
lmammino/e-foundation | src/Common/Doctrine/MappingLocator.php | MappingLocator.getMappings | public static function getMappings()
{
$basePath = self::getBasePath();
return array(
realpath($basePath.'Address/Resources/config/doctrine/model') => 'LMammino\EFoundation\Address\Model',
realpath($basePath.'Attribute/Resources/config/doctrine/model') =>
'LM... | php | public static function getMappings()
{
$basePath = self::getBasePath();
return array(
realpath($basePath.'Address/Resources/config/doctrine/model') => 'LMammino\EFoundation\Address\Model',
realpath($basePath.'Attribute/Resources/config/doctrine/model') =>
'LM... | [
"public",
"static",
"function",
"getMappings",
"(",
")",
"{",
"$",
"basePath",
"=",
"self",
"::",
"getBasePath",
"(",
")",
";",
"return",
"array",
"(",
"realpath",
"(",
"$",
"basePath",
".",
"'Address/Resources/config/doctrine/model'",
")",
"=>",
"'LMammino\\EFo... | Get the mapping
@return array | [
"Get",
"the",
"mapping"
] | train | https://github.com/lmammino/e-foundation/blob/198b7047d93eb11c9bc0c7ddf0bfa8229d42807a/src/Common/Doctrine/MappingLocator.php#L17-L32 |
titon/db | src/Titon/Db/Driver/Type/DateType.php | DateType.to | public function to($value) {
if (is_array($value)) {
$hour = isset($value['hour']) ? $value['hour'] : 0;
if (isset($value['meridiem']) && strtolower($value['meridiem']) === 'pm') {
$hour += 12;
}
$timestamp = mktime(
$hour,
... | php | public function to($value) {
if (is_array($value)) {
$hour = isset($value['hour']) ? $value['hour'] : 0;
if (isset($value['meridiem']) && strtolower($value['meridiem']) === 'pm') {
$hour += 12;
}
$timestamp = mktime(
$hour,
... | [
"public",
"function",
"to",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"hour",
"=",
"isset",
"(",
"$",
"value",
"[",
"'hour'",
"]",
")",
"?",
"$",
"value",
"[",
"'hour'",
"]",
":",
"0",
";",
"if... | {@inheritdoc}
@uses Titon\Utility\Time | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Type/DateType.php#L46-L70 |
nyeholt/silverstripe-external-content | code/forms/ExternalTreeDropdownField.php | ExternalTreeDropdownField.objectForKey | protected function objectForKey($key) {
if ($this->keyField == 'ID') {
return ExternalContent::getDataObjectFor($key);
} else {
return DataObject::get_one($this->sourceObject, "\"{$this->keyField}\" = '" . Convert::raw2sql($key) . "'");
}
} | php | protected function objectForKey($key) {
if ($this->keyField == 'ID') {
return ExternalContent::getDataObjectFor($key);
} else {
return DataObject::get_one($this->sourceObject, "\"{$this->keyField}\" = '" . Convert::raw2sql($key) . "'");
}
} | [
"protected",
"function",
"objectForKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"keyField",
"==",
"'ID'",
")",
"{",
"return",
"ExternalContent",
"::",
"getDataObjectFor",
"(",
"$",
"key",
")",
";",
"}",
"else",
"{",
"return",
"DataObjec... | Get the object where the $keyField is equal to a certain value
@param string|int $key
@return DataObject | [
"Get",
"the",
"object",
"where",
"the",
"$keyField",
"is",
"equal",
"to",
"a",
"certain",
"value"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/forms/ExternalTreeDropdownField.php#L40-L46 |
silvercommerce/catalogue-frontend | src/extensions/CategoryExtension.php | CategoryExtension.PrimaryImage | public function PrimaryImage()
{
// If we have associated an image, return it
$image = $this->owner->Image();
if ($image->exists()) {
return $image;
}
// Next try and get a child product image
$product = $this->owner->AllProducts()->first();
if ... | php | public function PrimaryImage()
{
// If we have associated an image, return it
$image = $this->owner->Image();
if ($image->exists()) {
return $image;
}
// Next try and get a child product image
$product = $this->owner->AllProducts()->first();
if ... | [
"public",
"function",
"PrimaryImage",
"(",
")",
"{",
"// If we have associated an image, return it",
"$",
"image",
"=",
"$",
"this",
"->",
"owner",
"->",
"Image",
"(",
")",
";",
"if",
"(",
"$",
"image",
"->",
"exists",
"(",
")",
")",
"{",
"return",
"$",
... | Gets the main image to use for this category, this
can either be the selected image, an image from the
first product or the default "no-product" image.
@return Image | [
"Gets",
"the",
"main",
"image",
"to",
"use",
"for",
"this",
"category",
"this",
"can",
"either",
"be",
"the",
"selected",
"image",
"an",
"image",
"from",
"the",
"first",
"product",
"or",
"the",
"default",
"no",
"-",
"product",
"image",
"."
] | train | https://github.com/silvercommerce/catalogue-frontend/blob/671f1e32bf6bc6eb193c6608ae904cd055540cc4/src/extensions/CategoryExtension.php#L35-L53 |
anexia-it/anexia-laravel-encryption | src/DatabaseEncryptionServiceProvider.php | DatabaseEncryptionServiceProvider.boot | public function boot()
{
Builder::macro('whereDecrypted', function($attribute, $operator = null, $value = null, $decryptKey = null){
list($value, $operator, $decryptKey) = $this->query->prepareDecryptionValueOperatorAndDecryptKey(
$value, $operator, $decryptKey, func_num_args() =... | php | public function boot()
{
Builder::macro('whereDecrypted', function($attribute, $operator = null, $value = null, $decryptKey = null){
list($value, $operator, $decryptKey) = $this->query->prepareDecryptionValueOperatorAndDecryptKey(
$value, $operator, $decryptKey, func_num_args() =... | [
"public",
"function",
"boot",
"(",
")",
"{",
"Builder",
"::",
"macro",
"(",
"'whereDecrypted'",
",",
"function",
"(",
"$",
"attribute",
",",
"$",
"operator",
"=",
"null",
",",
"$",
"value",
"=",
"null",
",",
"$",
"decryptKey",
"=",
"null",
")",
"{",
... | Bootstrap the application services.
@return void | [
"Bootstrap",
"the",
"application",
"services",
"."
] | train | https://github.com/anexia-it/anexia-laravel-encryption/blob/b7c72d99916ebca2d2cf2dbab1d4c0f84e383081/src/DatabaseEncryptionServiceProvider.php#L15-L60 |
helthe/Chronos | Field/DayOfMonthField.php | DayOfMonthField.matches | public function matches(\DateTime $date)
{
if ('?' === $this->value) {
return true;
}
$found = parent::matches($date);
if (!$found) {
$values = $this->getValueArray();
foreach ($values as $value) {
if ($found) {
... | php | public function matches(\DateTime $date)
{
if ('?' === $this->value) {
return true;
}
$found = parent::matches($date);
if (!$found) {
$values = $this->getValueArray();
foreach ($values as $value) {
if ($found) {
... | [
"public",
"function",
"matches",
"(",
"\\",
"DateTime",
"$",
"date",
")",
"{",
"if",
"(",
"'?'",
"===",
"$",
"this",
"->",
"value",
")",
"{",
"return",
"true",
";",
"}",
"$",
"found",
"=",
"parent",
"::",
"matches",
"(",
"$",
"date",
")",
";",
"i... | {@inheritdoc} | [
"{"
] | train | https://github.com/helthe/Chronos/blob/6c783c55c32b323550fc6f21cd644c2be82720b0/Field/DayOfMonthField.php#L24-L49 |
helthe/Chronos | Field/DayOfMonthField.php | DayOfMonthField.matchesNearestWeekday | private function matchesNearestWeekday($day, \DateTime $date)
{
$day = new \DateTime($date->format('F') . ' ' . substr($day, 0, -1) . ' ' . $date->format('Y'));
$weekday = $day->format('w');
if ($day->format('d') == $date->format('d') && $weekday !== '0' && $weekday !== '6') {
r... | php | private function matchesNearestWeekday($day, \DateTime $date)
{
$day = new \DateTime($date->format('F') . ' ' . substr($day, 0, -1) . ' ' . $date->format('Y'));
$weekday = $day->format('w');
if ($day->format('d') == $date->format('d') && $weekday !== '0' && $weekday !== '6') {
r... | [
"private",
"function",
"matchesNearestWeekday",
"(",
"$",
"day",
",",
"\\",
"DateTime",
"$",
"date",
")",
"{",
"$",
"day",
"=",
"new",
"\\",
"DateTime",
"(",
"$",
"date",
"->",
"format",
"(",
"'F'",
")",
".",
"' '",
".",
"substr",
"(",
"$",
"day",
... | Checks if the given last day matches the given date.
@param string $day
@param \DateTime $date
@return Boolean | [
"Checks",
"if",
"the",
"given",
"last",
"day",
"matches",
"the",
"given",
"date",
"."
] | train | https://github.com/helthe/Chronos/blob/6c783c55c32b323550fc6f21cd644c2be82720b0/Field/DayOfMonthField.php#L102-L122 |
dms-org/package.blog | src/Domain/Entities/BlogArticle.php | BlogArticle.defineEntity | protected function defineEntity(ClassDefinition $class)
{
$class->property($this->author)->asObject(BlogAuthor::class);
$class->property($this->category)->nullable()->asObject(BlogCategory::class);
$class->property($this->title)->asString();
$class->property($this->subTitle)->asSt... | php | protected function defineEntity(ClassDefinition $class)
{
$class->property($this->author)->asObject(BlogAuthor::class);
$class->property($this->category)->nullable()->asObject(BlogCategory::class);
$class->property($this->title)->asString();
$class->property($this->subTitle)->asSt... | [
"protected",
"function",
"defineEntity",
"(",
"ClassDefinition",
"$",
"class",
")",
"{",
"$",
"class",
"->",
"property",
"(",
"$",
"this",
"->",
"author",
")",
"->",
"asObject",
"(",
"BlogAuthor",
"::",
"class",
")",
";",
"$",
"class",
"->",
"property",
... | Defines the structure of this entity.
@param ClassDefinition $class | [
"Defines",
"the",
"structure",
"of",
"this",
"entity",
"."
] | train | https://github.com/dms-org/package.blog/blob/1500f6fad20d81289a0dfa617fc1c54699f01e16/src/Domain/Entities/BlogArticle.php#L176-L209 |
dms-org/package.blog | src/Domain/Entities/BlogArticle.php | BlogArticle.postComment | public function postComment(string $authorName, EmailAddress $authorEmail, string $content, IClock $clock): BlogArticleComment
{
InvalidOperationException::verify($this->published, 'This blog article is not published');
InvalidOperationException::verify($this->allowCommenting, 'This blog article doe... | php | public function postComment(string $authorName, EmailAddress $authorEmail, string $content, IClock $clock): BlogArticleComment
{
InvalidOperationException::verify($this->published, 'This blog article is not published');
InvalidOperationException::verify($this->allowCommenting, 'This blog article doe... | [
"public",
"function",
"postComment",
"(",
"string",
"$",
"authorName",
",",
"EmailAddress",
"$",
"authorEmail",
",",
"string",
"$",
"content",
",",
"IClock",
"$",
"clock",
")",
":",
"BlogArticleComment",
"{",
"InvalidOperationException",
"::",
"verify",
"(",
"$"... | @param string $authorName
@param EmailAddress $authorEmail
@param string $content
@param IClock $clock
@return BlogArticleComment | [
"@param",
"string",
"$authorName",
"@param",
"EmailAddress",
"$authorEmail",
"@param",
"string",
"$content",
"@param",
"IClock",
"$clock"
] | train | https://github.com/dms-org/package.blog/blob/1500f6fad20d81289a0dfa617fc1c54699f01e16/src/Domain/Entities/BlogArticle.php#L219-L235 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Writer/Word2007/ContentTypes.php | PHPWord_Writer_Word2007_ContentTypes._getImageMimeType | private function _getImageMimeType($pFile = '') {
if(PHPWord_Shared_File::file_exists($pFile)) {
$image = getimagesize($pFile);
return image_type_to_mime_type($image[2]);
} else {
throw new Exception("File $pFile does not exist");
}
} | php | private function _getImageMimeType($pFile = '') {
if(PHPWord_Shared_File::file_exists($pFile)) {
$image = getimagesize($pFile);
return image_type_to_mime_type($image[2]);
} else {
throw new Exception("File $pFile does not exist");
}
} | [
"private",
"function",
"_getImageMimeType",
"(",
"$",
"pFile",
"=",
"''",
")",
"{",
"if",
"(",
"PHPWord_Shared_File",
"::",
"file_exists",
"(",
"$",
"pFile",
")",
")",
"{",
"$",
"image",
"=",
"getimagesize",
"(",
"$",
"pFile",
")",
";",
"return",
"image_... | Get image mime type
@param string $pFile Filename
@return string Mime Type
@throws Exception | [
"Get",
"image",
"mime",
"type"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Writer/Word2007/ContentTypes.php#L137-L144 |
webforge-labs/psc-cms | lib/PHPWord/PHPWord/Writer/Word2007/ContentTypes.php | PHPWord_Writer_Word2007_ContentTypes._writeDefaultContentType | private function _writeDefaultContentType(PHPWord_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') {
if($pPartname != '' && $pContentType != '') {
// Write content type
$objWriter->startElement('Default');
$objWriter->writeAttribute('Extension', $pPartname);
$objWriter->write... | php | private function _writeDefaultContentType(PHPWord_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') {
if($pPartname != '' && $pContentType != '') {
// Write content type
$objWriter->startElement('Default');
$objWriter->writeAttribute('Extension', $pPartname);
$objWriter->write... | [
"private",
"function",
"_writeDefaultContentType",
"(",
"PHPWord_Shared_XMLWriter",
"$",
"objWriter",
"=",
"null",
",",
"$",
"pPartname",
"=",
"''",
",",
"$",
"pContentType",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"pPartname",
"!=",
"''",
"&&",
"$",
"pContentT... | Write Default content type
@param PHPWord_Shared_XMLWriter $objWriter XML Writer
@param string $pPartname Part name
@param string $pContentType Content type
@throws Exception | [
"Write",
"Default",
"content",
"type"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/PHPWord/PHPWord/Writer/Word2007/ContentTypes.php#L154-L164 |
AydinHassan/cli-md-renderer | src/CliRenderer.php | CliRenderer.renderInlines | public function renderInlines(array $inlines)
{
return implode(
"",
array_map(
function (AbstractInline $inline) {
$renderer = $this->getInlineRendererForClass(get_class($inline));
if (!$renderer) {
throw... | php | public function renderInlines(array $inlines)
{
return implode(
"",
array_map(
function (AbstractInline $inline) {
$renderer = $this->getInlineRendererForClass(get_class($inline));
if (!$renderer) {
throw... | [
"public",
"function",
"renderInlines",
"(",
"array",
"$",
"inlines",
")",
"{",
"return",
"implode",
"(",
"\"\"",
",",
"array_map",
"(",
"function",
"(",
"AbstractInline",
"$",
"inline",
")",
"{",
"$",
"renderer",
"=",
"$",
"this",
"->",
"getInlineRendererFor... | @param AbstractInline[] $inlines
@return string | [
"@param",
"AbstractInline",
"[]",
"$inlines"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/CliRenderer.php#L73-L91 |
AydinHassan/cli-md-renderer | src/CliRenderer.php | CliRenderer.renderBlock | public function renderBlock(AbstractBlock $block)
{
$renderer = $this->getBlockRendererForClass(get_class($block));
if (!$renderer) {
throw new RuntimeException(
sprintf('Unable to find corresponding renderer for block type: "%s"', get_class($block))
);
... | php | public function renderBlock(AbstractBlock $block)
{
$renderer = $this->getBlockRendererForClass(get_class($block));
if (!$renderer) {
throw new RuntimeException(
sprintf('Unable to find corresponding renderer for block type: "%s"', get_class($block))
);
... | [
"public",
"function",
"renderBlock",
"(",
"AbstractBlock",
"$",
"block",
")",
"{",
"$",
"renderer",
"=",
"$",
"this",
"->",
"getBlockRendererForClass",
"(",
"get_class",
"(",
"$",
"block",
")",
")",
";",
"if",
"(",
"!",
"$",
"renderer",
")",
"{",
"throw"... | @param AbstractBlock $block
@throws RuntimeException
@return string | [
"@param",
"AbstractBlock",
"$block"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/CliRenderer.php#L100-L110 |
AydinHassan/cli-md-renderer | src/CliRenderer.php | CliRenderer.renderBlocks | public function renderBlocks(array $blocks)
{
return implode(
"\n",
array_map(
function (AbstractBlock $block) {
return $this->renderBlock($block);
},
$blocks
)
);
} | php | public function renderBlocks(array $blocks)
{
return implode(
"\n",
array_map(
function (AbstractBlock $block) {
return $this->renderBlock($block);
},
$blocks
)
);
} | [
"public",
"function",
"renderBlocks",
"(",
"array",
"$",
"blocks",
")",
"{",
"return",
"implode",
"(",
"\"\\n\"",
",",
"array_map",
"(",
"function",
"(",
"AbstractBlock",
"$",
"block",
")",
"{",
"return",
"$",
"this",
"->",
"renderBlock",
"(",
"$",
"block"... | @param AbstractBlock[] $blocks
@return string | [
"@param",
"AbstractBlock",
"[]",
"$blocks"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/CliRenderer.php#L117-L128 |
AydinHassan/cli-md-renderer | src/CliRenderer.php | CliRenderer.getInlineRendererForClass | private function getInlineRendererForClass($inlineBlockClass)
{
if (!isset($this->inlineRenderers[$inlineBlockClass])) {
return null;
}
return $this->inlineRenderers[$inlineBlockClass];
} | php | private function getInlineRendererForClass($inlineBlockClass)
{
if (!isset($this->inlineRenderers[$inlineBlockClass])) {
return null;
}
return $this->inlineRenderers[$inlineBlockClass];
} | [
"private",
"function",
"getInlineRendererForClass",
"(",
"$",
"inlineBlockClass",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"inlineRenderers",
"[",
"$",
"inlineBlockClass",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"th... | @param string $inlineBlockClass
@return null|CliInlineRendererInterface | [
"@param",
"string",
"$inlineBlockClass"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/CliRenderer.php#L135-L142 |
AydinHassan/cli-md-renderer | src/CliRenderer.php | CliRenderer.getBlockRendererForClass | private function getBlockRendererForClass($blockClass)
{
if (!isset($this->renderers[$blockClass])) {
return null;
}
return $this->renderers[$blockClass];
} | php | private function getBlockRendererForClass($blockClass)
{
if (!isset($this->renderers[$blockClass])) {
return null;
}
return $this->renderers[$blockClass];
} | [
"private",
"function",
"getBlockRendererForClass",
"(",
"$",
"blockClass",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"renderers",
"[",
"$",
"blockClass",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"ren... | @param string $blockClass
@return null|CliBlockRendererInterface | [
"@param",
"string",
"$blockClass"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/CliRenderer.php#L149-L156 |
PeekAndPoke/psi | src/Operation/FullSet/FlattenOperation.php | FlattenOperation.apply | public function apply(\Iterator $set)
{
$result = new \ArrayIterator();
$this->flatten($result, $set);
return $result;
} | php | public function apply(\Iterator $set)
{
$result = new \ArrayIterator();
$this->flatten($result, $set);
return $result;
} | [
"public",
"function",
"apply",
"(",
"\\",
"Iterator",
"$",
"set",
")",
"{",
"$",
"result",
"=",
"new",
"\\",
"ArrayIterator",
"(",
")",
";",
"$",
"this",
"->",
"flatten",
"(",
"$",
"result",
",",
"$",
"set",
")",
";",
"return",
"$",
"result",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/FullSet/FlattenOperation.php#L22-L29 |
helthe/Chronos | Job/AbstractJob.php | AbstractJob.isDue | public function isDue($date = 'now')
{
if (!$date instanceof \DateTime) {
$date = new \DateTime($date);
}
return $this->expression->matches($date);
} | php | public function isDue($date = 'now')
{
if (!$date instanceof \DateTime) {
$date = new \DateTime($date);
}
return $this->expression->matches($date);
} | [
"public",
"function",
"isDue",
"(",
"$",
"date",
"=",
"'now'",
")",
"{",
"if",
"(",
"!",
"$",
"date",
"instanceof",
"\\",
"DateTime",
")",
"{",
"$",
"date",
"=",
"new",
"\\",
"DateTime",
"(",
"$",
"date",
")",
";",
"}",
"return",
"$",
"this",
"->... | {@inheritdoc} | [
"{"
] | train | https://github.com/helthe/Chronos/blob/6c783c55c32b323550fc6f21cd644c2be82720b0/Job/AbstractJob.php#L53-L60 |
devmobgroup/postcodes | src/Util/Json.php | Json.decode | public static function decode(ResponseInterface $response): array
{
$contents = $response->getBody()->getContents();
$decoded = json_decode($contents, true);
$response->getBody()->rewind();
if (json_last_error() !== JSON_ERROR_NONE || ! is_array($decoded)) {
throw new Js... | php | public static function decode(ResponseInterface $response): array
{
$contents = $response->getBody()->getContents();
$decoded = json_decode($contents, true);
$response->getBody()->rewind();
if (json_last_error() !== JSON_ERROR_NONE || ! is_array($decoded)) {
throw new Js... | [
"public",
"static",
"function",
"decode",
"(",
"ResponseInterface",
"$",
"response",
")",
":",
"array",
"{",
"$",
"contents",
"=",
"$",
"response",
"->",
"getBody",
"(",
")",
"->",
"getContents",
"(",
")",
";",
"$",
"decoded",
"=",
"json_decode",
"(",
"$... | Json decode an http response.
@param \Psr\Http\Message\ResponseInterface $response
@return array
@throws \DevMob\Postcodes\Exceptions\JsonException | [
"Json",
"decode",
"an",
"http",
"response",
"."
] | train | https://github.com/devmobgroup/postcodes/blob/1a8438fd960a8f50ec28d61af94560892b529f12/src/Util/Json.php#L17-L28 |
Nozemi/SlickBoard-Library | lib/SBLib/Database/DBUtil.php | DBUtil.addQuery | public function addQuery(DBUtilQuery $query) {
if($query->getName() !== null) {
$this->_queryQueue[$query->getName()] = $query;
} else {
$this->_queryQueue[] = $query;
}
new Logger('Query added to the queue.', Logger::DEBUG, __CLASS__, __LINE__);
return $... | php | public function addQuery(DBUtilQuery $query) {
if($query->getName() !== null) {
$this->_queryQueue[$query->getName()] = $query;
} else {
$this->_queryQueue[] = $query;
}
new Logger('Query added to the queue.', Logger::DEBUG, __CLASS__, __LINE__);
return $... | [
"public",
"function",
"addQuery",
"(",
"DBUtilQuery",
"$",
"query",
")",
"{",
"if",
"(",
"$",
"query",
"->",
"getName",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_queryQueue",
"[",
"$",
"query",
"->",
"getName",
"(",
")",
"]",
"=",
"$"... | Adds a query with it's parameters to the query queue.
@param DBUtilQuery $query
@return $this | [
"Adds",
"a",
"query",
"with",
"it",
"s",
"parameters",
"to",
"the",
"query",
"queue",
"."
] | train | https://github.com/Nozemi/SlickBoard-Library/blob/c9f0a26a30f8127c997f75d7232eac170972418d/lib/SBLib/Database/DBUtil.php#L123-L132 |
Nozemi/SlickBoard-Library | lib/SBLib/Database/DBUtil.php | DBUtil.addQueries | public function addQueries($queries) {
if(is_array($queries)) {
foreach($queries as $query) {
$this->addQuery($query);
}
new Logger('Queries added to the queue.', Logger::DEBUG, __CLASS__, __LINE__);
return $this;
}
new Logger('Fa... | php | public function addQueries($queries) {
if(is_array($queries)) {
foreach($queries as $query) {
$this->addQuery($query);
}
new Logger('Queries added to the queue.', Logger::DEBUG, __CLASS__, __LINE__);
return $this;
}
new Logger('Fa... | [
"public",
"function",
"addQueries",
"(",
"$",
"queries",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"queries",
")",
")",
"{",
"foreach",
"(",
"$",
"queries",
"as",
"$",
"query",
")",
"{",
"$",
"this",
"->",
"addQuery",
"(",
"$",
"query",
")",
";",
... | Add an array of "DBUtilQuery"s to the query_queue.
@param $queries
@return $this | [
"Add",
"an",
"array",
"of",
"DBUtilQuery",
"s",
"to",
"the",
"query_queue",
"."
] | train | https://github.com/Nozemi/SlickBoard-Library/blob/c9f0a26a30f8127c997f75d7232eac170972418d/lib/SBLib/Database/DBUtil.php#L140-L152 |
yuncms/framework | src/rest/models/UploaderAudioForm.php | UploaderAudioForm.save | public function save()
{
if ($this->validate() && $this->file instanceof UploadedFile) {
try {
if (($uploader = $this->file->save()) != false) {
$this->file = $uploader->getUrl();
return true;
} else {
$t... | php | public function save()
{
if ($this->validate() && $this->file instanceof UploadedFile) {
try {
if (($uploader = $this->file->save()) != false) {
$this->file = $uploader->getUrl();
return true;
} else {
$t... | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
"&&",
"$",
"this",
"->",
"file",
"instanceof",
"UploadedFile",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"$",
"uploader",
"=",
"$",
"this",
"->",
"file",
... | 保存图片
@return boolean
@throws \Exception | [
"保存图片"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/rest/models/UploaderAudioForm.php#L53-L72 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.errors | public function errors( $key = null )
{
if ( !is_null( $key ) )
{
if ( isset( $this->errors[$key] ) )
{
return $this->errors[$key];
}
return array();
}
$errors = array();
foreach( $this->errors as $error_array )
{
$errors = array_merge( $errors, $error_array );
}
return $errors;
... | php | public function errors( $key = null )
{
if ( !is_null( $key ) )
{
if ( isset( $this->errors[$key] ) )
{
return $this->errors[$key];
}
return array();
}
$errors = array();
foreach( $this->errors as $error_array )
{
$errors = array_merge( $errors, $error_array );
}
return $errors;
... | [
"public",
"function",
"errors",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this... | Return the error messages
@return array | [
"Return",
"the",
"error",
"messages"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L137-L156 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.add_error | public function add_error( $key, $message )
{
$this->success = false;
$this->errors[$key][] = $message;
} | php | public function add_error( $key, $message )
{
$this->success = false;
$this->errors[$key][] = $message;
} | [
"public",
"function",
"add_error",
"(",
"$",
"key",
",",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"success",
"=",
"false",
";",
"$",
"this",
"->",
"errors",
"[",
"$",
"key",
"]",
"[",
"]",
"=",
"$",
"message",
";",
"}"
] | Add an error to validator
@param string $key
@param string $message
@return void | [
"Add",
"an",
"error",
"to",
"validator"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L165-L169 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.label | public function label( $data, $value = null )
{
if ( !is_null( $value ) && !is_array( $data ) )
{
$data = array( $data => $value );
}
if ( !is_array( $data ) )
{
throw new \InvalidArgumentException( 'CCValidator::label - invalid label data given' );
}
$this->labels = array_merge( $this->labels, $... | php | public function label( $data, $value = null )
{
if ( !is_null( $value ) && !is_array( $data ) )
{
$data = array( $data => $value );
}
if ( !is_array( $data ) )
{
throw new \InvalidArgumentException( 'CCValidator::label - invalid label data given' );
}
$this->labels = array_merge( $this->labels, $... | [
"public",
"function",
"label",
"(",
"$",
"data",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
"&&",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"$",
"data",
... | Set a data value
@param string $data
@param mixed $value
@return void | [
"Set",
"a",
"data",
"value"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L190-L203 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.rules | public function rules()
{
$args = func_get_args();
$key = array_shift( $args );
if ( !is_array( reset( $args ) ) )
{
$rules = $args;
}
else
{
$rules = array_shift( $args );
}
$success = true;
foreach( $rules as $rule )
{
$rule = explode( ':', $rule );
$params = array();
if ( ... | php | public function rules()
{
$args = func_get_args();
$key = array_shift( $args );
if ( !is_array( reset( $args ) ) )
{
$rules = $args;
}
else
{
$rules = array_shift( $args );
}
$success = true;
foreach( $rules as $rule )
{
$rule = explode( ':', $rule );
$params = array();
if ( ... | [
"public",
"function",
"rules",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"key",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"reset",
"(",
"$",
"args",
")",
")",
")",
"{",
"$",
"ru... | Apply multiple rules to one attribute
@param ...string
@return bool | [
"Apply",
"multiple",
"rules",
"to",
"one",
"attribute"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L231-L269 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.message | public function message()
{
$params = func_get_args();
$message = array_shift( $params );
$method = array_shift( $params );
if ( !$result = $this->validate( $method, $params ) )
{
$key = array_shift( $params );
$params = $this->get_error_message_params( $key, $params );
// replace the params ins... | php | public function message()
{
$params = func_get_args();
$message = array_shift( $params );
$method = array_shift( $params );
if ( !$result = $this->validate( $method, $params ) )
{
$key = array_shift( $params );
$params = $this->get_error_message_params( $key, $params );
// replace the params ins... | [
"public",
"function",
"message",
"(",
")",
"{",
"$",
"params",
"=",
"func_get_args",
"(",
")",
";",
"$",
"message",
"=",
"array_shift",
"(",
"$",
"params",
")",
";",
"$",
"method",
"=",
"array_shift",
"(",
"$",
"params",
")",
";",
"if",
"(",
"!",
"... | Run the validation with a custom message
@param mixed...
@return bool | [
"Run",
"the",
"validation",
"with",
"a",
"custom",
"message"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L296-L319 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.validate | protected function validate( $method, $params )
{
$reverse = false;
// when the method starts with not we assume that we
// have to reverse the validation means only accepting the opposite
if ( substr( $method, 0, 4 ) === 'not_' )
{
$reverse = true; $method = substr( $method, 4 );
}
if ( array_key_... | php | protected function validate( $method, $params )
{
$reverse = false;
// when the method starts with not we assume that we
// have to reverse the validation means only accepting the opposite
if ( substr( $method, 0, 4 ) === 'not_' )
{
$reverse = true; $method = substr( $method, 4 );
}
if ( array_key_... | [
"protected",
"function",
"validate",
"(",
"$",
"method",
",",
"$",
"params",
")",
"{",
"$",
"reverse",
"=",
"false",
";",
"// when the method starts with not we assume that we ",
"// have to reverse the validation means only accepting the opposite",
"if",
"(",
"substr",
"("... | Run an validation call
@param string $rule
@param array $params
@return bool | [
"Run",
"an",
"validation",
"call"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L328-L350 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.proof_result | protected function proof_result( $rule, $key, $result )
{
if ( $result === false )
{
$this->failed[$key][] = $rule;
}
if ( $this->success === true )
{
return $this->success = $result;
}
return $result;
} | php | protected function proof_result( $rule, $key, $result )
{
if ( $result === false )
{
$this->failed[$key][] = $rule;
}
if ( $this->success === true )
{
return $this->success = $result;
}
return $result;
} | [
"protected",
"function",
"proof_result",
"(",
"$",
"rule",
",",
"$",
"key",
",",
"$",
"result",
")",
"{",
"if",
"(",
"$",
"result",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"failed",
"[",
"$",
"key",
"]",
"[",
"]",
"=",
"$",
"rule",
";",
"}... | Proof a single result and update the success property
@param string $rule
@param string $key
@param array $result
@return bool | [
"Proof",
"a",
"single",
"result",
"and",
"update",
"the",
"success",
"property"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L360-L373 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.apply_rule | protected function apply_rule( $rule, $callback, $params, $reverse )
{
$data_key = array_shift( $params );
// In case of that the requested data set does not exist
// we always set the test as failure.
if ( !array_key_exists( $data_key, $this->data ) )
{
return $this->proof_result( $rule, $data_key, ( $r... | php | protected function apply_rule( $rule, $callback, $params, $reverse )
{
$data_key = array_shift( $params );
// In case of that the requested data set does not exist
// we always set the test as failure.
if ( !array_key_exists( $data_key, $this->data ) )
{
return $this->proof_result( $rule, $data_key, ( $r... | [
"protected",
"function",
"apply_rule",
"(",
"$",
"rule",
",",
"$",
"callback",
",",
"$",
"params",
",",
"$",
"reverse",
")",
"{",
"$",
"data_key",
"=",
"array_shift",
"(",
"$",
"params",
")",
";",
"// In case of that the requested data set does not exist",
"// w... | Apply an rule executes the rule and runs the result proof
@param string $rule
@param callback $callback
@param array $params
@return bool | [
"Apply",
"an",
"rule",
"executes",
"the",
"rule",
"and",
"runs",
"the",
"result",
"proof"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L383-L407 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.get_error_message_params | protected function get_error_message_params( $key, $params )
{
// do we have a label to replace the key?
if ( isset( $this->labels[$key] ) )
{
$field = $this->labels[$key];
} else {
$field = ucfirst( str_replace( array( '_', '-' ), ' ', $key ) );
}
return array_merge( array( 'field' => $field ), $pa... | php | protected function get_error_message_params( $key, $params )
{
// do we have a label to replace the key?
if ( isset( $this->labels[$key] ) )
{
$field = $this->labels[$key];
} else {
$field = ucfirst( str_replace( array( '_', '-' ), ' ', $key ) );
}
return array_merge( array( 'field' => $field ), $pa... | [
"protected",
"function",
"get_error_message_params",
"(",
"$",
"key",
",",
"$",
"params",
")",
"{",
"// do we have a label to replace the key?",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"labels",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"field",
"=",
"... | Get the parameter array for the error messages
@param string $key
@param array $params
@return array | [
"Get",
"the",
"parameter",
"array",
"for",
"the",
"error",
"messages"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L416-L427 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.generate_error_message | protected function generate_error_message( $rule, $key, $params )
{
$params = $this->get_error_message_params( $key, $params );
return __( ClanCats::$config->get( 'validation.language_prefix' ).'.'.$rule, $params );
} | php | protected function generate_error_message( $rule, $key, $params )
{
$params = $this->get_error_message_params( $key, $params );
return __( ClanCats::$config->get( 'validation.language_prefix' ).'.'.$rule, $params );
} | [
"protected",
"function",
"generate_error_message",
"(",
"$",
"rule",
",",
"$",
"key",
",",
"$",
"params",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"get_error_message_params",
"(",
"$",
"key",
",",
"$",
"params",
")",
";",
"return",
"__",
"(",
"... | Generate the error message for an rule
@param string $rule
@param string $key
@param array $params
@return string | [
"Generate",
"the",
"error",
"message",
"for",
"an",
"rule"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L437-L441 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.rule_required | public function rule_required( $key, $value )
{
if ( is_null( $value ) )
{
return false;
}
elseif ( is_string( $value ) && trim( $value ) == '' )
{
return false;
}
return true;
} | php | public function rule_required( $key, $value )
{
if ( is_null( $value ) )
{
return false;
}
elseif ( is_string( $value ) && trim( $value ) == '' )
{
return false;
}
return true;
} | [
"public",
"function",
"rule_required",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"false",
";",
"}",
"elseif",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"trim",
"(",
"$",
... | Check if the field is set an not empty
@param string $key
@param string $value
@return bool | [
"Check",
"if",
"the",
"field",
"is",
"set",
"an",
"not",
"empty"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L454-L465 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.rule_between_num | public function rule_between_num( $key, $value, $min, $max )
{
if ( !$this->rule_min_num( $key, $value, $min ) )
{
return false;
}
if ( !$this->rule_max_num( $key, $value, $max ) )
{
return false;
}
return true;
} | php | public function rule_between_num( $key, $value, $min, $max )
{
if ( !$this->rule_min_num( $key, $value, $min ) )
{
return false;
}
if ( !$this->rule_max_num( $key, $value, $max ) )
{
return false;
}
return true;
} | [
"public",
"function",
"rule_between_num",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"min",
",",
"$",
"max",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"rule_min_num",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"min",
")",
")",
"{",
"re... | Is the given number between min and max
@param string $key
@param string $value
@return bool | [
"Is",
"the",
"given",
"number",
"between",
"min",
"and",
"max"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L518-L529 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.rule_min | public function rule_min( $key, $value, $min )
{
return $this->rule_min_num( $key, strlen( $value ), $min );
} | php | public function rule_min( $key, $value, $min )
{
return $this->rule_min_num( $key, strlen( $value ), $min );
} | [
"public",
"function",
"rule_min",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"min",
")",
"{",
"return",
"$",
"this",
"->",
"rule_min_num",
"(",
"$",
"key",
",",
"strlen",
"(",
"$",
"value",
")",
",",
"$",
"min",
")",
";",
"}"
] | Is the given string at least some size
@param string $key
@param string $value
@return bool | [
"Is",
"the",
"given",
"string",
"at",
"least",
"some",
"size"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L538-L541 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.rule_max | public function rule_max( $key, $value, $max )
{
return $this->rule_max_num( $key, strlen( $value ), $max );
} | php | public function rule_max( $key, $value, $max )
{
return $this->rule_max_num( $key, strlen( $value ), $max );
} | [
"public",
"function",
"rule_max",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"max",
")",
"{",
"return",
"$",
"this",
"->",
"rule_max_num",
"(",
"$",
"key",
",",
"strlen",
"(",
"$",
"value",
")",
",",
"$",
"max",
")",
";",
"}"
] | Is the given string max some size
@param string $key
@param string $value
@return bool | [
"Is",
"the",
"given",
"string",
"max",
"some",
"size"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L550-L553 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.rule_between | public function rule_between( $key, $value, $min, $max )
{
return $this->rule_between_num( $key, strlen( $value ), $min, $max );
} | php | public function rule_between( $key, $value, $min, $max )
{
return $this->rule_between_num( $key, strlen( $value ), $min, $max );
} | [
"public",
"function",
"rule_between",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"min",
",",
"$",
"max",
")",
"{",
"return",
"$",
"this",
"->",
"rule_between_num",
"(",
"$",
"key",
",",
"strlen",
"(",
"$",
"value",
")",
",",
"$",
"min",
",",
"... | Is the given string between min and max
@param string $key
@param string $value
@return bool | [
"Is",
"the",
"given",
"string",
"between",
"min",
"and",
"max"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L562-L565 |
ClanCats/Core | src/classes/CCValidator.php | CCValidator.rule_date_format | public function rule_date_format( $key, $value, $format = 'd/m/Y' )
{
return date( $format, strtotime( trim( $value ) ) ) == trim( $value );
} | php | public function rule_date_format( $key, $value, $format = 'd/m/Y' )
{
return date( $format, strtotime( trim( $value ) ) ) == trim( $value );
} | [
"public",
"function",
"rule_date_format",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"format",
"=",
"'d/m/Y'",
")",
"{",
"return",
"date",
"(",
"$",
"format",
",",
"strtotime",
"(",
"trim",
"(",
"$",
"value",
")",
")",
")",
"==",
"trim",
"(",
"$... | Check if valid date format
@param string $key
@param string $value
@param string $format
@param bool | [
"Check",
"if",
"valid",
"date",
"format"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCValidator.php#L711-L714 |
devmobgroup/postcodes | src/Traits/AccessesProperties.php | AccessesProperties.get | protected function get($data, string $key)
{
$dot = $data instanceof Dot ? $data : new Dot($data);
if (isset($dot[$key])) {
return $dot[$key];
}
throw new UnexpectedResponseException(sprintf('Missing key \'%s\' in data'));
} | php | protected function get($data, string $key)
{
$dot = $data instanceof Dot ? $data : new Dot($data);
if (isset($dot[$key])) {
return $dot[$key];
}
throw new UnexpectedResponseException(sprintf('Missing key \'%s\' in data'));
} | [
"protected",
"function",
"get",
"(",
"$",
"data",
",",
"string",
"$",
"key",
")",
"{",
"$",
"dot",
"=",
"$",
"data",
"instanceof",
"Dot",
"?",
"$",
"data",
":",
"new",
"Dot",
"(",
"$",
"data",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"dot",
"[",... | Extract data from an array using dot notation.
Throws an exception when the provided key does not exist.
@param array|\Adbar\Dot $data
@param string $key Supports dot notation {@see https://github.com/adbario/php-dot-notation}
@return mixed
@throws \DevMob\Postcodes\Exceptions\UnexpectedResponseException | [
"Extract",
"data",
"from",
"an",
"array",
"using",
"dot",
"notation",
".",
"Throws",
"an",
"exception",
"when",
"the",
"provided",
"key",
"does",
"not",
"exist",
"."
] | train | https://github.com/devmobgroup/postcodes/blob/1a8438fd960a8f50ec28d61af94560892b529f12/src/Traits/AccessesProperties.php#L19-L28 |
maximebf/events | src/Events/Notifier.php | Notifier.createEvent | public function createEvent($eventName, array $params = array())
{
$class = $this->eventClass;
return new $class($this->sender, $this->prefix . $eventName, $params);
} | php | public function createEvent($eventName, array $params = array())
{
$class = $this->eventClass;
return new $class($this->sender, $this->prefix . $eventName, $params);
} | [
"public",
"function",
"createEvent",
"(",
"$",
"eventName",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"eventClass",
";",
"return",
"new",
"$",
"class",
"(",
"$",
"this",
"->",
"sender",
",",
... | Creates an event object
@param string $eventName
@param array $params
@return Event | [
"Creates",
"an",
"event",
"object"
] | train | https://github.com/maximebf/events/blob/b9861c260ee9eaabb9aa986bab76a2e039eb871f/src/Events/Notifier.php#L125-L129 |
maximebf/events | src/Events/Notifier.php | Notifier.notify | public function notify($eventName, array $params = array())
{
$this->dispatcher->notify($e = $this->createEvent($eventName, $params));
return $e;
} | php | public function notify($eventName, array $params = array())
{
$this->dispatcher->notify($e = $this->createEvent($eventName, $params));
return $e;
} | [
"public",
"function",
"notify",
"(",
"$",
"eventName",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"dispatcher",
"->",
"notify",
"(",
"$",
"e",
"=",
"$",
"this",
"->",
"createEvent",
"(",
"$",
"eventName",
",",
... | Creates and dispatches an event
@see EventDispatcher::notify()
@param string $eventName
@param array $params
@return Event | [
"Creates",
"and",
"dispatches",
"an",
"event"
] | train | https://github.com/maximebf/events/blob/b9861c260ee9eaabb9aa986bab76a2e039eb871f/src/Events/Notifier.php#L139-L143 |
maximebf/events | src/Events/Notifier.php | Notifier.notifyUntil | public function notifyUntil($eventName, array $params = array(), $callback = null)
{
$this->dispatcher->notifyUntil($e = $this->createEvent($eventName, $params), $callback);
return $e;
} | php | public function notifyUntil($eventName, array $params = array(), $callback = null)
{
$this->dispatcher->notifyUntil($e = $this->createEvent($eventName, $params), $callback);
return $e;
} | [
"public",
"function",
"notifyUntil",
"(",
"$",
"eventName",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"dispatcher",
"->",
"notifyUntil",
"(",
"$",
"e",
"=",
"$",
"this",
"->",... | Creates and dispatches an event until it has been processed.
@see EventDispatcher::notifyUntil()
@param string $eventName
@param array $params
@param callback $callback
@return Event | [
"Creates",
"and",
"dispatches",
"an",
"event",
"until",
"it",
"has",
"been",
"processed",
"."
] | train | https://github.com/maximebf/events/blob/b9861c260ee9eaabb9aa986bab76a2e039eb871f/src/Events/Notifier.php#L154-L158 |
nyeholt/silverstripe-external-content | thirdparty/Zend/Validate/Float.php | Zend_Validate_Float.isValid | public function isValid($value)
{
$valueString = (string) $value;
$this->_setValue($valueString);
try {
if (!Zend_Locale_Format::isFloat($value, array('locale' => $this->_locale))) {
$this->_error();
return false;
}
} catch (Z... | php | public function isValid($value)
{
$valueString = (string) $value;
$this->_setValue($valueString);
try {
if (!Zend_Locale_Format::isFloat($value, array('locale' => $this->_locale))) {
$this->_error();
return false;
}
} catch (Z... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"valueString",
"=",
"(",
"string",
")",
"$",
"value",
";",
"$",
"this",
"->",
"_setValue",
"(",
"$",
"valueString",
")",
";",
"try",
"{",
"if",
"(",
"!",
"Zend_Locale_Format",
"::",
"... | Defined by Zend_Validate_Interface
Returns true if and only if $value is a floating-point value
@param string $value
@return boolean | [
"Defined",
"by",
"Zend_Validate_Interface"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Validate/Float.php#L90-L107 |
Sedona-Solutions/sedona-sbo | src/Sedona/SBORuntimeBundle/Form/Type/CollectionSelect2Type.php | CollectionSelect2Type.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['attr']['autocomplete'] = 'off';
if (array_key_exists('searchRouteName', $options)) {
$view->vars['attr']['data-source'] = $this->router->generate($options['searchRouteName']).'?property='.$optio... | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['attr']['autocomplete'] = 'off';
if (array_key_exists('searchRouteName', $options)) {
$view->vars['attr']['data-source'] = $this->router->generate($options['searchRouteName']).'?property='.$optio... | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"$",
"view",
"->",
"vars",
"[",
"'attr'",
"]",
"[",
"'autocomplete'",
"]",
"=",
"'off'",
";",
"if",
"(",
"array_... | {@inheritdoc} | [
"{"
] | train | https://github.com/Sedona-Solutions/sedona-sbo/blob/8548be4170d191cb1a3e263577aaaab49f04d5ce/src/Sedona/SBORuntimeBundle/Form/Type/CollectionSelect2Type.php#L80-L108 |
webforge-labs/psc-cms | lib/Psc/PHPUnit/InvokedAtMethodGroupIndexMatcher.php | InvokedAtMethodGroupIndexMatcher.verify | public function verify()
{
if ($this->groupIndex < $this->sequenceIndex) {
throw new PHPUnit_Framework_ExpectationFailedException(
sprintf(
"The expected invocation at method '%s' group-index %d was never reached.",
$this->method,
$t... | php | public function verify()
{
if ($this->groupIndex < $this->sequenceIndex) {
throw new PHPUnit_Framework_ExpectationFailedException(
sprintf(
"The expected invocation at method '%s' group-index %d was never reached.",
$this->method,
$t... | [
"public",
"function",
"verify",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"groupIndex",
"<",
"$",
"this",
"->",
"sequenceIndex",
")",
"{",
"throw",
"new",
"PHPUnit_Framework_ExpectationFailedException",
"(",
"sprintf",
"(",
"\"The expected invocation at method '%... | Verifies that the current expectation is valid. If everything is OK the
code should just return, if not it must throw an exception.
@throws PHPUnit_Framework_ExpectationFailedException | [
"Verifies",
"that",
"the",
"current",
"expectation",
"is",
"valid",
".",
"If",
"everything",
"is",
"OK",
"the",
"code",
"should",
"just",
"return",
"if",
"not",
"it",
"must",
"throw",
"an",
"exception",
"."
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHPUnit/InvokedAtMethodGroupIndexMatcher.php#L135-L147 |
crypto-markets/common | src/Common/Endpoint.php | Endpoint.make | public static function make(Client $httpClient, array $params = [])
{
$instance = new static($httpClient);
$instance->configure($params);
return $instance;
} | php | public static function make(Client $httpClient, array $params = [])
{
$instance = new static($httpClient);
$instance->configure($params);
return $instance;
} | [
"public",
"static",
"function",
"make",
"(",
"Client",
"$",
"httpClient",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
"(",
"$",
"httpClient",
")",
";",
"$",
"instance",
"->",
"configure",
"(",
"$",
"pa... | Create a new resource instance.
@param \CryptoMarkets\Common\Client $httpClient
@param array $params
@return static | [
"Create",
"a",
"new",
"resource",
"instance",
"."
] | train | https://github.com/crypto-markets/common/blob/206b1d9b88502d3fb73cef1323cd086156d3e633/src/Common/Endpoint.php#L48-L55 |
crypto-markets/common | src/Common/Endpoint.php | Endpoint.send | public function send()
{
$request = $this->createRequest();
$response = $this->httpClient->sendRequest($request);
return $this->mapResponse((array) $this->parseResponse($response));
} | php | public function send()
{
$request = $this->createRequest();
$response = $this->httpClient->sendRequest($request);
return $this->mapResponse((array) $this->parseResponse($response));
} | [
"public",
"function",
"send",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"createRequest",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"httpClient",
"->",
"sendRequest",
"(",
"$",
"request",
")",
";",
"return",
"$",
"this",
"->... | Send a new request.
@return array | [
"Send",
"a",
"new",
"request",
"."
] | train | https://github.com/crypto-markets/common/blob/206b1d9b88502d3fb73cef1323cd086156d3e633/src/Common/Endpoint.php#L75-L82 |
crypto-markets/common | src/Common/Endpoint.php | Endpoint.createRequest | public function createRequest()
{
return $this->httpClient->createRequest(
$this->getMethod(),
$this->getUrl(),
$this->getPreparedHeaders(),
$this->getPreparedData()
);
} | php | public function createRequest()
{
return $this->httpClient->createRequest(
$this->getMethod(),
$this->getUrl(),
$this->getPreparedHeaders(),
$this->getPreparedData()
);
} | [
"public",
"function",
"createRequest",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"httpClient",
"->",
"createRequest",
"(",
"$",
"this",
"->",
"getMethod",
"(",
")",
",",
"$",
"this",
"->",
"getUrl",
"(",
")",
",",
"$",
"this",
"->",
"getPreparedHeaders... | Create a new request object.
@return \GuzzleHttp\Psr7\Request | [
"Create",
"a",
"new",
"request",
"object",
"."
] | train | https://github.com/crypto-markets/common/blob/206b1d9b88502d3fb73cef1323cd086156d3e633/src/Common/Endpoint.php#L89-L97 |
crypto-markets/common | src/Common/Endpoint.php | Endpoint.getPreparedData | public function getPreparedData()
{
$params = $this->getData();
if ($this->authorize) {
$params = array_merge($params, $this->authenticationData($params));
}
return $params;
} | php | public function getPreparedData()
{
$params = $this->getData();
if ($this->authorize) {
$params = array_merge($params, $this->authenticationData($params));
}
return $params;
} | [
"public",
"function",
"getPreparedData",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"authorize",
")",
"{",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"params",
",",
"$",
"this",
"... | Get the request data for authorized or not.
@return string | [
"Get",
"the",
"request",
"data",
"for",
"authorized",
"or",
"not",
"."
] | train | https://github.com/crypto-markets/common/blob/206b1d9b88502d3fb73cef1323cd086156d3e633/src/Common/Endpoint.php#L141-L150 |
webforge-labs/psc-cms | lib/Psc/Environment.php | Environment.addIncludePath | public function addIncludePath($path, $type = 'prepend') {
if (!$this->hasIncludePath($path)) {
if ($type == 'append') {
$ret = set_include_path(rtrim(get_include_path(),PATH_SEPARATOR).PATH_SEPARATOR.$path);
} else {
$ret = set_include_path($path.PATH_SEPARATOR.ltrim(get_include_path(),... | php | public function addIncludePath($path, $type = 'prepend') {
if (!$this->hasIncludePath($path)) {
if ($type == 'append') {
$ret = set_include_path(rtrim(get_include_path(),PATH_SEPARATOR).PATH_SEPARATOR.$path);
} else {
$ret = set_include_path($path.PATH_SEPARATOR.ltrim(get_include_path(),... | [
"public",
"function",
"addIncludePath",
"(",
"$",
"path",
",",
"$",
"type",
"=",
"'prepend'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasIncludePath",
"(",
"$",
"path",
")",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"'append'",
")",
"{",
"$",
... | Fügt dem Include Path einen neuen Pfad hinzu
@param string $path der Pfad zum Verzeichnis als String
@param string $type append|prepend der Default ist prepend
@return Description | [
"Fügt",
"dem",
"Include",
"Path",
"einen",
"neuen",
"Pfad",
"hinzu"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Environment.php#L109-L121 |
webforge-labs/psc-cms | lib/Psc/Environment.php | Environment.getRequestPath | public function getRequestPath() {
$uri = $this->getRequestURI();
if (\Webforge\Common\String::startsWith($uri, '/index.php'))
$uri = mb_substr($uri,mb_strlen('index.php'));
if (empty($uri) || $uri == '/') return array();
$uri = ltrim($uri,'/');
$parts = explode('/',$uri);
r... | php | public function getRequestPath() {
$uri = $this->getRequestURI();
if (\Webforge\Common\String::startsWith($uri, '/index.php'))
$uri = mb_substr($uri,mb_strlen('index.php'));
if (empty($uri) || $uri == '/') return array();
$uri = ltrim($uri,'/');
$parts = explode('/',$uri);
r... | [
"public",
"function",
"getRequestPath",
"(",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getRequestURI",
"(",
")",
";",
"if",
"(",
"\\",
"Webforge",
"\\",
"Common",
"\\",
"String",
"::",
"startsWith",
"(",
"$",
"uri",
",",
"'/index.php'",
")",
")",
... | return array | [
"return",
"array"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Environment.php#L149-L162 |
yuncms/framework | src/base/Module.php | Module.getSettings | public function getSettings($key, $default = null)
{
return Yii::$app->settings->get($key, $this->id, $default);
} | php | public function getSettings($key, $default = null)
{
return Yii::$app->settings->get($key, $this->id, $default);
} | [
"public",
"function",
"getSettings",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"Yii",
"::",
"$",
"app",
"->",
"settings",
"->",
"get",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"id",
",",
"$",
"default",
")",
";",
"}"
... | 获取模块配置
@param string $key
@param mixed $default
@return mixed | [
"获取模块配置"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/base/Module.php#L26-L29 |
yuncms/framework | src/base/Module.php | Module.setSettings | public function setSettings($key, $value, $type = null)
{
return Yii::$app->settings->set($key, $value, $this->id, $type);
} | php | public function setSettings($key, $value, $type = null)
{
return Yii::$app->settings->set($key, $value, $this->id, $type);
} | [
"public",
"function",
"setSettings",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"type",
"=",
"null",
")",
"{",
"return",
"Yii",
"::",
"$",
"app",
"->",
"settings",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"this",
"->",
"id",
... | 设置模块配置
@param string $key
@param mixed $value
@param null $type
@return bool
@throws \yii\base\InvalidConfigException | [
"设置模块配置"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/base/Module.php#L39-L42 |
chubbyphp/chubbyphp-mock | src/Call.php | Call.create | public static function create(string $method): self
{
$self = new self();
$self->method = $method;
return $self;
} | php | public static function create(string $method): self
{
$self = new self();
$self->method = $method;
return $self;
} | [
"public",
"static",
"function",
"create",
"(",
"string",
"$",
"method",
")",
":",
"self",
"{",
"$",
"self",
"=",
"new",
"self",
"(",
")",
";",
"$",
"self",
"->",
"method",
"=",
"$",
"method",
";",
"return",
"$",
"self",
";",
"}"
] | @param string $method
@return self | [
"@param",
"string",
"$method"
] | train | https://github.com/chubbyphp/chubbyphp-mock/blob/4c58095b26eba579a2d707cf15cdab275e679041/src/Call.php#L63-L69 |
chubbyphp/chubbyphp-mock | src/Call.php | Call.with | public function with(...$with): self
{
$this->hasWith = true;
$this->with = $with;
return $this;
} | php | public function with(...$with): self
{
$this->hasWith = true;
$this->with = $with;
return $this;
} | [
"public",
"function",
"with",
"(",
"...",
"$",
"with",
")",
":",
"self",
"{",
"$",
"this",
"->",
"hasWith",
"=",
"true",
";",
"$",
"this",
"->",
"with",
"=",
"$",
"with",
";",
"return",
"$",
"this",
";",
"}"
] | @param mixed ...$with
@return self | [
"@param",
"mixed",
"...",
"$with"
] | train | https://github.com/chubbyphp/chubbyphp-mock/blob/4c58095b26eba579a2d707cf15cdab275e679041/src/Call.php#L76-L82 |
chubbyphp/chubbyphp-mock | src/Call.php | Call.willThrowException | public function willThrowException(\Throwable $exception): self
{
if ($this->hasReturnSelf) {
throw new \InvalidArgumentException(sprintf('%s: There is already a return self', __METHOD__));
}
if ($this->hasReturn) {
throw new \InvalidArgumentException(sprintf('%s: Th... | php | public function willThrowException(\Throwable $exception): self
{
if ($this->hasReturnSelf) {
throw new \InvalidArgumentException(sprintf('%s: There is already a return self', __METHOD__));
}
if ($this->hasReturn) {
throw new \InvalidArgumentException(sprintf('%s: Th... | [
"public",
"function",
"willThrowException",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"hasReturnSelf",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'%s: There is already a ... | @param \Throwable $exception
@return self | [
"@param",
"\\",
"Throwable",
"$exception"
] | train | https://github.com/chubbyphp/chubbyphp-mock/blob/4c58095b26eba579a2d707cf15cdab275e679041/src/Call.php#L89-L106 |
shinjin/freezer | src/LazyProxy.php | LazyProxy.getObject | public function getObject()
{
if ($this->thawedObject === null) {
$this->thawedObject = $this->storage->fetch($this->id);
}
return $this->thawedObject;
} | php | public function getObject()
{
if ($this->thawedObject === null) {
$this->thawedObject = $this->storage->fetch($this->id);
}
return $this->thawedObject;
} | [
"public",
"function",
"getObject",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"thawedObject",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"thawedObject",
"=",
"$",
"this",
"->",
"storage",
"->",
"fetch",
"(",
"$",
"this",
"->",
"id",
")",
";",
"}... | Returns the real object.
@return object | [
"Returns",
"the",
"real",
"object",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/LazyProxy.php#L39-L46 |
shinjin/freezer | src/LazyProxy.php | LazyProxy.__isset | public function __isset($name)
{
if ($this->thawedObject === null) {
if ($name === $this->storage->getFreezer()->getIdProperty()) {
return true;
}
}
return isset($this->replaceProxy(2)->{$name});
} | php | public function __isset($name)
{
if ($this->thawedObject === null) {
if ($name === $this->storage->getFreezer()->getIdProperty()) {
return true;
}
}
return isset($this->replaceProxy(2)->{$name});
} | [
"public",
"function",
"__isset",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"thawedObject",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"$",
"this",
"->",
"storage",
"->",
"getFreezer",
"(",
")",
"->",
"getIdProperty",
"(",... | Delegates the property isset check to the real object and
tries to replace the lazy proxy object with it.
@param string $name
@return mixed | [
"Delegates",
"the",
"property",
"isset",
"check",
"to",
"the",
"real",
"object",
"and",
"tries",
"to",
"replace",
"the",
"lazy",
"proxy",
"object",
"with",
"it",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/LazyProxy.php#L119-L128 |
shinjin/freezer | src/LazyProxy.php | LazyProxy.replaceProxy | protected function replaceProxy($offset)
{
$object = $this->getObject();
/**
* 0: LazyProxy::replaceProxy()
* 1: LazyProxy::__get($name) / LazyProxy::__set($name, $value)
* 2: Frame that accesses $name
* 1: LazyProxy::__call($method, $arguments)
* 2: ... | php | protected function replaceProxy($offset)
{
$object = $this->getObject();
/**
* 0: LazyProxy::replaceProxy()
* 1: LazyProxy::__get($name) / LazyProxy::__set($name, $value)
* 2: Frame that accesses $name
* 1: LazyProxy::__call($method, $arguments)
* 2: ... | [
"protected",
"function",
"replaceProxy",
"(",
"$",
"offset",
")",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"getObject",
"(",
")",
";",
"/**\n * 0: LazyProxy::replaceProxy()\n * 1: LazyProxy::__get($name) / LazyProxy::__set($name, $value)\n * 2: Frame... | Tries to replace the lazy proxy object with the real object.
@param integer $offset
@return object | [
"Tries",
"to",
"replace",
"the",
"lazy",
"proxy",
"object",
"with",
"the",
"real",
"object",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/LazyProxy.php#L136-L164 |
OpenClassrooms/ServiceProxy | src/Proxy/Strategy/ServiceProxyCacheStrategy.php | ServiceProxyCacheStrategy.execute | public function execute(ServiceProxyStrategyRequestInterface $request)
{
return $this->serviceProxyStrategyResponseBuilder
->create()
->withPreSource($this->generatePreSource($request))
->withPostSource($this->generatePostSource($request->getAnnotation()))
->w... | php | public function execute(ServiceProxyStrategyRequestInterface $request)
{
return $this->serviceProxyStrategyResponseBuilder
->create()
->withPreSource($this->generatePreSource($request))
->withPostSource($this->generatePostSource($request->getAnnotation()))
->w... | [
"public",
"function",
"execute",
"(",
"ServiceProxyStrategyRequestInterface",
"$",
"request",
")",
"{",
"return",
"$",
"this",
"->",
"serviceProxyStrategyResponseBuilder",
"->",
"create",
"(",
")",
"->",
"withPreSource",
"(",
"$",
"this",
"->",
"generatePreSource",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/OpenClassrooms/ServiceProxy/blob/31f9f8be8f064b4ca36873df83fc3833f53da438/src/Proxy/Strategy/ServiceProxyCacheStrategy.php#L24-L34 |
dburkart/scurvy | expression.php | Expression.evaluate | public function evaluate(&$registry=null, $recurse=false) {
// Back ourself up; this expression may need to be called more than
// once.
if ( !$recurse ) {
$this->eval = null;
$this->atomListBackup = $this->atomList;
}
// Get the next atom
$next = array_pop($this->atomList);
if (is_null($this-... | php | public function evaluate(&$registry=null, $recurse=false) {
// Back ourself up; this expression may need to be called more than
// once.
if ( !$recurse ) {
$this->eval = null;
$this->atomListBackup = $this->atomList;
}
// Get the next atom
$next = array_pop($this->atomList);
if (is_null($this-... | [
"public",
"function",
"evaluate",
"(",
"&",
"$",
"registry",
"=",
"null",
",",
"$",
"recurse",
"=",
"false",
")",
"{",
"// Back ourself up; this expression may need to be called more than",
"// once.",
"if",
"(",
"!",
"$",
"recurse",
")",
"{",
"$",
"this",
"->",... | Evaluates the decomposed expression contained in $this->atomList.
@param registry an associative array containing relevant variables
@return the result of the evaluation. | [
"Evaluates",
"the",
"decomposed",
"expression",
"contained",
"in",
"$this",
"-",
">",
"atomList",
"."
] | train | https://github.com/dburkart/scurvy/blob/990a7c4f0517298de304438cf9cd95a303a231fb/expression.php#L87-L209 |
dburkart/scurvy | expression.php | Expression.decompose | public function decompose($expr) {
$buffer = '';
$atomList = array();
$stack = array();
$count = strlen($expr);
$i = 0;
while ($i < $count) {
switch ($expr[$i]) {
case '<':
$this->pushVar($buffer, $atomList);
$a = EXPR_LES;
if ($expr[$i+1] == '=') {
$a = EXPR_LEQ;
... | php | public function decompose($expr) {
$buffer = '';
$atomList = array();
$stack = array();
$count = strlen($expr);
$i = 0;
while ($i < $count) {
switch ($expr[$i]) {
case '<':
$this->pushVar($buffer, $atomList);
$a = EXPR_LES;
if ($expr[$i+1] == '=') {
$a = EXPR_LEQ;
... | [
"public",
"function",
"decompose",
"(",
"$",
"expr",
")",
"{",
"$",
"buffer",
"=",
"''",
";",
"$",
"atomList",
"=",
"array",
"(",
")",
";",
"$",
"stack",
"=",
"array",
"(",
")",
";",
"$",
"count",
"=",
"strlen",
"(",
"$",
"expr",
")",
";",
"$",... | decompose() checks for an equal sign, and if found, decomposes each side
using decomposeE(), and then pushes the equality operator onto the stack.
If there is no equal sign, then decomposeE() is called on the entire
expression.
@param expr the expression to decompose | [
"decompose",
"()",
"checks",
"for",
"an",
"equal",
"sign",
"and",
"if",
"found",
"decomposes",
"each",
"side",
"using",
"decomposeE",
"()",
"and",
"then",
"pushes",
"the",
"equality",
"operator",
"onto",
"the",
"stack",
".",
"If",
"there",
"is",
"no",
"equ... | train | https://github.com/dburkart/scurvy/blob/990a7c4f0517298de304438cf9cd95a303a231fb/expression.php#L219-L334 |
dburkart/scurvy | expression.php | Expression.newVar | public function newVar($str) {
$str = trim($str);
// Try to make it a variable
if (preg_match('/^[a-zA-Z0-9\'_][a-zA-Z0-9\'_-]*$/', $str))
return new Atom(EXPR_VAR, $str);
else {
return false;
}
} | php | public function newVar($str) {
$str = trim($str);
// Try to make it a variable
if (preg_match('/^[a-zA-Z0-9\'_][a-zA-Z0-9\'_-]*$/', $str))
return new Atom(EXPR_VAR, $str);
else {
return false;
}
} | [
"public",
"function",
"newVar",
"(",
"$",
"str",
")",
"{",
"$",
"str",
"=",
"trim",
"(",
"$",
"str",
")",
";",
"// Try to make it a variable",
"if",
"(",
"preg_match",
"(",
"'/^[a-zA-Z0-9\\'_][a-zA-Z0-9\\'_-]*$/'",
",",
"$",
"str",
")",
")",
"return",
"new",... | Creates a new variable atom, subsequent to validating that the string
is correct for a variable
@param str the name of the variable
@return the newly created atom | [
"Creates",
"a",
"new",
"variable",
"atom",
"subsequent",
"to",
"validating",
"that",
"the",
"string",
"is",
"correct",
"for",
"a",
"variable"
] | train | https://github.com/dburkart/scurvy/blob/990a7c4f0517298de304438cf9cd95a303a231fb/expression.php#L343-L352 |
fubhy/graphql-php | src/Executor/Executor.php | Executor.execute | public static function execute(Schema $schema, $root, Document $ast, $operation = NULL, array $args = NULL)
{
if (!self::$UNDEFINED) {
self::$UNDEFINED = new \stdClass();
}
try {
$errors = new \ArrayObject();
$context = self::buildExecutionContext($schema... | php | public static function execute(Schema $schema, $root, Document $ast, $operation = NULL, array $args = NULL)
{
if (!self::$UNDEFINED) {
self::$UNDEFINED = new \stdClass();
}
try {
$errors = new \ArrayObject();
$context = self::buildExecutionContext($schema... | [
"public",
"static",
"function",
"execute",
"(",
"Schema",
"$",
"schema",
",",
"$",
"root",
",",
"Document",
"$",
"ast",
",",
"$",
"operation",
"=",
"NULL",
",",
"array",
"$",
"args",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"UNDEFI... | @param \Fubhy\GraphQL\Schema $schema
@param $root
@param \Fubhy\GraphQL\Language\Node\Document $ast
@param string|null $operation
@param array|null $args
@return array | [
"@param",
"\\",
"Fubhy",
"\\",
"GraphQL",
"\\",
"Schema",
"$schema",
"@param",
"$root",
"@param",
"\\",
"Fubhy",
"\\",
"GraphQL",
"\\",
"Language",
"\\",
"Node",
"\\",
"Document",
"$ast",
"@param",
"string|null",
"$operation",
"@param",
"array|null",
"$args"
] | train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Executor/Executor.php#L57-L77 |
fubhy/graphql-php | src/Executor/Executor.php | Executor.buildExecutionContext | protected static function buildExecutionContext(Schema $schema, $root, Document $ast, $operationName = NULL, array $args = NULL, &$errors)
{
$operations = [];
$fragments = [];
foreach ($ast->get('definitions') as $statement) {
switch ($statement::KIND) {
case Nod... | php | protected static function buildExecutionContext(Schema $schema, $root, Document $ast, $operationName = NULL, array $args = NULL, &$errors)
{
$operations = [];
$fragments = [];
foreach ($ast->get('definitions') as $statement) {
switch ($statement::KIND) {
case Nod... | [
"protected",
"static",
"function",
"buildExecutionContext",
"(",
"Schema",
"$",
"schema",
",",
"$",
"root",
",",
"Document",
"$",
"ast",
",",
"$",
"operationName",
"=",
"NULL",
",",
"array",
"$",
"args",
"=",
"NULL",
",",
"&",
"$",
"errors",
")",
"{",
... | Constructs a ExecutionContext object from the arguments passed to
execute, which we will pass throughout the other execution methods.
@param Schema $schema
@param $root
@param Document $ast
@param string|null $operationName
@param array $args
@param $errors
@return ExecutionContext
@throws \Exception | [
"Constructs",
"a",
"ExecutionContext",
"object",
"from",
"the",
"arguments",
"passed",
"to",
"execute",
"which",
"we",
"will",
"pass",
"throughout",
"the",
"other",
"execution",
"methods",
"."
] | train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Executor/Executor.php#L94-L125 |
fubhy/graphql-php | src/Executor/Executor.php | Executor.executeOperation | protected static function executeOperation(ExecutionContext $context, $root, OperationDefinition $operation)
{
$type = self::getOperationRootType($context->schema, $operation);
$fields = self::collectFields($context, $type, $operation->get('selectionSet'), new \ArrayObject(), new \ArrayObject());
... | php | protected static function executeOperation(ExecutionContext $context, $root, OperationDefinition $operation)
{
$type = self::getOperationRootType($context->schema, $operation);
$fields = self::collectFields($context, $type, $operation->get('selectionSet'), new \ArrayObject(), new \ArrayObject());
... | [
"protected",
"static",
"function",
"executeOperation",
"(",
"ExecutionContext",
"$",
"context",
",",
"$",
"root",
",",
"OperationDefinition",
"$",
"operation",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"getOperationRootType",
"(",
"$",
"context",
"->",
"schema",... | Implements the "Evaluating operations" section of the spec. | [
"Implements",
"the",
"Evaluating",
"operations",
"section",
"of",
"the",
"spec",
"."
] | train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Executor/Executor.php#L130-L139 |
fubhy/graphql-php | src/Executor/Executor.php | Executor.getOperationRootType | protected static function getOperationRootType(Schema $schema, OperationDefinition $operation)
{
switch ($operation->get('operation')) {
case 'query':
return $schema->getQueryType();
case 'mutation':
$mutationType = $schema->getMutationType();
... | php | protected static function getOperationRootType(Schema $schema, OperationDefinition $operation)
{
switch ($operation->get('operation')) {
case 'query':
return $schema->getQueryType();
case 'mutation':
$mutationType = $schema->getMutationType();
... | [
"protected",
"static",
"function",
"getOperationRootType",
"(",
"Schema",
"$",
"schema",
",",
"OperationDefinition",
"$",
"operation",
")",
"{",
"switch",
"(",
"$",
"operation",
"->",
"get",
"(",
"'operation'",
")",
")",
"{",
"case",
"'query'",
":",
"return",
... | Extracts the root type of the operation from the schema.
@param Schema $schema
@param OperationDefinition $operation
@return ObjectType
@throws \Exception | [
"Extracts",
"the",
"root",
"type",
"of",
"the",
"operation",
"from",
"the",
"schema",
"."
] | train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Executor/Executor.php#L152-L167 |
fubhy/graphql-php | src/Executor/Executor.php | Executor.executeFieldsSerially | protected static function executeFieldsSerially(ExecutionContext $context, ObjectType $parent, $source, $fields)
{
$results = [];
foreach ($fields as $response => $asts) {
$result = self::resolveField($context, $parent, $source, $asts);
if ($result !== self::$UNDEFINED) {
... | php | protected static function executeFieldsSerially(ExecutionContext $context, ObjectType $parent, $source, $fields)
{
$results = [];
foreach ($fields as $response => $asts) {
$result = self::resolveField($context, $parent, $source, $asts);
if ($result !== self::$UNDEFINED) {
... | [
"protected",
"static",
"function",
"executeFieldsSerially",
"(",
"ExecutionContext",
"$",
"context",
",",
"ObjectType",
"$",
"parent",
",",
"$",
"source",
",",
"$",
"fields",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fields",
"as"... | Implements the "Evaluating selection sets" section of the spec for "write" mode. | [
"Implements",
"the",
"Evaluating",
"selection",
"sets",
"section",
"of",
"the",
"spec",
"for",
"write",
"mode",
"."
] | train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Executor/Executor.php#L172-L185 |
fubhy/graphql-php | src/Executor/Executor.php | Executor.executeFields | protected static function executeFields(ExecutionContext $context, ObjectType $parent, $source, $fields)
{
return self::executeFieldsSerially($context, $parent, $source, $fields);
} | php | protected static function executeFields(ExecutionContext $context, ObjectType $parent, $source, $fields)
{
return self::executeFieldsSerially($context, $parent, $source, $fields);
} | [
"protected",
"static",
"function",
"executeFields",
"(",
"ExecutionContext",
"$",
"context",
",",
"ObjectType",
"$",
"parent",
",",
"$",
"source",
",",
"$",
"fields",
")",
"{",
"return",
"self",
"::",
"executeFieldsSerially",
"(",
"$",
"context",
",",
"$",
"... | Implements the "Evaluating selection sets" section of the spec for "read" mode.
@param ExecutionContext $context
@param ObjectType $parent
@param $source
@param $fields
@return array | [
"Implements",
"the",
"Evaluating",
"selection",
"sets",
"section",
"of",
"the",
"spec",
"for",
"read",
"mode",
"."
] | train | https://github.com/fubhy/graphql-php/blob/c1de2233c731ca29e5c5db4c43f3b9db36478c83/src/Executor/Executor.php#L197-L200 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.