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 |
|---|---|---|---|---|---|---|---|---|---|---|
FrenchFrogs/framework | src/Form/Element/Element.php | Element.setPlaceholder | public function setPlaceholder($value = false)
{
// par default on met la valeur du champs
if ($value === false) {
$value = $this->getLabel();
}
return $this->addAttribute('placeholder', $value);
} | php | public function setPlaceholder($value = false)
{
// par default on met la valeur du champs
if ($value === false) {
$value = $this->getLabel();
}
return $this->addAttribute('placeholder', $value);
} | [
"public",
"function",
"setPlaceholder",
"(",
"$",
"value",
"=",
"false",
")",
"{",
"// par default on met la valeur du champs",
"if",
"(",
"$",
"value",
"===",
"false",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getLabel",
"(",
")",
";",
"}",
"return... | Setter placeholder
@param bool|false $value
@return $this | [
"Setter",
"placeholder"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L277-L285 |
FrenchFrogs/framework | src/Form/Element/Element.php | Element.getRenderer | public function getRenderer()
{
if ($this->hasForm()) {
return $this->getForm()->getRenderer();
} elseif($this->hasRenderer()) {
return $this->renderer;
} else {
return null;
}
} | php | public function getRenderer()
{
if ($this->hasForm()) {
return $this->getForm()->getRenderer();
} elseif($this->hasRenderer()) {
return $this->renderer;
} else {
return null;
}
} | [
"public",
"function",
"getRenderer",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasForm",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getForm",
"(",
")",
"->",
"getRenderer",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"hasRender... | Getter for form renderer
@return \FrenchFrogs\Renderer\Renderer|null | [
"Getter",
"for",
"form",
"renderer"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L370-L379 |
FrenchFrogs/framework | src/Form/Element/Element.php | Element.getValidator | public function getValidator()
{
if(!$this->hasValidator() && $this->hasForm()) {
$this->setValidator(clone $this->getForm()->getValidator());
$this->getValidator()->clearErrors()->clearMessages()->clearRules();
}
return $this->validator;
} | php | public function getValidator()
{
if(!$this->hasValidator() && $this->hasForm()) {
$this->setValidator(clone $this->getForm()->getValidator());
$this->getValidator()->clearErrors()->clearMessages()->clearRules();
}
return $this->validator;
} | [
"public",
"function",
"getValidator",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasValidator",
"(",
")",
"&&",
"$",
"this",
"->",
"hasForm",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setValidator",
"(",
"clone",
"$",
"this",
"->",
"getForm",
... | getter for form validator
@return \FrenchFrogs\Validator\Validator|null | [
"getter",
"for",
"form",
"validator"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L386-L393 |
FrenchFrogs/framework | src/Form/Element/Element.php | Element.addRule | public function addRule($rule, $method = null, $params = [], $message = null)
{
// construction des paramètres
array_unshift($params, $rule, $method);
call_user_func_array([$this->getValidator(), 'addRule'], $params);
if (!is_null($message)) {
if(is_array($message)){
... | php | public function addRule($rule, $method = null, $params = [], $message = null)
{
// construction des paramètres
array_unshift($params, $rule, $method);
call_user_func_array([$this->getValidator(), 'addRule'], $params);
if (!is_null($message)) {
if(is_array($message)){
... | [
"public",
"function",
"addRule",
"(",
"$",
"rule",
",",
"$",
"method",
"=",
"null",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"message",
"=",
"null",
")",
"{",
"// construction des paramètres",
"array_unshift",
"(",
"$",
"params",
",",
"$",
"rule",
... | Ajoute un validator
@param $rule
@param null $method
@param array $params
@param null $message
@return $this | [
"Ajoute",
"un",
"validator"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L413-L432 |
FrenchFrogs/framework | src/Form/Element/Element.php | Element.valid | public function valid($value = null)
{
// si la valeur n'ets pas null, on la set
if (!is_null($value)) {
$value = (is_string($value)) ? trim($value) : $value;
if ($this->hasFilterer()) {
$value = $this->getFilterer()->filter($value);
}
... | php | public function valid($value = null)
{
// si la valeur n'ets pas null, on la set
if (!is_null($value)) {
$value = (is_string($value)) ? trim($value) : $value;
if ($this->hasFilterer()) {
$value = $this->getFilterer()->filter($value);
}
... | [
"public",
"function",
"valid",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"// si la valeur n'ets pas null, on la set",
"if",
"(",
"!",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"?",
"t... | Validation de la valeur courant de l'element
@param mixed $value
@return $this
@throws \Exception | [
"Validation",
"de",
"la",
"valeur",
"courant",
"de",
"l",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L467-L481 |
FrenchFrogs/framework | src/Form/Element/Element.php | Element.addFilter | public function addFilter($filter, $method = null, ...$params)
{
if (!$this->hasFilterer()) {
$this->setFilterer(configurator()->build('form.filterer.class'));
}
call_user_func_array([$this->getFilterer(), 'addFilter'], func_get_args());
return $this;
} | php | public function addFilter($filter, $method = null, ...$params)
{
if (!$this->hasFilterer()) {
$this->setFilterer(configurator()->build('form.filterer.class'));
}
call_user_func_array([$this->getFilterer(), 'addFilter'], func_get_args());
return $this;
} | [
"public",
"function",
"addFilter",
"(",
"$",
"filter",
",",
"$",
"method",
"=",
"null",
",",
"...",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasFilterer",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setFilterer",
"(",
"configurator",
... | Ajoute un filtre
@param $filter
@param null $method
@return $this | [
"Ajoute",
"un",
"filtre"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L498-L506 |
FrenchFrogs/framework | src/Form/Element/Element.php | Element.setFilters | public function setFilters($filters)
{
if (!$this->hasFilterer()) {
$this->setFilterer(configurator()->build('form.filterer.class'));
}
$this->getFilterer()->setFilters($filters);
return $this;
} | php | public function setFilters($filters)
{
if (!$this->hasFilterer()) {
$this->setFilterer(configurator()->build('form.filterer.class'));
}
$this->getFilterer()->setFilters($filters);
return $this;
} | [
"public",
"function",
"setFilters",
"(",
"$",
"filters",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasFilterer",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setFilterer",
"(",
"configurator",
"(",
")",
"->",
"build",
"(",
"'form.filterer.class'",
")",
... | Shortcut pour l'ajout de filtre
@param $filters
@return $this | [
"Shortcut",
"pour",
"l",
"ajout",
"de",
"filtre"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L514-L522 |
FrenchFrogs/framework | src/Form/Element/Element.php | Element.getFilteredValue | public function getFilteredValue()
{
if ($this->hasFilterer()) {
$value = $this->getFilterer()->filter($this->getValue());
} else {
$value = $this->getValue();
}
return $value;
} | php | public function getFilteredValue()
{
if ($this->hasFilterer()) {
$value = $this->getFilterer()->filter($this->getValue());
} else {
$value = $this->getValue();
}
return $value;
} | [
"public",
"function",
"getFilteredValue",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasFilterer",
"(",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getFilterer",
"(",
")",
"->",
"filter",
"(",
"$",
"this",
"->",
"getValue",
"(",
")",
"... | Renvoie la valeur filtré
@return mixed
@throws \Exception | [
"Renvoie",
"la",
"valeur",
"filtré"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Element/Element.php#L556-L565 |
yosmanyga/resource | src/Yosmanyga/Resource/Transformer/RelativeDirectoryTransformer.php | RelativeDirectoryTransformer.supports | public function supports(Resource $resource, Resource $parentResource)
{
if (!$resource->hasMetadata('dir') || 0 === strpos(parse_url($resource->getMetadata('dir'), PHP_URL_PATH), '/')) {
return false;
}
foreach ($this->firstCharacters as $character) {
if (0 === strp... | php | public function supports(Resource $resource, Resource $parentResource)
{
if (!$resource->hasMetadata('dir') || 0 === strpos(parse_url($resource->getMetadata('dir'), PHP_URL_PATH), '/')) {
return false;
}
foreach ($this->firstCharacters as $character) {
if (0 === strp... | [
"public",
"function",
"supports",
"(",
"Resource",
"$",
"resource",
",",
"Resource",
"$",
"parentResource",
")",
"{",
"if",
"(",
"!",
"$",
"resource",
"->",
"hasMetadata",
"(",
"'dir'",
")",
"||",
"0",
"===",
"strpos",
"(",
"parse_url",
"(",
"$",
"resour... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/RelativeDirectoryTransformer.php#L19-L32 |
yosmanyga/resource | src/Yosmanyga/Resource/Transformer/RelativeDirectoryTransformer.php | RelativeDirectoryTransformer.transform | public function transform(Resource $resource, Resource $parentResource)
{
$file = sprintf(
'%s/%s',
dirname($parentResource->getMetadata('file')),
$resource->getMetadata('dir')
);
return new Resource(['file' => $file]);
} | php | public function transform(Resource $resource, Resource $parentResource)
{
$file = sprintf(
'%s/%s',
dirname($parentResource->getMetadata('file')),
$resource->getMetadata('dir')
);
return new Resource(['file' => $file]);
} | [
"public",
"function",
"transform",
"(",
"Resource",
"$",
"resource",
",",
"Resource",
"$",
"parentResource",
")",
"{",
"$",
"file",
"=",
"sprintf",
"(",
"'%s/%s'",
",",
"dirname",
"(",
"$",
"parentResource",
"->",
"getMetadata",
"(",
"'file'",
")",
")",
",... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/RelativeDirectoryTransformer.php#L37-L46 |
wpottier/WizadSettingsBundle | DependencyInjection/WizadSettingsExtension.php | WizadSettingsExtension.prepend | public function prepend(ContainerBuilder $container)
{
$configs = $container->getExtensionConfig('wizad_settings');
$processor = new Processor();
$configuration = $this->getConfiguration($configs, $container);
$config = $processor->processConfiguration($configuration, $configs);
... | php | public function prepend(ContainerBuilder $container)
{
$configs = $container->getExtensionConfig('wizad_settings');
$processor = new Processor();
$configuration = $this->getConfiguration($configs, $container);
$config = $processor->processConfiguration($configuration, $configs);
... | [
"public",
"function",
"prepend",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configs",
"=",
"$",
"container",
"->",
"getExtensionConfig",
"(",
"'wizad_settings'",
")",
";",
"$",
"processor",
"=",
"new",
"Processor",
"(",
")",
";",
"$",
"config... | Allow an extension to prepend the extension configurations.
@param ContainerBuilder $container | [
"Allow",
"an",
"extension",
"to",
"prepend",
"the",
"extension",
"configurations",
"."
] | train | https://github.com/wpottier/WizadSettingsBundle/blob/92738c59d4da28d3a7376de854ce8505898159cb/DependencyInjection/WizadSettingsExtension.php#L37-L56 |
wpottier/WizadSettingsBundle | DependencyInjection/WizadSettingsExtension.php | WizadSettingsExtension.loadStorageEngine | protected function loadStorageEngine($config, ContainerBuilder $container)
{
$parametersStorageServiceDef = $container->getDefinition('wizad_settings.dal.parameters_storage');
if (isset($config['redis'])) {
$this->prepareRedisStorageEngine($config['redis'], $container, $parametersStorag... | php | protected function loadStorageEngine($config, ContainerBuilder $container)
{
$parametersStorageServiceDef = $container->getDefinition('wizad_settings.dal.parameters_storage');
if (isset($config['redis'])) {
$this->prepareRedisStorageEngine($config['redis'], $container, $parametersStorag... | [
"protected",
"function",
"loadStorageEngine",
"(",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"parametersStorageServiceDef",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"'wizad_settings.dal.parameters_storage'",
")",
";",
"if",
"("... | @param $config
@param ContainerBuilder $container
@return ParametersStorageInterface
@throws \Exception | [
"@param",
"$config",
"@param",
"ContainerBuilder",
"$container"
] | train | https://github.com/wpottier/WizadSettingsBundle/blob/92738c59d4da28d3a7376de854ce8505898159cb/DependencyInjection/WizadSettingsExtension.php#L73-L87 |
wpottier/WizadSettingsBundle | DependencyInjection/WizadSettingsExtension.php | WizadSettingsExtension.loadDynamicParametersSchema | protected function loadDynamicParametersSchema($config, ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
$schema = array();
foreach ($config['bundles'] as $bundle) {
$reflector = new \ReflectionClass($bundles[$bundle]);
$loader =... | php | protected function loadDynamicParametersSchema($config, ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
$schema = array();
foreach ($config['bundles'] as $bundle) {
$reflector = new \ReflectionClass($bundles[$bundle]);
$loader =... | [
"protected",
"function",
"loadDynamicParametersSchema",
"(",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"bundles",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'kernel.bundles'",
")",
";",
"$",
"schema",
"=",
"array",
"(",
"... | @param $config
@param ContainerBuilder $container
@return array | [
"@param",
"$config",
"@param",
"ContainerBuilder",
"$container"
] | train | https://github.com/wpottier/WizadSettingsBundle/blob/92738c59d4da28d3a7376de854ce8505898159cb/DependencyInjection/WizadSettingsExtension.php#L126-L140 |
huasituo/hstcms | src/Database/Migrations/2016_11_25_093145_create_hook_inject_table.php | CreateHookInjectTable.up | public function up()
{
//
Schema::create('hook_inject', function (Blueprint $table)
{
$table->increments('id')->comment('ID');
$table->string('hook_name', 50)->default('')->comment(trans('hstcms::hook.name'));
$table->string('alias', 100)->default('')->com... | php | public function up()
{
//
Schema::create('hook_inject', function (Blueprint $table)
{
$table->increments('id')->comment('ID');
$table->string('hook_name', 50)->default('')->comment(trans('hstcms::hook.name'));
$table->string('alias', 100)->default('')->com... | [
"public",
"function",
"up",
"(",
")",
"{",
"//",
"Schema",
"::",
"create",
"(",
"'hook_inject'",
",",
"function",
"(",
"Blueprint",
"$",
"table",
")",
"{",
"$",
"table",
"->",
"increments",
"(",
"'id'",
")",
"->",
"comment",
"(",
"'ID'",
")",
";",
"$... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Database/Migrations/2016_11_25_093145_create_hook_inject_table.php#L18-L34 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtRuleConditionalAbstract.php | AtRuleConditionalAbstract.addRule | public function addRule(RuleAbstract $rule)
{
// Check for allowed instances
if ($rule instanceof RuleGroupableInterface) {
$this->rules[] = $rule;
} else {
// Invalid rule instance, because only nested statements can be added to conditional group rules.
$... | php | public function addRule(RuleAbstract $rule)
{
// Check for allowed instances
if ($rule instanceof RuleGroupableInterface) {
$this->rules[] = $rule;
} else {
// Invalid rule instance, because only nested statements can be added to conditional group rules.
$... | [
"public",
"function",
"addRule",
"(",
"RuleAbstract",
"$",
"rule",
")",
"{",
"// Check for allowed instances",
"if",
"(",
"$",
"rule",
"instanceof",
"RuleGroupableInterface",
")",
"{",
"$",
"this",
"->",
"rules",
"[",
"]",
"=",
"$",
"rule",
";",
"}",
"else",... | Adds a rule.
@param RuleGroupableInterface $rule
@return $this
@throws \Exception | [
"Adds",
"a",
"rule",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtRuleConditionalAbstract.php#L17-L35 |
siriusphp/html | src/Tag.php | Tag.create | public static function create($tag, $props = null, $content = null, Builder $builder = null)
{
$widget = new static($props, $content, $builder);
if (substr($tag, - 1) === '/') {
$widget->tag = substr($tag, 0, - 1);
$widget->isSelfClosing = true;
} else {
... | php | public static function create($tag, $props = null, $content = null, Builder $builder = null)
{
$widget = new static($props, $content, $builder);
if (substr($tag, - 1) === '/') {
$widget->tag = substr($tag, 0, - 1);
$widget->isSelfClosing = true;
} else {
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"tag",
",",
"$",
"props",
"=",
"null",
",",
"$",
"content",
"=",
"null",
",",
"Builder",
"$",
"builder",
"=",
"null",
")",
"{",
"$",
"widget",
"=",
"new",
"static",
"(",
"$",
"props",
",",
"$",
... | Factory method.
If $tag ends in '/' the tag will be considered 'self-closing'
@example ExtendedTag::factory('hr/', null, ['class' => 'separator']);
ExtendedTag::factory('div', 'This is my content', ['class' => 'container']);
@param string $tag
@param array $props
@param mixed $content
@param Builder $builder
@return... | [
"Factory",
"method",
".",
"If",
"$tag",
"ends",
"in",
"/",
"the",
"tag",
"will",
"be",
"considered",
"self",
"-",
"closing"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L87-L100 |
siriusphp/html | src/Tag.php | Tag.setProps | public function setProps($props)
{
if (! is_array($props) && ! ($props instanceof \Traversable)) {
return $this;
}
foreach ($props as $name => $value) {
$this->set($name, $value);
}
return $this;
} | php | public function setProps($props)
{
if (! is_array($props) && ! ($props instanceof \Traversable)) {
return $this;
}
foreach ($props as $name => $value) {
$this->set($name, $value);
}
return $this;
} | [
"public",
"function",
"setProps",
"(",
"$",
"props",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"props",
")",
"&&",
"!",
"(",
"$",
"props",
"instanceof",
"\\",
"Traversable",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"foreach",
"(",
"$",... | Set multipe properties to the HTML element
@param array $props
@return self | [
"Set",
"multipe",
"properties",
"to",
"the",
"HTML",
"element"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L128-L138 |
siriusphp/html | src/Tag.php | Tag.set | public function set($name, $value = null)
{
if (is_string($name)) {
$name = $this->cleanAttributeName($name);
if ($value === null && isset($this->props[$name])) {
unset($this->props[$name]);
} elseif ($value !== null) {
$this->props[$name] ... | php | public function set($name, $value = null)
{
if (is_string($name)) {
$name = $this->cleanAttributeName($name);
if ($value === null && isset($this->props[$name])) {
unset($this->props[$name]);
} elseif ($value !== null) {
$this->props[$name] ... | [
"public",
"function",
"set",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"cleanAttributeName",
"(",
"$",
"name",
")",
";",
"if",
"(",
... | Set a single property to the HTML element
@param string $name
@param mixed $value
@return Tag | [
"Set",
"a",
"single",
"property",
"to",
"the",
"HTML",
"element"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L148-L160 |
siriusphp/html | src/Tag.php | Tag.getProps | public function getProps($list = null)
{
if ($list && is_array($list)) {
$result = array();
foreach ($list as $key) {
$result[$key] = $this->get($key);
}
return $result;
}
return $this->props;
} | php | public function getProps($list = null)
{
if ($list && is_array($list)) {
$result = array();
foreach ($list as $key) {
$result[$key] = $this->get($key);
}
return $result;
}
return $this->props;
} | [
"public",
"function",
"getProps",
"(",
"$",
"list",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"list",
"&&",
"is_array",
"(",
"$",
"list",
")",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"key",
")"... | Returns some or all of the HTML element's properties
@param array|null $list
@return array | [
"Returns",
"some",
"or",
"all",
"of",
"the",
"HTML",
"element",
"s",
"properties"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L184-L196 |
siriusphp/html | src/Tag.php | Tag.get | public function get($name)
{
$name = $this->cleanAttributeName($name);
return isset($this->props[$name]) ? $this->props[$name] : null;
} | php | public function get($name)
{
$name = $this->cleanAttributeName($name);
return isset($this->props[$name]) ? $this->props[$name] : null;
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"cleanAttributeName",
"(",
"$",
"name",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"props",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->"... | Returns one of HTML element's properties
@param string $name
@return mixed | [
"Returns",
"one",
"of",
"HTML",
"element",
"s",
"properties"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L205-L210 |
siriusphp/html | src/Tag.php | Tag.addClass | public function addClass($class)
{
if (! $this->hasClass($class)) {
$this->set('class', trim((string) $this->get('class') . ' ' . $class));
}
return $this;
} | php | public function addClass($class)
{
if (! $this->hasClass($class)) {
$this->set('class', trim((string) $this->get('class') . ' ' . $class));
}
return $this;
} | [
"public",
"function",
"addClass",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasClass",
"(",
"$",
"class",
")",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"'class'",
",",
"trim",
"(",
"(",
"string",
")",
"$",
"this",
"->",
"... | Add a class to the element's class list
@param string $class
@return self | [
"Add",
"a",
"class",
"to",
"the",
"element",
"s",
"class",
"list"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L219-L226 |
siriusphp/html | src/Tag.php | Tag.removeClass | public function removeClass($class)
{
$classes = $this->get('class');
if ($classes) {
$classes = trim(preg_replace('/(^| ){1}' . $class . '( |$){1}/i', ' ', $classes));
$this->set('class', $classes);
}
return $this;
} | php | public function removeClass($class)
{
$classes = $this->get('class');
if ($classes) {
$classes = trim(preg_replace('/(^| ){1}' . $class . '( |$){1}/i', ' ', $classes));
$this->set('class', $classes);
}
return $this;
} | [
"public",
"function",
"removeClass",
"(",
"$",
"class",
")",
"{",
"$",
"classes",
"=",
"$",
"this",
"->",
"get",
"(",
"'class'",
")",
";",
"if",
"(",
"$",
"classes",
")",
"{",
"$",
"classes",
"=",
"trim",
"(",
"preg_replace",
"(",
"'/(^| ){1}'",
".",... | Remove a class from the element's class list
@param string $class
@return self | [
"Remove",
"a",
"class",
"from",
"the",
"element",
"s",
"class",
"list"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L235-L244 |
siriusphp/html | src/Tag.php | Tag.setContent | public function setContent($content)
{
if (! $content) {
return $this;
}
if (! is_array($content)) {
$content = array( $content );
}
$this->clearContent();
foreach ($content as $child) {
$this->addChild($child);
}
r... | php | public function setContent($content)
{
if (! $content) {
return $this;
}
if (! is_array($content)) {
$content = array( $content );
}
$this->clearContent();
foreach ($content as $child) {
$this->addChild($child);
}
r... | [
"public",
"function",
"setContent",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"$",
"content",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"content",
")",
")",
"{",
"$",
"content",
"=",
"array",
"(",
"$",
... | Set the content
@param mixed $content
@return $this | [
"Set",
"the",
"content"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L283-L297 |
siriusphp/html | src/Tag.php | Tag.addChild | protected function addChild($tagTextOrArray)
{
// a list of arguments to be passed to builder->make()
if (is_array($tagTextOrArray) && ! empty($tagTextOrArray)) {
if (! isset($this->builder)) {
throw new \InvalidArgumentException(sprintf('Builder not attached to tag `%s`'... | php | protected function addChild($tagTextOrArray)
{
// a list of arguments to be passed to builder->make()
if (is_array($tagTextOrArray) && ! empty($tagTextOrArray)) {
if (! isset($this->builder)) {
throw new \InvalidArgumentException(sprintf('Builder not attached to tag `%s`'... | [
"protected",
"function",
"addChild",
"(",
"$",
"tagTextOrArray",
")",
"{",
"// a list of arguments to be passed to builder->make()",
"if",
"(",
"is_array",
"(",
"$",
"tagTextOrArray",
")",
"&&",
"!",
"empty",
"(",
"$",
"tagTextOrArray",
")",
")",
"{",
"if",
"(",
... | @param $tagTextOrArray
@return self | [
"@param",
"$tagTextOrArray"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L326-L343 |
siriusphp/html | src/Tag.php | Tag.getAttributesString | protected function getAttributesString()
{
$result = '';
ksort($this->props);
foreach ($this->props as $k => $v) {
if (substr($k, 0, 1) !== '_') {
if ($v === true) {
$result .= $k . ' ';
} else {
$result .= $... | php | protected function getAttributesString()
{
$result = '';
ksort($this->props);
foreach ($this->props as $k => $v) {
if (substr($k, 0, 1) !== '_') {
if ($v === true) {
$result .= $k . ' ';
} else {
$result .= $... | [
"protected",
"function",
"getAttributesString",
"(",
")",
"{",
"$",
"result",
"=",
"''",
";",
"ksort",
"(",
"$",
"this",
"->",
"props",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"props",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"su... | Return the attributes as a string for HTML output
example: title="Click here to delete" class="remove"
@return string | [
"Return",
"the",
"attributes",
"as",
"a",
"string",
"for",
"HTML",
"output",
"example",
":",
"title",
"=",
"Click",
"here",
"to",
"delete",
"class",
"=",
"remove"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L351-L369 |
siriusphp/html | src/Tag.php | Tag.escapeAttr | protected function escapeAttr($attr)
{
$attr = (string) $attr;
if (0 === strlen($attr)) {
return '';
}
// Don't bother if there are no specialchars - saves some processing
if (! preg_match('/[&<>"\']/', $attr)) {
return $attr;
}
retu... | php | protected function escapeAttr($attr)
{
$attr = (string) $attr;
if (0 === strlen($attr)) {
return '';
}
// Don't bother if there are no specialchars - saves some processing
if (! preg_match('/[&<>"\']/', $attr)) {
return $attr;
}
retu... | [
"protected",
"function",
"escapeAttr",
"(",
"$",
"attr",
")",
"{",
"$",
"attr",
"=",
"(",
"string",
")",
"$",
"attr",
";",
"if",
"(",
"0",
"===",
"strlen",
"(",
"$",
"attr",
")",
")",
"{",
"return",
"''",
";",
"}",
"// Don't bother if there are no spec... | @param $attr
@return string | [
"@param",
"$attr"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L376-L390 |
siriusphp/html | src/Tag.php | Tag.render | public function render()
{
if ($this->isSelfClosing) {
$element = "<{$this->tag}".$this->getAttributesString()." />";
} else {
$element = "<{$this->tag}".$this->getAttributesString().">".$this->getInnerHtml()."</{$this->tag}>";
}
$before = !empty($this->before... | php | public function render()
{
if ($this->isSelfClosing) {
$element = "<{$this->tag}".$this->getAttributesString()." />";
} else {
$element = "<{$this->tag}".$this->getAttributesString().">".$this->getInnerHtml()."</{$this->tag}>";
}
$before = !empty($this->before... | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSelfClosing",
")",
"{",
"$",
"element",
"=",
"\"<{$this->tag}\"",
".",
"$",
"this",
"->",
"getAttributesString",
"(",
")",
".",
"\" />\"",
";",
"}",
"else",
"{",
"$",
"elem... | Render the element
@return string | [
"Render",
"the",
"element"
] | train | https://github.com/siriusphp/html/blob/bc3e0cb98e80780e2ca01d88c3181605b7136f59/src/Tag.php#L397-L408 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableListCommand.php | PluggableListCommand.fire | public function fire()
{
$pluggables = $this->pluggable->all();
if (count($pluggables) == 0) {
return $this->error("Your application doesn't have any pluggables.");
}
$this->displayPluggables($this->getPluggables());
} | php | public function fire()
{
$pluggables = $this->pluggable->all();
if (count($pluggables) == 0) {
return $this->error("Your application doesn't have any pluggables.");
}
$this->displayPluggables($this->getPluggables());
} | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"pluggables",
"=",
"$",
"this",
"->",
"pluggable",
"->",
"all",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"pluggables",
")",
"==",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"error",
"(",
"\"Y... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableListCommand.php#L47-L56 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableListCommand.php | PluggableListCommand.getPluggables | protected function getPluggables()
{
$pluggables = $this->pluggable->all();
$results = [];
foreach ($pluggables as $pluggable) {
$results[] = $this->getPluggableInformation($pluggable);
}
return array_filter($results);
} | php | protected function getPluggables()
{
$pluggables = $this->pluggable->all();
$results = [];
foreach ($pluggables as $pluggable) {
$results[] = $this->getPluggableInformation($pluggable);
}
return array_filter($results);
} | [
"protected",
"function",
"getPluggables",
"(",
")",
"{",
"$",
"pluggables",
"=",
"$",
"this",
"->",
"pluggable",
"->",
"all",
"(",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"pluggables",
"as",
"$",
"pluggable",
")",
"{",
"$",... | Get all pluggables.
@return array | [
"Get",
"all",
"pluggables",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableListCommand.php#L63-L73 |
gdbots/pbjx-bundle-php | src/EchoRequestHandler.php | EchoRequestHandler.handle | protected function handle(EchoRequest $request, Pbjx $pbjx): EchoResponse
{
return EchoResponseV1::create()->set('msg', $request->get('msg'));
} | php | protected function handle(EchoRequest $request, Pbjx $pbjx): EchoResponse
{
return EchoResponseV1::create()->set('msg', $request->get('msg'));
} | [
"protected",
"function",
"handle",
"(",
"EchoRequest",
"$",
"request",
",",
"Pbjx",
"$",
"pbjx",
")",
":",
"EchoResponse",
"{",
"return",
"EchoResponseV1",
"::",
"create",
"(",
")",
"->",
"set",
"(",
"'msg'",
",",
"$",
"request",
"->",
"get",
"(",
"'msg'... | @param EchoRequest $request
@param Pbjx $pbjx
@return EchoResponse | [
"@param",
"EchoRequest",
"$request",
"@param",
"Pbjx",
"$pbjx"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/EchoRequestHandler.php#L24-L27 |
blast-project/CoreBundle | src/Controller/CoreController.php | CoreController.searchAction | public function searchAction(Request $request)
{
if ($request->get('admin') && $request->isXmlHttpRequest()) {
try {
$admin = $this->getAdminPool()->getAdminByAdminCode($request->get('admin'));
} catch (ServiceNotFoundException $e) {
throw new \Runtime... | php | public function searchAction(Request $request)
{
if ($request->get('admin') && $request->isXmlHttpRequest()) {
try {
$admin = $this->getAdminPool()->getAdminByAdminCode($request->get('admin'));
} catch (ServiceNotFoundException $e) {
throw new \Runtime... | [
"public",
"function",
"searchAction",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"get",
"(",
"'admin'",
")",
"&&",
"$",
"request",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"try",
"{",
"$",
"admin",
"=",
"$",
"this... | @param Request $request
@return JsonResponse|Response
@throws \RuntimeException | [
"@param",
"Request",
"$request"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Controller/CoreController.php#L34-L78 |
stubbles/stubbles-webapp-core | src/main/php/auth/token/TokenAuthenticator.php | TokenAuthenticator.authenticate | public function authenticate(Request $request)
{
$token = $this->readToken($request);
if (null === $token || $token->isEmpty()) {
return $this->login($request);
}
try {
$user = $this->tokenStore->findUserByToken($request, $token);
return null === ... | php | public function authenticate(Request $request)
{
$token = $this->readToken($request);
if (null === $token || $token->isEmpty()) {
return $this->login($request);
}
try {
$user = $this->tokenStore->findUserByToken($request, $token);
return null === ... | [
"public",
"function",
"authenticate",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"readToken",
"(",
"$",
"request",
")",
";",
"if",
"(",
"null",
"===",
"$",
"token",
"||",
"$",
"token",
"->",
"isEmpty",
"(",
")",
... | authenticates that the given request is valid
@param \stubbles\webapp\Request $request
@return \stubbles\webapp\auth\User|null
@throws \stubbles\webapp\auth\InternalAuthProviderException | [
"authenticates",
"that",
"the",
"given",
"request",
"is",
"valid"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/token/TokenAuthenticator.php#L67-L83 |
stubbles/stubbles-webapp-core | src/main/php/auth/token/TokenAuthenticator.php | TokenAuthenticator.login | private function login(Request $request)
{
$user = $this->loginProvider->authenticate($request);
if (null !== $user) {
try {
$token = $user->createToken($this->tokenSalt);
$this->tokenStore->store($request, $token, $user);
return $user;
... | php | private function login(Request $request)
{
$user = $this->loginProvider->authenticate($request);
if (null !== $user) {
try {
$token = $user->createToken($this->tokenSalt);
$this->tokenStore->store($request, $token, $user);
return $user;
... | [
"private",
"function",
"login",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"loginProvider",
"->",
"authenticate",
"(",
"$",
"request",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"user",
")",
"{",
"try",
"{",
"$",
"... | performs login when token not found or invalid
@param \stubbles\webapp\Request $request
@return \stubbles\webapp\auth\User|null
@throws \stubbles\webapp\auth\InternalAuthProviderException | [
"performs",
"login",
"when",
"token",
"not",
"found",
"or",
"invalid"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/token/TokenAuthenticator.php#L92-L109 |
stubbles/stubbles-webapp-core | src/main/php/auth/token/TokenAuthenticator.php | TokenAuthenticator.readToken | private function readToken(Request $request)
{
if (!$request->hasRedirectHeader('HTTP_AUTHORIZATION')) {
return null;
}
return $request->readRedirectHeader('HTTP_AUTHORIZATION')
->withFilter(TokenFilter::instance());
} | php | private function readToken(Request $request)
{
if (!$request->hasRedirectHeader('HTTP_AUTHORIZATION')) {
return null;
}
return $request->readRedirectHeader('HTTP_AUTHORIZATION')
->withFilter(TokenFilter::instance());
} | [
"private",
"function",
"readToken",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"request",
"->",
"hasRedirectHeader",
"(",
"'HTTP_AUTHORIZATION'",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"request",
"->",
"readRedirectHead... | reads token from authorization header
@param \stubbles\webapp\Request $request current request
@return \stubbles\webapp\auth\Token|null | [
"reads",
"token",
"from",
"authorization",
"header"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/token/TokenAuthenticator.php#L117-L125 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/Column.php | Column.getColumnAttr | public function getColumnAttr()
{
$attr = [];
foreach ($this->column as $item) {
if (is_array($item))
$attr = array_merge($attr, $item);
else
$attr[] = $item;
}
return array_unique(array_values($attr));
} | php | public function getColumnAttr()
{
$attr = [];
foreach ($this->column as $item) {
if (is_array($item))
$attr = array_merge($attr, $item);
else
$attr[] = $item;
}
return array_unique(array_values($attr));
} | [
"public",
"function",
"getColumnAttr",
"(",
")",
"{",
"$",
"attr",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"column",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"item",
")",
")",
"$",
"attr",
"=",
"array_merge",
"... | Gets all column attributes.
@return array | [
"Gets",
"all",
"column",
"attributes",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/Column.php#L29-L41 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/Column.php | Column.hideColumn | public function hideColumn($column)
{
if (! is_array($column))
$column = [$column];
$newColumn = [];
foreach ($this->column as $item) {
if (is_array($item)) {
$new = array_values(array_diff($item, $column));
if (! empty($new))
... | php | public function hideColumn($column)
{
if (! is_array($column))
$column = [$column];
$newColumn = [];
foreach ($this->column as $item) {
if (is_array($item)) {
$new = array_values(array_diff($item, $column));
if (! empty($new))
... | [
"public",
"function",
"hideColumn",
"(",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"column",
")",
")",
"$",
"column",
"=",
"[",
"$",
"column",
"]",
";",
"$",
"newColumn",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",... | Remove one or more columns attributes
@param string|array $column
@return self | [
"Remove",
"one",
"or",
"more",
"columns",
"attributes"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/Column.php#L64-L85 |
drupol/valuewrapper | src/Object/AnonymousObject.php | AnonymousObject.hash | public function hash(): string
{
if ($this->value() instanceof Hashable) {
return $this->doHash($this->type() . $this->value()->hash());
}
throw new \Exception('The anonymous class must implement Hashable interface.');
} | php | public function hash(): string
{
if ($this->value() instanceof Hashable) {
return $this->doHash($this->type() . $this->value()->hash());
}
throw new \Exception('The anonymous class must implement Hashable interface.');
} | [
"public",
"function",
"hash",
"(",
")",
":",
"string",
"{",
"if",
"(",
"$",
"this",
"->",
"value",
"(",
")",
"instanceof",
"Hashable",
")",
"{",
"return",
"$",
"this",
"->",
"doHash",
"(",
"$",
"this",
"->",
"type",
"(",
")",
".",
"$",
"this",
"-... | {@inheritdoc} | [
"{"
] | train | https://github.com/drupol/valuewrapper/blob/49cc07e4d0284718c24ba6e9cf524c1f4226694e/src/Object/AnonymousObject.php#L17-L24 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesKeyframe.php | KeyframesKeyframe.checkValue | public function checkValue(&$value)
{
if (parent::checkValue($value) === true) {
if (!preg_match('/^(?:from|to|(?:\d{1,2}|100)%)$/D', $value)) {
$this->setIsValid(false);
$this->addValidationError("Invalid value '$value' for the keyframe selector.");
... | php | public function checkValue(&$value)
{
if (parent::checkValue($value) === true) {
if (!preg_match('/^(?:from|to|(?:\d{1,2}|100)%)$/D', $value)) {
$this->setIsValid(false);
$this->addValidationError("Invalid value '$value' for the keyframe selector.");
... | [
"public",
"function",
"checkValue",
"(",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"parent",
"::",
"checkValue",
"(",
"$",
"value",
")",
"===",
"true",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^(?:from|to|(?:\\d{1,2}|100)%)$/D'",
",",
"$",
"value",
... | Checks the keyframes selector value.
@param string $value
@return bool | [
"Checks",
"the",
"keyframes",
"selector",
"value",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesKeyframe.php#L25-L38 |
movoin/one-swoole | src/FileSystem/ContentListingFormatter.php | ContentListingFormatter.formatListing | public function formatListing(array $listing): array
{
$listing = array_values(
array_map(
[$this, 'addPathInfo'],
array_filter($listing, [$this, 'isEntryOutOfScope'])
)
);
return $this->sortListing($listing);
} | php | public function formatListing(array $listing): array
{
$listing = array_values(
array_map(
[$this, 'addPathInfo'],
array_filter($listing, [$this, 'isEntryOutOfScope'])
)
);
return $this->sortListing($listing);
} | [
"public",
"function",
"formatListing",
"(",
"array",
"$",
"listing",
")",
":",
"array",
"{",
"$",
"listing",
"=",
"array_values",
"(",
"array_map",
"(",
"[",
"$",
"this",
",",
"'addPathInfo'",
"]",
",",
"array_filter",
"(",
"$",
"listing",
",",
"[",
"$",... | 格式化列表
@param array $listing
@return array | [
"格式化列表"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/ContentListingFormatter.php#L47-L57 |
movoin/one-swoole | src/FileSystem/ContentListingFormatter.php | ContentListingFormatter.residesInDirectory | private function residesInDirectory(array $entry): bool
{
if ($this->directory === '') {
return true;
}
return strpos($entry['path'], $this->directory . '/') === 0;
} | php | private function residesInDirectory(array $entry): bool
{
if ($this->directory === '') {
return true;
}
return strpos($entry['path'], $this->directory . '/') === 0;
} | [
"private",
"function",
"residesInDirectory",
"(",
"array",
"$",
"entry",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"directory",
"===",
"''",
")",
"{",
"return",
"true",
";",
"}",
"return",
"strpos",
"(",
"$",
"entry",
"[",
"'path'",
"]",
"... | 返回是否在父目录中
@param $entry
@return bool | [
"返回是否在父目录中"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/ContentListingFormatter.php#L98-L105 |
movoin/one-swoole | src/FileSystem/ContentListingFormatter.php | ContentListingFormatter.pathinfo | private function pathinfo(string $path): array
{
$pathinfo = pathinfo($path) + compact('path');
$pathinfo['dirname'] = array_key_exists('dirname', $pathinfo) ?
$this->normalizeDirname($pathinfo['dirname']) :
'';
return $pathinfo;
} | php | private function pathinfo(string $path): array
{
$pathinfo = pathinfo($path) + compact('path');
$pathinfo['dirname'] = array_key_exists('dirname', $pathinfo) ?
$this->normalizeDirname($pathinfo['dirname']) :
'';
return $pathinfo;
} | [
"private",
"function",
"pathinfo",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"$",
"pathinfo",
"=",
"pathinfo",
"(",
"$",
"path",
")",
"+",
"compact",
"(",
"'path'",
")",
";",
"$",
"pathinfo",
"[",
"'dirname'",
"]",
"=",
"array_key_exists",
"(... | 标准化路径信息
@param string $path
@return array | [
"标准化路径信息"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/ContentListingFormatter.php#L145-L153 |
datasift/datasift-php | examples/historics/env.php | Env.displayHistoricDetails | public function displayHistoricDetails($hist)
{
echo 'Playback ID: '.$hist->getHash().PHP_EOL;
echo 'Stream hash: '.$hist->getStreamHash().PHP_EOL;
echo 'Name: '.$hist->getName().PHP_EOL;
echo 'Start time: '.date('r', $hist->getStartDate()).PHP_EOL;
echo 'End time: '.date('r', $hist->getEndDate())... | php | public function displayHistoricDetails($hist)
{
echo 'Playback ID: '.$hist->getHash().PHP_EOL;
echo 'Stream hash: '.$hist->getStreamHash().PHP_EOL;
echo 'Name: '.$hist->getName().PHP_EOL;
echo 'Start time: '.date('r', $hist->getStartDate()).PHP_EOL;
echo 'End time: '.date('r', $hist->getEndDate())... | [
"public",
"function",
"displayHistoricDetails",
"(",
"$",
"hist",
")",
"{",
"echo",
"'Playback ID: '",
".",
"$",
"hist",
"->",
"getHash",
"(",
")",
".",
"PHP_EOL",
";",
"echo",
"'Stream hash: '",
".",
"$",
"hist",
"->",
"getStreamHash",
"(",
")",
".",
"PHP... | Displays details of a Historics query.
@param DataSift_Historic $hist A DataSift Historics object | [
"Displays",
"details",
"of",
"a",
"Historics",
"query",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/examples/historics/env.php#L77-L89 |
discophp/framework | core/classes/DataModel.class.php | DataModel.verify | public final function verify(){
foreach($this->definition as $k => $v){
$this->verifyData($k);
}//foreach
if(count($this->errors)){
return false;
}//if
return true;
} | php | public final function verify(){
foreach($this->definition as $k => $v){
$this->verifyData($k);
}//foreach
if(count($this->errors)){
return false;
}//if
return true;
} | [
"public",
"final",
"function",
"verify",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"definition",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"verifyData",
"(",
"$",
"k",
")",
";",
"}",
"//foreach",
"if",
"(",
"count",
"("... | Verify the data in the data model. If the data model failed to verify use the method `getErrors()` to get
a list of the errors in the model.
@return boolean Whether the data in the data model passed verification. | [
"Verify",
"the",
"data",
"in",
"the",
"data",
"model",
".",
"If",
"the",
"data",
"model",
"failed",
"to",
"verify",
"use",
"the",
"method",
"getErrors",
"()",
"to",
"get",
"a",
"list",
"of",
"the",
"errors",
"in",
"the",
"model",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L125-L137 |
discophp/framework | core/classes/DataModel.class.php | DataModel.verifyOnly | public final function verifyOnly($fields){
foreach($fields as $k){
$this->verifyData($k);
}//foreach
if(count($this->errors)){
return false;
}//if
return true;
} | php | public final function verifyOnly($fields){
foreach($fields as $k){
$this->verifyData($k);
}//foreach
if(count($this->errors)){
return false;
}//if
return true;
} | [
"public",
"final",
"function",
"verifyOnly",
"(",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"k",
")",
"{",
"$",
"this",
"->",
"verifyData",
"(",
"$",
"k",
")",
";",
"}",
"//foreach",
"if",
"(",
"count",
"(",
"$",
"this",
... | Verify only the passed fields data. This comes in handy when you only want to verify a subset of the data
models definition.
@param array $fields The field data keys to verify.
@return boolean Whether the data in the passed fields passed verification. | [
"Verify",
"only",
"the",
"passed",
"fields",
"data",
".",
"This",
"comes",
"in",
"handy",
"when",
"you",
"only",
"want",
"to",
"verify",
"a",
"subset",
"of",
"the",
"data",
"models",
"definition",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L149-L161 |
discophp/framework | core/classes/DataModel.class.php | DataModel.verifySetData | public final function verifySetData(){
foreach($this->data as $k => $v){
$this->verifyData($k);
}//foreach
if(count($this->errors)){
return false;
}//if
return true;
} | php | public final function verifySetData(){
foreach($this->data as $k => $v){
$this->verifyData($k);
}//foreach
if(count($this->errors)){
return false;
}//if
return true;
} | [
"public",
"final",
"function",
"verifySetData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"verifyData",
"(",
"$",
"k",
")",
";",
"}",
"//foreach",
"if",
"(",
"count",
"(... | Verify only data that has been set in the data model and not all data defined by the definitions.
@return boolean Whether the set data passed verification. | [
"Verify",
"only",
"data",
"that",
"has",
"been",
"set",
"in",
"the",
"data",
"model",
"and",
"not",
"all",
"data",
"defined",
"by",
"the",
"definitions",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L170-L182 |
discophp/framework | core/classes/DataModel.class.php | DataModel.verifyData | public final function verifyData($key){
unset($this->errors[$key]);
if(!array_key_exists($key,$this->data)){
if(!array_key_exists($key,$this->definition)){
throw new \Disco\exceptions\Exception("Field `{$key}` is not defined by this data model");
}//if
... | php | public final function verifyData($key){
unset($this->errors[$key]);
if(!array_key_exists($key,$this->data)){
if(!array_key_exists($key,$this->definition)){
throw new \Disco\exceptions\Exception("Field `{$key}` is not defined by this data model");
}//if
... | [
"public",
"final",
"function",
"verifyData",
"(",
"$",
"key",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"key",
"]",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"data",
")",
")",
"{",... | Verify a single piece of data in the model. If the data fails to validate its corresponding error message
will be set in the errors by the same key.
@param string $key The key of the data.
@return boolean Whether the data passed verification.
@throws \Disco\exceptions\Exception When the data model doesn't define the... | [
"Verify",
"a",
"single",
"piece",
"of",
"data",
"in",
"the",
"model",
".",
"If",
"the",
"data",
"fails",
"to",
"validate",
"its",
"corresponding",
"error",
"message",
"will",
"be",
"set",
"in",
"the",
"errors",
"by",
"the",
"same",
"key",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L196-L384 |
discophp/framework | core/classes/DataModel.class.php | DataModel.setError | protected final function setError($key, $error = null){
if($e = $this->getDefinitionValue($key,'error')){
$error = $e;
} else if($error === null){
$error = sprintf($this->defaultErrorMessage,$key);
}//elif
$this->errors[$key] = $error;
return false;
} | php | protected final function setError($key, $error = null){
if($e = $this->getDefinitionValue($key,'error')){
$error = $e;
} else if($error === null){
$error = sprintf($this->defaultErrorMessage,$key);
}//elif
$this->errors[$key] = $error;
return false;
} | [
"protected",
"final",
"function",
"setError",
"(",
"$",
"key",
",",
"$",
"error",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"e",
"=",
"$",
"this",
"->",
"getDefinitionValue",
"(",
"$",
"key",
",",
"'error'",
")",
")",
"{",
"$",
"error",
"=",
"$",
"e... | Set an error.
@param string $key The data key.
@param null|string The error message to set, if null, the `defaultErrorMessage` will be used.
@return boolean Always returns false, which eases chaining in the `verifyData` method. | [
"Set",
"an",
"error",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L396-L404 |
discophp/framework | core/classes/DataModel.class.php | DataModel.getError | public function getError($key){
if(!isset($this->errors[$key])){
return false;
}//if
return $this->errors[$key];
} | php | public function getError($key){
if(!isset($this->errors[$key])){
return false;
}//if
return $this->errors[$key];
} | [
"public",
"function",
"getError",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"errors",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"//if",
"return",
"$",
"this",
"->",
"errors",
"[",
"$",
"... | Get an error.
@param string $key The data key.
@return boolean|string False if no error for `$key`, otherwise the error string. | [
"Get",
"an",
"error",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L415-L423 |
discophp/framework | core/classes/DataModel.class.php | DataModel.setDefinition | public final function setDefinition($key, $value){
if(array_key_exists($key, $this->definition)){
throw new \Disco\exceptions\Exception("Cannot override frozen data model definition `{$key}`");
}//if
$this->definition[$key] = $value;
} | php | public final function setDefinition($key, $value){
if(array_key_exists($key, $this->definition)){
throw new \Disco\exceptions\Exception("Cannot override frozen data model definition `{$key}`");
}//if
$this->definition[$key] = $value;
} | [
"public",
"final",
"function",
"setDefinition",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"definition",
")",
")",
"{",
"throw",
"new",
"\\",
"Disco",
"\\",
"exceptions",
"\\",
... | Set a datums definition. Cannot overwrite previously defined definitions.
@param string $key The definition key.
@param array $value The definition.
@throws \Disco\exceptions\Exception When setting the definition would override a frozen data model definition. | [
"Set",
"a",
"datums",
"definition",
".",
"Cannot",
"overwrite",
"previously",
"defined",
"definitions",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L480-L485 |
discophp/framework | core/classes/DataModel.class.php | DataModel.getDefinitionValue | public final function getDefinitionValue($key, $condition){
if(!array_key_exists($key, $this->definition) || !array_key_exists($condition, $this->definition[$key])){
return false;
}//if
return $this->definition[$key][$condition];
} | php | public final function getDefinitionValue($key, $condition){
if(!array_key_exists($key, $this->definition) || !array_key_exists($condition, $this->definition[$key])){
return false;
}//if
return $this->definition[$key][$condition];
} | [
"public",
"final",
"function",
"getDefinitionValue",
"(",
"$",
"key",
",",
"$",
"condition",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"definition",
")",
"||",
"!",
"array_key_exists",
"(",
"$",
"condition",
"... | Get a single value that resides within a single data definition.
@param string $key The definition key.
@param string $condition The definition key child key.
@param mixed False when the condition is not set, otherwise the condition value.
@return mixed | [
"Get",
"a",
"single",
"value",
"that",
"resides",
"within",
"a",
"single",
"data",
"definition",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L498-L503 |
discophp/framework | core/classes/DataModel.class.php | DataModel.offsetSet | public function offsetSet($key,$value){
if(!array_key_exists($key,$this->definition)){
throw new \Disco\exceptions\Exception("Field `{$key}` is not defined by this data model");
}//if
$this->data[$key] = $value;
} | php | public function offsetSet($key,$value){
if(!array_key_exists($key,$this->definition)){
throw new \Disco\exceptions\Exception("Field `{$key}` is not defined by this data model");
}//if
$this->data[$key] = $value;
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"definition",
")",
")",
"{",
"throw",
"new",
"\\",
"Disco",
"\\",
"exceptions",
"\\",
"Excep... | Set a field of the data model using array access syntax.
@param string $key The key.
@param mixed $value The value.
@throws \Disco\exceptions\Exception When the data model doesn't support that field. | [
"Set",
"a",
"field",
"of",
"the",
"data",
"model",
"using",
"array",
"access",
"syntax",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L601-L606 |
discophp/framework | core/classes/DataModel.class.php | DataModel._postMassage | protected final function _postMassage($key,$value){
//POSTMASSAGE
if(($massage = $this->getDefinitionValue($key,'postmassage')) !== false){
$this->data[$key] = $this->{$massage}($value);
}//if
} | php | protected final function _postMassage($key,$value){
//POSTMASSAGE
if(($massage = $this->getDefinitionValue($key,'postmassage')) !== false){
$this->data[$key] = $this->{$massage}($value);
}//if
} | [
"protected",
"final",
"function",
"_postMassage",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"//POSTMASSAGE",
"if",
"(",
"(",
"$",
"massage",
"=",
"$",
"this",
"->",
"getDefinitionValue",
"(",
"$",
"key",
",",
"'postmassage'",
")",
")",
"!==",
"false"... | Apply a post massage function to a data value.
@param string $key The data key.
@param mixed $value The data value. | [
"Apply",
"a",
"post",
"massage",
"function",
"to",
"a",
"data",
"value",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L644-L651 |
discophp/framework | core/classes/DataModel.class.php | DataModel._isValidInt | protected final function _isValidInt($key,$value){
if(!is_numeric($value) || strpos($value,'.') !== false){
return $this->setError($key,"`{$key}` must be a integer");
}//if
if(!$this->_isBetweenMinAndMax($key,$value)){
return false;
}//if
return true;
... | php | protected final function _isValidInt($key,$value){
if(!is_numeric($value) || strpos($value,'.') !== false){
return $this->setError($key,"`{$key}` must be a integer");
}//if
if(!$this->_isBetweenMinAndMax($key,$value)){
return false;
}//if
return true;
... | [
"protected",
"final",
"function",
"_isValidInt",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"value",
")",
"||",
"strpos",
"(",
"$",
"value",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"this"... | Determine if the value is a valid int.
@param string $key The data key.
@param mixed $value The data value.
@return boolean | [
"Determine",
"if",
"the",
"value",
"is",
"a",
"valid",
"int",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L663-L675 |
discophp/framework | core/classes/DataModel.class.php | DataModel._isValidFloat | protected final function _isValidFloat($key,$value){
if(!is_numeric($value)){
return $this->setError($key,"`{$key}` must be numeric");
}//if
if(!$this->_isBetweenMinAndMax($key,$value)){
return false;
}//if
return true;
} | php | protected final function _isValidFloat($key,$value){
if(!is_numeric($value)){
return $this->setError($key,"`{$key}` must be numeric");
}//if
if(!$this->_isBetweenMinAndMax($key,$value)){
return false;
}//if
return true;
} | [
"protected",
"final",
"function",
"_isValidFloat",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"setError",
"(",
"$",
"key",
",",
"\"`{$key}` must be numeric\""... | Determine if the value is a valid float.
@param string $key The data key.
@param mixed $value The data value.
@return boolean | [
"Determine",
"if",
"the",
"value",
"is",
"a",
"valid",
"float",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L687-L699 |
discophp/framework | core/classes/DataModel.class.php | DataModel._isBetweenMinAndMax | protected final function _isBetweenMinAndMax($key,$value){
if(($min = $this->getDefinitionValue($key,'min')) !== false && $value < $min){
return $this->setError($key,"`{$key}` must be greater than {$min}");
}//if
if(($max = $this->getDefinitionValue($key,'max')) !== false && $value... | php | protected final function _isBetweenMinAndMax($key,$value){
if(($min = $this->getDefinitionValue($key,'min')) !== false && $value < $min){
return $this->setError($key,"`{$key}` must be greater than {$min}");
}//if
if(($max = $this->getDefinitionValue($key,'max')) !== false && $value... | [
"protected",
"final",
"function",
"_isBetweenMinAndMax",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"(",
"$",
"min",
"=",
"$",
"this",
"->",
"getDefinitionValue",
"(",
"$",
"key",
",",
"'min'",
")",
")",
"!==",
"false",
"&&",
"$",
"valu... | Determine if the value is greater than `min` if set, and less than `max` if set.
@param string $key The data key.
@param mixed $value The data value.
@return boolean | [
"Determine",
"if",
"the",
"value",
"is",
"greater",
"than",
"min",
"if",
"set",
"and",
"less",
"than",
"max",
"if",
"set",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/DataModel.class.php#L711-L723 |
acasademont/wurfl | examples/Introspector.php | ScientiaMobileIntrospector_Controller.prettyJSON | public static function prettyJSON($json)
{
$result = '';
$pos = 0;
$strLen = strlen($json);
$indentStr = ' ';
$newLine = "\n";
$prevChar = '';
$outOfQuotes = true;
for ($i=0; $i<=$strLen; $i++) {
$char = substr($... | php | public static function prettyJSON($json)
{
$result = '';
$pos = 0;
$strLen = strlen($json);
$indentStr = ' ';
$newLine = "\n";
$prevChar = '';
$outOfQuotes = true;
for ($i=0; $i<=$strLen; $i++) {
$char = substr($... | [
"public",
"static",
"function",
"prettyJSON",
"(",
"$",
"json",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"pos",
"=",
"0",
";",
"$",
"strLen",
"=",
"strlen",
"(",
"$",
"json",
")",
";",
"$",
"indentStr",
"=",
"' '",
";",
"$",
"newLine",
"=",... | Indents a flat JSON string to make it more human-readable.
@param string $json The original JSON string to process.
@return string Indented version of the original JSON string.
@author Unknown: http://recursive-design.com/blog/2008/03/11/format-json-with-php/ | [
"Indents",
"a",
"flat",
"JSON",
"string",
"to",
"make",
"it",
"more",
"human",
"-",
"readable",
"."
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/examples/Introspector.php#L243-L276 |
bestit/commercetools-order-export-bundle | src/Command/ExportCommand.php | ExportCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$logger = $this->getLogger();
if (!$this->lock()) {
$output->writeln('<comment>The command is already running in another process.</comment>');
$logger->warning('Command is already running.');
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$logger = $this->getLogger();
if (!$this->lock()) {
$output->writeln('<comment>The command is already running in another process.</comment>');
$logger->warning('Command is already running.');
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"lock",
"(",
")",
")",
"{"... | Executes the command.
@param InputInterface $input
@param OutputInterface $output
@return void | [
"Executes",
"the",
"command",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/Command/ExportCommand.php#L85-L105 |
bestit/commercetools-order-export-bundle | src/Command/ExportCommand.php | ExportCommand.getProgressBar | private function getProgressBar(OutputInterface $output, int $total): ProgressBar
{
return $this->getProgressBarFactory()->getProgressBar($output, $total);
} | php | private function getProgressBar(OutputInterface $output, int $total): ProgressBar
{
return $this->getProgressBarFactory()->getProgressBar($output, $total);
} | [
"private",
"function",
"getProgressBar",
"(",
"OutputInterface",
"$",
"output",
",",
"int",
"$",
"total",
")",
":",
"ProgressBar",
"{",
"return",
"$",
"this",
"->",
"getProgressBarFactory",
"(",
")",
"->",
"getProgressBar",
"(",
"$",
"output",
",",
"$",
"tot... | Returns the progress bar from the factory.
@param OutputInterface $output
@param int $total
@return ProgressBar | [
"Returns",
"the",
"progress",
"bar",
"from",
"the",
"factory",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/Command/ExportCommand.php#L140-L143 |
huasituo/hstcms | src/Providers/ConsoleServiceProvider.php | ConsoleServiceProvider.register | public function register()
{
$this->registerInstallCommand();
$this->registerInfoCommand();
$this->registerSeedCommand();
$this->registerCacheCommand();
$this->registerHookCommand();
} | php | public function register()
{
$this->registerInstallCommand();
$this->registerInfoCommand();
$this->registerSeedCommand();
$this->registerCacheCommand();
$this->registerHookCommand();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerInstallCommand",
"(",
")",
";",
"$",
"this",
"->",
"registerInfoCommand",
"(",
")",
";",
"$",
"this",
"->",
"registerSeedCommand",
"(",
")",
";",
"$",
"this",
"->",
"registerCache... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/ConsoleServiceProvider.php#L25-L32 |
huasituo/hstcms | src/Providers/ConsoleServiceProvider.php | ConsoleServiceProvider.registerInstallCommand | protected function registerInstallCommand()
{
$this->app->singleton('command.hstcms.install', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsInstallCommand($app['hstcms']);
});
$this->commands('command.hstcms.install');
} | php | protected function registerInstallCommand()
{
$this->app->singleton('command.hstcms.install', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsInstallCommand($app['hstcms']);
});
$this->commands('command.hstcms.install');
} | [
"protected",
"function",
"registerInstallCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'command.hstcms.install'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"\\",
"Huasituo",
"\\",
"Hstcms",
"\\",
"Console",
"\... | Register the hstcms.install command. | [
"Register",
"the",
"hstcms",
".",
"install",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/ConsoleServiceProvider.php#L37-L43 |
huasituo/hstcms | src/Providers/ConsoleServiceProvider.php | ConsoleServiceProvider.registerInfoCommand | protected function registerInfoCommand()
{
$this->app->singleton('command.hstcms.info', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsInfoCommand($app['hstcms']);
});
$this->commands('command.hstcms.info');
} | php | protected function registerInfoCommand()
{
$this->app->singleton('command.hstcms.info', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsInfoCommand($app['hstcms']);
});
$this->commands('command.hstcms.info');
} | [
"protected",
"function",
"registerInfoCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'command.hstcms.info'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"\\",
"Huasituo",
"\\",
"Hstcms",
"\\",
"Console",
"\\",
... | Register the hstcms.info command. | [
"Register",
"the",
"hstcms",
".",
"info",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/ConsoleServiceProvider.php#L48-L54 |
huasituo/hstcms | src/Providers/ConsoleServiceProvider.php | ConsoleServiceProvider.registerSeedCommand | protected function registerSeedCommand()
{
$this->app->singleton('command.hstcms.seed', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsSeedCommand($app['hstcms']);
});
$this->commands('command.hstcms.seed');
} | php | protected function registerSeedCommand()
{
$this->app->singleton('command.hstcms.seed', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsSeedCommand($app['hstcms']);
});
$this->commands('command.hstcms.seed');
} | [
"protected",
"function",
"registerSeedCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'command.hstcms.seed'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"\\",
"Huasituo",
"\\",
"Hstcms",
"\\",
"Console",
"\\",
... | Register the module:seed command. | [
"Register",
"the",
"module",
":",
"seed",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/ConsoleServiceProvider.php#L59-L65 |
huasituo/hstcms | src/Providers/ConsoleServiceProvider.php | ConsoleServiceProvider.registerCacheCommand | protected function registerCacheCommand()
{
$this->app->singleton('command.hstcms.cache', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsCacheCommand($app['hstcms']);
});
$this->commands('command.hstcms.cache');
} | php | protected function registerCacheCommand()
{
$this->app->singleton('command.hstcms.cache', function ($app) {
return new \Huasituo\Hstcms\Console\Commands\HstcmsCacheCommand($app['hstcms']);
});
$this->commands('command.hstcms.cache');
} | [
"protected",
"function",
"registerCacheCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'command.hstcms.cache'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"\\",
"Huasituo",
"\\",
"Hstcms",
"\\",
"Console",
"\\",
... | Register the module:cache command. | [
"Register",
"the",
"module",
":",
"cache",
"command",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Providers/ConsoleServiceProvider.php#L70-L76 |
datasift/datasift-php | lib/DataSift/StreamConsumer/HTTP.php | DataSift_StreamConsumer_HTTP.onStart | protected function onStart()
{
do {
// Disconnect and reconnect
$this->reconnect();
// If we successfully connected and we're supposed to be running,
// call the onConnect event
if ($this->_conn && ! feof($this->_conn) && $this->_state == parent::... | php | protected function onStart()
{
do {
// Disconnect and reconnect
$this->reconnect();
// If we successfully connected and we're supposed to be running,
// call the onConnect event
if ($this->_conn && ! feof($this->_conn) && $this->_state == parent::... | [
"protected",
"function",
"onStart",
"(",
")",
"{",
"do",
"{",
"// Disconnect and reconnect",
"$",
"this",
"->",
"reconnect",
"(",
")",
";",
"// If we successfully connected and we're supposed to be running,",
"// call the onConnect event",
"if",
"(",
"$",
"this",
"->",
... | SetUp
@return void | [
"SetUp"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer/HTTP.php#L94-L172 |
datasift/datasift-php | lib/DataSift/StreamConsumer/HTTP.php | DataSift_StreamConsumer_HTTP.connect | private function connect()
{
$this->_state = parent::STATE_STARTING;
// Build the URL and parse it
$protocol = 'http' . ($this->_user->useSSL() ? 's' : '');
if ($this->_is_multi) {
$url = $protocol . '://' . $this->_user->getStreamUrl() . 'multi';
} else {
... | php | private function connect()
{
$this->_state = parent::STATE_STARTING;
// Build the URL and parse it
$protocol = 'http' . ($this->_user->useSSL() ? 's' : '');
if ($this->_is_multi) {
$url = $protocol . '://' . $this->_user->getStreamUrl() . 'multi';
} else {
... | [
"private",
"function",
"connect",
"(",
")",
"{",
"$",
"this",
"->",
"_state",
"=",
"parent",
"::",
"STATE_STARTING",
";",
"// Build the URL and parse it",
"$",
"protocol",
"=",
"'http'",
".",
"(",
"$",
"this",
"->",
"_user",
"->",
"useSSL",
"(",
")",
"?",
... | Connect to the DataSift HTTP stream
@return void | [
"Connect",
"to",
"the",
"DataSift",
"HTTP",
"stream"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer/HTTP.php#L179-L293 |
datasift/datasift-php | lib/DataSift/StreamConsumer/HTTP.php | DataSift_StreamConsumer_HTTP.disconnect | private function disconnect()
{
if (is_resource($this->_conn)) {
fclose($this->_conn);
}
$this->_auto_reconnect = false;
$this->_conn = null;
} | php | private function disconnect()
{
if (is_resource($this->_conn)) {
fclose($this->_conn);
}
$this->_auto_reconnect = false;
$this->_conn = null;
} | [
"private",
"function",
"disconnect",
"(",
")",
"{",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->",
"_conn",
")",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"_conn",
")",
";",
"}",
"$",
"this",
"->",
"_auto_reconnect",
"=",
"false",
";",
"$",
"t... | Disconnect from the DataSift stream
@return void | [
"Disconnect",
"from",
"the",
"DataSift",
"stream"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer/HTTP.php#L300-L307 |
datasift/datasift-php | lib/DataSift/StreamConsumer/HTTP.php | DataSift_StreamConsumer_HTTP.reconnect | private function reconnect()
{
$auto = $this->_auto_reconnect;
$this->disconnect();
$this->auto_reconnect = $auto;
$this->connect();
} | php | private function reconnect()
{
$auto = $this->_auto_reconnect;
$this->disconnect();
$this->auto_reconnect = $auto;
$this->connect();
} | [
"private",
"function",
"reconnect",
"(",
")",
"{",
"$",
"auto",
"=",
"$",
"this",
"->",
"_auto_reconnect",
";",
"$",
"this",
"->",
"disconnect",
"(",
")",
";",
"$",
"this",
"->",
"auto_reconnect",
"=",
"$",
"auto",
";",
"$",
"this",
"->",
"connect",
... | Reconnect to the DataSift stream
@return void | [
"Reconnect",
"to",
"the",
"DataSift",
"stream"
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/StreamConsumer/HTTP.php#L314-L320 |
fanout/laravel-fanout | src/FanoutBroadcaster.php | FanoutBroadcaster.broadcast | public function broadcast(array $channels, $event, array $payload = [])
{
$payload = ['event' => $event, 'data' => $payload];
foreach ($channels as $channel) {
if ($this->async)
$this->fanout->publish_async($channel, $payload);
else
$this->fano... | php | public function broadcast(array $channels, $event, array $payload = [])
{
$payload = ['event' => $event, 'data' => $payload];
foreach ($channels as $channel) {
if ($this->async)
$this->fanout->publish_async($channel, $payload);
else
$this->fano... | [
"public",
"function",
"broadcast",
"(",
"array",
"$",
"channels",
",",
"$",
"event",
",",
"array",
"$",
"payload",
"=",
"[",
"]",
")",
"{",
"$",
"payload",
"=",
"[",
"'event'",
"=>",
"$",
"event",
",",
"'data'",
"=>",
"$",
"payload",
"]",
";",
"for... | Broadcast the given event.
@param array $channels
@param string $event
@param array $payload
@return void | [
"Broadcast",
"the",
"given",
"event",
"."
] | train | https://github.com/fanout/laravel-fanout/blob/3d9e776c9bedf327646b1f931dcadf52587f9c36/src/FanoutBroadcaster.php#L58-L67 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.handleAction | public function handleAction(Request $request): Envelope
{
$request->attributes->set('pbjx_redact_error_message', false);
$envelope = EnvelopeV1::create();
if (!$this->isRequestMethodOk($envelope, $request) || !$this->isContentTypeOk($envelope, $request)) {
return $envelope;
... | php | public function handleAction(Request $request): Envelope
{
$request->attributes->set('pbjx_redact_error_message', false);
$envelope = EnvelopeV1::create();
if (!$this->isRequestMethodOk($envelope, $request) || !$this->isContentTypeOk($envelope, $request)) {
return $envelope;
... | [
"public",
"function",
"handleAction",
"(",
"Request",
"$",
"request",
")",
":",
"Envelope",
"{",
"$",
"request",
"->",
"attributes",
"->",
"set",
"(",
"'pbjx_redact_error_message'",
",",
"false",
")",
";",
"$",
"envelope",
"=",
"EnvelopeV1",
"::",
"create",
... | @param Request $request
@return Envelope
@throws \Throwable | [
"@param",
"Request",
"$request"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L76-L198 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.handleCommand | private function handleCommand(Envelope $envelope, Request $request, Command $command): Envelope
{
try {
$this->pbjx->send($command);
} catch (\Throwable $e) {
return $this->handleException($envelope, $request, $command, $e);
}
$envelope
->set('co... | php | private function handleCommand(Envelope $envelope, Request $request, Command $command): Envelope
{
try {
$this->pbjx->send($command);
} catch (\Throwable $e) {
return $this->handleException($envelope, $request, $command, $e);
}
$envelope
->set('co... | [
"private",
"function",
"handleCommand",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
",",
"Command",
"$",
"command",
")",
":",
"Envelope",
"{",
"try",
"{",
"$",
"this",
"->",
"pbjx",
"->",
"send",
"(",
"$",
"command",
")",
";",
"}"... | @param Envelope $envelope
@param Request $request
@param Command $command
@return Envelope | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request",
"@param",
"Command",
"$command"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L207-L225 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.handleEvent | private function handleEvent(Envelope $envelope, Request $request, Event $event): Envelope
{
try {
$this->pbjx->publish($event);
} catch (\Throwable $e) {
return $this->handleException($envelope, $request, $event, $e);
}
$envelope
->set('code', Co... | php | private function handleEvent(Envelope $envelope, Request $request, Event $event): Envelope
{
try {
$this->pbjx->publish($event);
} catch (\Throwable $e) {
return $this->handleException($envelope, $request, $event, $e);
}
$envelope
->set('code', Co... | [
"private",
"function",
"handleEvent",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
",",
"Event",
"$",
"event",
")",
":",
"Envelope",
"{",
"try",
"{",
"$",
"this",
"->",
"pbjx",
"->",
"publish",
"(",
"$",
"event",
")",
";",
"}",
"... | @param Envelope $envelope
@param Request $request
@param Event $event
@return Envelope | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request",
"@param",
"Event",
"$event"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L234-L252 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.handleRequest | private function handleRequest(Envelope $envelope, Request $request, PbjxRequest $pbjxRequest): Envelope
{
try {
$response = $this->pbjx->request($pbjxRequest);
} catch (\Throwable $e) {
return $this->handleException($envelope, $request, $pbjxRequest, $e);
}
... | php | private function handleRequest(Envelope $envelope, Request $request, PbjxRequest $pbjxRequest): Envelope
{
try {
$response = $this->pbjx->request($pbjxRequest);
} catch (\Throwable $e) {
return $this->handleException($envelope, $request, $pbjxRequest, $e);
}
... | [
"private",
"function",
"handleRequest",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
",",
"PbjxRequest",
"$",
"pbjxRequest",
")",
":",
"Envelope",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"pbjx",
"->",
"request",
"(",
... | @param Envelope $envelope
@param Request $request
@param PbjxRequest $pbjxRequest
@return Envelope | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request",
"@param",
"PbjxRequest",
"$pbjxRequest"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L261-L275 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.handleException | private function handleException(Envelope $envelope, Request $request, Message $message, \Throwable $exception): Envelope
{
if ($exception instanceof HasEndUserMessage) {
$code = $exception->getCode();
$httpCode = StatusCodeConverter::vendorToHttp($code);
$errorName = Cla... | php | private function handleException(Envelope $envelope, Request $request, Message $message, \Throwable $exception): Envelope
{
if ($exception instanceof HasEndUserMessage) {
$code = $exception->getCode();
$httpCode = StatusCodeConverter::vendorToHttp($code);
$errorName = Cla... | [
"private",
"function",
"handleException",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
",",
"Message",
"$",
"message",
",",
"\\",
"Throwable",
"$",
"exception",
")",
":",
"Envelope",
"{",
"if",
"(",
"$",
"exception",
"instanceof",
"HasEn... | @param Envelope $envelope
@param Request $request
@param Message $message
@param \Throwable $exception
@return Envelope | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request",
"@param",
"Message",
"$message",
"@param",
"\\",
"Throwable",
"$exception"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L285-L323 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.isPbjxTokenOk | private function isPbjxTokenOk(Envelope $envelope, Request $request, string $content): bool
{
if ($request->attributes->getBoolean('pbjx_console')) {
// no tokens used on the console
return true;
}
$curie = $request->attributes->get('pbjx_curie');
foreach ($t... | php | private function isPbjxTokenOk(Envelope $envelope, Request $request, string $content): bool
{
if ($request->attributes->getBoolean('pbjx_console')) {
// no tokens used on the console
return true;
}
$curie = $request->attributes->get('pbjx_curie');
foreach ($t... | [
"private",
"function",
"isPbjxTokenOk",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
",",
"string",
"$",
"content",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"request",
"->",
"attributes",
"->",
"getBoolean",
"(",
"'pbjx_console'",
")",
"... | @param Envelope $envelope
@param Request $request
@param string $content
@return bool | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request",
"@param",
"string",
"$content"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L332-L383 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.isRequestMethodOk | private function isRequestMethodOk(Envelope $envelope, Request $request): bool
{
if (in_array($request->getMethod(), $this->allowedMethods)) {
return true;
}
$envelope
->set('code', Code::UNIMPLEMENTED)
->set('http_code', HttpCode::HTTP_METHOD_NOT_ALLOWED... | php | private function isRequestMethodOk(Envelope $envelope, Request $request): bool
{
if (in_array($request->getMethod(), $this->allowedMethods)) {
return true;
}
$envelope
->set('code', Code::UNIMPLEMENTED)
->set('http_code', HttpCode::HTTP_METHOD_NOT_ALLOWED... | [
"private",
"function",
"isRequestMethodOk",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
")",
":",
"bool",
"{",
"if",
"(",
"in_array",
"(",
"$",
"request",
"->",
"getMethod",
"(",
")",
",",
"$",
"this",
"->",
"allowedMethods",
")",
"... | @param Envelope $envelope
@param Request $request
@return bool | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L391-L407 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.isContentTypeOk | private function isContentTypeOk(Envelope $envelope, Request $request): bool
{
if ($request->query->has('callback') && $request->isMethod('GET')) {
// jsonp request, don't enforce
$request->attributes->set('_jsonp_enabled', true);
return true;
}
$request-... | php | private function isContentTypeOk(Envelope $envelope, Request $request): bool
{
if ($request->query->has('callback') && $request->isMethod('GET')) {
// jsonp request, don't enforce
$request->attributes->set('_jsonp_enabled', true);
return true;
}
$request-... | [
"private",
"function",
"isContentTypeOk",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"request",
"->",
"query",
"->",
"has",
"(",
"'callback'",
")",
"&&",
"$",
"request",
"->",
"isMethod",
"(",... | @param Envelope $envelope
@param Request $request
@return bool | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L415-L443 |
gdbots/pbjx-bundle-php | src/Controller/PbjxController.php | PbjxController.isJsonOk | private function isJsonOk(Envelope $envelope, Request $request): bool
{
if (JSON_ERROR_NONE === json_last_error()) {
return true;
}
$envelope
->set('code', Code::INVALID_ARGUMENT)
->set('http_code', HttpCode::HTTP_UNSUPPORTED_MEDIA_TYPE())
->s... | php | private function isJsonOk(Envelope $envelope, Request $request): bool
{
if (JSON_ERROR_NONE === json_last_error()) {
return true;
}
$envelope
->set('code', Code::INVALID_ARGUMENT)
->set('http_code', HttpCode::HTTP_UNSUPPORTED_MEDIA_TYPE())
->s... | [
"private",
"function",
"isJsonOk",
"(",
"Envelope",
"$",
"envelope",
",",
"Request",
"$",
"request",
")",
":",
"bool",
"{",
"if",
"(",
"JSON_ERROR_NONE",
"===",
"json_last_error",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"envelope",
"->",
"se... | @param Envelope $envelope
@param Request $request
@return bool | [
"@param",
"Envelope",
"$envelope",
"@param",
"Request",
"$request"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Controller/PbjxController.php#L451-L464 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/InterfaceTrans.php | InterfaceTrans.getInterfaceTrans | public function getInterfaceTrans()
{
$locale = config('app.locale');
$file = config('crude.defaultInterfaceTrans');
if ($file == 'CrudeCRUD::crude') {
$available = ['en', 'pl'];
$locale = in_array($locale, $available) ? $locale : 'en';
}
$this->inte... | php | public function getInterfaceTrans()
{
$locale = config('app.locale');
$file = config('crude.defaultInterfaceTrans');
if ($file == 'CrudeCRUD::crude') {
$available = ['en', 'pl'];
$locale = in_array($locale, $available) ? $locale : 'en';
}
$this->inte... | [
"public",
"function",
"getInterfaceTrans",
"(",
")",
"{",
"$",
"locale",
"=",
"config",
"(",
"'app.locale'",
")",
";",
"$",
"file",
"=",
"config",
"(",
"'crude.defaultInterfaceTrans'",
")",
";",
"if",
"(",
"$",
"file",
"==",
"'CrudeCRUD::crude'",
")",
"{",
... | Gets the interface and api labels and messages.
@return array | [
"Gets",
"the",
"interface",
"and",
"api",
"labels",
"and",
"messages",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/InterfaceTrans.php#L19-L35 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/InterfaceTrans.php | InterfaceTrans.setInterfaceTrans | public function setInterfaceTrans($attr, $value = null)
{
if (is_array($attr))
$this->interfaceTrans = array_merge($this->interfaceTrans, $attr);
else
$this->interfaceTrans[$attr] = $value;
return $this;
} | php | public function setInterfaceTrans($attr, $value = null)
{
if (is_array($attr))
$this->interfaceTrans = array_merge($this->interfaceTrans, $attr);
else
$this->interfaceTrans[$attr] = $value;
return $this;
} | [
"public",
"function",
"setInterfaceTrans",
"(",
"$",
"attr",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"attr",
")",
")",
"$",
"this",
"->",
"interfaceTrans",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"interfaceTrans",
... | Sets the interface and api labels and messages.
@param string|array $attr
@param array $value
@return self | [
"Sets",
"the",
"interface",
"and",
"api",
"labels",
"and",
"messages",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/InterfaceTrans.php#L52-L60 |
prooph/link-app-core | src/Service/AbstractRestController.php | AbstractRestController.location | protected function location($url)
{
/** @var $response Response */
$response = $this->getResponse();
$response->getHeaders()
->addHeaderLine(
'Location',
$url
);
$response->setStatusCode(201);
return $response;
} | php | protected function location($url)
{
/** @var $response Response */
$response = $this->getResponse();
$response->getHeaders()
->addHeaderLine(
'Location',
$url
);
$response->setStatusCode(201);
return $response;
} | [
"protected",
"function",
"location",
"(",
"$",
"url",
")",
"{",
"/** @var $response Response */",
"$",
"response",
"=",
"$",
"this",
"->",
"getResponse",
"(",
")",
";",
"$",
"response",
"->",
"getHeaders",
"(",
")",
"->",
"addHeaderLine",
"(",
"'Location'",
... | Returns a 201 response with a Location header
@param string $url
@return Response | [
"Returns",
"a",
"201",
"response",
"with",
"a",
"Location",
"header"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Service/AbstractRestController.php#L205-L219 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Response/Preprocessor/Status100.php | Status100.consolidate | public function consolidate(Response $response) {
$response->getContent()->set(null);
$response->getHeaders()->delete('Content-Type');
$response->getHeaders()->delete('Content-Length');
} | php | public function consolidate(Response $response) {
$response->getContent()->set(null);
$response->getHeaders()->delete('Content-Type');
$response->getHeaders()->delete('Content-Length');
} | [
"public",
"function",
"consolidate",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"response",
"->",
"getContent",
"(",
")",
"->",
"set",
"(",
"null",
")",
";",
"$",
"response",
"->",
"getHeaders",
"(",
")",
"->",
"delete",
"(",
"'Content-Type'",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Response/Preprocessor/Status100.php#L28-L34 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.withSkip | public function withSkip(string $name): self
{
$clone = clone $this;
if (array_key_exists($name, $clone->skips)) {
$clone->skips[$name] = 1;
}
return $clone;
} | php | public function withSkip(string $name): self
{
$clone = clone $this;
if (array_key_exists($name, $clone->skips)) {
$clone->skips[$name] = 1;
}
return $clone;
} | [
"public",
"function",
"withSkip",
"(",
"string",
"$",
"name",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"clone",
"->",
"skips",
")",
")",
"{",
"$",
"clone",
"->",... | 设置忽略类型
@param string $name
@return self | [
"设置忽略类型"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L158-L167 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.withPath | public function withPath(string $path): self
{
$this->assertPresent($path);
if ($this->path === $path) {
return $this;
}
$clone = clone $this;
$clone->path = $path;
return $clone;
} | php | public function withPath(string $path): self
{
$this->assertPresent($path);
if ($this->path === $path) {
return $this;
}
$clone = clone $this;
$clone->path = $path;
return $clone;
} | [
"public",
"function",
"withPath",
"(",
"string",
"$",
"path",
")",
":",
"self",
"{",
"$",
"this",
"->",
"assertPresent",
"(",
"$",
"path",
")",
";",
"if",
"(",
"$",
"this",
"->",
"path",
"===",
"$",
"path",
")",
"{",
"return",
"$",
"this",
";",
"... | 设置路径
@param string $path
@return self
@throws \InvalidArgumentException | [
"设置路径"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L209-L221 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.withExtension | public function withExtension(string $extension): self
{
if ($this->extension === $extension) {
return $this;
}
$clone = clone $this;
$clone->extension = strtolower($extension);
return $clone;
} | php | public function withExtension(string $extension): self
{
if ($this->extension === $extension) {
return $this;
}
$clone = clone $this;
$clone->extension = strtolower($extension);
return $clone;
} | [
"public",
"function",
"withExtension",
"(",
"string",
"$",
"extension",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"extension",
"===",
"$",
"extension",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"clone",
"=",
"clone",
"$",
"this",
";"... | 设置文件扩展名
@param string $extension
@return self | [
"设置文件扩展名"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L249-L259 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.getClassName | public function getClassName(SplFileInfo $file): string
{
return
rtrim($this->getRootNamespace(), '\\') .
str_replace('/', '\\', str_replace($this->getAppPath(), '', $file->getPath())) .
'\\' .
$file->getBasename('.' . $file->getExtension())
;
} | php | public function getClassName(SplFileInfo $file): string
{
return
rtrim($this->getRootNamespace(), '\\') .
str_replace('/', '\\', str_replace($this->getAppPath(), '', $file->getPath())) .
'\\' .
$file->getBasename('.' . $file->getExtension())
;
} | [
"public",
"function",
"getClassName",
"(",
"SplFileInfo",
"$",
"file",
")",
":",
"string",
"{",
"return",
"rtrim",
"(",
"$",
"this",
"->",
"getRootNamespace",
"(",
")",
",",
"'\\\\'",
")",
".",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",
",",
"str_replace",
... | 获得路径对应的命名空间
@param \SplFileInfo $file
@return string | [
"获得路径对应的命名空间"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L268-L276 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.getRootNamespace | public function getRootNamespace(): string
{
if (! is_null(static::$namespace)) {
return static::$namespace;
}
$composer = Json::decode(file_get_contents($this->getRootPath() . '/composer.json'));
foreach ((array) Arr::get($composer, 'autoload.psr-4', []) as $namespace ... | php | public function getRootNamespace(): string
{
if (! is_null(static::$namespace)) {
return static::$namespace;
}
$composer = Json::decode(file_get_contents($this->getRootPath() . '/composer.json'));
foreach ((array) Arr::get($composer, 'autoload.psr-4', []) as $namespace ... | [
"public",
"function",
"getRootNamespace",
"(",
")",
":",
"string",
"{",
"if",
"(",
"!",
"is_null",
"(",
"static",
"::",
"$",
"namespace",
")",
")",
"{",
"return",
"static",
"::",
"$",
"namespace",
";",
"}",
"$",
"composer",
"=",
"Json",
"::",
"decode",... | 获得应用命名空间
@return string | [
"获得应用命名空间"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L283-L303 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.getIterator | public function getIterator(): Iterator
{
return new CallbackFilterIterator(
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($this->path, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
),
function ($cur... | php | public function getIterator(): Iterator
{
return new CallbackFilterIterator(
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($this->path, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
),
function ($cur... | [
"public",
"function",
"getIterator",
"(",
")",
":",
"Iterator",
"{",
"return",
"new",
"CallbackFilterIterator",
"(",
"new",
"RecursiveIteratorIterator",
"(",
"new",
"RecursiveDirectoryIterator",
"(",
"$",
"this",
"->",
"path",
",",
"FilesystemIterator",
"::",
"SKIP_... | 获得扁平化结果
@return /Iterator | [
"获得扁平化结果"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L310-L321 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.match | protected function match(SplFileInfo $file): bool
{
return $file->isFile() &&
$this->hasExtension($file) &&
$this->instanceOf($file)
;
} | php | protected function match(SplFileInfo $file): bool
{
return $file->isFile() &&
$this->hasExtension($file) &&
$this->instanceOf($file)
;
} | [
"protected",
"function",
"match",
"(",
"SplFileInfo",
"$",
"file",
")",
":",
"bool",
"{",
"return",
"$",
"file",
"->",
"isFile",
"(",
")",
"&&",
"$",
"this",
"->",
"hasExtension",
"(",
"$",
"file",
")",
"&&",
"$",
"this",
"->",
"instanceOf",
"(",
"$"... | 匹配文件
@param \SplFileInfo $file
@return bool | [
"匹配文件"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L340-L346 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.hasExtension | protected function hasExtension(SplFileInfo $file): bool
{
if ($this->extension === null) {
return true;
}
return strtolower($file->getExtension()) === strtolower($this->extension);
} | php | protected function hasExtension(SplFileInfo $file): bool
{
if ($this->extension === null) {
return true;
}
return strtolower($file->getExtension()) === strtolower($this->extension);
} | [
"protected",
"function",
"hasExtension",
"(",
"SplFileInfo",
"$",
"file",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"extension",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"strtolower",
"(",
"$",
"file",
"->",
"getExtension... | 判断文件是否为指定扩展名
@param \SplFileInfo $file
@return bool | [
"判断文件是否为指定扩展名"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L355-L362 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.instanceOf | protected function instanceOf(SplFileInfo $file): bool
{
$reflecter = new ReflectionClass($this->getClassName($file));
if (! $this->isSkip($reflecter)) {
if ($this->interface === null) {
return true;
}
return (bool) $reflecter->implementsInterface... | php | protected function instanceOf(SplFileInfo $file): bool
{
$reflecter = new ReflectionClass($this->getClassName($file));
if (! $this->isSkip($reflecter)) {
if ($this->interface === null) {
return true;
}
return (bool) $reflecter->implementsInterface... | [
"protected",
"function",
"instanceOf",
"(",
"SplFileInfo",
"$",
"file",
")",
":",
"bool",
"{",
"$",
"reflecter",
"=",
"new",
"ReflectionClass",
"(",
"$",
"this",
"->",
"getClassName",
"(",
"$",
"file",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
... | 判断文件是否实现于指定接口
@param \SplFileInfo $file
@return bool | [
"判断文件是否实现于指定接口"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L371-L385 |
movoin/one-swoole | src/FileSystem/Finder.php | Finder.isSkip | protected function isSkip(ReflectionClass $reflecter): bool
{
$skips = array_filter(
$this->skips,
function ($value) {
return $value === 1;
}
);
foreach ($skips as $name => $value) {
$method = 'is' . ucfirst($name);
... | php | protected function isSkip(ReflectionClass $reflecter): bool
{
$skips = array_filter(
$this->skips,
function ($value) {
return $value === 1;
}
);
foreach ($skips as $name => $value) {
$method = 'is' . ucfirst($name);
... | [
"protected",
"function",
"isSkip",
"(",
"ReflectionClass",
"$",
"reflecter",
")",
":",
"bool",
"{",
"$",
"skips",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"skips",
",",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"$",
"value",
"===",
"1",
";... | 判断是否忽略
@param \ReflectionClass $reflecter
@return bool | [
"判断是否忽略"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/FileSystem/Finder.php#L394-L416 |
fuelphp/display | src/Parser/Smarty.php | Smarty.setupSmarty | protected function setupSmarty()
{
$this->smarty = new SmartyParser;
if ($this->viewManager->cachePath)
{
$this->smarty->setCacheDir($this->viewManager->cachePath.'smarty/');
}
} | php | protected function setupSmarty()
{
$this->smarty = new SmartyParser;
if ($this->viewManager->cachePath)
{
$this->smarty->setCacheDir($this->viewManager->cachePath.'smarty/');
}
} | [
"protected",
"function",
"setupSmarty",
"(",
")",
"{",
"$",
"this",
"->",
"smarty",
"=",
"new",
"SmartyParser",
";",
"if",
"(",
"$",
"this",
"->",
"viewManager",
"->",
"cachePath",
")",
"{",
"$",
"this",
"->",
"smarty",
"->",
"setCacheDir",
"(",
"$",
"... | Sets Smarty up | [
"Sets",
"Smarty",
"up"
] | train | https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Parser/Smarty.php#L51-L59 |
fuelphp/display | src/Parser/Smarty.php | Smarty.parse | public function parse($file, array $data = [])
{
$smarty = $this->getSmarty();
$template = $smarty->createTemplate($file);
$template->assign($data);
return $template->fetch();
} | php | public function parse($file, array $data = [])
{
$smarty = $this->getSmarty();
$template = $smarty->createTemplate($file);
$template->assign($data);
return $template->fetch();
} | [
"public",
"function",
"parse",
"(",
"$",
"file",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"smarty",
"=",
"$",
"this",
"->",
"getSmarty",
"(",
")",
";",
"$",
"template",
"=",
"$",
"smarty",
"->",
"createTemplate",
"(",
"$",
"file",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/fuelphp/display/blob/d9a3eddbf80f0fd81beb40d9f4507600ac6611a4/src/Parser/Smarty.php#L64-L72 |
isolate-org/isolate | src/Isolate/Isolate.php | Isolate.getContext | public function getContext($name = self::DEFAULT_CONTEXT)
{
if (!array_key_exists($name, $this->contexts)) {
$this->contexts[$name] = $this->contextFactory->create(new Name($name));
}
return $this->contexts[$name];
} | php | public function getContext($name = self::DEFAULT_CONTEXT)
{
if (!array_key_exists($name, $this->contexts)) {
$this->contexts[$name] = $this->contextFactory->create(new Name($name));
}
return $this->contexts[$name];
} | [
"public",
"function",
"getContext",
"(",
"$",
"name",
"=",
"self",
"::",
"DEFAULT_CONTEXT",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"contexts",
")",
")",
"{",
"$",
"this",
"->",
"contexts",
"[",
"$",
"n... | {inheritdoc} | [
"{",
"inheritdoc",
"}"
] | train | https://github.com/isolate-org/isolate/blob/61a553d159ea4ce103b960e2f78298d061e0d884/src/Isolate/Isolate.php#L32-L39 |
dengyongbin/loopeer-lib | src/Sms/LuoSiMaoSms.php | LuoSiMaoSms.sendSms | public function sendSms($phone, $message) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://sms-api.luosimao.com/v1/send.json");
curl_setopt($ch, CURLOPT_ENCODING ,"UTF-8");
$this->setOpt($ch);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'mobile' => $phon... | php | public function sendSms($phone, $message) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://sms-api.luosimao.com/v1/send.json");
curl_setopt($ch, CURLOPT_ENCODING ,"UTF-8");
$this->setOpt($ch);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'mobile' => $phon... | [
"public",
"function",
"sendSms",
"(",
"$",
"phone",
",",
"$",
"message",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"\"http://sms-api.luosimao.com/v1/send.json\"",
")",
";",
"curl_setopt",
"(... | 发送短信
@param $phone
@param $message
@return mixed | [
"发送短信"
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Sms/LuoSiMaoSms.php#L36-L49 |
dengyongbin/loopeer-lib | src/Sms/LuoSiMaoSms.php | LuoSiMaoSms.sendVerify | public function sendVerify($phone, $code) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://voice-api.luosimao.com/v1/verify.json");
$this->setOpt($ch);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'mobile' => $phone,
'code' => $code
)
... | php | public function sendVerify($phone, $code) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://voice-api.luosimao.com/v1/verify.json");
$this->setOpt($ch);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'mobile' => $phone,
'code' => $code
)
... | [
"public",
"function",
"sendVerify",
"(",
"$",
"phone",
",",
"$",
"code",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_URL",
",",
"\"http://voice-api.luosimao.com/v1/verify.json\"",
")",
";",
"$",
"this",
... | 发送语音
@param $phone
@param $code
@return mixed | [
"发送语音"
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Sms/LuoSiMaoSms.php#L57-L69 |
dengyongbin/loopeer-lib | src/Sms/LuoSiMaoSms.php | LuoSiMaoSms.setOpt | private function setOpt($ch) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $this->apiKey);
curl... | php | private function setOpt($ch) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $this->apiKey);
curl... | [
"private",
"function",
"setOpt",
"(",
"$",
"ch",
")",
"{",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_CONNECTTIMEOUT",
",",
"30",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_RETURNTRANSFER",
",",
"TRUE",
")",
";",
"curl_setopt",
"(",
"$",
"c... | 设置curl参数
@param $ch | [
"设置curl参数"
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Sms/LuoSiMaoSms.php#L75-L82 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/OrderBundle/Order/OrderPdfManager.php | OrderPdfManager.createOrderConfirmation | public function createOrderConfirmation(ApiOrderInterface $apiOrder)
{
$data = $this->getContentForPdf($apiOrder);
$header = $this->pdfManager->renderTemplate(
$this->templateHeaderPath,
array()
);
$footer = $this->pdfManager->renderTemplate(
$th... | php | public function createOrderConfirmation(ApiOrderInterface $apiOrder)
{
$data = $this->getContentForPdf($apiOrder);
$header = $this->pdfManager->renderTemplate(
$this->templateHeaderPath,
array()
);
$footer = $this->pdfManager->renderTemplate(
$th... | [
"public",
"function",
"createOrderConfirmation",
"(",
"ApiOrderInterface",
"$",
"apiOrder",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getContentForPdf",
"(",
"$",
"apiOrder",
")",
";",
"$",
"header",
"=",
"$",
"this",
"->",
"pdfManager",
"->",
"renderT... | @param ApiOrderInterface $apiOrder
@return file | [
"@param",
"ApiOrderInterface",
"$apiOrder"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/OrderBundle/Order/OrderPdfManager.php#L105-L130 |
dragosprotung/stc-core | src/Workout/Dumper/JSON.php | JSON.dump | public function dump(Workout $workout): string
{
$data = array();
$tracks = $workout->tracks();
foreach ($tracks as $track) {
$data[] = array(
'workout' => array(
'points' => $this->writeTrackPoints($track->trackPoints())
)
... | php | public function dump(Workout $workout): string
{
$data = array();
$tracks = $workout->tracks();
foreach ($tracks as $track) {
$data[] = array(
'workout' => array(
'points' => $this->writeTrackPoints($track->trackPoints())
)
... | [
"public",
"function",
"dump",
"(",
"Workout",
"$",
"workout",
")",
":",
"string",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"tracks",
"=",
"$",
"workout",
"->",
"tracks",
"(",
")",
";",
"foreach",
"(",
"$",
"tracks",
"as",
"$",
"track",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/JSON.php#L19-L32 |
dragosprotung/stc-core | src/Workout/Dumper/JSON.php | JSON.writeTrackPoints | private function writeTrackPoints(array $trackPoints)
{
$points = array();
$previousPoint = null;
foreach ($trackPoints as $trackPoint) {
$dateTime = clone $trackPoint->dateTime();
$dateTime->setTimezone(new \DateTimeZone('UTC'));
$distance = 0;
... | php | private function writeTrackPoints(array $trackPoints)
{
$points = array();
$previousPoint = null;
foreach ($trackPoints as $trackPoint) {
$dateTime = clone $trackPoint->dateTime();
$dateTime->setTimezone(new \DateTimeZone('UTC'));
$distance = 0;
... | [
"private",
"function",
"writeTrackPoints",
"(",
"array",
"$",
"trackPoints",
")",
"{",
"$",
"points",
"=",
"array",
"(",
")",
";",
"$",
"previousPoint",
"=",
"null",
";",
"foreach",
"(",
"$",
"trackPoints",
"as",
"$",
"trackPoint",
")",
"{",
"$",
"dateTi... | Write the track points into an array.
@param TrackPoint[] $trackPoints The track points to write.
@return array | [
"Write",
"the",
"track",
"points",
"into",
"an",
"array",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Dumper/JSON.php#L40-L67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.