_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q238200
AssociationController.indexAction
train
public function indexAction() { $this->checkStaticTemplateIsIncluded(); $this->checkSettings(); $arguments = $this->request->getArguments(); return $this->forward('listAssociations', null, null, $arguments); }
php
{ "resource": "" }
q238201
AssociationController.listSubAssociationsAction
train
public function listSubAssociationsAction(string $aID = null, string $filter = null) { $this->checkStaticTemplateIsIncluded(); $this->checkSettings(); $this->slotExtendedAssignMultiple([ self::VIEW_VARIABLE_ASSOCIATION_ID => $aID, self::VIEW_VARIABLE_FILTER => $this-...
php
{ "resource": "" }
q238202
AssociationController.detailAssociationAction
train
public function detailAssociationAction(string $aID) { $this->checkStaticTemplateIsIncluded(); $this->checkSettings(); $this->slotExtendedAssignMultiple([ self::VIEW_VARIABLE_ASSOCIATION_ID => $aID ], __CLASS__, __FUNCTION__); return $this->view->render(); }
php
{ "resource": "" }
q238203
AssociationController.detailEventAction
train
public function detailEventAction(string $aID, string $eID) { $this->checkStaticTemplateIsIncluded(); $this->checkSettings(); $this->slotExtendedAssignMultiple([ self::VIEW_VARIABLE_ASSOCIATION_ID => $aID, self::VIEW_VARIABLE_EVENT_ID => $eID ], __CLASS__, __...
php
{ "resource": "" }
q238204
AssociationController.detailFunctionaryAction
train
public function detailFunctionaryAction(string $aID, string $fID) { $this->checkStaticTemplateIsIncluded(); $this->checkSettings(); $this->slotExtendedAssignMultiple([ self::VIEW_VARIABLE_ASSOCIATION_ID => $aID, self::VIEW_VARIABLE_FUNCTIONARY_ID => $fID ], _...
php
{ "resource": "" }
q238205
iauCpv.Cpv
train
public static function Cpv(array $pv, array &$c) { // Added in PHP porting... initialize $c array $c[] = [0, 0, 0]; $c[] = [0, 0, 0]; IAU::Cp($pv[0], $c[0]); IAU::Cp($pv[1], $c[1]); return; }
php
{ "resource": "" }
q238206
Image_Imagemagick.exec
train
protected function exec($program, $params, $passthru = false) { // Determine the path $this->im_path = realpath($this->config['imagemagick_dir'].$program); if ( ! $this->im_path) { $this->im_path = realpath($this->config['imagemagick_dir'].$program.'.exe'); } if ( ! $this->im_path) { throw new \Ru...
php
{ "resource": "" }
q238207
Page.setContents
train
public function setContents($contents) { $contents_exist = file_exists($contents); if ($contents_exist) { $this->contents = file_get_contents($contents); $this->updateLog("info", "Page contents set from {$contents}"); } else { $this->contents = false; ...
php
{ "resource": "" }
q238208
Twig.getTwigEnvironment
train
private function getTwigEnvironment() { if (null == $this->twigEnvironment) { $this->twigEnvironment = $this->createTwigEnvironment(); } return $this->twigEnvironment; }
php
{ "resource": "" }
q238209
Twig.createTwigEnvironment
train
private function createTwigEnvironment() { $twigEnv = new Twig_Environment( $this->getLoader(), $this->getOptions() ); if ($this->options['debug']) { $twigEnv->addExtension(new Twig_Extension_Debug()); } return $twigEnv; }
php
{ "resource": "" }
q238210
Twig.getLoader
train
private function getLoader() { if (null == $this->loader) { $this->loader = new Twig_Loader_Filesystem( $this->locations ); } return $this->loader; }
php
{ "resource": "" }
q238211
Twig.getOptions
train
private function getOptions() { $options = []; foreach($this->optionsMap as $property => $name) { $options[$name] = $this->options[$property]; } return $options; }
php
{ "resource": "" }
q238212
MessageFileLanguage.save
train
public function save() { if($this->msg) { ksort($this->msg); $file = $this->folder."messages_".$this->language.".php"; $old = umask(00002); if (file_exists($file) && !is_writable($file)) { throw new FileTranslatorException('Cannot write to file "'.$file.'".'); } elseif (!file_exists($file)) {...
php
{ "resource": "" }
q238213
MessageFileLanguage.deleteMessage
train
public function deleteMessage($key) { if(isset($this->msg[$key])) { unset($this->msg[$key]); } if(!$this->msg) { $this->deleteFile(); } }
php
{ "resource": "" }
q238214
Directory.initializeResouces
train
protected function initializeResouces() { if ($this->resources !== null) { return; } $this->resources = array(); $contents = dir($this->root . $this->path); while (($path = $contents->read()) !== false) { if (in_array($path, array('.', '..', '.hg')))...
php
{ "resource": "" }
q238215
Locator.getHandlerForCommand
train
public function getHandlerForCommand($commandName) { $command = str_replace($this->commandNamespace, '', $commandName); $handlerName = $this->handlerNamespace.'\\'.trim($command, '\\').'Handler'; if (!class_exists($handlerName)) { throw MissingHandlerException::forCommand($c...
php
{ "resource": "" }
q238216
FunctionCallSignatureSniff.isMultiLineCall
train
public function isMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $tokens) { $closeBracket = $tokens[$openBracket]['parenthesis_closer']; if ($tokens[$openBracket]['line'] !== $tokens[$closeBracket]['line']) { return true; } return false; }
php
{ "resource": "" }
q238217
h2o.addTag
train
public static function addTag($tag, $class = null) { $tags = array(); if (is_string($tag)) { if (is_null($class)) { $class = ucwords("{$tag}_Tag"); } $tags[$tag] = $class; } elseif (is_array($tag)) { $tags = $tag; } ...
php
{ "resource": "" }
q238218
h2o.addFilter
train
public static function addFilter($filter, $callback = null) { if (is_array($filter)) { $filters = $filter; foreach ($filters as $key => $filter) { if (is_numeric($key)) { $key = $filter; } self::addFilter($key, $filt...
php
{ "resource": "" }
q238219
Wrapper.getArrayType
train
protected function getArrayType(array $array) { $indices = count(array_filter(array_keys($array), 'is_string')); if ($indices == 0) { $type = self::ARRAY_TYPE_LIST; } elseif ($indices == count($array)) { $type = self::ARRAY_TYPE_DICT; } else { $type = self::ARRAY_TYPE_MIXED; } return $type; }
php
{ "resource": "" }
q238220
Wrapper.getCallbackReflection
train
protected function getCallbackReflection($callback) { if (is_string($callback) && strpos($callback, '::') !== false) { $callback = explode('::', $callback, 2); } switch (true) { case is_string($callback) && function_exists($callback): case $callback instanceof \Closure: $reflection_method = new \Refl...
php
{ "resource": "" }
q238221
Wrapper.setCallback
train
protected function setCallback($callback) { if (!is_callable($callback)) { throw new InvalidCallbackException('Invalid callback'); } $this->reflection_parameter = $this ->getCallbackReflection($callback) ->getParameters() ; $this->callback = $callback; return $this; }
php
{ "resource": "" }
q238222
Wrapper.prepareArguments
train
protected function prepareArguments($reflection_parameter, $arguments) { $array_type = $this->getArrayType($arguments); $prepared = array(); if ($array_type == self::ARRAY_TYPE_LIST) { $prepared = $arguments; } elseif ($array_type == self::ARRAY_TYPE_DICT) { foreach ($reflection_parameter as $parameter) ...
php
{ "resource": "" }
q238223
CheckoutController.detailAction
train
public function detailAction(Request $request) { $cart = $this->getCurrentCart(); $form = $this->createForm('EcommerceBundle\Form\CartType', $cart); return array( 'cart' => $cart, 'form' => $form->createView() ); }
php
{ "resource": "" }
q238224
CheckoutController.addAction
train
public function addAction(Request $request) { $em = $this->getDoctrine()->getManager(); $coreManager = $this->get('core_manager'); $checkoutManager = $this->get('checkout_manager'); $cart = $this->getCurrentCart(); $emptyItem = new CartItem(); try { ...
php
{ "resource": "" }
q238225
CheckoutController.saveAction
train
public function saveAction(Request $request) { $cart = $this->getCurrentCart(); $form = $this->createForm(CartType::class, $cart); if ($form->handleRequest($request)->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($cart); ...
php
{ "resource": "" }
q238226
CheckoutController.removeAction
train
public function removeAction($id) { $em = $this->getDoctrine()->getManager(); $cart = $this->getCurrentCart(); $repository = $em->getRepository('EcommerceBundle:CartItem'); $item = $repository->find($id); if (!$item || false === $cart->hasItem($item)) { // Write ...
php
{ "resource": "" }
q238227
CheckoutController.editBillingAction
train
public function editBillingAction(Request $request) { if($request->isXmlHttpRequest()){ $em = $this->container->get('doctrine')->getManager(); $checkoutManager = $this->container->get('checkout_manager'); /** @var Address $address */ $address = $checkoutManag...
php
{ "resource": "" }
q238228
CheckoutController.setBillingAddressAction
train
public function setBillingAddressAction($id) { $em = $this->container->get('doctrine')->getManager(); $user = $this->container->get('security.token_storage')->getToken()->getUser(); $address = $em->getRepository('EcommerceBundle:Address') ->findOneBy(array( 'i...
php
{ "resource": "" }
q238229
CheckoutController.showDeliveryAction
train
public function showDeliveryAction() { $em = $this->container->get('doctrine')->getManager(); $user = $this->container->get('security.token_storage')->getToken()->getUser(); $addresses = $em->getRepository('EcommerceBundle:Address') ->findBy(array( 'actor' => ...
php
{ "resource": "" }
q238230
CheckoutController.newDeliveryAction
train
public function newDeliveryAction(Request $request) { if($request->isXmlHttpRequest()){ $em = $this->container->get('doctrine')->getManager(); $user = $this->container->get('security.token_storage')->getToken()->getUser(); /** @var Address $address */ $countr...
php
{ "resource": "" }
q238231
CheckoutController.editDeliveryAction
train
public function editDeliveryAction(Request $request, $id) { if($request->isXmlHttpRequest()){ $em = $this->container->get('doctrine')->getManager(); $user = $this->container->get('security.token_storage')->getToken()->getUser(); /** @var Address $address */ ...
php
{ "resource": "" }
q238232
CheckoutController.deleteDeliveryAction
train
public function deleteDeliveryAction($id) { $em = $this->container->get('doctrine')->getManager(); $user = $this->container->get('security.token_storage')->getToken()->getUser(); $address = $em->getRepository('EcommerceBundle:Address') ->findOneBy(array( 'id' ...
php
{ "resource": "" }
q238233
iauBi00.Bi00
train
public static function Bi00(&$dpsibi, &$depsbi, &$dra) { /* The frame bias corrections in longitude and obliquity */ $DPBIAS = -0.041775 * DAS2R; $DEBIAS = -0.0068192 * DAS2R; /* The ICRS RA of the J2000.0 equinox (Chapront et al., 2002) */ $DRA0 = -0.0146 * DAS2R; /* Return the results (which...
php
{ "resource": "" }
q238234
Stack.offsetSet
train
final public function offsetSet($key, $value) { $key = (string) $key; if ( array_key_exists($key, $this->_stack) ) { throw new \DomainException('Key already exists.'); } $this->_stack[$key] = $value; }
php
{ "resource": "" }
q238235
Paragraph.getSiteInfo
train
protected function getSiteInfo() { if ( null === $this->siteInfo ) { $this->siteInfo = $this->getServiceLocator() ->get( 'SiteInfo' ); } return $this->siteInfo; }
php
{ "resource": "" }
q238236
Paragraph.getFallbackUri
train
protected function getFallbackUri( $paragraphId, $absolute = false ) { $uri = '/app/' . $this->locale . '/paragraph/render/' . $paragraphId; if ( $absolute ) { $uri = $this->getSiteInfo() ->getSubdomainUrl( null, $uri ); } return $uri; ...
php
{ "resource": "" }
q238237
Paragraph.getSubdomain
train
protected function getSubdomain( $subdomainId = null ) { static $subdomains = array(); $siteInfo = $this->getSiteInfo(); if ( empty( $subdomainId ) || $siteInfo->getSubdomainId() == $subdomainId ) { return $siteInfo->getSubdomain(); } if ( ! isset( $subd...
php
{ "resource": "" }
q238238
Paragraph.getUriForContent
train
protected function getUriForContent( $contentId, $absolute = false ) { /* @var $model \Grid\Core\Model\Uri\Model */ $service = $this->getServiceLocator(); $model = $service->get( 'Grid\Core\Model\Uri\Model' ); $subdomain = $this->getSiteInfo()->getSubdomainId(); $uri...
php
{ "resource": "" }
q238239
Paragraph.getUriById
train
protected function getUriById( $paragraphId, $absolute = false ) { /* @var $model \Grid\Paragraph\Model\Paragraph\Model */ $service = $this->getServiceLocator(); $model = $service->get( 'Grid\Paragraph\Model\Paragraph\Model' ); $paragraph = $model->find( $paragraphId ); ...
php
{ "resource": "" }
q238240
Paragraph.getUri
train
public function getUri( $absolute = false ) { if ( empty( $this->contentId ) ) { return '#error-paragraph-missing:contentId'; } if ( 'content' == $this->subType ) { return $this->getUriForContent( $this->contentId, $absolute ); } retu...
php
{ "resource": "" }
q238241
Session.set_sticky
train
public static function set_sticky($key, $value) { if (self::$sticky === null) { self::$sticky = new \Skeleton\Core\Web\Session\Sticky(); } self::$sticky->$key = $value; }
php
{ "resource": "" }
q238242
LogsServiceProvider.registerLogs
train
protected function registerLogs() { $this->app->singleton('logs', function($app) { $config = $this->app->config->get('logs'); if ($config['adapter'] == 'loggly') { return new Adapters\Loggly(); } elseif ($config['adapter'] == 'stackdriver') { ...
php
{ "resource": "" }
q238243
Model.compile_properties
train
protected static function compile_properties(array $properties, $defaults = true) { $p = $properties; $properties = []; foreach ($p as $key => $value) { if (is_int($key)) { $key = $value; $value = []; } // Get property defaults if ($defaults and $property = static::property($key, false...
php
{ "resource": "" }
q238244
Model.skeleton_properties
train
public static function skeleton_properties($type) { $class = get_called_class(); if (isset(static::$_skeleton_cached[$class][$type])) { return static::$_skeleton_cached[$class][$type]; } $var = '_' . $type . '_properties'; $properties = []; if (property_exists($class, $var)) { $properties = st...
php
{ "resource": "" }
q238245
Model.fieldsets
train
public static function fieldsets() { $class = get_called_class(); if (array_key_exists($class, static::$_fieldsets_cached)) { return static::$_fieldsets_cached[$class]; } $fieldsets = []; if (property_exists($class, '_fieldsets')) { $fieldsets = []; foreach (static::$_fieldsets as $fieldset ...
php
{ "resource": "" }
q238246
Model.generateInput
train
protected static function generateInput($field, array $propertyConfig) { $type = \Arr::get($propertyConfig, 'type', 'text'); // Build up a config array to pass to the parent $config = [ 'name' => $field, 'label' => \Arr::get($propertyConfig, 'label', $field), 'attributes' => \Arr::get($prope...
php
{ "resource": "" }
q238247
Model.generate_filters
train
public static function generate_filters() { if (static::$builder === null) { static::setBuilder(new Basic); } $form = []; // Loop through and add all fields foreach (static::list_properties() as $field => $config) { $form[] = static::generateInput($field, $config); } return $form; }
php
{ "resource": "" }
q238248
EmailBodyPartCollection.deserializeJSON
train
public function deserializeJSON($jsonString) { $data = \json_decode($jsonString); $this->clear(); foreach ($data as $v) { $part = new EmailBodyPart(); $part->updateFromObject($v); $this->add($v); } }
php
{ "resource": "" }
q238249
LocaleFactory.findLocale
train
protected function findLocale() { $locale = null; if (PHP_SAPI == 'cli') { $locale = getenv('LANG'); } else if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && extension_loaded('intl')) { $locale = \Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); } ...
php
{ "resource": "" }
q238250
HandleExceptions.handleShutdown
train
public function handleShutdown() { $error = error_get_last(); if ($error !== null && $this->isFatal($error['type'])) { $this->handleException(new FatalErrorException($error['message'], $error['type'], 0, $error['file'], $error['line'])); // @codeCoverageIgnore } // @codeCoverageI...
php
{ "resource": "" }
q238251
Descriptor.getOptionNotation
train
protected function getOptionNotation(OptionInterface $option): string { $multiple = $option->isMultiple(); $short = $option->getShort(); $long = $option->getLong(); $flag = $option->isFlag(); $notation = ''; if ($short !== null) { $notation .= '-' . $shor...
php
{ "resource": "" }
q238252
Stream.calculateSize
train
private function calculateSize() { // Clear the stat cache if the stream has a URI if ($this->uri) { clearstatcache(true, $this->uri); } $stats = fstat($this->stream); if (isset($stats[static::META_SIZE])) { $this->size = $stats[static::META_SIZE]; ...
php
{ "resource": "" }
q238253
Menu_Item_Megamenu_Fields_Walker.get_fields
train
protected function get_fields($item, $depth, $args = array(), $id = 0) { ob_start(); /** * Get menu item custom fields from plugins/themes * * @since 0.1.0 * @since 1.0.0 Pass correct parameters. * * @param int $item_id Menu item ID. * ...
php
{ "resource": "" }
q238254
DeployController.actionInstall
train
public function actionInstall() { $this->stdout("Run composer dump-autoload ... "); $this->executeCommand('$ composer dump-autoload'); $this->stdout("[DONE]\n"); $scriptComponent = $this->getScript(); if ($scripts = $scriptComponent->getScript('yii2-yiithings-install-cmd')) ...
php
{ "resource": "" }
q238255
SessionHandlerDB.open
train
public function open($sessionPath, $sessionName){ //si la sesión no está abierta tengo que abrir conexión a base de datos if(!$this->opened){ $this->connection= new DataBaseAR(FALSE); $this->connection->connect($this->dataBase); $this->opened= TRUE; ...
php
{ "resource": "" }
q238256
SessionHandlerDB.read
train
public function read($sessionId){ //si la sesión está abierta y tengo lock if($this->opened){ $sql= $this->connection->connection->prepare('SELECT session_data FROM sessions WHERE session_id = :id'); $sql->bindValue('id', $sessionId); $sql->execute(); $re...
php
{ "resource": "" }
q238257
SessionHandlerDB.write
train
public function write($sessionId, $sessionData){ //si la sesión está abierta y tengo lock if($this->opened){ $sql= $this->connection->connection->prepare('REPLACE INTO sessions (session_id, session_data, session_expiration) VALUES(:id, :data, :expiration)'); $sql->bindValue('id'...
php
{ "resource": "" }
q238258
SessionHandlerDB.destroy
train
public function destroy($sessionId){ //si la sesión está abierta y tengo lock if($this->opened){ $sql= $this->connection->connection->prepare('DELETE FROM sessions WHERE session_id = :id'); $sql->bindValue('id', $sessionId); return $sql->execute() === TRUE; }...
php
{ "resource": "" }
q238259
SessionHandlerDB.gc
train
public function gc($lifetime){ //si la sesión está abierta y tengo lock if($this->opened){ $fecha= new \DateTime(); $sql= $this->connection->connection->prepare('DELETE FROM sessions WHERE session_expiration < :fecha'); $sql->bindValue('fecha', $fecha->format('Y-m-d ...
php
{ "resource": "" }
q238260
Logger.init
train
public static function init($settings = null) { if (!is_null($settings)) self::$settings = array_replace_recursive(self::$settings, $settings); }
php
{ "resource": "" }
q238261
TextToHtml.getHtml
train
public function getHtml(string $text) : string { $textAsHtml = htmlspecialchars($text, ENT_QUOTES); $textWithNewLines = nl2br($textAsHtml); $tokenized = $this->tokenizer->tokenize($textWithNewLines); $html = $this->bbCode->format($tokenized); return $html; }
php
{ "resource": "" }
q238262
Tabs.doRefresh
train
public function doRefresh(){ //Validating elements. Should be already done but let's say on the safe side $this->form->validateElements(); //If valid apply values to the accordion if($this->form->isValid()){ foreach($this->form->getElements() as $element){ $this->tabs->addParams($element->getName(), ...
php
{ "resource": "" }
q238263
BusHolderTrait.getEventBus
train
public function getEventBus() { if (!$this->eventBus) { if (isset(static::$staticEventBus)) { return static::$staticEventBus; } $this->eventBus = new Bus; } return $this->eventBus; }
php
{ "resource": "" }
q238264
SearchForm.createDataProvider
train
protected function createDataProvider() : ActiveDataProvider { $query = $this->buildQuery(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'defaultOrder' => $this->defaultOrder ] ]); if (!$this->load($th...
php
{ "resource": "" }
q238265
SearchForm.requestData
train
protected function requestData() : array { switch ($this->method) { case 'post': return Yii::$app->request->post(); case 'get': return Yii::$app->request->getQueryParams(); default: throw new InvalidConfigException('Request ...
php
{ "resource": "" }
q238266
SearchForm.filterTimestamp
train
protected function filterTimestamp(&$query, $attr = 'updated_at') { if (!is_null($this->{$attr}) && strpos($this->{$attr}, ' - ') !== false ) { list($start_date, $end_date) = explode(' - ', $this->{$attr}); $query->andFilterWhere(['>=', $attr, (int)strtotime($start_date)]); ...
php
{ "resource": "" }
q238267
Path.isIn
train
public function isIn($directory, $cwd = null) { $dir = Path::info($directory); if ($dir->isEmpty()) { throw new \InvalidArgumentException('Directory is empty.'); } $dir = $dir->normalize()->assumeDirectory(); $self = $this->normalize(); if (! $dir->isAbsolute() && is_null($cwd)) { throw new \Inval...
php
{ "resource": "" }
q238268
Path.relativeTo
train
public function relativeTo($directory, $cwd = null) { $dir = Path::info($directory); if ($dir->isEmpty()) { throw new \InvalidArgumentException('Directory is empty.'); } $dir = $dir->normalize()->assumeDirectory(); $self = $this->normalize()->dir(); if (! $dir->isAbsolute() && is_null($cwd)) { thr...
php
{ "resource": "" }
q238269
Path.set
train
public function set($path) { if (! is_string($path)) { throw new \InvalidArgumentException(); } if ($path === '') { $this->setParts([]); } else { $this->setParts(explode('/', $path)); } return $this; }
php
{ "resource": "" }
q238270
Path.isEmpty
train
public function isEmpty() { if ($this->partCount === 0) { return true; } if ($this->partCount === 1) { return $this->firstPart === ''; } if ($this->partCount === 3 && $this->isStreamWrapped()) { return true; } return false; }
php
{ "resource": "" }
q238271
Path.isStreamWrapped
train
public function isStreamWrapped() { $maybeStreamWrapped = $this->partCount > 1 && $this->firstPart !== '' && $this->parts[1] === '' && ':' === substr($this->firstPart, -1); if (! $maybeStreamWrapped) { return false; } $name = substr($this->firstPart, 0, -1); return in_array($name, stream_get_wrappers()); ...
php
{ "resource": "" }
q238272
Path.equals
train
public function equals($path) { $p = Path::info($path); return $p->normalize()->get() === $this->normalize()->get(); }
php
{ "resource": "" }
q238273
Path.dir
train
public function dir() { $dir = clone $this; if ($this->lastPart === '') { // already dir } else if ($this->lastPart === '..' || $this->lastPart === '.') { $dir->parts[] = ''; } else { array_pop($dir->parts); $dir->parts[] = ''; } $dir->setParts($dir->parts); return $dir; }
php
{ "resource": "" }
q238274
Path.resolve
train
public function resolve($path) { if ($path instanceof Path) { $add = clone $path; } else if (is_string($path)) { $add = new Path($path); } else { throw new \InvalidArgumentException(); } $base = clone $this; if ($base->partCount === 0) { return $add; } if ($add->isAbsolute()) { ret...
php
{ "resource": "" }
q238275
Router.triggerError
train
public function triggerError($errorCode, $errorMessage = '') { $callError = $errorCode; if (!isset($this->error[$errorCode]) || !is_callable($this->error[$errorCode])) { if (isset($this->error[0]) && is_callable($this->error[0])) { $callError = 0; } else { ...
php
{ "resource": "" }
q238276
Producer.addJob
train
public function addJob($queue, Job $job, $maxlen = 0, $async = false) { $command = [ 'ADDJOB', $queue, $job->getBody(), $this->getReplicationTimeout(), 'REPLICATE', $this->getReplicationFactor(), 'DELAY', $job->getDelay(), '...
php
{ "resource": "" }
q238277
FileController.show
train
public function show($id) { $file = $this->repository->getById($id); if (!$file) { return $this->errorNotFound(); } $this->authorize('read', $file); return new FileResource($file); }
php
{ "resource": "" }
q238278
Table.setHeading
train
public function setHeading($column) { $columns = is_array($column) ? $column : func_get_args(); $this->_head = array_values($columns); return $this; }
php
{ "resource": "" }
q238279
Table.setRow
train
public function setRow($column) { $columns = is_array($column) ? $column : func_get_args(); // If this is a sequential array if (array_keys($columns) === range(0, count($columns) - 1)) { $assocArray = array(); for($i=0;$i<count($this...
php
{ "resource": "" }
q238280
Table.setRows
train
public function setRows(array $rows) { if (isset($rows['_head'])) { $this->setHeading($rows['_head']); unset($rows['_head']); } if (!empty($rows)) { foreach($rows as $row) { $this->setRow($row); } } ...
php
{ "resource": "" }
q238281
Table.render
train
public function render() { // Render the table container $output = "<table {$this->renderAttributes()} >\n\t<tbody>\n"; // Render the heading $output .= "\t\t<th>\n"; foreach ($this->_head as $heading) { $output .= "\t\t\t<t...
php
{ "resource": "" }
q238282
AbstractNode.getElementType
train
protected function getElementType() { $class = $this->getElementClass($this); $parts = explode('\\', $class); $type = end($parts); $replace = '$1_$2'; return ctype_lower($type) ? $type : strtolower(preg_replace('/(.)([A-Z])/', $replace, $type)); }
php
{ "resource": "" }
q238283
AbstractNode.getJavascriptNodeName
train
protected function getJavascriptNodeName(ElementInterface $element) { $class = $this->getElementClass($element); $parts = explode('\\', $class); return 'GForm' . end($parts); }
php
{ "resource": "" }
q238284
Configuration.define
train
public static function define($section, \Closure $closure) { $config = call_user_func($closure, self::getInstance()); if (! is_array($config)) { throw new \Exception("You should return an array in the Configuration::define closure!"); } self::getInstance()->add($section,...
php
{ "resource": "" }
q238285
Configuration.getSection
train
public function getSection($section, $default = -1) { // Return if section is defined. if (isset($this->config[$section])) { return $this->config[$section]; } if ($default !== -1) { return $default; } // Find the default value (in default conf...
php
{ "resource": "" }
q238286
Configuration.add
train
public function add($section, $config = array()) { if (! isset($this->config[$section])) { $this->config[$section] = array(); } $this->config[$section] = array_merge($this->config[$section], $config); }
php
{ "resource": "" }
q238287
Configuration.doGetSection
train
private function doGetSection($section) { return isset($this->config[$section]) ? $this->config[$section] : null; }
php
{ "resource": "" }
q238288
Preparing.prepare
train
protected function prepare () { $request = & $this->request; // store original path value for later use $request->SetOriginalPath($request->GetPath(TRUE)); // switching media site version and targeting localized version // will be only by GET method, other methods are not very useful // to localize or t...
php
{ "resource": "" }
q238289
Preparing.setUpSession
train
protected function setUpSession () { if ($this->session === NULL) { $sessionClass = $this->application->GetSessionClass(); $selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__; $this->session = $sessionClass::GetNamespace($selfClass); $this->session->SetExpirationSeconds($this->...
php
{ "resource": "" }
q238290
RepositoryFactory.register
train
private function register( Entity $meta, Repository $repository ): self { $this->repositories = $this->repositories->put( $meta, $repository ); return $this; }
php
{ "resource": "" }
q238291
Chain.addParser
train
public function addParser(SymbolParserInterface $parser) { if ($parser instanceof self) { // Reducing recursivity $this->addParsers($parser->parsers); } else { $this->parsers[] = $parser; } return $this; }
php
{ "resource": "" }
q238292
Session.set
train
public static function set($var, $value) { // var_dump($var." ".$value); Session::init(true); if (!Session::check_checksum()) return false; $_SESSION[$var] = $value; $_SESSION[__SESSION_checksum_var] = Session::make_checksum(); return $value; }
php
{ "resource": "" }
q238293
Session._unset
train
public static function _unset($var) { Session::init(true); if (!Session::check_checksum()) return false; unset($_SESSION[$var]); $_SESSION[__SESSION_checksum_var] = Session::make_checksum(); return true; }
php
{ "resource": "" }
q238294
Session.make_checksum
train
private static function make_checksum() { $ret = ""; $_SESSION[__SESSION_time_var] = \AsyncWeb\Date\Time::get(); if (isset($_SESSION) && is_array($_SESSION)) foreach ($_SESSION as $s => $v) { if ($s != __SESSION_checksum_var) { $ret = md5($ret . $s); } ...
php
{ "resource": "" }
q238295
Isbn.validateIsbn10
train
private function validateIsbn10(): bool { $value = \str_replace(['-', ' '], '', $this->value); if (!\preg_match($this->patterns['isbn10-basic'], $value)) { $this->setError(self::VALIDATOR_ERROR_ISBN_INCORRECT_FORMAT); return false; } $sum = 0; for ($i...
php
{ "resource": "" }
q238296
Isbn.validateAuto
train
private function validateAuto(): bool { if (\preg_match($this->patterns['isbn13-basic'], $this->value)) { return $this->validateIsbn13(); } if (\preg_match($this->patterns['isbn13-separated'], $this->value) && \strlen($this->value) == 17) { return $this->validateIsbn1...
php
{ "resource": "" }
q238297
Exception.logException
train
public function logException(\Exception $e) { $error = $e->getMessage() . $e->getTraceAsString(); return $this->logEmergency($error); }
php
{ "resource": "" }
q238298
iauUtcut1.Utcut1
train
public static function Utcut1($utc1, $utc2, $dut1, &$ut11, &$ut12) { $iy; $im; $id; $js; $jw; $w; $dat; $dta; $tai1; $tai2; /* Look up TAI-UTC. */ if (IAU::Jd2cal($utc1, $utc2, $iy, $im, $id, $w)) return -1; $js = IAU::Dat($iy, $im, $id, 0.0, $dat); if ($js...
php
{ "resource": "" }
q238299
NodeValidator.validateByOnlyOne
train
public function validateByOnlyOne($nodeType, TreeInterface $tree) { if (!$nodeType) { return true; } $config = $this->getNodeTypeConfig($nodeType); if (null === $config) { return false; } if ($config->isOnlyOne()) { return !in_arr...
php
{ "resource": "" }