_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q6500
AdvancedSearchable.resolveSearchKeywords
train
protected function resolveSearchKeywords(string $keyword): array { $basic = []; $advanced = []; $tags = \array_map(function ($value) { [$tag, ] = \explode(':', $value, 2); return "{$tag}:"; }, \array_keys($this->getSearchableRules())); if (\preg_match_all('/([\w]+:\"[\w\s]*\"|[\w]+:[\w\S]+|[\w\S]+)\s?/', $keyword, $keywords)) {
php
{ "resource": "" }
q6501
TreeNodeSurv.loadNodeCache
train
public function loadNodeCache($nID = -3, $nCache = []) { if (sizeof($nCache) > 0) { if (isset($nCache["pID"])) { $this->parentID = $nCache["pID"]; } if (isset($nCache["pOrd"])) { $this->parentOrd = $nCache["pOrd"]; } if (isset($nCache["opts"])) { $this->nodeOpts = $nCache["opts"];
php
{ "resource": "" }
q6502
GlobalsTables.getTblFldTypes
train
public function getTblFldTypes($tbl) { $flds = []; if (isset($this->fldTypes[$tbl]) && sizeof($this->fldTypes[$tbl]) > 0) { $flds = $this->fldTypes[$tbl]; } else { $tblRow = SLTables::where('TblName', $tbl) ->first(); if ($tblRow) { $chk = SLFields::where('FldTable', $tblRow->TblID) ->orderBy('FldOrd', 'asc')
php
{ "resource": "" }
q6503
SurvLoopController.checkSystemInit
train
public function checkSystemInit() { if (!session()->has('chkSysInit') || $GLOBALS["SL"]->REQ->has('refresh')) { $sysChk = User::select('id') ->get(); if ($sysChk->isEmpty()) { return $this->freshUser($GLOBALS["SL"]->REQ); } $sysChk = SLDatabases::select('DbID') ->where('DbUser', '>', 0) ->get(); if ($sysChk->isEmpty()) { return $this->redir('/fresh/database', true);
php
{ "resource": "" }
q6504
SurvLoopController.isPageFirstTime
train
protected function isPageFirstTime($currPage = '') { if (trim($currPage) == '') { $currPage = $this->v["currPage"][0]; } $chk =
php
{ "resource": "" }
q6505
SurvLoopController.doublecheckSurvTables
train
protected function doublecheckSurvTables() { if (!session()->has('doublecheckSurvTables')) { $chks = []; $chks[] = "ALTER TABLE `SL_Tree` CHANGE `TreeRootURL` `TreeSlug` VARCHAR(255)"; $chks[] = "ALTER TABLE `SL_Tree` ADD `TreeOpts` INT(11) DEFAULT 1 AFTER `TreeCoreTable`"; $chks[] = "ALTER TABLE `SL_DesignTweaks` ADD `TweakUniqueStr` INT(11) DEFAULT NULL AFTER `TweakVersionAB`"; $chks[] = "ALTER TABLE `SL_DesignTweaks` ADD `TweakIsMobile` VARCHAR(50) DEFAULT NULL AFTER " . "`TweakUniqueStr`"; ob_start();
php
{ "resource": "" }
q6506
UpdatePasswordController.runUpdate
train
public function runUpdate(Request $request) { $user = User::find(Auth::id()); $this->validate($request, [ 'old' => 'required', 'password' => 'required|min:8|confirmed', ]); if (Auth::attempt(['name' => $user->name, 'password' => $request->old])) { $user->fill([ 'password' => bcrypt($request->password) ])->save(); $request->session()->flash('success', 'Your password
php
{ "resource": "" }
q6507
PHPArray.encode
train
protected function encode($data) { $data = [ '<?php', '',
php
{ "resource": "" }
q6508
HumanDate.transform
train
public function transform($date) { if (!$date instanceof DateTime) { $date = new DateTime($date); } $current = new DateTime('now'); if ($this->isToday($date)) { return $this->trans('Today'); } if ($this->isYesterday($date)) { return $this->trans('Yesterday'); } if ($this->isTomorrow($date)) { return $this->trans('Tomorrow'); } if ($this->isNextWeek($date)) { return $this->trans('Next %weekday%', [ '%weekday%' =>
php
{ "resource": "" }
q6509
AttributeAttributeType.copy
train
public function copy($deepCopy = false) { // we use get_class(), because this might be a subclass $clazz = get_class($this);
php
{ "resource": "" }
q6510
AttributeAttributeType.setAttribute
train
public function setAttribute(ChildAttribute $v = null) { if ($v === null) { $this->setAttributeId(NULL); } else { $this->setAttributeId($v->getId()); } $this->aAttribute = $v; // Add binding for other direction of this n:n relationship. // If this object
php
{ "resource": "" }
q6511
AttributeAttributeType.getAttribute
train
public function getAttribute(ConnectionInterface $con = null) { if ($this->aAttribute === null && ($this->attribute_id !== null)) { $this->aAttribute = AttributeQuery::create()->findPk($this->attribute_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in
php
{ "resource": "" }
q6512
AttributeAttributeType.getAttributeType
train
public function getAttributeType(ConnectionInterface $con = null) { if ($this->aAttributeType === null && ($this->attribute_type_id !== null)) { $this->aAttributeType = ChildAttributeTypeQuery::create()->findPk($this->attribute_type_id, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since
php
{ "resource": "" }
q6513
AttributeAttributeType.initAttributeTypeAvMetas
train
public function initAttributeTypeAvMetas($overrideExisting = true) { if (null !== $this->collAttributeTypeAvMetas && !$overrideExisting) {
php
{ "resource": "" }
q6514
AttributeAttributeType.getAttributeTypeAvMetas
train
public function getAttributeTypeAvMetas($criteria = null, ConnectionInterface $con = null) { $partial = $this->collAttributeTypeAvMetasPartial && !$this->isNew(); if (null === $this->collAttributeTypeAvMetas || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collAttributeTypeAvMetas) { // return empty collection $this->initAttributeTypeAvMetas(); } else { $collAttributeTypeAvMetas = ChildAttributeTypeAvMetaQuery::create(null, $criteria) ->filterByAttributeAttributeType($this) ->find($con); if (null !== $criteria) { if (false !== $this->collAttributeTypeAvMetasPartial && count($collAttributeTypeAvMetas)) {
php
{ "resource": "" }
q6515
AttributeAttributeType.countAttributeTypeAvMetas
train
public function countAttributeTypeAvMetas(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collAttributeTypeAvMetasPartial && !$this->isNew(); if (null === $this->collAttributeTypeAvMetas || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collAttributeTypeAvMetas) { return 0; } if ($partial && !$criteria) { return count($this->getAttributeTypeAvMetas());
php
{ "resource": "" }
q6516
AttributeAttributeType.addAttributeTypeAvMeta
train
public function addAttributeTypeAvMeta(ChildAttributeTypeAvMeta $l) { if ($this->collAttributeTypeAvMetas === null) { $this->initAttributeTypeAvMetas(); $this->collAttributeTypeAvMetasPartial = true; }
php
{ "resource": "" }
q6517
AttributeAttributeType.getAttributeTypeAvMetasJoinAttributeAv
train
public function getAttributeTypeAvMetasJoinAttributeAv($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildAttributeTypeAvMetaQuery::create(null, $criteria);
php
{ "resource": "" }
q6518
ChainSearchProvider.getClient
train
public function getClient() { $client = $this->reduceFirst(function (SearchProviderInterface $provider) { return $provider->getClient(); }); if (null === $client) {
php
{ "resource": "" }
q6519
ChainSearchProvider.getIndex
train
public function getIndex($indexName) { return $this->reduceFirst(function (SearchProviderInterface $provider)
php
{ "resource": "" }
q6520
ChainSearchProvider.createDocument
train
public function createDocument($document, $uid, $indexName = '', $indexType = '')
php
{ "resource": "" }
q6521
ChainSearchProvider.addDocument
train
public function addDocument($indexName, $indexType, $document, $uid) { if ("" === $indexName && $document instanceof DocumentReference) { $indexName = $document->getIndexName(); } else { $indexName = $this->indexNamePrefix . $indexName; }
php
{ "resource": "" }
q6522
ChainSearchProvider.addDocuments
train
public function addDocuments($documents, $indexName = '', $indexType = '') { if ("" === $indexName && isset($documents[0])) { $indexName = $documents[0]->getIndexName(); } else { $indexName = $this->indexNamePrefix . $indexName; } $this->mapProviders(function (SearchProviderInterface $provider) use ($documents, $indexName, $indexType) { $documents = array_map(function (DocumentReference $document) use ($provider) { return $provider->createDocument( $document->getDocument(),
php
{ "resource": "" }
q6523
ChainSearchProvider.deleteDocument
train
public function deleteDocument($indexName, $indexType, $uid) { $this->mapProviders(function (SearchProviderInterface $provider) use ($indexName, $indexType, $uid) {
php
{ "resource": "" }
q6524
ChainSearchProvider.deleteIndex
train
public function deleteIndex($indexName) { $this->mapProviders(function (SearchProviderInterface $provider) use ($indexName) { try { $provider->deleteIndex($this->indexNamePrefix . $indexName);
php
{ "resource": "" }
q6525
ValidatingMiddleware.handle
train
public function handle($command, Closure $next) { if (property_exists($command, 'rules')
php
{ "resource": "" }
q6526
ValidatingMiddleware.validate
train
protected function validate($command) { if (method_exists($command, 'validate')) { $command->validate(); } $messages = property_exists($command, 'validationMessages') ?
php
{ "resource": "" }
q6527
ValidatingMiddleware.getData
train
protected function getData($command) { $data = []; foreach ((new ReflectionClass($command))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { $name = $property->getName(); $value = $property->getValue($command); if (in_array($name,
php
{ "resource": "" }
q6528
TelegramHandler.send
train
private function send($message) { $url = self::BASE_URI . $this->token . '/sendMessage'; $data = [ 'chat_id' => $this->chatId, 'text' => $message, 'disable_web_page_preview' => true // Just in case there is a link in the message ]; // Set HTML parse mode when HTML code is detected if (preg_match('/<[^<]+>/', $data['text']) !== false) { $data['parse_mode'] = 'HTML'; } if ($this->useCurl === true && extension_loaded('curl')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer); curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); $result = curl_exec($ch); if (!$result) { throw new \RuntimeException('Request to Telegram API failed: ' . curl_error($ch)); } } else { $opts = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($data), 'timeout' => $this->timeout, ], 'ssl' => [ 'verify_peer' => $this->verifyPeer, 'verify_peer_name' => $this->verifyPeer,
php
{ "resource": "" }
q6529
HttpTrait.getParameter
train
protected function getParameter($key, $type = Validate::TYPE_STRING, array $filter = array(), $title = null, $required = true) { $parameter = $this->request->getUri()->getParameter($key); if (isset($parameter)) {
php
{ "resource": "" }
q6530
HttpTrait.setBody
train
protected function setBody($data) { $this->responseWriter->setBody($this->
php
{ "resource": "" }
q6531
RedirectTrait.forward
train
protected function forward($source, array $parameters = array()) { $path = $this->reverseRouter->getPath($source, $parameters); if ($path !== null) { $this->request->setUri($this->request->getUri()->withPath($path)); $this->loader->load($this->request, $this->response,
php
{ "resource": "" }
q6532
RedirectTrait.redirect
train
protected function redirect($source, array $parameters = array(), $code = 307) { if ($source instanceof Url) { $url = $source->toString(); } elseif (filter_var($source, FILTER_VALIDATE_URL)) { $url = $source; } else { $url = $this->reverseRouter->getUrl($source, $parameters);
php
{ "resource": "" }
q6533
GeneratorService.generateRemotingApi
train
public function generateRemotingApi() { $list = array(); foreach($this->remotingBundles as $bundle) { $bundleRef = new \ReflectionClass($bundle); $controllerDir = new Finder(); $controllerDir->files()->in(dirname($bundleRef->getFileName()).'/Controller/')->name('/.*Controller\.php$/'); foreach($controllerDir as $controllerFile) { $controller = $bundleRef->getNamespaceName() . "\\Controller\\" . substr($controllerFile->getFilename(), 0, -4); $controllerRef = new \ReflectionClass($controller); foreach ($controllerRef->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
php
{ "resource": "" }
q6534
GeneratorService.tryToGetJoinColumnNameOfMappedBy
train
protected function tryToGetJoinColumnNameOfMappedBy($annotation){ $annotation = $this->tryToGetJoinColumnAnnotationOfMappedBy($annotation); if ($annotation !== null) { if ($annotation instanceof JoinColumn) { return $annotation->name; } else if ($annotation instanceof JoinColumns) { if (count($annotation->value) > 1) {
php
{ "resource": "" }
q6535
GeneratorService.tryToGetJoinColumnAnnotationOfMappedBy
train
protected function tryToGetJoinColumnAnnotationOfMappedBy($annotation){ $result = null; if($annotation->targetEntity && $annotation->mappedBy) { $result = $this->getAnnotation( $annotation->targetEntity, $annotation->mappedBy, 'Doctrine\ORM\Mapping\JoinColumn' ); if ($result === null) { $result = $this->getAnnotation(
php
{ "resource": "" }
q6536
GeneratorService.getEntityColumnType
train
public function getEntityColumnType($entity, $property) { $classRef = new \ReflectionClass($entity); if ($classRef->hasProperty($property)) { $propertyRef = $classRef->getProperty($property); $columnRef = $this->annoReader->getPropertyAnnotation($propertyRef, 'Doctrine\ORM\Mapping\Column'); } else { /** Can not find the property on the class. Check the all the Column annotation */ foreach ($classRef->getProperties() as $propertyRef) { $columnRef = $this->annoReader->getPropertyAnnotation($propertyRef, 'Doctrine\ORM\Mapping\Column'); if ($columnRef->name == $property) { break; } else { $columnRef = null; } } }
php
{ "resource": "" }
q6537
GeneratorService.getValidator
train
protected function getValidator($name, $annotation) { $validate = array(); switch($name) { case 'NotBlank': case 'NotNull': $validate['type'] = "presence"; break; case 'Email': $validate['type'] = "email"; break; case 'Length': $validate['type'] = "length"; $validate['max'] = (int)$annotation->max; $validate['min'] = (int)$annotation->min; break; case 'Regex': if ($annotation->match) { $validate['type'] = "format"; $validate['matcher']['skipEncode'] = true; $validate['matcher']['value'] = $annotation->pattern; } break; case 'MaxLength': case 'MinLength': $validate['type'] = "length";
php
{ "resource": "" }
q6538
GeneratorService.getModelName
train
public function getModelName($entity) { $classRef = new \ReflectionClass($entity); $classModelAnnotation = $this->annoReader->getClassAnnotation($classRef, 'Tpg\ExtjsBundle\Annotation\Model'); if ($classModelAnnotation !== null) { if ($classModelAnnotation->name) {
php
{ "resource": "" }
q6539
Dispatch.route
train
public function route(RequestInterface $request, ResponseInterface $response, Context $context = null) { $this->level++; $this->eventDispatcher->dispatch(Event::REQUEST_INCOMING, new RequestIncomingEvent($request)); // load controller if ($context === null) { $factory = $this->config->get('psx_context_factory'); if ($factory instanceof \Closure) { $context = $factory(); } else { $context = new Context(); } } try { $this->loader->load($request, $response, $context); } catch (StatusCode\NotModifiedException $e) { $response->setStatus($e->getStatusCode()); $response->setBody(new StringStream()); } catch (StatusCode\RedirectionException $e) { $response->setStatus($e->getStatusCode()); $response->setHeader('Location', $e->getLocation()); $response->setBody(new StringStream()); } catch (\Throwable $e) { $this->eventDispatcher->dispatch(Event::EXCEPTION_THROWN, new ExceptionThrownEvent($e, new ControllerContext($request, $response))); $this->handleException($e, $response); try { $context->setException($e); $class = isset($this->config['psx_error_controller']) ? $this->config['psx_error_controller'] : ErrorController::class; $controller = $this->controllerFactory->getController($class, $context); $this->loader->execute($controller, $request, $response); } catch (\Throwable $e) {
php
{ "resource": "" }
q6540
Queue.consume
train
public static function consume($name) { $config = static::get($name); if (empty($config['consume'])) { throw new Exception('Missing consumer configuration (' . $name . ')'); } $config = $config['consume']; $config += [ 'connection' => 'rabbit', 'prefetchCount' => 1, ]; if (!array_key_exists($name, static::$_consumers)) {
php
{ "resource": "" }
q6541
Queue.publish
train
public static function publish($name, $data, array $options = []) { $config = static::get($name); if (empty($config['publish'])) { throw new Exception('Missing publisher configuration (' . $name . ')'); } $config = $config['publish']; $config += $options; $config += [ 'connection' => 'rabbit', 'className' => 'RabbitMQ.RabbitQueue' ]; if (!array_key_exists($name, static::$_publishers))
php
{ "resource": "" }
q6542
ExtjsExtension.injectModel
train
public function injectModel() { $params = func_get_args(); $injection = array_shift($params); if ($injection == false) { $url = $this->router->generate('extjs_generate_model', array('model'=>$params), false);
php
{ "resource": "" }
q6543
MenuItemsTable.beforeSave
train
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options): void { // fallback to default icon if (!$entity->get('icon')) {
php
{ "resource": "" }
q6544
ObjectTrait.set
train
public function set($name, $value, $where = '') { if (($name && $this->canSetProperty($name)) || strpos($name, 'on ') === 0 || strpos($name, 'as ') === 0) {
php
{ "resource": "" }
q6545
ObjectTrait.add
train
public function add($name, $value = null, $where = '') { if (!$this->has($name)) {
php
{ "resource": "" }
q6546
FileCommentCopyrightSniff.processCopyrightTags
train
private function processCopyrightTags(File $phpcs_file, $stack_ptr, $comment_start): void { $tokens = $phpcs_file->getTokens(); foreach ($tokens[$comment_start]['comment_tags'] as $tag) { if ($tokens[$tag]['content'] === $this->copyright_tag) { $this->checkForContentInCopyrightTag($phpcs_file, $tag, $tokens[$comment_start]['comment_closer']); //Use default PEAR style copyright notation checking. $this->processCopyright($phpcs_file, [$tag]); return; } } //No @copyright tag because not returned $error = 'Missing ' . $this->copyright_tag . ' tag in file doc-block'; if (false === $phpcs_file->addFixableError($error, $stack_ptr, 'MissingCopyrightTag')) { return; } if ($tokens[$tokens[$comment_start]['comment_closer']]['line'] ===
php
{ "resource": "" }
q6547
ManagerTrait.getItem
train
public function getItem($name, $default = null) { if (empty($this->_items[$name])) { $this->_items[$name] = $default;
php
{ "resource": "" }
q6548
ManagerTrait.getItems
train
public function getItems() { foreach ($this->_items as $name
php
{ "resource": "" }
q6549
UriExtended.withoutQueryValue
train
public function withoutQueryValue($key):UriExtended{ $current = $this->getQuery(); if($current === ''){ return $this; } $decodedKey = \rawurldecode($key); $result = \array_filter(\explode('&', $current), function($part) use
php
{ "resource": "" }
q6550
AttributeType.initAttributeAttributeTypes
train
public function initAttributeAttributeTypes($overrideExisting = true) { if (null !== $this->collAttributeAttributeTypes && !$overrideExisting) {
php
{ "resource": "" }
q6551
AttributeType.getAttributeAttributeTypes
train
public function getAttributeAttributeTypes($criteria = null, ConnectionInterface $con = null) { $partial = $this->collAttributeAttributeTypesPartial && !$this->isNew(); if (null === $this->collAttributeAttributeTypes || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collAttributeAttributeTypes) { // return empty collection $this->initAttributeAttributeTypes(); } else { $collAttributeAttributeTypes = ChildAttributeAttributeTypeQuery::create(null, $criteria) ->filterByAttributeType($this) ->find($con); if (null !== $criteria) { if (false !== $this->collAttributeAttributeTypesPartial && count($collAttributeAttributeTypes)) {
php
{ "resource": "" }
q6552
AttributeType.countAttributeAttributeTypes
train
public function countAttributeAttributeTypes(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collAttributeAttributeTypesPartial && !$this->isNew(); if (null === $this->collAttributeAttributeTypes || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collAttributeAttributeTypes) { return 0; } if ($partial && !$criteria) { return count($this->getAttributeAttributeTypes());
php
{ "resource": "" }
q6553
AttributeType.addAttributeAttributeType
train
public function addAttributeAttributeType(ChildAttributeAttributeType $l) { if ($this->collAttributeAttributeTypes === null) { $this->initAttributeAttributeTypes(); $this->collAttributeAttributeTypesPartial = true; }
php
{ "resource": "" }
q6554
AttributeType.getAttributeAttributeTypesJoinAttribute
train
public function getAttributeAttributeTypesJoinAttribute($criteria = null, $con = null, $joinBehavior = Criteria::LEFT_JOIN) {
php
{ "resource": "" }
q6555
AttributeType.initAttributeTypeI18ns
train
public function initAttributeTypeI18ns($overrideExisting = true) { if (null !== $this->collAttributeTypeI18ns && !$overrideExisting) {
php
{ "resource": "" }
q6556
AttributeType.getAttributeTypeI18ns
train
public function getAttributeTypeI18ns($criteria = null, ConnectionInterface $con = null) { $partial = $this->collAttributeTypeI18nsPartial && !$this->isNew(); if (null === $this->collAttributeTypeI18ns || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collAttributeTypeI18ns) { // return empty collection $this->initAttributeTypeI18ns(); } else { $collAttributeTypeI18ns = ChildAttributeTypeI18nQuery::create(null, $criteria) ->filterByAttributeType($this) ->find($con); if (null !== $criteria) { if (false !== $this->collAttributeTypeI18nsPartial && count($collAttributeTypeI18ns)) {
php
{ "resource": "" }
q6557
AttributeType.countAttributeTypeI18ns
train
public function countAttributeTypeI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collAttributeTypeI18nsPartial && !$this->isNew(); if (null === $this->collAttributeTypeI18ns || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collAttributeTypeI18ns) { return 0; } if ($partial && !$criteria) { return count($this->getAttributeTypeI18ns());
php
{ "resource": "" }
q6558
AttributeType.addAttributeTypeI18n
train
public function addAttributeTypeI18n(ChildAttributeTypeI18n $l) { if ($l && $locale = $l->getLocale()) { $this->setLocale($locale); $this->currentTranslations[$locale] = $l; } if ($this->collAttributeTypeI18ns === null) { $this->initAttributeTypeI18ns(); $this->collAttributeTypeI18nsPartial = true;
php
{ "resource": "" }
q6559
AttributeType.validate
train
public function validate(Validator $validator = null) { if (null === $validator) { $validator = new Validator(new ClassMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory(), new DefaultTranslator()); } $failureMap = new ConstraintViolationList(); if (!$this->alreadyInValidation) { $this->alreadyInValidation = true; $retval = null; $retval = $validator->validate($this); if (count($retval) > 0) { $failureMap->addAll($retval); } if (null !== $this->collAttributeAttributeTypes) { foreach ($this->collAttributeAttributeTypes as $referrerFK) { if (method_exists($referrerFK, 'validate')) { if (!$referrerFK->validate($validator)) { $failureMap->addAll($referrerFK->getValidationFailures()); } }
php
{ "resource": "" }
q6560
RabbitMQConnection.logQueries
train
public function logQueries($enable = null) { if ($enable !== null) { $this->_logQueries = $enable; } if ($this->_logQueries) { return
php
{ "resource": "" }
q6561
RabbitMQConnection.logger
train
public function logger($logger = null) { if ($logger) { $this->_logger = $logger; } if ($this->_logger) { return $this->_logger;
php
{ "resource": "" }
q6562
RabbitMQConnection.connect
train
public function connect() { $connection = $this->_connection; $connection->setLogin($this->_config['user']); $connection->setPassword($this->_config['password']); $connection->setHost($this->_config['host']); $connection->setPort($this->_config['port']); $connection->setVhost($this->_config['vhost']); $connection->setReadTimeout($this->_config['readTimeout']); # You shall not use persistent connections #
php
{ "resource": "" }
q6563
RabbitMQConnection.channel
train
public function channel($name, $options = []) { if (empty($this->_channels[$name])) { $this->_channels[$name] = new AMQPChannel($this->connection());
php
{ "resource": "" }
q6564
RabbitMQConnection.exchange
train
public function exchange($name, $options = []) { if (empty($this->_exchanges[$name])) { $channel = $this->channel($name, $options); $exchange = new AMQPExchange($channel); $exchange->setName($name);
php
{ "resource": "" }
q6565
RabbitMQConnection.queue
train
public function queue($name, $options = []) { if (empty($this->_queues[$name])) { $channel = $this->channel($name, $options); $queue = new AMQPQueue($channel); $queue->setName($name); if (!empty($options['flags'])) {
php
{ "resource": "" }
q6566
RabbitMQConnection._prepareMessage
train
protected function _prepareMessage($data, array $options) { $attributes = []; $options += [ 'silent' => false, 'compress' => true, 'serializer' => extension_loaded('msgpack') ? 'msgpack' : 'json', 'delivery_mode' => 1 ]; switch ($options['serializer']) { case 'json': $data = json_encode($data); $attributes['content_type'] = 'application/json'; break; case 'text': $attributes['content_type'] = 'application/text'; break;
php
{ "resource": "" }
q6567
TreeSurvBasicNav.chkKidMapTrue
train
protected function chkKidMapTrue($nID) { $found = false; if (sizeof($this->kidMaps) > 0) { foreach ($this->kidMaps as $parent => $kids) { if (sizeof($kids) > 0) { foreach ($kids as $nKid => $ress) { if ($nID == $nKid && sizeof($ress) > 0) {
php
{ "resource": "" }
q6568
Contentful.getContentTypeByName
train
public function getContentTypeByName($name, $space, array $options = []) { $envelope = $this->findEnvelopeForSpace($space); $promise = coroutine( function () use ($name, $space, $envelope, $options) { $contentTypeFromEnvelope = $envelope->findContentTypeByName($name); if ($contentTypeFromEnvelope) { yield promise_for($contentTypeFromEnvelope);
php
{ "resource": "" }
q6569
Contentful.flushCache
train
public function flushCache($spaceName) { $spaceData = $this->getSpaceDataForName($spaceName);
php
{ "resource": "" }
q6570
Contentful.completeParameter
train
private function completeParameter(ParameterInterface $parameter, $spaceName) { if (!$parameter instanceof IncompleteParameterInterface) { return $parameter; } switch ($parameter->getName()) { case 'content_type_name': $contentTypeFilter = $this->resolveContentTypeNameFilter($parameter, $spaceName); if (null === $contentTypeFilter) { throw new \RuntimeException(sprintf('Could not resolve content type with name "%s".', $parameter->getValue())); }
php
{ "resource": "" }
q6571
SchemaApiAbstract.parseRequest
train
protected function parseRequest(RequestInterface $request, MethodAbstract $method) { if ($method->hasRequest()) { $schema = $method->getRequest(); if ($schema instanceof Passthru) { $data = $this->requestReader->getBody($request); } elseif ($schema instanceof SchemaInterface) { $data =
php
{ "resource": "" }
q6572
SchemaApiAbstract.sendResponse
train
private function sendResponse(MethodAbstract $method, RequestInterface $request, ResponseInterface $response, $data) { $statusCode = $response->getStatusCode(); if (empty($statusCode)) { // in case we have only one defined response use this code
php
{ "resource": "" }
q6573
SchemaApiAbstract.getResource
train
private function getResource() { $resource = $this->resourceListing->getResource($this->context->getPath(), $this->context->getVersion()); if (!$resource instanceof Resource) {
php
{ "resource": "" }
q6574
ContentTypePromise.getField
train
public function getField($fieldId) { $resolved = $this->getResolved(); if (!$resolved
php
{ "resource": "" }
q6575
UserProvider.get
train
public function get(string $key = null, $default = null) { $key = \str_replace('.', '/user-', $key); $value = Arr::get($this->items, $key); // We need to consider if the value pending to be deleted, // in this case return the default. if ($value === ':to-be-deleted:') { return \value($default); } // If the result is available from data, simply return it so we // don't have to fetch the same result again from the database.
php
{ "resource": "" }
q6576
Python.isJson
train
protected function isJson($string) { $output = json_decode($string, true); if ($output === null) {
php
{ "resource": "" }
q6577
BasicDocumentor.getTemplate
train
protected static function getTemplate($path) { if(file_exists($path)) $template = file_get_contents($path); elseif(file_exists(__DIR__ . '/templates/' . $path)) $template =
php
{ "resource": "" }
q6578
RedisSessionHandler.read
train
public function read($sessionId) { $sessionId = $this->keyPrefix . $sessionId; $sessionData = $this->redis->get($sessionId);
php
{ "resource": "" }
q6579
NotFoundManager.removeForRedirect
train
public function removeForRedirect(Redirect $redirect) { $notFounds = $this->om->getRepository($this->class)->findBy(array('path' => $redirect->getSource()));
php
{ "resource": "" }
q6580
PublicNodeVersions.getRef
train
public function getRef($nodeVersionId) { $this->initNodeVersions();
php
{ "resource": "" }
q6581
PublicNodeVersions.getNodeRef
train
public function getNodeRef($nodeId, $lang = null) { $this->initNodeVersions(); $lang = $lang ?: $this->currentLocale->getCurrentLocale();
php
{ "resource": "" }
q6582
Parser.read
train
public function read($filePath) { $this->rawEntries = array(); $this->currentEntry = $this->createNewEntryAsArray(); $this->state = null; $this->justNewEntry = false; $handle = $this->openFile($filePath); while (!feof($handle)) { $line = trim(fgets($handle));
php
{ "resource": "" }
q6583
Parser.prepareResults
train
protected function prepareResults() { $this->entriesAsArrays = array(); $this->entries = array(); $this->headers = array(); $counter = 0; foreach ($this->rawEntries as $entry) { $entry = $this->prepareEntry($entry, $counter); $id = $this->getMsgId($entry);
php
{ "resource": "" }
q6584
Parser.removeFuzzyFlagForMsgId
train
protected function removeFuzzyFlagForMsgId($msgid) { if (!isset($this->entriesAsArrays[$msgid])) { throw new \Exception('Entry does not exist'); } if ($this->entriesAsArrays[$msgid]['fuzzy']) { $flags = $this->entriesAsArrays[$msgid]['flags'];
php
{ "resource": "" }
q6585
Parser.updateEntries
train
public function updateEntries($msgid, $translation) { if ( !isset($this->entriesAsArrays[$msgid]) || !is_array($translation) || sizeof($translation) != sizeof($this->entriesAsArrays[$msgid]['msgstr']) ) {
php
{ "resource": "" }
q6586
Parser.updateEntry
train
public function updateEntry($msgid, $translation, $positionMsgstr = 0) { if ( !isset($this->entriesAsArrays[$msgid]) || !is_string($translation) || !isset($this->entriesAsArrays[$msgid]['msgstr'][$positionMsgstr]) ) {
php
{ "resource": "" }
q6587
AdminDatabaseInstall.manualMySql
train
public function manualMySql(Request $request) { $this->admControlInit($request, '/dashboard/db/all'); if ($this->v["uID"] == 1) { // && in_array($_SERVER["REMOTE_ADDR"], ['192.168.10.1'])) { $this->v["manualMySql"] = 'Connected successfully<br />'; $db = mysqli_connect(env('DB_HOST', 'localhost'), env('DB_USERNAME', 'homestead'), env('DB_PASSWORD', 'secret'), env('DB_DATABASE', 'homestead')); if ($db->connect_error) { $this->v["manualMySql"] = "Connection failed: " . $db->connect_error . '<br />'; } $this->v["lastSql"] = ''; $this->v["lastResults"] = []; if ($request->has('mys') && trim($request->mys) != '') { $this->v["lastSql"] = trim($request->mys); $this->v["manualMySql"] .= '<b>Statements submitted...</b><br />'; $statements = $GLOBALS["SL"]->mexplode(';', $request->mys); foreach ($statements as $sql) { $cnt = 0; if (trim($sql) != '') { ob_start(); $res = mysqli_query($db, $sql);
php
{ "resource": "" }
q6588
Metable.getOriginalMetaData
train
public function getOriginalMetaData(string $key, $default = null) {
php
{ "resource": "" }
q6589
Metable.getMetaData
train
public function getMetaData(string $key, $default = null) { $meta
php
{ "resource": "" }
q6590
Metable.putMetaData
train
public function putMetaData($key, $value = null): void { $meta = $this->getAttribute('meta'); if (\is_array($key)) { foreach ($key as $name => $value) { $meta->put($name, $value);
php
{ "resource": "" }
q6591
Metable.forgetMetaData
train
public function forgetMetaData($key): void { $meta = $this->getAttribute('meta'); if (\is_array($key)) { foreach ($key as $name) { $meta->forget($name);
php
{ "resource": "" }
q6592
Metable.accessMetableAttribute
train
protected function accessMetableAttribute($value): Meta { $meta = []; if ($value instanceof Meta) { return $value; } elseif (! \is_null($value)) {
php
{ "resource": "" }
q6593
TreeSurvNodeEdit.updateTreeOpts
train
public function updateTreeOpts($treeID = -3) { $treeRow = $GLOBALS["SL"]->treeRow; if ($treeID <= 0) { $treeID = $GLOBALS["SL"]->treeID; } else { $treeRow = SLTree::find($treeID); } if ($treeRow->TreeType == 'Page') { /* // auto-setting $skipConds = []; $testCond = SLConditions::where('CondTag', '#TestLink') ->where('CondDatabase', $treeRow->TreeDatabase) ->first(); if (!$testCond || !isset($testCond->CondID)) { $testCond = SLConditions::where('CondTag', '#TestLink')
php
{ "resource": "" }
q6594
Model.shard
train
static function shard($collector = null) { if (func_num_args()) { if ($collector) { static::$_shards[static::class] = $collector; } else { unset(static::$_shards[static::class]); } return;
php
{ "resource": "" }
q6595
Model.find
train
public static function find($options = []) { $options = Set::extend(static::query(), $options); $schema = static::definition();
php
{ "resource": "" }
q6596
Model.load
train
public static function load($id, $options = [], $fetchOptions = []) { $options
php
{ "resource": "" }
q6597
Model.reset
train
public static function reset() { unset(static::$_dependencies[static::class]); static::conventions(null); static::connection(null); static::definition(null); static::validator(null);
php
{ "resource": "" }
q6598
Model.fetch
train
public function fetch($name) { return $this->get($name, function($instance, $name) { $collection = [$instance]; $this->schema()->embed($collection, $name);
php
{ "resource": "" }
q6599
Model.sync
train
public function sync($data = false) { if ($this->_exists !== null) { return; } $id = $this->id(); if ($id !== null) { $persisted = static::load($id); if ($persisted && $data) { $this->amend($persisted->data(),
php
{ "resource": "" }