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 |
|---|---|---|---|---|---|---|---|---|---|---|
mainio/c5pkg_symfony_forms | src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/DateSelectorType.php | DateSelectorType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$dh = \Core::make('helper/date');
$tz = $dh->getTimezone('user')->getName();
$apptz = $dh->getTimezone('system')->getName();
$dtTransformer = new DateTimeToStringTransformer(
$apptz,
$... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$dh = \Core::make('helper/date');
$tz = $dh->getTimezone('user')->getName();
$apptz = $dh->getTimezone('system')->getName();
$dtTransformer = new DateTimeToStringTransformer(
$apptz,
$... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"dh",
"=",
"\\",
"Core",
"::",
"make",
"(",
"'helper/date'",
")",
";",
"$",
"tz",
"=",
"$",
"dh",
"->",
"getTimezone",
"(",
"'u... | {@inheritdoc} | [
"{"
] | train | https://github.com/mainio/c5pkg_symfony_forms/blob/41a93c293d986574ec5cade8a7c8700e083dbaaa/src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/DateSelectorType.php#L17-L29 |
mainio/c5pkg_symfony_forms | src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/DateSelectorType.php | DateSelectorType.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
$dh = \Core::make('helper/form/date_time');
$view->vars = array_replace($view->vars, array(
'selector' => $dh->date($view->vars["full_name"], $view->vars["value"]),
));
} | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
$dh = \Core::make('helper/form/date_time');
$view->vars = array_replace($view->vars, array(
'selector' => $dh->date($view->vars["full_name"], $view->vars["value"]),
));
} | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"$",
"dh",
"=",
"\\",
"Core",
"::",
"make",
"(",
"'helper/form/date_time'",
")",
";",
"$",
"view",
"->",
"vars",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/mainio/c5pkg_symfony_forms/blob/41a93c293d986574ec5cade8a7c8700e083dbaaa/src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/DateSelectorType.php#L34-L40 |
gbprod/doctrine-specification-bundle | src/DoctrineSpecificationBundle/DependencyInjection/Compiler/QueryFactoryPass.php | QueryFactoryPass.process | public function process(ContainerBuilder $container)
{
if (!$container->has('gbprod.doctrine_specification_handler')) {
throw new \Exception('Missing gbprod.doctrine_specification_handler definition');
}
$handler = $container
->findDefinition('gbprod.doctrine_specifi... | php | public function process(ContainerBuilder $container)
{
if (!$container->has('gbprod.doctrine_specification_handler')) {
throw new \Exception('Missing gbprod.doctrine_specification_handler definition');
}
$handler = $container
->findDefinition('gbprod.doctrine_specifi... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"has",
"(",
"'gbprod.doctrine_specification_handler'",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Missing gbprod.doctrine_sp... | {inheritdoc} | [
"{",
"inheritdoc",
"}"
] | train | https://github.com/gbprod/doctrine-specification-bundle/blob/205c1db4efe12b17b8d911c91a688f2596d0b35c/src/DoctrineSpecificationBundle/DependencyInjection/Compiler/QueryFactoryPass.php#L19-L43 |
mainio/c5pkg_symfony_forms | src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/FileSelectorType.php | FileSelectorType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$em = $options['entity_manager'];
if ($em instanceof EntityManager) {
$builder->addViewTransformer(new FileToIntegerTransformer($em));
} else {
parent::buildForm($builder, $options);
}
... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$em = $options['entity_manager'];
if ($em instanceof EntityManager) {
$builder->addViewTransformer(new FileToIntegerTransformer($em));
} else {
parent::buildForm($builder, $options);
}
... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"em",
"=",
"$",
"options",
"[",
"'entity_manager'",
"]",
";",
"if",
"(",
"$",
"em",
"instanceof",
"EntityManager",
")",
"{",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/mainio/c5pkg_symfony_forms/blob/41a93c293d986574ec5cade8a7c8700e083dbaaa/src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/FileSelectorType.php#L18-L26 |
mainio/c5pkg_symfony_forms | src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/FileSelectorType.php | FileSelectorType.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
// TODO: Through configurations variables, we should allow the defining
// the file type for the selector (e.g. $fm->image(...), $fm->doc(...))
$fm = \Core::make('helper/concrete/file_manager');
if... | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
// TODO: Through configurations variables, we should allow the defining
// the file type for the selector (e.g. $fm->image(...), $fm->doc(...))
$fm = \Core::make('helper/concrete/file_manager');
if... | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"// TODO: Through configurations variables, we should allow the defining",
"// the file type for the selector (e.g. $fm->image(...), $... | {@inheritdoc} | [
"{"
] | train | https://github.com/mainio/c5pkg_symfony_forms/blob/41a93c293d986574ec5cade8a7c8700e083dbaaa/src/Mainio/C5/Symfony/Form/Extension/Concrete5/Type/FileSelectorType.php#L31-L44 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php | ezcMailFileSet.hasData | public function hasData()
{
if ( count( $this->files ) >= 1 )
{
if ( $this->files[0] === 'php://stdin' || filesize( $this->files[0] ) > 0 )
{
return true;
}
}
return false;
} | php | public function hasData()
{
if ( count( $this->files ) >= 1 )
{
if ( $this->files[0] === 'php://stdin' || filesize( $this->files[0] ) > 0 )
{
return true;
}
}
return false;
} | [
"public",
"function",
"hasData",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"files",
")",
">=",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"files",
"[",
"0",
"]",
"===",
"'php://stdin'",
"||",
"filesize",
"(",
"$",
"this",
"->",... | Returns whether the file set contains files
@return bool | [
"Returns",
"whether",
"the",
"file",
"set",
"contains",
"files"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php#L90-L100 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php | ezcMailFileSet.getNextLine | public function getNextLine()
{
if ( $this->hasMoreMailData === false )
{
$this->nextMail();
}
// finished?
if ( $this->fp == null || feof( $this->fp ) )
{
if ( $this->fp != null )
{
fclose( $this->fp );
... | php | public function getNextLine()
{
if ( $this->hasMoreMailData === false )
{
$this->nextMail();
}
// finished?
if ( $this->fp == null || feof( $this->fp ) )
{
if ( $this->fp != null )
{
fclose( $this->fp );
... | [
"public",
"function",
"getNextLine",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasMoreMailData",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"nextMail",
"(",
")",
";",
"}",
"// finished?",
"if",
"(",
"$",
"this",
"->",
"fp",
"==",
"null",
"||",
... | Returns one line of data from the current mail in the set.
Null is returned if there is no current mail in the set or
the end of the mail is reached,
@return string | [
"Returns",
"one",
"line",
"of",
"data",
"from",
"the",
"current",
"mail",
"in",
"the",
"set",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php#L110-L134 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php | ezcMailFileSet.nextMail | public function nextMail()
{
if ( $this->hasMoreMailData === false )
{
$this->hasMoreMailData = true;
return $this->openFile( true );
}
return $this->openFile();
} | php | public function nextMail()
{
if ( $this->hasMoreMailData === false )
{
$this->hasMoreMailData = true;
return $this->openFile( true );
}
return $this->openFile();
} | [
"public",
"function",
"nextMail",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasMoreMailData",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"hasMoreMailData",
"=",
"true",
";",
"return",
"$",
"this",
"->",
"openFile",
"(",
"true",
")",
";",
"}",
"... | Moves the set to the next mail and returns true upon success.
False is returned if there are no more mail in the set.
@return bool | [
"Moves",
"the",
"set",
"to",
"the",
"next",
"mail",
"and",
"returns",
"true",
"upon",
"success",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php#L143-L151 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php | ezcMailFileSet.openFile | private function openFile( $isFirst = false )
{
// cleanup file pointer if needed
if ( $this->fp != null )
{
fclose( $this->fp );
$this->fp = null;
}
// open the new file
$file = $isFirst ? current( $this->files ) : next( $this->files );
... | php | private function openFile( $isFirst = false )
{
// cleanup file pointer if needed
if ( $this->fp != null )
{
fclose( $this->fp );
$this->fp = null;
}
// open the new file
$file = $isFirst ? current( $this->files ) : next( $this->files );
... | [
"private",
"function",
"openFile",
"(",
"$",
"isFirst",
"=",
"false",
")",
"{",
"// cleanup file pointer if needed",
"if",
"(",
"$",
"this",
"->",
"fp",
"!=",
"null",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"fp",
")",
";",
"$",
"this",
"->",
"fp",
... | Opens the next file in the set and returns true on success.
@param bool $isFirst
@return bool | [
"Opens",
"the",
"next",
"file",
"in",
"the",
"set",
"and",
"returns",
"true",
"on",
"success",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/file/file_set.php#L159-L186 |
joni-jones/yii2-heroku-logger | HerokuTarget.php | HerokuTarget.export | public function export()
{
$messages = implode("\n", array_map([$this, 'formatMessage'], $this->messages))."\n";
$stdout = fopen('php://stdout', 'w');
if ($stdout === false) {
throw new InvalidConfigException('Unable to open stdout stream');
}
fwrite($stdout, $mes... | php | public function export()
{
$messages = implode("\n", array_map([$this, 'formatMessage'], $this->messages))."\n";
$stdout = fopen('php://stdout', 'w');
if ($stdout === false) {
throw new InvalidConfigException('Unable to open stdout stream');
}
fwrite($stdout, $mes... | [
"public",
"function",
"export",
"(",
")",
"{",
"$",
"messages",
"=",
"implode",
"(",
"\"\\n\"",
",",
"array_map",
"(",
"[",
"$",
"this",
",",
"'formatMessage'",
"]",
",",
"$",
"this",
"->",
"messages",
")",
")",
".",
"\"\\n\"",
";",
"$",
"stdout",
"=... | Write yii logs to stdout
@access public
@return void | [
"Write",
"yii",
"logs",
"to",
"stdout"
] | train | https://github.com/joni-jones/yii2-heroku-logger/blob/0a648cdd52941caae49c0e54ae65b8a7fc6b2db9/HerokuTarget.php#L15-L24 |
zicht/z | src/Zicht/Tool/Debug.php | Debug.enterScope | public static function enterScope($scope)
{
if (!is_scalar($scope)) {
throw new \InvalidArgumentException("Only scalars allowed as scope identifiers");
}
array_push(self::$scope, $scope);
list($call) = debug_backtrace(0);
array_push(self::$scopeChange, $call);
... | php | public static function enterScope($scope)
{
if (!is_scalar($scope)) {
throw new \InvalidArgumentException("Only scalars allowed as scope identifiers");
}
array_push(self::$scope, $scope);
list($call) = debug_backtrace(0);
array_push(self::$scopeChange, $call);
... | [
"public",
"static",
"function",
"enterScope",
"(",
"$",
"scope",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"scope",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Only scalars allowed as scope identifiers\"",
")",
";",
"}",
"ar... | Keeps track of scope
@param string $scope
@return void | [
"Keeps",
"track",
"of",
"scope"
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Debug.php#L31-L39 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/filters/bork_filter.php | ezcTranslationBorkFilter.borkify | static private function borkify( $text )
{
$textBlocks = preg_split( '/(%[^ ]+)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
$newTextBlocks = array();
foreach ( $textBlocks as $text )
{
if ( strlen( $text ) && $text[0] == '%' )
{
$newTextBlocks[] ... | php | static private function borkify( $text )
{
$textBlocks = preg_split( '/(%[^ ]+)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
$newTextBlocks = array();
foreach ( $textBlocks as $text )
{
if ( strlen( $text ) && $text[0] == '%' )
{
$newTextBlocks[] ... | [
"static",
"private",
"function",
"borkify",
"(",
"$",
"text",
")",
"{",
"$",
"textBlocks",
"=",
"preg_split",
"(",
"'/(%[^ ]+)/'",
",",
"$",
"text",
",",
"-",
"1",
",",
"PREG_SPLIT_DELIM_CAPTURE",
")",
";",
"$",
"newTextBlocks",
"=",
"array",
"(",
")",
"... | This "borkifies" the $text.
@param string $text
@return string | [
"This",
"borkifies",
"the",
"$text",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/filters/bork_filter.php#L55-L90 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/filters/bork_filter.php | ezcTranslationBorkFilter.runFilter | public function runFilter( array $context )
{
foreach ( $context as $element )
{
if ( $element->status !== ezcTranslationData::TRANSLATED )
{
$element->translation = self::borkify( $element->original );
}
}
} | php | public function runFilter( array $context )
{
foreach ( $context as $element )
{
if ( $element->status !== ezcTranslationData::TRANSLATED )
{
$element->translation = self::borkify( $element->original );
}
}
} | [
"public",
"function",
"runFilter",
"(",
"array",
"$",
"context",
")",
"{",
"foreach",
"(",
"$",
"context",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"->",
"status",
"!==",
"ezcTranslationData",
"::",
"TRANSLATED",
")",
"{",
"$",
"element... | Filters a context
Applies the "bork" filter on the given context. The bork filter mangles
non-finished or non-translated text so that it is obvious which text is
translatable, but not yet translated.
@param array(ezcTranslationData) $context
@return void | [
"Filters",
"a",
"context"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/filters/bork_filter.php#L102-L111 |
zicht/z | src/Zicht/Tool/Script/Parser.php | Parser.parse | public function parse(TokenStream $input)
{
$exprParser = new Parser\Expression($this);
$ret = new Node\Script();
if ($input->valid()) {
do {
$hasMatch = false;
if ($input->match(Token::EXPR_START, '@(')) {
$input->next();
... | php | public function parse(TokenStream $input)
{
$exprParser = new Parser\Expression($this);
$ret = new Node\Script();
if ($input->valid()) {
do {
$hasMatch = false;
if ($input->match(Token::EXPR_START, '@(')) {
$input->next();
... | [
"public",
"function",
"parse",
"(",
"TokenStream",
"$",
"input",
")",
"{",
"$",
"exprParser",
"=",
"new",
"Parser",
"\\",
"Expression",
"(",
"$",
"this",
")",
";",
"$",
"ret",
"=",
"new",
"Node",
"\\",
"Script",
"(",
")",
";",
"if",
"(",
"$",
"inpu... | Parses the input tokenstream and returns a Script node
@param TokenStream $input
@return Node\Script
@throws \Symfony\Component\Process\Exception\InvalidArgumentException
@throws \UnexpectedValueException | [
"Parses",
"the",
"input",
"tokenstream",
"and",
"returns",
"a",
"Script",
"node"
] | train | https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Script/Parser.php#L27-L91 |
fdisotto/cac-api | src/fdisotto/CACApi.php | CACApi.getConsoleUrl | public function getConsoleUrl($sid = '') {
$data = $this->_data;
$data['sid'] = $sid;
$this->_make_request(self::CONSOLE_URL, $data, 'POST');
return $this->_response['console'];
} | php | public function getConsoleUrl($sid = '') {
$data = $this->_data;
$data['sid'] = $sid;
$this->_make_request(self::CONSOLE_URL, $data, 'POST');
return $this->_response['console'];
} | [
"public",
"function",
"getConsoleUrl",
"(",
"$",
"sid",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_data",
";",
"$",
"data",
"[",
"'sid'",
"]",
"=",
"$",
"sid",
";",
"$",
"this",
"->",
"_make_request",
"(",
"self",
"::",
"CONSOLE_UR... | Return the URL to the web console for the server specified.
https://github.com/cloudatcost/api#power-operations
@param int $sid Server ID
@return string Console url | [
"Return",
"the",
"URL",
"to",
"the",
"web",
"console",
"for",
"the",
"server",
"specified",
".",
"https",
":",
"//",
"github",
".",
"com",
"/",
"cloudatcost",
"/",
"api#power",
"-",
"operations"
] | train | https://github.com/fdisotto/cac-api/blob/c5c7fce1a00dd35584d5ce7e78a41d54188163cc/src/fdisotto/CACApi.php#L186-L192 |
fdisotto/cac-api | src/fdisotto/CACApi.php | CACApi.renameServer | public function renameServer($sid = '', $name = '') {
$data = $this->_data;
$data['sid'] = $sid;
$data['name'] = $name;
$this->_make_request(self::RENAME_SRV_URL, $data, 'POST');
return array_key_exists('result', $this->_response) ? $this->_response['result'] : false;
} | php | public function renameServer($sid = '', $name = '') {
$data = $this->_data;
$data['sid'] = $sid;
$data['name'] = $name;
$this->_make_request(self::RENAME_SRV_URL, $data, 'POST');
return array_key_exists('result', $this->_response) ? $this->_response['result'] : false;
} | [
"public",
"function",
"renameServer",
"(",
"$",
"sid",
"=",
"''",
",",
"$",
"name",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_data",
";",
"$",
"data",
"[",
"'sid'",
"]",
"=",
"$",
"sid",
";",
"$",
"data",
"[",
"'name'",
"]",
... | Rename the server label
https://github.com/cloudatcost/api#rename-server
@param int $sid Server ID
@param string $name Name
@return bool|string false or "success" if success | [
"Rename",
"the",
"server",
"label",
"https",
":",
"//",
"github",
".",
"com",
"/",
"cloudatcost",
"/",
"api#rename",
"-",
"server"
] | train | https://github.com/fdisotto/cac-api/blob/c5c7fce1a00dd35584d5ce7e78a41d54188163cc/src/fdisotto/CACApi.php#L202-L209 |
fdisotto/cac-api | src/fdisotto/CACApi.php | CACApi.reverseDNS | public function reverseDNS($sid = '', $hostname = '') {
$data = $this->_data;
$data['sid'] = $sid;
$data['hostname'] = $hostname;
$this->_make_request(self::R_DNS_URL, $data, 'POST');
return array_key_exists('result', $this->_response) ? $this->_response['result'] : false;
} | php | public function reverseDNS($sid = '', $hostname = '') {
$data = $this->_data;
$data['sid'] = $sid;
$data['hostname'] = $hostname;
$this->_make_request(self::R_DNS_URL, $data, 'POST');
return array_key_exists('result', $this->_response) ? $this->_response['result'] : false;
} | [
"public",
"function",
"reverseDNS",
"(",
"$",
"sid",
"=",
"''",
",",
"$",
"hostname",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_data",
";",
"$",
"data",
"[",
"'sid'",
"]",
"=",
"$",
"sid",
";",
"$",
"data",
"[",
"'hostname'",
... | Modify the reverse DNS & hostname of the VPS
https://github.com/cloudatcost/api#modify-reverse-dns
@param int $sid Server ID
@param string $hostname Hostname
@return bool|string false or "success" if success | [
"Modify",
"the",
"reverse",
"DNS",
"&",
"hostname",
"of",
"the",
"VPS",
"https",
":",
"//",
"github",
".",
"com",
"/",
"cloudatcost",
"/",
"api#modify",
"-",
"reverse",
"-",
"dns"
] | train | https://github.com/fdisotto/cac-api/blob/c5c7fce1a00dd35584d5ce7e78a41d54188163cc/src/fdisotto/CACApi.php#L219-L226 |
fdisotto/cac-api | src/fdisotto/CACApi.php | CACApi.runMode | public function runMode($sid = '', $mode = '') {
$data = $this->_data;
$data['sid'] = $sid;
$data['mode'] = $mode;
$this->_make_request(self::RUN_MODE_URL, $data, 'POST');
return array_key_exists('result', $this->_response) ? $this->_response['result'] : false;
} | php | public function runMode($sid = '', $mode = '') {
$data = $this->_data;
$data['sid'] = $sid;
$data['mode'] = $mode;
$this->_make_request(self::RUN_MODE_URL, $data, 'POST');
return array_key_exists('result', $this->_response) ? $this->_response['result'] : false;
} | [
"public",
"function",
"runMode",
"(",
"$",
"sid",
"=",
"''",
",",
"$",
"mode",
"=",
"''",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_data",
";",
"$",
"data",
"[",
"'sid'",
"]",
"=",
"$",
"sid",
";",
"$",
"data",
"[",
"'mode'",
"]",
"=",... | Set the run mode of the server to either 'normal' or 'safe'.
Safe automatically turns off the server after 7 days of idle usage.
Normal keeps it on indefinitely.
https://github.com/cloudatcost/api#run-mode
@param int $sid Server ID
@param string $mode Run mode: 'normal' or 'safe'
@return bool|string false or "success"... | [
"Set",
"the",
"run",
"mode",
"of",
"the",
"server",
"to",
"either",
"normal",
"or",
"safe",
".",
"Safe",
"automatically",
"turns",
"off",
"the",
"server",
"after",
"7",
"days",
"of",
"idle",
"usage",
".",
"Normal",
"keeps",
"it",
"on",
"indefinitely",
".... | train | https://github.com/fdisotto/cac-api/blob/c5c7fce1a00dd35584d5ce7e78a41d54188163cc/src/fdisotto/CACApi.php#L238-L245 |
fdisotto/cac-api | src/fdisotto/CACApi.php | CACApi._make_request | private function _make_request($where, $data, $type = 'GET') {
if ($type == 'GET') {
try {
$this->get(self::BASE_URL . self::API_VERSION . $where, $data);
$this->_response = json_decode($this->response, true);
if ($this->_response['status'] === 'ok') {
if (array_key_exists('data', $this->_response... | php | private function _make_request($where, $data, $type = 'GET') {
if ($type == 'GET') {
try {
$this->get(self::BASE_URL . self::API_VERSION . $where, $data);
$this->_response = json_decode($this->response, true);
if ($this->_response['status'] === 'ok') {
if (array_key_exists('data', $this->_response... | [
"private",
"function",
"_make_request",
"(",
"$",
"where",
",",
"$",
"data",
",",
"$",
"type",
"=",
"'GET'",
")",
"{",
"if",
"(",
"$",
"type",
"==",
"'GET'",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"get",
"(",
"self",
"::",
"BASE_URL",
".",
"sel... | Perform the web request to the C@C API
@param string $where The endpont of the url
@param array $data Options for the web request
@param string $type GET or POST web request
@return bool | [
"Perform",
"the",
"web",
"request",
"to",
"the",
"C@C",
"API"
] | train | https://github.com/fdisotto/cac-api/blob/c5c7fce1a00dd35584d5ce7e78a41d54188163cc/src/fdisotto/CACApi.php#L255-L295 |
fdisotto/cac-api | src/fdisotto/CACApi.php | CACApi._make_power_operation | private function _make_power_operation($sid, $action) {
$data = $this->_data;
$data['sid'] = $sid;
$data['action'] = $action;
try {
return $this->_make_request(self::POWER_OP_URL, $data, 'POST');
} catch (\Exception $e) {
throw new \Exception('Something gone wrong', 0, $e);
}
return true;
} | php | private function _make_power_operation($sid, $action) {
$data = $this->_data;
$data['sid'] = $sid;
$data['action'] = $action;
try {
return $this->_make_request(self::POWER_OP_URL, $data, 'POST');
} catch (\Exception $e) {
throw new \Exception('Something gone wrong', 0, $e);
}
return true;
} | [
"private",
"function",
"_make_power_operation",
"(",
"$",
"sid",
",",
"$",
"action",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"_data",
";",
"$",
"data",
"[",
"'sid'",
"]",
"=",
"$",
"sid",
";",
"$",
"data",
"[",
"'action'",
"]",
"=",
"$",
"... | Perform the power operation on the server
@param int $sid Server ID
@param string $action poweron, poweroff, reset request
@return bool | [
"Perform",
"the",
"power",
"operation",
"on",
"the",
"server"
] | train | https://github.com/fdisotto/cac-api/blob/c5c7fce1a00dd35584d5ce7e78a41d54188163cc/src/fdisotto/CACApi.php#L304-L317 |
mothership-ec/composer | src/Composer/Util/StreamContextFactory.php | StreamContextFactory.fixHttpHeaderField | private static function fixHttpHeaderField($header)
{
if (!is_array($header)) {
$header = explode("\r\n", $header);
}
uasort($header, function ($el) {
return preg_match('{^content-type}i', $el) ? 1 : -1;
});
return $header;
} | php | private static function fixHttpHeaderField($header)
{
if (!is_array($header)) {
$header = explode("\r\n", $header);
}
uasort($header, function ($el) {
return preg_match('{^content-type}i', $el) ? 1 : -1;
});
return $header;
} | [
"private",
"static",
"function",
"fixHttpHeaderField",
"(",
"$",
"header",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"header",
")",
")",
"{",
"$",
"header",
"=",
"explode",
"(",
"\"\\r\\n\"",
",",
"$",
"header",
")",
";",
"}",
"uasort",
"(",
"$... | A bug in PHP prevents the headers from correctly being sent when a content-type header is present and
NOT at the end of the array
This method fixes the array by moving the content-type header to the end
@link https://bugs.php.net/bug.php?id=61548
@param $header
@return array | [
"A",
"bug",
"in",
"PHP",
"prevents",
"the",
"headers",
"from",
"correctly",
"being",
"sent",
"when",
"a",
"content",
"-",
"type",
"header",
"is",
"present",
"and",
"NOT",
"at",
"the",
"end",
"of",
"the",
"array"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Util/StreamContextFactory.php#L143-L153 |
tequila/mongodb-odm | src/DocumentsCollection.php | DocumentsCollection.rewind | public function rewind()
{
if ($this->iterationStarted) {
throw new LogicException(sprintf('%s cannot yield multiple iterators', get_class($this)));
}
$this->iterationStarted = true;
} | php | public function rewind()
{
if ($this->iterationStarted) {
throw new LogicException(sprintf('%s cannot yield multiple iterators', get_class($this)));
}
$this->iterationStarted = true;
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"iterationStarted",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"sprintf",
"(",
"'%s cannot yield multiple iterators'",
",",
"get_class",
"(",
"$",
"this",
")",
")",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/DocumentsCollection.php#L100-L106 |
nabab/bbn | src/bbn/appui/tasks.php | tasks.stop_track | public function stop_track($id_task, $message = false, $id_user = false){
$ok = false;
$now = time();
if (
($active_track = $this->get_active_track($id_user)) &&
($active_track['id_task'] === $id_task)
){
$ok = true;
if (
!empty($message) &&
!($id_note = $this->co... | php | public function stop_track($id_task, $message = false, $id_user = false){
$ok = false;
$now = time();
if (
($active_track = $this->get_active_track($id_user)) &&
($active_track['id_task'] === $id_task)
){
$ok = true;
if (
!empty($message) &&
!($id_note = $this->co... | [
"public",
"function",
"stop_track",
"(",
"$",
"id_task",
",",
"$",
"message",
"=",
"false",
",",
"$",
"id_user",
"=",
"false",
")",
"{",
"$",
"ok",
"=",
"false",
";",
"$",
"now",
"=",
"time",
"(",
")",
";",
"if",
"(",
"(",
"$",
"active_track",
"=... | Stops a track.
@param string $id_task The task's ID
@param boolean|string $message The message to attach to track (optional)
@param boolean|string $id_user The track's user. If you give 'false', it will use the current user
@return boolean | [
"Stops",
"a",
"track",
"."
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/tasks.php#L1113-L1140 |
inhere/php-librarys | src/Collections/ActiveData.php | ActiveData.load | public function load($data, $recursive = false)
{
foreach ($data as $name => $value) {
$name = trim($name);
if (is_numeric($name)) {
continue;
}
$this->$name = $recursive && \is_array($value) ? static::create($value, $recursive) : $value;
... | php | public function load($data, $recursive = false)
{
foreach ($data as $name => $value) {
$name = trim($name);
if (is_numeric($name)) {
continue;
}
$this->$name = $recursive && \is_array($value) ? static::create($value, $recursive) : $value;
... | [
"public",
"function",
"load",
"(",
"$",
"data",
",",
"$",
"recursive",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"name",
"=",
"trim",
"(",
"$",
"name",
")",
";",
"if",
"(",
"is_nu... | 初始化,载入数据
@param array $data
@param bool $recursive
@return $this | [
"初始化,载入数据"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Collections/ActiveData.php#L47-L60 |
inhere/php-librarys | src/Collections/ActiveData.php | ActiveData.get | public function get($name)
{
if (strpos($name, '.')) {
$names = explode('.', $name);
$node = $this;
foreach ($names as $n) {
if ($node instanceof self && property_exists($node, $n)) {
$node = $node->$n;
} else {
... | php | public function get($name)
{
if (strpos($name, '.')) {
$names = explode('.', $name);
$node = $this;
foreach ($names as $n) {
if ($node instanceof self && property_exists($node, $n)) {
$node = $node->$n;
} else {
... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'.'",
")",
")",
"{",
"$",
"names",
"=",
"explode",
"(",
"'.'",
",",
"$",
"name",
")",
";",
"$",
"node",
"=",
"$",
"this",
";",
"foreach",
"(... | 以点连接 快速获取子级节点的值
@param string $name
@return ActiveData|null | [
"以点连接",
"快速获取子级节点的值"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Collections/ActiveData.php#L92-L115 |
ClementIV/yii-rest-rbac2.0 | models/LoginForm.php | LoginForm.login | public function login()
{
if ($this->validate()) {
$this->trigger(self::GET_ACCESS_TOKEN);
if($this->_user != null) {
$this ->_user = User::findByUsername($this->username);
}
return $this->_user;
} else {
return null;
... | php | public function login()
{
if ($this->validate()) {
$this->trigger(self::GET_ACCESS_TOKEN);
if($this->_user != null) {
$this ->_user = User::findByUsername($this->username);
}
return $this->_user;
} else {
return null;
... | [
"public",
"function",
"login",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"GET_ACCESS_TOKEN",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_user",
"!=",
"null",
")",
"... | Logs in a user using the provided username and password.
@return boolean whether the user is logged in successfully | [
"Logs",
"in",
"a",
"user",
"using",
"the",
"provided",
"username",
"and",
"password",
"."
] | train | https://github.com/ClementIV/yii-rest-rbac2.0/blob/435ffceca8d51b4d369182db3a06c20f336e9ac4/models/LoginForm.php#L63-L74 |
ClementIV/yii-rest-rbac2.0 | models/LoginForm.php | LoginForm.onGenerateAccessToken | public function onGenerateAccessToken()
{
if (!User::isAccessTokenValid($this->_user->access_token)) {
$this->_user->generateAccessToken();
$this->_user->save(false);
}
} | php | public function onGenerateAccessToken()
{
if (!User::isAccessTokenValid($this->_user->access_token)) {
$this->_user->generateAccessToken();
$this->_user->save(false);
}
} | [
"public",
"function",
"onGenerateAccessToken",
"(",
")",
"{",
"if",
"(",
"!",
"User",
"::",
"isAccessTokenValid",
"(",
"$",
"this",
"->",
"_user",
"->",
"access_token",
")",
")",
"{",
"$",
"this",
"->",
"_user",
"->",
"generateAccessToken",
"(",
")",
";",
... | 登录校验成功后,为用户生成新的token
如果token失效,则重新生成token | [
"登录校验成功后,为用户生成新的token",
"如果token失效,则重新生成token"
] | train | https://github.com/ClementIV/yii-rest-rbac2.0/blob/435ffceca8d51b4d369182db3a06c20f336e9ac4/models/LoginForm.php#L94-L100 |
getuisdk/getui-php-sdk | src/Base128Varint.php | Base128Varint.getValue | public function getValue($string)
{
// now just drop the msb and reorder it + parse it in own string
$valuestring = '';
$string_length = strlen($string);
$i = 1;
while ($string_length > $i) {
// unset msb string and reorder it
$valuestring ... | php | public function getValue($string)
{
// now just drop the msb and reorder it + parse it in own string
$valuestring = '';
$string_length = strlen($string);
$i = 1;
while ($string_length > $i) {
// unset msb string and reorder it
$valuestring ... | [
"public",
"function",
"getValue",
"(",
"$",
"string",
")",
"{",
"// now just drop the msb and reorder it + parse it in own string\r",
"$",
"valuestring",
"=",
"''",
";",
"$",
"string_length",
"=",
"strlen",
"(",
"$",
"string",
")",
";",
"$",
"i",
"=",
"1",
";",
... | Returns the dec value of an base128
@param string $string bstring
@return mixed | [
"Returns",
"the",
"dec",
"value",
"of",
"an",
"base128"
] | train | https://github.com/getuisdk/getui-php-sdk/blob/e91773b099bcbfd7492a44086b373d1c9fee37e2/src/Base128Varint.php#L77-L93 |
getuisdk/getui-php-sdk | src/Base128Varint.php | Base128Varint.hexToStr | public function hexToStr($hex)
{
$str = '';
$hl = strlen($hex);
for ($i = 0; $i < $hl; $i += 2) {
$str .= chr(intval(substr($hex, $i, 2), 16));
}
return $str;
} | php | public function hexToStr($hex)
{
$str = '';
$hl = strlen($hex);
for ($i = 0; $i < $hl; $i += 2) {
$str .= chr(intval(substr($hex, $i, 2), 16));
}
return $str;
} | [
"public",
"function",
"hexToStr",
"(",
"$",
"hex",
")",
"{",
"$",
"str",
"=",
"''",
";",
"$",
"hl",
"=",
"strlen",
"(",
"$",
"hex",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"hl",
";",
"$",
"i",
"+=",
"2",
")",
... | Converts hex 2 ascii
@param String $hex - the hex string
@return mixed | [
"Converts",
"hex",
"2",
"ascii"
] | train | https://github.com/getuisdk/getui-php-sdk/blob/e91773b099bcbfd7492a44086b373d1c9fee37e2/src/Base128Varint.php#L100-L108 |
oroinc/OroLayoutComponent | HierarchyCollection.php | HierarchyCollection.getRootId | public function getRootId()
{
if (empty($this->hierarchy)) {
throw new Exception\LogicException('The root item does not exist.');
}
reset($this->hierarchy);
$id = key($this->hierarchy);
return $id;
} | php | public function getRootId()
{
if (empty($this->hierarchy)) {
throw new Exception\LogicException('The root item does not exist.');
}
reset($this->hierarchy);
$id = key($this->hierarchy);
return $id;
} | [
"public",
"function",
"getRootId",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"hierarchy",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"LogicException",
"(",
"'The root item does not exist.'",
")",
";",
"}",
"reset",
"(",
"$",
"this",... | Returns the identifier of the root item
@return string
@throws Exception\LogicException if the root item does not exist | [
"Returns",
"the",
"identifier",
"of",
"the",
"root",
"item"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/HierarchyCollection.php#L41-L51 |
oroinc/OroLayoutComponent | HierarchyCollection.php | HierarchyCollection.get | public function get(array $path)
{
$current = &$this->hierarchy;
foreach ($path as $childId) {
if (!isset($current[$childId])) {
return [];
}
$current = &$current[$childId];
}
return $current;
} | php | public function get(array $path)
{
$current = &$this->hierarchy;
foreach ($path as $childId) {
if (!isset($current[$childId])) {
return [];
}
$current = &$current[$childId];
}
return $current;
} | [
"public",
"function",
"get",
"(",
"array",
"$",
"path",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->",
"hierarchy",
";",
"foreach",
"(",
"$",
"path",
"as",
"$",
"childId",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"current",
"[",
"$",
... | Gets hierarchy by the path
@param string[] $path
@return array | [
"Gets",
"hierarchy",
"by",
"the",
"path"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/HierarchyCollection.php#L60-L71 |
oroinc/OroLayoutComponent | HierarchyCollection.php | HierarchyCollection.add | public function add(array $parentPath, $id, $siblingId = null, $prepend = null, array $children = [])
{
$current = &$this->hierarchy;
$parentPathLength = count($parentPath);
$key = null;
for ($i = 0; $i < $parentPathLength; $i++) {
if (!isset($curren... | php | public function add(array $parentPath, $id, $siblingId = null, $prepend = null, array $children = [])
{
$current = &$this->hierarchy;
$parentPathLength = count($parentPath);
$key = null;
for ($i = 0; $i < $parentPathLength; $i++) {
if (!isset($curren... | [
"public",
"function",
"add",
"(",
"array",
"$",
"parentPath",
",",
"$",
"id",
",",
"$",
"siblingId",
"=",
"null",
",",
"$",
"prepend",
"=",
"null",
",",
"array",
"$",
"children",
"=",
"[",
"]",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->... | Adds a new item to the hierarchy
@param string[] $parentPath
@param string $id
@param string|null $siblingId The id of nearest neighbor item
@param bool $prepend Determines whether the item should be added before or after
the specified sibling item
If the sibling item is not specified and $prepend is ... | [
"Adds",
"a",
"new",
"item",
"to",
"the",
"hierarchy"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/HierarchyCollection.php#L89-L173 |
oroinc/OroLayoutComponent | HierarchyCollection.php | HierarchyCollection.remove | public function remove(array $path)
{
$current = &$this->hierarchy;
$pathLength = count($path);
for ($i = 0; $i < $pathLength; $i++) {
if (!isset($current[$path[$i]])) {
break;
}
if ($i === $pathLength - 1) {
unset($curre... | php | public function remove(array $path)
{
$current = &$this->hierarchy;
$pathLength = count($path);
for ($i = 0; $i < $pathLength; $i++) {
if (!isset($current[$path[$i]])) {
break;
}
if ($i === $pathLength - 1) {
unset($curre... | [
"public",
"function",
"remove",
"(",
"array",
"$",
"path",
")",
"{",
"$",
"current",
"=",
"&",
"$",
"this",
"->",
"hierarchy",
";",
"$",
"pathLength",
"=",
"count",
"(",
"$",
"path",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",... | Removes the item from the hierarchy
@param string[] $path | [
"Removes",
"the",
"item",
"from",
"the",
"hierarchy"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/HierarchyCollection.php#L180-L194 |
bpolaszek/simple-dbal | src/Model/Adapter/PDO/Result.php | Result.shouldResetResultset | private function shouldResetResultset(): bool
{
return !empty($this->storage['row']) || !empty($this->storage['value']) || !empty($this->storage['list']) || !empty($this->storage['yield']);
} | php | private function shouldResetResultset(): bool
{
return !empty($this->storage['row']) || !empty($this->storage['value']) || !empty($this->storage['list']) || !empty($this->storage['yield']);
} | [
"private",
"function",
"shouldResetResultset",
"(",
")",
":",
"bool",
"{",
"return",
"!",
"empty",
"(",
"$",
"this",
"->",
"storage",
"[",
"'row'",
"]",
")",
"||",
"!",
"empty",
"(",
"$",
"this",
"->",
"storage",
"[",
"'value'",
"]",
")",
"||",
"!",
... | If asRow(), asList() or asValue() was called earlier, the iterator may be incomplete.
In such case we need to rewind the iterator by executing the statement a second time.
You should avoid to call getIterator() and asRow(), etc. with the same resultset.
@return bool | [
"If",
"asRow",
"()",
"asList",
"()",
"or",
"asValue",
"()",
"was",
"called",
"earlier",
"the",
"iterator",
"may",
"be",
"incomplete",
".",
"In",
"such",
"case",
"we",
"need",
"to",
"rewind",
"the",
"iterator",
"by",
"executing",
"the",
"statement",
"a",
... | train | https://github.com/bpolaszek/simple-dbal/blob/52cb50d326ba5854191814b470f5e84950ebb6e6/src/Model/Adapter/PDO/Result.php#L218-L221 |
frdl/webfan | .ApplicationComposer/lib/frdl/webfan/App.php | App.setAliasMap | public function setAliasMap($aliasing = null){
$this->wrap['aliasing'] = (is_array($aliasing)) ? $aliasing
: array(
'schema' => array(
'1.3.6.1.4.1.37553.8.1.8.8.5.65.8.1.1' => array('name' => 'Autoloader', 'alias' => self::LOADER, 'default' => &$this->LoaderClass,
... | php | public function setAliasMap($aliasing = null){
$this->wrap['aliasing'] = (is_array($aliasing)) ? $aliasing
: array(
'schema' => array(
'1.3.6.1.4.1.37553.8.1.8.8.5.65.8.1.1' => array('name' => 'Autoloader', 'alias' => self::LOADER, 'default' => &$this->LoaderClass,
... | [
"public",
"function",
"setAliasMap",
"(",
"$",
"aliasing",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"wrap",
"[",
"'aliasing'",
"]",
"=",
"(",
"is_array",
"(",
"$",
"aliasing",
")",
")",
"?",
"$",
"aliasing",
":",
"array",
"(",
"'schema'",
"=>",
"arr... | todo : compinent registry | [
"todo",
":",
"compinent",
"registry"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/frdl/webfan/App.php#L177-L200 |
frdl/webfan | .ApplicationComposer/lib/frdl/webfan/App.php | App.stream_open | public function stream_open($url, $mode, $options = STREAM_REPORT_ERRORS, &$opened_path = null){
$u = parse_url($url);
$c = explode('.',$u['host']);
$c = array_reverse($c);
$this->Controller = null;
$cN = (isset(self::God()->wrappers[$u['scheme']]['tld'][$c[0]]))
?self::God()->wrappers[$u... | php | public function stream_open($url, $mode, $options = STREAM_REPORT_ERRORS, &$opened_path = null){
$u = parse_url($url);
$c = explode('.',$u['host']);
$c = array_reverse($c);
$this->Controller = null;
$cN = (isset(self::God()->wrappers[$u['scheme']]['tld'][$c[0]]))
?self::God()->wrappers[$u... | [
"public",
"function",
"stream_open",
"(",
"$",
"url",
",",
"$",
"mode",
",",
"$",
"options",
"=",
"STREAM_REPORT_ERRORS",
",",
"&",
"$",
"opened_path",
"=",
"null",
")",
"{",
"$",
"u",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"$",
"c",
"=",
"ex... | Streaming Methods | [
"Streaming",
"Methods"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/frdl/webfan/App.php#L441-L464 |
jnaxo/country-codes | database/seeds/ChileanAdministrativeAreasSeeder.php | ChileanAdministrativeAreasSeeder.run | public function run()
{
DB::table('ctrystore_administrative_areas')->delete();
$today = date('Y-m-d H:i:s');
$data = [
['name' => 'Tarapacá', 'code' => 'TA', 'tag' => 'I'],
['name' => 'Antofagasta', 'code' => 'AN', 'tag' => 'II'],
['name' => 'Atacama', 'c... | php | public function run()
{
DB::table('ctrystore_administrative_areas')->delete();
$today = date('Y-m-d H:i:s');
$data = [
['name' => 'Tarapacá', 'code' => 'TA', 'tag' => 'I'],
['name' => 'Antofagasta', 'code' => 'AN', 'tag' => 'II'],
['name' => 'Atacama', 'c... | [
"public",
"function",
"run",
"(",
")",
"{",
"DB",
"::",
"table",
"(",
"'ctrystore_administrative_areas'",
")",
"->",
"delete",
"(",
")",
";",
"$",
"today",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"data",
"=",
"[",
"[",
"'name'",
"=>",
"'Tarap... | Run the database seeds. | [
"Run",
"the",
"database",
"seeds",
"."
] | train | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/database/seeds/ChileanAdministrativeAreasSeeder.php#L10-L54 |
SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.createService | public function createService(ServiceLocatorInterface $viewHelperManager)
{
$serviceLocator = $viewHelperManager->getServiceLocator();
$config = $serviceLocator->has('config') ? $serviceLocator->get('config') : array();
if (isset($config['dojo'])) {
$this->config($config['dojo'])... | php | public function createService(ServiceLocatorInterface $viewHelperManager)
{
$serviceLocator = $viewHelperManager->getServiceLocator();
$config = $serviceLocator->has('config') ? $serviceLocator->get('config') : array();
if (isset($config['dojo'])) {
$this->config($config['dojo'])... | [
"public",
"function",
"createService",
"(",
"ServiceLocatorInterface",
"$",
"viewHelperManager",
")",
"{",
"$",
"serviceLocator",
"=",
"$",
"viewHelperManager",
"->",
"getServiceLocator",
"(",
")",
";",
"$",
"config",
"=",
"$",
"serviceLocator",
"->",
"has",
"(",
... | Create and configure service
@see \Zend\ServiceManager\FactoryInterface::createService()
@param ServiceLocatorInterface $viewHelperManager
@return \Spork\View\Helper\Dojo | [
"Create",
"and",
"configure",
"service"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L118-L133 |
SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.setDebug | public function setDebug($flag = true)
{
$this->debug = $this->getSession()->debug = (bool) $flag;
if (true == $this->debug) {
if (isset($this->options['debugOptions'])
&& is_array($this->options['debugOptions'])) {
$this->initializeOptions($this->opti... | php | public function setDebug($flag = true)
{
$this->debug = $this->getSession()->debug = (bool) $flag;
if (true == $this->debug) {
if (isset($this->options['debugOptions'])
&& is_array($this->options['debugOptions'])) {
$this->initializeOptions($this->opti... | [
"public",
"function",
"setDebug",
"(",
"$",
"flag",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"debug",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"debug",
"=",
"(",
"bool",
")",
"$",
"flag",
";",
"if",
"(",
"true",
"==",
"$",
"this",
... | Set debug flag
@param string $flag | [
"Set",
"debug",
"flag"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L170-L181 |
SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.setPackages | public function setPackages(array $packages)
{
foreach ($packages as $name => $location) {
if (is_array($location)) {
if (array_key_exists('name', $location)
&& array_key_exists('location', $location)) {
$name = $location['name'];... | php | public function setPackages(array $packages)
{
foreach ($packages as $name => $location) {
if (is_array($location)) {
if (array_key_exists('name', $location)
&& array_key_exists('location', $location)) {
$name = $location['name'];... | [
"public",
"function",
"setPackages",
"(",
"array",
"$",
"packages",
")",
"{",
"foreach",
"(",
"$",
"packages",
"as",
"$",
"name",
"=>",
"$",
"location",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"location",
")",
")",
"{",
"if",
"(",
"array_key_exists"... | Set package
@param array $packages | [
"Set",
"package"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L244-L258 |
SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.config | public function config(array $options)
{
$this->options = $options;
$this->initializeOptions($options);
if ($this->getSession()->debug == true) {
$this->setDebug(true);
}
} | php | public function config(array $options)
{
$this->options = $options;
$this->initializeOptions($options);
if ($this->getSession()->debug == true) {
$this->setDebug(true);
}
} | [
"public",
"function",
"config",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"$",
"options",
";",
"$",
"this",
"->",
"initializeOptions",
"(",
"$",
"options",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getSession",
"(",
")... | Configure object
@param array $options | [
"Configure",
"object"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L316-L325 |
SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.initialize | public function initialize()
{
if (true == $this->initialized) {
return;
}
$this->initialized = true;
if ($this->isEnabled()) {
$headScript = $this->getView()->plugin('headScript');
$headScript->prependFile($this->src);
... | php | public function initialize()
{
if (true == $this->initialized) {
return;
}
$this->initialized = true;
if ($this->isEnabled()) {
$headScript = $this->getView()->plugin('headScript');
$headScript->prependFile($this->src);
... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"true",
"==",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"initialized",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")"... | Add Dojo configuration to HeadScript. Should only be called once. | [
"Add",
"Dojo",
"configuration",
"to",
"HeadScript",
".",
"Should",
"only",
"be",
"called",
"once",
"."
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L330-L360 |
SporkCode/Spork | src/View/Helper/Dojo.php | Dojo.initializeOptions | protected function initializeOptions(array $options)
{
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (method_exists($this, $method)) {
call_user_func(array($this, $method), $value);
}
}
} | php | protected function initializeOptions(array $options)
{
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (method_exists($this, $method)) {
call_user_func(array($this, $method), $value);
}
}
} | [
"protected",
"function",
"initializeOptions",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"method",
"=",
"'set'",
".",
"ucfirst",
"(",
"$",
"key",
")",
";",
"if",
"(",
... | Initialize options
@param array $options | [
"Initialize",
"options"
] | train | https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/Dojo.php#L377-L385 |
jasny/controller | src/Controller/View/PHP.php | PHP.getViewer | public function getViewer()
{
if (!isset($this->viewer)) {
$this->viewer = $this->createPHPView(['path' => $this->getViewPath()]);
}
return $this->viewer;
} | php | public function getViewer()
{
if (!isset($this->viewer)) {
$this->viewer = $this->createPHPView(['path' => $this->getViewPath()]);
}
return $this->viewer;
} | [
"public",
"function",
"getViewer",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"viewer",
")",
")",
"{",
"$",
"this",
"->",
"viewer",
"=",
"$",
"this",
"->",
"createPHPView",
"(",
"[",
"'path'",
"=>",
"$",
"this",
"->",
"getViewP... | Get the template engine abstraction
@return PHPView | [
"Get",
"the",
"template",
"engine",
"abstraction"
] | train | https://github.com/jasny/controller/blob/28edf64343f1d8218c166c0c570128e1ee6153d8/src/Controller/View/PHP.php#L20-L27 |
AbuseIO/parser-copyrightcompliance | src/Copyrightcompliance.php | Copyrightcompliance.parse | public function parse()
{
// ACNS: Automated Copyright Notice System
$foundAcnsFile = false;
foreach ($this->parsedMail->getAttachments() as $attachment) {
// Only use the Copyrightcompliance formatted reports, skip all others
if (preg_match(config("{$this->configBas... | php | public function parse()
{
// ACNS: Automated Copyright Notice System
$foundAcnsFile = false;
foreach ($this->parsedMail->getAttachments() as $attachment) {
// Only use the Copyrightcompliance formatted reports, skip all others
if (preg_match(config("{$this->configBas... | [
"public",
"function",
"parse",
"(",
")",
"{",
"// ACNS: Automated Copyright Notice System",
"$",
"foundAcnsFile",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"parsedMail",
"->",
"getAttachments",
"(",
")",
"as",
"$",
"attachment",
")",
"{",
"// Only us... | Parse attachments
@return array Returns array with failed or success data
(See parser-common/src/Parser.php) for more info. | [
"Parse",
"attachments"
] | train | https://github.com/AbuseIO/parser-copyrightcompliance/blob/1f8ef247ae3a1f8e5dfc0f7dd97bba63a76b606a/src/Copyrightcompliance.php#L30-L81 |
mothership-ec/composer | src/Composer/Downloader/ArchiveDownloader.php | ArchiveDownloader.processUrl | protected function processUrl(PackageInterface $package, $url)
{
if ($package->getDistReference() && strpos($url, 'github.com')) {
if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
// update legacy github archives to API cal... | php | protected function processUrl(PackageInterface $package, $url)
{
if ($package->getDistReference() && strpos($url, 'github.com')) {
if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
// update legacy github archives to API cal... | [
"protected",
"function",
"processUrl",
"(",
"PackageInterface",
"$",
"package",
",",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"package",
"->",
"getDistReference",
"(",
")",
"&&",
"strpos",
"(",
"$",
"url",
",",
"'github.com'",
")",
")",
"{",
"if",
"(",
"p... | {@inheritdoc} | [
"{"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Downloader/ArchiveDownloader.php#L105-L125 |
mothership-ec/composer | src/Composer/Downloader/ArchiveDownloader.php | ArchiveDownloader.getFolderContent | private function getFolderContent($dir)
{
$finder = Finder::create()
->ignoreVCS(false)
->ignoreDotFiles(false)
->depth(0)
->in($dir);
return iterator_to_array($finder);
} | php | private function getFolderContent($dir)
{
$finder = Finder::create()
->ignoreVCS(false)
->ignoreDotFiles(false)
->depth(0)
->in($dir);
return iterator_to_array($finder);
} | [
"private",
"function",
"getFolderContent",
"(",
"$",
"dir",
")",
"{",
"$",
"finder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"ignoreVCS",
"(",
"false",
")",
"->",
"ignoreDotFiles",
"(",
"false",
")",
"->",
"depth",
"(",
"0",
")",
"->",
"in",
"... | Returns the folder content, excluding dotfiles
@param string $dir Directory
@return \SplFileInfo[] | [
"Returns",
"the",
"folder",
"content",
"excluding",
"dotfiles"
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Downloader/ArchiveDownloader.php#L143-L152 |
99designs/ergo-http | src/NullRequest.php | NullRequest.copy | public function copy($headers = false, $body = false, $url = false, $method = false)
{
return clone $this;
} | php | public function copy($headers = false, $body = false, $url = false, $method = false)
{
return clone $this;
} | [
"public",
"function",
"copy",
"(",
"$",
"headers",
"=",
"false",
",",
"$",
"body",
"=",
"false",
",",
"$",
"url",
"=",
"false",
",",
"$",
"method",
"=",
"false",
")",
"{",
"return",
"clone",
"$",
"this",
";",
"}"
] | Creates a new Request object with the parameters specified, or uses
the current object's parameters
@return object | [
"Creates",
"a",
"new",
"Request",
"object",
"with",
"the",
"parameters",
"specified",
"or",
"uses",
"the",
"current",
"object",
"s",
"parameters"
] | train | https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/NullRequest.php#L70-L73 |
HaaseIT/HCSF | src/Controller/CLI/Itemdata.php | Itemdata.removeDataWhere | public function removeDataWhere($field, $needle, $fieldtoremove)
{
foreach ($this->items as $key => $item) {
if (!empty($item['itm_data']->$field)) {
if ($needle) {
if ($item['itm_data']->$field == $needle && isset($item['itm_data']->$fieldtoremove)) {
... | php | public function removeDataWhere($field, $needle, $fieldtoremove)
{
foreach ($this->items as $key => $item) {
if (!empty($item['itm_data']->$field)) {
if ($needle) {
if ($item['itm_data']->$field == $needle && isset($item['itm_data']->$fieldtoremove)) {
... | [
"public",
"function",
"removeDataWhere",
"(",
"$",
"field",
",",
"$",
"needle",
",",
"$",
"fieldtoremove",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"item... | if $needls is set to false, existence of the field is enough to trigger removal | [
"if",
"$needls",
"is",
"set",
"to",
"false",
"existence",
"of",
"the",
"field",
"is",
"enough",
"to",
"trigger",
"removal"
] | train | https://github.com/HaaseIT/HCSF/blob/8c8f33e8230f1d8b225a9b92707a951565fce25d/src/Controller/CLI/Itemdata.php#L97-L114 |
inhere/php-librarys | src/Helpers/Sys.php | Sys.runCommand | public static function runCommand($command, $returnStatus = true)
{
$return_var = 1;
//system
if (\function_exists('system')) {
ob_start();
system($command, $return_var);
$output = ob_get_contents();
ob_end_clean();
// passthru
... | php | public static function runCommand($command, $returnStatus = true)
{
$return_var = 1;
//system
if (\function_exists('system')) {
ob_start();
system($command, $return_var);
$output = ob_get_contents();
ob_end_clean();
// passthru
... | [
"public",
"static",
"function",
"runCommand",
"(",
"$",
"command",
",",
"$",
"returnStatus",
"=",
"true",
")",
"{",
"$",
"return_var",
"=",
"1",
";",
"//system",
"if",
"(",
"\\",
"function_exists",
"(",
"'system'",
")",
")",
"{",
"ob_start",
"(",
")",
... | Method to execute a command in the sys
Uses :
1. system
2. passthru
3. exec
4. shell_exec
@param $command
@param bool $returnStatus
@return array | [
"Method",
"to",
"execute",
"a",
"command",
"in",
"the",
"sys",
"Uses",
":",
"1",
".",
"system",
"2",
".",
"passthru",
"3",
".",
"exec",
"4",
".",
"shell_exec"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/Sys.php#L70-L109 |
inhere/php-librarys | src/Helpers/Sys.php | Sys.getHostIP | public static function getHostIP(string $default = '127.0.0.1'): string
{
static $ip;
if ($ip) {
return $ip;
}
$host= gethostname();
$maybe = gethostbyname($host);
if ($host !== $maybe) {
$ip = $maybe;
return $ip;
}
... | php | public static function getHostIP(string $default = '127.0.0.1'): string
{
static $ip;
if ($ip) {
return $ip;
}
$host= gethostname();
$maybe = gethostbyname($host);
if ($host !== $maybe) {
$ip = $maybe;
return $ip;
}
... | [
"public",
"static",
"function",
"getHostIP",
"(",
"string",
"$",
"default",
"=",
"'127.0.0.1'",
")",
":",
"string",
"{",
"static",
"$",
"ip",
";",
"if",
"(",
"$",
"ip",
")",
"{",
"return",
"$",
"ip",
";",
"}",
"$",
"host",
"=",
"gethostname",
"(",
... | 当前主机的外网IP
@param string $default
@return string | [
"当前主机的外网IP"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/Sys.php#L138-L166 |
inhere/php-librarys | src/Helpers/Sys.php | Sys.gitCheck | public static function gitCheck()
{
if (PHP_SAPI === 'cli') {
$_GET = getopt('d::', ['dir::']);
}
// 获取要查看的目录,没有则检测当前目录
$dir = $_GET['d'] ?? ($_GET['dir'] ?? __DIR__);
if (!is_dir($dir)) {
trigger_error($dir);
}
ob_start();
s... | php | public static function gitCheck()
{
if (PHP_SAPI === 'cli') {
$_GET = getopt('d::', ['dir::']);
}
// 获取要查看的目录,没有则检测当前目录
$dir = $_GET['d'] ?? ($_GET['dir'] ?? __DIR__);
if (!is_dir($dir)) {
trigger_error($dir);
}
ob_start();
s... | [
"public",
"static",
"function",
"gitCheck",
"(",
")",
"{",
"if",
"(",
"PHP_SAPI",
"===",
"'cli'",
")",
"{",
"$",
"_GET",
"=",
"getopt",
"(",
"'d::'",
",",
"[",
"'dir::'",
"]",
")",
";",
"}",
"// 获取要查看的目录,没有则检测当前目录",
"$",
"dir",
"=",
"$",
"_GET",
"[",... | 支持查看指定目录,默认当前目录
CLI:
php test.php -d=path
php test.php --dir=path
WEB:
/test.php?dir=path | [
"支持查看指定目录,默认当前目录",
"CLI",
":",
"php",
"test",
".",
"php",
"-",
"d",
"=",
"path",
"php",
"test",
".",
"php",
"--",
"dir",
"=",
"path",
"WEB",
":",
"/",
"test",
".",
"php?dir",
"=",
"path"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/Sys.php#L207-L229 |
c5labs/block-boilerplate | controller.php | Controller.validate | public function validate($data)
{
$errors = new \Concrete\Core\Error\Error();
/**
* if ('Oliver' !== $data['name']) {
* $errors['name'] = "You input the incorrect name.";
* }.
*/
if ($errors->has()) {
return $errors;
}
ret... | php | public function validate($data)
{
$errors = new \Concrete\Core\Error\Error();
/**
* if ('Oliver' !== $data['name']) {
* $errors['name'] = "You input the incorrect name.";
* }.
*/
if ($errors->has()) {
return $errors;
}
ret... | [
"public",
"function",
"validate",
"(",
"$",
"data",
")",
"{",
"$",
"errors",
"=",
"new",
"\\",
"Concrete",
"\\",
"Core",
"\\",
"Error",
"\\",
"Error",
"(",
")",
";",
"/**\n * if ('Oliver' !== $data['name']) {\n * $errors['name'] = \"You input the inc... | Run when the add or edit forms are submitted. This should return true if
validation is successful or a Concrete\Core\Error\Error() object if it fails.
@param $data
@return bool|Error | [
"Run",
"when",
"the",
"add",
"or",
"edit",
"forms",
"are",
"submitted",
".",
"This",
"should",
"return",
"true",
"if",
"validation",
"is",
"successful",
"or",
"a",
"Concrete",
"\\",
"Core",
"\\",
"Error",
"\\",
"Error",
"()",
"object",
"if",
"it",
"fails... | train | https://github.com/c5labs/block-boilerplate/blob/ed011364db67d8e219fdb3e18ff3d3e87027b565/controller.php#L281-L295 |
c5labs/block-boilerplate | controller.php | Controller.import | public function import($page, $areaHandle, SimpleXMLElement $blockNode)
{
parent::import($page, $areaHandle, $blockNode);
} | php | public function import($page, $areaHandle, SimpleXMLElement $blockNode)
{
parent::import($page, $areaHandle, $blockNode);
} | [
"public",
"function",
"import",
"(",
"$",
"page",
",",
"$",
"areaHandle",
",",
"SimpleXMLElement",
"$",
"blockNode",
")",
"{",
"parent",
"::",
"import",
"(",
"$",
"page",
",",
"$",
"areaHandle",
",",
"$",
"blockNode",
")",
";",
"}"
] | Runs when a block is being imported.
@param Page $page
@param string $areaHandle
@param SimpleXMLElement $blockNode
@return void | [
"Runs",
"when",
"a",
"block",
"is",
"being",
"imported",
"."
] | train | https://github.com/c5labs/block-boilerplate/blob/ed011364db67d8e219fdb3e18ff3d3e87027b565/controller.php#L371-L374 |
phootwork/lang | src/ArrayObject.php | ArrayObject.add | public function add($element, $index = null) {
if ($index === null) {
$this->array[$this->count()] = $element;
} else {
array_splice($this->array, $index, 0, $element);
}
return $this;
} | php | public function add($element, $index = null) {
if ($index === null) {
$this->array[$this->count()] = $element;
} else {
array_splice($this->array, $index, 0, $element);
}
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"element",
",",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"index",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"array",
"[",
"$",
"this",
"->",
"count",
"(",
")",
"]",
"=",
"$",
"element",
";",
... | Adds an element to that array
@param mixed $element
@param int $index
@return $this | [
"Adds",
"an",
"element",
"to",
"that",
"array"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L100-L108 |
phootwork/lang | src/ArrayObject.php | ArrayObject.splice | public function splice($offset, $length = null, $replacement = []) {
$length = $length === null ? $this->count() : $length;
array_splice($this->array, $offset, $length, $replacement);
return $this;
} | php | public function splice($offset, $length = null, $replacement = []) {
$length = $length === null ? $this->count() : $length;
array_splice($this->array, $offset, $length, $replacement);
return $this;
} | [
"public",
"function",
"splice",
"(",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
",",
"$",
"replacement",
"=",
"[",
"]",
")",
"{",
"$",
"length",
"=",
"$",
"length",
"===",
"null",
"?",
"$",
"this",
"->",
"count",
"(",
")",
":",
"$",
"length"... | Remove a portion of the array and replace it with something else
@param int $offset If offset is positive then the start of removed portion is at that offset from the beginning of the input array. If offset is negative then it starts that far from the end of the input array.
@param int $length If length is omitted, re... | [
"Remove",
"a",
"portion",
"of",
"the",
"array",
"and",
"replace",
"it",
"with",
"something",
"else"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L208-L212 |
phootwork/lang | src/ArrayObject.php | ArrayObject.doSort | protected function doSort(&$array, $cmp, callable $usort, callable $sort) {
if (is_callable($cmp)) {
$usort($array, $cmp);
} else if ($cmp instanceof Comparator) {
$usort($array, function ($a, $b) use ($cmp) {
return $cmp->compare($a, $b);
});
} else {
$sort($array);
}
} | php | protected function doSort(&$array, $cmp, callable $usort, callable $sort) {
if (is_callable($cmp)) {
$usort($array, $cmp);
} else if ($cmp instanceof Comparator) {
$usort($array, function ($a, $b) use ($cmp) {
return $cmp->compare($a, $b);
});
} else {
$sort($array);
}
} | [
"protected",
"function",
"doSort",
"(",
"&",
"$",
"array",
",",
"$",
"cmp",
",",
"callable",
"$",
"usort",
",",
"callable",
"$",
"sort",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"cmp",
")",
")",
"{",
"$",
"usort",
"(",
"$",
"array",
",",
"$"... | Internal sort function
@param array $array the array on which is operated on
@param Comparator|callable $cmp the compare function
@param callable $usort the sort function for user passed $cmd
@param callable $sort the default sort function | [
"Internal",
"sort",
"function"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L264-L274 |
phootwork/lang | src/ArrayObject.php | ArrayObject.find | public function find() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
foreach ($this->array as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if ($return) {
return ... | php | public function find() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
foreach ($this->array as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if ($return) {
return ... | [
"public",
"function",
"find",
"(",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"1",
")",
"{",
"$",
"callback",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"$",
"callb... | Searches the array with a given callback and returns the first element if found.
The callback function takes one or two parameters:
function ($element [, $query]) {}
The callback must return a boolean
@param mixed $query OPTIONAL the provided query
@param callable $callback the callback function
@return mixed|null ... | [
"Searches",
"the",
"array",
"with",
"a",
"given",
"callback",
"and",
"returns",
"the",
"first",
"element",
"if",
"found",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L382-L399 |
phootwork/lang | src/ArrayObject.php | ArrayObject.findLast | public function findLast() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$reverse = array_reverse($this->array, true);
foreach ($reverse as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($... | php | public function findLast() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$reverse = array_reverse($this->array, true);
foreach ($reverse as $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($... | [
"public",
"function",
"findLast",
"(",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"1",
")",
"{",
"$",
"callback",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"$",
"c... | Searches the array with a given callback and returns the last element if found.
The callback function takes one or two parameters:
function ($element [, $query]) {}
The callback must return a boolean
@param mixed $query OPTIONAL the provided query
@param callable $callback the callback function
@return mixed|null t... | [
"Searches",
"the",
"array",
"with",
"a",
"given",
"callback",
"and",
"returns",
"the",
"last",
"element",
"if",
"found",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L414-L432 |
phootwork/lang | src/ArrayObject.php | ArrayObject.findAll | public function findAll() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$array = [];
foreach ($this->array as $k => $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if... | php | public function findAll() {
if (func_num_args() == 1) {
$callback = func_get_arg(0);
} else {
$query = func_get_arg(0);
$callback = func_get_arg(1);
}
$array = [];
foreach ($this->array as $k => $element) {
$return = func_num_args() == 1 ? $callback($element) : $callback($element, $query);
if... | [
"public",
"function",
"findAll",
"(",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"1",
")",
"{",
"$",
"callback",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"}",
"else",
"{",
"$",
"query",
"=",
"func_get_arg",
"(",
"0",
")",
";",
"$",
"ca... | Searches the array with a given callback and returns all matching elements.
The callback function takes one or two parameters:
function ($element [, $query]) {}
The callback must return a boolean
@param mixed $query OPTIONAL the provided query
@param callable $callback the callback function
@return mixed|null the f... | [
"Searches",
"the",
"array",
"with",
"a",
"given",
"callback",
"and",
"returns",
"all",
"matching",
"elements",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/ArrayObject.php#L447-L465 |
sleeping-owl/route-priority | src/SleepingOwl/RoutePriority/RouteCollection.php | RouteCollection.addToCollections | protected function addToCollections($route)
{
$domainAndUri = $route->domain() . $route->getUri();
foreach ($route->methods() as $method)
{
$this->routes[$method][$domainAndUri] = $route;
}
$this->allRoutes[$method . $domainAndUri] = $route;
} | php | protected function addToCollections($route)
{
$domainAndUri = $route->domain() . $route->getUri();
foreach ($route->methods() as $method)
{
$this->routes[$method][$domainAndUri] = $route;
}
$this->allRoutes[$method . $domainAndUri] = $route;
} | [
"protected",
"function",
"addToCollections",
"(",
"$",
"route",
")",
"{",
"$",
"domainAndUri",
"=",
"$",
"route",
"->",
"domain",
"(",
")",
".",
"$",
"route",
"->",
"getUri",
"(",
")",
";",
"foreach",
"(",
"$",
"route",
"->",
"methods",
"(",
")",
"as... | Add the given route to the arrays of routes.
@param \Illuminate\Routing\Route $route
@return void | [
"Add",
"the",
"given",
"route",
"to",
"the",
"arrays",
"of",
"routes",
"."
] | train | https://github.com/sleeping-owl/route-priority/blob/fd311e5cdb2135e3aa34e9ef37c8f4f02c635089/src/SleepingOwl/RoutePriority/RouteCollection.php#L35-L45 |
php-lug/lug | src/Bundle/ResourceBundle/EventSubscriber/Doctrine/ORM/ResolveTargetEntitySubscriber.php | ResolveTargetEntitySubscriber.addResolveTargetEntity | public function addResolveTargetEntity($originalEntity, $newEntity, array $mapping)
{
$mapping['targetEntity'] = ltrim($newEntity, '\\\\');
$this->resolveTargetEntities[ltrim($originalEntity, '\\\\')] = $mapping;
parent::addResolveTargetEntity($originalEntity, $newEntity, $mapping);
} | php | public function addResolveTargetEntity($originalEntity, $newEntity, array $mapping)
{
$mapping['targetEntity'] = ltrim($newEntity, '\\\\');
$this->resolveTargetEntities[ltrim($originalEntity, '\\\\')] = $mapping;
parent::addResolveTargetEntity($originalEntity, $newEntity, $mapping);
} | [
"public",
"function",
"addResolveTargetEntity",
"(",
"$",
"originalEntity",
",",
"$",
"newEntity",
",",
"array",
"$",
"mapping",
")",
"{",
"$",
"mapping",
"[",
"'targetEntity'",
"]",
"=",
"ltrim",
"(",
"$",
"newEntity",
",",
"'\\\\\\\\'",
")",
";",
"$",
"t... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/ResourceBundle/EventSubscriber/Doctrine/ORM/ResolveTargetEntitySubscriber.php#L39-L45 |
php-lug/lug | src/Bundle/ResourceBundle/EventSubscriber/Doctrine/ORM/ResolveTargetEntitySubscriber.php | ResolveTargetEntitySubscriber.loadClassMetadata | public function loadClassMetadata(LoadClassMetadataEventArgs $event)
{
$map = [];
$metadata = $event->getClassMetadata();
foreach ($metadata->discriminatorMap as $discriminatorName => $discriminatorClass) {
if (isset($this->resolveTargetEntities[$discriminatorClass])) {
... | php | public function loadClassMetadata(LoadClassMetadataEventArgs $event)
{
$map = [];
$metadata = $event->getClassMetadata();
foreach ($metadata->discriminatorMap as $discriminatorName => $discriminatorClass) {
if (isset($this->resolveTargetEntities[$discriminatorClass])) {
... | [
"public",
"function",
"loadClassMetadata",
"(",
"LoadClassMetadataEventArgs",
"$",
"event",
")",
"{",
"$",
"map",
"=",
"[",
"]",
";",
"$",
"metadata",
"=",
"$",
"event",
"->",
"getClassMetadata",
"(",
")",
";",
"foreach",
"(",
"$",
"metadata",
"->",
"discr... | {@inheritdoc} | [
"{"
] | train | https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/ResourceBundle/EventSubscriber/Doctrine/ORM/ResolveTargetEntitySubscriber.php#L50-L64 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/translation_manager.php | ezcTranslationManager.getFromCache | private function getFromCache( $locale, $context )
{
if ( isset( $this->contextCache[$locale][$context] ) )
{
return $this->contextCache[$locale][$context];
}
return null;
} | php | private function getFromCache( $locale, $context )
{
if ( isset( $this->contextCache[$locale][$context] ) )
{
return $this->contextCache[$locale][$context];
}
return null;
} | [
"private",
"function",
"getFromCache",
"(",
"$",
"locale",
",",
"$",
"context",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"contextCache",
"[",
"$",
"locale",
"]",
"[",
"$",
"context",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"co... | Returns the translation for the context $context with the locale $locale.
Null is returned if no such context exists.
@param string $locale
@param string $context
@return ezcTranslation | [
"Returns",
"the",
"translation",
"for",
"the",
"context",
"$context",
"with",
"the",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/translation_manager.php#L103-L110 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/translation_manager.php | ezcTranslationManager.putToCache | private function putToCache( $locale, $contextName, ezcTranslation $contextData )
{
$this->contextCache[$locale][$contextName] = $contextData;
} | php | private function putToCache( $locale, $contextName, ezcTranslation $contextData )
{
$this->contextCache[$locale][$contextName] = $contextData;
} | [
"private",
"function",
"putToCache",
"(",
"$",
"locale",
",",
"$",
"contextName",
",",
"ezcTranslation",
"$",
"contextData",
")",
"{",
"$",
"this",
"->",
"contextCache",
"[",
"$",
"locale",
"]",
"[",
"$",
"contextName",
"]",
"=",
"$",
"contextData",
";",
... | Stores $contextData with the name $contextName and locale $locale
to the context cache
@param string $locale
@param string $contextName
@param ezcTranslation $contextData
@return void | [
"Stores",
"$contextData",
"with",
"the",
"name",
"$contextName",
"and",
"locale",
"$locale",
"to",
"the",
"context",
"cache"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/translation_manager.php#L121-L124 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/translation_manager.php | ezcTranslationManager.getContext | public function getContext( $locale, $context )
{
// Try to find the context in the cache
if ( ( $translationContext = $this->getFromCache( $locale, $context) ) !== null )
{
return $translationContext;
}
// Retrieve the context through the backend and apply filter... | php | public function getContext( $locale, $context )
{
// Try to find the context in the cache
if ( ( $translationContext = $this->getFromCache( $locale, $context) ) !== null )
{
return $translationContext;
}
// Retrieve the context through the backend and apply filter... | [
"public",
"function",
"getContext",
"(",
"$",
"locale",
",",
"$",
"context",
")",
"{",
"// Try to find the context in the cache",
"if",
"(",
"(",
"$",
"translationContext",
"=",
"$",
"this",
"->",
"getFromCache",
"(",
"$",
"locale",
",",
"$",
"context",
")",
... | Returns the translations for the $context context and the locale $locale.
This methods reads the context data from the backend and applies the
filters before returning the translation map as part of the
ezcTranslation object that it returns.
@param string $locale
@param string $context
@return ezcTranslation | [
"Returns",
"the",
"translations",
"for",
"the",
"$context",
"context",
"and",
"the",
"locale",
"$locale",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/translation_manager.php#L137-L154 |
WScore/Validation | src/Rules.php | Rules.offsetGet | public function offsetGet($offset)
{
return array_key_exists($offset, $this->filter) ? $this->filter[$offset] : null;
} | php | public function offsetGet($offset)
{
return array_key_exists($offset, $this->filter) ? $this->filter[$offset] : null;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"offset",
",",
"$",
"this",
"->",
"filter",
")",
"?",
"$",
"this",
"->",
"filter",
"[",
"$",
"offset",
"]",
":",
"null",
";",
"}"
] | Offset to retrieve
@param mixed $offset The offset to retrieve.
@return mixed Can return all value types. | [
"Offset",
"to",
"retrieve"
] | train | https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Rules.php#L342-L345 |
inhere/php-librarys | src/Traits/TraitUseAlias.php | TraitUseAlias.alias | public function alias($alias, $value = '')
{
// set
if ($alias && $value) {
$this->aliasAndValueCheck($alias, $value);
$this->aliases[$alias] = trim($value);
// get
} else {
return $this->resolveAlias($alias);
}
return $this;
... | php | public function alias($alias, $value = '')
{
// set
if ($alias && $value) {
$this->aliasAndValueCheck($alias, $value);
$this->aliases[$alias] = trim($value);
// get
} else {
return $this->resolveAlias($alias);
}
return $this;
... | [
"public",
"function",
"alias",
"(",
"$",
"alias",
",",
"$",
"value",
"=",
"''",
")",
"{",
"// set",
"if",
"(",
"$",
"alias",
"&&",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"aliasAndValueCheck",
"(",
"$",
"alias",
",",
"$",
"value",
")",
";",
"$... | 设置/获取别名
@param string $alias 别名
@param string $value 真实的值. 为空用于获取
@throws \RuntimeException
@return mixed | [
"设置",
"/",
"获取别名"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Traits/TraitUseAlias.php#L30-L43 |
inhere/php-librarys | src/Traits/TraitUseAlias.php | TraitUseAlias.loadAliases | public function loadAliases(array $aliases)
{
foreach ($aliases as $alias => $path) {
$this->alias($alias, $path);
}
return $this;
} | php | public function loadAliases(array $aliases)
{
foreach ($aliases as $alias => $path) {
$this->alias($alias, $path);
}
return $this;
} | [
"public",
"function",
"loadAliases",
"(",
"array",
"$",
"aliases",
")",
"{",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
"=>",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"alias",
"(",
"$",
"alias",
",",
"$",
"path",
")",
";",
"}",
"return",
... | 载入别名设置
@param array $aliases
@return $this
@throws \RuntimeException | [
"载入别名设置"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Traits/TraitUseAlias.php#L103-L110 |
nonzod/yii2-foundation | Widget.php | Widget.init | public function init() {
parent::init();
if (empty($this->options['id'])) {
$this->options['id'] = $this->getId();
}
} | php | public function init() {
parent::init();
if (empty($this->options['id'])) {
$this->options['id'] = $this->getId();
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'id'",
"]",
"=",
"$",
"this",
"->",
... | Initialize the widget | [
"Initialize",
"the",
"widget"
] | train | https://github.com/nonzod/yii2-foundation/blob/5df93b8a39a73a7fade2f3189693fdb6625205d2/Widget.php#L39-L44 |
nonzod/yii2-foundation | Widget.php | Widget.registerPlugin | protected function registerPlugin($name = '') {
$view = $this->getView();
//$id = $this->options['id'];
if ($this->clientOptions !== false) {
$options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
$js = "$(document).foundation({ '$name' : { $options } });";
... | php | protected function registerPlugin($name = '') {
$view = $this->getView();
//$id = $this->options['id'];
if ($this->clientOptions !== false) {
$options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
$js = "$(document).foundation({ '$name' : { $options } });";
... | [
"protected",
"function",
"registerPlugin",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"getView",
"(",
")",
";",
"//$id = $this->options['id'];",
"if",
"(",
"$",
"this",
"->",
"clientOptions",
"!==",
"false",
")",
"{",
"$"... | Registers a specific Foundation plugin and call related methods
@param string $name the name of the Foundation plugin
@todo far caricare solo i js dei plugin in uso | [
"Registers",
"a",
"specific",
"Foundation",
"plugin",
"and",
"call",
"related",
"methods"
] | train | https://github.com/nonzod/yii2-foundation/blob/5df93b8a39a73a7fade2f3189693fdb6625205d2/Widget.php#L51-L69 |
oroinc/OroLayoutComponent | BlockOptionsResolver.php | BlockOptionsResolver.resolveOptions | public function resolveOptions($blockType, array $options = [])
{
$resolver = $this->getOptionResolver($blockType);
return $resolver->resolve($options);
} | php | public function resolveOptions($blockType, array $options = [])
{
$resolver = $this->getOptionResolver($blockType);
return $resolver->resolve($options);
} | [
"public",
"function",
"resolveOptions",
"(",
"$",
"blockType",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"resolver",
"=",
"$",
"this",
"->",
"getOptionResolver",
"(",
"$",
"blockType",
")",
";",
"return",
"$",
"resolver",
"->",
"resolve... | Returns the combination of the default options for the given block type and the passed options
@param string|BlockTypeInterface $blockType The block type name or instance of BlockTypeInterface
@param array $options The options
@return array A list of options and their values
@throws InvalidOpti... | [
"Returns",
"the",
"combination",
"of",
"the",
"default",
"options",
"for",
"the",
"given",
"block",
"type",
"and",
"the",
"passed",
"options"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/BlockOptionsResolver.php#L34-L39 |
oroinc/OroLayoutComponent | BlockOptionsResolver.php | BlockOptionsResolver.getOptionResolver | protected function getOptionResolver($blockType)
{
if ($blockType instanceof BlockTypeInterface) {
$name = $blockType->getName();
$type = $blockType;
} else {
$name = $blockType;
$type = null;
}
if (!isset($this->resolvers[$name])) {
... | php | protected function getOptionResolver($blockType)
{
if ($blockType instanceof BlockTypeInterface) {
$name = $blockType->getName();
$type = $blockType;
} else {
$name = $blockType;
$type = null;
}
if (!isset($this->resolvers[$name])) {
... | [
"protected",
"function",
"getOptionResolver",
"(",
"$",
"blockType",
")",
"{",
"if",
"(",
"$",
"blockType",
"instanceof",
"BlockTypeInterface",
")",
"{",
"$",
"name",
"=",
"$",
"blockType",
"->",
"getName",
"(",
")",
";",
"$",
"type",
"=",
"$",
"blockType"... | @param string|BlockTypeInterface $blockType
@return OptionsResolver | [
"@param",
"string|BlockTypeInterface",
"$blockType"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/BlockOptionsResolver.php#L46-L73 |
zhouyl/mellivora | Mellivora/Http/HttpServiceProvider.php | HttpServiceProvider.registerCookiesProvider | public function registerCookiesProvider()
{
$this->container['cookies'] = function ($container) {
$config = $container['config']->get('session.cookies');
$cookies = new Cookies($config->toArray());
// 数据需要加密处理
if ($config->encrypt) {
$cookies... | php | public function registerCookiesProvider()
{
$this->container['cookies'] = function ($container) {
$config = $container['config']->get('session.cookies');
$cookies = new Cookies($config->toArray());
// 数据需要加密处理
if ($config->encrypt) {
$cookies... | [
"public",
"function",
"registerCookiesProvider",
"(",
")",
"{",
"$",
"this",
"->",
"container",
"[",
"'cookies'",
"]",
"=",
"function",
"(",
"$",
"container",
")",
"{",
"$",
"config",
"=",
"$",
"container",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'sessi... | 注册 Cookies 服务 | [
"注册",
"Cookies",
"服务"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/HttpServiceProvider.php#L25-L39 |
zhouyl/mellivora | Mellivora/Http/HttpServiceProvider.php | HttpServiceProvider.registerResponseProvider | public function registerResponseProvider()
{
$this->container['response'] = function ($container) {
$headers = new Headers(['Content-Type' => 'text/html; charset=UTF-8']);
$response = new Response(200, $headers);
return $response->withProtocolVersion($container['setting... | php | public function registerResponseProvider()
{
$this->container['response'] = function ($container) {
$headers = new Headers(['Content-Type' => 'text/html; charset=UTF-8']);
$response = new Response(200, $headers);
return $response->withProtocolVersion($container['setting... | [
"public",
"function",
"registerResponseProvider",
"(",
")",
"{",
"$",
"this",
"->",
"container",
"[",
"'response'",
"]",
"=",
"function",
"(",
"$",
"container",
")",
"{",
"$",
"headers",
"=",
"new",
"Headers",
"(",
"[",
"'Content-Type'",
"=>",
"'text/html; c... | 注册 Http Response 服务 | [
"注册",
"Http",
"Response",
"服务"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Http/HttpServiceProvider.php#L54-L62 |
j-d/draggy | src/Draggy/Autocode/CPPEntity.php | CPPEntity.shouldRender | public function shouldRender($templateName)
{
switch ($templateName) {
case 'entity':
return true;
case 'entity-header':
return true;
case 'entity-base':
return $this->getProject()->getAutocodeProperty('base');
c... | php | public function shouldRender($templateName)
{
switch ($templateName) {
case 'entity':
return true;
case 'entity-header':
return true;
case 'entity-base':
return $this->getProject()->getAutocodeProperty('base');
c... | [
"public",
"function",
"shouldRender",
"(",
"$",
"templateName",
")",
"{",
"switch",
"(",
"$",
"templateName",
")",
"{",
"case",
"'entity'",
":",
"return",
"true",
";",
"case",
"'entity-header'",
":",
"return",
"true",
";",
"case",
"'entity-base'",
":",
"retu... | {@inheritdoc} | [
"{"
] | train | https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/CPPEntity.php#L10-L24 |
mothership-ec/composer | src/Composer/Repository/FilesystemRepository.php | FilesystemRepository.initialize | protected function initialize()
{
parent::initialize();
if (!$this->file->exists()) {
return;
}
try {
$packages = $this->file->read();
if (!is_array($packages)) {
throw new \UnexpectedValueException('Could not parse package list ... | php | protected function initialize()
{
parent::initialize();
if (!$this->file->exists()) {
return;
}
try {
$packages = $this->file->read();
if (!is_array($packages)) {
throw new \UnexpectedValueException('Could not parse package list ... | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"parent",
"::",
"initialize",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"file",
"->",
"exists",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"$",
"packages",
"=",
"$",
"this",
"... | Initializes repository (reads file, or remote address). | [
"Initializes",
"repository",
"(",
"reads",
"file",
"or",
"remote",
"address",
")",
"."
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/FilesystemRepository.php#L42-L65 |
mothership-ec/composer | src/Composer/Repository/FilesystemRepository.php | FilesystemRepository.write | public function write()
{
$data = array();
$dumper = new ArrayDumper();
foreach ($this->getCanonicalPackages() as $package) {
$data[] = $dumper->dump($package);
}
$this->file->write($data);
} | php | public function write()
{
$data = array();
$dumper = new ArrayDumper();
foreach ($this->getCanonicalPackages() as $package) {
$data[] = $dumper->dump($package);
}
$this->file->write($data);
} | [
"public",
"function",
"write",
"(",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"dumper",
"=",
"new",
"ArrayDumper",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCanonicalPackages",
"(",
")",
"as",
"$",
"package",
")",
"{",
"$... | Writes writable repository. | [
"Writes",
"writable",
"repository",
"."
] | train | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/FilesystemRepository.php#L76-L86 |
phPoirot/psr7 | HttpResponse.php | HttpResponse.getReasonPhrase | function getReasonPhrase()
{
if (!$this->reasonPhrase)
$this->reasonPhrase = \Poirot\Psr7\Response\getStatReasonFromCode($this->getStatusCode());
return $this->reasonPhrase;
} | php | function getReasonPhrase()
{
if (!$this->reasonPhrase)
$this->reasonPhrase = \Poirot\Psr7\Response\getStatReasonFromCode($this->getStatusCode());
return $this->reasonPhrase;
} | [
"function",
"getReasonPhrase",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"reasonPhrase",
")",
"$",
"this",
"->",
"reasonPhrase",
"=",
"\\",
"Poirot",
"\\",
"Psr7",
"\\",
"Response",
"\\",
"getStatReasonFromCode",
"(",
"$",
"this",
"->",
"getStatusC... | {@inheritdoc} | [
"{"
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/HttpResponse.php#L66-L72 |
phPoirot/psr7 | HttpResponse.php | HttpResponse.withStatus | function withStatus($code, $reasonPhrase = '')
{
$this->_assertValidateStatus($code);
$new = clone $this;
$new->statusCode = (int) $code;
$new->reasonPhrase = $reasonPhrase;
return $new;
} | php | function withStatus($code, $reasonPhrase = '')
{
$this->_assertValidateStatus($code);
$new = clone $this;
$new->statusCode = (int) $code;
$new->reasonPhrase = $reasonPhrase;
return $new;
} | [
"function",
"withStatus",
"(",
"$",
"code",
",",
"$",
"reasonPhrase",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"_assertValidateStatus",
"(",
"$",
"code",
")",
";",
"$",
"new",
"=",
"clone",
"$",
"this",
";",
"$",
"new",
"->",
"statusCode",
"=",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/HttpResponse.php#L77-L85 |
phPoirot/psr7 | HttpResponse.php | HttpResponse._assertValidateStatus | protected function _assertValidateStatus($code)
{
if (! is_numeric($code)
|| is_float($code)
|| $code < 100
|| $code >= 600
)
throw new \InvalidArgumentException(sprintf(
'Invalid status code "%s"; must be an integer between 100 and 599... | php | protected function _assertValidateStatus($code)
{
if (! is_numeric($code)
|| is_float($code)
|| $code < 100
|| $code >= 600
)
throw new \InvalidArgumentException(sprintf(
'Invalid status code "%s"; must be an integer between 100 and 599... | [
"protected",
"function",
"_assertValidateStatus",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"code",
")",
"||",
"is_float",
"(",
"$",
"code",
")",
"||",
"$",
"code",
"<",
"100",
"||",
"$",
"code",
">=",
"600",
")",
"throw",
... | Validate a status code.
@param int|string $code
@throws \InvalidArgumentException on an invalid status code. | [
"Validate",
"a",
"status",
"code",
"."
] | train | https://github.com/phPoirot/psr7/blob/e90295e806dc2eb0cc422f315075f673c63a0780/HttpResponse.php#L93-L104 |
m4grio/bangkok-insurance-php | src/Client/ModelClient.php | ModelClient.call | public function call($method, Array $params = [])
{
$rawResult = parent::call($method, $params);
switch ($method) {
case 'GetCarBrandAndModel':
$result = $rawResult->GetCarBrandAndModelReturn->MakeModelBean;
break;
case 'GetCarBrand':
... | php | public function call($method, Array $params = [])
{
$rawResult = parent::call($method, $params);
switch ($method) {
case 'GetCarBrandAndModel':
$result = $rawResult->GetCarBrandAndModelReturn->MakeModelBean;
break;
case 'GetCarBrand':
... | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"Array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"rawResult",
"=",
"parent",
"::",
"call",
"(",
"$",
"method",
",",
"$",
"params",
")",
";",
"switch",
"(",
"$",
"method",
")",
"{",
"case... | @param $method
@param array $params
@return mixed
@throws \Exception
@throws \SoapFault | [
"@param",
"$method",
"@param",
"array",
"$params"
] | train | https://github.com/m4grio/bangkok-insurance-php/blob/400266d043abe6b7cacb9da36064cbb169149c2a/src/Client/ModelClient.php#L29-L43 |
leprephp/http-server | src/Server.php | Server.append | public function append($middleware, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildAlwaysTrue(),
$priority
);
} | php | public function append($middleware, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildAlwaysTrue(),
$priority
);
} | [
"public",
"function",
"append",
"(",
"$",
"middleware",
",",
"$",
"priority",
"=",
"0",
")",
":",
"Server",
"{",
"return",
"$",
"this",
"->",
"appendOnCondition",
"(",
"$",
"middleware",
",",
"$",
"this",
"->",
"buildAlwaysTrue",
"(",
")",
",",
"$",
"p... | Always adds a middleware to the stack.
The middleware will run in any case.
@param MiddlewareInterface|callable|array $middleware
@param int $priority
@return Server | [
"Always",
"adds",
"a",
"middleware",
"to",
"the",
"stack",
"."
] | train | https://github.com/leprephp/http-server/blob/2e307c80986456f7c53248b792771cb13bb4234d/src/Server.php#L63-L70 |
leprephp/http-server | src/Server.php | Server.appendOnPath | public function appendOnPath($middleware, string $path, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildPathCondition($path),
$priority
);
} | php | public function appendOnPath($middleware, string $path, $priority = 0): Server
{
return $this->appendOnCondition(
$middleware,
$this->buildPathCondition($path),
$priority
);
} | [
"public",
"function",
"appendOnPath",
"(",
"$",
"middleware",
",",
"string",
"$",
"path",
",",
"$",
"priority",
"=",
"0",
")",
":",
"Server",
"{",
"return",
"$",
"this",
"->",
"appendOnCondition",
"(",
"$",
"middleware",
",",
"$",
"this",
"->",
"buildPat... | Adds a middleware to the stack only if the request path matches.
The path must match exactly. If the "*" character is present, a comparison will be
made via regex. For example: the path '/api' matches only with request path '/api'.
But the path '/api/*' matches with all request paths that start with '/api/'.
The only... | [
"Adds",
"a",
"middleware",
"to",
"the",
"stack",
"only",
"if",
"the",
"request",
"path",
"matches",
"."
] | train | https://github.com/leprephp/http-server/blob/2e307c80986456f7c53248b792771cb13bb4234d/src/Server.php#L90-L97 |
leprephp/http-server | src/Server.php | Server.appendOnCondition | public function appendOnCondition($middleware, callable $condition, $priority = 0): Server
{
if (!is_array($middleware)) {
$middleware = [$middleware];
}
foreach ($middleware as $mw) {
$this->stack[$priority][] = [$condition, $mw];
}
return $this;
... | php | public function appendOnCondition($middleware, callable $condition, $priority = 0): Server
{
if (!is_array($middleware)) {
$middleware = [$middleware];
}
foreach ($middleware as $mw) {
$this->stack[$priority][] = [$condition, $mw];
}
return $this;
... | [
"public",
"function",
"appendOnCondition",
"(",
"$",
"middleware",
",",
"callable",
"$",
"condition",
",",
"$",
"priority",
"=",
"0",
")",
":",
"Server",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"middleware",
")",
")",
"{",
"$",
"middleware",
"=",
"[... | Adds a middleware to the stack only if the condition returns true.
The `$condition` parameter must be a callable and it will be called with the
`ServerRequestInterface` object as argument.
@param MiddlewareInterface|callable|array $middleware
@param callable $condition
@param int ... | [
"Adds",
"a",
"middleware",
"to",
"the",
"stack",
"only",
"if",
"the",
"condition",
"returns",
"true",
"."
] | train | https://github.com/leprephp/http-server/blob/2e307c80986456f7c53248b792771cb13bb4234d/src/Server.php#L110-L121 |
ComposePress/core | src/Traits/Component.php | Component.get_plugin | public function get_plugin() {
if ( null === $this->plugin ) {
$parent = $this;
while ( $parent->has_parent() ) {
$parent = $parent->parent;
}
$this->plugin = $parent;
}
if ( $this->plugin === $this && ! ( $this instanceof Plugin ) ) {
throw new \Exception( 'Plugin property is equal to self. D... | php | public function get_plugin() {
if ( null === $this->plugin ) {
$parent = $this;
while ( $parent->has_parent() ) {
$parent = $parent->parent;
}
$this->plugin = $parent;
}
if ( $this->plugin === $this && ! ( $this instanceof Plugin ) ) {
throw new \Exception( 'Plugin property is equal to self. D... | [
"public",
"function",
"get_plugin",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"plugin",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
";",
"while",
"(",
"$",
"parent",
"->",
"has_parent",
"(",
")",
")",
"{",
"$",
"parent",
"=",
"$"... | Magical utility method that will walk up the reference chain to get the master Plugin instance and cache it in $plugin
@return Plugin | [
"Magical",
"utility",
"method",
"that",
"will",
"walk",
"up",
"the",
"reference",
"chain",
"to",
"get",
"the",
"master",
"Plugin",
"instance",
"and",
"cache",
"it",
"in",
"$plugin"
] | train | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L51-L65 |
ComposePress/core | src/Traits/Component.php | Component.setup_components | protected function setup_components() {
$this->load_components();
$components = $this->get_components();
$this->set_component_parents( $components );
/** @var \ComposePress\Core\Abstracts\Component[] $components */
foreach ( $components as $component ) {
if ( method_exists( $component, 'init' ) ) {
$c... | php | protected function setup_components() {
$this->load_components();
$components = $this->get_components();
$this->set_component_parents( $components );
/** @var \ComposePress\Core\Abstracts\Component[] $components */
foreach ( $components as $component ) {
if ( method_exists( $component, 'init' ) ) {
$c... | [
"protected",
"function",
"setup_components",
"(",
")",
"{",
"$",
"this",
"->",
"load_components",
"(",
")",
";",
"$",
"components",
"=",
"$",
"this",
"->",
"get_components",
"(",
")",
";",
"$",
"this",
"->",
"set_component_parents",
"(",
"$",
"components",
... | Setup components and run init | [
"Setup",
"components",
"and",
"run",
"init"
] | train | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L86-L97 |
ComposePress/core | src/Traits/Component.php | Component.get_components | protected function get_components() {
$components = ( new \ReflectionClass( $this ) )->getProperties();
$components = array_map(
/**
* @param \ReflectionProperty $property
*
* @return string
*/
function ( $property ) {
return $property->name;
}, $components );
$components = array_filter( $... | php | protected function get_components() {
$components = ( new \ReflectionClass( $this ) )->getProperties();
$components = array_map(
/**
* @param \ReflectionProperty $property
*
* @return string
*/
function ( $property ) {
return $property->name;
}, $components );
$components = array_filter( $... | [
"protected",
"function",
"get_components",
"(",
")",
"{",
"$",
"components",
"=",
"(",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
")",
"->",
"getProperties",
"(",
")",
";",
"$",
"components",
"=",
"array_map",
"(",
"/**\n\t\t * @param \\ReflectionP... | Get all components with a getter and that uses the Component trait
@return array|\ReflectionProperty[] | [
"Get",
"all",
"components",
"with",
"a",
"getter",
"and",
"that",
"uses",
"the",
"Component",
"trait"
] | train | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L104-L129 |
ComposePress/core | src/Traits/Component.php | Component.load | protected function load( $component, $args = [] ) {
$args = (array) $args;
if ( ! property_exists( $this, $component ) ) {
return false;
}
$class = $this->$component;
if ( ! is_string( $class ) ) {
return false;
}
if ( ! class_exists( $class ) ) {
throw new \Exception( sprintf( 'Can not find c... | php | protected function load( $component, $args = [] ) {
$args = (array) $args;
if ( ! property_exists( $this, $component ) ) {
return false;
}
$class = $this->$component;
if ( ! is_string( $class ) ) {
return false;
}
if ( ! class_exists( $class ) ) {
throw new \Exception( sprintf( 'Can not find c... | [
"protected",
"function",
"load",
"(",
"$",
"component",
",",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"args",
"=",
"(",
"array",
")",
"$",
"args",
";",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"this",
",",
"$",
"component",
")",
")",
"{",
... | Load any property on the current component based on its string value as the class via the container
@param $component
@return bool
@throws \Exception | [
"Load",
"any",
"property",
"on",
"the",
"current",
"component",
"based",
"on",
"its",
"string",
"value",
"as",
"the",
"class",
"via",
"the",
"container"
] | train | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L139-L157 |
ComposePress/core | src/Traits/Component.php | Component.is_loaded | protected function is_loaded( $component ) {
if ( ! property_exists( $this, $component ) ) {
return false;
}
$property = $this->$component;
if ( ! is_object( $property ) ) {
return false;
}
if ( $property instanceof \stdClass ) {
return false;
}
return true;
} | php | protected function is_loaded( $component ) {
if ( ! property_exists( $this, $component ) ) {
return false;
}
$property = $this->$component;
if ( ! is_object( $property ) ) {
return false;
}
if ( $property instanceof \stdClass ) {
return false;
}
return true;
} | [
"protected",
"function",
"is_loaded",
"(",
"$",
"component",
")",
"{",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"this",
",",
"$",
"component",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"property",
"=",
"$",
"this",
"->",
"$",
"component",
... | @param string $component
@return bool | [
"@param",
"string",
"$component"
] | train | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L164-L180 |
ComposePress/core | src/Traits/Component.php | Component.is_component | protected function is_component( $component, $use_cache = true ) {
static $cache = [];
if ( ! is_object( $component ) ) {
if ( ! is_string( $component ) ) {
return false;
}
$getter = 'get_' . $component;
if ( ! ( method_exists( $this, $getter ) && ( new \ReflectionMethod( $this, $getter ) )->isPubl... | php | protected function is_component( $component, $use_cache = true ) {
static $cache = [];
if ( ! is_object( $component ) ) {
if ( ! is_string( $component ) ) {
return false;
}
$getter = 'get_' . $component;
if ( ! ( method_exists( $this, $getter ) && ( new \ReflectionMethod( $this, $getter ) )->isPubl... | [
"protected",
"function",
"is_component",
"(",
"$",
"component",
",",
"$",
"use_cache",
"=",
"true",
")",
"{",
"static",
"$",
"cache",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"component",
")",
")",
"{",
"if",
"(",
"!",
"is_string",
... | @param string|object $component
@param bool $use_cache
@return bool|mixed
@throws \ReflectionException | [
"@param",
"string|object",
"$component",
"@param",
"bool",
"$use_cache"
] | train | https://github.com/ComposePress/core/blob/f403f81d06a1e43017cb23c19c980fe3ef3bb6f7/src/Traits/Component.php#L189-L233 |
mustardandrew/muan-laravel-acl | src/AclServiceProvider.php | AclServiceProvider.boot | public function boot()
{
$this->initMigrations();
$this->initPermissions();
$this->initMiddlewares();
$this->initDirectives();
$this->initUserObserver();
$this->initCommands();
} | php | public function boot()
{
$this->initMigrations();
$this->initPermissions();
$this->initMiddlewares();
$this->initDirectives();
$this->initUserObserver();
$this->initCommands();
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"initMigrations",
"(",
")",
";",
"$",
"this",
"->",
"initPermissions",
"(",
")",
";",
"$",
"this",
"->",
"initMiddlewares",
"(",
")",
";",
"$",
"this",
"->",
"initDirectives",
"(",
")",
... | Boot
@return void | [
"Boot"
] | train | https://github.com/mustardandrew/muan-laravel-acl/blob/b5f23340b5536babb98d9fd0d727a7a3371c97d5/src/AclServiceProvider.php#L54-L62 |
mustardandrew/muan-laravel-acl | src/AclServiceProvider.php | AclServiceProvider.initPermissions | protected function initPermissions()
{
if ($this->app->runningInConsole()) {
return;
}
Permission::get()->map(function(Permission $permission) {
Gate::define($permission->name, function ($user) use ($permission) {
return $user->hasPermission($permissi... | php | protected function initPermissions()
{
if ($this->app->runningInConsole()) {
return;
}
Permission::get()->map(function(Permission $permission) {
Gate::define($permission->name, function ($user) use ($permission) {
return $user->hasPermission($permissi... | [
"protected",
"function",
"initPermissions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"return",
";",
"}",
"Permission",
"::",
"get",
"(",
")",
"->",
"map",
"(",
"function",
"(",
"Permission",
"$",... | Initialization permissions
@return void | [
"Initialization",
"permissions"
] | train | https://github.com/mustardandrew/muan-laravel-acl/blob/b5f23340b5536babb98d9fd0d727a7a3371c97d5/src/AclServiceProvider.php#L79-L90 |
flowcode/AmulenUserBundle | src/Flowcode/UserBundle/Entity/User.php | User.addUserGroup | public function addUserGroup(\Amulen\UserBundle\Entity\UserGroup $userGroup)
{
$this->groups[] = $userGroup;
return $this;
} | php | public function addUserGroup(\Amulen\UserBundle\Entity\UserGroup $userGroup)
{
$this->groups[] = $userGroup;
return $this;
} | [
"public",
"function",
"addUserGroup",
"(",
"\\",
"Amulen",
"\\",
"UserBundle",
"\\",
"Entity",
"\\",
"UserGroup",
"$",
"userGroup",
")",
"{",
"$",
"this",
"->",
"groups",
"[",
"]",
"=",
"$",
"userGroup",
";",
"return",
"$",
"this",
";",
"}"
] | @param \Amulen\UserBundle\Entity\UserGroup $userGroup
@return User | [
"@param",
"\\",
"Amulen",
"\\",
"UserBundle",
"\\",
"Entity",
"\\",
"UserGroup",
"$userGroup"
] | train | https://github.com/flowcode/AmulenUserBundle/blob/00055834d9f094e63dcd8d66e2fedb822fcddee0/src/Flowcode/UserBundle/Entity/User.php#L489-L494 |
simbiosis-group/yii2-helper | actions/ImportAction.php | ImportAction.run | public function run($defaultValuesJson = '')
{
$modelName = $this->formModelName;
$model = new $modelName;
if ('' != $defaultValuesJson) {
$this->defaultValues = $this->getDefaultValuesFromJson($defaultValuesJson);
}
if ($model->load(Yii::$app->request-... | php | public function run($defaultValuesJson = '')
{
$modelName = $this->formModelName;
$model = new $modelName;
if ('' != $defaultValuesJson) {
$this->defaultValues = $this->getDefaultValuesFromJson($defaultValuesJson);
}
if ($model->load(Yii::$app->request-... | [
"public",
"function",
"run",
"(",
"$",
"defaultValuesJson",
"=",
"''",
")",
"{",
"$",
"modelName",
"=",
"$",
"this",
"->",
"formModelName",
";",
"$",
"model",
"=",
"new",
"$",
"modelName",
";",
"if",
"(",
"''",
"!=",
"$",
"defaultValuesJson",
")",
"{",... | Runs the action
@param string $defaultValuesJson The default values in JSON format
@return string result content | [
"Runs",
"the",
"action"
] | train | https://github.com/simbiosis-group/yii2-helper/blob/c85c4204dd06b16e54210e75fe6deb51869d1dd9/actions/ImportAction.php#L103-L134 |
zhouyl/mellivora | Mellivora/Database/Schema/Blueprint.php | Blueprint.toSql | public function toSql(Connection $connection, Grammar $grammar)
{
$this->addImpliedCommands();
$statements = [];
// Each type of command has a corresponding compiler function on the schema
// grammar which is used to build the necessary SQL statements to build
// the bluepr... | php | public function toSql(Connection $connection, Grammar $grammar)
{
$this->addImpliedCommands();
$statements = [];
// Each type of command has a corresponding compiler function on the schema
// grammar which is used to build the necessary SQL statements to build
// the bluepr... | [
"public",
"function",
"toSql",
"(",
"Connection",
"$",
"connection",
",",
"Grammar",
"$",
"grammar",
")",
"{",
"$",
"this",
"->",
"addImpliedCommands",
"(",
")",
";",
"$",
"statements",
"=",
"[",
"]",
";",
"// Each type of command has a corresponding compiler func... | Get the raw SQL statements for the blueprint.
@param \Mellivora\Database\Connection $connection
@param \Mellivora\Database\Schema\Grammars\Grammar $grammar
@return array | [
"Get",
"the",
"raw",
"SQL",
"statements",
"for",
"the",
"blueprint",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Schema/Blueprint.php#L98-L118 |
zhouyl/mellivora | Mellivora/Database/Schema/Blueprint.php | Blueprint.addImpliedCommands | protected function addImpliedCommands()
{
if (count($this->getAddedColumns()) > 0 && !$this->creating()) {
array_unshift($this->commands, $this->createCommand('add'));
}
if (count($this->getChangedColumns()) > 0 && !$this->creating()) {
array_unshift($this->commands,... | php | protected function addImpliedCommands()
{
if (count($this->getAddedColumns()) > 0 && !$this->creating()) {
array_unshift($this->commands, $this->createCommand('add'));
}
if (count($this->getChangedColumns()) > 0 && !$this->creating()) {
array_unshift($this->commands,... | [
"protected",
"function",
"addImpliedCommands",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getAddedColumns",
"(",
")",
")",
">",
"0",
"&&",
"!",
"$",
"this",
"->",
"creating",
"(",
")",
")",
"{",
"array_unshift",
"(",
"$",
"this",
"->... | Add the commands that are implied by the blueprint's state.
@return void | [
"Add",
"the",
"commands",
"that",
"are",
"implied",
"by",
"the",
"blueprint",
"s",
"state",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Schema/Blueprint.php#L125-L136 |
zhouyl/mellivora | Mellivora/Database/Schema/Blueprint.php | Blueprint.createIndexName | protected function createIndexName($type, array $columns)
{
$index = strtolower($type . '_' . implode('_', $columns));
return str_replace(['-', '.'], '_', $index);
} | php | protected function createIndexName($type, array $columns)
{
$index = strtolower($type . '_' . implode('_', $columns));
return str_replace(['-', '.'], '_', $index);
} | [
"protected",
"function",
"createIndexName",
"(",
"$",
"type",
",",
"array",
"$",
"columns",
")",
"{",
"$",
"index",
"=",
"strtolower",
"(",
"$",
"type",
".",
"'_'",
".",
"implode",
"(",
"'_'",
",",
"$",
"columns",
")",
")",
";",
"return",
"str_replace"... | Create a default index name for the table.
@param string $type
@param array $columns
@return string | [
"Create",
"a",
"default",
"index",
"name",
"for",
"the",
"table",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Schema/Blueprint.php#L1063-L1068 |
ShaoZeMing/laravel-merchant | src/Layout/Content.php | Content.render | public function render()
{
$items = [
'header' => $this->header,
'description' => $this->description,
'breadcrumb' => $this->breadcrumb,
'content' => $this->build(),
];
return view('merchant::content', $items)->render();
} | php | public function render()
{
$items = [
'header' => $this->header,
'description' => $this->description,
'breadcrumb' => $this->breadcrumb,
'content' => $this->build(),
];
return view('merchant::content', $items)->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"items",
"=",
"[",
"'header'",
"=>",
"$",
"this",
"->",
"header",
",",
"'description'",
"=>",
"$",
"this",
"->",
"description",
",",
"'breadcrumb'",
"=>",
"$",
"this",
"->",
"breadcrumb",
",",
"'content... | Render this content.
@return string | [
"Render",
"this",
"content",
"."
] | train | https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Layout/Content.php#L197-L207 |
simbiosis-group/yii2-helper | models/ExcelImportForm.php | ExcelImportForm.getToolTipTemplate | public function getToolTipTemplate($field)
{
if (array_key_exists($field, $this->toolTips())) {
$toolTip = Html::tag('span', "{label}", [
'data-content'=> $this->toolTips()[$field],
'data-toggle'=>'popover',
'data-trigger'=>'hover',
'style'=>'cursor:help; border-bottom: 1px dashed #888'
... | php | public function getToolTipTemplate($field)
{
if (array_key_exists($field, $this->toolTips())) {
$toolTip = Html::tag('span', "{label}", [
'data-content'=> $this->toolTips()[$field],
'data-toggle'=>'popover',
'data-trigger'=>'hover',
'style'=>'cursor:help; border-bottom: 1px dashed #888'
... | [
"public",
"function",
"getToolTipTemplate",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"field",
",",
"$",
"this",
"->",
"toolTips",
"(",
")",
")",
")",
"{",
"$",
"toolTip",
"=",
"Html",
"::",
"tag",
"(",
"'span'",
",",
"\"{... | Generate the tool tip template to use in form.
@param string $field The table field name.
@return string Return the tool tip template. | [
"Generate",
"the",
"tool",
"tip",
"template",
"to",
"use",
"in",
"form",
"."
] | train | https://github.com/simbiosis-group/yii2-helper/blob/c85c4204dd06b16e54210e75fe6deb51869d1dd9/models/ExcelImportForm.php#L86-L100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.