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 |
|---|---|---|---|---|---|---|---|---|---|---|
caffeinated/beverage | src/Traits/BindIlluminate.php | BindIlluminate.ensureIlluminateBase | public function ensureIlluminateBase(Container $app = null)
{
if (! $app->bound('events')) {
$app->singleton('events', $this->illuminateClasses['events']);
$app['events']->fire('booting');
}
if (! $app->bound('files')) {
$app->bindIf('files', $this->illum... | php | public function ensureIlluminateBase(Container $app = null)
{
if (! $app->bound('events')) {
$app->singleton('events', $this->illuminateClasses['events']);
$app['events']->fire('booting');
}
if (! $app->bound('files')) {
$app->bindIf('files', $this->illum... | [
"public",
"function",
"ensureIlluminateBase",
"(",
"Container",
"$",
"app",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"app",
"->",
"bound",
"(",
"'events'",
")",
")",
"{",
"$",
"app",
"->",
"singleton",
"(",
"'events'",
",",
"$",
"this",
"->",
"ill... | Ensure the base event and file bindings are present. Required for binding anything else.
@param Container $app
@return void | [
"Ensure",
"the",
"base",
"event",
"and",
"file",
"bindings",
"are",
"present",
".",
"Required",
"for",
"binding",
"anything",
"else",
"."
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/BindIlluminate.php#L68-L78 |
caffeinated/beverage | src/Traits/BindIlluminate.php | BindIlluminate.bindIlluminateCore | public function bindIlluminateCore(Container $app = null)
{
if (! $app) {
$app = new Container();
}
$this->ensureIlluminateBase($app);
// Core classes
$app->bindIf('url', $this->illuminateClasses[ 'url' ]);
// Session and request
$app->bindIf('s... | php | public function bindIlluminateCore(Container $app = null)
{
if (! $app) {
$app = new Container();
}
$this->ensureIlluminateBase($app);
// Core classes
$app->bindIf('url', $this->illuminateClasses[ 'url' ]);
// Session and request
$app->bindIf('s... | [
"public",
"function",
"bindIlluminateCore",
"(",
"Container",
"$",
"app",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"app",
")",
"{",
"$",
"app",
"=",
"new",
"Container",
"(",
")",
";",
"}",
"$",
"this",
"->",
"ensureIlluminateBase",
"(",
"$",
"app"... | Bind the core classes to the Container
@param Container $app
@return Container | [
"Bind",
"the",
"core",
"classes",
"to",
"the",
"Container"
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/BindIlluminate.php#L86-L142 |
caffeinated/beverage | src/Traits/BindIlluminate.php | BindIlluminate.bindIlluminateView | public function bindIlluminateView(Container $app = null, array $viewPaths = array(), $cachePath)
{
if (! $app) {
$app = new Container();
}
$this->ensureIlluminateBase($app);
$app->bindShared('view.engine.resolver', function (Container $app) {
$resolver = ne... | php | public function bindIlluminateView(Container $app = null, array $viewPaths = array(), $cachePath)
{
if (! $app) {
$app = new Container();
}
$this->ensureIlluminateBase($app);
$app->bindShared('view.engine.resolver', function (Container $app) {
$resolver = ne... | [
"public",
"function",
"bindIlluminateView",
"(",
"Container",
"$",
"app",
"=",
"null",
",",
"array",
"$",
"viewPaths",
"=",
"array",
"(",
")",
",",
"$",
"cachePath",
")",
"{",
"if",
"(",
"!",
"$",
"app",
")",
"{",
"$",
"app",
"=",
"new",
"Container",... | bindIlluminateView
@param Container $app
@param array $viewPaths
@param string $cachePath
@return Container | [
"bindIlluminateView"
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/BindIlluminate.php#L152-L195 |
caffeinated/beverage | src/Traits/BindIlluminate.php | BindIlluminate.loadIlluminateConfig | protected function loadIlluminateConfig(Container $app, Repository $config)
{
foreach ($this->getIlluminateConfig($app) as $key => $path) {
$config->set($key, require $path);
}
} | php | protected function loadIlluminateConfig(Container $app, Repository $config)
{
foreach ($this->getIlluminateConfig($app) as $key => $path) {
$config->set($key, require $path);
}
} | [
"protected",
"function",
"loadIlluminateConfig",
"(",
"Container",
"$",
"app",
",",
"Repository",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getIlluminateConfig",
"(",
"$",
"app",
")",
"as",
"$",
"key",
"=>",
"$",
"path",
")",
"{",
"$",... | Load the configuration items from all config files.
@param Container $app
@param Repository $config
@return void | [
"Load",
"the",
"configuration",
"items",
"from",
"all",
"config",
"files",
"."
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/BindIlluminate.php#L204-L209 |
caffeinated/beverage | src/Traits/BindIlluminate.php | BindIlluminate.getIlluminateConfig | protected function getIlluminateConfig(Container $app)
{
$files = array();
foreach (Finder::create()->files()->name('*.php')->in($app['path.config']) as $file) {
$files[basename($file->getRealPath(), '.php')] = $file->getRealPath();
}
return $files;
} | php | protected function getIlluminateConfig(Container $app)
{
$files = array();
foreach (Finder::create()->files()->name('*.php')->in($app['path.config']) as $file) {
$files[basename($file->getRealPath(), '.php')] = $file->getRealPath();
}
return $files;
} | [
"protected",
"function",
"getIlluminateConfig",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"Finder",
"::",
"create",
"(",
")",
"->",
"files",
"(",
")",
"->",
"name",
"(",
"'*.php'",
")",
"->",
"... | Get all configuration files from the application.
@param Container $app
@return array | [
"Get",
"all",
"configuration",
"files",
"from",
"the",
"application",
"."
] | train | https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/BindIlluminate.php#L217-L226 |
Eresus/EresusCMS | src/core/Plugin/Controller/Admin/LegacySettings.php | Eresus_Plugin_Controller_Admin_LegacySettings.call | private function call($method, array $args = array())
{
if (!method_exists($this->getPlugin(), $method))
{
throw new Eresus_CMS_Exception_NotFound;
}
return call_user_func_array(array($this->getPlugin(), $method), $args);
} | php | private function call($method, array $args = array())
{
if (!method_exists($this->getPlugin(), $method))
{
throw new Eresus_CMS_Exception_NotFound;
}
return call_user_func_array(array($this->getPlugin(), $method), $args);
} | [
"private",
"function",
"call",
"(",
"$",
"method",
",",
"array",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
"->",
"getPlugin",
"(",
")",
",",
"$",
"method",
")",
")",
"{",
"throw",
"new",
"Er... | Вызывает метод модуля расширения
@param string $method имя метода
@param array $args аргументы
@return mixed
@throws Eresus_CMS_Exception_NotFound
@since 3.01 | [
"Вызывает",
"метод",
"модуля",
"расширения"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Plugin/Controller/Admin/LegacySettings.php#L72-L80 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Translation/src/filters/complement_filter.php | ezcTranslationComplementEmptyFilter.runFilter | public function runFilter( array $context )
{
foreach ( $context as $element )
{
if ( $element->status == ezcTranslationData::UNFINISHED )
{
$element->translation = $element->original;
}
}
} | php | public function runFilter( array $context )
{
foreach ( $context as $element )
{
if ( $element->status == ezcTranslationData::UNFINISHED )
{
$element->translation = $element->original;
}
}
} | [
"public",
"function",
"runFilter",
"(",
"array",
"$",
"context",
")",
"{",
"foreach",
"(",
"$",
"context",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"->",
"status",
"==",
"ezcTranslationData",
"::",
"UNFINISHED",
")",
"{",
"$",
"element"... | Filters the context $context.
Applies the fillin filter on the given context. The filter replaces a
missing translated string with its original.
@param array(ezcTranslationData) $context
@return void | [
"Filters",
"the",
"context",
"$context",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Translation/src/filters/complement_filter.php#L57-L66 |
mustardandrew/muan-laravel-acl | src/Commands/Role/RemoveCommand.php | RemoveCommand.handle | public function handle()
{
$roleName = $this->argument('role');
if (! $role = Role::whereName($roleName)->first()) {
$this->warn("Role {$roleName} not exists.");
return 1;
}
if ($role->delete()) {
echo "Role {$roleName} removed successfully.", PH... | php | public function handle()
{
$roleName = $this->argument('role');
if (! $role = Role::whereName($roleName)->first()) {
$this->warn("Role {$roleName} not exists.");
return 1;
}
if ($role->delete()) {
echo "Role {$roleName} removed successfully.", PH... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"roleName",
"=",
"$",
"this",
"->",
"argument",
"(",
"'role'",
")",
";",
"if",
"(",
"!",
"$",
"role",
"=",
"Role",
"::",
"whereName",
"(",
"$",
"roleName",
")",
"->",
"first",
"(",
")",
")",
"{"... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/mustardandrew/muan-laravel-acl/blob/b5f23340b5536babb98d9fd0d727a7a3371c97d5/src/Commands/Role/RemoveCommand.php#L34-L50 |
wenbinye/PhalconX | src/Php/Lint.php | Lint.enterUse | public function enterUse(Node\Stmt\Use_ $node)
{
foreach ($node->uses as $use) {
if (isset($this->uses[$use->alias])) {
$this->addError(Errors\UseConflict::class, $use);
} elseif ($node->type === Node\Stmt\Use_::TYPE_NORMAL) {
$this->uses[$use->alias] ... | php | public function enterUse(Node\Stmt\Use_ $node)
{
foreach ($node->uses as $use) {
if (isset($this->uses[$use->alias])) {
$this->addError(Errors\UseConflict::class, $use);
} elseif ($node->type === Node\Stmt\Use_::TYPE_NORMAL) {
$this->uses[$use->alias] ... | [
"public",
"function",
"enterUse",
"(",
"Node",
"\\",
"Stmt",
"\\",
"Use_",
"$",
"node",
")",
"{",
"foreach",
"(",
"$",
"node",
"->",
"uses",
"as",
"$",
"use",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"uses",
"[",
"$",
"use",
"->",
... | collect use | [
"collect",
"use"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/Lint.php#L134-L143 |
Smile-SA/CronBundle | Command/CronStatusCommand.php | CronStatusCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var CronService $cronService */
$cronService = $this->getContainer()->get('smile.cron.service');
$crons = $cronService->listCronsStatus();
$cronRows = array();
foreach ($crons as $cron) {
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var CronService $cronService */
$cronService = $this->getContainer()->get('smile.cron.service');
$crons = $cronService->listCronsStatus();
$cronRows = array();
foreach ($crons as $cron) {
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var CronService $cronService */",
"$",
"cronService",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'smile.cron.s... | Execute command
@param InputInterface $input Input interface
@param OutputInterface $output Output interface | [
"Execute",
"command"
] | train | https://github.com/Smile-SA/CronBundle/blob/3e6d29112915fa957cc04386ba9c6d1fc134d31f/Command/CronStatusCommand.php#L30-L54 |
zhouyl/mellivora | Mellivora/Cache/RedisConnector.php | RedisConnector.getCacheAdapter | public function getCacheAdapter()
{
$client = RedisAdapter::createConnection(
$this->config['dsn'],
$this->config['options']
);
return new RedisAdapter(
$client,
$this->config['namespace'],
$this->config['lifetime']
);
... | php | public function getCacheAdapter()
{
$client = RedisAdapter::createConnection(
$this->config['dsn'],
$this->config['options']
);
return new RedisAdapter(
$client,
$this->config['namespace'],
$this->config['lifetime']
);
... | [
"public",
"function",
"getCacheAdapter",
"(",
")",
"{",
"$",
"client",
"=",
"RedisAdapter",
"::",
"createConnection",
"(",
"$",
"this",
"->",
"config",
"[",
"'dsn'",
"]",
",",
"$",
"this",
"->",
"config",
"[",
"'options'",
"]",
")",
";",
"return",
"new",... | {@inheritdoc} | [
"{"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Cache/RedisConnector.php#L31-L43 |
zhouyl/mellivora | Mellivora/Cache/RedisConnector.php | RedisConnector.getSimpleCacheAdapter | public function getSimpleCacheAdapter()
{
$client = RedisCache::createConnection(
$this->config['dsn'],
$this->config['options']
);
return new RedisCache(
$client,
$this->config['namespace'],
$this->config['lifetime']
);
... | php | public function getSimpleCacheAdapter()
{
$client = RedisCache::createConnection(
$this->config['dsn'],
$this->config['options']
);
return new RedisCache(
$client,
$this->config['namespace'],
$this->config['lifetime']
);
... | [
"public",
"function",
"getSimpleCacheAdapter",
"(",
")",
"{",
"$",
"client",
"=",
"RedisCache",
"::",
"createConnection",
"(",
"$",
"this",
"->",
"config",
"[",
"'dsn'",
"]",
",",
"$",
"this",
"->",
"config",
"[",
"'options'",
"]",
")",
";",
"return",
"n... | {@inheritdoc} | [
"{"
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Cache/RedisConnector.php#L48-L60 |
lokhman/silex-tools | src/Silex/Console/Provider/DoctrineServiceProvider.php | DoctrineServiceProvider.boot | public function boot(Application $app)
{
$commands = [
new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand(),
new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
];
$helperSet = new... | php | public function boot(Application $app)
{
$commands = [
new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
new \Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand(),
new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
];
$helperSet = new... | [
"public",
"function",
"boot",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"commands",
"=",
"[",
"new",
"\\",
"Doctrine",
"\\",
"DBAL",
"\\",
"Tools",
"\\",
"Console",
"\\",
"Command",
"\\",
"ImportCommand",
"(",
")",
",",
"new",
"\\",
"Doctrine",
"\... | {@inheritdoc} | [
"{"
] | train | https://github.com/lokhman/silex-tools/blob/91e84099479beb4e866abc88a55ed1e457a8a9e9/src/Silex/Console/Provider/DoctrineServiceProvider.php#L58-L99 |
Eresus/EresusCMS | src/ext-3rd/tinymce/eresus-connector.php | TinyMCEConnector.forms_html | function forms_html($form, $field)
{
$value = isset($form->values[$field['name']]) ?
$form->values[$field['name']] :
(isset($field['value'])?$field['value']:'');
$preset = isset($field['preset']) ? $field['preset'] : 'default';
$result = "\t\t" . '<tr><td colspan="2">' . $field['label'] .
'<br /><textar... | php | function forms_html($form, $field)
{
$value = isset($form->values[$field['name']]) ?
$form->values[$field['name']] :
(isset($field['value'])?$field['value']:'');
$preset = isset($field['preset']) ? $field['preset'] : 'default';
$result = "\t\t" . '<tr><td colspan="2">' . $field['label'] .
'<br /><textar... | [
"function",
"forms_html",
"(",
"$",
"form",
",",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"isset",
"(",
"$",
"form",
"->",
"values",
"[",
"$",
"field",
"[",
"'name'",
"]",
"]",
")",
"?",
"$",
"form",
"->",
"values",
"[",
"$",
"field",
"[",
"'... | Возвращает разметку для подключения WYSIWYG-редактора
@param Form $form
@param array $field
@return array | [
"Возвращает",
"разметку",
"для",
"подключения",
"WYSIWYG",
"-",
"редактора"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/eresus-connector.php#L54-L74 |
Eresus/EresusCMS | src/ext-3rd/tinymce/eresus-connector.php | TinyMCEConnector.getWYSIWYG | public function getWYSIWYG(array $field)
{
$value = isset($field['value']) ? $field['value'] : '';
$preset = isset($field['preset']) ? $field['preset'] : 'default';
$html = '<textarea name="wyswyg_' . $field['name'] . '" class="tinymce_' . $preset .
'" cols="80" rows="25" style="height: ' . $field['height'] .... | php | public function getWYSIWYG(array $field)
{
$value = isset($field['value']) ? $field['value'] : '';
$preset = isset($field['preset']) ? $field['preset'] : 'default';
$html = '<textarea name="wyswyg_' . $field['name'] . '" class="tinymce_' . $preset .
'" cols="80" rows="25" style="height: ' . $field['height'] .... | [
"public",
"function",
"getWYSIWYG",
"(",
"array",
"$",
"field",
")",
"{",
"$",
"value",
"=",
"isset",
"(",
"$",
"field",
"[",
"'value'",
"]",
")",
"?",
"$",
"field",
"[",
"'value'",
"]",
":",
"''",
";",
"$",
"preset",
"=",
"isset",
"(",
"$",
"fie... | Возвращает разметку редактора
@param array $field
@return string
@since 2.16 | [
"Возвращает",
"разметку",
"редактора"
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/ext-3rd/tinymce/eresus-connector.php#L86-L103 |
o2system/email | src/Protocols/SendMailProtocol.php | SendmailProtocol.sending | protected function sending(Message $message)
{
$phpMailer = new PHPMailer();
$phpMailer->isSendmail();
// Set from
if (false !== ($from = $message->getFrom())) {
$phpMailer->setFrom($from->getEmail(), $from->getName());
}
// Set recipient
... | php | protected function sending(Message $message)
{
$phpMailer = new PHPMailer();
$phpMailer->isSendmail();
// Set from
if (false !== ($from = $message->getFrom())) {
$phpMailer->setFrom($from->getEmail(), $from->getName());
}
// Set recipient
... | [
"protected",
"function",
"sending",
"(",
"Message",
"$",
"message",
")",
"{",
"$",
"phpMailer",
"=",
"new",
"PHPMailer",
"(",
")",
";",
"$",
"phpMailer",
"->",
"isSendmail",
"(",
")",
";",
"// Set from\r",
"if",
"(",
"false",
"!==",
"(",
"$",
"from",
"... | MailProtocol::sending
Protocol message sending process.
@param Message $message
@return bool
@throws \PHPMailer\PHPMailer\Exception | [
"MailProtocol",
"::",
"sending"
] | train | https://github.com/o2system/email/blob/7c64b73f539cac8df4b2aaef474b29b949067898/src/Protocols/SendMailProtocol.php#L39-L88 |
neat-php/database | classes/Table.php | Table.findOne | public function findOne($conditions, string $orderBy = null): Result
{
$query = $this->query()
->where($conditions)
->limit(1);
if ($orderBy) {
$query->orderBy($orderBy);
}
return $query->query();
} | php | public function findOne($conditions, string $orderBy = null): Result
{
$query = $this->query()
->where($conditions)
->limit(1);
if ($orderBy) {
$query->orderBy($orderBy);
}
return $query->query();
} | [
"public",
"function",
"findOne",
"(",
"$",
"conditions",
",",
"string",
"$",
"orderBy",
"=",
"null",
")",
":",
"Result",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"where",
"(",
"$",
"conditions",
")",
"->",
"limit",
"(",
"... | Builds the query for the given conditions and executes it
Will return an result with 1 or 0 rows
@param array|string $conditions
@param string|null $orderBy
@return Result | [
"Builds",
"the",
"query",
"for",
"the",
"given",
"conditions",
"and",
"executes",
"it",
"Will",
"return",
"an",
"result",
"with",
"1",
"or",
"0",
"rows"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Table.php#L77-L88 |
neat-php/database | classes/Table.php | Table.validateIdentifier | public function validateIdentifier($id)
{
$printed = print_r($id, true);
if (count($this->keys) > 1 && !is_array($id)) {
throw new \RuntimeException("Entity $this->name has a composed key, finding by id requires an array, given: $printed");
}
if (count($this->keys) !== co... | php | public function validateIdentifier($id)
{
$printed = print_r($id, true);
if (count($this->keys) > 1 && !is_array($id)) {
throw new \RuntimeException("Entity $this->name has a composed key, finding by id requires an array, given: $printed");
}
if (count($this->keys) !== co... | [
"public",
"function",
"validateIdentifier",
"(",
"$",
"id",
")",
"{",
"$",
"printed",
"=",
"print_r",
"(",
"$",
"id",
",",
"true",
")",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"keys",
")",
">",
"1",
"&&",
"!",
"is_array",
"(",
"$",
"id",... | Validates the identifier to prevent unexpected behaviour
@param int|string|array $id | [
"Validates",
"the",
"identifier",
"to",
"prevent",
"unexpected",
"behaviour"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Table.php#L148-L158 |
neat-php/database | classes/Table.php | Table.where | public function where($id)
{
$this->validateIdentifier($id);
if (!is_array($id)) {
$key = reset($this->keys);
return [$key => $id];
} else {
return $id;
}
} | php | public function where($id)
{
$this->validateIdentifier($id);
if (!is_array($id)) {
$key = reset($this->keys);
return [$key => $id];
} else {
return $id;
}
} | [
"public",
"function",
"where",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"validateIdentifier",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"id",
")",
")",
"{",
"$",
"key",
"=",
"reset",
"(",
"$",
"this",
"->",
"keys",
")"... | Creates the where condition for the identifier
@param int|string|array $id
@return array | [
"Creates",
"the",
"where",
"condition",
"for",
"the",
"identifier"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/Table.php#L166-L176 |
gdbots/iam-php | src/SearchUsersRequestHandler.php | SearchUsersRequestHandler.beforeSearchNodes | protected function beforeSearchNodes(SearchNodesRequest $request, ParsedQuery $parsedQuery): void
{
parent::beforeSearchNodes($request, $parsedQuery);
$required = BoolOperator::REQUIRED();
foreach (['is_staff', 'is_blocked'] as $trinary) {
if (Trinary::UNKNOWN !== $request->get(... | php | protected function beforeSearchNodes(SearchNodesRequest $request, ParsedQuery $parsedQuery): void
{
parent::beforeSearchNodes($request, $parsedQuery);
$required = BoolOperator::REQUIRED();
foreach (['is_staff', 'is_blocked'] as $trinary) {
if (Trinary::UNKNOWN !== $request->get(... | [
"protected",
"function",
"beforeSearchNodes",
"(",
"SearchNodesRequest",
"$",
"request",
",",
"ParsedQuery",
"$",
"parsedQuery",
")",
":",
"void",
"{",
"parent",
"::",
"beforeSearchNodes",
"(",
"$",
"request",
",",
"$",
"parsedQuery",
")",
";",
"$",
"required",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/gdbots/iam-php/blob/3dbfa602de183a7ac5fb5140304e8cf4c4b15ab3/src/SearchUsersRequestHandler.php#L20-L36 |
webdevvie/pheanstalk-task-queue-bundle | Command/WorkerCommand.php | WorkerCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->initialiseWorker($input, $output);
$this->keepAliveTimeout = $input->getOption('keepaliveTimeout', 60);
$this->lastKeepdbalive = time();
$this->taskCommandGenerator = $this->getContainer()->get(
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->initialiseWorker($input, $output);
$this->keepAliveTimeout = $input->getOption('keepaliveTimeout', 60);
$this->lastKeepdbalive = time();
$this->taskCommandGenerator = $this->getContainer()->get(
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"initialiseWorker",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"this",
"->",
"keepAliveTimeout",
"=",
"$... | {@inheritDoc}
@param InputInterface $input
@param OutputInterface $output
@return void
@throws \InvalidArgumentException | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Command/WorkerCommand.php#L71-L99 |
webdevvie/pheanstalk-task-queue-bundle | Command/WorkerCommand.php | WorkerCommand.handleRunningProcess | private function handleRunningProcess(
Process $process,
&$runningCommand,
&$failed,
&$hasReceivedSignal,
&$exitCode,
&$exitCodeText
) {
if ($process->isRunning()) {
if ($hasReceivedSignal) {
return;
}
//forc... | php | private function handleRunningProcess(
Process $process,
&$runningCommand,
&$failed,
&$hasReceivedSignal,
&$exitCode,
&$exitCodeText
) {
if ($process->isRunning()) {
if ($hasReceivedSignal) {
return;
}
//forc... | [
"private",
"function",
"handleRunningProcess",
"(",
"Process",
"$",
"process",
",",
"&",
"$",
"runningCommand",
",",
"&",
"$",
"failed",
",",
"&",
"$",
"hasReceivedSignal",
",",
"&",
"$",
"exitCode",
",",
"&",
"$",
"exitCodeText",
")",
"{",
"if",
"(",
"$... | Handles any running process waiting for signals..
@param Process $process
@param boolean &$runningCommand
@param boolean &$failed
@param boolean &$hasReceivedSignal
@param integer &$exitCode
@param string &$exitCodeText
@return void | [
"Handles",
"any",
"running",
"process",
"waiting",
"for",
"signals",
".."
] | train | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Command/WorkerCommand.php#L175-L208 |
yosymfony/ConfigServiceProvider | src/Yosymfony/Silex/ConfigServiceProvider/Loaders/JsonLoader.php | JsonLoader.load | public function load($resource, $type = null)
{
if(null === $type)
{
$resource = $this->getLocation($resource);
$data = $this->loadFile($resource);
}
else
{
$data = $resource;
}
$parsed = $this->parseResource($data)... | php | public function load($resource, $type = null)
{
if(null === $type)
{
$resource = $this->getLocation($resource);
$data = $this->loadFile($resource);
}
else
{
$data = $resource;
}
$parsed = $this->parseResource($data)... | [
"public",
"function",
"load",
"(",
"$",
"resource",
",",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"type",
")",
"{",
"$",
"resource",
"=",
"$",
"this",
"->",
"getLocation",
"(",
"$",
"resource",
")",
";",
"$",
"data",
"="... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosymfony/ConfigServiceProvider/blob/f6cb9a9fc707b6c92e0d03201e5ecc17eaee3114/src/Yosymfony/Silex/ConfigServiceProvider/Loaders/JsonLoader.php#L27-L53 |
eghojansu/moe | src/tools/SMTP.php | SMTP.dialog | protected function dialog($cmd=NULL,$log=TRUE) {
$socket=&$this->socket;
if (!is_null($cmd))
fputs($socket,$cmd."\r\n");
$reply='';
while (!feof($socket) && ($info=stream_get_meta_data($socket)) &&
!$info['timed_out'] && $str=fgets($socket,4096)) {
$reply.=$str;
if (preg_match('/(?:^|\n)\d{3} .+?\r\... | php | protected function dialog($cmd=NULL,$log=TRUE) {
$socket=&$this->socket;
if (!is_null($cmd))
fputs($socket,$cmd."\r\n");
$reply='';
while (!feof($socket) && ($info=stream_get_meta_data($socket)) &&
!$info['timed_out'] && $str=fgets($socket,4096)) {
$reply.=$str;
if (preg_match('/(?:^|\n)\d{3} .+?\r\... | [
"protected",
"function",
"dialog",
"(",
"$",
"cmd",
"=",
"NULL",
",",
"$",
"log",
"=",
"TRUE",
")",
"{",
"$",
"socket",
"=",
"&",
"$",
"this",
"->",
"socket",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"cmd",
")",
")",
"fputs",
"(",
"$",
"socket... | Send SMTP command and record server response
@return string
@param $cmd string
@param $log bool | [
"Send",
"SMTP",
"command",
"and",
"record",
"server",
"response"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/SMTP.php#L106-L122 |
eghojansu/moe | src/tools/SMTP.php | SMTP.send | function send($message,$log=TRUE) {
if ($this->scheme=='ssl' && !extension_loaded('openssl'))
return FALSE;
// Message should not be blank
if (!$message)
user_error(self::E_Blank,E_USER_ERROR);
$fw=Base::instance();
// Retrieve headers
$headers=$this->headers;
// Connect to the server
$socket=&$th... | php | function send($message,$log=TRUE) {
if ($this->scheme=='ssl' && !extension_loaded('openssl'))
return FALSE;
// Message should not be blank
if (!$message)
user_error(self::E_Blank,E_USER_ERROR);
$fw=Base::instance();
// Retrieve headers
$headers=$this->headers;
// Connect to the server
$socket=&$th... | [
"function",
"send",
"(",
"$",
"message",
",",
"$",
"log",
"=",
"TRUE",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"scheme",
"==",
"'ssl'",
"&&",
"!",
"extension_loaded",
"(",
"'openssl'",
")",
")",
"return",
"FALSE",
";",
"// Message should not be blank",
"... | Transmit message
@return bool
@param $message string
@param $log bool | [
"Transmit",
"message"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/tools/SMTP.php#L145-L264 |
mmanos/laravel-casset | src/controllers/CassetController.php | CassetController.getIndex | public function getIndex($type = null)
{
$container = Input::get('c');
$files = Input::get('files', '');
if (empty($type) || !in_array($type, array('style', 'script'))) {
App::abort(404);
}
if (empty($container)) {
App::abort(404);
}
$files = json_decode(base64_decode($files), true);
if ... | php | public function getIndex($type = null)
{
$container = Input::get('c');
$files = Input::get('files', '');
if (empty($type) || !in_array($type, array('style', 'script'))) {
App::abort(404);
}
if (empty($container)) {
App::abort(404);
}
$files = json_decode(base64_decode($files), true);
if ... | [
"public",
"function",
"getIndex",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"container",
"=",
"Input",
"::",
"get",
"(",
"'c'",
")",
";",
"$",
"files",
"=",
"Input",
"::",
"get",
"(",
"'files'",
",",
"''",
")",
";",
"if",
"(",
"empty",
"(",
... | Index action.
@return mixed | [
"Index",
"action",
"."
] | train | https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/controllers/CassetController.php#L20-L57 |
glynnforrest/active-doctrine | src/ActiveDoctrine/Fixture/FixtureLoader.php | FixtureLoader.addFixture | public function addFixture(FixtureInterface $fixture)
{
$this->dropTables = array_merge($this->dropTables, (array) $fixture->getTables());
$this->fixtures[] = $fixture;
} | php | public function addFixture(FixtureInterface $fixture)
{
$this->dropTables = array_merge($this->dropTables, (array) $fixture->getTables());
$this->fixtures[] = $fixture;
} | [
"public",
"function",
"addFixture",
"(",
"FixtureInterface",
"$",
"fixture",
")",
"{",
"$",
"this",
"->",
"dropTables",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"dropTables",
",",
"(",
"array",
")",
"$",
"fixture",
"->",
"getTables",
"(",
")",
")",
";... | Add a fixture to be loaded into the database.
@param FixtureInterface $fixture | [
"Add",
"a",
"fixture",
"to",
"be",
"loaded",
"into",
"the",
"database",
"."
] | train | https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Fixture/FixtureLoader.php#L22-L26 |
glynnforrest/active-doctrine | src/ActiveDoctrine/Fixture/FixtureLoader.php | FixtureLoader.run | public function run(Connection $connection, $append = false)
{
if (!$append) {
//in the future, resolve key constraints here
foreach (array_unique($this->dropTables) as $table) {
$connection->delete($table, [1 => 1], [\PDO::PARAM_INT]);
}
}
... | php | public function run(Connection $connection, $append = false)
{
if (!$append) {
//in the future, resolve key constraints here
foreach (array_unique($this->dropTables) as $table) {
$connection->delete($table, [1 => 1], [\PDO::PARAM_INT]);
}
}
... | [
"public",
"function",
"run",
"(",
"Connection",
"$",
"connection",
",",
"$",
"append",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"append",
")",
"{",
"//in the future, resolve key constraints here",
"foreach",
"(",
"array_unique",
"(",
"$",
"this",
"->",
"... | Run all fixtures.
@param Connection $connection
@param bool $append Don't empty tables before loading | [
"Run",
"all",
"fixtures",
"."
] | train | https://github.com/glynnforrest/active-doctrine/blob/fcf8c434c7df4704966107bf9a95c005a0b37168/src/ActiveDoctrine/Fixture/FixtureLoader.php#L34-L46 |
neat-php/database | classes/FetchedResult.php | FetchedResult.each | public function each(callable $closure)
{
$results = [];
foreach ($this->rows as $row) {
$results[] = $closure(...array_values($row));
}
return $results;
} | php | public function each(callable $closure)
{
$results = [];
foreach ($this->rows as $row) {
$results[] = $closure(...array_values($row));
}
return $results;
} | [
"public",
"function",
"each",
"(",
"callable",
"$",
"closure",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"results",
"[",
"]",
"=",
"$",
"closure",
"(",
"...",
"array_... | Call a closure for each row
@param callable $closure
@return array | [
"Call",
"a",
"closure",
"for",
"each",
"row"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/FetchedResult.php#L39-L47 |
neat-php/database | classes/FetchedResult.php | FetchedResult.row | public function row()
{
if (isset($this->rows[$this->cursor])) {
return $this->rows[$this->cursor++];
}
return false;
} | php | public function row()
{
if (isset($this->rows[$this->cursor])) {
return $this->rows[$this->cursor++];
}
return false;
} | [
"public",
"function",
"row",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"rows",
"[",
"$",
"this",
"->",
"cursor",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"rows",
"[",
"$",
"this",
"->",
"cursor",
"++",
"]",
";",
"}",
... | Get a single row as array
Moves the cursor to the next row
@return array|false | [
"Get",
"a",
"single",
"row",
"as",
"array"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/FetchedResult.php#L68-L75 |
neat-php/database | classes/FetchedResult.php | FetchedResult.values | public function values($column = 0)
{
if (is_int($column)) {
$column = $this->rows ? array_keys($this->rows[0])[$column] : '';
}
return array_map(function ($row) use ($column) {
return $row[$column];
}, $this->rows);
} | php | public function values($column = 0)
{
if (is_int($column)) {
$column = $this->rows ? array_keys($this->rows[0])[$column] : '';
}
return array_map(function ($row) use ($column) {
return $row[$column];
}, $this->rows);
} | [
"public",
"function",
"values",
"(",
"$",
"column",
"=",
"0",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"column",
")",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"rows",
"?",
"array_keys",
"(",
"$",
"this",
"->",
"rows",
"[",
"0",
"]",
")"... | Get all values from one column
Moves the cursor to the end of the result
@param int|string $column
@return array | [
"Get",
"all",
"values",
"from",
"one",
"column"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/FetchedResult.php#L85-L94 |
neat-php/database | classes/FetchedResult.php | FetchedResult.value | public function value($column = 0)
{
$row = $this->row();
if ($row) {
return is_int($column) ? array_values($row)[$column] : $row[$column];
}
return false;
} | php | public function value($column = 0)
{
$row = $this->row();
if ($row) {
return is_int($column) ? array_values($row)[$column] : $row[$column];
}
return false;
} | [
"public",
"function",
"value",
"(",
"$",
"column",
"=",
"0",
")",
"{",
"$",
"row",
"=",
"$",
"this",
"->",
"row",
"(",
")",
";",
"if",
"(",
"$",
"row",
")",
"{",
"return",
"is_int",
"(",
"$",
"column",
")",
"?",
"array_values",
"(",
"$",
"row",... | Get a single value from one column
Moves the cursor to the next row
@param int|string $column
@return mixed|false | [
"Get",
"a",
"single",
"value",
"from",
"one",
"column"
] | train | https://github.com/neat-php/database/blob/7b4b66c8f1bc63e50925f12712b9eedcfb2a98ff/classes/FetchedResult.php#L104-L112 |
RhubarbPHP/Module.RestApi | src/Resources/CollectionRestResource.php | CollectionRestResource.containsResourceIdentifier | public function containsResourceIdentifier($resourceIdentifier)
{
// This will be very slow however the base implementation can do nothing else.
// Inheritors of this class should override this if they can do this faster!
$items = $this->getItems(0, false);
foreach ($items[0] as $it... | php | public function containsResourceIdentifier($resourceIdentifier)
{
// This will be very slow however the base implementation can do nothing else.
// Inheritors of this class should override this if they can do this faster!
$items = $this->getItems(0, false);
foreach ($items[0] as $it... | [
"public",
"function",
"containsResourceIdentifier",
"(",
"$",
"resourceIdentifier",
")",
"{",
"// This will be very slow however the base implementation can do nothing else.",
"// Inheritors of this class should override this if they can do this faster!",
"$",
"items",
"=",
"$",
"this",
... | Test to see if the given resource identifier exists in the collection of resources.
@param $resourceIdentifier
@return True if it exists, false if it does not. | [
"Test",
"to",
"see",
"if",
"the",
"given",
"resource",
"identifier",
"exists",
"in",
"the",
"collection",
"of",
"resources",
"."
] | train | https://github.com/RhubarbPHP/Module.RestApi/blob/825d2b920caed13811971c5eb2784a94417787bd/src/Resources/CollectionRestResource.php#L64-L77 |
RhubarbPHP/Module.RestApi | src/Resources/CollectionRestResource.php | CollectionRestResource.createCollectionResourceForItems | protected function createCollectionResourceForItems($items, $from, $to, $count)
{
$resource = parent::get();
$resource->items = $items;
$resource->count = $count;
$resource->range = new \stdClass();
$resource->range->from = $from;
$resource->range->to = $to;
... | php | protected function createCollectionResourceForItems($items, $from, $to, $count)
{
$resource = parent::get();
$resource->items = $items;
$resource->count = $count;
$resource->range = new \stdClass();
$resource->range->from = $from;
$resource->range->to = $to;
... | [
"protected",
"function",
"createCollectionResourceForItems",
"(",
"$",
"items",
",",
"$",
"from",
",",
"$",
"to",
",",
"$",
"count",
")",
"{",
"$",
"resource",
"=",
"parent",
"::",
"get",
"(",
")",
";",
"$",
"resource",
"->",
"items",
"=",
"$",
"items"... | Creates a valid collection response from a list of objects.
@param Collection|\stdClass[] $items
@param int $from
@param int $to
@param int $count
@return \stdClass | [
"Creates",
"a",
"valid",
"collection",
"response",
"from",
"a",
"list",
"of",
"objects",
"."
] | train | https://github.com/RhubarbPHP/Module.RestApi/blob/825d2b920caed13811971c5eb2784a94417787bd/src/Resources/CollectionRestResource.php#L151-L161 |
mikebarlow/html-helper | src/Attributes.php | Attributes.attr | public function attr(array $attributes)
{
$result = '';
foreach ($attributes as $attribute => $value) {
$result .= ' '.(is_int($attribute) ? $value : $attribute.'="'.str_replace('"', '"', $value).'"');
}
return $result;
} | php | public function attr(array $attributes)
{
$result = '';
foreach ($attributes as $attribute => $value) {
$result .= ' '.(is_int($attribute) ? $value : $attribute.'="'.str_replace('"', '"', $value).'"');
}
return $result;
} | [
"public",
"function",
"attr",
"(",
"array",
"$",
"attributes",
")",
"{",
"$",
"result",
"=",
"''",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
".=",
"' '",
".",
"(",
"is_int",
"(",
"$... | Render the attributes
@param array $attributes
@return string | [
"Render",
"the",
"attributes"
] | train | https://github.com/mikebarlow/html-helper/blob/d9d9dc3e92ba3ecd75f3a2e5a5bc2d23f38b5f65/src/Attributes.php#L13-L22 |
mikebarlow/html-helper | src/Attributes.php | Attributes.mergeAttr | public function mergeAttr()
{
$arrays = func_get_args();
$result = array();
foreach ($arrays as $array) {
$result = $this->mergeRecursive($result, $array);
}
return $result;
} | php | public function mergeAttr()
{
$arrays = func_get_args();
$result = array();
foreach ($arrays as $array) {
$result = $this->mergeRecursive($result, $array);
}
return $result;
} | [
"public",
"function",
"mergeAttr",
"(",
")",
"{",
"$",
"arrays",
"=",
"func_get_args",
"(",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"arrays",
"as",
"$",
"array",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
... | It will merge multiple attributes arrays without erase values
@return array | [
"It",
"will",
"merge",
"multiple",
"attributes",
"arrays",
"without",
"erase",
"values"
] | train | https://github.com/mikebarlow/html-helper/blob/d9d9dc3e92ba3ecd75f3a2e5a5bc2d23f38b5f65/src/Attributes.php#L29-L39 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php | ezcCacheMemcacheBackend.store | public function store( $key, $var, $expire = 0 )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
// protect our data by wrapping it in an object
$data = new ezcCacheMemory... | php | public function store( $key, $var, $expire = 0 )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
// protect our data by wrapping it in an object
$data = new ezcCacheMemory... | [
"public",
"function",
"store",
"(",
"$",
"key",
",",
"$",
"var",
",",
"$",
"expire",
"=",
"0",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
">",
"self",
"::",
"MAX_KEY_LENGTH",
")",
"{",
"throw",
"new",
"ezcCacheInvalidKeyException",
"(",
"$"... | Adds the $var data to the cache under the key $key. Returns true or
false depending on the success of the operation.
@param string $key
@param mixed $var
@param int $expire
@return bool | [
"Adds",
"the",
"$var",
"data",
"to",
"the",
"cache",
"under",
"the",
"key",
"$key",
".",
"Returns",
"true",
"or",
"false",
"depending",
"on",
"the",
"success",
"of",
"the",
"operation",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php#L153-L164 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php | ezcCacheMemcacheBackend.fetch | public function fetch( $key )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
$data = $this->memcache->get( $key );
return ( is_object( $data ) ) ? $data->var : false;
... | php | public function fetch( $key )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
$data = $this->memcache->get( $key );
return ( is_object( $data ) ) ? $data->var : false;
... | [
"public",
"function",
"fetch",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
">",
"self",
"::",
"MAX_KEY_LENGTH",
")",
"{",
"throw",
"new",
"ezcCacheInvalidKeyException",
"(",
"$",
"key",
",",
"'Length > '",
".",
"self",
"::",
"... | Returns the data from the cache associated with key $key.
@param mixed $key
@return mixed | [
"Returns",
"the",
"data",
"from",
"the",
"cache",
"associated",
"with",
"key",
"$key",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php#L172-L181 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php | ezcCacheMemcacheBackend.acquireLock | public function acquireLock( $key, $waitTime, $maxTime )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
// add() does not replace and returns true on success. $maxTime is
... | php | public function acquireLock( $key, $waitTime, $maxTime )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
// add() does not replace and returns true on success. $maxTime is
... | [
"public",
"function",
"acquireLock",
"(",
"$",
"key",
",",
"$",
"waitTime",
",",
"$",
"maxTime",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
">",
"self",
"::",
"MAX_KEY_LENGTH",
")",
"{",
"throw",
"new",
"ezcCacheInvalidKeyException",
"(",
"$",
... | Acquires a lock on the given $key.
@param string $key
@param int $waitTime usleep()
@param int $maxTime seconds | [
"Acquires",
"a",
"lock",
"on",
"the",
"given",
"$key",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php#L226-L240 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php | ezcCacheMemcacheBackend.releaseLock | public function releaseLock( $key )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
$this->memcache->delete( $key );
} | php | public function releaseLock( $key )
{
if ( strlen( $key ) > self::MAX_KEY_LENGTH )
{
throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
}
$this->memcache->delete( $key );
} | [
"public",
"function",
"releaseLock",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"key",
")",
">",
"self",
"::",
"MAX_KEY_LENGTH",
")",
"{",
"throw",
"new",
"ezcCacheInvalidKeyException",
"(",
"$",
"key",
",",
"'Length > '",
".",
"self",
"::... | Releases a lock on the given $key.
@param string $key
@return void | [
"Releases",
"a",
"lock",
"on",
"the",
"given",
"$key",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/backends/memcache/memcache_backend.php#L248-L256 |
inhere/php-librarys | src/Helpers/Req.php | Req.param | public static function param($key, $default = null)
{
if (!$key || !\is_string($key)) {
return false;
}
$ret = $_POST[$key] ?? $_GET[$key] ?? $default;
if (\is_string($ret)) {
return stripslashes(urldecode(preg_replace('/((\%5C0+)|(\%00+))/i', '', urlencode(... | php | public static function param($key, $default = null)
{
if (!$key || !\is_string($key)) {
return false;
}
$ret = $_POST[$key] ?? $_GET[$key] ?? $default;
if (\is_string($ret)) {
return stripslashes(urldecode(preg_replace('/((\%5C0+)|(\%00+))/i', '', urlencode(... | [
"public",
"static",
"function",
"param",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"key",
"||",
"!",
"\\",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"ret",
"=",
"$",
... | Get a value from $_POST / $_GET
if unavailable, take a default value
@param string $key Value key
@param mixed $default (optional)
@return mixed Value | [
"Get",
"a",
"value",
"from",
"$_POST",
"/",
"$_GET",
"if",
"unavailable",
"take",
"a",
"default",
"value"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/Req.php#L59-L72 |
inhere/php-librarys | src/Helpers/Req.php | Req.server | public static function server($name, $default = '')
{
$name = strtoupper($name);
return isset($_SERVER[$name]) ? trim($_SERVER[$name]) : $default;
} | php | public static function server($name, $default = '')
{
$name = strtoupper($name);
return isset($_SERVER[$name]) ? trim($_SERVER[$name]) : $default;
} | [
"public",
"static",
"function",
"server",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"''",
")",
"{",
"$",
"name",
"=",
"strtoupper",
"(",
"$",
"name",
")",
";",
"return",
"isset",
"(",
"$",
"_SERVER",
"[",
"$",
"name",
"]",
")",
"?",
"trim",
"("... | get $_SERVER value
@param string $name
@param string $default
@return mixed | [
"get",
"$_SERVER",
"value"
] | train | https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/Req.php#L205-L210 |
phootwork/lang | src/Text.php | Text.insert | public function insert($substring, $index) {
if ($index <= 0) {
return $this->prepend($substring);
}
if ($index > $this->length()) {
return $this->append($substring);
}
$start = mb_substr($this->string, 0, $index, $this->encoding);
$end = mb_substr($this->string, $index, $this->length(), $this->enco... | php | public function insert($substring, $index) {
if ($index <= 0) {
return $this->prepend($substring);
}
if ($index > $this->length()) {
return $this->append($substring);
}
$start = mb_substr($this->string, 0, $index, $this->encoding);
$end = mb_substr($this->string, $index, $this->length(), $this->enco... | [
"public",
"function",
"insert",
"(",
"$",
"substring",
",",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"index",
"<=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"prepend",
"(",
"$",
"substring",
")",
";",
"}",
"if",
"(",
"$",
"index",
">",
"$",
"... | Inserts a substring at the given index
<code>
$str = new Text('Hello World!');<br>
$str->insert('to this ', 5); // Hello to this World!
</code>
@param string|Text $substring
@param int $index
@return Text | [
"Inserts",
"a",
"substring",
"at",
"the",
"given",
"index"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L115-L127 |
phootwork/lang | src/Text.php | Text.compare | public function compare($compare, callable $callback = null) {
if ($callback === null) {
$callback = 'strcmp';
}
return $callback($this->string, (string) $compare);
} | php | public function compare($compare, callable $callback = null) {
if ($callback === null) {
$callback = 'strcmp';
}
return $callback($this->string, (string) $compare);
} | [
"public",
"function",
"compare",
"(",
"$",
"compare",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"callback",
"===",
"null",
")",
"{",
"$",
"callback",
"=",
"'strcmp'",
";",
"}",
"return",
"$",
"callback",
"(",
"$",
"this... | Compares this string to another
@param string $compare string to compare to
@param callable $callback
@return int | [
"Compares",
"this",
"string",
"to",
"another"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L164-L169 |
phootwork/lang | src/Text.php | Text.slice | public function slice($offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
if ($length === 0) {
return new Text('', $this->encoding);
}
return new Text(mb_substr($this->string, $offset, $length, $this->encoding), $this->encoding);
} | php | public function slice($offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
if ($length === 0) {
return new Text('', $this->encoding);
}
return new Text(mb_substr($this->string, $offset, $length, $this->encoding), $this->encoding);
} | [
"public",
"function",
"slice",
"(",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"prepareOffset",
"(",
"$",
"offset",
")",
";",
"$",
"length",
"=",
"$",
"this",
"->",
"prepareLength",
"(",
"$",
"o... | Slices a piece of the string from a given offset with a specified length.
If no length is given, the String is sliced to its maximum length.
@see #substring
@param int $offset
@param int $length
@return Text | [
"Slices",
"a",
"piece",
"of",
"the",
"string",
"from",
"a",
"given",
"offset",
"with",
"a",
"specified",
"length",
".",
"If",
"no",
"length",
"is",
"given",
"the",
"String",
"is",
"sliced",
"to",
"its",
"maximum",
"length",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L206-L215 |
phootwork/lang | src/Text.php | Text.substring | public function substring($start, $end = null) {
$length = $this->length();
if ($end < 0) {
$end = $length + $end;
}
$end = $end !== null ? min($end, $length) : $length;
$start = min($start, $end);
$end = max($start, $end);
$end = $end - $start;
return new Text(mb_substr($this->string, $start, $end,... | php | public function substring($start, $end = null) {
$length = $this->length();
if ($end < 0) {
$end = $length + $end;
}
$end = $end !== null ? min($end, $length) : $length;
$start = min($start, $end);
$end = max($start, $end);
$end = $end - $start;
return new Text(mb_substr($this->string, $start, $end,... | [
"public",
"function",
"substring",
"(",
"$",
"start",
",",
"$",
"end",
"=",
"null",
")",
"{",
"$",
"length",
"=",
"$",
"this",
"->",
"length",
"(",
")",
";",
"if",
"(",
"$",
"end",
"<",
"0",
")",
"{",
"$",
"end",
"=",
"$",
"length",
"+",
"$",... | Slices a piece of the string from a given start to an end.
If no length is given, the String is sliced to its maximum length.
@see #slice
@param int $start
@param int $end
@return Text | [
"Slices",
"a",
"piece",
"of",
"the",
"string",
"from",
"a",
"given",
"start",
"to",
"an",
"end",
".",
"If",
"no",
"length",
"is",
"given",
"the",
"String",
"is",
"sliced",
"to",
"its",
"maximum",
"length",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L226-L237 |
phootwork/lang | src/Text.php | Text.countSubstring | public function countSubstring($substring, $caseSensitive = true) {
$this->verifyNotEmpty($substring, '$substring');
if ($caseSensitive) {
return mb_substr_count($this->string, $substring, $this->encoding);
}
$str = mb_strtoupper($this->string, $this->encoding);
$substring = mb_strtoupper($substring, $this... | php | public function countSubstring($substring, $caseSensitive = true) {
$this->verifyNotEmpty($substring, '$substring');
if ($caseSensitive) {
return mb_substr_count($this->string, $substring, $this->encoding);
}
$str = mb_strtoupper($this->string, $this->encoding);
$substring = mb_strtoupper($substring, $this... | [
"public",
"function",
"countSubstring",
"(",
"$",
"substring",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"verifyNotEmpty",
"(",
"$",
"substring",
",",
"'$substring'",
")",
";",
"if",
"(",
"$",
"caseSensitive",
")",
"{",
"return",... | Count the number of substring occurrences.
@param string|Text $substring The substring to count the occurrencies
@param boolean $caseSensitive Force case-sensitivity
@return int | [
"Count",
"the",
"number",
"of",
"substring",
"occurrences",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L246-L254 |
phootwork/lang | src/Text.php | Text.replace | public function replace($search, $replace) {
if ($search instanceof Text) {
$search = $search->toString();
} else if ($search instanceof Arrayable) {
$search = $search->toArray();
}
if ($replace instanceof Text) {
$replace = $replace->toString();
} else if ($replace instanceof Arrayable) {
$repla... | php | public function replace($search, $replace) {
if ($search instanceof Text) {
$search = $search->toString();
} else if ($search instanceof Arrayable) {
$search = $search->toArray();
}
if ($replace instanceof Text) {
$replace = $replace->toString();
} else if ($replace instanceof Arrayable) {
$repla... | [
"public",
"function",
"replace",
"(",
"$",
"search",
",",
"$",
"replace",
")",
"{",
"if",
"(",
"$",
"search",
"instanceof",
"Text",
")",
"{",
"$",
"search",
"=",
"$",
"search",
"->",
"toString",
"(",
")",
";",
"}",
"else",
"if",
"(",
"$",
"search",... | Replace all occurrences of the search string with the replacement string
@see #supplant
@param Arrayable|Text|array|string $search
The value being searched for, otherwise known as the needle. An array may be used
to designate multiple needles.
@param Arrayable|Text|array|string $replace
The replacement value that repl... | [
"Replace",
"all",
"occurrences",
"of",
"the",
"search",
"string",
"with",
"the",
"replacement",
"string"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L275-L289 |
phootwork/lang | src/Text.php | Text.supplant | public function supplant(array $map) {
return new Text(str_replace(array_keys($map), array_values($map), $this->string), $this->encoding);
} | php | public function supplant(array $map) {
return new Text(str_replace(array_keys($map), array_values($map), $this->string), $this->encoding);
} | [
"public",
"function",
"supplant",
"(",
"array",
"$",
"map",
")",
"{",
"return",
"new",
"Text",
"(",
"str_replace",
"(",
"array_keys",
"(",
"$",
"map",
")",
",",
"array_values",
"(",
"$",
"map",
")",
",",
"$",
"this",
"->",
"string",
")",
",",
"$",
... | Replaces all occurences of given replacement map. Keys will be replaced with its values.
@param array $map the replacements. Keys will be replaced with its value.
@return Text | [
"Replaces",
"all",
"occurences",
"of",
"given",
"replacement",
"map",
".",
"Keys",
"will",
"be",
"replaced",
"with",
"its",
"values",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L297-L299 |
phootwork/lang | src/Text.php | Text.splice | public function splice($replacement, $offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
$start = $this->substring(0, $offset);
$end = $this->substring($offset + $length);
return new Text($start . $replacement . $end);
} | php | public function splice($replacement, $offset, $length = null) {
$offset = $this->prepareOffset($offset);
$length = $this->prepareLength($offset, $length);
$start = $this->substring(0, $offset);
$end = $this->substring($offset + $length);
return new Text($start . $replacement . $end);
} | [
"public",
"function",
"splice",
"(",
"$",
"replacement",
",",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"prepareOffset",
"(",
"$",
"offset",
")",
";",
"$",
"length",
"=",
"$",
"this",
"->",
"pr... | Replace text within a portion of a string.
@param string|Text $replacement
@param int $offset
@param int|null $length
@return Text
@throws \InvalidArgumentException If $offset is greater then the string length or $length is too small. | [
"Replace",
"text",
"within",
"a",
"portion",
"of",
"a",
"string",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L310-L318 |
phootwork/lang | src/Text.php | Text.chars | public function chars() {
$chars = new ArrayObject();
for ($i = 0, $l = $this->length(); $i < $l; $i++) {
$chars->push($this->at($i));
}
return $chars;
} | php | public function chars() {
$chars = new ArrayObject();
for ($i = 0, $l = $this->length(); $i < $l; $i++) {
$chars->push($this->at($i));
}
return $chars;
} | [
"public",
"function",
"chars",
"(",
")",
"{",
"$",
"chars",
"=",
"new",
"ArrayObject",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"l",
"=",
"$",
"this",
"->",
"length",
"(",
")",
";",
"$",
"i",
"<",
"$",
"l",
";",
"$",
"i",
... | Returns an ArrayObject consisting of the characters in the string.
@return ArrayObject An ArrayObject of all chars | [
"Returns",
"an",
"ArrayObject",
"consisting",
"of",
"the",
"characters",
"in",
"the",
"string",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L349-L355 |
phootwork/lang | src/Text.php | Text.indexOf | public function indexOf($string, $offset = 0) {
$offset = $this->prepareOffset($offset);
if ($string == '') {
return $offset;
}
return mb_strpos($this->string, (string) $string, $offset, $this->encoding);
} | php | public function indexOf($string, $offset = 0) {
$offset = $this->prepareOffset($offset);
if ($string == '') {
return $offset;
}
return mb_strpos($this->string, (string) $string, $offset, $this->encoding);
} | [
"public",
"function",
"indexOf",
"(",
"$",
"string",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"prepareOffset",
"(",
"$",
"offset",
")",
";",
"if",
"(",
"$",
"string",
"==",
"''",
")",
"{",
"return",
"$",
"off... | Returns the index of a given string, starting at the optional zero-related offset
@param string $string
@param int $offset zero-related offset
@return int|boolean int for the index or false if the given string doesn't occur | [
"Returns",
"the",
"index",
"of",
"a",
"given",
"string",
"starting",
"at",
"the",
"optional",
"zero",
"-",
"related",
"offset"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L364-L372 |
phootwork/lang | src/Text.php | Text.lastIndexOf | public function lastIndexOf($string, $offset = null) {
if (null === $offset) {
$offset = $this->length();
} else {
$offset = $this->prepareOffset($offset);
}
if ($string === '') {
return $offset;
}
/* Converts $offset to a negative offset as strrpos has a different
* behavior for positive offs... | php | public function lastIndexOf($string, $offset = null) {
if (null === $offset) {
$offset = $this->length();
} else {
$offset = $this->prepareOffset($offset);
}
if ($string === '') {
return $offset;
}
/* Converts $offset to a negative offset as strrpos has a different
* behavior for positive offs... | [
"public",
"function",
"lastIndexOf",
"(",
"$",
"string",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"offset",
")",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"length",
"(",
")",
";",
"}",
"else",
"{",
"$",
"offset"... | Returns the last index of a given string, starting at the optional offset
@param string $string
@param int $offset
@return int|boolean int for the index or false if the given string doesn't occur | [
"Returns",
"the",
"last",
"index",
"of",
"a",
"given",
"string",
"starting",
"at",
"the",
"optional",
"offset"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L381-L395 |
phootwork/lang | src/Text.php | Text.startsWith | public function startsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_substr($this->string, 0, $substringLength, $this->encoding);
return (string) $substring === $startOfStr;
} | php | public function startsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_substr($this->string, 0, $substringLength, $this->encoding);
return (string) $substring === $startOfStr;
} | [
"public",
"function",
"startsWith",
"(",
"$",
"substring",
")",
"{",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"startOfStr",
"=",
"mb_substr",
"(",
"$",
"this",
"->",
"string",
","... | Checks whether the string starts with the given string. Case sensitive!
@see Text::startsWithIgnoreCase()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"starts",
"with",
"the",
"given",
"string",
".",
"Case",
"sensitive!"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L404-L409 |
phootwork/lang | src/Text.php | Text.startsWithIgnoreCase | public function startsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_strtolower(mb_substr($this->string, 0, $substringLength, $this->encoding));
return (string) $substring === $startOfStr;
} | php | public function startsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$startOfStr = mb_strtolower(mb_substr($this->string, 0, $substringLength, $this->encoding));
return (string) $substring === $startOfStr;
} | [
"public",
"function",
"startsWithIgnoreCase",
"(",
"$",
"substring",
")",
"{",
"$",
"substring",
"=",
"mb_strtolower",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
... | Checks whether the string starts with the given string. Ignores case.
@see Text::startsWith()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"starts",
"with",
"the",
"given",
"string",
".",
"Ignores",
"case",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L418-L424 |
phootwork/lang | src/Text.php | Text.endsWith | public function endsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding);
return (string) $substring === $endOfStr;
} | php | public function endsWith($substring) {
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding);
return (string) $substring === $endOfStr;
} | [
"public",
"function",
"endsWith",
"(",
"$",
"substring",
")",
"{",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"endOfStr",
"=",
"mb_substr",
"(",
"$",
"this",
"->",
"string",
",",
... | Checks whether the string ends with the given string. Case sensitive!
@see Text::endsWithIgnoreCase()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"ends",
"with",
"the",
"given",
"string",
".",
"Case",
"sensitive!"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L433-L438 |
phootwork/lang | src/Text.php | Text.endsWithIgnoreCase | public function endsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_strtolower(mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding));
return (string) $subst... | php | public function endsWithIgnoreCase($substring) {
$substring = mb_strtolower($substring, $this->encoding);
$substringLength = mb_strlen($substring, $this->encoding);
$endOfStr = mb_strtolower(mb_substr($this->string, $this->length() - $substringLength, $substringLength, $this->encoding));
return (string) $subst... | [
"public",
"function",
"endsWithIgnoreCase",
"(",
"$",
"substring",
")",
"{",
"$",
"substring",
"=",
"mb_strtolower",
"(",
"$",
"substring",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"substringLength",
"=",
"mb_strlen",
"(",
"$",
"substring",
",",
... | Checks whether the string ends with the given string. Ingores case.
@see Text::endsWith()
@param string|Text $substring The substring to look for
@return boolean | [
"Checks",
"whether",
"the",
"string",
"ends",
"with",
"the",
"given",
"string",
".",
"Ingores",
"case",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L447-L453 |
phootwork/lang | src/Text.php | Text.trim | public function trim($characters = " \t\n\r\v\0") {
return new Text(trim($this->string, (string) $characters), $this->encoding);
} | php | public function trim($characters = " \t\n\r\v\0") {
return new Text(trim($this->string, (string) $characters), $this->encoding);
} | [
"public",
"function",
"trim",
"(",
"$",
"characters",
"=",
"\" \\t\\n\\r\\v\\0\"",
")",
"{",
"return",
"new",
"Text",
"(",
"trim",
"(",
"$",
"this",
"->",
"string",
",",
"(",
"string",
")",
"$",
"characters",
")",
",",
"$",
"this",
"->",
"encoding",
")... | Strip whitespace (or other characters) from the beginning and end of the string
@param string $characters
Optionally, the stripped characters can also be specified using the mask parameter.
Simply list all characters that you want to be stripped. With .. you can specify a
range of characters.
@return Text | [
"Strip",
"whitespace",
"(",
"or",
"other",
"characters",
")",
"from",
"the",
"beginning",
"and",
"end",
"of",
"the",
"string"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L491-L493 |
phootwork/lang | src/Text.php | Text.trimStart | public function trimStart($characters = " \t\n\r\v\0") {
return new Text(ltrim($this->string, (string) $characters), $this->encoding);
} | php | public function trimStart($characters = " \t\n\r\v\0") {
return new Text(ltrim($this->string, (string) $characters), $this->encoding);
} | [
"public",
"function",
"trimStart",
"(",
"$",
"characters",
"=",
"\" \\t\\n\\r\\v\\0\"",
")",
"{",
"return",
"new",
"Text",
"(",
"ltrim",
"(",
"$",
"this",
"->",
"string",
",",
"(",
"string",
")",
"$",
"characters",
")",
",",
"$",
"this",
"->",
"encoding"... | Strip whitespace (or other characters) from the beginning of the string
@param string $characters
Optionally, the stripped characters can also be specified using the mask parameter.
Simply list all characters that you want to be stripped. With .. you can specify a
range of characters.
@return Text | [
"Strip",
"whitespace",
"(",
"or",
"other",
"characters",
")",
"from",
"the",
"beginning",
"of",
"the",
"string"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L505-L507 |
phootwork/lang | src/Text.php | Text.trimEnd | public function trimEnd($characters = " \t\n\r\v\0") {
return new Text(rtrim($this->string, (string) $characters), $this->encoding);
} | php | public function trimEnd($characters = " \t\n\r\v\0") {
return new Text(rtrim($this->string, (string) $characters), $this->encoding);
} | [
"public",
"function",
"trimEnd",
"(",
"$",
"characters",
"=",
"\" \\t\\n\\r\\v\\0\"",
")",
"{",
"return",
"new",
"Text",
"(",
"rtrim",
"(",
"$",
"this",
"->",
"string",
",",
"(",
"string",
")",
"$",
"characters",
")",
",",
"$",
"this",
"->",
"encoding",
... | Strip whitespace (or other characters) from the end of the string
@param string $characters
Optionally, the stripped characters can also be specified using the mask parameter.
Simply list all characters that you want to be stripped. With .. you can specify a
range of characters.
@return Text | [
"Strip",
"whitespace",
"(",
"or",
"other",
"characters",
")",
"from",
"the",
"end",
"of",
"the",
"string"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L519-L521 |
phootwork/lang | src/Text.php | Text.pad | public function pad($length, $padding = ' ') {
$len = $length - $this->length();
return $this->applyPadding(floor($len / 2), ceil($len / 2), $padding);
} | php | public function pad($length, $padding = ' ') {
$len = $length - $this->length();
return $this->applyPadding(floor($len / 2), ceil($len / 2), $padding);
} | [
"public",
"function",
"pad",
"(",
"$",
"length",
",",
"$",
"padding",
"=",
"' '",
")",
"{",
"$",
"len",
"=",
"$",
"length",
"-",
"$",
"this",
"->",
"length",
"(",
")",
";",
"return",
"$",
"this",
"->",
"applyPadding",
"(",
"floor",
"(",
"$",
"len... | Adds padding to the start and end
@param int $length
@param string $padding
@return Text | [
"Adds",
"padding",
"to",
"the",
"start",
"and",
"end"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L530-L533 |
phootwork/lang | src/Text.php | Text.applyPadding | protected function applyPadding($left = 0, $right = 0, $padStr = ' ') {
$length = mb_strlen($padStr, $this->encoding);
$strLength = $this->length();
$paddedLength = $strLength + $left + $right;
if (!$length || $paddedLength <= $strLength) {
return $this;
}
$leftPadding = mb_substr(str_repeat($padStr, ce... | php | protected function applyPadding($left = 0, $right = 0, $padStr = ' ') {
$length = mb_strlen($padStr, $this->encoding);
$strLength = $this->length();
$paddedLength = $strLength + $left + $right;
if (!$length || $paddedLength <= $strLength) {
return $this;
}
$leftPadding = mb_substr(str_repeat($padStr, ce... | [
"protected",
"function",
"applyPadding",
"(",
"$",
"left",
"=",
"0",
",",
"$",
"right",
"=",
"0",
",",
"$",
"padStr",
"=",
"' '",
")",
"{",
"$",
"length",
"=",
"mb_strlen",
"(",
"$",
"padStr",
",",
"$",
"this",
"->",
"encoding",
")",
";",
"$",
"s... | Adds the specified amount of left and right padding to the given string.
The default character used is a space.
@see https://github.com/danielstjules/Stringy/blob/master/src/Stringy.php
@param int $left Length of left padding
@param int $right Length of right padding
@param string $padStr String used to pad
@return Te... | [
"Adds",
"the",
"specified",
"amount",
"of",
"left",
"and",
"right",
"padding",
"to",
"the",
"given",
"string",
".",
"The",
"default",
"character",
"used",
"is",
"a",
"space",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L567-L578 |
phootwork/lang | src/Text.php | Text.wrapWords | public function wrapWords($width = 75, $break = "\n", $cut = false) {
return new Text(wordwrap($this->string, $width, $break, $cut), $this->encoding);
} | php | public function wrapWords($width = 75, $break = "\n", $cut = false) {
return new Text(wordwrap($this->string, $width, $break, $cut), $this->encoding);
} | [
"public",
"function",
"wrapWords",
"(",
"$",
"width",
"=",
"75",
",",
"$",
"break",
"=",
"\"\\n\"",
",",
"$",
"cut",
"=",
"false",
")",
"{",
"return",
"new",
"Text",
"(",
"wordwrap",
"(",
"$",
"this",
"->",
"string",
",",
"$",
"width",
",",
"$",
... | Returns a copy of the string wrapped at a given number of characters
@param int $width The number of characters at which the string will be wrapped.
@param string $break The line is broken using the optional break parameter.
@param bool $cut
If the cut is set to TRUE, the string is always wrapped at or before the spec... | [
"Returns",
"a",
"copy",
"of",
"the",
"string",
"wrapped",
"at",
"a",
"given",
"number",
"of",
"characters"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L616-L618 |
phootwork/lang | src/Text.php | Text.repeat | public function repeat($multiplier) {
$this->verifyNotNegative($multiplier, 'Number of repetitions');
return new Text(str_repeat($this->string, $multiplier), $this->encoding);
} | php | public function repeat($multiplier) {
$this->verifyNotNegative($multiplier, 'Number of repetitions');
return new Text(str_repeat($this->string, $multiplier), $this->encoding);
} | [
"public",
"function",
"repeat",
"(",
"$",
"multiplier",
")",
"{",
"$",
"this",
"->",
"verifyNotNegative",
"(",
"$",
"multiplier",
",",
"'Number of repetitions'",
")",
";",
"return",
"new",
"Text",
"(",
"str_repeat",
"(",
"$",
"this",
"->",
"string",
",",
"... | Repeat the string $times times. If $times is 0, it returns ''.
@param int $multiplier
@return Text
@throws \InvalidArgumentException If $times is negative. | [
"Repeat",
"the",
"string",
"$times",
"times",
".",
"If",
"$times",
"is",
"0",
"it",
"returns",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L627-L630 |
phootwork/lang | src/Text.php | Text.truncate | public function truncate($length, $substring = '') {
if ($this->length() <= $length) {
return new Text($this->string, $this->encoding);
}
$substrLen = mb_strlen($substring, $this->encoding);
if ($this->length() + $substrLen > $length) {
$length -= $substrLen;
}
return $this->substring(0, $length)->... | php | public function truncate($length, $substring = '') {
if ($this->length() <= $length) {
return new Text($this->string, $this->encoding);
}
$substrLen = mb_strlen($substring, $this->encoding);
if ($this->length() + $substrLen > $length) {
$length -= $substrLen;
}
return $this->substring(0, $length)->... | [
"public",
"function",
"truncate",
"(",
"$",
"length",
",",
"$",
"substring",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"length",
"(",
")",
"<=",
"$",
"length",
")",
"{",
"return",
"new",
"Text",
"(",
"$",
"this",
"->",
"string",
",",
"$"... | Truncates the string with a substring and ensures it doesn't exceed the given length
@param int $length
@param string $substring
@return Text | [
"Truncates",
"the",
"string",
"with",
"a",
"substring",
"and",
"ensures",
"it",
"doesn",
"t",
"exceed",
"the",
"given",
"length"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L648-L660 |
phootwork/lang | src/Text.php | Text.split | public function split($delimiter, $limit = PHP_INT_MAX) {
return new ArrayObject(explode($delimiter, $this->string, $limit));
} | php | public function split($delimiter, $limit = PHP_INT_MAX) {
return new ArrayObject(explode($delimiter, $this->string, $limit));
} | [
"public",
"function",
"split",
"(",
"$",
"delimiter",
",",
"$",
"limit",
"=",
"PHP_INT_MAX",
")",
"{",
"return",
"new",
"ArrayObject",
"(",
"explode",
"(",
"$",
"delimiter",
",",
"$",
"this",
"->",
"string",
",",
"$",
"limit",
")",
")",
";",
"}"
] | Splits the string by string
@param string $delimiter The boundary string.
@param integer $limit
If limit is set and positive, the returned array will contain a maximum of
limit elements with the last element containing the rest of string.
If the limit parameter is negative, all components except the last
-limit are r... | [
"Splits",
"the",
"string",
"by",
"string"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L692-L694 |
phootwork/lang | src/Text.php | Text.join | public static function join(array $pieces, $glue = '', $encoding = null) {
return new Text(implode($pieces, $glue), $encoding);
} | php | public static function join(array $pieces, $glue = '', $encoding = null) {
return new Text(implode($pieces, $glue), $encoding);
} | [
"public",
"static",
"function",
"join",
"(",
"array",
"$",
"pieces",
",",
"$",
"glue",
"=",
"''",
",",
"$",
"encoding",
"=",
"null",
")",
"{",
"return",
"new",
"Text",
"(",
"implode",
"(",
"$",
"pieces",
",",
"$",
"glue",
")",
",",
"$",
"encoding",... | Join array elements with a string
@param array $pieces The array of strings to join.
@param string $glue Defaults to an empty string.
@param string $encoding the desired encoding
@return Text
Returns a string containing a string representation of all the array elements in the
same order, with the glue string between e... | [
"Join",
"array",
"elements",
"with",
"a",
"string"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L706-L708 |
phootwork/lang | src/Text.php | Text.chunk | public function chunk($splitLength = 1) {
$this->verifyPositive($splitLength, 'The chunk length');
return new ArrayObject(str_split($this->string, $splitLength));
} | php | public function chunk($splitLength = 1) {
$this->verifyPositive($splitLength, 'The chunk length');
return new ArrayObject(str_split($this->string, $splitLength));
} | [
"public",
"function",
"chunk",
"(",
"$",
"splitLength",
"=",
"1",
")",
"{",
"$",
"this",
"->",
"verifyPositive",
"(",
"$",
"splitLength",
",",
"'The chunk length'",
")",
";",
"return",
"new",
"ArrayObject",
"(",
"str_split",
"(",
"$",
"this",
"->",
"string... | Convert the string to an array
@param int $splitLength Maximum length of the chunk.
@return ArrayObject
If the optional splitLength parameter is specified, the returned array will be
broken down into chunks with each being splitLength in length, otherwise each chunk
will be one character in length.
If the split_lengt... | [
"Convert",
"the",
"string",
"to",
"an",
"array"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L723-L727 |
phootwork/lang | src/Text.php | Text.toLowerCaseFirst | public function toLowerCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtolower($first, $this->encoding) . $rest, $this->encoding);
} | php | public function toLowerCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtolower($first, $this->encoding) . $rest, $this->encoding);
} | [
"public",
"function",
"toLowerCaseFirst",
"(",
")",
"{",
"$",
"first",
"=",
"$",
"this",
"->",
"substring",
"(",
"0",
",",
"1",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"substring",
"(",
"1",
")",
";",
"return",
"new",
"Text",
"(",
"mb_strtol... | Transforms the string to first character lowercased
@return Text | [
"Transforms",
"the",
"string",
"to",
"first",
"character",
"lowercased"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L750-L755 |
phootwork/lang | src/Text.php | Text.toUpperCaseFirst | public function toUpperCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtoupper($first, $this->encoding) . $rest, $this->encoding);
} | php | public function toUpperCaseFirst() {
$first = $this->substring(0, 1);
$rest = $this->substring(1);
return new Text(mb_strtoupper($first, $this->encoding) . $rest, $this->encoding);
} | [
"public",
"function",
"toUpperCaseFirst",
"(",
")",
"{",
"$",
"first",
"=",
"$",
"this",
"->",
"substring",
"(",
"0",
",",
"1",
")",
";",
"$",
"rest",
"=",
"$",
"this",
"->",
"substring",
"(",
"1",
")",
";",
"return",
"new",
"Text",
"(",
"mb_strtou... | Transforms the string to first character uppercased
@return Text | [
"Transforms",
"the",
"string",
"to",
"first",
"character",
"uppercased"
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L771-L776 |
phootwork/lang | src/Text.php | Text.toCapitalCaseWords | public function toCapitalCaseWords() {
$encoding = $this->encoding;
return $this->split(' ')->map(function ($str) use ($encoding) {
return Text::create($str, $encoding)->toCapitalCase();
})->join(' ');
} | php | public function toCapitalCaseWords() {
$encoding = $this->encoding;
return $this->split(' ')->map(function ($str) use ($encoding) {
return Text::create($str, $encoding)->toCapitalCase();
})->join(' ');
} | [
"public",
"function",
"toCapitalCaseWords",
"(",
")",
"{",
"$",
"encoding",
"=",
"$",
"this",
"->",
"encoding",
";",
"return",
"$",
"this",
"->",
"split",
"(",
"' '",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"str",
")",
"use",
"(",
"$",
"encoding... | Transforms the string with the words capitalized.
@return Text | [
"Transforms",
"the",
"string",
"with",
"the",
"words",
"capitalized",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L792-L797 |
phootwork/lang | src/Text.php | Text.toStudlyCase | public function toStudlyCase() {
$input = $this->trim('-_');
if ($input->isEmpty()) {
return $input;
}
$encoding = $this->encoding;
return Text::create(preg_replace_callback('/([A-Z-_][a-z0-9]+)/', function ($matches) use ($encoding) {
return Text::create($matches[0], $encoding)->replace(['-', '_'], '')... | php | public function toStudlyCase() {
$input = $this->trim('-_');
if ($input->isEmpty()) {
return $input;
}
$encoding = $this->encoding;
return Text::create(preg_replace_callback('/([A-Z-_][a-z0-9]+)/', function ($matches) use ($encoding) {
return Text::create($matches[0], $encoding)->replace(['-', '_'], '')... | [
"public",
"function",
"toStudlyCase",
"(",
")",
"{",
"$",
"input",
"=",
"$",
"this",
"->",
"trim",
"(",
"'-_'",
")",
";",
"if",
"(",
"$",
"input",
"->",
"isEmpty",
"(",
")",
")",
"{",
"return",
"$",
"input",
";",
"}",
"$",
"encoding",
"=",
"$",
... | Converts this string into StudlyCase. Numbers are considered as part of its previous piece.
<code>
$var = new Text('my_own_variable');<br>
$var->toStudlyCase(); // MyOwnVariable
$var = new Text('my_test3_variable');<br>
$var->toStudlyCase(); // MyTest3Variable
</code>
@return Text | [
"Converts",
"this",
"string",
"into",
"StudlyCase",
".",
"Numbers",
"are",
"considered",
"as",
"part",
"of",
"its",
"previous",
"piece",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L846-L855 |
phootwork/lang | src/Text.php | Text.toKebabCase | public function toKebabCase() {
if ($this->contains('_')) {
return $this->replace('_', '-');
}
return new Text(mb_strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1-$2', $this->string)), $this->encoding);
} | php | public function toKebabCase() {
if ($this->contains('_')) {
return $this->replace('_', '-');
}
return new Text(mb_strtolower(preg_replace('/([a-z0-9])([A-Z])/', '$1-$2', $this->string)), $this->encoding);
} | [
"public",
"function",
"toKebabCase",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"contains",
"(",
"'_'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"replace",
"(",
"'_'",
",",
"'-'",
")",
";",
"}",
"return",
"new",
"Text",
"(",
"mb_strtolower",
"... | Convert this string into kebab-case. Numbers are considered as part of its previous piece.
<code>
$var = new Text('myOwnVariable');<br>
$var->toKebapCase(); // my-own-variable
$var = new Text('myTest3Variable');<br>
$var->toKebapCase(); // my-test3-variable
</code>
@return Text | [
"Convert",
"this",
"string",
"into",
"kebab",
"-",
"case",
".",
"Numbers",
"are",
"considered",
"as",
"part",
"of",
"its",
"previous",
"piece",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L870-L876 |
phootwork/lang | src/Text.php | Text.toPlural | public function toPlural(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getPluralForm($this->string), $this->encoding);
} | php | public function toPlural(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getPluralForm($this->string), $this->encoding);
} | [
"public",
"function",
"toPlural",
"(",
"Pluralizer",
"$",
"pluralizer",
"=",
"null",
")",
"{",
"$",
"pluralizer",
"=",
"$",
"pluralizer",
"?",
":",
"new",
"EnglishPluralizer",
"(",
")",
";",
"return",
"new",
"Text",
"(",
"$",
"pluralizer",
"->",
"getPlural... | Get the plural form of the Text object.
@return Text | [
"Get",
"the",
"plural",
"form",
"of",
"the",
"Text",
"object",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L883-L887 |
phootwork/lang | src/Text.php | Text.toSingular | public function toSingular(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getSingularForm($this->string), $this->encoding);
} | php | public function toSingular(Pluralizer $pluralizer = null) {
$pluralizer = $pluralizer ?: new EnglishPluralizer();
return new Text($pluralizer->getSingularForm($this->string), $this->encoding);
} | [
"public",
"function",
"toSingular",
"(",
"Pluralizer",
"$",
"pluralizer",
"=",
"null",
")",
"{",
"$",
"pluralizer",
"=",
"$",
"pluralizer",
"?",
":",
"new",
"EnglishPluralizer",
"(",
")",
";",
"return",
"new",
"Text",
"(",
"$",
"pluralizer",
"->",
"getSing... | Get the singular form of the Text object.
@return Text | [
"Get",
"the",
"singular",
"form",
"of",
"the",
"Text",
"object",
"."
] | train | https://github.com/phootwork/lang/blob/2e5dc084d9102bf6b4c60f3ec2acc2ef49861588/src/Text.php#L894-L898 |
rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.validatePassword | public function validatePassword($password)
{
if (static::judgePasswordHash($password)) {
return $this->{$this->passwordHashAttribute} == $password;
}
return Yii::$app->security->validatePassword($password, $this->{$this->passwordHashAttribute});
} | php | public function validatePassword($password)
{
if (static::judgePasswordHash($password)) {
return $this->{$this->passwordHashAttribute} == $password;
}
return Yii::$app->security->validatePassword($password, $this->{$this->passwordHashAttribute});
} | [
"public",
"function",
"validatePassword",
"(",
"$",
"password",
")",
"{",
"if",
"(",
"static",
"::",
"judgePasswordHash",
"(",
"$",
"password",
")",
")",
"{",
"return",
"$",
"this",
"->",
"{",
"$",
"this",
"->",
"passwordHashAttribute",
"}",
"==",
"$",
"... | Validate password.
@param string $password Password or Password Hash.
@return boolean | [
"Validate",
"password",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L48-L54 |
rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.isUsed | public static function isUsed($password, $user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
$passwords = static::find()->createdBy($user)->all();
foreach ($passwords as $p) {
/* @var $p static */
if ($p... | php | public static function isUsed($password, $user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
$passwords = static::find()->createdBy($user)->all();
foreach ($passwords as $p) {
/* @var $p static */
if ($p... | [
"public",
"static",
"function",
"isUsed",
"(",
"$",
"password",
",",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"User",
"::",
"isValid",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"'User Invalid.'",
")",
";"... | Check whether the password has been used.
@param string $password Password or Password Hash.
@param User $user
@return false|static The first validated password model, or false if not validated. | [
"Check",
"whether",
"the",
"password",
"has",
"been",
"used",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L62-L75 |
rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.setPassword | public function setPassword($password)
{
$this->{$this->passwordHashAttribute} = Yii::$app->security->generatePasswordHash($password);
} | php | public function setPassword($password)
{
$this->{$this->passwordHashAttribute} = Yii::$app->security->generatePasswordHash($password);
} | [
"public",
"function",
"setPassword",
"(",
"$",
"password",
")",
"{",
"$",
"this",
"->",
"{",
"$",
"this",
"->",
"passwordHashAttribute",
"}",
"=",
"Yii",
"::",
"$",
"app",
"->",
"security",
"->",
"generatePasswordHash",
"(",
"$",
"password",
")",
";",
"}... | Set password.
@param string $password | [
"Set",
"password",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L81-L84 |
rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.add | public static function add($password, $user = null)
{
if (static::isUsed($password, $user) && !$user->allowUsedPassword) {
throw new InvalidParamException('Password existed.');
}
if (static::judgePasswordHash($password)) {
$passwordHistory = $user->create(static::clas... | php | public static function add($password, $user = null)
{
if (static::isUsed($password, $user) && !$user->allowUsedPassword) {
throw new InvalidParamException('Password existed.');
}
if (static::judgePasswordHash($password)) {
$passwordHistory = $user->create(static::clas... | [
"public",
"static",
"function",
"add",
"(",
"$",
"password",
",",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"static",
"::",
"isUsed",
"(",
"$",
"password",
",",
"$",
"user",
")",
"&&",
"!",
"$",
"user",
"->",
"allowUsedPassword",
")",
"{",
"th... | Add password to history.
@param string $password Password or Password Hash.
@param User $user
@return boolean
@throws InvalidParamException throw if password existed. | [
"Add",
"password",
"to",
"history",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L99-L112 |
rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.first | public static function first($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt()->one();
} | php | public static function first($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt()->one();
} | [
"public",
"static",
"function",
"first",
"(",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"User",
"::",
"isValid",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"'User Invalid.'",
")",
";",
"}",
"return",
"stati... | Get first password hash.
@param User $user
@return static
@throws InvalidParamException throw if user invalid. | [
"Get",
"first",
"password",
"hash",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L146-L152 |
rhosocial/yii2-user | security/PasswordHistory.php | PasswordHistory.last | public static function last($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt(SORT_DESC)->one();
} | php | public static function last($user = null)
{
if (!User::isValid($user)) {
throw new InvalidParamException('User Invalid.');
}
return static::find()->createdBy($user)->orderByCreatedAt(SORT_DESC)->one();
} | [
"public",
"static",
"function",
"last",
"(",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"User",
"::",
"isValid",
"(",
"$",
"user",
")",
")",
"{",
"throw",
"new",
"InvalidParamException",
"(",
"'User Invalid.'",
")",
";",
"}",
"return",
"static... | Get last password hash.
@param User $user
@return static
@throws InvalidParamException throw if user invalid. | [
"Get",
"last",
"password",
"hash",
"."
] | train | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/security/PasswordHistory.php#L161-L167 |
highday/glitter | src/Http/Controllers/Office/Customer/SearchController.php | SearchController.search | public function search(
string $preset = null,
Request $request,
SearchService $service,
CustomerFinderGroup $finderGroup
) {
// キーワードセット
$keyword = $request->input('keyword', null);
$service->setKeyword($keyword);
$finder = ($preset)
? $f... | php | public function search(
string $preset = null,
Request $request,
SearchService $service,
CustomerFinderGroup $finderGroup
) {
// キーワードセット
$keyword = $request->input('keyword', null);
$service->setKeyword($keyword);
$finder = ($preset)
? $f... | [
"public",
"function",
"search",
"(",
"string",
"$",
"preset",
"=",
"null",
",",
"Request",
"$",
"request",
",",
"SearchService",
"$",
"service",
",",
"CustomerFinderGroup",
"$",
"finderGroup",
")",
"{",
"// キーワードセット",
"$",
"keyword",
"=",
"$",
"request",
"->... | @param string|null $preset ファインダー名
@param Request $request
@param SearchService $service
@param CustomerFinderGroup $finderGroup
@return Factory|View|RedirectResponse | [
"@param",
"string|null",
"$preset",
"ファインダー名",
"@param",
"Request",
"$request",
"@param",
"SearchService",
"$service",
"@param",
"CustomerFinderGroup",
"$finderGroup"
] | train | https://github.com/highday/glitter/blob/d1c7a227fd2343806bd3ec0314e621ced57dfe66/src/Http/Controllers/Office/Customer/SearchController.php#L27-L54 |
jaxon-php/jaxon-jquery | src/Dom/Action.php | Action.getScript | public function getScript()
{
$this->useSingleQuotes();
foreach($this->aArguments as $xArgument)
{
if($xArgument instanceof Element)
{
$this->addParameter(Jaxon::JS_VALUE, $xArgument->getScript());
}
else if($xArgument instanceo... | php | public function getScript()
{
$this->useSingleQuotes();
foreach($this->aArguments as $xArgument)
{
if($xArgument instanceof Element)
{
$this->addParameter(Jaxon::JS_VALUE, $xArgument->getScript());
}
else if($xArgument instanceo... | [
"public",
"function",
"getScript",
"(",
")",
"{",
"$",
"this",
"->",
"useSingleQuotes",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"aArguments",
"as",
"$",
"xArgument",
")",
"{",
"if",
"(",
"$",
"xArgument",
"instanceof",
"Element",
")",
"{",
"$... | Return a string representation of the call to this jQuery function
@return string | [
"Return",
"a",
"string",
"representation",
"of",
"the",
"call",
"to",
"this",
"jQuery",
"function"
] | train | https://github.com/jaxon-php/jaxon-jquery/blob/90766a8ea8a4124a3f110e96b316370f71762380/src/Dom/Action.php#L41-L76 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/rfc822_parser.php | ezcMailRfc822Parser.parseBody | public function parseBody( $origLine )
{
$line = rtrim( $origLine, "\r\n" );
if ( $this->parserState == self::PARSE_STATE_HEADERS && $line == '' )
{
$this->parserState = self::PARSE_STATE_BODY;
// clean up headers for the part
// the rest of the headers s... | php | public function parseBody( $origLine )
{
$line = rtrim( $origLine, "\r\n" );
if ( $this->parserState == self::PARSE_STATE_HEADERS && $line == '' )
{
$this->parserState = self::PARSE_STATE_BODY;
// clean up headers for the part
// the rest of the headers s... | [
"public",
"function",
"parseBody",
"(",
"$",
"origLine",
")",
"{",
"$",
"line",
"=",
"rtrim",
"(",
"$",
"origLine",
",",
"\"\\r\\n\"",
")",
";",
"if",
"(",
"$",
"this",
"->",
"parserState",
"==",
"self",
"::",
"PARSE_STATE_HEADERS",
"&&",
"$",
"line",
... | Parses the body of an rfc 2822 message.
@throws ezcBaseFileNotFoundException
if a neccessary temporary file could not be openened.
@param string $origLine | [
"Parses",
"the",
"body",
"of",
"an",
"rfc",
"2822",
"message",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/rfc822_parser.php#L71-L104 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/rfc822_parser.php | ezcMailRfc822Parser.finish | public function finish( $class = "ezcMail" )
{
$mail = new $class();
$mail->setHeaders( $this->headers->getCaseSensitiveArray() );
ezcMailPartParser::parsePartHeaders( $this->headers, $mail );
// from
if ( isset( $this->headers['From'] ) )
{
$mail->from =... | php | public function finish( $class = "ezcMail" )
{
$mail = new $class();
$mail->setHeaders( $this->headers->getCaseSensitiveArray() );
ezcMailPartParser::parsePartHeaders( $this->headers, $mail );
// from
if ( isset( $this->headers['From'] ) )
{
$mail->from =... | [
"public",
"function",
"finish",
"(",
"$",
"class",
"=",
"\"ezcMail\"",
")",
"{",
"$",
"mail",
"=",
"new",
"$",
"class",
"(",
")",
";",
"$",
"mail",
"->",
"setHeaders",
"(",
"$",
"this",
"->",
"headers",
"->",
"getCaseSensitiveArray",
"(",
")",
")",
"... | Returns an ezcMail corresponding to the parsed message.
You can specify an alternate class using the $class parameter, if you
extended ezcMail.
@param string $class Class to instanciate instead of ezcMail.
@return ezcMail | [
"Returns",
"an",
"ezcMail",
"corresponding",
"to",
"the",
"parsed",
"message",
".",
"You",
"can",
"specify",
"an",
"alternate",
"class",
"using",
"the",
"$class",
"parameter",
"if",
"you",
"extended",
"ezcMail",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/rfc822_parser.php#L114-L163 |
spiderling-php/spiderling | src/CrawlerSession.php | CrawlerSession.saveHtml | public function saveHtml($filename, $base = null)
{
$this->ensureWritableDirectory(dirname($filename));
$html = new Html($this->getHtml());
if (null !== $base) {
$html->resolveLinks(\GuzzleHttp\Psr7\uri_for($base));
}
file_put_contents($filename, $html->get());... | php | public function saveHtml($filename, $base = null)
{
$this->ensureWritableDirectory(dirname($filename));
$html = new Html($this->getHtml());
if (null !== $base) {
$html->resolveLinks(\GuzzleHttp\Psr7\uri_for($base));
}
file_put_contents($filename, $html->get());... | [
"public",
"function",
"saveHtml",
"(",
"$",
"filename",
",",
"$",
"base",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ensureWritableDirectory",
"(",
"dirname",
"(",
"$",
"filename",
")",
")",
";",
"$",
"html",
"=",
"new",
"Html",
"(",
"$",
"this",
"->... | Save the HTML of the session into a file
Optionally resolve all the links with a base uri
@param string $filename
@throws InvalidArgumentException if directory doesnt exist or is not writable
@param UriInterface|string $base | [
"Save",
"the",
"HTML",
"of",
"the",
"session",
"into",
"a",
"file",
"Optionally",
"resolve",
"all",
"the",
"links",
"with",
"a",
"base",
"uri"
] | train | https://github.com/spiderling-php/spiderling/blob/030d70fb71c89256e3b256dda7fa4c47751d9c53/src/CrawlerSession.php#L85-L98 |
fccn/oai-pmh-core | src/libs/phprop.php | Phprop.parse | public static function parse($filename, $del=".")
{
if (is_null(self::$_instance)) {
self::$_instance = new self($filename, $del);
}
return self::$_instance->getObj();
//return self::$_instance;
} | php | public static function parse($filename, $del=".")
{
if (is_null(self::$_instance)) {
self::$_instance = new self($filename, $del);
}
return self::$_instance->getObj();
//return self::$_instance;
} | [
"public",
"static",
"function",
"parse",
"(",
"$",
"filename",
",",
"$",
"del",
"=",
"\".\"",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_instance",
")",
")",
"{",
"self",
"::",
"$",
"_instance",
"=",
"new",
"self",
"(",
"$",
"filenam... | Singleton pattern constructor
@param string ini filename
@param string delimiter, it is '.' by default but can be changed
@return object : object containing ini data | [
"Singleton",
"pattern",
"constructor"
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/phprop.php#L91-L98 |
fccn/oai-pmh-core | src/libs/phprop.php | Phprop._parseIni | private function _parseIni($iniFile)
{
$aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
$tmpArray = array();
foreach ($aParsedIni as $key=>$value) {
if (strpos($key, ':') !== false) {
$sections = explode(':', $key);
if (count($section... | php | private function _parseIni($iniFile)
{
$aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
$tmpArray = array();
foreach ($aParsedIni as $key=>$value) {
if (strpos($key, ':') !== false) {
$sections = explode(':', $key);
if (count($section... | [
"private",
"function",
"_parseIni",
"(",
"$",
"iniFile",
")",
"{",
"$",
"aParsedIni",
"=",
"parse_ini_file",
"(",
"$",
"iniFile",
",",
"true",
",",
"INI_SCANNER_RAW",
")",
";",
"$",
"tmpArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aParsedIn... | Parses ini file and extract its keys and prepare it for object creation | [
"Parses",
"ini",
"file",
"and",
"extract",
"its",
"keys",
"and",
"prepare",
"it",
"for",
"object",
"creation"
] | train | https://github.com/fccn/oai-pmh-core/blob/a9c6852482c7bd7c48911a2165120325ecc27ea2/src/libs/phprop.php#L103-L165 |
hametuha/wpametu | src/WPametu/File/Image.php | Image.trim | public function trim( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ){
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) )
return $editor;
$editor->set_quality( $jpeg_quality );
$resized = $editor->resize( $max_... | php | public function trim( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ){
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) )
return $editor;
$editor->set_quality( $jpeg_quality );
$resized = $editor->resize( $max_... | [
"public",
"function",
"trim",
"(",
"$",
"file",
",",
"$",
"max_w",
",",
"$",
"max_h",
",",
"$",
"crop",
"=",
"false",
",",
"$",
"suffix",
"=",
"null",
",",
"$",
"dest_path",
"=",
"null",
",",
"$",
"jpeg_quality",
"=",
"90",
")",
"{",
"$",
"editor... | Clone of image resize
@see image_resize
@param string $file Image file path.
@param int $max_w Maximum width to resize to.
@param int $max_h Maximum height to resize to.
@param bool $crop Optional. Whether to crop image or resize.
@param string $suffix Optional. File suffix.
@param string $dest_path Optional. New imag... | [
"Clone",
"of",
"image",
"resize"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Image.php#L39-L56 |
hametuha/wpametu | src/WPametu/File/Image.php | Image.fit | public function fit($src, $dest, $width, $height){
// Calculate
$size = getimagesize($src);
$ratio = max($width / $size[0], $height / $size[1]);
$old_width = $size[0];
$old_height = $size[1];
$new_width = intval($old_width * $ratio);
$new_height = intval($old_heig... | php | public function fit($src, $dest, $width, $height){
// Calculate
$size = getimagesize($src);
$ratio = max($width / $size[0], $height / $size[1]);
$old_width = $size[0];
$old_height = $size[1];
$new_width = intval($old_width * $ratio);
$new_height = intval($old_heig... | [
"public",
"function",
"fit",
"(",
"$",
"src",
",",
"$",
"dest",
",",
"$",
"width",
",",
"$",
"height",
")",
"{",
"// Calculate",
"$",
"size",
"=",
"getimagesize",
"(",
"$",
"src",
")",
";",
"$",
"ratio",
"=",
"max",
"(",
"$",
"width",
"/",
"$",
... | Fit small image to specified bound
@param string $src
@param string $dest
@param int $width
@param int $height
@return bool | [
"Fit",
"small",
"image",
"to",
"specified",
"bound"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/File/Image.php#L67-L99 |
blast-project/BaseEntitiesBundle | src/Controller/SearchController.php | SearchController.retrieveAutocompleteItemsAction | public function retrieveAutocompleteItemsAction(Request $request)
{
// $$pool = $this->container->get('sonata.admin.pool')->getInstance($request->get('admin_code'));
$admin = $this->container->get('sonata.admin.pool')->getInstance($request->get('admin_code'));
$admin->setRequest($requ... | php | public function retrieveAutocompleteItemsAction(Request $request)
{
// $$pool = $this->container->get('sonata.admin.pool')->getInstance($request->get('admin_code'));
$admin = $this->container->get('sonata.admin.pool')->getInstance($request->get('admin_code'));
$admin->setRequest($requ... | [
"public",
"function",
"retrieveAutocompleteItemsAction",
"(",
"Request",
"$",
"request",
")",
"{",
"// $$pool = $this->container->get('sonata.admin.pool')->getInstance($request->get('admin_code'));",
"$",
"admin",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
... | Retrieve list of items for autocomplete form field with search indexes
Based on Sonata\AdminBundle\Controller\HelperController#retrieveAutocompleteItemsAction.
@param Request $request
@return JsonResponse
@throws \RuntimeException
@throws AccessDeniedException
@todo refactor this to avoid dependency to BaseEntities... | [
"Retrieve",
"list",
"of",
"items",
"for",
"autocomplete",
"form",
"field",
"with",
"search",
"indexes",
"Based",
"on",
"Sonata",
"\\",
"AdminBundle",
"\\",
"Controller",
"\\",
"HelperController#retrieveAutocompleteItemsAction",
"."
] | train | https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Controller/SearchController.php#L37-L130 |
blast-project/BaseEntitiesBundle | src/Controller/SearchController.php | SearchController.retrieveFormFieldDescription | private function retrieveFormFieldDescription(AdminInterface $admin, $field)
{
$admin->getFormFieldDescriptions();
$fieldDescription = $admin->getFormFieldDescription($field);
if (!$fieldDescription) {
throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field... | php | private function retrieveFormFieldDescription(AdminInterface $admin, $field)
{
$admin->getFormFieldDescriptions();
$fieldDescription = $admin->getFormFieldDescription($field);
if (!$fieldDescription) {
throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field... | [
"private",
"function",
"retrieveFormFieldDescription",
"(",
"AdminInterface",
"$",
"admin",
",",
"$",
"field",
")",
"{",
"$",
"admin",
"->",
"getFormFieldDescriptions",
"(",
")",
";",
"$",
"fieldDescription",
"=",
"$",
"admin",
"->",
"getFormFieldDescription",
"("... | Retrieve the form field description given by field name.
Copied from Sonata\AdminBundle\Controller\HelperController.
@param AdminInterface $admin
@param string $field
@return FormInterface
@throws \RuntimeException | [
"Retrieve",
"the",
"form",
"field",
"description",
"given",
"by",
"field",
"name",
".",
"Copied",
"from",
"Sonata",
"\\",
"AdminBundle",
"\\",
"Controller",
"\\",
"HelperController",
"."
] | train | https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Controller/SearchController.php#L143-L158 |
webdevvie/pheanstalk-task-queue-bundle | Command/Example/AddExampleTaskCommand.php | AddExampleTaskCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->initialiseWorker($input, $output);
$totalTasks = $input->getOption('total-tasks');
for ($counter = 0; $counter < $totalTasks; $counter++) {
$task = new ExampleTaskDescription();
$task-... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->initialiseWorker($input, $output);
$totalTasks = $input->getOption('total-tasks');
for ($counter = 0; $counter < $totalTasks; $counter++) {
$task = new ExampleTaskDescription();
$task-... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"this",
"->",
"initialiseWorker",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"totalTasks",
"=",
"$",
"input",
"->",
... | Adds an example task to the task queue using the ExampleTask.php
@param InputInterface $input
@param OutputInterface $output
@return void
@throws \InvalidArgumentException | [
"Adds",
"an",
"example",
"task",
"to",
"the",
"task",
"queue",
"using",
"the",
"ExampleTask",
".",
"php"
] | train | https://github.com/webdevvie/pheanstalk-task-queue-bundle/blob/db5e63a8f844e345dc2e69ce8e94b32d851020eb/Command/Example/AddExampleTaskCommand.php#L43-L53 |
Visithor/visithor | src/Visithor/Reader/YamlConfigurationReader.php | YamlConfigurationReader.read | public function read($path)
{
$config = $this
->readByFilename(
$path,
Visithor::CONFIG_FILE_NAME_DISTR
);
if (false === $config) {
$config = $this
->readByFilename(
$path,
Vi... | php | public function read($path)
{
$config = $this
->readByFilename(
$path,
Visithor::CONFIG_FILE_NAME_DISTR
);
if (false === $config) {
$config = $this
->readByFilename(
$path,
Vi... | [
"public",
"function",
"read",
"(",
"$",
"path",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"readByFilename",
"(",
"$",
"path",
",",
"Visithor",
"::",
"CONFIG_FILE_NAME_DISTR",
")",
";",
"if",
"(",
"false",
"===",
"$",
"config",
")",
"{",
"$",
"... | Read all the configuration given a path
@param string $path Path
@return array|false Configuration loaded or false if file not exists | [
"Read",
"all",
"the",
"configuration",
"given",
"a",
"path"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Reader/YamlConfigurationReader.php#L32-L49 |
Visithor/visithor | src/Visithor/Reader/YamlConfigurationReader.php | YamlConfigurationReader.readByFilename | public function readByFilename($path, $filename)
{
$config = false;
$configFilePath = rtrim($path, '/') . '/' . $filename;
if (is_file($configFilePath)) {
$yamlParser = new YamlParser();
$config = $yamlParser->parse(file_get_contents($configFilePath));
}
... | php | public function readByFilename($path, $filename)
{
$config = false;
$configFilePath = rtrim($path, '/') . '/' . $filename;
if (is_file($configFilePath)) {
$yamlParser = new YamlParser();
$config = $yamlParser->parse(file_get_contents($configFilePath));
}
... | [
"public",
"function",
"readByFilename",
"(",
"$",
"path",
",",
"$",
"filename",
")",
"{",
"$",
"config",
"=",
"false",
";",
"$",
"configFilePath",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'/'",
")",
".",
"'/'",
".",
"$",
"filename",
";",
"if",
"(",
"i... | Read all the configuration given a path and a filename
@param string $path Path
@param string $filename File name
@return array Configuration | [
"Read",
"all",
"the",
"configuration",
"given",
"a",
"path",
"and",
"a",
"filename"
] | train | https://github.com/Visithor/visithor/blob/201ba2cfc536a0875983c79226947aa20b9f4dca/src/Visithor/Reader/YamlConfigurationReader.php#L60-L71 |
syzygypl/page-media-set-bundle | DependencyInjection/PageMediaSetExtension.php | PageMediaSetExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$configs = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load... | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$configs = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"configs",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"co... | {@inheritdoc} | [
"{"
] | train | https://github.com/syzygypl/page-media-set-bundle/blob/013d5321518755b07d292d63d5b3f1ddeb635107/DependencyInjection/PageMediaSetExtension.php#L23-L49 |
wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.addClass | public function addClass($class, $extends = null, $implements = [])
{
$classId = $this->registerClass($class);
if ($extends) {
$parentClassId = $this->registerClass($extends);
$this->extends[$classId] = [$parentClassId];
}
if (!empty($implements)) {
... | php | public function addClass($class, $extends = null, $implements = [])
{
$classId = $this->registerClass($class);
if ($extends) {
$parentClassId = $this->registerClass($extends);
$this->extends[$classId] = [$parentClassId];
}
if (!empty($implements)) {
... | [
"public",
"function",
"addClass",
"(",
"$",
"class",
",",
"$",
"extends",
"=",
"null",
",",
"$",
"implements",
"=",
"[",
"]",
")",
"{",
"$",
"classId",
"=",
"$",
"this",
"->",
"registerClass",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"extends",... | add class to hierarchy tree
@param string $class
@param string $extends parent class
@param array $implements interfaces that implements
@return self | [
"add",
"class",
"to",
"hierarchy",
"tree"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L74-L88 |
wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.addInterface | public function addInterface($interface, $extends = [])
{
$interfaceId = $this->registerInterface($interface);
if (!empty($extends)) {
$interfaceIds = [];
foreach ($extends as $name) {
$interfaceIds[] = $this->registerInterface($name);
}
... | php | public function addInterface($interface, $extends = [])
{
$interfaceId = $this->registerInterface($interface);
if (!empty($extends)) {
$interfaceIds = [];
foreach ($extends as $name) {
$interfaceIds[] = $this->registerInterface($name);
}
... | [
"public",
"function",
"addInterface",
"(",
"$",
"interface",
",",
"$",
"extends",
"=",
"[",
"]",
")",
"{",
"$",
"interfaceId",
"=",
"$",
"this",
"->",
"registerInterface",
"(",
"$",
"interface",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"extends",
... | add interface to hierarchy tree
@param string $interface
@param array $extends
@return self | [
"add",
"interface",
"to",
"hierarchy",
"tree"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L97-L107 |
wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.getParent | public function getParent($class)
{
$classId = $this->getClassId($class);
if (!isset($classId)) {
return false;
}
$parentClassId = $this->extends[$classId];
return isset($parentClassId) ? $this->classes[$parentClassId[0]] : null;
} | php | public function getParent($class)
{
$classId = $this->getClassId($class);
if (!isset($classId)) {
return false;
}
$parentClassId = $this->extends[$classId];
return isset($parentClassId) ? $this->classes[$parentClassId[0]] : null;
} | [
"public",
"function",
"getParent",
"(",
"$",
"class",
")",
"{",
"$",
"classId",
"=",
"$",
"this",
"->",
"getClassId",
"(",
"$",
"class",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"classId",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"par... | gets parent class
@param string $class
@retutn string|null|false | [
"gets",
"parent",
"class"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L115-L123 |
wenbinye/PhalconX | src/Php/ClassHierarchy.php | ClassHierarchy.getAncestors | public function getAncestors($class)
{
$ancestors = [];
while (true) {
$parent = $this->getParent($class);
if ($parent) {
$ancestors[] = $parent;
$class = $parent;
} else {
break;
}
}
retu... | php | public function getAncestors($class)
{
$ancestors = [];
while (true) {
$parent = $this->getParent($class);
if ($parent) {
$ancestors[] = $parent;
$class = $parent;
} else {
break;
}
}
retu... | [
"public",
"function",
"getAncestors",
"(",
"$",
"class",
")",
"{",
"$",
"ancestors",
"=",
"[",
"]",
";",
"while",
"(",
"true",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParent",
"(",
"$",
"class",
")",
";",
"if",
"(",
"$",
"parent",
")... | gets all parent classes
@param string $class
@return array | [
"gets",
"all",
"parent",
"classes"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Php/ClassHierarchy.php#L131-L144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.