_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q239200
FormBuilder.fieldsFor
train
public function fieldsFor($id, $obj, callable $callback){ $this->context->fieldsFor($id, $obj, $callback); }
php
{ "resource": "" }
q239201
String.split
train
public function split($separator) { $hash = new Hash(explode((string) $separator, (string) $this)); return $hash->map( function ($value) { return new String($value); } ); }
php
{ "resource": "" }
q239202
String.at
train
public function at($start = null, $length = null) { return new String(mb_substr((string) $this, $start, $length, 'UTF-8')); }
php
{ "resource": "" }
q239203
SitemapFileDumper.getSitemapEntries
train
protected function getSitemapEntries(ProfileInterface $profile) { $now = new \DateTime(); $urlEntries = $profile->getUrlEntries(); $numberOfSitemap = $this->getNumberOfSitemap($urlEntries); if (1 === $numberOfSitemap) { $this->writeFile( $this->helper->ge...
php
{ "resource": "" }
q239204
SitemapFileDumper.getNumberOfSitemap
train
private function getNumberOfSitemap(array $urlEntries) { $total = count($urlEntries); if ($total <= $this->maxPerSitemap) { return 1; } return intval(ceil($total / $this->maxPerSitemap)); }
php
{ "resource": "" }
q239205
SitemapFileDumper.writeFile
train
private function writeFile($path, $data) { if (false === @file_put_contents($path, $data)) { throw new DumperException(sprintf('Unable to write file "%s"', $path)); } }
php
{ "resource": "" }
q239206
Database.mySQLconnection
train
public static function mySQLconnection( $array ) { if ( env( 'APP_ENV' ) === 'local' && in_array( env( 'DB_HOST' ), [ 'localhost', '127.0.0.1' ] ) ) { $path = '/Applications/MAMP/tmp/mysql/mysql.sock'; $mampSocket = ( file_exists( $path ) ) ? $path : ''; $array['unix_sock...
php
{ "resource": "" }
q239207
RootViewFactory.createView
train
public function createView($object) { if (is_array($object)) { return array_map([ $this, 'createView' ], $object); } $view = $this->factory->createView($object); if (false === $view instanceof View) { return $this->notSuitableFactoryFor($object); } ...
php
{ "resource": "" }
q239208
RootViewFactory.notSuitableFactoryFor
train
private function notSuitableFactoryFor($object) { switch ($this->notFoundBehaviour) { case self::NOT_FOUND_RETURNS_NULL: return null; case self::NOT_FOUND_RETURN_SOURCE: return $object; case self::NOT_FOUND_THROWS_EXCEPTION: d...
php
{ "resource": "" }
q239209
Form.getHTML
train
public function getHTML() { $tag = '<form'; $q = $this->quoteType; //build attribute strings foreach( $this->attrs as $name=>$value ) { //if true, such as CHECKED, we just add the name if( $value === true ) $tag .= " $name"; ...
php
{ "resource": "" }
q239210
Form.setData
train
public function setData( array $array ) { foreach( $array as $name=>$value ) { if( !isset( $this->nameHash[$name] ) ) { continue; } $element = $this->nameHash[$name]; $element->setAttribute( 'value', (string)$value ); } }
php
{ "resource": "" }
q239211
AbstractSeparator.setSeparator
train
public function setSeparator($separator) { if (!is_string($separator)) { throw new Exception\InvalidArgumentException('"' . $separator . '" is not a valid separator.'); } $this->separator = $separator; return $this; }
php
{ "resource": "" }
q239212
Assertion.assert
train
public function assert($assertion, $message) { // Increment the assertion count $this->test->incrementAssertionCount(); $assertion = $this->negative ? !((bool) $assertion) : (bool) $assertion; if ($assertion === false) { return call_user_func_array([$this, 'fail'], $mes...
php
{ "resource": "" }
q239213
Assertion.fail
train
private function fail() { $args = func_get_args(); $format = array_shift($args); $regex = '/\{\{(?P<positive>[^{}]*)\|(?<negative>[^{}]*)\}\}/'; preg_match_all($regex, $format, $matches); $replacements = $this->negative ? $matches['negative'] : $matches['positive']; ...
php
{ "resource": "" }
q239214
Assertion.boolean
train
public function boolean() { $message = ['%s is {{not|}} a boolean', $this->value]; $this->assert(is_bool($this->value), $message); return $this; }
php
{ "resource": "" }
q239215
Assertion.true
train
public function true() { $message = ['%s is {{not|}} true', $this->value]; $this->assert(($this->value === true), $message); return $this; }
php
{ "resource": "" }
q239216
Assertion.false
train
public function false() { $message = ['%s is {{not|}} false', $this->value]; $this->assert(($this->value === false), $message); return $this; }
php
{ "resource": "" }
q239217
Assertion.equal
train
public function equal($value) { $message = ['%s is {{not|}} equal to %s', $this->value, $value]; $this->assert(($this->value === $value), $message); return $this; }
php
{ "resource": "" }
q239218
Assertion.equivalentTo
train
public function equivalentTo($value) { $message = ['%s is {{not|}} equivalent to %s', $this->value, $value]; $this->assert(($this->value == $value), $message); return $this; }
php
{ "resource": "" }
q239219
Assertion.size
train
public function size($len) { $len = (int) $len; if (is_string($this->value)) { $message = ['%s {{does not have|has}} a string length of %s', $this->value, $len]; $this->assert((strlen($this->value) === $len), $message); } if (is_int($this->value)) { ...
php
{ "resource": "" }
q239220
Assertion.blank
train
public function blank() { $message = ['%s is {{not|}} empty', $this->value]; $this->assert((empty($this->value)), $message); return $this; }
php
{ "resource": "" }
q239221
Assertion.anArray
train
public function anArray() { $message = ['%s is {{not|}} an array', $this->value]; $this->assert((is_array($this->value)), $message); return $this; }
php
{ "resource": "" }
q239222
Assertion.implement
train
public function implement($interface) { $message = ['Class %s {{does not implement|implements}} interface %s', $this->value, $interface]; $this->assert((in_array($interface, class_implements($this->value))), $message); return $this; }
php
{ "resource": "" }
q239223
Assertion.match
train
public function match($regex) { $matches = preg_match($regex, $this->value); $message = ['%s {{does not match|matches}} the regular expression %s', $this->value, $regex]; $this->assert((!empty($matches)), $message); return $this; }
php
{ "resource": "" }
q239224
HTMLBrick.addClass
train
public function addClass($class) { if (isset($this->attr['class'])) { $classes = explode(' ', $this->attr['class']); if (!in_array($class, $classes)) { $classes[] = $class; } $this->attr['class'] = implode(' ', $classes); } else { ...
php
{ "resource": "" }
q239225
HTMLBrick.removeClass
train
public function removeClass($class) { if (isset($this->attr['class'])) { $classes = explode(' ', $this->attr['class']); if (in_array($class, $classes)) { $classes = array_diff($classes, [$class]); } if (empty($classes)) { unset...
php
{ "resource": "" }
q239226
Route.setValidations
train
public function setValidations(ArrayObject $validations) { foreach ($validations as $param => $validation) { $this->setValidation($param, $validation); } return $this; }
php
{ "resource": "" }
q239227
Route.setValidation
train
public function setValidation($param, $validation) { // supprime les parentaises pour eviter les captures innattendus $validation = \preg_replace('`\((?=[^?][^:])`', '(?:', $validation); $this->Validations[$param] = $validation; return $this; }
php
{ "resource": "" }
q239228
Fromdb.scaffold
train
public static function scaffold($tables = null) { // do we have any tables defined? if (empty($tables)) { // do we want to generate for all tables? if ( ! \Cli::option('all', false)) { \Cli::write('No table names specified to run scaffolding on.', 'red'); exit(); } // get the list of all ...
php
{ "resource": "" }
q239229
Fromdb.arguments
train
protected static function arguments($table) { // get the list of columns from the table try { $columns = \DB::list_columns(trim($table), null, \Cli::option('db', null)); } catch (\Exception $e) { \Cli::write($e->getMessage(), 'red'); exit(); } // construct the arguments list, starting with th...
php
{ "resource": "" }
q239230
Set.typed
train
public static function typed(string $type, iterable $input = []): Set { $resolver = Resolver::typed($type); return new static($input, $resolver); }
php
{ "resource": "" }
q239231
Shout.flush
train
public function flush() { if (!$this->config["blocking"] && !empty($this->asyncBuffer)) { $wrote = fwrite($this->destinationHandler, $this->asyncBuffer); $this->asyncBuffer = substr($this->asyncBuffer, $wrote); } return empty($this->asyncBuffer); }
php
{ "resource": "" }
q239232
Shout.rotate
train
public function rotate($resetTimer = true) { if (!$this->config["blocking"]) { while (!empty($this->asyncBuffer)) { $this->flush(); } } if ($resetTimer) { $this->lastRotationTime = time(); } $this->log(self::INFO, "Rotatin...
php
{ "resource": "" }
q239233
Shout.setMaximumLogLevel
train
public function setMaximumLogLevel($level) { if ($level !== null && !is_numeric($level)) { throw new InvalidArgumentException("Maximum log level must be a number or null"); } $this->config["maximumLogLevel"] = $level; }
php
{ "resource": "" }
q239234
Repository.run
train
public function run($command) { return $this->getGitConsole()->run(GitApi::getBin()." ".$command, $this->getRepositoryPath()); }
php
{ "resource": "" }
q239235
Repository.getBranchesList
train
public function getBranchesList($keep_asterisk = false) { $branchArray = explode("\n", $this->run("branch")); foreach ($branchArray as $i => &$branch) { $branch = trim($branch); if (! $keep_asterisk) { $branch = str_replace("* ", "", $branch); } ...
php
{ "resource": "" }
q239236
Commands.anatomy
train
protected function anatomy() { $this->members = Strings::splite($this->key, ' '); $this->command = $this->members[0]; // $y = ''; for ($i = 1; $i < count($this->members); $i++) { $y .= $this->members[$i].' '; } // $rest2 = []; $rest...
php
{ "resource": "" }
q239237
Commands.params
train
protected function params() { $params = []; // for ($i = 0; $i < count($this->members); $i++) { $params[] = $this->members[$i]; } // $this->params = $params; return $params; }
php
{ "resource": "" }
q239238
Commands.setParams
train
protected function setParams() { $this->params(); // foreach ($this->params as $key => $value) { $cont = $this->strip($value); // if (Strings::length($cont) > 2) { if ($cont[0] == '-' && $cont[1] == '-') { $this->setOpti...
php
{ "resource": "" }
q239239
Commands.setArgument
train
protected function setArgument($arg) { if ($this->checkDiscription($arg)) { $this->advanceArg($arg); } else { $this->simpleArg($arg); } }
php
{ "resource": "" }
q239240
Commands.simpleArg
train
protected function simpleArg($key, $desc = '') { if ($this->isOption($key)) { $name = substr($key, 0, -1); $this->addArgument($name, InputArgument::OPTIONAL, $desc); $this->addArgumentInput($name, InputArgument::OPTIONAL, $desc); } else { $this->addArg...
php
{ "resource": "" }
q239241
Commands.advanceArg
train
protected function advanceArg($key) { $data = Strings::splite($key, ' : '); // $arg = $data[0]; $desc = $data[1]; // $this->simpleArg($arg, $desc); }
php
{ "resource": "" }
q239242
Commands.addArgumentInput
train
protected function addArgumentInput($name, $requirement, $description = '') { $this->inputs[] = new Argument($name, $requirement, $description); }
php
{ "resource": "" }
q239243
Commands.setOption
train
protected function setOption($opt) { if ($this->checkDiscription($opt)) { $this->advanceOpt($opt); } else { $this->simpleOpt($opt); } }
php
{ "resource": "" }
q239244
Commands.simpleOpt
train
protected function simpleOpt($opt, $disc = '') { $type = $this->getOptionType($opt); $key = $this->stripOpt($opt); // if ($type == self::REQUIRED) { $key = substr($key, 0, -1); $this->addOption($key, null, InputOption::VALUE_REQUIRED, $disc); $this...
php
{ "resource": "" }
q239245
Commands.advanceOpt
train
protected function advanceOpt($opt) { $data = Strings::splite($opt, ' : '); // $opt = $data[0]; $disc = $data[1]; // $this->simpleOpt($opt, $disc); }
php
{ "resource": "" }
q239246
Commands.addOptionInput
train
protected function addOptionInput($name, $requirement = null, $description = '', $value = null) { $this->inputs[] = new Option($name, $requirement, $description, $value); }
php
{ "resource": "" }
q239247
Commands.getOptionType
train
protected function getOptionType($opt) { if (substr($opt, -1) == '=') { return self::REQUIRED; } elseif (Strings::contains($opt, '=')) { return self::VALUE; } else { return self::OPTIONAL; } }
php
{ "resource": "" }
q239248
Commands.info
train
public function info($text, $sameLine = false) { $output = $this->console->info($text); // if ($sameLine) { $this->console->write($output); } else { $this->console->line($output); } }
php
{ "resource": "" }
q239249
Commands.title
train
public function title($sub = '', $title = 'Vinala Lumos') { if ($title != '') { $this->console->line("\n".$title); // $underline = ''; for ($i = 0; $i < strlen($title); $i++) { $underline .= '='; } // $this->...
php
{ "resource": "" }
q239250
Commands.confirm
train
public function confirm($text, $default = false) { $helper = $this->getHelper('question'); // $question = new ConfirmationQuestion($this->console->question($text.' '), $default); // return $helper->ask($this->input, $this->output, $question); }
php
{ "resource": "" }
q239251
Commands.hidden
train
public function hidden($text) { $helper = $this->getHelper('question'); // $question = new Question($this->console->question($text.' ')); // $question->setHidden(true); // $question->setHiddenFallback(true); // return $helper->ask($this->input,...
php
{ "resource": "" }
q239252
Commands.table
train
public function table($header, $data) { $table = new Table($this->output); // $table->setHeaders($header)->setRows($data); // $table->render(); }
php
{ "resource": "" }
q239253
CookieAuthSessionRepository.create
train
private function create(): CookieAuthSession { $response = $this->request($this->endpoint . $this->path, [ RequestOptions::JSON => [ 'username' => $this->username, 'password' => $this->password, ], ]); $body = $response->getBody(); ...
php
{ "resource": "" }
q239254
CookieAuthSessionRepository.request
train
private function request($url, array $options) { $response = $this->client->request('POST', $url, $options); $body = $response->getBody(); if ($response->getStatusCode() != 200 || !isset($body)) { throw new \Exception('Failed request to ' . $this->endpoint . '.')...
php
{ "resource": "" }
q239255
InstallationStatusDeterminator.isTensideConfigured
train
public function isTensideConfigured() { if (isset($this->isTensideConfigured)) { return $this->isTensideConfigured; } return $this->isTensideConfigured = file_exists( $this->home->tensideDataDir() . DIRECTORY_SEPARATOR . 'tenside.json' ); }
php
{ "resource": "" }
q239256
InstallationStatusDeterminator.isProjectPresent
train
public function isProjectPresent() { if (isset($this->isProjectPresent)) { return $this->isProjectPresent; } return $this->isProjectPresent = file_exists($this->home->homeDir() . DIRECTORY_SEPARATOR . 'composer.json'); }
php
{ "resource": "" }
q239257
InstallationStatusDeterminator.isProjectInstalled
train
public function isProjectInstalled() { if (isset($this->isProjectInstalled)) { return $this->isProjectInstalled; } return $this->isProjectInstalled = is_dir($this->home->homeDir() . DIRECTORY_SEPARATOR . 'vendor'); }
php
{ "resource": "" }
q239258
Collection.createFlatArrayWithValuesAsAttributeName
train
public function createFlatArrayWithValuesAsAttributeName($attribute_name) { $a = []; foreach ($this->getCollection() as $key => $object) { $object_array = $object->toArray(); if (isset($object_array[$attribute_name])) { $a[$key] = $object_array[$attribute_name...
php
{ "resource": "" }
q239259
NiirrtyException.getErrorMessage
train
public function getErrorMessage( bool $appendPreviousByNewline = false ) : string { // Getting a optional previous exception $prev = $this->getPrevious(); if ( null === $prev ) { // If no previous exception is used return \sprintf( '%s(%d): %s', st...
php
{ "resource": "" }
q239260
NiirrtyException.toCustomString
train
public function toCustomString( int $subExceptionLevel = 0, string $indentSpaces = ' ' ) : string { // Concatenate the base error message from usable elements $msg = \sprintf( '%s%s in %s[%d]. %s', \str_repeat( $indentSpaces, $subExceptionLevel ), \get_class( $this ), ...
php
{ "resource": "" }
q239261
ProfileController.updatePassword
train
public function updatePassword(UpdateProfilePasswordRequest $request) { $user = $this->user->find($this->auth->id()); $credentials = [ 'id' => $this->auth->id(), 'email' => $user->email, 'password' => $request->old_password, ]; if (! $th...
php
{ "resource": "" }
q239262
MysqlDriver.isColumnInIndex
train
private function isColumnInIndex(TableInterface $table, ColumnInterface $column){ $indexes = $table->getAddedIndexes(); if(in_array($column->getName(), $table->getPrimaryKey())){ return true; } foreach($indexes as $columnNames){ if(in_array($column->getName(), $...
php
{ "resource": "" }
q239263
PageBuilder.buildTopMatter
train
protected function buildTopMatter() { $topMatterBuilder = SectionBuilder::begin() ->setType(SectionBuilder::TYPE_SPAN); if ($this->breadCrumbTitles !== []) { $breadCrumbsBuilder = SectionBuilder::begin() ->setType(SectionBuilder::TYPE_BREADCRUMBS); ...
php
{ "resource": "" }
q239264
PageBuilder.validateRenderer
train
protected function validateRenderer() { if ($this->renderer === null) { $settingsInstance = $this->getSettingsInstance(); if ($this->type === static::TYPE_EXCEL) { $writerClasses = $settingsInstance->getDefaultExcelWriterClasses(); $rendererClass = $s...
php
{ "resource": "" }
q239265
PageBuilder.validateInitializer
train
protected function validateInitializer() { if ($this->renderer === null) { $settingsInstance = $this->getSettingsInstance(); if ($this->type === static::TYPE_EXCEL) { $initializerClass = $settingsInstance->getDefaultExcelInitializerClass(); } elseif ($thi...
php
{ "resource": "" }
q239266
Rule.validate
train
public function validate(string $key, array $scope = [], array $input = []): void { $value = $key == '*' ? '*' : $scope[$key] ?? null; ($this->validate)($value, $key, $scope, $input); }
php
{ "resource": "" }
q239267
AbstractActionController.getService
train
protected function getService() { if (!isset($this->service)) { $this->service = $this->getServiceLocator() ->get($this->getModuleNamespace() . '\Service\\' . $this->getEntityName()); } return $this->service; }
php
{ "resource": "" }
q239268
iauRefco.Refco
train
public static function Refco($phpa, $tc, $rh, $wl, &$refa, &$refb) { $optic; $p; $t; $r; $w; $ps; $pw; $tk; $wlsq; $gamma; $beta; /* Decide whether optical/IR or radio case: switch at 100 microns. */ $optic = ( $wl <= 100.0 ); /* Restrict parameters to safe val...
php
{ "resource": "" }
q239269
ComposerIO.getAnswers
train
public function getAnswers(\Composer\IO\IOInterface $io, array $questions): array { $answers = []; foreach($questions as $key => $question) { $answers[$key] = $io->ask($question->getQuestion(), $question->getDefault()); } return $answers; }
php
{ "resource": "" }
q239270
FormatDateTimeValidator.validateTimezoneTime
train
private function validateTimezoneTime(int $hour, int $minutes): bool { if (!$this->validateHour($hour)) { return false; } if (!$this->validateMinutes($minutes)) { return false; } return true; }
php
{ "resource": "" }
q239271
LayoutController.childElementtypesAction
train
public function childElementtypesAction(Request $request) { $id = $request->get('id'); $elementSourceManager = $this->get('phlexible_element.element_source_manager'); $elementService = $this->get('phlexible_element.element_service'); $iconResolver = $this->get('phlexible_element.ico...
php
{ "resource": "" }
q239272
LayoutController.childElementsAction
train
public function childElementsAction(Request $request) { $tid = $request->get('tree_id'); $layoutareaId = $request->get('layoutarea_id'); $language = $request->get('language', 'de'); $translator = $this->get('translator'); $treeManager = $this->get('phlexible_tree.tree_manage...
php
{ "resource": "" }
q239273
LoggableCollection.wrapCursor
train
protected function wrapCursor(\RiakCursor $cursor, $query, $fields) { return new LoggableCursor($this, $cursor, $query, $fields, $this->numRetries, $this->loggerCallable); }
php
{ "resource": "" }
q239274
Password.setMaximumLength
train
public function setMaximumLength($maximumLength) { if ($maximumLength <= $this->minimalLength) { throw new Exception\InvalidArgumentException('Maximum length must be larger than minimal length.'); } $this->maximumLength = $maximumLength; return $this; }
php
{ "resource": "" }
q239275
CreatedBy.before_insert
train
public function before_insert(Orm\Model $obj) { if ($obj instanceof Orm\Model_Temporal) { if ($obj->{$obj->temporal_property('end_column')} !== $obj->temporal_property('max_timestamp')) { return false; } } if ($user_id = \Auth::get_user_id()) { $obj->{$this->_property} = $user_id[1]; } }
php
{ "resource": "" }
q239276
CssRoutingLoader.load
train
public function load($resource, $type = null) { $routes = new RouteCollection(); $pattern = '/_pygments_bundle/style.css'; $defaults = array( '_controller' => 'CypressPygmentsElephantBundle:Main:css', ); $route = new Route($pattern, $defaults); $routes->...
php
{ "resource": "" }
q239277
AssignmentController.actionAssign
train
public function actionAssign($id) { $model = Yii::createObject([ 'class' => Assignment::className(), 'user_id' => $id, ]); if ($model->load(\Yii::$app->request->post()) && $model->updateAssignments()) { } return \matacms\rbac\widgets\Assignments::w...
php
{ "resource": "" }
q239278
Number.getBytes
train
public static function getBytes($value){ $value = trim($value); $unit = $value{strlen($value)-1}; $value = floatval($value); switch(strtolower($unit)){ case 'g': $multiplier = 1073741824; break; case 'm': $multiplier = 1048576; break; case 'k': $multiplier = 1024; break...
php
{ "resource": "" }
q239279
Number.formatNumber
train
public static function formatNumber($number, $decimals = 0, $invalid = '-'){ if(!is_numeric($number)) return $invalid; $locale = localeconv(); return number_format($number, $decimals, $locale['decimal_point'], $locale['thousands_sep']); }
php
{ "resource": "" }
q239280
Number.formatTime
train
public static function formatTime($format, $time = null){ if(empty($time)) $time = time(); // Apply Windows-specific format mapping if(PHP_OS == 'WINNT'){ $mapping = [ '%C' => sprintf('%02d', date('Y', $time) / 100), '%D' => '%m/%d/%y', '%e' => sprintf('%\' 2d', date('j', $time)), '%h' => '...
php
{ "resource": "" }
q239281
Number.isValidTelephoneNumber
train
public static function isValidTelephoneNumber($telephone){ $numbers = str_split($telephone); $nums = []; foreach($numbers as $number){ if(ctype_digit($number)){ $nums[] = $number; } } if(count($nums) > 8){ return true; } return false; }
php
{ "resource": "" }
q239282
Number.formatSocialNumber
train
public static function formatSocialNumber($number){ assert('is_integer($number)'); if(!is_integer($number)) return $number; if($number > 10000000){ $number = round($number / 1000000) . 'M'; } elseif($number > 1000000){ $number = round($number / 1000000, 1) . 'M'; } elseif($number > 10000){ ...
php
{ "resource": "" }
q239283
AbstractExecutable.handleSignal
train
protected function handleSignal(int $signo, $siginfo) : void { $this->log("Signal received: $signo", LOG_DEBUG, "syslog"); if ($signo === SIGTERM || $signo === SIGINT || $signo === SIGQUIT) { $this->log("Termination signal received. Shutting down.", LOG_INFO, [ "syslog", STDOUT ], true);...
php
{ "resource": "" }
q239284
Hash.toArray
train
public function toArray($recursive = true) { $values = $this->values; if (!$recursive) { return $values; } foreach ($values as $key => $value) { if (gettype($value) === 'object') { if ($value instanceof Hash) { $value = $v...
php
{ "resource": "" }
q239285
Hash.select
train
public function select($callback) { $hash = $this->create(); foreach ($this as $key => $value) { if ($callback($value, $key) == true) { $hash[$key] = $value; } } return $hash; }
php
{ "resource": "" }
q239286
Hash.keys
train
public function keys() { return $this->create(array_keys($this->toArray()))->map( function ($key) { return new String($key); } ); }
php
{ "resource": "" }
q239287
SkillPartTableMap.doDelete
train
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillPartTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity $crite...
php
{ "resource": "" }
q239288
SkillPartTableMap.doInsert
train
public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(SkillPartTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; // renam...
php
{ "resource": "" }
q239289
ValidationResult.getMessages
train
public function getMessages(): array { $errors = $this->getErrors(); $keys = array_keys($errors); return array_reduce($keys, function ($messages, $key) use ($errors) { $translated = $this->translator->getMessages($key, $errors[$key]); return array_merge($messages,...
php
{ "resource": "" }
q239290
Jobs.createJobsBuilder
train
public static function createJobsBuilder() { $builder = new JobsBuilder(); $builder->addExtension(new Extension\Core\CoreExtension()); $builder->addExtension(new Extension\ETL\ETLExtension()); return $builder; }
php
{ "resource": "" }
q239291
RequestBasedRequestHandler.isAjax
train
private function isAjax(ServerRequestInterface $request): bool { $params = $request->getServerParams(); if (! array_key_exists('HTTP_X_REQUESTED_WITH', $params)) { return false; } return strtolower($params['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; }
php
{ "resource": "" }
q239292
RequestBasedRequestHandler.preferred
train
private function preferred(ServerRequestInterface $request): RequestHandlerInterface { $negotiator = new Negotiator; $accept = $request->getHeaderLine('Accept', '*/*'); $priorities = array_keys($this->handlers); $best = $negotiator->getBest($accept, $priorities); $mediatype...
php
{ "resource": "" }
q239293
Controller.addRoute
train
public static function addRoute($route, $controller, $root) { $file = $root.'app/http/Routes.php'; $content = "\n\ntarget('$route','$controller');"; file_put_contents($file, $content, FILE_APPEND | LOCK_EX); return true; }
php
{ "resource": "" }
q239294
Controller.clear
train
public static function clear() { $path = root().'resources/controllers/*.php'; $files = File::glob($path); // foreach ($files as $file) { File::delete($file); } // return true; }
php
{ "resource": "" }
q239295
Gravatar.getGravatar
train
public function getGravatar($email, $size = null, $rating = null, $default = null, $secure = null) { $hash = $this->getHash($email); $map = array( 's' => $size ?: $this->settings['size'], 'r' => $rating ?: $this->settings['rating'], 'd' => $default ?: $this->sett...
php
{ "resource": "" }
q239296
Gravatar.getProfile
train
public function getProfile($email, $format = null, $secure = null) { $hash = $this->getHash($email); $extension = ''; if (null !== $format) { $extension = strtolower($format); } if (null === $secure) { $secure = $this->settings['secure']; } ...
php
{ "resource": "" }
q239297
ConfigProvider.getControllerPluginConfig
train
public function getControllerPluginConfig() { return [ 'aliases' => [ 'tssEmail' => Controller\Plugin\EmailPlugin::class, 'tssImageThumb' => Controller\Plugin\ImageThumbPlugin::class, 'tssReferer' => Controller\Plugin\Referer::class, ],...
php
{ "resource": "" }
q239298
ConfigProvider.getViewHelpers
train
public function getViewHelpers() { return [ 'aliases' => [ 'tssFlashMessenger' => View\Helper\FlashMessenger::class, 'tssFormRow' => Form\View\Helper\FormRow::class, 'tssPaginator' => View\Helper\Paginator::class, 'tssReferer' => Vi...
php
{ "resource": "" }
q239299
Bootstrap.run
train
public function run(...$argv) : void { $recipe = $this->recipe; if (isset($this->config->aliases, $this->config->aliases->$recipe)) { $alias = $this->config->aliases->$recipe; $recipe = $alias[0]; $argv = array_merge(array_splice($alias, 1), $argv); } ...
php
{ "resource": "" }