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 |
|---|---|---|---|---|---|---|---|---|---|---|
yosmanyga/resource | src/Yosmanyga/Resource/Reader/Iterator/InMemoryReader.php | InMemoryReader.current | public function current()
{
if (!isset($this->data)) {
throw new \RuntimeException('The resource needs to be open.');
}
$key = key($this->data);
if (null === $key) {
return false;
}
return ['key' => $key, 'value' => current($this->data)];
... | php | public function current()
{
if (!isset($this->data)) {
throw new \RuntimeException('The resource needs to be open.');
}
$key = key($this->data);
if (null === $key) {
return false;
}
return ['key' => $key, 'value' => current($this->data)];
... | [
"public",
"function",
"current",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'The resource needs to be open.'",
")",
";",
"}",
"$",
"key",
"=",
"key",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Reader/Iterator/InMemoryReader.php#L50-L63 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Console/Cerberus.php | Cerberus.createDir | public static function createDir($strPath, $rights = 0777)
{
$folderPath = array($strPath);
$oldumask = umask(0);
while (!@is_dir(dirname(end($folderPath)))
&& dirname(end($folderPath)) != "/"
&& dirname(end($folderPath)) != "."
&& dirname(end($folderPath... | php | public static function createDir($strPath, $rights = 0777)
{
$folderPath = array($strPath);
$oldumask = umask(0);
while (!@is_dir(dirname(end($folderPath)))
&& dirname(end($folderPath)) != "/"
&& dirname(end($folderPath)) != "."
&& dirname(end($folderPath... | [
"public",
"static",
"function",
"createDir",
"(",
"$",
"strPath",
",",
"$",
"rights",
"=",
"0777",
")",
"{",
"$",
"folderPath",
"=",
"array",
"(",
"$",
"strPath",
")",
";",
"$",
"oldumask",
"=",
"umask",
"(",
"0",
")",
";",
"while",
"(",
"!",
"@",
... | Creates a directory recursively
@param string $strPath path
@param integer $rights right for new directory
@throws \RuntimeException | [
"Creates",
"a",
"directory",
"recursively"
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Console/Cerberus.php#L96-L118 |
pageon/SlackWebhookMonolog | src/Slack/StringFormat.php | StringFormat.arrayToNumberedList | public function arrayToNumberedList(array $listItems)
{
$formattedList = '';
$number = 1;
foreach ($listItems as $listItem) {
$formattedList .= sprintf("%d. %s\n", $number++, (string) $listItem);
}
return $formattedList;
} | php | public function arrayToNumberedList(array $listItems)
{
$formattedList = '';
$number = 1;
foreach ($listItems as $listItem) {
$formattedList .= sprintf("%d. %s\n", $number++, (string) $listItem);
}
return $formattedList;
} | [
"public",
"function",
"arrayToNumberedList",
"(",
"array",
"$",
"listItems",
")",
"{",
"$",
"formattedList",
"=",
"''",
";",
"$",
"number",
"=",
"1",
";",
"foreach",
"(",
"$",
"listItems",
"as",
"$",
"listItem",
")",
"{",
"$",
"formattedList",
".=",
"spr... | This will generate a numbered list from an array.
@param array $listItems
@return string | [
"This",
"will",
"generate",
"a",
"numbered",
"list",
"from",
"an",
"array",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/StringFormat.php#L107-L117 |
pageon/SlackWebhookMonolog | src/Slack/StringFormat.php | StringFormat.arrayToKeyValueList | public function arrayToKeyValueList(array $listItems)
{
$formattedList = '';
foreach ($listItems as $key => $value) {
$formattedList .= sprintf("%s: %s\n", $this->emphasis($key), (string) $value);
}
return $formattedList;
} | php | public function arrayToKeyValueList(array $listItems)
{
$formattedList = '';
foreach ($listItems as $key => $value) {
$formattedList .= sprintf("%s: %s\n", $this->emphasis($key), (string) $value);
}
return $formattedList;
} | [
"public",
"function",
"arrayToKeyValueList",
"(",
"array",
"$",
"listItems",
")",
"{",
"$",
"formattedList",
"=",
"''",
";",
"foreach",
"(",
"$",
"listItems",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"formattedList",
".=",
"sprintf",
"(",
"\"... | This will generate a numbered list from an array.
@param array $listItems
@return string | [
"This",
"will",
"generate",
"a",
"numbered",
"list",
"from",
"an",
"array",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/StringFormat.php#L126-L135 |
pageon/SlackWebhookMonolog | src/Slack/StringFormat.php | StringFormat.arrayToBulletList | public function arrayToBulletList(array $listItems, $bulletCharacter = '•')
{
$formattedList = '';
foreach ($listItems as $listItem) {
$formattedList .= sprintf("%s %s\n", $bulletCharacter, (string) $listItem);
}
return $formattedList;
} | php | public function arrayToBulletList(array $listItems, $bulletCharacter = '•')
{
$formattedList = '';
foreach ($listItems as $listItem) {
$formattedList .= sprintf("%s %s\n", $bulletCharacter, (string) $listItem);
}
return $formattedList;
} | [
"public",
"function",
"arrayToBulletList",
"(",
"array",
"$",
"listItems",
",",
"$",
"bulletCharacter",
"=",
"'•')",
"",
"{",
"$",
"formattedList",
"=",
"''",
";",
"foreach",
"(",
"$",
"listItems",
"as",
"$",
"listItem",
")",
"{",
"$",
"formattedList",
".=... | This will generate a bullet list from an array.
@param array $listItems
@param string $bulletCharacter The character used as bullet
@return string | [
"This",
"will",
"generate",
"a",
"bullet",
"list",
"from",
"an",
"array",
"."
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/StringFormat.php#L145-L154 |
phramework/validate | src/DatetimeValidator.php | DatetimeValidator.validate | public function validate($value)
{
//Use string's validator
$return = parent::validate($value);
//Apply additional rules
if ($return->status === true && (preg_match(
'/^(\d{4})-(\d{2})-(\d{2}) ([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/',
$value,
... | php | public function validate($value)
{
//Use string's validator
$return = parent::validate($value);
//Apply additional rules
if ($return->status === true && (preg_match(
'/^(\d{4})-(\d{2})-(\d{2}) ([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/',
$value,
... | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"//Use string's validator",
"$",
"return",
"=",
"parent",
"::",
"validate",
"(",
"$",
"value",
")",
";",
"//Apply additional rules",
"if",
"(",
"$",
"return",
"->",
"status",
"===",
"true",
"&&",... | Validate value, validates as SQL date or SQL datetime
@see \Phramework\Validate\ValidateResult for ValidateResult object
@see https://dev.mysql.com/doc/refman/5.1/en/datetime.html
@param mixed $value Value to validate
@return ValidateResult
@todo set errorObject | [
"Validate",
"value",
"validates",
"as",
"SQL",
"date",
"or",
"SQL",
"datetime"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/DatetimeValidator.php#L71-L120 |
remialvado/RiakBundle | DependencyInjection/RiakExtension.php | RiakExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$configuration = new Configuration();
$config = $this->processConfiguration($configura... | php | public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$configuration = new Configuration();
$config = $this->processConfiguration($configura... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"loader",
"=",
"new",
"Loader",
"\\",
"YamlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/../Resourc... | {@inheritDoc} | [
"{"
] | train | https://github.com/remialvado/RiakBundle/blob/089ae818738e512a90b2fa93de6c4991242f5b7b/DependencyInjection/RiakExtension.php#L22-L51 |
ejsmont-artur/phpProxyBuilder | src/PhpProxyBuilder/Aop/Advice/LoggingAdvice.php | LoggingAdvice.interceptMethodCall | public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {
$methodName = $jointPoint->getMethodName();
// binary & operator
if (self::LOG_ARGUMENTS & $this->flags) {
$attachment = $jointPoint->getArguments();
} else {
$attachment = null;
... | php | public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) {
$methodName = $jointPoint->getMethodName();
// binary & operator
if (self::LOG_ARGUMENTS & $this->flags) {
$attachment = $jointPoint->getArguments();
} else {
$attachment = null;
... | [
"public",
"function",
"interceptMethodCall",
"(",
"ProceedingJoinPointInterface",
"$",
"jointPoint",
")",
"{",
"$",
"methodName",
"=",
"$",
"jointPoint",
"->",
"getMethodName",
"(",
")",
";",
"// binary & operator",
"if",
"(",
"self",
"::",
"LOG_ARGUMENTS",
"&",
"... | In this implementation we log each method call with execution time and optional param/result
@param ProceedingJoinPointInterface $jointPoint
@return mixed | [
"In",
"this",
"implementation",
"we",
"log",
"each",
"method",
"call",
"with",
"execution",
"time",
"and",
"optional",
"param",
"/",
"result"
] | train | https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Aop/Advice/LoggingAdvice.php#L84-L110 |
activecollab/databasestructure | src/Structure.php | Structure.getType | public function getType($type_name)
{
if (isset($this->types[$type_name])) {
return $this->types[$type_name];
} else {
throw new InvalidArgumentException("Type '$type_name' not found");
}
} | php | public function getType($type_name)
{
if (isset($this->types[$type_name])) {
return $this->types[$type_name];
} else {
throw new InvalidArgumentException("Type '$type_name' not found");
}
} | [
"public",
"function",
"getType",
"(",
"$",
"type_name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"type_name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"types",
"[",
"$",
"type_name",
"]",
";",
"}",
"else",
... | Return type by type name.
@param string $type_name
@return Type | [
"Return",
"type",
"by",
"type",
"name",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Structure.php#L70-L77 |
activecollab/databasestructure | src/Structure.php | Structure.build | public function build($build_path = null, ConnectionInterface $connection = null, array $event_handlers = [])
{
$builders = $this->getBuilders($build_path, $connection, $event_handlers);
foreach ($builders as $builder) {
$builder->preBuild();
}
foreach ($this->types as ... | php | public function build($build_path = null, ConnectionInterface $connection = null, array $event_handlers = [])
{
$builders = $this->getBuilders($build_path, $connection, $event_handlers);
foreach ($builders as $builder) {
$builder->preBuild();
}
foreach ($this->types as ... | [
"public",
"function",
"build",
"(",
"$",
"build_path",
"=",
"null",
",",
"ConnectionInterface",
"$",
"connection",
"=",
"null",
",",
"array",
"$",
"event_handlers",
"=",
"[",
"]",
")",
"{",
"$",
"builders",
"=",
"$",
"this",
"->",
"getBuilders",
"(",
"$"... | Build model at the given path.
If $build_path is null, classes will be generated, evaled and loaded into the memory
@param string|null $build_path
@param ConnectionInterface $connection
@param array|null $event_handlers | [
"Build",
"model",
"at",
"the",
"given",
"path",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Structure.php#L187-L204 |
activecollab/databasestructure | src/Structure.php | Structure.getBuilders | private function getBuilders($build_path, ConnectionInterface $connection = null, array $event_handlers)
{
if (empty($this->builders)) {
$this->builders[] = new BaseDirBuilder($this);
$this->builders[] = new TypesBuilder($this);
$this->builders[] = new BaseTypeClassBuild... | php | private function getBuilders($build_path, ConnectionInterface $connection = null, array $event_handlers)
{
if (empty($this->builders)) {
$this->builders[] = new BaseDirBuilder($this);
$this->builders[] = new TypesBuilder($this);
$this->builders[] = new BaseTypeClassBuild... | [
"private",
"function",
"getBuilders",
"(",
"$",
"build_path",
",",
"ConnectionInterface",
"$",
"connection",
"=",
"null",
",",
"array",
"$",
"event_handlers",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"builders",
")",
")",
"{",
"$",
"this",
"... | Return a list of prepared builder instances.
@param string|null $build_path
@param ConnectionInterface $connection
@param array $event_handlers
@return BuilderInterface[] | [
"Return",
"a",
"list",
"of",
"prepared",
"builder",
"instances",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Structure.php#L219-L266 |
WebDevTmas/date-repetition | src/DateRepetition/WeeklyDateRepetition.php | WeeklyDateRepetition.setDay | public function setDay($day)
{
if(! in_array($day, $this->weekDays)) {
throw new InvalidArgumentException('Argument is not a day of the week');
}
$this->day = $day;
return $this;
} | php | public function setDay($day)
{
if(! in_array($day, $this->weekDays)) {
throw new InvalidArgumentException('Argument is not a day of the week');
}
$this->day = $day;
return $this;
} | [
"public",
"function",
"setDay",
"(",
"$",
"day",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"day",
",",
"$",
"this",
"->",
"weekDays",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Argument is not a day of the week'",
")",
";",
"}"... | Sets weekday of the weekly date repetition
@param string day of the week (monday, tuesday, wednesday, thursday, friday, saturday, sunday)
@return this | [
"Sets",
"weekday",
"of",
"the",
"weekly",
"date",
"repetition"
] | train | https://github.com/WebDevTmas/date-repetition/blob/3ebd59f4ab3aab4b7497ebd767a57fad08277c6d/src/DateRepetition/WeeklyDateRepetition.php#L66-L73 |
larakit/lk-staticfiles | src/StaticFiles/CommandDeploy.php | CommandDeploy.handle | public function handle() {
$this->info(str_repeat('#',80));
$this->info('# larakit:sf:deploy');
$this->info(str_repeat('#',80));
Manager::deploy($this->getOutput());
$this->info('Статика успешно выложена!');
//обновим хэш
$file_config = config_path('larakit... | php | public function handle() {
$this->info(str_repeat('#',80));
$this->info('# larakit:sf:deploy');
$this->info(str_repeat('#',80));
Manager::deploy($this->getOutput());
$this->info('Статика успешно выложена!');
//обновим хэш
$file_config = config_path('larakit... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"this",
"->",
"info",
"(",
"str_repeat",
"(",
"'#'",
",",
"80",
")",
")",
";",
"$",
"this",
"->",
"info",
"(",
"'# larakit:sf:deploy'",
")",
";",
"$",
"this",
"->",
"info",
"(",
"str_repeat",
"(",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/CommandDeploy.php#L34-L48 |
vincentchalamon/VinceCmsSonataAdminBundle | Controller/PublishableController.php | PublishableController.deleteAction | public function deleteAction($id)
{
$id = $this->get('request')->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);
if (!$object) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
}
if (is_call... | php | public function deleteAction($id)
{
$id = $this->get('request')->get($this->admin->getIdParameter());
$object = $this->admin->getObject($id);
if (!$object) {
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
}
if (is_call... | [
"public",
"function",
"deleteAction",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"get",
"(",
"'request'",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"admin",
"->",
"getIdParameter",
"(",
")",
")",
";",
"$",
"object",
"=",
"$",
"t... | {@inheritdoc} | [
"{"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Controller/PublishableController.php#L28-L47 |
vincentchalamon/VinceCmsSonataAdminBundle | Controller/PublishableController.php | PublishableController.batchActionPublish | public function batchActionPublish(ProxyQueryInterface $query)
{
try {
$objects = $query->select('DISTINCT '.$query->getRootAlias())->getQuery()->iterate();
$i = 0;
$em = $this->get('doctrine')->getManager();
foreach ($objects as $object) {
... | php | public function batchActionPublish(ProxyQueryInterface $query)
{
try {
$objects = $query->select('DISTINCT '.$query->getRootAlias())->getQuery()->iterate();
$i = 0;
$em = $this->get('doctrine')->getManager();
foreach ($objects as $object) {
... | [
"public",
"function",
"batchActionPublish",
"(",
"ProxyQueryInterface",
"$",
"query",
")",
"{",
"try",
"{",
"$",
"objects",
"=",
"$",
"query",
"->",
"select",
"(",
"'DISTINCT '",
".",
"$",
"query",
"->",
"getRootAlias",
"(",
")",
")",
"->",
"getQuery",
"("... | Execute a batch publish
@param ProxyQueryInterface $query
@return RedirectResponse | [
"Execute",
"a",
"batch",
"publish"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Controller/PublishableController.php#L56-L78 |
fuelphp/display | src/Parser/Twig.php | Twig.setupTwig | public function setupTwig()
{
$twigLoader = new TwigLoader($this->viewManager);
$config = [];
if ($this->viewManager->cachePath)
{
$config['cache'] = $this->viewManager->cachePath.'twig/';
}
$this->twig = new Twig_Environment($twigLoader, $config);
} | php | public function setupTwig()
{
$twigLoader = new TwigLoader($this->viewManager);
$config = [];
if ($this->viewManager->cachePath)
{
$config['cache'] = $this->viewManager->cachePath.'twig/';
}
$this->twig = new Twig_Environment($twigLoader, $config);
} | [
"public",
"function",
"setupTwig",
"(",
")",
"{",
"$",
"twigLoader",
"=",
"new",
"TwigLoader",
"(",
"$",
"this",
"->",
"viewManager",
")",
";",
"$",
"config",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"viewManager",
"->",
"cachePath",
")",
"{... | Sets the Twig Environment up | [
"Sets",
"the",
"Twig",
"Environment",
"up"
] | train | https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Parser/Twig.php#L51-L62 |
fuelphp/display | src/Parser/Twig.php | Twig.parse | public function parse($file, array $data = [])
{
$twig = $this->getTwig();
return $twig->render($file, $data);
} | php | public function parse($file, array $data = [])
{
$twig = $this->getTwig();
return $twig->render($file, $data);
} | [
"public",
"function",
"parse",
"(",
"$",
"file",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"twig",
"=",
"$",
"this",
"->",
"getTwig",
"(",
")",
";",
"return",
"$",
"twig",
"->",
"render",
"(",
"$",
"file",
",",
"$",
"data",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Parser/Twig.php#L67-L72 |
Wonail/wocenter | widgets/DateControl.php | DateControl.initConfigByBehavior | protected function initConfigByBehavior()
{
if ($this->hasModel() && $this->model->hasProperty('dateTimeWidget')) {
/** @var ModifyTimestampBehavior $modifyTimestampBehavior */
$modifyTimestampBehavior = $this->model;
$displayData = $modifyTimestampBehavior->getDisplayFor... | php | protected function initConfigByBehavior()
{
if ($this->hasModel() && $this->model->hasProperty('dateTimeWidget')) {
/** @var ModifyTimestampBehavior $modifyTimestampBehavior */
$modifyTimestampBehavior = $this->model;
$displayData = $modifyTimestampBehavior->getDisplayFor... | [
"protected",
"function",
"initConfigByBehavior",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasModel",
"(",
")",
"&&",
"$",
"this",
"->",
"model",
"->",
"hasProperty",
"(",
"'dateTimeWidget'",
")",
")",
"{",
"/** @var ModifyTimestampBehavior $modifyTimestampBeh... | 如果存在模型且模型拥有\wocenter\behaviors\ModifyTimestampBehavior行为,则根据行为配置来初始化一些相关参数 | [
"如果存在模型且模型拥有",
"\\",
"wocenter",
"\\",
"behaviors",
"\\",
"ModifyTimestampBehavior行为,则根据行为配置来初始化一些相关参数"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/widgets/DateControl.php#L26-L39 |
drpdigital/json-api-parser | src/Arr.php | Arr.collapse | public static function collapse($array)
{
$results = [];
foreach ($array as $key => $values) {
if (is_array($values) === false) {
$results[$key] = $values;
continue;
}
$results = array_merge($results, $values);
}
r... | php | public static function collapse($array)
{
$results = [];
foreach ($array as $key => $values) {
if (is_array($values) === false) {
$results[$key] = $values;
continue;
}
$results = array_merge($results, $values);
}
r... | [
"public",
"static",
"function",
"collapse",
"(",
"$",
"array",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"values",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"values",
")",
"===",
"fa... | Collapse an array of arrays into a single array.
@param array $array
@return array | [
"Collapse",
"an",
"array",
"of",
"arrays",
"into",
"a",
"single",
"array",
"."
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/Arr.php#L67-L80 |
FrenchFrogs/framework | src/Table/Column/Strainer/DateRange.php | DateRange.call | public function call(\FrenchFrogs\Table\Table\Table $table, ...$params)
{
if ($this->hasCallable()) {
call_user_func_array($this->callable, $params);
} else {
// verify that source is a query
if (!$table->isSourceQueryBuilder()) {
throw new \Excep... | php | public function call(\FrenchFrogs\Table\Table\Table $table, ...$params)
{
if ($this->hasCallable()) {
call_user_func_array($this->callable, $params);
} else {
// verify that source is a query
if (!$table->isSourceQueryBuilder()) {
throw new \Excep... | [
"public",
"function",
"call",
"(",
"\\",
"FrenchFrogs",
"\\",
"Table",
"\\",
"Table",
"\\",
"Table",
"$",
"table",
",",
"...",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCallable",
"(",
")",
")",
"{",
"call_user_func_array",
"(",
"$",
... | Execute strainer
@param \FrenchFrogs\Table\Table\Table $table
@param array ...$params
@return $this
@throws \Exception | [
"Execute",
"strainer"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Column/Strainer/DateRange.php#L25-L55 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Checker/DelegatorChecker.php | DelegatorChecker.supports | public function supports(Resource $resource)
{
try {
if ($this->pickChecker($resource)) {
return true;
}
} catch (\RuntimeException $e) {
}
return false;
} | php | public function supports(Resource $resource)
{
try {
if ($this->pickChecker($resource)) {
return true;
}
} catch (\RuntimeException $e) {
}
return false;
} | [
"public",
"function",
"supports",
"(",
"Resource",
"$",
"resource",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"pickChecker",
"(",
"$",
"resource",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"\\",
"RuntimeException",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Checker/DelegatorChecker.php#L29-L39 |
yosmanyga/resource | src/Yosmanyga/Resource/Cacher/Checker/DelegatorChecker.php | DelegatorChecker.pickChecker | protected function pickChecker($resource)
{
foreach ($this->checkers as $i => $checker) {
if ($checker->supports($resource)) {
if (0 != $i) {
// Move checkers to top to improve next pick
unset($this->checkers[$i]);
array... | php | protected function pickChecker($resource)
{
foreach ($this->checkers as $i => $checker) {
if ($checker->supports($resource)) {
if (0 != $i) {
// Move checkers to top to improve next pick
unset($this->checkers[$i]);
array... | [
"protected",
"function",
"pickChecker",
"(",
"$",
"resource",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"checkers",
"as",
"$",
"i",
"=>",
"$",
"checker",
")",
"{",
"if",
"(",
"$",
"checker",
"->",
"supports",
"(",
"$",
"resource",
")",
")",
"{",
... | @param \Yosmanyga\Resource\Resource $resource
@throws \RuntimeException If no checker is able to support the
resource
@return \Yosmanyga\Resource\Cacher\Checker\CheckerInterface | [
"@param",
"\\",
"Yosmanyga",
"\\",
"Resource",
"\\",
"Resource",
"$resource"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Cacher/Checker/DelegatorChecker.php#L65-L80 |
Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/FieldCollection.php | FieldCollection.addItem | public function addItem(BaseField $objItem)
{
$this->items[] = $objItem;
end($this->items);
$key = key($this->items);
$this->index[$key] = $objItem->get('colName');
} | php | public function addItem(BaseField $objItem)
{
$this->items[] = $objItem;
end($this->items);
$key = key($this->items);
$this->index[$key] = $objItem->get('colName');
} | [
"public",
"function",
"addItem",
"(",
"BaseField",
"$",
"objItem",
")",
"{",
"$",
"this",
"->",
"items",
"[",
"]",
"=",
"$",
"objItem",
";",
"end",
"(",
"$",
"this",
"->",
"items",
")",
";",
"$",
"key",
"=",
"key",
"(",
"$",
"this",
"->",
"items"... | Add an item of type BaseField to the field collection
@param BaseField $objItem | [
"Add",
"an",
"item",
"of",
"type",
"BaseField",
"to",
"the",
"field",
"collection"
] | train | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/FieldCollection.php#L50-L56 |
Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/FieldCollection.php | FieldCollection.findItemByColName | public function findItemByColName($colName)
{
if(in_array($colName, $this->index)){
return $this->items[array_search($colName, $this->index)];
}
return false;
} | php | public function findItemByColName($colName)
{
if(in_array($colName, $this->index)){
return $this->items[array_search($colName, $this->index)];
}
return false;
} | [
"public",
"function",
"findItemByColName",
"(",
"$",
"colName",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"colName",
",",
"$",
"this",
"->",
"index",
")",
")",
"{",
"return",
"$",
"this",
"->",
"items",
"[",
"array_search",
"(",
"$",
"colName",
",",
... | Get an item by its colName
@param string $colName
@return BaseField|bool | [
"Get",
"an",
"item",
"by",
"its",
"colName"
] | train | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/FieldCollection.php#L63-L72 |
hollodotme/TreeMDown | src/TreeMDown.php | TreeMDown.getOutput | public function getOutput( array &$headers = [] )
{
$this->prepareOptions();
$this->prepareSearch();
$this->prepareTree();
switch ( $this->options->get( Opt::OUTPUT_TYPE ) )
{
case Opt::OUTPUT_TYPE_RAW :
$headers['Content-Type'] = 'text/plain; charset=UTF-8';
$currentFile = $this->sea... | php | public function getOutput( array &$headers = [] )
{
$this->prepareOptions();
$this->prepareSearch();
$this->prepareTree();
switch ( $this->options->get( Opt::OUTPUT_TYPE ) )
{
case Opt::OUTPUT_TYPE_RAW :
$headers['Content-Type'] = 'text/plain; charset=UTF-8';
$currentFile = $this->sea... | [
"public",
"function",
"getOutput",
"(",
"array",
"&",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"prepareOptions",
"(",
")",
";",
"$",
"this",
"->",
"prepareSearch",
"(",
")",
";",
"$",
"this",
"->",
"prepareTree",
"(",
")",
";",
"... | @param array $headers Output headers
@return string|\DOMDocument
@throws \RuntimeException | [
"@param",
"array",
"$headers",
"Output",
"headers"
] | train | https://github.com/hollodotme/TreeMDown/blob/462c4118c70b68963e0176d540fc8502730ffe27/src/TreeMDown.php#L156-L192 |
FrenchFrogs/framework | src/Table/Column/Button.php | Button.getBindedLabel | public function getBindedLabel($row = [])
{
$bind = isset($row[$this->getName()]) ? $row[$this->getName()] : false;
return sprintf($this->getLabel(), $bind);
} | php | public function getBindedLabel($row = [])
{
$bind = isset($row[$this->getName()]) ? $row[$this->getName()] : false;
return sprintf($this->getLabel(), $bind);
} | [
"public",
"function",
"getBindedLabel",
"(",
"$",
"row",
"=",
"[",
"]",
")",
"{",
"$",
"bind",
"=",
"isset",
"(",
"$",
"row",
"[",
"$",
"this",
"->",
"getName",
"(",
")",
"]",
")",
"?",
"$",
"row",
"[",
"$",
"this",
"->",
"getName",
"(",
")",
... | Return the binded Label
@param array $row
@return string | [
"Return",
"the",
"binded",
"Label"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Column/Button.php#L31-L35 |
prooph/link-app-core | src/Controller/ProcessingSetUpController.php | ProcessingSetUpController.runAction | public function runAction()
{
try {
$this->commandBus->dispatch(CreateDefaultProcessingConfigFile::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
$sqliteDbFile = SqliteDbFile::initializeFromDist(Definition::getEventStoreSqliteDbFile());
$esConfigLocati... | php | public function runAction()
{
try {
$this->commandBus->dispatch(CreateDefaultProcessingConfigFile::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
$sqliteDbFile = SqliteDbFile::initializeFromDist(Definition::getEventStoreSqliteDbFile());
$esConfigLocati... | [
"public",
"function",
"runAction",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"commandBus",
"->",
"dispatch",
"(",
"CreateDefaultProcessingConfigFile",
"::",
"in",
"(",
"ConfigLocation",
"::",
"fromPath",
"(",
"Definition",
"::",
"getSystemConfigDir",
"(",
")... | Runs the initial set up of the processing system | [
"Runs",
"the",
"initial",
"set",
"up",
"of",
"the",
"processing",
"system"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Controller/ProcessingSetUpController.php#L33-L55 |
bestit/commercetools-order-export-bundle | src/DependencyInjection/BestItCtOrderExportExtension.php | BestItCtOrderExportExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$config = $this->processConfiguration(new Configuration(), $configs);
$container->setAlias... | php | public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$config = $this->processConfiguration(new Configuration(), $configs);
$container->setAlias... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"loader",
"=",
"new",
"YamlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/../Resources/config'",
")",
... | Loads the bundle config.
@param array $configs
@param ContainerBuilder $container
@return void | [
"Loads",
"the",
"bundle",
"config",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/DependencyInjection/BestItCtOrderExportExtension.php#L25-L71 |
gmazzap/Url_To_Query | UrlToQuery.php | UrlToQuery.resolve | function resolve( $url = '', $query_string_vars = [ ] ) {
$url = filter_var( $url, FILTER_SANITIZE_URL );
if ( ! empty( $url ) ) {
$id = md5( $url . serialize( $query_string_vars ) );
if ( ! isset( $this->items[$id] ) || ! $this->items[$id] instanceof UrlToQueryItem ) {
... | php | function resolve( $url = '', $query_string_vars = [ ] ) {
$url = filter_var( $url, FILTER_SANITIZE_URL );
if ( ! empty( $url ) ) {
$id = md5( $url . serialize( $query_string_vars ) );
if ( ! isset( $this->items[$id] ) || ! $this->items[$id] instanceof UrlToQueryItem ) {
... | [
"function",
"resolve",
"(",
"$",
"url",
"=",
"''",
",",
"$",
"query_string_vars",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"filter_var",
"(",
"$",
"url",
",",
"FILTER_SANITIZE_URL",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"url",
")",
")",
"... | Resolve an url to an array of WP_Query arguments for main query
@param string $url Url to resolve
@param type $query_string_vars Query variables to be added to the url
@return array|\WP_Error Resolved query or WP_Error is something goes wrong | [
"Resolve",
"an",
"url",
"to",
"an",
"array",
"of",
"WP_Query",
"arguments",
"for",
"main",
"query"
] | train | https://github.com/gmazzap/Url_To_Query/blob/2537affbbb8b9062d46bb2deec1933acab63d007/UrlToQuery.php#L57-L69 |
stubbles/stubbles-webapp-core | src/main/php/response/mimetypes/Csv.php | Csv.serialize | public function serialize($resource, OutputStream $out): OutputStream
{
if (is_scalar($resource) || $resource instanceof Error) {
$out->writeLine((string) $resource);
} elseif (is_array($resource) || $resource instanceof \Traversable) {
$this->serializeIterable($resource, $ou... | php | public function serialize($resource, OutputStream $out): OutputStream
{
if (is_scalar($resource) || $resource instanceof Error) {
$out->writeLine((string) $resource);
} elseif (is_array($resource) || $resource instanceof \Traversable) {
$this->serializeIterable($resource, $ou... | [
"public",
"function",
"serialize",
"(",
"$",
"resource",
",",
"OutputStream",
"$",
"out",
")",
":",
"OutputStream",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"resource",
")",
"||",
"$",
"resource",
"instanceof",
"Error",
")",
"{",
"$",
"out",
"->",
"writeLi... | serializes resource to output stream
@param mixed $resource
@param \stubbles\streams\OutputStream $out
@return \stubbles\streams\OutputStream | [
"serializes",
"resource",
"to",
"output",
"stream"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/mimetypes/Csv.php#L77-L94 |
stubbles/stubbles-webapp-core | src/main/php/response/mimetypes/Csv.php | Csv.serializeIterable | private function serializeIterable($resource, OutputStream $out)
{
$memory = fopen('php://memory', 'wb');
if (is_array($resource) && is_scalar(current($resource))) {
if (!is_numeric(key($resource))) {
$out->write($this->toCsvLine(array_keys($resource), $memory));
... | php | private function serializeIterable($resource, OutputStream $out)
{
$memory = fopen('php://memory', 'wb');
if (is_array($resource) && is_scalar(current($resource))) {
if (!is_numeric(key($resource))) {
$out->write($this->toCsvLine(array_keys($resource), $memory));
... | [
"private",
"function",
"serializeIterable",
"(",
"$",
"resource",
",",
"OutputStream",
"$",
"out",
")",
"{",
"$",
"memory",
"=",
"fopen",
"(",
"'php://memory'",
",",
"'wb'",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"resource",
")",
"&&",
"is_scalar",
"... | serializes iterable to csv
@param iterable $resource
@param \stubbles\streams\OutputStream $out | [
"serializes",
"iterable",
"to",
"csv"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/mimetypes/Csv.php#L102-L124 |
stubbles/stubbles-webapp-core | src/main/php/response/mimetypes/Csv.php | Csv.toCsvLine | private function toCsvLine(array $elements, $memory): string
{
ftruncate($memory, 0);
rewind($memory);
fputcsv($memory, $elements, $this->delimiter, $this->enclosure);
rewind($memory);
return stream_get_contents($memory);
} | php | private function toCsvLine(array $elements, $memory): string
{
ftruncate($memory, 0);
rewind($memory);
fputcsv($memory, $elements, $this->delimiter, $this->enclosure);
rewind($memory);
return stream_get_contents($memory);
} | [
"private",
"function",
"toCsvLine",
"(",
"array",
"$",
"elements",
",",
"$",
"memory",
")",
":",
"string",
"{",
"ftruncate",
"(",
"$",
"memory",
",",
"0",
")",
";",
"rewind",
"(",
"$",
"memory",
")",
";",
"fputcsv",
"(",
"$",
"memory",
",",
"$",
"e... | turns given list of elements into a line suitable for csv
@param string[] $elements
@param resource $memory
@return string | [
"turns",
"given",
"list",
"of",
"elements",
"into",
"a",
"line",
"suitable",
"for",
"csv"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/response/mimetypes/Csv.php#L133-L140 |
luyadev/luya-module-styleguide | src/controllers/DefaultController.php | DefaultController.actionIndex | public function actionIndex()
{
if (!$this->hasAccess()) {
return $this->redirect(['login']);
}
foreach ($this->module->assetFiles as $class) {
$this->registerAsset($class);
}
return $this->render('index', [
'title' => 'Styleguide... | php | public function actionIndex()
{
if (!$this->hasAccess()) {
return $this->redirect(['login']);
}
foreach ($this->module->assetFiles as $class) {
$this->registerAsset($class);
}
return $this->render('index', [
'title' => 'Styleguide... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAccess",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirect",
"(",
"[",
"'login'",
"]",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"module",
... | Render Styleguide.
@return \yii\web\Response|string | [
"Render",
"Styleguide",
"."
] | train | https://github.com/luyadev/luya-module-styleguide/blob/212ebbd9555ca2e871372b10f3e2399f7ab68e85/src/controllers/DefaultController.php#L24-L39 |
luyadev/luya-module-styleguide | src/controllers/DefaultController.php | DefaultController.actionLogin | public function actionLogin()
{
$password = Yii::$app->request->post('pass', false);
// check password
if ($password === $this->module->password || $this->hasAccess()) {
Yii::$app->session->set(self::STYLEGUIDE_SESSION_PWNAME, $password);
return $this->redirect(['ind... | php | public function actionLogin()
{
$password = Yii::$app->request->post('pass', false);
// check password
if ($password === $this->module->password || $this->hasAccess()) {
Yii::$app->session->set(self::STYLEGUIDE_SESSION_PWNAME, $password);
return $this->redirect(['ind... | [
"public",
"function",
"actionLogin",
"(",
")",
"{",
"$",
"password",
"=",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
"'pass'",
",",
"false",
")",
";",
"// check password",
"if",
"(",
"$",
"password",
"===",
"$",
"this",
"->",
"module"... | Login action if password is required.
@return \yii\web\Response|string | [
"Login",
"action",
"if",
"password",
"is",
"required",
"."
] | train | https://github.com/luyadev/luya-module-styleguide/blob/212ebbd9555ca2e871372b10f3e2399f7ab68e85/src/controllers/DefaultController.php#L46-L59 |
luyadev/luya-module-styleguide | src/controllers/DefaultController.php | DefaultController.extractElementsFromComponent | protected function extractElementsFromComponent()
{
$elements = [];
foreach (Yii::$app->element->getElements() as $name => $closure) {
$reflection = new \ReflectionFunction($closure);
$args = $reflection->getParameters();
$params = [];
$writtenParams =... | php | protected function extractElementsFromComponent()
{
$elements = [];
foreach (Yii::$app->element->getElements() as $name => $closure) {
$reflection = new \ReflectionFunction($closure);
$args = $reflection->getParameters();
$params = [];
$writtenParams =... | [
"protected",
"function",
"extractElementsFromComponent",
"(",
")",
"{",
"$",
"elements",
"=",
"[",
"]",
";",
"foreach",
"(",
"Yii",
"::",
"$",
"app",
"->",
"element",
"->",
"getElements",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"closure",
")",
"{",
"$"... | Extract the data from the element component
@return array | [
"Extract",
"the",
"data",
"from",
"the",
"element",
"component"
] | train | https://github.com/luyadev/luya-module-styleguide/blob/212ebbd9555ca2e871372b10f3e2399f7ab68e85/src/controllers/DefaultController.php#L66-L106 |
luyadev/luya-module-styleguide | src/controllers/DefaultController.php | DefaultController.defineElement | protected function defineElement($element, $name = null, $description = null, array $values = [], array $options = [], array $params = [])
{
return [
'name' => $name ?: $element,
'description' => $description,
'element' => $element,
'values' => $values,
... | php | protected function defineElement($element, $name = null, $description = null, array $values = [], array $options = [], array $params = [])
{
return [
'name' => $name ?: $element,
'description' => $description,
'element' => $element,
'values' => $values,
... | [
"protected",
"function",
"defineElement",
"(",
"$",
"element",
",",
"$",
"name",
"=",
"null",
",",
"$",
"description",
"=",
"null",
",",
"array",
"$",
"values",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"params",
... | Generate the array for a given element.
@return array | [
"Generate",
"the",
"array",
"for",
"a",
"given",
"element",
"."
] | train | https://github.com/luyadev/luya-module-styleguide/blob/212ebbd9555ca2e871372b10f3e2399f7ab68e85/src/controllers/DefaultController.php#L113-L122 |
luyadev/luya-module-styleguide | src/controllers/DefaultController.php | DefaultController.hasAccess | protected function hasAccess()
{
return $this->module->password == Yii::$app->session->get(self::STYLEGUIDE_SESSION_PWNAME, false);
} | php | protected function hasAccess()
{
return $this->module->password == Yii::$app->session->get(self::STYLEGUIDE_SESSION_PWNAME, false);
} | [
"protected",
"function",
"hasAccess",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"module",
"->",
"password",
"==",
"Yii",
"::",
"$",
"app",
"->",
"session",
"->",
"get",
"(",
"self",
"::",
"STYLEGUIDE_SESSION_PWNAME",
",",
"false",
")",
";",
"}"
] | Whether current session contains password or not.
@return boolean | [
"Whether",
"current",
"session",
"contains",
"password",
"or",
"not",
"."
] | train | https://github.com/luyadev/luya-module-styleguide/blob/212ebbd9555ca2e871372b10f3e2399f7ab68e85/src/controllers/DefaultController.php#L129-L132 |
darkwebdesign/doctrine-unit-testing | src/Mocks/ConnectionMock.php | ConnectionMock.fetchColumn | public function fetchColumn($statement, array $params = [], $colnum = 0, array $types = [])
{
if (null !== $this->_fetchOneException) {
throw $this->_fetchOneException;
}
return $this->_fetchOneResult;
} | php | public function fetchColumn($statement, array $params = [], $colnum = 0, array $types = [])
{
if (null !== $this->_fetchOneException) {
throw $this->_fetchOneException;
}
return $this->_fetchOneResult;
} | [
"public",
"function",
"fetchColumn",
"(",
"$",
"statement",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"colnum",
"=",
"0",
",",
"array",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"_fetchOneExcept... | {@inheritdoc} | [
"{"
] | train | https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/ConnectionMock.php#L99-L106 |
esperecyan/dictionary-php | src/validator/NumberValidator.php | NumberValidator.validate | protected function validate(string $input): bool
{
return preg_match($this->realNumber ? self::REAL_NUMBER_REGEXP : self::INTEGER_REGEXP, $input) === 1;
} | php | protected function validate(string $input): bool
{
return preg_match($this->realNumber ? self::REAL_NUMBER_REGEXP : self::INTEGER_REGEXP, $input) === 1;
} | [
"protected",
"function",
"validate",
"(",
"string",
"$",
"input",
")",
":",
"bool",
"{",
"return",
"preg_match",
"(",
"$",
"this",
"->",
"realNumber",
"?",
"self",
"::",
"REAL_NUMBER_REGEXP",
":",
"self",
"::",
"INTEGER_REGEXP",
",",
"$",
"input",
")",
"==... | 入力値が整数、または実数の規則に合致していれば真を返します。
@param string $input
@return bool | [
"入力値が整数、または実数の規則に合致していれば真を返します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/NumberValidator.php#L33-L36 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/ShippingBundle/Controller/ShippingController.php | ShippingController.fieldsAction | public function fieldsAction(Request $request)
{
$locale = $this->getLocale($request);
$context = $request->get('context');
if ($context === 'order') {
$descriptors = array_values($this->getManager()->getFieldDescriptors($locale, $context));
} else {
$descri... | php | public function fieldsAction(Request $request)
{
$locale = $this->getLocale($request);
$context = $request->get('context');
if ($context === 'order') {
$descriptors = array_values($this->getManager()->getFieldDescriptors($locale, $context));
} else {
$descri... | [
"public",
"function",
"fieldsAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
"$",
"request",
")",
";",
"$",
"context",
"=",
"$",
"request",
"->",
"get",
"(",
"'context'",
")",
";",
"if",
"("... | returns all fields that can be used by list
@param Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"returns",
"all",
"fields",
"that",
"can",
"be",
"used",
"by",
"list"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/ShippingBundle/Controller/ShippingController.php#L64-L78 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/ShippingBundle/Controller/ShippingController.php | ShippingController.getAction | public function getAction(Request $request, $id)
{
$locale = $this->getLocale($request);
$view = $this->responseGetById(
$id,
function ($id) use ($locale){
/** @var Shipping $shipping */
$shipping = $this->getManager()->findByIdAndLocale($id, $... | php | public function getAction(Request $request, $id)
{
$locale = $this->getLocale($request);
$view = $this->responseGetById(
$id,
function ($id) use ($locale){
/** @var Shipping $shipping */
$shipping = $this->getManager()->findByIdAndLocale($id, $... | [
"public",
"function",
"getAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
"$",
"request",
")",
";",
"$",
"view",
"=",
"$",
"this",
"->",
"responseGetById",
"(",
"$",
"id",
... | Retrieves and shows a shipping with the given ID
@param \Symfony\Component\HttpFoundation\Request $request
@param integer $id shipping ID
@return \Symfony\Component\HttpFoundation\Response | [
"Retrieves",
"and",
"shows",
"a",
"shipping",
"with",
"the",
"given",
"ID"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/ShippingBundle/Controller/ShippingController.php#L148-L162 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/ShippingBundle/Controller/ShippingController.php | ShippingController.deleteAction | public function deleteAction(Request $request, $id)
{
$locale = $this->getLocale($request);
$delete = function ($id) use ($locale){
$this->getManager()->delete($id, $this->getUser()->getId());
};
$view = $this->responseDelete($id, $delete);
return $this->handleV... | php | public function deleteAction(Request $request, $id)
{
$locale = $this->getLocale($request);
$delete = function ($id) use ($locale){
$this->getManager()->delete($id, $this->getUser()->getId());
};
$view = $this->responseDelete($id, $delete);
return $this->handleV... | [
"public",
"function",
"deleteAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
"$",
"request",
")",
";",
"$",
"delete",
"=",
"function",
"(",
"$",
"id",
")",
"use",
"(",
"$",... | Delete a shipping with the given id.
@param \Symfony\Component\HttpFoundation\Request $request
@param integer $id shipping ID
@return \Symfony\Component\HttpFoundation\Response | [
"Delete",
"a",
"shipping",
"with",
"the",
"given",
"id",
"."
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/ShippingBundle/Controller/ShippingController.php#L285-L295 |
Nayjest/Tree | src/NodeCollection.php | NodeCollection.add | public function add($item, $prepend = false)
{
if (!$item instanceof ChildNodeInterface) {
$details = is_object($item) ? get_class($item) : gettype($item);
throw new InvalidArgumentException(
"NodeCollection accepts only objects implementing ChildNodeInterface, $detai... | php | public function add($item, $prepend = false)
{
if (!$item instanceof ChildNodeInterface) {
$details = is_object($item) ? get_class($item) : gettype($item);
throw new InvalidArgumentException(
"NodeCollection accepts only objects implementing ChildNodeInterface, $detai... | [
"public",
"function",
"add",
"(",
"$",
"item",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"item",
"instanceof",
"ChildNodeInterface",
")",
"{",
"$",
"details",
"=",
"is_object",
"(",
"$",
"item",
")",
"?",
"get_class",
"(",
"$"... | Adds component to collection.
If component is already in collection, it will not be added twice.
@param ChildNodeInterface $item
@param bool $prepend Pass true to add component to the beginning of an array.
@return $this | [
"Adds",
"component",
"to",
"collection",
"."
] | train | https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/NodeCollection.php#L40-L59 |
Nayjest/Tree | src/NodeCollection.php | NodeCollection.remove | public function remove($item)
{
if ($item->parent() === $this->parentNode) {
$this->checkUnlocked($item);
$item->internalUnsetParent();
parent::remove($item);
}
return $this;
} | php | public function remove($item)
{
if ($item->parent() === $this->parentNode) {
$this->checkUnlocked($item);
$item->internalUnsetParent();
parent::remove($item);
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"parent",
"(",
")",
"===",
"$",
"this",
"->",
"parentNode",
")",
"{",
"$",
"this",
"->",
"checkUnlocked",
"(",
"$",
"item",
")",
";",
"$",
"item",
"->",
"in... | @param ChildNodeInterface $item
@return $this | [
"@param",
"ChildNodeInterface",
"$item"
] | train | https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/NodeCollection.php#L66-L75 |
huasituo/hstcms | src/Console/Commands/HookListCommand.php | HookListCommand.handle | public function handle()
{
$t = $this->option('t');
if($t == '1') {
$Hook = HookModel::getAll();
$Hooks = [];
$Hooks = HookModel::getAll(2);
$headers = ['name', 'description'];
$this->table($headers, $Hooks);
} else {
if... | php | public function handle()
{
$t = $this->option('t');
if($t == '1') {
$Hook = HookModel::getAll();
$Hooks = [];
$Hooks = HookModel::getAll(2);
$headers = ['name', 'description'];
$this->table($headers, $Hooks);
} else {
if... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"t",
"=",
"$",
"this",
"->",
"option",
"(",
"'t'",
")",
";",
"if",
"(",
"$",
"t",
"==",
"'1'",
")",
"{",
"$",
"Hook",
"=",
"HookModel",
"::",
"getAll",
"(",
")",
";",
"$",
"Hooks",
"=",
"[",... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HookListCommand.php#L45-L71 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.on | public function on($event, $listener, int $priority = Priority::NORMAL)
{
$this->addListener($event, $listener, $priority);
} | php | public function on($event, $listener, int $priority = Priority::NORMAL)
{
$this->addListener($event, $listener, $priority);
} | [
"public",
"function",
"on",
"(",
"$",
"event",
",",
"$",
"listener",
",",
"int",
"$",
"priority",
"=",
"Priority",
"::",
"NORMAL",
")",
"{",
"$",
"this",
"->",
"addListener",
"(",
"$",
"event",
",",
"$",
"listener",
",",
"$",
"priority",
")",
";",
... | 注册事件监听句柄
@param \One\Event\Event|string $event
@param \Closure|\One\Event\Listener|array|string $listener
@param int $priority
@throws \InvalidArgumentException | [
"注册事件监听句柄"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L60-L63 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.once | public function once($event, $listener, int $priority = Priority::NORMAL)
{
$this->addListener($event, $listener, $priority, true);
} | php | public function once($event, $listener, int $priority = Priority::NORMAL)
{
$this->addListener($event, $listener, $priority, true);
} | [
"public",
"function",
"once",
"(",
"$",
"event",
",",
"$",
"listener",
",",
"int",
"$",
"priority",
"=",
"Priority",
"::",
"NORMAL",
")",
"{",
"$",
"this",
"->",
"addListener",
"(",
"$",
"event",
",",
"$",
"listener",
",",
"$",
"priority",
",",
"true... | 注册一次性事件监听句柄
@param \One\Event\Event|string $event
@param \Closure|\One\Event\Listener|array|string $listener
@param int $priority
@throws \InvalidArgumentException | [
"注册一次性事件监听句柄"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L74-L77 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.off | public function off($event)
{
$event = $this->getEventName($event);
if ($this->hasListener($event)) {
unset($this->sortedListeners[$event], $this->listeners[$event]);
}
unset($event);
} | php | public function off($event)
{
$event = $this->getEventName($event);
if ($this->hasListener($event)) {
unset($this->sortedListeners[$event], $this->listeners[$event]);
}
unset($event);
} | [
"public",
"function",
"off",
"(",
"$",
"event",
")",
"{",
"$",
"event",
"=",
"$",
"this",
"->",
"getEventName",
"(",
"$",
"event",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasListener",
"(",
"$",
"event",
")",
")",
"{",
"unset",
"(",
"$",
"this",... | 注销事件监听
@param \One\Event\Event|string $event
@throws \InvalidArgumentException | [
"注销事件监听"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L86-L95 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.emit | public function emit($event, ...$parameters)
{
$event = $this->ensureEvent($event);
$event->setEmitter($this);
$event->setContexts($parameters);
$listeners = $this->getListeners($event);
foreach ($listeners as $listener) {
$listener->handle($event);
}
... | php | public function emit($event, ...$parameters)
{
$event = $this->ensureEvent($event);
$event->setEmitter($this);
$event->setContexts($parameters);
$listeners = $this->getListeners($event);
foreach ($listeners as $listener) {
$listener->handle($event);
}
... | [
"public",
"function",
"emit",
"(",
"$",
"event",
",",
"...",
"$",
"parameters",
")",
"{",
"$",
"event",
"=",
"$",
"this",
"->",
"ensureEvent",
"(",
"$",
"event",
")",
";",
"$",
"event",
"->",
"setEmitter",
"(",
"$",
"this",
")",
";",
"$",
"event",
... | 触发事件
@param \One\Event\Event|string $event
@param array $parameters
@throws \InvalidArgumentException | [
"触发事件"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L105-L118 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.getListeners | public function getListeners($event): array
{
$event = $this->getEventName($event);
if (! $this->hasListener($event)) {
return [];
}
if (! array_key_exists($event, $this->sortedListeners)) {
$listeners = $this->listeners[$event];
krsort($listene... | php | public function getListeners($event): array
{
$event = $this->getEventName($event);
if (! $this->hasListener($event)) {
return [];
}
if (! array_key_exists($event, $this->sortedListeners)) {
$listeners = $this->listeners[$event];
krsort($listene... | [
"public",
"function",
"getListeners",
"(",
"$",
"event",
")",
":",
"array",
"{",
"$",
"event",
"=",
"$",
"this",
"->",
"getEventName",
"(",
"$",
"event",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasListener",
"(",
"$",
"event",
")",
")",
"{",
... | 获得指定事件的监听器
@param \One\Event\Event|string $event
@return array
@throws \InvalidArgumentException | [
"获得指定事件的监听器"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L128-L151 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.hasListener | public function hasListener($event): bool
{
$name = $this->getEventName($event);
if (isset($this->listeners[$name])) {
foreach ($this->listeners[$name] as $listeners) {
if (count($listeners) > 0) {
return true;
}
}
... | php | public function hasListener($event): bool
{
$name = $this->getEventName($event);
if (isset($this->listeners[$name])) {
foreach ($this->listeners[$name] as $listeners) {
if (count($listeners) > 0) {
return true;
}
}
... | [
"public",
"function",
"hasListener",
"(",
"$",
"event",
")",
":",
"bool",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getEventName",
"(",
"$",
"event",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"name",
"]",
")",
... | 判断指定事件是否存在监听器
@param \One\Event\Event|string $event
@return bool
@throws \InvalidArgumentException | [
"判断指定事件是否存在监听器"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L161-L176 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.addListener | public function addListener($event, $listener, int $priority = Priority::NORMAL, $once = false)
{
$name = $this->getEventName($event);
if (! $this->hasListener($name)) {
$this->listeners[$name] = [];
}
if (! isset($this->listeners[$name][$priority])) {
$this... | php | public function addListener($event, $listener, int $priority = Priority::NORMAL, $once = false)
{
$name = $this->getEventName($event);
if (! $this->hasListener($name)) {
$this->listeners[$name] = [];
}
if (! isset($this->listeners[$name][$priority])) {
$this... | [
"public",
"function",
"addListener",
"(",
"$",
"event",
",",
"$",
"listener",
",",
"int",
"$",
"priority",
"=",
"Priority",
"::",
"NORMAL",
",",
"$",
"once",
"=",
"false",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getEventName",
"(",
"$",
"even... | 添加事件监听
@param \One\Event\Event|string $event
@param \Closure|\One\Event\Listener|array|string $listener
@param int $priority
@param bool $once
@throws \InvalidArgumentException | [
"添加事件监听"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L188-L205 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.removeListener | public function removeListener($event, $listener)
{
if (! $this->hasListener($event)) {
return;
}
$event = $this->getEventName($event);
$listeners = $this->listeners[$event];
foreach ($listeners as $priority => $registed) {
$listeners[$priority] = ar... | php | public function removeListener($event, $listener)
{
if (! $this->hasListener($event)) {
return;
}
$event = $this->getEventName($event);
$listeners = $this->listeners[$event];
foreach ($listeners as $priority => $registed) {
$listeners[$priority] = ar... | [
"public",
"function",
"removeListener",
"(",
"$",
"event",
",",
"$",
"listener",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasListener",
"(",
"$",
"event",
")",
")",
"{",
"return",
";",
"}",
"$",
"event",
"=",
"$",
"this",
"->",
"getEventName",
... | 移除事件监听
@param \One\Event\Event|string $event
@param \Closure|\One\Event\Listener|array|string $listener
@throws \InvalidArgumentException | [
"移除事件监听"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L215-L233 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.getEventName | protected function getEventName($event)
{
if (Assert::instanceOf($event, '\\One\\Event\\Event')) {
return $event->getName();
} elseif (Assert::string($event)) {
return $event;
}
throw new InvalidArgumentException(
'`Event` must be `string` or exte... | php | protected function getEventName($event)
{
if (Assert::instanceOf($event, '\\One\\Event\\Event')) {
return $event->getName();
} elseif (Assert::string($event)) {
return $event;
}
throw new InvalidArgumentException(
'`Event` must be `string` or exte... | [
"protected",
"function",
"getEventName",
"(",
"$",
"event",
")",
"{",
"if",
"(",
"Assert",
"::",
"instanceOf",
"(",
"$",
"event",
",",
"'\\\\One\\\\Event\\\\Event'",
")",
")",
"{",
"return",
"$",
"event",
"->",
"getName",
"(",
")",
";",
"}",
"elseif",
"(... | 获得事件名称
@param \One\Event\Event|string $event
@return string
@throws \InvalidArgumentException | [
"获得事件名称"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L243-L254 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.ensureEvent | protected function ensureEvent($event): Event
{
if (Assert::instanceOf($event, '\\One\\Event\\Event')) {
return $event;
} elseif (Assert::string($event)) {
return new Event($event);
}
throw new InvalidArgumentException(
'`Event` must be `string` o... | php | protected function ensureEvent($event): Event
{
if (Assert::instanceOf($event, '\\One\\Event\\Event')) {
return $event;
} elseif (Assert::string($event)) {
return new Event($event);
}
throw new InvalidArgumentException(
'`Event` must be `string` o... | [
"protected",
"function",
"ensureEvent",
"(",
"$",
"event",
")",
":",
"Event",
"{",
"if",
"(",
"Assert",
"::",
"instanceOf",
"(",
"$",
"event",
",",
"'\\\\One\\\\Event\\\\Event'",
")",
")",
"{",
"return",
"$",
"event",
";",
"}",
"elseif",
"(",
"Assert",
"... | 创建事件实例
@param \One\Event\Event|string $event
@return \One\Event\Event
@throws \InvalidArgumentException | [
"创建事件实例"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L264-L275 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.ensureListener | protected function ensureListener($listener): Listener
{
if (Assert::instanceOf($listener, '\\One\\Event\\Listener')) {
return $listener;
} elseif (Assert::instanceOf($listener, '\\Closure') || Assert::array($listener)) {
return new Listener($listener);
} elseif (Asse... | php | protected function ensureListener($listener): Listener
{
if (Assert::instanceOf($listener, '\\One\\Event\\Listener')) {
return $listener;
} elseif (Assert::instanceOf($listener, '\\Closure') || Assert::array($listener)) {
return new Listener($listener);
} elseif (Asse... | [
"protected",
"function",
"ensureListener",
"(",
"$",
"listener",
")",
":",
"Listener",
"{",
"if",
"(",
"Assert",
"::",
"instanceOf",
"(",
"$",
"listener",
",",
"'\\\\One\\\\Event\\\\Listener'",
")",
")",
"{",
"return",
"$",
"listener",
";",
"}",
"elseif",
"(... | 创建事件监听器实例
@param \Closure|\One\Event\Listener|array|string $listener
@return \One\Event\Listener
@throws \InvalidArgumentException | [
"创建事件监听器实例"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L285-L298 |
movoin/one-swoole | src/Event/Emitter.php | Emitter.ensureOnceListener | protected function ensureOnceListener($listener): OnceListener
{
if (Assert::instanceOf($listener, '\\One\\Event\\OnceListener')) {
return $listener;
} elseif (Assert::instanceOf($listener, '\\Closure') || Assert::array($listener)) {
return new OnceListener($listener);
... | php | protected function ensureOnceListener($listener): OnceListener
{
if (Assert::instanceOf($listener, '\\One\\Event\\OnceListener')) {
return $listener;
} elseif (Assert::instanceOf($listener, '\\Closure') || Assert::array($listener)) {
return new OnceListener($listener);
... | [
"protected",
"function",
"ensureOnceListener",
"(",
"$",
"listener",
")",
":",
"OnceListener",
"{",
"if",
"(",
"Assert",
"::",
"instanceOf",
"(",
"$",
"listener",
",",
"'\\\\One\\\\Event\\\\OnceListener'",
")",
")",
"{",
"return",
"$",
"listener",
";",
"}",
"e... | 创建一次性事件监听器实例
@param \Closure|\One\Event\OnceListener|array|string $listener
@return \One\Event\OnceListener
@throws \InvalidArgumentException | [
"创建一次性事件监听器实例"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Event/Emitter.php#L308-L321 |
esperecyan/dictionary-php | src/validator/AnswerValidator.php | AnswerValidator.validate | protected function validate(string $input): bool
{
return \Normalizer::isNormalized($input, \Normalizer::FORM_KC)
&& ($this->isRegExp($input) ? $this->validateRegexp($input) : $this->validateCharacters($input));
} | php | protected function validate(string $input): bool
{
return \Normalizer::isNormalized($input, \Normalizer::FORM_KC)
&& ($this->isRegExp($input) ? $this->validateRegexp($input) : $this->validateCharacters($input));
} | [
"protected",
"function",
"validate",
"(",
"string",
"$",
"input",
")",
":",
"bool",
"{",
"return",
"\\",
"Normalizer",
"::",
"isNormalized",
"(",
"$",
"input",
",",
"\\",
"Normalizer",
"::",
"FORM_KC",
")",
"&&",
"(",
"$",
"this",
"->",
"isRegExp",
"(",
... | 入力値がanswerフィールドの規則に違反していなければ真を返します。
@param string $input
@return bool | [
"入力値がanswerフィールドの規則に違反していなければ真を返します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/AnswerValidator.php#L24-L28 |
esperecyan/dictionary-php | src/validator/AnswerValidator.php | AnswerValidator.validateRegexp | public function validateRegexp(string $input): bool
{
$output = true;
set_error_handler(function (int $severity, string $message) use (&$output) {
if (strpos($message, 'preg_replace(): ') === 0) {
$output = false;
} else {
return false;
... | php | public function validateRegexp(string $input): bool
{
$output = true;
set_error_handler(function (int $severity, string $message) use (&$output) {
if (strpos($message, 'preg_replace(): ') === 0) {
$output = false;
} else {
return false;
... | [
"public",
"function",
"validateRegexp",
"(",
"string",
"$",
"input",
")",
":",
"bool",
"{",
"$",
"output",
"=",
"true",
";",
"set_error_handler",
"(",
"function",
"(",
"int",
"$",
"severity",
",",
"string",
"$",
"message",
")",
"use",
"(",
"&",
"$",
"o... | 妥当な正規表現文字列の可能性が高い場合は真を返します。
@param string $input NFKC適用済みの文字列。
@return bool | [
"妥当な正規表現文字列の可能性が高い場合は真を返します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/AnswerValidator.php#L45-L60 |
esperecyan/dictionary-php | src/validator/AnswerValidator.php | AnswerValidator.convertToValidCharacters | protected function convertToValidCharacters(string $input): string
{
$converted = preg_replace(
'/[\\p{C}\\p{Z}\\p{M}]+/u',
'',
\Normalizer::normalize(str_replace('~', '〜', $input), \Normalizer::FORM_KC)
);
if ($this->isRegExp($converted)) {
$c... | php | protected function convertToValidCharacters(string $input): string
{
$converted = preg_replace(
'/[\\p{C}\\p{Z}\\p{M}]+/u',
'',
\Normalizer::normalize(str_replace('~', '〜', $input), \Normalizer::FORM_KC)
);
if ($this->isRegExp($converted)) {
$c... | [
"protected",
"function",
"convertToValidCharacters",
"(",
"string",
"$",
"input",
")",
":",
"string",
"{",
"$",
"converted",
"=",
"preg_replace",
"(",
"'/[\\\\p{C}\\\\p{Z}\\\\p{M}]+/u'",
",",
"''",
",",
"\\",
"Normalizer",
"::",
"normalize",
"(",
"str_replace",
"(... | 入力を妥当な値に変換します。
@param string $input
@return string 変換できなかった場合は空文字列を返します。 | [
"入力を妥当な値に変換します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/validator/AnswerValidator.php#L67-L78 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Service/AbstractService.php | AbstractService.getImplementedMethods | public function getImplementedMethods() {
$supported_methods = $this->getConfiguration()->get('supported-http-methods');
if ( is_null($supported_methods) ) $supported_methods = self::$supported_methods;
if ( method_exists($this, 'any') ) {
return $supported_methods;
}
... | php | public function getImplementedMethods() {
$supported_methods = $this->getConfiguration()->get('supported-http-methods');
if ( is_null($supported_methods) ) $supported_methods = self::$supported_methods;
if ( method_exists($this, 'any') ) {
return $supported_methods;
}
... | [
"public",
"function",
"getImplementedMethods",
"(",
")",
"{",
"$",
"supported_methods",
"=",
"$",
"this",
"->",
"getConfiguration",
"(",
")",
"->",
"get",
"(",
"'supported-http-methods'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"supported_methods",
")",
")",... | Get service-implemented HTTP methods
@return array Service implemented methods, in uppercase | [
"Get",
"service",
"-",
"implemented",
"HTTP",
"methods"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Service/AbstractService.php#L75-L97 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Service/AbstractService.php | AbstractService.getMethod | public function getMethod($method) {
$method = strtolower($method);
if ( method_exists($this, $method) ) {
return $method;
} else if ( method_exists($this, 'any') ) {
return 'any';
} else {
return null;
}
} | php | public function getMethod($method) {
$method = strtolower($method);
if ( method_exists($this, $method) ) {
return $method;
} else if ( method_exists($this, 'any') ) {
return 'any';
} else {
return null;
}
} | [
"public",
"function",
"getMethod",
"(",
"$",
"method",
")",
"{",
"$",
"method",
"=",
"strtolower",
"(",
"$",
"method",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"{",
"return",
"$",
"method",
";",
"}",
"el... | Return the callable class method that reflect the requested one | [
"Return",
"the",
"callable",
"class",
"method",
"that",
"reflect",
"the",
"requested",
"one"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Service/AbstractService.php#L103-L121 |
czim/laravel-pxlcms | src/Generator/Writer/AbstractProcessStep.php | AbstractProcessStep.stubReplace | protected function stubReplace($placeholder, $replace, $pregReplace = false)
{
if ($pregReplace) {
$this->data->output['content'] = preg_replace(
$placeholder,
$replace,
$this->data->output['content']
);
} else {
... | php | protected function stubReplace($placeholder, $replace, $pregReplace = false)
{
if ($pregReplace) {
$this->data->output['content'] = preg_replace(
$placeholder,
$replace,
$this->data->output['content']
);
} else {
... | [
"protected",
"function",
"stubReplace",
"(",
"$",
"placeholder",
",",
"$",
"replace",
",",
"$",
"pregReplace",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"pregReplace",
")",
"{",
"$",
"this",
"->",
"data",
"->",
"output",
"[",
"'content'",
"]",
"=",
"preg... | Replaces output stub content placeholders with actual content
@param string $placeholder
@param string $replace
@param bool $pregReplace whether to use preg_replace
@return $this | [
"Replaces",
"output",
"stub",
"content",
"placeholders",
"with",
"actual",
"content"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/AbstractProcessStep.php#L17-L37 |
czim/laravel-pxlcms | src/Generator/Writer/AbstractProcessStep.php | AbstractProcessStep.getLongestKey | protected function getLongestKey(array $array)
{
$longest = 0;
foreach ($array as $key => $value) {
if ($longest > strlen($key)) continue;
$longest = strlen($key);
}
return $longest;
} | php | protected function getLongestKey(array $array)
{
$longest = 0;
foreach ($array as $key => $value) {
if ($longest > strlen($key)) continue;
$longest = strlen($key);
}
return $longest;
} | [
"protected",
"function",
"getLongestKey",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"longest",
"=",
"0",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"longest",
">",
"strlen",
"(",
"$",
"key",
... | Returns length of longest key in key-value pair array
@param array $array
@return int | [
"Returns",
"length",
"of",
"longest",
"key",
"in",
"key",
"-",
"value",
"pair",
"array"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/AbstractProcessStep.php#L69-L80 |
danmichaelo/quitesimplexmlelement | src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php | QuiteSimpleXMLElement.attr | public function attr($attribute)
{
if (strpos($attribute, ':') !== false) {
list($ns, $attribute) = explode(':', $attribute, 2);
return trim((string) $this->el->attributes($ns, true)->{$attribute});
}
return trim((string) $this->el->attributes()->{$attribute});
} | php | public function attr($attribute)
{
if (strpos($attribute, ':') !== false) {
list($ns, $attribute) = explode(':', $attribute, 2);
return trim((string) $this->el->attributes($ns, true)->{$attribute});
}
return trim((string) $this->el->attributes()->{$attribute});
} | [
"public",
"function",
"attr",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"attribute",
",",
"':'",
")",
"!==",
"false",
")",
"{",
"list",
"(",
"$",
"ns",
",",
"$",
"attribute",
")",
"=",
"explode",
"(",
"':'",
",",
"$",
"attri... | Get a node attribute value. Namespace prefixes are supported.
@param string $attribute
@return string | [
"Get",
"a",
"node",
"attribute",
"value",
".",
"Namespace",
"prefixes",
"are",
"supported",
"."
] | train | https://github.com/danmichaelo/quitesimplexmlelement/blob/566261ac5a789d63fda4ffc328501213772c1b27/src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php#L15-L23 |
danmichaelo/quitesimplexmlelement | src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php | QuiteSimpleXMLElement.first | public function first($path)
{
// Convenience method
$x = $this->xpath($path);
return count($x) ? $x[0] : null;
} | php | public function first($path)
{
// Convenience method
$x = $this->xpath($path);
return count($x) ? $x[0] : null;
} | [
"public",
"function",
"first",
"(",
"$",
"path",
")",
"{",
"// Convenience method",
"$",
"x",
"=",
"$",
"this",
"->",
"xpath",
"(",
"$",
"path",
")",
";",
"return",
"count",
"(",
"$",
"x",
")",
"?",
"$",
"x",
"[",
"0",
"]",
":",
"null",
";",
"}... | Get the first node matching an XPath query, or null if no match.
@param string $path
@return QuiteSimpleXMLElement | [
"Get",
"the",
"first",
"node",
"matching",
"an",
"XPath",
"query",
"or",
"null",
"if",
"no",
"match",
"."
] | train | https://github.com/danmichaelo/quitesimplexmlelement/blob/566261ac5a789d63fda4ffc328501213772c1b27/src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php#L31-L37 |
danmichaelo/quitesimplexmlelement | src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php | QuiteSimpleXMLElement.has | public function has($path)
{
$x = $this->xpath($path);
return count($x) ? true : false;
} | php | public function has($path)
{
$x = $this->xpath($path);
return count($x) ? true : false;
} | [
"public",
"function",
"has",
"(",
"$",
"path",
")",
"{",
"$",
"x",
"=",
"$",
"this",
"->",
"xpath",
"(",
"$",
"path",
")",
";",
"return",
"count",
"(",
"$",
"x",
")",
"?",
"true",
":",
"false",
";",
"}"
] | Check if the document has at least one node matching an XPath query.
@param string $path
@return bool | [
"Check",
"if",
"the",
"document",
"has",
"at",
"least",
"one",
"node",
"matching",
"an",
"XPath",
"query",
"."
] | train | https://github.com/danmichaelo/quitesimplexmlelement/blob/566261ac5a789d63fda4ffc328501213772c1b27/src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php#L45-L50 |
danmichaelo/quitesimplexmlelement | src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php | QuiteSimpleXMLElement.xpath | public function xpath($path)
{
return array_map(function ($el) {
return new QuiteSimpleXMLElement($el, $this);
}, $this->el->xpath($path));
} | php | public function xpath($path)
{
return array_map(function ($el) {
return new QuiteSimpleXMLElement($el, $this);
}, $this->el->xpath($path));
} | [
"public",
"function",
"xpath",
"(",
"$",
"path",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"el",
")",
"{",
"return",
"new",
"QuiteSimpleXMLElement",
"(",
"$",
"el",
",",
"$",
"this",
")",
";",
"}",
",",
"$",
"this",
"->",
"el",
"-... | Get all nodes matching an XPath query.
@param string $path
@return QuiteSimpleXMLElement[] | [
"Get",
"all",
"nodes",
"matching",
"an",
"XPath",
"query",
"."
] | train | https://github.com/danmichaelo/quitesimplexmlelement/blob/566261ac5a789d63fda4ffc328501213772c1b27/src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php#L58-L63 |
danmichaelo/quitesimplexmlelement | src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php | QuiteSimpleXMLElement.text | public function text($path = '.', $trim = true)
{
$text = strval($this->first($path));
return $trim ? trim($text) : $text;
} | php | public function text($path = '.', $trim = true)
{
$text = strval($this->first($path));
return $trim ? trim($text) : $text;
} | [
"public",
"function",
"text",
"(",
"$",
"path",
"=",
"'.'",
",",
"$",
"trim",
"=",
"true",
")",
"{",
"$",
"text",
"=",
"strval",
"(",
"$",
"this",
"->",
"first",
"(",
"$",
"path",
")",
")",
";",
"return",
"$",
"trim",
"?",
"trim",
"(",
"$",
"... | Get the text of the first node matching an XPath query. By default,
the text will be trimmed, but if you want the untrimmed text, set
the second parameter to False.
@param string $path
@param bool $trim
@return string | [
"Get",
"the",
"text",
"of",
"the",
"first",
"node",
"matching",
"an",
"XPath",
"query",
".",
"By",
"default",
"the",
"text",
"will",
"be",
"trimmed",
"but",
"if",
"you",
"want",
"the",
"untrimmed",
"text",
"set",
"the",
"second",
"parameter",
"to",
"Fals... | train | https://github.com/danmichaelo/quitesimplexmlelement/blob/566261ac5a789d63fda4ffc328501213772c1b27/src/Danmichaelo/QuiteSimpleXMLElement/QuiteSimpleXMLElement.php#L85-L90 |
ekyna/GlsUniBox | Api/Config.php | Config.getRequestConfig | static public function getRequestConfig($code = Service::BP)
{
Service::isValid($code);
$config = [
static::T540 => ['Date expédition format AAAAMMJJ', true, 8],
static::T530 => ['Poids format xx.xx', true, 5],
static::T860 => ['Raison sociale destinataire', t... | php | static public function getRequestConfig($code = Service::BP)
{
Service::isValid($code);
$config = [
static::T540 => ['Date expédition format AAAAMMJJ', true, 8],
static::T530 => ['Poids format xx.xx', true, 5],
static::T860 => ['Raison sociale destinataire', t... | [
"static",
"public",
"function",
"getRequestConfig",
"(",
"$",
"code",
"=",
"Service",
"::",
"BP",
")",
"{",
"Service",
"::",
"isValid",
"(",
"$",
"code",
")",
";",
"$",
"config",
"=",
"[",
"static",
"::",
"T540",
"=>",
"[",
"'Date expédition format AAAAMMJ... | Returns the request configuration for the given product code.
@param string $code
@return array | [
"Returns",
"the",
"request",
"configuration",
"for",
"the",
"given",
"product",
"code",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Config.php#L280-L352 |
ekyna/GlsUniBox | Api/Config.php | Config.getResponseConfig | static public function getResponseConfig()
{
return [
static::T110 => ['Clé de tri en Expédition/Transit', 3],
static::T310 => ['Clé de tri en réception', 1],
static::T100 => ['Pays Destination', 2],
static::T101 => ['Dépôt GLS de livraison', 4],
... | php | static public function getResponseConfig()
{
return [
static::T110 => ['Clé de tri en Expédition/Transit', 3],
static::T310 => ['Clé de tri en réception', 1],
static::T100 => ['Pays Destination', 2],
static::T101 => ['Dépôt GLS de livraison', 4],
... | [
"static",
"public",
"function",
"getResponseConfig",
"(",
")",
"{",
"return",
"[",
"static",
"::",
"T110",
"=>",
"[",
"'Clé de tri en Expédition/Transit', ",
"3",
",",
"",
"",
"static",
"::",
"T310",
"=>",
"[",
"'Clé de tri en réception', ",
"1",
",",
"",
"",
... | Returns the response configuration.
@return array | [
"Returns",
"the",
"response",
"configuration",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Config.php#L359-L372 |
ekyna/GlsUniBox | Api/Config.php | Config.validateClientConfig | static public function validateClientConfig(array $config)
{
$tags = [static::T8700, static::T8915, static::T8914];
foreach ($tags as $tag) {
if (!array_key_exists($tag, $config) || empty($config[$tag])) {
throw new InvalidArgumentException("Please configure value for ta... | php | static public function validateClientConfig(array $config)
{
$tags = [static::T8700, static::T8915, static::T8914];
foreach ($tags as $tag) {
if (!array_key_exists($tag, $config) || empty($config[$tag])) {
throw new InvalidArgumentException("Please configure value for ta... | [
"static",
"public",
"function",
"validateClientConfig",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"tags",
"=",
"[",
"static",
"::",
"T8700",
",",
"static",
"::",
"T8915",
",",
"static",
"::",
"T8914",
"]",
";",
"foreach",
"(",
"$",
"tags",
"as",
"$",... | Validates the client configuration.
@param array $config | [
"Validates",
"the",
"client",
"configuration",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Config.php#L379-L388 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableMigrateCommand.php | PluggableMigrateCommand.fire | public function fire()
{
if (!$this->confirmToProceed()) {
return;
}
$this->prepareDatabase();
$pluggable = $this->pluggable->getProperties($this->argument('pluggable'));
if (!empty($pluggable)) {
if ($this->pluggable->isEnabled($pluggable['slug'])) {... | php | public function fire()
{
if (!$this->confirmToProceed()) {
return;
}
$this->prepareDatabase();
$pluggable = $this->pluggable->getProperties($this->argument('pluggable'));
if (!empty($pluggable)) {
if ($this->pluggable->isEnabled($pluggable['slug'])) {... | [
"public",
"function",
"fire",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirmToProceed",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"prepareDatabase",
"(",
")",
";",
"$",
"pluggable",
"=",
"$",
"this",
"->",
"pluggable",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableMigrateCommand.php#L45-L69 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableMigrateCommand.php | PluggableMigrateCommand.migrate | protected function migrate($slug)
{
$moduleName = Str::studly($slug);
if ($this->pluggable->exists($moduleName)) {
$pretend = $this->option('pretend');
$path = $this->getMigrationPath($slug);
$this->migrator->run($path, $pretend);
foreach ($this->migr... | php | protected function migrate($slug)
{
$moduleName = Str::studly($slug);
if ($this->pluggable->exists($moduleName)) {
$pretend = $this->option('pretend');
$path = $this->getMigrationPath($slug);
$this->migrator->run($path, $pretend);
foreach ($this->migr... | [
"protected",
"function",
"migrate",
"(",
"$",
"slug",
")",
"{",
"$",
"moduleName",
"=",
"Str",
"::",
"studly",
"(",
"$",
"slug",
")",
";",
"if",
"(",
"$",
"this",
"->",
"pluggable",
"->",
"exists",
"(",
"$",
"moduleName",
")",
")",
"{",
"$",
"prete... | Run migrations for the specified module.
@param string $slug
@return mixed | [
"Run",
"migrations",
"for",
"the",
"specified",
"module",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableMigrateCommand.php#L78-L98 |
seeren/http | src/Stream/ClientResponseStream.php | ClientResponseStream.parseContext | private final function parseContext(RequestInterface $request): array
{
try {
$header = "";
foreach ($request->getHeaders() as $key => $value) {
$header .= $key . ": " . implode("; ", $value) . "\r\n";
}
$request->getBody()->rewind();
}... | php | private final function parseContext(RequestInterface $request): array
{
try {
$header = "";
foreach ($request->getHeaders() as $key => $value) {
$header .= $key . ": " . implode("; ", $value) . "\r\n";
}
$request->getBody()->rewind();
}... | [
"private",
"final",
"function",
"parseContext",
"(",
"RequestInterface",
"$",
"request",
")",
":",
"array",
"{",
"try",
"{",
"$",
"header",
"=",
"\"\"",
";",
"foreach",
"(",
"$",
"request",
"->",
"getHeaders",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"va... | Parse context
@param RequestInterface $request
@return array parsed context | [
"Parse",
"context"
] | train | https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Stream/ClientResponseStream.php#L58-L75 |
crossjoin/Css | src/Crossjoin/Css/Helper/Condition.php | Condition.splitNestedConditions | public static function splitNestedConditions($conditionList, $charset = "UTF-8")
{
// Check arguments
if (!is_string($conditionList)) {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($conditionList). "' for argument 'conditionList' given."
);
... | php | public static function splitNestedConditions($conditionList, $charset = "UTF-8")
{
// Check arguments
if (!is_string($conditionList)) {
throw new \InvalidArgumentException(
"Invalid type '" . gettype($conditionList). "' for argument 'conditionList' given."
);
... | [
"public",
"static",
"function",
"splitNestedConditions",
"(",
"$",
"conditionList",
",",
"$",
"charset",
"=",
"\"UTF-8\"",
")",
"{",
"// Check arguments",
"if",
"(",
"!",
"is_string",
"(",
"$",
"conditionList",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgu... | Splits a condition list with nested conditions (CSS4) into multiple conditions (CSS3 compatible).
@param string $conditionList
@param string $charset
@return array | [
"Splits",
"a",
"condition",
"list",
"with",
"nested",
"conditions",
"(",
"CSS4",
")",
"into",
"multiple",
"conditions",
"(",
"CSS3",
"compatible",
")",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Helper/Condition.php#L13-L138 |
syhol/mrcolor | src/SyHolloway/MrColor/Format/Rgb.php | Rgb.toHex | public function toHex()
{
$hex = array(
dechex($this->values['red']),
dechex($this->values['green']),
dechex($this->values['blue'])
);
//Make sure the hex is 6 digit
foreach ($hex as $key => $value) {
$hex[$key] = strlen($value) === 1 ... | php | public function toHex()
{
$hex = array(
dechex($this->values['red']),
dechex($this->values['green']),
dechex($this->values['blue'])
);
//Make sure the hex is 6 digit
foreach ($hex as $key => $value) {
$hex[$key] = strlen($value) === 1 ... | [
"public",
"function",
"toHex",
"(",
")",
"{",
"$",
"hex",
"=",
"array",
"(",
"dechex",
"(",
"$",
"this",
"->",
"values",
"[",
"'red'",
"]",
")",
",",
"dechex",
"(",
"$",
"this",
"->",
"values",
"[",
"'green'",
"]",
")",
",",
"dechex",
"(",
"$",
... | Return the corresponding hex color value for the value in this format
@return string (6 characters, hex color value, no hash) | [
"Return",
"the",
"corresponding",
"hex",
"color",
"value",
"for",
"the",
"value",
"in",
"this",
"format"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Format/Rgb.php#L31-L45 |
syhol/mrcolor | src/SyHolloway/MrColor/Format/Rgb.php | Rgb.fromHex | public function fromHex($hex)
{
$this->values = array(
'red' => hexdec($hex[0] . $hex[1]),
'green' => hexdec($hex[2] . $hex[3]),
'blue' => hexdec($hex[4] . $hex[5])
);
} | php | public function fromHex($hex)
{
$this->values = array(
'red' => hexdec($hex[0] . $hex[1]),
'green' => hexdec($hex[2] . $hex[3]),
'blue' => hexdec($hex[4] . $hex[5])
);
} | [
"public",
"function",
"fromHex",
"(",
"$",
"hex",
")",
"{",
"$",
"this",
"->",
"values",
"=",
"array",
"(",
"'red'",
"=>",
"hexdec",
"(",
"$",
"hex",
"[",
"0",
"]",
".",
"$",
"hex",
"[",
"1",
"]",
")",
",",
"'green'",
"=>",
"hexdec",
"(",
"$",
... | Load the given hex color value into this format
@param string (6 characters, hex color value, no hash) | [
"Load",
"the",
"given",
"hex",
"color",
"value",
"into",
"this",
"format"
] | train | https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Format/Rgb.php#L52-L59 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.setCreateDate | public function setCreateDate($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->create_date !== null || $dt !== null) {
if ($dt !== $this->create_date) {
$this->create_date = $dt;
$this->modifiedColumns[RoleTableMap::COL_CREATE_DAT... | php | public function setCreateDate($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->create_date !== null || $dt !== null) {
if ($dt !== $this->create_date) {
$this->create_date = $dt;
$this->modifiedColumns[RoleTableMap::COL_CREATE_DAT... | [
"public",
"function",
"setCreateDate",
"(",
"$",
"v",
")",
"{",
"$",
"dt",
"=",
"PropelDateTime",
"::",
"newInstance",
"(",
"$",
"v",
",",
"null",
",",
"'\\DateTime'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"create_date",
"!==",
"null",
"||",
"$",
"... | Sets the value of [create_date] column to a normalized version of the date/time value specified.
@param mixed $v string, integer (timestamp), or \DateTime value.
Empty strings are treated as NULL.
@return $this|\Alchemy\Component\Cerberus\Model\Role The current object (for fluent API support) | [
"Sets",
"the",
"value",
"of",
"[",
"create_date",
"]",
"column",
"to",
"a",
"normalized",
"version",
"of",
"the",
"date",
"/",
"time",
"value",
"specified",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L640-L651 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.setUpdateDate | public function setUpdateDate($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->update_date !== null || $dt !== null) {
if ($dt !== $this->update_date) {
$this->update_date = $dt;
$this->modifiedColumns[RoleTableMap::COL_UPDATE_DAT... | php | public function setUpdateDate($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->update_date !== null || $dt !== null) {
if ($dt !== $this->update_date) {
$this->update_date = $dt;
$this->modifiedColumns[RoleTableMap::COL_UPDATE_DAT... | [
"public",
"function",
"setUpdateDate",
"(",
"$",
"v",
")",
"{",
"$",
"dt",
"=",
"PropelDateTime",
"::",
"newInstance",
"(",
"$",
"v",
",",
"null",
",",
"'\\DateTime'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"update_date",
"!==",
"null",
"||",
"$",
"... | Sets the value of [update_date] column to a normalized version of the date/time value specified.
@param mixed $v string, integer (timestamp), or \DateTime value.
Empty strings are treated as NULL.
@return $this|\Alchemy\Component\Cerberus\Model\Role The current object (for fluent API support) | [
"Sets",
"the",
"value",
"of",
"[",
"update_date",
"]",
"column",
"to",
"a",
"normalized",
"version",
"of",
"the",
"date",
"/",
"time",
"value",
"specified",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L660-L671 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.setStatus | public function setStatus($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->status !== $v) {
$this->status = $v;
$this->modifiedColumns[RoleTableMap::COL_STATUS] = true;
}
return $this;
} | php | public function setStatus($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->status !== $v) {
$this->status = $v;
$this->modifiedColumns[RoleTableMap::COL_STATUS] = true;
}
return $this;
} | [
"public",
"function",
"setStatus",
"(",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"=",
"(",
"string",
")",
"$",
"v",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"status",
"!==",
"$",
"v",
")",
"{",
"$",
"this",... | Set the value of [status] column.
@param string $v new value
@return $this|\Alchemy\Component\Cerberus\Model\Role The current object (for fluent API support) | [
"Set",
"the",
"value",
"of",
"[",
"status",
"]",
"column",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L679-L691 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.reload | public function reload($deep = false, ConnectionInterface $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("Cannot reload a deleted object.");
}
if ($this->isNew()) {
throw new PropelException("Cannot reload an unsaved object.");
}
... | php | public function reload($deep = false, ConnectionInterface $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("Cannot reload a deleted object.");
}
if ($this->isNew()) {
throw new PropelException("Cannot reload an unsaved object.");
}
... | [
"public",
"function",
"reload",
"(",
"$",
"deep",
"=",
"false",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDeleted",
"(",
")",
")",
"{",
"throw",
"new",
"PropelException",
"(",
"\"Cannot reload a deleted... | Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
This will only work if the object has been saved and has a valid primary key set.
@param boolean $deep (optional) Whether to also de-associated any related objects.
@param ConnectionInterface $con (option... | [
"Reloads",
"this",
"object",
"from",
"datastore",
"based",
"on",
"primary",
"key",
"and",
"(",
"optionally",
")",
"resets",
"all",
"associated",
"objects",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L703-L737 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.doSave | protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
... | php | protected function doSave(ConnectionInterface $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
... | [
"protected",
"function",
"doSave",
"(",
"ConnectionInterface",
"$",
"con",
")",
"{",
"$",
"affectedRows",
"=",
"0",
";",
"// initialize var to track total num of affected rows",
"if",
"(",
"!",
"$",
"this",
"->",
"alreadyInSave",
")",
"{",
"$",
"this",
"->",
"al... | Performs the work of inserting or updating the row in the database.
If the object is new, it inserts it; otherwise an update is performed.
All related objects are also updated in this method.
@param ConnectionInterface $con
@return int The number of rows affected by this insert/update and any referri... | [
"Performs",
"the",
"work",
"of",
"inserting",
"or",
"updating",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L829-L943 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.doInsert | protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[RoleTableMap::COL_ID] = true;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . RoleTableMa... | php | protected function doInsert(ConnectionInterface $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[RoleTableMap::COL_ID] = true;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . RoleTableMa... | [
"protected",
"function",
"doInsert",
"(",
"ConnectionInterface",
"$",
"con",
")",
"{",
"$",
"modifiedColumns",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"$",
"this",
"->",
"modifiedColumns",
"[",
"RoleTableMap",
"::",
"COL_ID",
"]",
"=",
... | Insert the row in the database.
@param ConnectionInterface $con
@throws PropelException
@see doSave() | [
"Insert",
"the",
"row",
"in",
"the",
"database",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L953-L1027 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.getByPosition | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getName();
break;
case 2:
return $this->getDescription();
brea... | php | public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getName();
break;
case 2:
return $this->getDescription();
brea... | [
"public",
"function",
"getByPosition",
"(",
"$",
"pos",
")",
"{",
"switch",
"(",
"$",
"pos",
")",
"{",
"case",
"0",
":",
"return",
"$",
"this",
"->",
"getId",
"(",
")",
";",
"break",
";",
"case",
"1",
":",
"return",
"$",
"this",
"->",
"getName",
... | Retrieves a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@return mixed Value of field at $pos | [
"Retrieves",
"a",
"field",
"from",
"the",
"object",
"by",
"Position",
"as",
"specified",
"in",
"the",
"xml",
"schema",
".",
"Zero",
"-",
"based",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L1070-L1095 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.buildCriteria | public function buildCriteria()
{
$criteria = new Criteria(RoleTableMap::DATABASE_NAME);
if ($this->isColumnModified(RoleTableMap::COL_ID)) {
$criteria->add(RoleTableMap::COL_ID, $this->id);
}
if ($this->isColumnModified(RoleTableMap::COL_NAME)) {
$criteria->... | php | public function buildCriteria()
{
$criteria = new Criteria(RoleTableMap::DATABASE_NAME);
if ($this->isColumnModified(RoleTableMap::COL_ID)) {
$criteria->add(RoleTableMap::COL_ID, $this->id);
}
if ($this->isColumnModified(RoleTableMap::COL_NAME)) {
$criteria->... | [
"public",
"function",
"buildCriteria",
"(",
")",
"{",
"$",
"criteria",
"=",
"new",
"Criteria",
"(",
"RoleTableMap",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isColumnModified",
"(",
"RoleTableMap",
"::",
"COL_ID",
")",
")",
"{",
"$",
... | Build a Criteria object containing the values of all modified columns in this object.
@return Criteria The Criteria object containing all modified values. | [
"Build",
"a",
"Criteria",
"object",
"containing",
"the",
"values",
"of",
"all",
"modified",
"columns",
"in",
"this",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L1266-L1290 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.copyInto | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setName($this->getName());
$copyObj->setDescription($this->getDescription());
$copyObj->setCreateDate($this->getCreateDate());
$copyObj->setUpdateDate($this->getUpdateDate());
$copyObj->setStat... | php | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setName($this->getName());
$copyObj->setDescription($this->getDescription());
$copyObj->setCreateDate($this->getCreateDate());
$copyObj->setUpdateDate($this->getUpdateDate());
$copyObj->setStat... | [
"public",
"function",
"copyInto",
"(",
"$",
"copyObj",
",",
"$",
"deepCopy",
"=",
"false",
",",
"$",
"makeNew",
"=",
"true",
")",
"{",
"$",
"copyObj",
"->",
"setName",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
")",
";",
"$",
"copyObj",
"->",
"se... | Sets contents of passed object to values from current object.
If desired, this method can also make copies of all associated (fkey referrers)
objects.
@param object $copyObj An object of \Alchemy\Component\Cerberus\Model\Role (or compatible) type.
@param boolean $deepCopy Whether to also copy all rows that ... | [
"Sets",
"contents",
"of",
"passed",
"object",
"to",
"values",
"from",
"current",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L1372-L1403 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.initRolePermissions | public function initRolePermissions($overrideExisting = true)
{
if (null !== $this->collRolePermissions && !$overrideExisting) {
return;
}
$this->collRolePermissions = new ObjectCollection();
$this->collRolePermissions->setModel('\Alchemy\Component\Cerberus\Model\RolePerm... | php | public function initRolePermissions($overrideExisting = true)
{
if (null !== $this->collRolePermissions && !$overrideExisting) {
return;
}
$this->collRolePermissions = new ObjectCollection();
$this->collRolePermissions->setModel('\Alchemy\Component\Cerberus\Model\RolePerm... | [
"public",
"function",
"initRolePermissions",
"(",
"$",
"overrideExisting",
"=",
"true",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"collRolePermissions",
"&&",
"!",
"$",
"overrideExisting",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"coll... | Initializes the collRolePermissions collection.
By default this just sets the collRolePermissions collection to an empty array (like clearcollRolePermissions());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array... | [
"Initializes",
"the",
"collRolePermissions",
"collection",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L1726-L1733 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.addRolePermission | public function addRolePermission(ChildRolePermission $l)
{
if ($this->collRolePermissions === null) {
$this->initRolePermissions();
$this->collRolePermissionsPartial = true;
}
if (!$this->collRolePermissions->contains($l)) {
$this->doAddRolePermission($l... | php | public function addRolePermission(ChildRolePermission $l)
{
if ($this->collRolePermissions === null) {
$this->initRolePermissions();
$this->collRolePermissionsPartial = true;
}
if (!$this->collRolePermissions->contains($l)) {
$this->doAddRolePermission($l... | [
"public",
"function",
"addRolePermission",
"(",
"ChildRolePermission",
"$",
"l",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collRolePermissions",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"initRolePermissions",
"(",
")",
";",
"$",
"this",
"->",
"collRolePerm... | Method called to associate a ChildRolePermission object to this object
through the ChildRolePermission foreign key attribute.
@param ChildRolePermission $l ChildRolePermission
@return $this|\Alchemy\Component\Cerberus\Model\Role The current object (for fluent API support) | [
"Method",
"called",
"to",
"associate",
"a",
"ChildRolePermission",
"object",
"to",
"this",
"object",
"through",
"the",
"ChildRolePermission",
"foreign",
"key",
"attribute",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L1870-L1882 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.initUsers | public function initUsers()
{
$this->collUsers = new ObjectCollection();
$this->collUsersPartial = true;
$this->collUsers->setModel('\Alchemy\Component\Cerberus\Model\User');
} | php | public function initUsers()
{
$this->collUsers = new ObjectCollection();
$this->collUsersPartial = true;
$this->collUsers->setModel('\Alchemy\Component\Cerberus\Model\User');
} | [
"public",
"function",
"initUsers",
"(",
")",
"{",
"$",
"this",
"->",
"collUsers",
"=",
"new",
"ObjectCollection",
"(",
")",
";",
"$",
"this",
"->",
"collUsersPartial",
"=",
"true",
";",
"$",
"this",
"->",
"collUsers",
"->",
"setModel",
"(",
"'\\Alchemy\\Co... | Initializes the collUsers collection.
By default this just sets the collUsers collection to an empty collection (like clearUsers());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in data... | [
"Initializes",
"the",
"collUsers",
"collection",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L1961-L1967 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.getUsers | public function getUsers(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collUsersPartial && !$this->isNew();
if (null === $this->collUsers || null !== $criteria || $partial) {
if ($this->isNew()) {
// return empty collection
... | php | public function getUsers(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collUsersPartial && !$this->isNew();
if (null === $this->collUsers || null !== $criteria || $partial) {
if ($this->isNew()) {
// return empty collection
... | [
"public",
"function",
"getUsers",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUsersPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"(",
")",
... | Gets a collection of ChildUser objects related by a many-to-many relationship
to the current object by way of the user_role cross-reference table.
If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Nex... | [
"Gets",
"a",
"collection",
"of",
"ChildUser",
"objects",
"related",
"by",
"a",
"many",
"-",
"to",
"-",
"many",
"relationship",
"to",
"the",
"current",
"object",
"by",
"way",
"of",
"the",
"user_role",
"cross",
"-",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L1994-L2027 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.setUsers | public function setUsers(Collection $users, ConnectionInterface $con = null)
{
$this->clearUsers();
$currentUsers = $this->getUsers();
$usersScheduledForDeletion = $currentUsers->diff($users);
foreach ($usersScheduledForDeletion as $toDelete) {
$this->removeUser($toDele... | php | public function setUsers(Collection $users, ConnectionInterface $con = null)
{
$this->clearUsers();
$currentUsers = $this->getUsers();
$usersScheduledForDeletion = $currentUsers->diff($users);
foreach ($usersScheduledForDeletion as $toDelete) {
$this->removeUser($toDele... | [
"public",
"function",
"setUsers",
"(",
"Collection",
"$",
"users",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"clearUsers",
"(",
")",
";",
"$",
"currentUsers",
"=",
"$",
"this",
"->",
"getUsers",
"(",
")",
";",
"$... | Sets a collection of User objects related by a many-to-many relationship
to the current object by way of the user_role cross-reference table.
It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.
@param Collection $users A Prop... | [
"Sets",
"a",
"collection",
"of",
"User",
"objects",
"related",
"by",
"a",
"many",
"-",
"to",
"-",
"many",
"relationship",
"to",
"the",
"current",
"object",
"by",
"way",
"of",
"the",
"user_role",
"cross",
"-",
"reference",
"table",
".",
"It",
"will",
"als... | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2039-L2060 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.countUsers | public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collUsersPartial && !$this->isNew();
if (null === $this->collUsers || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUsers) {
... | php | public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collUsersPartial && !$this->isNew();
if (null === $this->collUsers || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUsers) {
... | [
"public",
"function",
"countUsers",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"$",
"distinct",
"=",
"false",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUsersPartial",
"&&",
"!",
"... | Gets the number of User objects related by a many-to-many relationship
to the current object by way of the user_role cross-reference table.
@param Criteria $criteria Optional query object to filter the query
@param boolean $distinct Set to true to force count distinct
@param ConnectionInterface $con Opt... | [
"Gets",
"the",
"number",
"of",
"User",
"objects",
"related",
"by",
"a",
"many",
"-",
"to",
"-",
"many",
"relationship",
"to",
"the",
"current",
"object",
"by",
"way",
"of",
"the",
"user_role",
"cross",
"-",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2072-L2096 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.addUser | public function addUser(ChildUser $user)
{
if ($this->collUsers === null) {
$this->initUsers();
}
if (!$this->getUsers()->contains($user)) {
// only add it if the **same** object is not already associated
$this->collUsers->push($user);
$this->... | php | public function addUser(ChildUser $user)
{
if ($this->collUsers === null) {
$this->initUsers();
}
if (!$this->getUsers()->contains($user)) {
// only add it if the **same** object is not already associated
$this->collUsers->push($user);
$this->... | [
"public",
"function",
"addUser",
"(",
"ChildUser",
"$",
"user",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collUsers",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"initUsers",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"getUsers",
"(",
... | Associate a ChildUser to this object
through the user_role cross reference table.
@param ChildUser $user
@return ChildRole The current object (for fluent API support) | [
"Associate",
"a",
"ChildUser",
"to",
"this",
"object",
"through",
"the",
"user_role",
"cross",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2105-L2118 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.removeUser | public function removeUser(ChildUser $user)
{
if ($this->getUsers()->contains($user)) { $userRole = new ChildUserRole();
$userRole->setUser($user);
if ($user->isRolesLoaded()) {
//remove the back reference if available
$user->getRoles()->removeObject(... | php | public function removeUser(ChildUser $user)
{
if ($this->getUsers()->contains($user)) { $userRole = new ChildUserRole();
$userRole->setUser($user);
if ($user->isRolesLoaded()) {
//remove the back reference if available
$user->getRoles()->removeObject(... | [
"public",
"function",
"removeUser",
"(",
"ChildUser",
"$",
"user",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getUsers",
"(",
")",
"->",
"contains",
"(",
"$",
"user",
")",
")",
"{",
"$",
"userRole",
"=",
"new",
"ChildUserRole",
"(",
")",
";",
"$",
"u... | Remove user of this object
through the user_role cross reference table.
@param ChildUser $user
@return ChildRole The current object (for fluent API support) | [
"Remove",
"user",
"of",
"this",
"object",
"through",
"the",
"user_role",
"cross",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2152-L2178 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.initPermissions | public function initPermissions()
{
$this->collPermissions = new ObjectCollection();
$this->collPermissionsPartial = true;
$this->collPermissions->setModel('\Alchemy\Component\Cerberus\Model\Permission');
} | php | public function initPermissions()
{
$this->collPermissions = new ObjectCollection();
$this->collPermissionsPartial = true;
$this->collPermissions->setModel('\Alchemy\Component\Cerberus\Model\Permission');
} | [
"public",
"function",
"initPermissions",
"(",
")",
"{",
"$",
"this",
"->",
"collPermissions",
"=",
"new",
"ObjectCollection",
"(",
")",
";",
"$",
"this",
"->",
"collPermissionsPartial",
"=",
"true",
";",
"$",
"this",
"->",
"collPermissions",
"->",
"setModel",
... | Initializes the collPermissions collection.
By default this just sets the collPermissions collection to an empty collection (like clearPermissions());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the val... | [
"Initializes",
"the",
"collPermissions",
"collection",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2203-L2209 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.getPermissions | public function getPermissions(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collPermissionsPartial && !$this->isNew();
if (null === $this->collPermissions || null !== $criteria || $partial) {
if ($this->isNew()) {
// return empty collect... | php | public function getPermissions(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collPermissionsPartial && !$this->isNew();
if (null === $this->collPermissions || null !== $criteria || $partial) {
if ($this->isNew()) {
// return empty collect... | [
"public",
"function",
"getPermissions",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collPermissionsPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"... | Gets a collection of ChildPermission objects related by a many-to-many relationship
to the current object by way of the role_permission cross-reference table.
If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then... | [
"Gets",
"a",
"collection",
"of",
"ChildPermission",
"objects",
"related",
"by",
"a",
"many",
"-",
"to",
"-",
"many",
"relationship",
"to",
"the",
"current",
"object",
"by",
"way",
"of",
"the",
"role_permission",
"cross",
"-",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2236-L2269 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.setPermissions | public function setPermissions(Collection $permissions, ConnectionInterface $con = null)
{
$this->clearPermissions();
$currentPermissions = $this->getPermissions();
$permissionsScheduledForDeletion = $currentPermissions->diff($permissions);
foreach ($permissionsScheduledForDeletion... | php | public function setPermissions(Collection $permissions, ConnectionInterface $con = null)
{
$this->clearPermissions();
$currentPermissions = $this->getPermissions();
$permissionsScheduledForDeletion = $currentPermissions->diff($permissions);
foreach ($permissionsScheduledForDeletion... | [
"public",
"function",
"setPermissions",
"(",
"Collection",
"$",
"permissions",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"clearPermissions",
"(",
")",
";",
"$",
"currentPermissions",
"=",
"$",
"this",
"->",
"getPermissio... | Sets a collection of Permission objects related by a many-to-many relationship
to the current object by way of the role_permission cross-reference table.
It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.
@param Collection $... | [
"Sets",
"a",
"collection",
"of",
"Permission",
"objects",
"related",
"by",
"a",
"many",
"-",
"to",
"-",
"many",
"relationship",
"to",
"the",
"current",
"object",
"by",
"way",
"of",
"the",
"role_permission",
"cross",
"-",
"reference",
"table",
".",
"It",
"w... | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2281-L2302 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.countPermissions | public function countPermissions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collPermissionsPartial && !$this->isNew();
if (null === $this->collPermissions || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->co... | php | public function countPermissions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collPermissionsPartial && !$this->isNew();
if (null === $this->collPermissions || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->co... | [
"public",
"function",
"countPermissions",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"$",
"distinct",
"=",
"false",
",",
"ConnectionInterface",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collPermissionsPartial",
"&&"... | Gets the number of Permission objects related by a many-to-many relationship
to the current object by way of the role_permission cross-reference table.
@param Criteria $criteria Optional query object to filter the query
@param boolean $distinct Set to true to force count distinct
@param ConnectionInterf... | [
"Gets",
"the",
"number",
"of",
"Permission",
"objects",
"related",
"by",
"a",
"many",
"-",
"to",
"-",
"many",
"relationship",
"to",
"the",
"current",
"object",
"by",
"way",
"of",
"the",
"role_permission",
"cross",
"-",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2314-L2338 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Base/Role.php | Role.addPermission | public function addPermission(ChildPermission $permission)
{
if ($this->collPermissions === null) {
$this->initPermissions();
}
if (!$this->getPermissions()->contains($permission)) {
// only add it if the **same** object is not already associated
$this->c... | php | public function addPermission(ChildPermission $permission)
{
if ($this->collPermissions === null) {
$this->initPermissions();
}
if (!$this->getPermissions()->contains($permission)) {
// only add it if the **same** object is not already associated
$this->c... | [
"public",
"function",
"addPermission",
"(",
"ChildPermission",
"$",
"permission",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"collPermissions",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"initPermissions",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
... | Associate a ChildPermission to this object
through the role_permission cross reference table.
@param ChildPermission $permission
@return ChildRole The current object (for fluent API support) | [
"Associate",
"a",
"ChildPermission",
"to",
"this",
"object",
"through",
"the",
"role_permission",
"cross",
"reference",
"table",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Base/Role.php#L2347-L2360 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.