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 |
|---|---|---|---|---|---|---|---|---|---|---|
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.daily | public function daily()
{
$this->setScheduleMinute(0);
$this->setScheduleHour(0);
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleMonth(self::ANY);
$this->setScheduleDayOfWeek(self::ANY);
return $this;
} | php | public function daily()
{
$this->setScheduleMinute(0);
$this->setScheduleHour(0);
$this->setScheduleDayOfMonth(self::ANY);
$this->setScheduleMonth(self::ANY);
$this->setScheduleDayOfWeek(self::ANY);
return $this;
} | [
"public",
"function",
"daily",
"(",
")",
"{",
"$",
"this",
"->",
"setScheduleMinute",
"(",
"0",
")",
";",
"$",
"this",
"->",
"setScheduleHour",
"(",
"0",
")",
";",
"$",
"this",
"->",
"setScheduleDayOfMonth",
"(",
"self",
"::",
"ANY",
")",
";",
"$",
"... | Run once a day at midnight
@return $this | [
"Run",
"once",
"a",
"day",
"at",
"midnight"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L274-L283 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php | Scheduler.everyMinutes | public function everyMinutes($minutes)
{
$minutesSchedule = self::ANY;
if ($minutes != 1) {
$minutesSchedule .= '/'.$minutes;
}
$this->setScheduleMinute($minutesSchedule);
return $this;
} | php | public function everyMinutes($minutes)
{
$minutesSchedule = self::ANY;
if ($minutes != 1) {
$minutesSchedule .= '/'.$minutes;
}
$this->setScheduleMinute($minutesSchedule);
return $this;
} | [
"public",
"function",
"everyMinutes",
"(",
"$",
"minutes",
")",
"{",
"$",
"minutesSchedule",
"=",
"self",
"::",
"ANY",
";",
"if",
"(",
"$",
"minutes",
"!=",
"1",
")",
"{",
"$",
"minutesSchedule",
".=",
"'/'",
".",
"$",
"minutes",
";",
"}",
"$",
"this... | Run a command every X minutes
@param int $minutes
@return $this | [
"Run",
"a",
"command",
"every",
"X",
"minutes"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/Scheduler.php#L365-L375 |
Indatus/dispatcher | src/Indatus/Dispatcher/Commands/Run.php | Run.fire | public function fire()
{
/** @var \Indatus\Dispatcher\OptionReader $optionReader */
$optionReader = App::make('Indatus\Dispatcher\OptionReader', [
$this->option(),
]);
/** @var \Indatus\Dispatcher\Debugger $debugger */
$debugger = App::make('Indatus\Dispa... | php | public function fire()
{
/** @var \Indatus\Dispatcher\OptionReader $optionReader */
$optionReader = App::make('Indatus\Dispatcher\OptionReader', [
$this->option(),
]);
/** @var \Indatus\Dispatcher\Debugger $debugger */
$debugger = App::make('Indatus\Dispa... | [
"public",
"function",
"fire",
"(",
")",
"{",
"/** @var \\Indatus\\Dispatcher\\OptionReader $optionReader */",
"$",
"optionReader",
"=",
"App",
"::",
"make",
"(",
"'Indatus\\Dispatcher\\OptionReader'",
",",
"[",
"$",
"this",
"->",
"option",
"(",
")",
",",
"]",
")",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Commands/Run.php#L64-L78 |
Indatus/dispatcher | src/Indatus/Dispatcher/Commands/Make.php | Make.extendStub | protected function extendStub($stub)
{
/** @var \Illuminate\Filesystem\Filesystem $files */
$files = App::make('Illuminate\Filesystem\Filesystem');
$content = $files->get(__DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'command.stub');
$replacements = [
'use Illu... | php | protected function extendStub($stub)
{
/** @var \Illuminate\Filesystem\Filesystem $files */
$files = App::make('Illuminate\Filesystem\Filesystem');
$content = $files->get(__DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'command.stub');
$replacements = [
'use Illu... | [
"protected",
"function",
"extendStub",
"(",
"$",
"stub",
")",
"{",
"/** @var \\Illuminate\\Filesystem\\Filesystem $files */",
"$",
"files",
"=",
"App",
"::",
"make",
"(",
"'Illuminate\\Filesystem\\Filesystem'",
")",
";",
"$",
"content",
"=",
"$",
"files",
"->",
"get... | Make sure we're implementing our own class
@param $stub
@return string | [
"Make",
"sure",
"we",
"re",
"implementing",
"our",
"own",
"class"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Commands/Make.php#L50-L67 |
Indatus/dispatcher | src/Indatus/Dispatcher/BackgroundProcessRunner.php | BackgroundProcessRunner.run | public function run(
ScheduledCommandInterface $scheduledCommand,
array $arguments = [],
array $options = [],
Debugger $debugger = null
) {
$runCommand = $this->commandService->getRunCommand($scheduledCommand, $arguments, $options);
if (!is_null($debugger)) {
... | php | public function run(
ScheduledCommandInterface $scheduledCommand,
array $arguments = [],
array $options = [],
Debugger $debugger = null
) {
$runCommand = $this->commandService->getRunCommand($scheduledCommand, $arguments, $options);
if (!is_null($debugger)) {
... | [
"public",
"function",
"run",
"(",
"ScheduledCommandInterface",
"$",
"scheduledCommand",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"Debugger",
"$",
"debugger",
"=",
"null",
")",
"{",
"$",
"runCommand",
... | Run a scheduled command
@param \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface $scheduledCommand
@param array $arguments
@param array $options
@return bool | [
"Run",
"a",
"scheduled",
"command"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/BackgroundProcessRunner.php#L35-L50 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/ScheduleService.php | ScheduleService.isDue | public function isDue(Schedulable $scheduler)
{
/** @var \Indatus\Dispatcher\Drivers\DateTime\ScheduleInterpreter $interpreter */
$interpreter = App::make('Indatus\Dispatcher\Drivers\DateTime\ScheduleInterpreter', [$scheduler]);
/** @var \Illuminate\Contracts\Logging\Log $logger */
... | php | public function isDue(Schedulable $scheduler)
{
/** @var \Indatus\Dispatcher\Drivers\DateTime\ScheduleInterpreter $interpreter */
$interpreter = App::make('Indatus\Dispatcher\Drivers\DateTime\ScheduleInterpreter', [$scheduler]);
/** @var \Illuminate\Contracts\Logging\Log $logger */
... | [
"public",
"function",
"isDue",
"(",
"Schedulable",
"$",
"scheduler",
")",
"{",
"/** @var \\Indatus\\Dispatcher\\Drivers\\DateTime\\ScheduleInterpreter $interpreter */",
"$",
"interpreter",
"=",
"App",
"::",
"make",
"(",
"'Indatus\\Dispatcher\\Drivers\\DateTime\\ScheduleInterpreter'... | Determine if a schedule is due to be run.
@param \Indatus\Dispatcher\Scheduling\Schedulable $scheduler
@return bool | [
"Determine",
"if",
"a",
"schedule",
"is",
"due",
"to",
"be",
"run",
"."
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/ScheduleService.php#L29-L44 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/ScheduleInterpreter.php | ScheduleInterpreter.isDue | public function isDue()
{
$cron = App::make('Cron\CronExpression', [$this->scheduler->getCronSchedule()]);
// if a week is defined, so some special weekly stuff
if ($this->scheduler->getScheduleWeek() !== Scheduler::NONE) {
return $this->thisWeek() && $cron->isDue();
}
... | php | public function isDue()
{
$cron = App::make('Cron\CronExpression', [$this->scheduler->getCronSchedule()]);
// if a week is defined, so some special weekly stuff
if ($this->scheduler->getScheduleWeek() !== Scheduler::NONE) {
return $this->thisWeek() && $cron->isDue();
}
... | [
"public",
"function",
"isDue",
"(",
")",
"{",
"$",
"cron",
"=",
"App",
"::",
"make",
"(",
"'Cron\\CronExpression'",
",",
"[",
"$",
"this",
"->",
"scheduler",
"->",
"getCronSchedule",
"(",
")",
"]",
")",
";",
"// if a week is defined, so some special weekly stuff... | Determine if the current schedule is due to be run
@return bool | [
"Determine",
"if",
"the",
"current",
"schedule",
"is",
"due",
"to",
"be",
"run"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/ScheduleInterpreter.php#L41-L52 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/ScheduleInterpreter.php | ScheduleInterpreter.thisWeek | public function thisWeek()
{
$scheduleWeek = $this->scheduler->getScheduleWeek();
$currentWeek = $this->now->format('W');
//if a month is defined, week refers to the week of the month
$scheduleMonth = $this->scheduler->getScheduleMonth();
if (!is_null($scheduleMonth) && $sch... | php | public function thisWeek()
{
$scheduleWeek = $this->scheduler->getScheduleWeek();
$currentWeek = $this->now->format('W');
//if a month is defined, week refers to the week of the month
$scheduleMonth = $this->scheduler->getScheduleMonth();
if (!is_null($scheduleMonth) && $sch... | [
"public",
"function",
"thisWeek",
"(",
")",
"{",
"$",
"scheduleWeek",
"=",
"$",
"this",
"->",
"scheduler",
"->",
"getScheduleWeek",
"(",
")",
";",
"$",
"currentWeek",
"=",
"$",
"this",
"->",
"now",
"->",
"format",
"(",
"'W'",
")",
";",
"//if a month is d... | Determine if the provided expression refers to this week
@return bool | [
"Determine",
"if",
"the",
"provided",
"expression",
"refers",
"to",
"this",
"week"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/ScheduleInterpreter.php#L59-L78 |
Indatus/dispatcher | src/Indatus/Dispatcher/Drivers/DateTime/ScheduleInterpreter.php | ScheduleInterpreter.isCurrent | protected function isCurrent($expression, $current)
{
// if it's any
if ($expression == Scheduler::ANY) {
return true;
}
// if this is in a series
if (is_array($expression)) {
return in_array($current, $expression);
}
// if there's a ... | php | protected function isCurrent($expression, $current)
{
// if it's any
if ($expression == Scheduler::ANY) {
return true;
}
// if this is in a series
if (is_array($expression)) {
return in_array($current, $expression);
}
// if there's a ... | [
"protected",
"function",
"isCurrent",
"(",
"$",
"expression",
",",
"$",
"current",
")",
"{",
"// if it's any",
"if",
"(",
"$",
"expression",
"==",
"Scheduler",
"::",
"ANY",
")",
"{",
"return",
"true",
";",
"}",
"// if this is in a series",
"if",
"(",
"is_arr... | This method checks syntax for all scheduling components.
- If there's a direct match
- If it's an ANY match
- If the expression exists in the series
@param string $expression The expression to compare
@param string $current The current value to compare against
@return bool | [
"This",
"method",
"checks",
"syntax",
"for",
"all",
"scheduling",
"components",
"."
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Drivers/DateTime/ScheduleInterpreter.php#L92-L110 |
Indatus/dispatcher | src/Indatus/Dispatcher/Scheduling/Schedulable.php | Schedulable.args | public function args(array $arguments)
{
// provide a new instance of the scheduler class if this
// is the first method that was called. This allows for
// $scheduler->opts() to return a new instance of the
// scheduler when it's first called
if (count($this->options) == 0)... | php | public function args(array $arguments)
{
// provide a new instance of the scheduler class if this
// is the first method that was called. This allows for
// $scheduler->opts() to return a new instance of the
// scheduler when it's first called
if (count($this->options) == 0)... | [
"public",
"function",
"args",
"(",
"array",
"$",
"arguments",
")",
"{",
"// provide a new instance of the scheduler class if this",
"// is the first method that was called. This allows for",
"// $scheduler->opts() to return a new instance of the",
"// scheduler when it's first called",
"i... | Define arguments for this schedule when it runs.
@param array $arguments
@return \Indatus\Dispatcher\Scheduling\Schedulable | [
"Define",
"arguments",
"for",
"this",
"schedule",
"when",
"it",
"runs",
"."
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Scheduling/Schedulable.php#L32-L48 |
Indatus/dispatcher | src/Indatus/Dispatcher/Scheduling/Schedulable.php | Schedulable.opts | public function opts(array $options)
{
// provide a new instance of the scheduler class if this
// is the first method that was called. This allows for
// $scheduler->opts() to return a new instance of the
// scheduler when it's first called
if (count($this->arguments) == 0)... | php | public function opts(array $options)
{
// provide a new instance of the scheduler class if this
// is the first method that was called. This allows for
// $scheduler->opts() to return a new instance of the
// scheduler when it's first called
if (count($this->arguments) == 0)... | [
"public",
"function",
"opts",
"(",
"array",
"$",
"options",
")",
"{",
"// provide a new instance of the scheduler class if this",
"// is the first method that was called. This allows for",
"// $scheduler->opts() to return a new instance of the",
"// scheduler when it's first called",
"if"... | Define options for this schedule when it runs.
@param array $options
@return \Indatus\Dispatcher\Scheduling\Schedulable | [
"Define",
"options",
"for",
"this",
"schedule",
"when",
"it",
"runs",
"."
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Scheduling/Schedulable.php#L79-L95 |
Indatus/dispatcher | src/Indatus/Dispatcher/Scheduling/Schedulable.php | Schedulable.setEnvironmentOption | private function setEnvironmentOption()
{
if (!array_key_exists('env', $this->options)) {
$this->options = array_merge(
$this->options,
['env' => App::environment()]
);
}
} | php | private function setEnvironmentOption()
{
if (!array_key_exists('env', $this->options)) {
$this->options = array_merge(
$this->options,
['env' => App::environment()]
);
}
} | [
"private",
"function",
"setEnvironmentOption",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'env'",
",",
"$",
"this",
"->",
"options",
")",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"options",
",",
... | Propagate scheduled:run environment
to scheduled commands, only if 'env' option was not specified | [
"Propagate",
"scheduled",
":",
"run",
"environment",
"to",
"scheduled",
"commands",
"only",
"if",
"env",
"option",
"was",
"not",
"specified"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Scheduling/Schedulable.php#L124-L132 |
Indatus/dispatcher | src/Indatus/Dispatcher/Debugger.php | Debugger.commandNotRun | public function commandNotRun(ScheduledCommandInterface $command, $reason)
{
if ($this->optionReader->isDebugMode()) {
$this->output->writeln(' <comment>'.$command->getName().'</comment>: '.$reason);
}
} | php | public function commandNotRun(ScheduledCommandInterface $command, $reason)
{
if ($this->optionReader->isDebugMode()) {
$this->output->writeln(' <comment>'.$command->getName().'</comment>: '.$reason);
}
} | [
"public",
"function",
"commandNotRun",
"(",
"ScheduledCommandInterface",
"$",
"command",
",",
"$",
"reason",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"optionReader",
"->",
"isDebugMode",
"(",
")",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",... | Indicate why a command was not run
@param ScheduledCommandInterface $command
@param $reason | [
"Indicate",
"why",
"a",
"command",
"was",
"not",
"run"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Debugger.php#L31-L36 |
Indatus/dispatcher | src/Indatus/Dispatcher/Debugger.php | Debugger.commandRun | public function commandRun(ScheduledCommandInterface $command, $runCommand)
{
if ($this->optionReader->isDebugMode()) {
$this->output->writeln(' <info>'.$command->getName().'</info>: '.$runCommand);
}
} | php | public function commandRun(ScheduledCommandInterface $command, $runCommand)
{
if ($this->optionReader->isDebugMode()) {
$this->output->writeln(' <info>'.$command->getName().'</info>: '.$runCommand);
}
} | [
"public",
"function",
"commandRun",
"(",
"ScheduledCommandInterface",
"$",
"command",
",",
"$",
"runCommand",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"optionReader",
"->",
"isDebugMode",
"(",
")",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"("... | Indicate why a command has run
@param ScheduledCommandInterface $command
@param $runCommand | [
"Indicate",
"why",
"a",
"command",
"has",
"run"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/Debugger.php#L44-L49 |
Indatus/dispatcher | src/Indatus/Dispatcher/ConfigResolver.php | ConfigResolver.resolveSchedulerClass | public function resolveSchedulerClass()
{
try {
return $this->container->make($this->getDriver().'\\Scheduler', [$this]);
} catch (ReflectionException $e) {
return $this->container->make('Indatus\Dispatcher\Drivers\\'.$this->getDriver().'\\Scheduler', [$this]);
}
... | php | public function resolveSchedulerClass()
{
try {
return $this->container->make($this->getDriver().'\\Scheduler', [$this]);
} catch (ReflectionException $e) {
return $this->container->make('Indatus\Dispatcher\Drivers\\'.$this->getDriver().'\\Scheduler', [$this]);
}
... | [
"public",
"function",
"resolveSchedulerClass",
"(",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"$",
"this",
"->",
"getDriver",
"(",
")",
".",
"'\\\\Scheduler'",
",",
"[",
"$",
"this",
"]",
")",
";",
"}",
"catch",... | Resolve a class based on the driver configuration
@return \Indatus\Dispatcher\Scheduling\Schedulable | [
"Resolve",
"a",
"class",
"based",
"on",
"the",
"driver",
"configuration"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/ConfigResolver.php#L35-L42 |
Indatus/dispatcher | src/Indatus/Dispatcher/ConfigResolver.php | ConfigResolver.resolveServiceClass | public function resolveServiceClass()
{
try {
return $this->container->make($this->getDriver().'\\ScheduleService');
} catch (ReflectionException $e) {
return $this->container->make('Indatus\Dispatcher\Drivers\\'.$this->getDriver().'\\ScheduleService');
}
} | php | public function resolveServiceClass()
{
try {
return $this->container->make($this->getDriver().'\\ScheduleService');
} catch (ReflectionException $e) {
return $this->container->make('Indatus\Dispatcher\Drivers\\'.$this->getDriver().'\\ScheduleService');
}
} | [
"public",
"function",
"resolveServiceClass",
"(",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"$",
"this",
"->",
"getDriver",
"(",
")",
".",
"'\\\\ScheduleService'",
")",
";",
"}",
"catch",
"(",
"ReflectionException",
... | Resolve a class based on the driver configuration
@return \Indatus\Dispatcher\Scheduling\ScheduleService | [
"Resolve",
"a",
"class",
"based",
"on",
"the",
"driver",
"configuration"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/ConfigResolver.php#L49-L56 |
Indatus/dispatcher | src/Indatus/Dispatcher/ServiceProvider.php | ServiceProvider.boot | public function boot()
{
$this->package('indatus/dispatcher');
$resolver = $this->app->make('\Indatus\Dispatcher\ConfigResolver');
//load the scheduler of the appropriate driver
$this->app->bind('Indatus\Dispatcher\Scheduling\Schedulable', function () use ($resolver) {
... | php | public function boot()
{
$this->package('indatus/dispatcher');
$resolver = $this->app->make('\Indatus\Dispatcher\ConfigResolver');
//load the scheduler of the appropriate driver
$this->app->bind('Indatus\Dispatcher\Scheduling\Schedulable', function () use ($resolver) {
... | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"package",
"(",
"'indatus/dispatcher'",
")",
";",
"$",
"resolver",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"'\\Indatus\\Dispatcher\\ConfigResolver'",
")",
";",
"//load the scheduler of the... | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/ServiceProvider.php#L29-L44 |
Indatus/dispatcher | src/Indatus/Dispatcher/ServiceProvider.php | ServiceProvider.registerCommands | private function registerCommands()
{
//scheduled:summary
$this->app->bindShared('command.scheduled.summary', function (Application $app) {
return $app->make('Indatus\Dispatcher\Commands\ScheduleSummary');
});
//scheduled:make
$this->app->bindShared('command.sche... | php | private function registerCommands()
{
//scheduled:summary
$this->app->bindShared('command.scheduled.summary', function (Application $app) {
return $app->make('Indatus\Dispatcher\Commands\ScheduleSummary');
});
//scheduled:make
$this->app->bindShared('command.sche... | [
"private",
"function",
"registerCommands",
"(",
")",
"{",
"//scheduled:summary",
"$",
"this",
"->",
"app",
"->",
"bindShared",
"(",
"'command.scheduled.summary'",
",",
"function",
"(",
"Application",
"$",
"app",
")",
"{",
"return",
"$",
"app",
"->",
"make",
"(... | Register artisan commands
@codeCoverageIgnore | [
"Register",
"artisan",
"commands"
] | train | https://github.com/Indatus/dispatcher/blob/9548ab90d0c1e9a2ff7239f28e470de4493c00ff/src/Indatus/Dispatcher/ServiceProvider.php#L75-L93 |
lexik/LexikMaintenanceBundle | Command/DriverUnlockCommand.php | DriverUnlockCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
if (!$this->confirmUnlock($input, $output)) {
return;
}
$driver = $this->getContainer()->get('lexik_maintenance.driver.factory')->getDriver();
$unlockMessage = $driver->getMessageUnlock($driver... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
if (!$this->confirmUnlock($input, $output)) {
return;
}
$driver = $this->getContainer()->get('lexik_maintenance.driver.factory')->getDriver();
$unlockMessage = $driver->getMessageUnlock($driver... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirmUnlock",
"(",
"$",
"input",
",",
"$",
"output",
")",
")",
"{",
"return",
";",
"}",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Command/DriverUnlockCommand.php#L36-L47 |
lexik/LexikMaintenanceBundle | Command/DriverUnlockCommand.php | DriverUnlockCommand.askConfirmation | protected function askConfirmation($question, InputInterface $input, OutputInterface $output) {
if (!$this->getHelperSet()->has('question')) {
return $this->getHelper('dialog')
->askConfirmation($output, '<question>' . $question . '</question>', 'y');
}
return $this-... | php | protected function askConfirmation($question, InputInterface $input, OutputInterface $output) {
if (!$this->getHelperSet()->has('question')) {
return $this->getHelper('dialog')
->askConfirmation($output, '<question>' . $question . '</question>', 'y');
}
return $this-... | [
"protected",
"function",
"askConfirmation",
"(",
"$",
"question",
",",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getHelperSet",
"(",
")",
"->",
"has",
"(",
"'question'",
")",
")",
... | This method ensure that we stay compatible with symfony console 2.3 by using the deprecated dialog helper
but use the ConfirmationQuestion when available.
@param $question
@param InputInterface $input
@param OutputInterface $output
@return mixed | [
"This",
"method",
"ensure",
"that",
"we",
"stay",
"compatible",
"with",
"symfony",
"console",
"2",
".",
"3",
"by",
"using",
"the",
"deprecated",
"dialog",
"helper",
"but",
"use",
"the",
"ConfirmationQuestion",
"when",
"available",
"."
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Command/DriverUnlockCommand.php#L91-L99 |
lexik/LexikMaintenanceBundle | Drivers/DriverFactory.php | DriverFactory.getDriver | public function getDriver()
{
$class = $this->driverOptions['class'];
if (!class_exists($class)) {
throw new \ErrorException("Class '".$class."' not found in ".get_class($this));
}
if ($class === self::DATABASE_DRIVER) {
$driver = $this->dbDriver;
... | php | public function getDriver()
{
$class = $this->driverOptions['class'];
if (!class_exists($class)) {
throw new \ErrorException("Class '".$class."' not found in ".get_class($this));
}
if ($class === self::DATABASE_DRIVER) {
$driver = $this->dbDriver;
... | [
"public",
"function",
"getDriver",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"driverOptions",
"[",
"'class'",
"]",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"ErrorException",
"(",
"\"Class '... | Return the driver
@return mixed
@throws \ErrorException | [
"Return",
"the",
"driver"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/DriverFactory.php#L60-L78 |
lexik/LexikMaintenanceBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('lexik_maintenance');
$rootNode
->addDefaultsIfNotSet()
->children()
->arrayNode('authorized')
->addDefaultsIfNotSet()
... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('lexik_maintenance');
$rootNode
->addDefaultsIfNotSet()
->children()
->arrayNode('authorized')
->addDefaultsIfNotSet()
... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'lexik_maintenance'",
")",
";",
"$",
"rootNode",
"->",
"addDefaultsIfNotSet... | {@inheritDoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/DependencyInjection/Configuration.php#L21-L86 |
lexik/LexikMaintenanceBundle | Listener/MaintenanceListener.php | MaintenanceListener.onKernelRequest | public function onKernelRequest(GetResponseEvent $event)
{
if(!$event->isMasterRequest()){
return;
}
$request = $event->getRequest();
if (is_array($this->query)) {
foreach ($this->query as $key => $pattern) {
if (!empty($pattern) && preg_matc... | php | public function onKernelRequest(GetResponseEvent $event)
{
if(!$event->isMasterRequest()){
return;
}
$request = $event->getRequest();
if (is_array($this->query)) {
foreach ($this->query as $key => $pattern) {
if (!empty($pattern) && preg_matc... | [
"public",
"function",
"onKernelRequest",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";... | @param GetResponseEvent $event GetResponseEvent
@return void
@throws ServiceUnavailableException | [
"@param",
"GetResponseEvent",
"$event",
"GetResponseEvent"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Listener/MaintenanceListener.php#L152-L208 |
lexik/LexikMaintenanceBundle | Listener/MaintenanceListener.php | MaintenanceListener.onKernelResponse | public function onKernelResponse(FilterResponseEvent $event)
{
if ($this->handleResponse && $this->http_code !== null) {
$response = $event->getResponse();
$response->setStatusCode($this->http_code, $this->http_status);
}
} | php | public function onKernelResponse(FilterResponseEvent $event)
{
if ($this->handleResponse && $this->http_code !== null) {
$response = $event->getResponse();
$response->setStatusCode($this->http_code, $this->http_status);
}
} | [
"public",
"function",
"onKernelResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"handleResponse",
"&&",
"$",
"this",
"->",
"http_code",
"!==",
"null",
")",
"{",
"$",
"response",
"=",
"$",
"event",
"->",
"getRespo... | Rewrites the http code of the response
@param FilterResponseEvent $event FilterResponseEvent
@return void | [
"Rewrites",
"the",
"http",
"code",
"of",
"the",
"response"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Listener/MaintenanceListener.php#L216-L222 |
lexik/LexikMaintenanceBundle | Listener/MaintenanceListener.php | MaintenanceListener.checkIps | protected function checkIps($requestedIp, $ips)
{
$ips = (array) $ips;
$valid = false;
$i = 0;
while ($i<count($ips) && !$valid) {
$valid = IpUtils::checkIp($requestedIp, $ips[$i]);
$i++;
}
return $valid;
} | php | protected function checkIps($requestedIp, $ips)
{
$ips = (array) $ips;
$valid = false;
$i = 0;
while ($i<count($ips) && !$valid) {
$valid = IpUtils::checkIp($requestedIp, $ips[$i]);
$i++;
}
return $valid;
} | [
"protected",
"function",
"checkIps",
"(",
"$",
"requestedIp",
",",
"$",
"ips",
")",
"{",
"$",
"ips",
"=",
"(",
"array",
")",
"$",
"ips",
";",
"$",
"valid",
"=",
"false",
";",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"$",
"i",
"<",
"count",
"(",
... | Checks if the requested ip is valid.
@param string $requestedIp
@param string|array $ips
@return boolean | [
"Checks",
"if",
"the",
"requested",
"ip",
"is",
"valid",
"."
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Listener/MaintenanceListener.php#L231-L244 |
lexik/LexikMaintenanceBundle | Drivers/ShmDriver.php | ShmDriver.createLock | protected function createLock()
{
if ($this->shmId) {
return shm_put_var($this->shmId, self::VARIABLE_KEY, self::VALUE_TO_STORE);
}
return false;
} | php | protected function createLock()
{
if ($this->shmId) {
return shm_put_var($this->shmId, self::VARIABLE_KEY, self::VALUE_TO_STORE);
}
return false;
} | [
"protected",
"function",
"createLock",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shmId",
")",
"{",
"return",
"shm_put_var",
"(",
"$",
"this",
"->",
"shmId",
",",
"self",
"::",
"VARIABLE_KEY",
",",
"self",
"::",
"VALUE_TO_STORE",
")",
";",
"}",
"ret... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/ShmDriver.php#L73-L80 |
lexik/LexikMaintenanceBundle | Drivers/ShmDriver.php | ShmDriver.isExists | public function isExists()
{
if ($this->shmId) {
if (!shm_has_var($this->shmId, self::VARIABLE_KEY) ) {
return false;
}
$data = shm_get_var($this->shmId, self::VARIABLE_KEY);
return ($data == self::VALUE_TO_STORE);
}
return fal... | php | public function isExists()
{
if ($this->shmId) {
if (!shm_has_var($this->shmId, self::VARIABLE_KEY) ) {
return false;
}
$data = shm_get_var($this->shmId, self::VARIABLE_KEY);
return ($data == self::VALUE_TO_STORE);
}
return fal... | [
"public",
"function",
"isExists",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"shmId",
")",
"{",
"if",
"(",
"!",
"shm_has_var",
"(",
"$",
"this",
"->",
"shmId",
",",
"self",
"::",
"VARIABLE_KEY",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/ShmDriver.php#L97-L108 |
lexik/LexikMaintenanceBundle | DependencyInjection/LexikMaintenanceExtension.php | LexikMaintenanceExtension.registerDsnConfiguration | protected function registerDsnConfiguration($options)
{
if ( ! isset($options['table'])) {
throw new InvalidArgumentException('You need to define table for dsn use');
}
if ( ! isset($options['user'])) {
throw new InvalidArgumentException('You need to define user for ... | php | protected function registerDsnConfiguration($options)
{
if ( ! isset($options['table'])) {
throw new InvalidArgumentException('You need to define table for dsn use');
}
if ( ! isset($options['user'])) {
throw new InvalidArgumentException('You need to define user for ... | [
"protected",
"function",
"registerDsnConfiguration",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"[",
"'table'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'You need to define table for dsn use'",
")",
... | Load dsn configuration
@param array $options A configuration array
@throws InvalidArgumentException | [
"Load",
"dsn",
"configuration"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/DependencyInjection/LexikMaintenanceExtension.php#L62-L75 |
lexik/LexikMaintenanceBundle | Drivers/DatabaseDriver.php | DatabaseDriver.setOptions | public function setOptions($options)
{
$this->options = $options;
if (isset($this->options['dsn'])) {
$this->pdoDriver = new DsnQuery($this->options);
} else {
if (isset($this->options['connection'])) {
$this->pdoDriver = new DefaultQuery($this->doctr... | php | public function setOptions($options)
{
$this->options = $options;
if (isset($this->options['dsn'])) {
$this->pdoDriver = new DsnQuery($this->options);
} else {
if (isset($this->options['connection'])) {
$this->pdoDriver = new DefaultQuery($this->doctr... | [
"public",
"function",
"setOptions",
"(",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"options",
"=",
"$",
"options",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'dsn'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"pdoDriver",
"=",... | Set options from configuration
@param array $options Options | [
"Set",
"options",
"from",
"configuration"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/DatabaseDriver.php#L53-L66 |
lexik/LexikMaintenanceBundle | Drivers/DatabaseDriver.php | DatabaseDriver.createLock | protected function createLock()
{
$db = $this->pdoDriver->initDb();
try {
$ttl = null;
if (isset($this->options['ttl']) && $this->options['ttl'] !== 0) {
$now = new \Datetime('now');
$ttl = $this->options['ttl'];
$ttl = $now->m... | php | protected function createLock()
{
$db = $this->pdoDriver->initDb();
try {
$ttl = null;
if (isset($this->options['ttl']) && $this->options['ttl'] !== 0) {
$now = new \Datetime('now');
$ttl = $this->options['ttl'];
$ttl = $now->m... | [
"protected",
"function",
"createLock",
"(",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"pdoDriver",
"->",
"initDb",
"(",
")",
";",
"try",
"{",
"$",
"ttl",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'ttl'",
"]... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/DatabaseDriver.php#L71-L88 |
lexik/LexikMaintenanceBundle | Drivers/DatabaseDriver.php | DatabaseDriver.createUnlock | protected function createUnlock()
{
$db = $this->pdoDriver->initDb();
try {
$status = $this->pdoDriver->deleteQuery($db);
} catch (\Exception $e) {
$status = false;
}
return $status;
} | php | protected function createUnlock()
{
$db = $this->pdoDriver->initDb();
try {
$status = $this->pdoDriver->deleteQuery($db);
} catch (\Exception $e) {
$status = false;
}
return $status;
} | [
"protected",
"function",
"createUnlock",
"(",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"pdoDriver",
"->",
"initDb",
"(",
")",
";",
"try",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"pdoDriver",
"->",
"deleteQuery",
"(",
"$",
"db",
")",
";",
"}... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/DatabaseDriver.php#L93-L104 |
lexik/LexikMaintenanceBundle | Drivers/DatabaseDriver.php | DatabaseDriver.isExists | public function isExists()
{
$db = $this->pdoDriver->initDb();
$data = $this->pdoDriver->selectQuery($db);
if (!$data) {
return null;
}
if (null !== $data[0]['ttl']) {
$now = new \DateTime('now');
$ttl = new \DateTime($data[0]['ttl']);
... | php | public function isExists()
{
$db = $this->pdoDriver->initDb();
$data = $this->pdoDriver->selectQuery($db);
if (!$data) {
return null;
}
if (null !== $data[0]['ttl']) {
$now = new \DateTime('now');
$ttl = new \DateTime($data[0]['ttl']);
... | [
"public",
"function",
"isExists",
"(",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"pdoDriver",
"->",
"initDb",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"pdoDriver",
"->",
"selectQuery",
"(",
"$",
"db",
")",
";",
"if",
"(",
"!",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/DatabaseDriver.php#L109-L128 |
lexik/LexikMaintenanceBundle | Command/DriverLockCommand.php | DriverLockCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$driver = $this->getDriver();
if ($input->isInteractive()) {
if (!$this->askConfirmation('WARNING! Are you sure you wish to continue? (y/n)', $input, $output)) {
$output->writeln('<error>Mainten... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$driver = $this->getDriver();
if ($input->isInteractive()) {
if (!$this->askConfirmation('WARNING! Are you sure you wish to continue? (y/n)', $input, $output)) {
$output->writeln('<error>Mainten... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"driver",
"=",
"$",
"this",
"->",
"getDriver",
"(",
")",
";",
"if",
"(",
"$",
"input",
"->",
"isInteractive",
"(",
")",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Command/DriverLockCommand.php#L52-L73 |
lexik/LexikMaintenanceBundle | Command/DriverLockCommand.php | DriverLockCommand.interact | protected function interact(InputInterface $input, OutputInterface $output)
{
$driver = $this->getDriver();
$default = $driver->getOptions();
$formatter = $this->getHelperSet()->get('formatter');
if (null !== $input->getArgument('ttl') && !is_numeric($input->getArgument('ttl'))) {
... | php | protected function interact(InputInterface $input, OutputInterface $output)
{
$driver = $this->getDriver();
$default = $driver->getOptions();
$formatter = $this->getHelperSet()->get('formatter');
if (null !== $input->getArgument('ttl') && !is_numeric($input->getArgument('ttl'))) {
... | [
"protected",
"function",
"interact",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"driver",
"=",
"$",
"this",
"->",
"getDriver",
"(",
")",
";",
"$",
"default",
"=",
"$",
"driver",
"->",
"getOptions",
"(",
")"... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Command/DriverLockCommand.php#L78-L131 |
lexik/LexikMaintenanceBundle | Command/DriverLockCommand.php | DriverLockCommand.askAndValidate | protected function askAndValidate(InputInterface $input, OutputInterface $output, $question, $validator, $attempts = 1, $default = null) {
if (!$this->getHelperSet()->has('question')) {
return $this->getHelper('dialog')
->askAndValidate($output, $question, $validator, $attempts, $def... | php | protected function askAndValidate(InputInterface $input, OutputInterface $output, $question, $validator, $attempts = 1, $default = null) {
if (!$this->getHelperSet()->has('question')) {
return $this->getHelper('dialog')
->askAndValidate($output, $question, $validator, $attempts, $def... | [
"protected",
"function",
"askAndValidate",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"$",
"question",
",",
"$",
"validator",
",",
"$",
"attempts",
"=",
"1",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"!"... | This method ensure that we stay compatible with symfony console 2.3 by using the deprecated dialog helper
but use the ConfirmationQuestion when available.
@param InputInterface $input
@param OutputInterface $output
@param $question
@param $validator
@param int $attempts
@param null $default
@return mixed | [
"This",
"method",
"ensure",
"that",
"we",
"stay",
"compatible",
"with",
"symfony",
"console",
"2",
".",
"3",
"by",
"using",
"the",
"deprecated",
"dialog",
"helper",
"but",
"use",
"the",
"ConfirmationQuestion",
"when",
"available",
"."
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Command/DriverLockCommand.php#L174-L186 |
lexik/LexikMaintenanceBundle | Drivers/MemCacheDriver.php | MemCacheDriver.createLock | protected function createLock()
{
return $this->memcacheInstance->set($this->keyName, self::VALUE_TO_STORE, false, (isset($this->options['ttl']) ? $this->options['ttl'] : 0));
} | php | protected function createLock()
{
return $this->memcacheInstance->set($this->keyName, self::VALUE_TO_STORE, false, (isset($this->options['ttl']) ? $this->options['ttl'] : 0));
} | [
"protected",
"function",
"createLock",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"memcacheInstance",
"->",
"set",
"(",
"$",
"this",
"->",
"keyName",
",",
"self",
"::",
"VALUE_TO_STORE",
",",
"false",
",",
"(",
"isset",
"(",
"$",
"this",
"->",
"options"... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/MemCacheDriver.php#L69-L72 |
lexik/LexikMaintenanceBundle | Drivers/FileDriver.php | FileDriver.isExists | public function isExists()
{
if (file_exists($this->filePath)) {
if (isset($this->options['ttl']) && is_numeric($this->options['ttl'])) {
$this->isEndTime($this->options['ttl']);
}
return true;
} else {
return false;
}
} | php | public function isExists()
{
if (file_exists($this->filePath)) {
if (isset($this->options['ttl']) && is_numeric($this->options['ttl'])) {
$this->isEndTime($this->options['ttl']);
}
return true;
} else {
return false;
}
} | [
"public",
"function",
"isExists",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"filePath",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'ttl'",
"]",
")",
"&&",
"is_numeric",
"(",
"$",
"this",
"->",... | {@inheritDoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/FileDriver.php#L47-L57 |
lexik/LexikMaintenanceBundle | Drivers/FileDriver.php | FileDriver.isEndTime | public function isEndTime($timeTtl)
{
$now = new \DateTime('now');
$accessTime = date("Y-m-d H:i:s.", filemtime($this->filePath));
$accessTime = new \DateTime($accessTime);
$accessTime->modify(sprintf('+%s seconds', $timeTtl));
if ($accessTime < $now) {
return $t... | php | public function isEndTime($timeTtl)
{
$now = new \DateTime('now');
$accessTime = date("Y-m-d H:i:s.", filemtime($this->filePath));
$accessTime = new \DateTime($accessTime);
$accessTime->modify(sprintf('+%s seconds', $timeTtl));
if ($accessTime < $now) {
return $t... | [
"public",
"function",
"isEndTime",
"(",
"$",
"timeTtl",
")",
"{",
"$",
"now",
"=",
"new",
"\\",
"DateTime",
"(",
"'now'",
")",
";",
"$",
"accessTime",
"=",
"date",
"(",
"\"Y-m-d H:i:s.\"",
",",
"filemtime",
"(",
"$",
"this",
"->",
"filePath",
")",
")",... | Test if time to life is expired
@param integer $timeTtl The ttl value
@return boolean | [
"Test",
"if",
"time",
"to",
"life",
"is",
"expired"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/FileDriver.php#L66-L78 |
lexik/LexikMaintenanceBundle | Drivers/Query/PdoQuery.php | PdoQuery.prepareStatement | protected function prepareStatement($db, $query)
{
try {
$stmt = $db->prepare($query);
} catch (\Exception $e) {
$stmt = false;
}
if (false === $stmt) {
throw new \RuntimeException('The database cannot successfully prepare the statement');
... | php | protected function prepareStatement($db, $query)
{
try {
$stmt = $db->prepare($query);
} catch (\Exception $e) {
$stmt = false;
}
if (false === $stmt) {
throw new \RuntimeException('The database cannot successfully prepare the statement');
... | [
"protected",
"function",
"prepareStatement",
"(",
"$",
"db",
",",
"$",
"query",
")",
"{",
"try",
"{",
"$",
"stmt",
"=",
"$",
"db",
"->",
"prepare",
"(",
"$",
"query",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"stmt"... | PrepareStatement
@param \PDO $db PDO instance
@param string $query Query
@return Statement
@throws \RuntimeException | [
"PrepareStatement"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/Query/PdoQuery.php#L115-L128 |
lexik/LexikMaintenanceBundle | Drivers/Query/DefaultQuery.php | DefaultQuery.initDb | public function initDb()
{
if (null === $this->db) {
$db = $this->em->getConnection();
$this->db = $db;
$this->createTableQuery();
}
return $this->db;
} | php | public function initDb()
{
if (null === $this->db) {
$db = $this->em->getConnection();
$this->db = $db;
$this->createTableQuery();
}
return $this->db;
} | [
"public",
"function",
"initDb",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"db",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"em",
"->",
"getConnection",
"(",
")",
";",
"$",
"this",
"->",
"db",
"=",
"$",
"db",
";",
"$",
"thi... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/Query/DefaultQuery.php#L33-L42 |
lexik/LexikMaintenanceBundle | Drivers/Query/DefaultQuery.php | DefaultQuery.createTableQuery | public function createTableQuery()
{
$type = $this->em->getConnection()->getDatabasePlatform()->getName() != 'mysql' ? 'timestamp' : 'datetime';
$this->db->exec(
sprintf('CREATE TABLE IF NOT EXISTS %s (ttl %s DEFAULT NULL)', self::NAME_TABLE, $type)
);
} | php | public function createTableQuery()
{
$type = $this->em->getConnection()->getDatabasePlatform()->getName() != 'mysql' ? 'timestamp' : 'datetime';
$this->db->exec(
sprintf('CREATE TABLE IF NOT EXISTS %s (ttl %s DEFAULT NULL)', self::NAME_TABLE, $type)
);
} | [
"public",
"function",
"createTableQuery",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"em",
"->",
"getConnection",
"(",
")",
"->",
"getDatabasePlatform",
"(",
")",
"->",
"getName",
"(",
")",
"!=",
"'mysql'",
"?",
"'timestamp'",
":",
"'datetime'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/Query/DefaultQuery.php#L47-L54 |
lexik/LexikMaintenanceBundle | Drivers/Query/DefaultQuery.php | DefaultQuery.insertQuery | public function insertQuery($ttl, $db)
{
return $this->exec(
$db, sprintf('INSERT INTO %s (ttl) VALUES (:ttl)',
self::NAME_TABLE),
array(':ttl' => $ttl)
);
} | php | public function insertQuery($ttl, $db)
{
return $this->exec(
$db, sprintf('INSERT INTO %s (ttl) VALUES (:ttl)',
self::NAME_TABLE),
array(':ttl' => $ttl)
);
} | [
"public",
"function",
"insertQuery",
"(",
"$",
"ttl",
",",
"$",
"db",
")",
"{",
"return",
"$",
"this",
"->",
"exec",
"(",
"$",
"db",
",",
"sprintf",
"(",
"'INSERT INTO %s (ttl) VALUES (:ttl)'",
",",
"self",
"::",
"NAME_TABLE",
")",
",",
"array",
"(",
"':... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/Query/DefaultQuery.php#L75-L82 |
lexik/LexikMaintenanceBundle | Drivers/Query/DsnQuery.php | DsnQuery.initDb | public function initDb()
{
if (null === $this->db) {
if (!class_exists('PDO') || !in_array('mysql', \PDO::getAvailableDrivers(), true)) {
throw new \RuntimeException('You need to enable PDO_Mysql extension for the profiler to run properly.');
}
$db = new... | php | public function initDb()
{
if (null === $this->db) {
if (!class_exists('PDO') || !in_array('mysql', \PDO::getAvailableDrivers(), true)) {
throw new \RuntimeException('You need to enable PDO_Mysql extension for the profiler to run properly.');
}
$db = new... | [
"public",
"function",
"initDb",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"db",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'PDO'",
")",
"||",
"!",
"in_array",
"(",
"'mysql'",
",",
"\\",
"PDO",
"::",
"getAvailableDrivers",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/Query/DsnQuery.php#L18-L32 |
lexik/LexikMaintenanceBundle | Drivers/Query/DsnQuery.php | DsnQuery.createTableQuery | public function createTableQuery()
{
$type = $this->db->getAttribute(\PDO::ATTR_DRIVER_NAME) != 'mysql' ? 'timestamp' : 'datetime';
$this->db->exec(sprintf('CREATE TABLE IF NOT EXISTS %s (ttl %s DEFAULT NULL)', $this->options['table'], $type));
} | php | public function createTableQuery()
{
$type = $this->db->getAttribute(\PDO::ATTR_DRIVER_NAME) != 'mysql' ? 'timestamp' : 'datetime';
$this->db->exec(sprintf('CREATE TABLE IF NOT EXISTS %s (ttl %s DEFAULT NULL)', $this->options['table'], $type));
} | [
"public",
"function",
"createTableQuery",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"db",
"->",
"getAttribute",
"(",
"\\",
"PDO",
"::",
"ATTR_DRIVER_NAME",
")",
"!=",
"'mysql'",
"?",
"'timestamp'",
":",
"'datetime'",
";",
"$",
"this",
"->",
"db... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/Query/DsnQuery.php#L37-L42 |
lexik/LexikMaintenanceBundle | Drivers/Query/DsnQuery.php | DsnQuery.insertQuery | public function insertQuery($ttl, $db)
{
return $this->exec(
$db,
sprintf('INSERT INTO %s (ttl) VALUES (:ttl)',
$this->options['table']),
array(':ttl' => $ttl)
);
} | php | public function insertQuery($ttl, $db)
{
return $this->exec(
$db,
sprintf('INSERT INTO %s (ttl) VALUES (:ttl)',
$this->options['table']),
array(':ttl' => $ttl)
);
} | [
"public",
"function",
"insertQuery",
"(",
"$",
"ttl",
",",
"$",
"db",
")",
"{",
"return",
"$",
"this",
"->",
"exec",
"(",
"$",
"db",
",",
"sprintf",
"(",
"'INSERT INTO %s (ttl) VALUES (:ttl)'",
",",
"$",
"this",
"->",
"options",
"[",
"'table'",
"]",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/lexik/LexikMaintenanceBundle/blob/3a3e916776934a95834235e4a1d71e4595d515f5/Drivers/Query/DsnQuery.php#L63-L71 |
borisrepl/boris | lib/Boris/EvalWorker.php | EvalWorker.setLocal | public function setLocal($local, $value = null)
{
if (!is_array($local)) {
$local = array(
$local => $value
);
}
$this->_exports = array_merge($this->_exports, $local);
} | php | public function setLocal($local, $value = null)
{
if (!is_array($local)) {
$local = array(
$local => $value
);
}
$this->_exports = array_merge($this->_exports, $local);
} | [
"public",
"function",
"setLocal",
"(",
"$",
"local",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"local",
")",
")",
"{",
"$",
"local",
"=",
"array",
"(",
"$",
"local",
"=>",
"$",
"value",
")",
";",
"}",
"$",
... | Set local variables to be placed in the workers's scope.
@param array|string $local
@param mixed $value, if $local is a string | [
"Set",
"local",
"variables",
"to",
"be",
"placed",
"in",
"the",
"workers",
"s",
"scope",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/EvalWorker.php#L44-L53 |
borisrepl/boris | lib/Boris/EvalWorker.php | EvalWorker.start | public function start()
{
$__scope = $this->_runHooks($this->_startHooks);
extract($__scope);
$this->_write($this->_socket, self::READY);
/* Note the naming of the local variables due to shared scope with the user here */
for (;;) {
declare (tick... | php | public function start()
{
$__scope = $this->_runHooks($this->_startHooks);
extract($__scope);
$this->_write($this->_socket, self::READY);
/* Note the naming of the local variables due to shared scope with the user here */
for (;;) {
declare (tick... | [
"public",
"function",
"start",
"(",
")",
"{",
"$",
"__scope",
"=",
"$",
"this",
"->",
"_runHooks",
"(",
"$",
"this",
"->",
"_startHooks",
")",
";",
"extract",
"(",
"$",
"__scope",
")",
";",
"$",
"this",
"->",
"_write",
"(",
"$",
"this",
"->",
"_soc... | Start the worker.
This method never returns. | [
"Start",
"the",
"worker",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/EvalWorker.php#L90-L172 |
borisrepl/boris | lib/Boris/EvalWorker.php | EvalWorker.cancelOperation | public function cancelOperation()
{
printf("Cancelling...\n");
$this->_cancelled = true;
posix_kill($this->_pid, SIGKILL);
pcntl_signal_dispatch();
} | php | public function cancelOperation()
{
printf("Cancelling...\n");
$this->_cancelled = true;
posix_kill($this->_pid, SIGKILL);
pcntl_signal_dispatch();
} | [
"public",
"function",
"cancelOperation",
"(",
")",
"{",
"printf",
"(",
"\"Cancelling...\\n\"",
")",
";",
"$",
"this",
"->",
"_cancelled",
"=",
"true",
";",
"posix_kill",
"(",
"$",
"this",
"->",
"_pid",
",",
"SIGKILL",
")",
";",
"pcntl_signal_dispatch",
"(",
... | While a child process is running, terminate it immediately. | [
"While",
"a",
"child",
"process",
"is",
"running",
"terminate",
"it",
"immediately",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/EvalWorker.php#L177-L183 |
borisrepl/boris | lib/Boris/EvalWorker.php | EvalWorker._runHooks | private function _runHooks($hooks)
{
extract($this->_exports);
foreach ($hooks as $__hook) {
if (is_string($__hook)) {
eval($__hook);
} elseif (is_callable($__hook)) {
call_user_func($__hook, $this, get_defined_vars());
} e... | php | private function _runHooks($hooks)
{
extract($this->_exports);
foreach ($hooks as $__hook) {
if (is_string($__hook)) {
eval($__hook);
} elseif (is_callable($__hook)) {
call_user_func($__hook, $this, get_defined_vars());
} e... | [
"private",
"function",
"_runHooks",
"(",
"$",
"hooks",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"_exports",
")",
";",
"foreach",
"(",
"$",
"hooks",
"as",
"$",
"__hook",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"__hook",
")",
")",
"{",
"eval"... | -- Private Methods | [
"--",
"Private",
"Methods"
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/EvalWorker.php#L196-L214 |
borisrepl/boris | lib/Boris/ReadlineClient.php | ReadlineClient.start | public function start($prompt, $historyFile)
{
readline_read_history($historyFile);
declare (ticks = 1);
pcntl_signal(SIGCHLD, SIG_IGN);
pcntl_signal(SIGINT, array(
$this,
'clear'
), true);
// wait for the worker to finish exe... | php | public function start($prompt, $historyFile)
{
readline_read_history($historyFile);
declare (ticks = 1);
pcntl_signal(SIGCHLD, SIG_IGN);
pcntl_signal(SIGINT, array(
$this,
'clear'
), true);
// wait for the worker to finish exe... | [
"public",
"function",
"start",
"(",
"$",
"prompt",
",",
"$",
"historyFile",
")",
"{",
"readline_read_history",
"(",
"$",
"historyFile",
")",
";",
"declare",
"(",
"ticks",
"=",
"1",
")",
";",
"pcntl_signal",
"(",
"SIGCHLD",
",",
"SIG_IGN",
")",
";",
"pcnt... | Start the client with an prompt and readline history path.
This method never returns.
@param string $prompt
@param string $historyFile | [
"Start",
"the",
"client",
"with",
"an",
"prompt",
"and",
"readline",
"history",
"path",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/ReadlineClient.php#L35-L96 |
borisrepl/boris | lib/Boris/CLIOptionsHandler.php | CLIOptionsHandler.handle | public function handle($boris)
{
$args = getopt('hvr:', array(
'help',
'version',
'require:'
));
foreach ($args as $option => $value) {
switch ($option) {
/*
* Sets files to load at startup, may be used... | php | public function handle($boris)
{
$args = getopt('hvr:', array(
'help',
'version',
'require:'
));
foreach ($args as $option => $value) {
switch ($option) {
/*
* Sets files to load at startup, may be used... | [
"public",
"function",
"handle",
"(",
"$",
"boris",
")",
"{",
"$",
"args",
"=",
"getopt",
"(",
"'hvr:'",
",",
"array",
"(",
"'help'",
",",
"'version'",
",",
"'require:'",
")",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"option",
"=>",
"$",
"v... | Accept the REPL object and perform any setup necessary from the CLI flags.
@param Boris $boris | [
"Accept",
"the",
"REPL",
"object",
"and",
"perform",
"any",
"setup",
"necessary",
"from",
"the",
"CLI",
"flags",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/CLIOptionsHandler.php#L15-L51 |
borisrepl/boris | lib/Boris/CLIOptionsHandler.php | CLIOptionsHandler._handleRequire | private function _handleRequire($boris, $paths)
{
$require = array_reduce((array) $paths, function($acc, $v)
{
return array_merge($acc, explode(',', $v));
}, array());
$boris->onStart(function($worker, $scope) use ($require)
{
foreach ($requir... | php | private function _handleRequire($boris, $paths)
{
$require = array_reduce((array) $paths, function($acc, $v)
{
return array_merge($acc, explode(',', $v));
}, array());
$boris->onStart(function($worker, $scope) use ($require)
{
foreach ($requir... | [
"private",
"function",
"_handleRequire",
"(",
"$",
"boris",
",",
"$",
"paths",
")",
"{",
"$",
"require",
"=",
"array_reduce",
"(",
"(",
"array",
")",
"$",
"paths",
",",
"function",
"(",
"$",
"acc",
",",
"$",
"v",
")",
"{",
"return",
"array_merge",
"(... | -- Private Methods | [
"--",
"Private",
"Methods"
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/CLIOptionsHandler.php#L55-L70 |
borisrepl/boris | lib/Boris/Config.php | Config.apply | public function apply(Boris $boris)
{
$applied = false;
foreach ($this->_searchPaths as $path) {
if (is_readable($path)) {
$this->_loadInIsolation($path, $boris);
$applied = true;
$this->_files[] = $path;
if (!$thi... | php | public function apply(Boris $boris)
{
$applied = false;
foreach ($this->_searchPaths as $path) {
if (is_readable($path)) {
$this->_loadInIsolation($path, $boris);
$applied = true;
$this->_files[] = $path;
if (!$thi... | [
"public",
"function",
"apply",
"(",
"Boris",
"$",
"boris",
")",
"{",
"$",
"applied",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"_searchPaths",
"as",
"$",
"path",
")",
"{",
"if",
"(",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"$",
... | Searches for configuration files in the available
search paths, and applies them.
Returns true if any configuration files were found.
@param Boris\Boris $boris
@return bool | [
"Searches",
"for",
"configuration",
"files",
"in",
"the",
"available",
"search",
"paths",
"and",
"applies",
"them",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/Config.php#L50-L68 |
borisrepl/boris | lib/Boris/ShallowParser.php | ShallowParser.statements | public function statements($buffer)
{
$result = $this->_createResult($buffer);
while (strlen($result->buffer) > 0) {
$this->_resetResult($result);
if ($result->state == '<<<') {
if (!$this->_initializeHeredoc($result)) {
... | php | public function statements($buffer)
{
$result = $this->_createResult($buffer);
while (strlen($result->buffer) > 0) {
$this->_resetResult($result);
if ($result->state == '<<<') {
if (!$this->_initializeHeredoc($result)) {
... | [
"public",
"function",
"statements",
"(",
"$",
"buffer",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"_createResult",
"(",
"$",
"buffer",
")",
";",
"while",
"(",
"strlen",
"(",
"$",
"result",
"->",
"buffer",
")",
">",
"0",
")",
"{",
"$",
"this"... | Break the $buffer into chunks, with one for each highest-level construct possible.
If the buffer is incomplete, returns an empty array.
@param string $buffer
@return array | [
"Break",
"the",
"$buffer",
"into",
"chunks",
"with",
"one",
"for",
"each",
"highest",
"-",
"level",
"construct",
"possible",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/ShallowParser.php#L31-L69 |
borisrepl/boris | lib/Boris/ShallowParser.php | ShallowParser._createResult | private function _createResult($buffer)
{
$result = new \stdClass();
$result->buffer = $buffer;
$result->stmt = '';
$result->state = null;
$result->states = array();
$result->statements = array();
$result->stop = false;
... | php | private function _createResult($buffer)
{
$result = new \stdClass();
$result->buffer = $buffer;
$result->stmt = '';
$result->state = null;
$result->states = array();
$result->statements = array();
$result->stop = false;
... | [
"private",
"function",
"_createResult",
"(",
"$",
"buffer",
")",
"{",
"$",
"result",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"result",
"->",
"buffer",
"=",
"$",
"buffer",
";",
"$",
"result",
"->",
"stmt",
"=",
"''",
";",
"$",
"result",
"-... | -- Private Methods | [
"--",
"Private",
"Methods"
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/ShallowParser.php#L78-L89 |
borisrepl/boris | lib/Boris/Boris.php | Boris.start | public function start()
{
declare (ticks = 1);
pcntl_signal(SIGINT, SIG_IGN, true);
if (!$pipes = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP)) {
throw new \RuntimeException('Failed to create socket pair');
}
$pid = p... | php | public function start()
{
declare (ticks = 1);
pcntl_signal(SIGINT, SIG_IGN, true);
if (!$pipes = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP)) {
throw new \RuntimeException('Failed to create socket pair');
}
$pid = p... | [
"public",
"function",
"start",
"(",
")",
"{",
"declare",
"(",
"ticks",
"=",
"1",
")",
";",
"pcntl_signal",
"(",
"SIGINT",
",",
"SIG_IGN",
",",
"true",
")",
";",
"if",
"(",
"!",
"$",
"pipes",
"=",
"stream_socket_pair",
"(",
"STREAM_PF_UNIX",
",",
"STREA... | Start the REPL (display the readline prompt).
This method never returns. | [
"Start",
"the",
"REPL",
"(",
"display",
"the",
"readline",
"prompt",
")",
"."
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/Boris.php#L143-L177 |
borisrepl/boris | lib/Boris/ColoredInspector.php | ColoredInspector._dump | public function _dump($value)
{
$tests = array(
'is_null' => '_dumpNull',
'is_string' => '_dumpString',
'is_bool' => '_dumpBoolean',
'is_integer' => '_dumpInteger',
'is_float' => '_dumpFloat',
'is_array' => '_dumpArray',
'is... | php | public function _dump($value)
{
$tests = array(
'is_null' => '_dumpNull',
'is_string' => '_dumpString',
'is_bool' => '_dumpBoolean',
'is_integer' => '_dumpInteger',
'is_float' => '_dumpFloat',
'is_array' => '_dumpArray',
'is... | [
"public",
"function",
"_dump",
"(",
"$",
"value",
")",
"{",
"$",
"tests",
"=",
"array",
"(",
"'is_null'",
"=>",
"'_dumpNull'",
",",
"'is_string'",
"=>",
"'_dumpString'",
",",
"'is_bool'",
"=>",
"'_dumpBoolean'",
",",
"'is_integer'",
"=>",
"'_dumpInteger'",
","... | -- Private Methods | [
"--",
"Private",
"Methods"
] | train | https://github.com/borisrepl/boris/blob/793a5f196bc47b93ed95c5dcdacee52c7b3536fc/lib/Boris/ColoredInspector.php#L89-L110 |
InfyOmLabs/generator-builder | src/Commands/GeneratorBuilderRoutesPublisherCommand.php | GeneratorBuilderRoutesPublisherCommand.publishViews | public function publishViews()
{
$sourceDir = __DIR__ . "/../../views/";
$destinationDir = base_path('resources/views/infyom/generator-builder/');
if (file_exists($destinationDir)) {
$answer = $this->ask('Do you want to overwrite generator-builder? (y|N) :', false);
... | php | public function publishViews()
{
$sourceDir = __DIR__ . "/../../views/";
$destinationDir = base_path('resources/views/infyom/generator-builder/');
if (file_exists($destinationDir)) {
$answer = $this->ask('Do you want to overwrite generator-builder? (y|N) :', false);
... | [
"public",
"function",
"publishViews",
"(",
")",
"{",
"$",
"sourceDir",
"=",
"__DIR__",
".",
"\"/../../views/\"",
";",
"$",
"destinationDir",
"=",
"base_path",
"(",
"'resources/views/infyom/generator-builder/'",
")",
";",
"if",
"(",
"file_exists",
"(",
"$",
"destin... | Publishes views. | [
"Publishes",
"views",
"."
] | train | https://github.com/InfyOmLabs/generator-builder/blob/1a554fa57bfac0deff019cf7847fcdde162c7350/src/Commands/GeneratorBuilderRoutesPublisherCommand.php#L57-L76 |
Airmanbzh/php-html-generator | src/HtmlTag.php | HtmlTag.addClass | public function addClass($value)
{
if (!isset($this->attributeList['class']) || is_null($this->attributeList['class'])) {
$this->attributeList['class'] = array();
}
$this->attributeList['class'][] = $value;
return $this;
} | php | public function addClass($value)
{
if (!isset($this->attributeList['class']) || is_null($this->attributeList['class'])) {
$this->attributeList['class'] = array();
}
$this->attributeList['class'][] = $value;
return $this;
} | [
"public",
"function",
"addClass",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attributeList",
"[",
"'class'",
"]",
")",
"||",
"is_null",
"(",
"$",
"this",
"->",
"attributeList",
"[",
"'class'",
"]",
")",
")",
"{",
... | Add a class to classList
@param string $value
@return HtmlTag instance | [
"Add",
"a",
"class",
"to",
"classList"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/HtmlTag.php#L37-L44 |
Airmanbzh/php-html-generator | src/HtmlTag.php | HtmlTag.removeClass | public function removeClass($value)
{
if (!is_null($this->attributeList['class'])) {
unset($this->attributeList['class'][array_search($value, $this->attributeList['class'])]);
}
return $this;
} | php | public function removeClass($value)
{
if (!is_null($this->attributeList['class'])) {
unset($this->attributeList['class'][array_search($value, $this->attributeList['class'])]);
}
return $this;
} | [
"public",
"function",
"removeClass",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"attributeList",
"[",
"'class'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"attributeList",
"[",
"'class'",
"]",
"[",
"arr... | Remove a class from classList
@param string $value
@return HtmlTag instance | [
"Remove",
"a",
"class",
"from",
"classList"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/HtmlTag.php#L51-L57 |
Airmanbzh/php-html-generator | src/Markup.php | Markup.set | public function set($attribute, $value = null)
{
if (is_array($attribute)) {
foreach ($attribute as $key => $value) {
$this[$key] = $value;
}
} else {
$this[$attribute] = $value;
}
return $this;
} | php | public function set($attribute, $value = null)
{
if (is_array($attribute)) {
foreach ($attribute as $key => $value) {
$this[$key] = $value;
}
} else {
$this[$attribute] = $value;
}
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"attribute",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"attribute",
")",
")",
"{",
"foreach",
"(",
"$",
"attribute",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"thi... | (Re)Define an attribute or many attributes
@param string|array $attribute
@param string $value
@return static instance | [
"(",
"Re",
")",
"Define",
"an",
"attribute",
"or",
"many",
"attributes"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/Markup.php#L128-L138 |
Airmanbzh/php-html-generator | src/Markup.php | Markup.getPrevious | public function getPrevious()
{
$prev = $this;
$find = false;
if (!is_null($this->parent)) {
foreach ($this->parent->content as $c) {
if ($c === $this) {
$find=true;
break;
}
if (!$find) {
... | php | public function getPrevious()
{
$prev = $this;
$find = false;
if (!is_null($this->parent)) {
foreach ($this->parent->content as $c) {
if ($c === $this) {
$find=true;
break;
}
if (!$find) {
... | [
"public",
"function",
"getPrevious",
"(",
")",
"{",
"$",
"prev",
"=",
"$",
"this",
";",
"$",
"find",
"=",
"false",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"parent",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"parent",
"->",... | Return previous element or itself
@return static instance | [
"Return",
"previous",
"element",
"or",
"itself"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/Markup.php#L241-L257 |
Airmanbzh/php-html-generator | src/Markup.php | Markup.toString | public function toString()
{
$string = '';
if (!empty($this->tag)) {
$string .= '<' . $this->tag;
$string .= $this->attributesToString();
if ($this->autoclosed) {
$string .= '/>';
} else {
$string .= '>' . $this->conten... | php | public function toString()
{
$string = '';
if (!empty($this->tag)) {
$string .= '<' . $this->tag;
$string .= $this->attributesToString();
if ($this->autoclosed) {
$string .= '/>';
} else {
$string .= '>' . $this->conten... | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"string",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"tag",
")",
")",
"{",
"$",
"string",
".=",
"'<'",
".",
"$",
"this",
"->",
"tag",
";",
"$",
"string",
".=",
"$",
"... | Generation method
@return string | [
"Generation",
"method"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/Markup.php#L318-L334 |
Airmanbzh/php-html-generator | src/Markup.php | Markup.attributesToString | protected function attributesToString()
{
$string = '';
$XMLConvention = in_array(static::$outputLanguage, array(ENT_XML1, ENT_XHTML));
if (!empty($this->attributeList)) {
foreach ($this->attributeList as $key => $value) {
if ($value!==null && ($value!==false || $... | php | protected function attributesToString()
{
$string = '';
$XMLConvention = in_array(static::$outputLanguage, array(ENT_XML1, ENT_XHTML));
if (!empty($this->attributeList)) {
foreach ($this->attributeList as $key => $value) {
if ($value!==null && ($value!==false || $... | [
"protected",
"function",
"attributesToString",
"(",
")",
"{",
"$",
"string",
"=",
"''",
";",
"$",
"XMLConvention",
"=",
"in_array",
"(",
"static",
"::",
"$",
"outputLanguage",
",",
"array",
"(",
"ENT_XML1",
",",
"ENT_XHTML",
")",
")",
";",
"if",
"(",
"!"... | return current list of attribute as a string $key="$val" $key2="$val2"
@return string | [
"return",
"current",
"list",
"of",
"attribute",
"as",
"a",
"string",
"$key",
"=",
"$val",
"$key2",
"=",
"$val2"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/Markup.php#L340-L366 |
Airmanbzh/php-html-generator | src/Markup.php | Markup.contentToString | protected function contentToString()
{
$string = '';
if (!is_null($this->content)) {
foreach ($this->content as $c) {
$string .= $c->toString();
}
}
return $string;
} | php | protected function contentToString()
{
$string = '';
if (!is_null($this->content)) {
foreach ($this->content as $c) {
$string .= $c->toString();
}
}
return $string;
} | [
"protected",
"function",
"contentToString",
"(",
")",
"{",
"$",
"string",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"content",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"content",
"as",
"$",
"c",
")",
"{",
"$",
"s... | return current list of content as a string
@return string | [
"return",
"current",
"list",
"of",
"content",
"as",
"a",
"string"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/Markup.php#L372-L382 |
Airmanbzh/php-html-generator | src/Markup.php | Markup.unXSS | public static function unXSS($input)
{
$return = '';
if (version_compare(phpversion(), '5.4', '<')) {
$return = htmlspecialchars($input);
} else {
$return = htmlentities($input, ENT_QUOTES | ENT_DISALLOWED | static::$outputLanguage);
}
return $return;... | php | public static function unXSS($input)
{
$return = '';
if (version_compare(phpversion(), '5.4', '<')) {
$return = htmlspecialchars($input);
} else {
$return = htmlentities($input, ENT_QUOTES | ENT_DISALLOWED | static::$outputLanguage);
}
return $return;... | [
"public",
"static",
"function",
"unXSS",
"(",
"$",
"input",
")",
"{",
"$",
"return",
"=",
"''",
";",
"if",
"(",
"version_compare",
"(",
"phpversion",
"(",
")",
",",
"'5.4'",
",",
"'<'",
")",
")",
"{",
"$",
"return",
"=",
"htmlspecialchars",
"(",
"$",... | Protects value from XSS injection by replacing some characters by XML / HTML entities
@param string $input The unprotected value
@return string A safe string | [
"Protects",
"value",
"from",
"XSS",
"injection",
"by",
"replacing",
"some",
"characters",
"by",
"XML",
"/",
"HTML",
"entities"
] | train | https://github.com/Airmanbzh/php-html-generator/blob/6cb31f402db0732d39a30a2da631f33fa888db3d/src/Markup.php#L389-L399 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/Table.php | Table.getRow | public function getRow($index)
{
return isset($this->rows[$index]) ? $this->rows[$index] : null;
} | php | public function getRow($index)
{
return isset($this->rows[$index]) ? $this->rows[$index] : null;
} | [
"public",
"function",
"getRow",
"(",
"$",
"index",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"rows",
"[",
"$",
"index",
"]",
")",
"?",
"$",
"this",
"->",
"rows",
"[",
"$",
"index",
"]",
":",
"null",
";",
"}"
] | @param int $index
@return null|TableRow | [
"@param",
"int",
"$index"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/Table.php#L55-L58 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/Table.php | Table.getCellByPosition | public function getCellByPosition(TablePosition $position)
{
$row = $this->getRow($position->getRow());
return $row ? $row->getCell($position->getCell()) : null;
} | php | public function getCellByPosition(TablePosition $position)
{
$row = $this->getRow($position->getRow());
return $row ? $row->getCell($position->getCell()) : null;
} | [
"public",
"function",
"getCellByPosition",
"(",
"TablePosition",
"$",
"position",
")",
"{",
"$",
"row",
"=",
"$",
"this",
"->",
"getRow",
"(",
"$",
"position",
"->",
"getRow",
"(",
")",
")",
";",
"return",
"$",
"row",
"?",
"$",
"row",
"->",
"getCell",
... | @param TablePosition $position
@return null|TableCell | [
"@param",
"TablePosition",
"$position"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/Table.php#L78-L83 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/Table.php | Table.getPositionBefore | public function getPositionBefore(TablePosition $position, $offset = 1)
{
if ($position->getCell() > ($offset - 1)) {
$newRow = $position->getRow();
$newCell = $position->getCell() - $offset;
} elseif ($position->getRow() > 0) {
$cellsToMove = $offset;
... | php | public function getPositionBefore(TablePosition $position, $offset = 1)
{
if ($position->getCell() > ($offset - 1)) {
$newRow = $position->getRow();
$newCell = $position->getCell() - $offset;
} elseif ($position->getRow() > 0) {
$cellsToMove = $offset;
... | [
"public",
"function",
"getPositionBefore",
"(",
"TablePosition",
"$",
"position",
",",
"$",
"offset",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"position",
"->",
"getCell",
"(",
")",
">",
"(",
"$",
"offset",
"-",
"1",
")",
")",
"{",
"$",
"newRow",
"=",
"... | @param TablePosition $position
@param int $offset
@return TablePosition|null | [
"@param",
"TablePosition",
"$position",
"@param",
"int",
"$offset"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/Table.php#L91-L125 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/Table.php | Table.getPositionAfter | public function getPositionAfter(TablePosition $position, $offset = 1)
{
$cellsToMove = $offset;
$newRow = $position->getRow();
$newCell = $position->getCell();
while ($cellsToMove > 0 && $newRow < count($this->rows)) {
$cellCount = count($this->getRow($newRow)->getCells... | php | public function getPositionAfter(TablePosition $position, $offset = 1)
{
$cellsToMove = $offset;
$newRow = $position->getRow();
$newCell = $position->getCell();
while ($cellsToMove > 0 && $newRow < count($this->rows)) {
$cellCount = count($this->getRow($newRow)->getCells... | [
"public",
"function",
"getPositionAfter",
"(",
"TablePosition",
"$",
"position",
",",
"$",
"offset",
"=",
"1",
")",
"{",
"$",
"cellsToMove",
"=",
"$",
"offset",
";",
"$",
"newRow",
"=",
"$",
"position",
"->",
"getRow",
"(",
")",
";",
"$",
"newCell",
"=... | @param TablePosition $position
@param int $offset
@return TablePosition|null | [
"@param",
"TablePosition",
"$position",
"@param",
"int",
"$offset"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/Table.php#L133-L159 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/AbstractDiff.php | AbstractDiff.initPurifier | public function initPurifier($defaultPurifierSerializerCache = null)
{
if (null !== $this->purifierConfig) {
$HTMLPurifierConfig = $this->purifierConfig;
} else {
$HTMLPurifierConfig = \HTMLPurifier_Config::createDefault();
}
// Cache.SerializerPath defaults... | php | public function initPurifier($defaultPurifierSerializerCache = null)
{
if (null !== $this->purifierConfig) {
$HTMLPurifierConfig = $this->purifierConfig;
} else {
$HTMLPurifierConfig = \HTMLPurifier_Config::createDefault();
}
// Cache.SerializerPath defaults... | [
"public",
"function",
"initPurifier",
"(",
"$",
"defaultPurifierSerializerCache",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"purifierConfig",
")",
"{",
"$",
"HTMLPurifierConfig",
"=",
"$",
"this",
"->",
"purifierConfig",
";",
"}",
"... | Initializes HTMLPurifier with cache location.
@param null|string $defaultPurifierSerializerCache | [
"Initializes",
"HTMLPurifier",
"with",
"cache",
"location",
"."
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/AbstractDiff.php#L127-L148 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/AbstractDiff.php | AbstractDiff.prepare | protected function prepare()
{
$this->initPurifier($this->config->getPurifierCacheLocation());
$this->oldText = $this->purifyHtml($this->oldText);
$this->newText = $this->purifyHtml($this->newText);
} | php | protected function prepare()
{
$this->initPurifier($this->config->getPurifierCacheLocation());
$this->oldText = $this->purifyHtml($this->oldText);
$this->newText = $this->purifyHtml($this->newText);
} | [
"protected",
"function",
"prepare",
"(",
")",
"{",
"$",
"this",
"->",
"initPurifier",
"(",
"$",
"this",
"->",
"config",
"->",
"getPurifierCacheLocation",
"(",
")",
")",
";",
"$",
"this",
"->",
"oldText",
"=",
"$",
"this",
"->",
"purifyHtml",
"(",
"$",
... | Prepare (purify) the HTML
@return void | [
"Prepare",
"(",
"purify",
")",
"the",
"HTML"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/AbstractDiff.php#L155-L161 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/AbstractDiff.php | AbstractDiff.convertHtmlToListOfWords | protected function convertHtmlToListOfWords($characterString)
{
$mode = 'character';
$current_word = '';
$words = array();
$keepNewLines = $this->getConfig()->isKeepNewLines();
foreach ($characterString as $i => $character) {
switch ($mode) {
case ... | php | protected function convertHtmlToListOfWords($characterString)
{
$mode = 'character';
$current_word = '';
$words = array();
$keepNewLines = $this->getConfig()->isKeepNewLines();
foreach ($characterString as $i => $character) {
switch ($mode) {
case ... | [
"protected",
"function",
"convertHtmlToListOfWords",
"(",
"$",
"characterString",
")",
"{",
"$",
"mode",
"=",
"'character'",
";",
"$",
"current_word",
"=",
"''",
";",
"$",
"words",
"=",
"array",
"(",
")",
";",
"$",
"keepNewLines",
"=",
"$",
"this",
"->",
... | @param array $characterString
@return array | [
"@param",
"array",
"$characterString"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/AbstractDiff.php#L448-L524 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TablePosition.php | TablePosition.compare | public static function compare($a, $b)
{
if ($a->getRow() == $b->getRow()) {
return $a->getCell() - $b->getCell();
}
return $a->getRow() - $b->getRow();
} | php | public static function compare($a, $b)
{
if ($a->getRow() == $b->getRow()) {
return $a->getCell() - $b->getCell();
}
return $a->getRow() - $b->getRow();
} | [
"public",
"static",
"function",
"compare",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getRow",
"(",
")",
"==",
"$",
"b",
"->",
"getRow",
"(",
")",
")",
"{",
"return",
"$",
"a",
"->",
"getCell",
"(",
")",
"-",
"$",
"... | @param TablePosition $a
@param TablePosition $b
@return int | [
"@param",
"TablePosition",
"$a",
"@param",
"TablePosition",
"$b"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TablePosition.php#L61-L68 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableRow.php | TableRow.setTable | public function setTable(Table $table = null)
{
$this->table = $table;
if ($table && !in_array($this, $table->getRows())) {
$table->addRow($this);
}
return $this;
} | php | public function setTable(Table $table = null)
{
$this->table = $table;
if ($table && !in_array($this, $table->getRows())) {
$table->addRow($this);
}
return $this;
} | [
"public",
"function",
"setTable",
"(",
"Table",
"$",
"table",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"table",
"=",
"$",
"table",
";",
"if",
"(",
"$",
"table",
"&&",
"!",
"in_array",
"(",
"$",
"this",
",",
"$",
"table",
"->",
"getRows",
"(",
")... | @param Table|null $table
@return $this | [
"@param",
"Table|null",
"$table"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableRow.php#L33-L42 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableRow.php | TableRow.addCell | public function addCell(TableCell $cell)
{
$this->cells[] = $cell;
if (!$cell->getRow()) {
$cell->setRow($this);
}
return $this;
} | php | public function addCell(TableCell $cell)
{
$this->cells[] = $cell;
if (!$cell->getRow()) {
$cell->setRow($this);
}
return $this;
} | [
"public",
"function",
"addCell",
"(",
"TableCell",
"$",
"cell",
")",
"{",
"$",
"this",
"->",
"cells",
"[",
"]",
"=",
"$",
"cell",
";",
"if",
"(",
"!",
"$",
"cell",
"->",
"getRow",
"(",
")",
")",
"{",
"$",
"cell",
"->",
"setRow",
"(",
"$",
"this... | @param TableCell $cell
@return $this | [
"@param",
"TableCell",
"$cell"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableRow.php#L57-L66 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableRow.php | TableRow.getCell | public function getCell($index)
{
return isset($this->cells[$index]) ? $this->cells[$index] : null;
} | php | public function getCell($index)
{
return isset($this->cells[$index]) ? $this->cells[$index] : null;
} | [
"public",
"function",
"getCell",
"(",
"$",
"index",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"cells",
"[",
"$",
"index",
"]",
")",
"?",
"$",
"this",
"->",
"cells",
"[",
"$",
"index",
"]",
":",
"null",
";",
"}"
] | @param int $index
@return TableCell|null | [
"@param",
"int",
"$index"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableRow.php#L88-L91 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/ListDiff.php | ListDiff.create | public static function create($oldText, $newText, HtmlDiffConfig $config = null)
{
$diff = new self($oldText, $newText);
if (null !== $config) {
$diff->setConfig($config);
}
return $diff;
} | php | public static function create($oldText, $newText, HtmlDiffConfig $config = null)
{
$diff = new self($oldText, $newText);
if (null !== $config) {
$diff->setConfig($config);
}
return $diff;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"oldText",
",",
"$",
"newText",
",",
"HtmlDiffConfig",
"$",
"config",
"=",
"null",
")",
"{",
"$",
"diff",
"=",
"new",
"self",
"(",
"$",
"oldText",
",",
"$",
"newText",
")",
";",
"if",
"(",
"null",
... | @param string $oldText
@param string $newText
@param HtmlDiffConfig|null $config
@return ListDiff | [
"@param",
"string",
"$oldText",
"@param",
"string",
"$newText",
"@param",
"HtmlDiffConfig|null",
"$config"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiff.php#L19-L28 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/ListDiff.php | ListDiff.hasBetterMatch | protected function hasBetterMatch(array $matchData, $currentIndex)
{
$matchPercentage = $matchData[$currentIndex];
foreach ($matchData as $index => $percentage) {
if ($index > $currentIndex &&
$percentage > $matchPercentage &&
$percentage > $this->config->... | php | protected function hasBetterMatch(array $matchData, $currentIndex)
{
$matchPercentage = $matchData[$currentIndex];
foreach ($matchData as $index => $percentage) {
if ($index > $currentIndex &&
$percentage > $matchPercentage &&
$percentage > $this->config->... | [
"protected",
"function",
"hasBetterMatch",
"(",
"array",
"$",
"matchData",
",",
"$",
"currentIndex",
")",
"{",
"$",
"matchPercentage",
"=",
"$",
"matchData",
"[",
"$",
"currentIndex",
"]",
";",
"foreach",
"(",
"$",
"matchData",
"as",
"$",
"index",
"=>",
"$... | @param array $matchData
@param int $currentIndex
@return bool | [
"@param",
"array",
"$matchData",
"@param",
"int",
"$currentIndex"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/ListDiff.php#L198-L211 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.createIsolatedDiffTagPlaceholders | protected function createIsolatedDiffTagPlaceholders(&$words)
{
$openIsolatedDiffTags = 0;
$isolatedDiffTagIndices = array();
$isolatedDiffTagStart = 0;
$currentIsolatedDiffTag = null;
foreach ($words as $index => $word) {
$openIsolatedDiffTag = $this->isOpeningIs... | php | protected function createIsolatedDiffTagPlaceholders(&$words)
{
$openIsolatedDiffTags = 0;
$isolatedDiffTagIndices = array();
$isolatedDiffTagStart = 0;
$currentIsolatedDiffTag = null;
foreach ($words as $index => $word) {
$openIsolatedDiffTag = $this->isOpeningIs... | [
"protected",
"function",
"createIsolatedDiffTagPlaceholders",
"(",
"&",
"$",
"words",
")",
"{",
"$",
"openIsolatedDiffTags",
"=",
"0",
";",
"$",
"isolatedDiffTagIndices",
"=",
"array",
"(",
")",
";",
"$",
"isolatedDiffTagStart",
"=",
"0",
";",
"$",
"currentIsola... | @param array $words
@return array | [
"@param",
"array",
"$words"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L152-L195 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.isOpeningIsolatedDiffTag | protected function isOpeningIsolatedDiffTag($item, $currentIsolatedDiffTag = null)
{
$tagsToMatch = $currentIsolatedDiffTag !== null
? array($currentIsolatedDiffTag => $this->config->getIsolatedDiffTagPlaceholder($currentIsolatedDiffTag))
: $this->config->getIsolatedDiffTags();
... | php | protected function isOpeningIsolatedDiffTag($item, $currentIsolatedDiffTag = null)
{
$tagsToMatch = $currentIsolatedDiffTag !== null
? array($currentIsolatedDiffTag => $this->config->getIsolatedDiffTagPlaceholder($currentIsolatedDiffTag))
: $this->config->getIsolatedDiffTags();
... | [
"protected",
"function",
"isOpeningIsolatedDiffTag",
"(",
"$",
"item",
",",
"$",
"currentIsolatedDiffTag",
"=",
"null",
")",
"{",
"$",
"tagsToMatch",
"=",
"$",
"currentIsolatedDiffTag",
"!==",
"null",
"?",
"array",
"(",
"$",
"currentIsolatedDiffTag",
"=>",
"$",
... | @param string $item
@param null|string $currentIsolatedDiffTag
@return false|string | [
"@param",
"string",
"$item",
"@param",
"null|string",
"$currentIsolatedDiffTag"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L203-L216 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.diffIsolatedPlaceholder | protected function diffIsolatedPlaceholder($operation, $pos, $placeholder, $stripWrappingTags = true)
{
$oldText = implode('', $this->findIsolatedDiffTagsInOld($operation, $pos));
$newText = implode('', $this->newIsolatedDiffTags[$pos]);
if ($this->isListPlaceholder($placeholder)) {
... | php | protected function diffIsolatedPlaceholder($operation, $pos, $placeholder, $stripWrappingTags = true)
{
$oldText = implode('', $this->findIsolatedDiffTagsInOld($operation, $pos));
$newText = implode('', $this->newIsolatedDiffTags[$pos]);
if ($this->isListPlaceholder($placeholder)) {
... | [
"protected",
"function",
"diffIsolatedPlaceholder",
"(",
"$",
"operation",
",",
"$",
"pos",
",",
"$",
"placeholder",
",",
"$",
"stripWrappingTags",
"=",
"true",
")",
"{",
"$",
"oldText",
"=",
"implode",
"(",
"''",
",",
"$",
"this",
"->",
"findIsolatedDiffTag... | @param Operation $operation
@param int $pos
@param string $placeholder
@param bool $stripWrappingTags
@return string | [
"@param",
"Operation",
"$operation",
"@param",
"int",
"$pos",
"@param",
"string",
"$placeholder",
"@param",
"bool",
"$stripWrappingTags"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L326-L342 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.diffElements | protected function diffElements($oldText, $newText, $stripWrappingTags = true)
{
$wrapStart = '';
$wrapEnd = '';
if ($stripWrappingTags) {
$pattern = '/(^<[^>]+>)|(<\/[^>]+>$)/iu';
$matches = array();
if (preg_match_all($pattern, $newText, $matches)) {
... | php | protected function diffElements($oldText, $newText, $stripWrappingTags = true)
{
$wrapStart = '';
$wrapEnd = '';
if ($stripWrappingTags) {
$pattern = '/(^<[^>]+>)|(<\/[^>]+>$)/iu';
$matches = array();
if (preg_match_all($pattern, $newText, $matches)) {
... | [
"protected",
"function",
"diffElements",
"(",
"$",
"oldText",
",",
"$",
"newText",
",",
"$",
"stripWrappingTags",
"=",
"true",
")",
"{",
"$",
"wrapStart",
"=",
"''",
";",
"$",
"wrapEnd",
"=",
"''",
";",
"if",
"(",
"$",
"stripWrappingTags",
")",
"{",
"$... | @param string $oldText
@param string $newText
@param bool $stripWrappingTags
@return string | [
"@param",
"string",
"$oldText",
"@param",
"string",
"$newText",
"@param",
"bool",
"$stripWrappingTags"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L351-L371 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.diffList | protected function diffList($oldText, $newText)
{
$diff = ListDiffLines::create($oldText, $newText, $this->config);
return $diff->build();
} | php | protected function diffList($oldText, $newText)
{
$diff = ListDiffLines::create($oldText, $newText, $this->config);
return $diff->build();
} | [
"protected",
"function",
"diffList",
"(",
"$",
"oldText",
",",
"$",
"newText",
")",
"{",
"$",
"diff",
"=",
"ListDiffLines",
"::",
"create",
"(",
"$",
"oldText",
",",
"$",
"newText",
",",
"$",
"this",
"->",
"config",
")",
";",
"return",
"$",
"diff",
"... | @param string $oldText
@param string $newText
@return string | [
"@param",
"string",
"$oldText",
"@param",
"string",
"$newText"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L379-L384 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.diffTables | protected function diffTables($oldText, $newText)
{
$diff = TableDiff::create($oldText, $newText, $this->config);
return $diff->build();
} | php | protected function diffTables($oldText, $newText)
{
$diff = TableDiff::create($oldText, $newText, $this->config);
return $diff->build();
} | [
"protected",
"function",
"diffTables",
"(",
"$",
"oldText",
",",
"$",
"newText",
")",
"{",
"$",
"diff",
"=",
"TableDiff",
"::",
"create",
"(",
"$",
"oldText",
",",
"$",
"newText",
",",
"$",
"this",
"->",
"config",
")",
";",
"return",
"$",
"diff",
"->... | @param string $oldText
@param string $newText
@return string | [
"@param",
"string",
"$oldText",
"@param",
"string",
"$newText"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L392-L397 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.getAttributeFromTag | protected function getAttributeFromTag($text, $attribute)
{
$matches = array();
if (preg_match(sprintf('/<[^>]*\b%s\s*=\s*([\'"])(.*)\1[^>]*>/iu', $attribute), $text, $matches)) {
return htmlspecialchars_decode($matches[2]);
}
return;
} | php | protected function getAttributeFromTag($text, $attribute)
{
$matches = array();
if (preg_match(sprintf('/<[^>]*\b%s\s*=\s*([\'"])(.*)\1[^>]*>/iu', $attribute), $text, $matches)) {
return htmlspecialchars_decode($matches[2]);
}
return;
} | [
"protected",
"function",
"getAttributeFromTag",
"(",
"$",
"text",
",",
"$",
"attribute",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"if",
"(",
"preg_match",
"(",
"sprintf",
"(",
"'/<[^>]*\\b%s\\s*=\\s*([\\'\"])(.*)\\1[^>]*>/iu'",
",",
"$",
"attribute... | @param string $text
@param string $attribute
@return null|string | [
"@param",
"string",
"$text",
"@param",
"string",
"$attribute"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L441-L449 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.isPlaceholderType | protected function isPlaceholderType($text, $types, $strict = true)
{
if (!is_array($types)) {
$types = array($types);
}
$criteria = array();
foreach ($types as $type) {
if ($this->config->isIsolatedDiffTag($type)) {
$criteria[] = $this->confi... | php | protected function isPlaceholderType($text, $types, $strict = true)
{
if (!is_array($types)) {
$types = array($types);
}
$criteria = array();
foreach ($types as $type) {
if ($this->config->isIsolatedDiffTag($type)) {
$criteria[] = $this->confi... | [
"protected",
"function",
"isPlaceholderType",
"(",
"$",
"text",
",",
"$",
"types",
",",
"$",
"strict",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"types",
")",
")",
"{",
"$",
"types",
"=",
"array",
"(",
"$",
"types",
")",
";",
"... | @param string $text
@param array|string $types
@param bool $strict
@return bool | [
"@param",
"string",
"$text",
"@param",
"array|string",
"$types",
"@param",
"bool",
"$strict"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L488-L504 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.findIsolatedDiffTagsInOld | protected function findIsolatedDiffTagsInOld($operation, $posInNew)
{
$offset = $posInNew - $operation->startInNew;
return $this->oldIsolatedDiffTags[$operation->startInOld + $offset];
} | php | protected function findIsolatedDiffTagsInOld($operation, $posInNew)
{
$offset = $posInNew - $operation->startInNew;
return $this->oldIsolatedDiffTags[$operation->startInOld + $offset];
} | [
"protected",
"function",
"findIsolatedDiffTagsInOld",
"(",
"$",
"operation",
",",
"$",
"posInNew",
")",
"{",
"$",
"offset",
"=",
"$",
"posInNew",
"-",
"$",
"operation",
"->",
"startInNew",
";",
"return",
"$",
"this",
"->",
"oldIsolatedDiffTags",
"[",
"$",
"o... | @param Operation $operation
@param int $posInNew
@return array | [
"@param",
"Operation",
"$operation",
"@param",
"int",
"$posInNew"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L522-L527 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.checkCondition | protected function checkCondition($word, $condition)
{
return $condition == 'tag' ? $this->isTag($word) : !$this->isTag($word);
} | php | protected function checkCondition($word, $condition)
{
return $condition == 'tag' ? $this->isTag($word) : !$this->isTag($word);
} | [
"protected",
"function",
"checkCondition",
"(",
"$",
"word",
",",
"$",
"condition",
")",
"{",
"return",
"$",
"condition",
"==",
"'tag'",
"?",
"$",
"this",
"->",
"isTag",
"(",
"$",
"word",
")",
":",
"!",
"$",
"this",
"->",
"isTag",
"(",
"$",
"word",
... | @param string $word
@param string $condition
@return bool | [
"@param",
"string",
"$word",
"@param",
"string",
"$condition"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L601-L604 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.stripTagAttributes | protected function stripTagAttributes($word)
{
$space = $this->stringUtil->strpos($word, ' ', 1);
if ($space) {
return '<' . $this->stringUtil->substr($word, 1, $space) . '>';
}
return trim($word, '<>');
} | php | protected function stripTagAttributes($word)
{
$space = $this->stringUtil->strpos($word, ' ', 1);
if ($space) {
return '<' . $this->stringUtil->substr($word, 1, $space) . '>';
}
return trim($word, '<>');
} | [
"protected",
"function",
"stripTagAttributes",
"(",
"$",
"word",
")",
"{",
"$",
"space",
"=",
"$",
"this",
"->",
"stringUtil",
"->",
"strpos",
"(",
"$",
"word",
",",
"' '",
",",
"1",
")",
";",
"if",
"(",
"$",
"space",
")",
"{",
"return",
"'<'",
"."... | @param string $word
@return string | [
"@param",
"string",
"$word"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L770-L779 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.findMatch | protected function findMatch($startInOld, $endInOld, $startInNew, $endInNew)
{
$groupDiffs = $this->isGroupDiffs();
$bestMatchInOld = $startInOld;
$bestMatchInNew = $startInNew;
$bestMatchSize = 0;
$matchLengthAt = array();
for ($indexInOld = $startInOld; $indexI... | php | protected function findMatch($startInOld, $endInOld, $startInNew, $endInNew)
{
$groupDiffs = $this->isGroupDiffs();
$bestMatchInOld = $startInOld;
$bestMatchInNew = $startInNew;
$bestMatchSize = 0;
$matchLengthAt = array();
for ($indexInOld = $startInOld; $indexI... | [
"protected",
"function",
"findMatch",
"(",
"$",
"startInOld",
",",
"$",
"endInOld",
",",
"$",
"startInNew",
",",
"$",
"endInNew",
")",
"{",
"$",
"groupDiffs",
"=",
"$",
"this",
"->",
"isGroupDiffs",
"(",
")",
";",
"$",
"bestMatchInOld",
"=",
"$",
"startI... | @param int $startInOld
@param int $endInOld
@param int $startInNew
@param int $endInNew
@return Match|null | [
"@param",
"int",
"$startInOld",
"@param",
"int",
"$endInOld",
"@param",
"int",
"$startInNew",
"@param",
"int",
"$endInNew"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L789-L844 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/HtmlDiff.php | HtmlDiff.array_slice_cached | protected function array_slice_cached(&$array, $offset, $length = null)
{
static $lastOffset = null;
static $lastLength = null;
static $cache = null;
// PHP has no support for by-reference comparing.
// to prevent false positive hits, reset the cache when the oldWords o... | php | protected function array_slice_cached(&$array, $offset, $length = null)
{
static $lastOffset = null;
static $lastLength = null;
static $cache = null;
// PHP has no support for by-reference comparing.
// to prevent false positive hits, reset the cache when the oldWords o... | [
"protected",
"function",
"array_slice_cached",
"(",
"&",
"$",
"array",
",",
"$",
"offset",
",",
"$",
"length",
"=",
"null",
")",
"{",
"static",
"$",
"lastOffset",
"=",
"null",
";",
"static",
"$",
"lastLength",
"=",
"null",
";",
"static",
"$",
"cache",
... | Special array_slice function that caches its last request.
The diff algorithm seems to request the same information many times in a row.
by returning the previous answer the algorithm preforms way faster.
The result is a string instead of an array, this way we safe on the amount of
memory intensive implode() calls.
... | [
"Special",
"array_slice",
"function",
"that",
"caches",
"its",
"last",
"request",
"."
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/HtmlDiff.php#L872-L900 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/AbstractTableElement.php | AbstractTableElement.cloneNode | public function cloneNode(\DOMDocument $domDocument)
{
return $domDocument->importNode($this->getDomNode()->cloneNode(false), false);
} | php | public function cloneNode(\DOMDocument $domDocument)
{
return $domDocument->importNode($this->getDomNode()->cloneNode(false), false);
} | [
"public",
"function",
"cloneNode",
"(",
"\\",
"DOMDocument",
"$",
"domDocument",
")",
"{",
"return",
"$",
"domDocument",
"->",
"importNode",
"(",
"$",
"this",
"->",
"getDomNode",
"(",
")",
"->",
"cloneNode",
"(",
"false",
")",
",",
"false",
")",
";",
"}"... | @param \DOMDocument $domDocument
@return \DOMElement | [
"@param",
"\\",
"DOMDocument",
"$domDocument"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/AbstractTableElement.php#L76-L79 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableCell.php | TableCell.setRow | public function setRow(TableRow $row = null)
{
$this->row = $row;
if (null !== $row && !in_array($this, $row->getCells())) {
$row->addCell($this);
}
return $this;
} | php | public function setRow(TableRow $row = null)
{
$this->row = $row;
if (null !== $row && !in_array($this, $row->getCells())) {
$row->addCell($this);
}
return $this;
} | [
"public",
"function",
"setRow",
"(",
"TableRow",
"$",
"row",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"row",
"=",
"$",
"row",
";",
"if",
"(",
"null",
"!==",
"$",
"row",
"&&",
"!",
"in_array",
"(",
"$",
"this",
",",
"$",
"row",
"->",
"getCells",
... | @param TableRow|null $row
@return $this | [
"@param",
"TableRow|null",
"$row"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableCell.php#L28-L37 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableDiff.php | TableDiff.getRowMatches | protected function getRowMatches($oldMatchData, $newMatchData)
{
$matches = array();
$startInOld = 0;
$startInNew = 0;
$endInOld = count($oldMatchData);
$endInNew = count($newMatchData);
$this->findRowMatches($newMatchData, $startInOld, $endInOld, $startInNew, $endI... | php | protected function getRowMatches($oldMatchData, $newMatchData)
{
$matches = array();
$startInOld = 0;
$startInNew = 0;
$endInOld = count($oldMatchData);
$endInNew = count($newMatchData);
$this->findRowMatches($newMatchData, $startInOld, $endInOld, $startInNew, $endI... | [
"protected",
"function",
"getRowMatches",
"(",
"$",
"oldMatchData",
",",
"$",
"newMatchData",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"$",
"startInOld",
"=",
"0",
";",
"$",
"startInNew",
"=",
"0",
";",
"$",
"endInOld",
"=",
"count",
"(",... | @param array $oldMatchData
@param array $newMatchData
@return array | [
"@param",
"array",
"$oldMatchData",
"@param",
"array",
"$newMatchData"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L308-L320 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableDiff.php | TableDiff.findRowMatch | protected function findRowMatch($newMatchData, $startInOld, $endInOld, $startInNew, $endInNew)
{
$bestMatch = null;
$bestPercentage = 0;
foreach ($newMatchData as $newIndex => $oldMatches) {
if ($newIndex < $startInNew) {
continue;
}
if (... | php | protected function findRowMatch($newMatchData, $startInOld, $endInOld, $startInNew, $endInNew)
{
$bestMatch = null;
$bestPercentage = 0;
foreach ($newMatchData as $newIndex => $oldMatches) {
if ($newIndex < $startInNew) {
continue;
}
if (... | [
"protected",
"function",
"findRowMatch",
"(",
"$",
"newMatchData",
",",
"$",
"startInOld",
",",
"$",
"endInOld",
",",
"$",
"startInNew",
",",
"$",
"endInNew",
")",
"{",
"$",
"bestMatch",
"=",
"null",
";",
"$",
"bestPercentage",
"=",
"0",
";",
"foreach",
... | @param array $newMatchData
@param int $startInOld
@param int $endInOld
@param int $startInNew
@param int $endInNew
@return RowMatch|null | [
"@param",
"array",
"$newMatchData",
"@param",
"int",
"$startInOld",
"@param",
"int",
"$endInOld",
"@param",
"int",
"$startInNew",
"@param",
"int",
"$endInNew"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L373-L417 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableDiff.php | TableDiff.diffRows | protected function diffRows($oldRow, $newRow, array &$appliedRowSpans, $forceExpansion = false)
{
// create tr dom element
$rowToClone = $newRow ?: $oldRow;
/* @var $diffRow \DOMElement */
$diffRow = $this->diffDom->importNode($rowToClone->getDomNode()->cloneNode(false), false);
... | php | protected function diffRows($oldRow, $newRow, array &$appliedRowSpans, $forceExpansion = false)
{
// create tr dom element
$rowToClone = $newRow ?: $oldRow;
/* @var $diffRow \DOMElement */
$diffRow = $this->diffDom->importNode($rowToClone->getDomNode()->cloneNode(false), false);
... | [
"protected",
"function",
"diffRows",
"(",
"$",
"oldRow",
",",
"$",
"newRow",
",",
"array",
"&",
"$",
"appliedRowSpans",
",",
"$",
"forceExpansion",
"=",
"false",
")",
"{",
"// create tr dom element",
"$",
"rowToClone",
"=",
"$",
"newRow",
"?",
":",
"$",
"o... | @param TableRow|null $oldRow
@param TableRow|null $newRow
@param array $appliedRowSpans
@param bool $forceExpansion
@return array | [
"@param",
"TableRow|null",
"$oldRow",
"@param",
"TableRow|null",
"$newRow",
"@param",
"array",
"$appliedRowSpans",
"@param",
"bool",
"$forceExpansion"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L427-L544 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableDiff.php | TableDiff.getNewCellNode | protected function getNewCellNode(TableCell $oldCell = null, TableCell $newCell = null)
{
// If only one cell exists, use it
if (!$oldCell || !$newCell) {
$clone = $newCell
? $newCell->getDomNode()->cloneNode(false)
: $oldCell->getDomNode()->cloneNode(fals... | php | protected function getNewCellNode(TableCell $oldCell = null, TableCell $newCell = null)
{
// If only one cell exists, use it
if (!$oldCell || !$newCell) {
$clone = $newCell
? $newCell->getDomNode()->cloneNode(false)
: $oldCell->getDomNode()->cloneNode(fals... | [
"protected",
"function",
"getNewCellNode",
"(",
"TableCell",
"$",
"oldCell",
"=",
"null",
",",
"TableCell",
"$",
"newCell",
"=",
"null",
")",
"{",
"// If only one cell exists, use it",
"if",
"(",
"!",
"$",
"oldCell",
"||",
"!",
"$",
"newCell",
")",
"{",
"$",... | @param TableCell|null $oldCell
@param TableCell|null $newCell
@return \DOMElement | [
"@param",
"TableCell|null",
"$oldCell",
"@param",
"TableCell|null",
"$newCell"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L552-L576 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableDiff.php | TableDiff.diffCells | protected function diffCells($oldCell, $newCell, $usingExtraRow = false)
{
$diffCell = $this->getNewCellNode($oldCell, $newCell);
$oldContent = $oldCell ? $this->getInnerHtml($oldCell->getDomNode()) : '';
$newContent = $newCell ? $this->getInnerHtml($newCell->getDomNode()) : '';
$h... | php | protected function diffCells($oldCell, $newCell, $usingExtraRow = false)
{
$diffCell = $this->getNewCellNode($oldCell, $newCell);
$oldContent = $oldCell ? $this->getInnerHtml($oldCell->getDomNode()) : '';
$newContent = $newCell ? $this->getInnerHtml($newCell->getDomNode()) : '';
$h... | [
"protected",
"function",
"diffCells",
"(",
"$",
"oldCell",
",",
"$",
"newCell",
",",
"$",
"usingExtraRow",
"=",
"false",
")",
"{",
"$",
"diffCell",
"=",
"$",
"this",
"->",
"getNewCellNode",
"(",
"$",
"oldCell",
",",
"$",
"newCell",
")",
";",
"$",
"oldC... | @param TableCell|null $oldCell
@param TableCell|null $newCell
@param bool $usingExtraRow
@return \DOMElement | [
"@param",
"TableCell|null",
"$oldCell",
"@param",
"TableCell|null",
"$newCell",
"@param",
"bool",
"$usingExtraRow"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L585-L614 |
caxy/php-htmldiff | lib/Caxy/HtmlDiff/Table/TableDiff.php | TableDiff.createDocumentWithHtml | protected function createDocumentWithHtml($text)
{
$dom = new \DOMDocument();
$dom->loadHTML(mb_convert_encoding(
$this->purifier->purify(mb_convert_encoding($text, $this->config->getEncoding(), mb_detect_encoding($text))),
'HTML-ENTITIES',
$this->config->getEncod... | php | protected function createDocumentWithHtml($text)
{
$dom = new \DOMDocument();
$dom->loadHTML(mb_convert_encoding(
$this->purifier->purify(mb_convert_encoding($text, $this->config->getEncoding(), mb_detect_encoding($text))),
'HTML-ENTITIES',
$this->config->getEncod... | [
"protected",
"function",
"createDocumentWithHtml",
"(",
"$",
"text",
")",
"{",
"$",
"dom",
"=",
"new",
"\\",
"DOMDocument",
"(",
")",
";",
"$",
"dom",
"->",
"loadHTML",
"(",
"mb_convert_encoding",
"(",
"$",
"this",
"->",
"purifier",
"->",
"purify",
"(",
... | @param string $text
@return \DOMDocument | [
"@param",
"string",
"$text"
] | train | https://github.com/caxy/php-htmldiff/blob/d304b3cd8205c7fcc6ae93aa323a12b878103f87/lib/Caxy/HtmlDiff/Table/TableDiff.php#L627-L637 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.