_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q6700
AttributeTypeAvMeta.getAttributeAv
train
public function getAttributeAv(ConnectionInterface $con = null) { if ($this->aAttributeAv === null && ($this->attribute_av_id !== null)) { $this->aAttributeAv = AttributeAvQuery::create()->findPk($this->attribute_av_id, $con); /* The following can be used additionally to ...
php
{ "resource": "" }
q6701
AttributeTypeAvMeta.setAttributeAttributeType
train
public function setAttributeAttributeType(ChildAttributeAttributeType $v = null) { if ($v === null) { $this->setAttributeAttributeTypeId(NULL); } else { $this->setAttributeAttributeTypeId($v->getId()); } $this->aAttributeAttributeType = $v; // Add bi...
php
{ "resource": "" }
q6702
AttributeTypeAvMeta.getAttributeAttributeType
train
public function getAttributeAttributeType(ConnectionInterface $con = null) { if ($this->aAttributeAttributeType === null && ($this->attribute_attribute_type_id !== null)) { $this->aAttributeAttributeType = ChildAttributeAttributeTypeQuery::create()->findPk($this->attribute_attribute_type_id, $co...
php
{ "resource": "" }
q6703
Owns.scopeOwns
train
public function scopeOwns(Builder $query, Model $related, ?string $foreignKey = null): Builder { if (\is_null($foreignKey)) { $foreignKey = $this->getForeignKey(); } return $query->where( $this->getKeyName(), $related->getAttribute($foreignKey) ); }
php
{ "resource": "" }
q6704
Collection.setAt
train
public function setAt($offset, $data, $options = []) { $keys = is_array($offset) ? $offset : ($offset !== null ? explode('.', $offset) : []); $name = array_shift($keys); if ($keys) { $this->get($name)->setAt($keys, $data, $options); } if ($schema = $this->schema(...
php
{ "resource": "" }
q6705
Collection.offsetExists
train
public function offsetExists($offset) { $keys = is_array($offset) ? $offset : explode('.', $offset); if (!$keys) { return false; } $name = array_shift($keys); if ($keys) { if (!array_key_exists($name, $this->_data)) { return false; ...
php
{ "resource": "" }
q6706
Collection.modified
train
public function modified($options = []) { $options += ['embed' => false]; if ($this->_modified) { return true; } foreach ($this->_data as $index => $entity) { if (is_object($entity) && method_exists($entity, 'modified') && $entity->modified($options)) { ...
php
{ "resource": "" }
q6707
Collection.errors
train
public function errors($options = []) { $errors = []; $errored = false; foreach ($this as $entity) { $result = $entity->errors($options); $errors[] = $result; if ($result) { $errored = true; } } return $errored ?...
php
{ "resource": "" }
q6708
Collection.hierarchy
train
public function hierarchy($prefix = '', &$ignore = [], $index = false) { $hash = spl_object_hash($this); if (isset($ignore[$hash])) { return false; } $ignore[$hash] = true; $result = []; foreach ($this as $entity) { if ($hierarchy = $entity->...
php
{ "resource": "" }
q6709
Handler.setDefaultOptions
train
protected function setDefaultOptions(OptionsResolver $resolver) { $resolver ->setDefaults(array( 'host' => function(Options $options) { if (isset($options['test']) && $options['test']) { return 'https://test-api.pin.net.au'; ...
php
{ "resource": "" }
q6710
DocBlock.addAnnotation
train
public function addAnnotation($key, $value) { if (!isset($this->annotations[$key])) { $this->annotations[$key] = array(); } $this->annotations[$key][] = $value; }
php
{ "resource": "" }
q6711
UploadableListener.postLoad
train
public function postLoad(LifecycleEventArgs $eventArgs) { $entityManager = $eventArgs->getEntityManager(); $object = $eventArgs->getEntity(); $uploadableMeta = $this->getObjectExtendedMetadata($entityManager, $object); if ($uploadableMeta->hasUploadableProperties()) { $t...
php
{ "resource": "" }
q6712
UploadableListener.preFlush
train
public function preFlush(PreFlushEventArgs $eventArgs) { $entityManager = $eventArgs->getEntityManager(); $unitOfWork = $entityManager->getUnitOfWork(); foreach ($unitOfWork->getIdentityMap() as $entities) { foreach ($entities as $object) { $uploadableMeta = $thi...
php
{ "resource": "" }
q6713
UploadableListener.loadFiles
train
protected function loadFiles( EntityManagerInterface $entityManager, $object, UploadableClassMetadata $uploadableMeta ): void { $this->assertIsObject($object); $propertyManipulator = $this->getPropertyManipulator($entityManager); foreach ($uploadableMeta->getUploadabl...
php
{ "resource": "" }
q6714
UploadableListener.getPropertyManipulator
train
private function getPropertyManipulator(EntityManagerInterface $entityManager): PropertyManipulator { $oid = spl_object_hash($entityManager); if (!isset($this->propertyManipulators[$oid])) { $this->propertyManipulators[$oid] = new PropertyManipulator(); } return $this->p...
php
{ "resource": "" }
q6715
AttributeTypeI18nTableMap.doDelete
train
public static function doDelete($values, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(AttributeTypeI18nTableMap::DATABASE_NAME); } if ($values instanceof Criteria) { // rename for clarity ...
php
{ "resource": "" }
q6716
AttributeTypeI18nTableMap.doInsert
train
public static function doInsert($criteria, ConnectionInterface $con = null) { if (null === $con) { $con = Propel::getServiceContainer()->getWriteConnection(AttributeTypeI18nTableMap::DATABASE_NAME); } if ($criteria instanceof Criteria) { $criteria = clone $criteria; ...
php
{ "resource": "" }
q6717
OciPdoAdapter.closeConnection
train
public function closeConnection() { if (is_resource($this->_dbh)) { $res = @oci_close($this->_dbh); $this->checkError($res); } else { $res = true; } return $res; }
php
{ "resource": "" }
q6718
OciPdoAdapter.getError
train
protected function getError() { if ($this->_error === false) { if (is_resource($this->_dbh)) { $this->_error = @oci_error($this->_dbh); } else { $this->_error = @oci_error(); } } return $this->_error; }
php
{ "resource": "" }
q6719
OciPdoAdapter.raiseError
train
public function raiseError() { $error = $this->getError(); if ($error === false) { return; } $this->_error = false; if ($error['offset'] == 0) { $message = sprintf('%s', $error['message']); } else { $message = sprintf('%s in %s at %s', $error['message'], $error['sqltext'], $error['offset']); ...
php
{ "resource": "" }
q6720
Buffer.first
train
public function first($options = []) { $result = $this->get($options); return is_object($result) ? $result->rewind() : reset($result); }
php
{ "resource": "" }
q6721
TranslatableListener.postLoad
train
public function postLoad(LifecycleEventArgs $eventArgs) { $this->loadTranslation( $eventArgs->getEntityManager(), $eventArgs->getEntity(), $this->getLocale() ); }
php
{ "resource": "" }
q6722
TranslatableListener.preFlush
train
public function preFlush(PreFlushEventArgs $eventArgs) { $entityManager = $eventArgs->getEntityManager(); $unitOfWork = $entityManager->getUnitOfWork(); foreach ($unitOfWork->getScheduledEntityInsertions() as $object) { $this->updateObjectTranslations($entityManager, $object); ...
php
{ "resource": "" }
q6723
TranslatableListener.updateObjectTranslations
train
private function updateObjectTranslations(EntityManagerInterface $entityManager, $object): void { $translatableMeta = $this->getTranslatableMetadata($entityManager, $object); if (!$translatableMeta->hasTranslatableProperties()) { return; } foreach ($translatableMeta->get...
php
{ "resource": "" }
q6724
Data.get
train
public function get($key, $default = null, $filter = null) { $result = $default; if ($this->has($key)) { $result = $this->offsetGet($key); } return $this->filter($result, $filter); }
php
{ "resource": "" }
q6725
Data.filter
train
protected function filter($value, $filter) { if (null !== $filter) { $value = Filter::_($value, $filter); } return $value; }
php
{ "resource": "" }
q6726
Data.is
train
public function is($key, $compareWith = true, $strictMode = false) { if (strpos($key, '.') === false) { $value = $this->get($key); } else { $value = $this->find($key); } if ($strictMode) { return $value === $compareWith; } /** @no...
php
{ "resource": "" }
q6727
Renderer.renderAxis
train
protected function renderAxis(AxisInterface $axis) { $options = array( 'opposite' => $axis->isOpposite(), 'showFirstLabel' => $axis->getLabel()->isShowFirst(), 'showLastLabel' => $axis->getLabel()->isShowLast(), ); if (0 < count($axis->getCategories())) {...
php
{ "resource": "" }
q6728
Renderer.renderDataPoint
train
protected function renderDataPoint(DataPointInterface $dataPoint) { $options = array(); if (null !== $dataPoint->getName()) { $options['name'] = $dataPoint->getName(); } if ($dataPoint instanceof PieDataPointInterface) { $options['sliced'] = $dataPoint->isSlic...
php
{ "resource": "" }
q6729
ReturnTypeDeclarationSniff.getClosingParenthesis
train
private function getClosingParenthesis(File $phpcs_file, array $tokens, $stack_ptr): int { $closing_parenthesis = $tokens[$stack_ptr]['parenthesis_closer']; // In case the function is a closure, the closing parenthesis // may be positioned after a use language construct. if ($tokens...
php
{ "resource": "" }
q6730
ReturnTypeDeclarationSniff.fixSpacing
train
private function fixSpacing(File $phpcs_file, $tokens, $required_spacing, $start, $end): void { if (($start + 1) === $end && empty($required_spacing) === false) { //insert whitespace if there is no whitespace, and whitespace is required $phpcs_file->fixer->addContent($start, $require...
php
{ "resource": "" }
q6731
UserProfile.updateProfile
train
public function updateProfile() { if ($this->v["uID"] > 0) { // $GLOBALS["SL"]->user() returns an instance of the authenticated user... if ($this->v["uID"] == $GLOBALS["SL"]->REQ->uID || $this->v["user"]->hasRole('administrator')) { $user = User::find($GLOBALS["SL"]->...
php
{ "resource": "" }
q6732
OciPdoLobStreamWrapper.getContext
train
public static function getContext(&$lob) { if (!self::$_isRegistered) { stream_wrapper_register(self::WRAPPER_NAME, get_class()); self::$_isRegistered = true; } return stream_context_create(array(self::WRAPPER_NAME => array('lob' => &$lob))); }
php
{ "resource": "" }
q6733
OciPdoLobStreamWrapper.stream_open
train
public function stream_open($path, $mode, $options, &$opened_path) { if (!preg_match('/^r[bt]?$/', $mode) || is_null($this->context)) { return false; } $opt = stream_context_get_options($this->context); if (!is_array($opt[self::WRAPPER_NAME]) || !isset($opt[self::WRAPPER_NAME]['lob'])) { return false; }...
php
{ "resource": "" }
q6734
TreeSurvAPI.checkViewDataPerms
train
public function checkViewDataPerms($fld) { if ($fld && isset($fld->FldOpts) && intVal($fld->FldOpts) > 0) { if ($fld->FldOpts%7 > 0 && $fld->FldOpts%11 > 0 && $fld->FldOpts%13 > 0) { return true; } if (in_array($GLOBALS["SL"]->x["pageView"], ['full', 'full...
php
{ "resource": "" }
q6735
CommitCommand.execute
train
protected function execute(InputInterface $input, OutputInterface $output) { // Welcome $output->writeln( '<info>Welcome to the Cypress GitElephantBundle commit command.</info>' ); if ($input->getOption('no-push')) { $output->writeln( '<comment...
php
{ "resource": "" }
q6736
Schema.lock
train
public function lock($locked = true) { $this->_locked = $locked === false ? false : true; return $this; }
php
{ "resource": "" }
q6737
Schema.fields
train
public function fields($basePath = '') { $fields = []; foreach ($this->names() as $name) { $fields[$name] = null; } $names = Set::expand($fields); if ($basePath) { $parts = explode('.', $basePath); foreach ($parts as $part) { ...
php
{ "resource": "" }
q6738
Schema.defaults
train
public function defaults($basePath = null) { $defaults = []; foreach ($this->_columns as $key => $value) { if ($basePath) { $fieldName = strpos($key, $basePath . '.') === 0 ? substr($key, strlen($basePath) + 1) : null; } else { $fieldName = $ke...
php
{ "resource": "" }
q6739
Schema.type
train
public function type($name) { if (!$this->has($name)) { return; } $column = $this->column($name); return isset($column['type']) ? $column['type'] : null; }
php
{ "resource": "" }
q6740
Schema.column
train
public function column($name, $params = []) { if (func_num_args() === 1) { if (!isset($this->_columns[$name])) { throw new ORMException("Unexisting column `'{$name}'`"); } return $this->_columns[$name]; } $column = $this->_initColumn($param...
php
{ "resource": "" }
q6741
Schema._initColumn
train
protected function _initColumn($column) { $defaults = [ 'type' => 'string', 'array' => false ]; if (is_string($column)) { $column = ['type' => $column]; } elseif (isset($column[0])) { $column['type'] = $column[0]; unset($co...
php
{ "resource": "" }
q6742
Schema.append
train
public function append($fields) { if (is_array($fields)) { foreach ($fields as $key => $value) { $this->column($key, $value); } } else { foreach ($fields->fields() as $name) { $this->column($name, $fields->column($name)); ...
php
{ "resource": "" }
q6743
Schema.virtuals
train
public function virtuals($attribute = null) { $fields = []; foreach ($this->_columns as $name => $field) { if (empty($field['virtual'])) { continue; } $fields[] = $name; } return $fields; }
php
{ "resource": "" }
q6744
Schema.belongsTo
train
public function belongsTo($name, $to, $config = []) { $defaults = [ 'to' => $to, 'relation' => 'belongsTo' ]; $config += $defaults; return $this->bind($name, $config); }
php
{ "resource": "" }
q6745
Schema.hasMany
train
public function hasMany($name, $to, $config = []) { $defaults = [ 'to' => $to, 'relation' => 'hasMany' ]; $config += $defaults; return $this->bind($name, $config); }
php
{ "resource": "" }
q6746
Schema.hasOne
train
public function hasOne($name, $to, $config = []) { $defaults = [ 'to' => $to, 'relation' => 'hasOne' ]; $config += $defaults; return $this->bind($name, $config); }
php
{ "resource": "" }
q6747
Schema.hasManyThrough
train
public function hasManyThrough($name, $through, $using, $config = []) { $defaults = [ 'through' => $through, 'using' => $using, 'relation' => 'hasManyThrough' ]; $config += $defaults; return $this->bind($name, $config); }
php
{ "resource": "" }
q6748
Schema.unbind
train
public function unbind($name) { if (!isset($this->_relations[$name])) { return; } unset($this->_relations[$name]); unset($this->_relationships[$name]); }
php
{ "resource": "" }
q6749
Schema.relation
train
public function relation($name) { if (isset($this->_relationships[$name])) { return $this->_relationships[$name]; } if (!isset($this->_relations[$name])) { throw new ORMException("Relationship `{$name}` not found."); } $config = $this->_relations[$name...
php
{ "resource": "" }
q6750
Schema.relations
train
public function relations($embedded = false) { $result = []; foreach ($this->_relations as $field => $config) { if (!$config['embedded'] || $embedded) { $result[] = $field; } } return $result; }
php
{ "resource": "" }
q6751
Schema.hasRelation
train
public function hasRelation($name, $embedded = null) { if (!isset($this->_relations[$name])) { return false; } $relation = $this->_relations[$name]; if ($embedded === null) { return true; } return $embedded === $relation['embedded']; }
php
{ "resource": "" }
q6752
Schema.embed
train
public function embed(&$collection, $relations, $options = []) { $expanded = []; $relations = $this->expand($relations); $tree = $this->treeify($relations); $habtm = []; foreach ($tree as $name => $subtree) { $rel = $this->relation($name); if ($rel->...
php
{ "resource": "" }
q6753
Schema.expand
train
public function expand($relations) { if (is_string($relations)) { $relations = [$relations]; } $relations = Set::normalize($relations); foreach ($relations as $path => $value) { $num = strpos($path, '.'); $name = $num !== false ? substr($path, 0, ...
php
{ "resource": "" }
q6754
Schema.treeify
train
public function treeify($embed) { if (!$embed) { return []; } $embed = Set::expand(Set::normalize((array) $embed), ['affix' => 'embed']); $result = []; foreach ($embed as $relName => $value) { if (!isset($this->_relations[$relName])) { ...
php
{ "resource": "" }
q6755
Schema.cast
train
public function cast($field = null, $data = [], $options = []) { $defaults = [ 'parent' => null, 'basePath' => null, 'exists' => null, 'defaults' => true ]; $options += $defaults; $options['class'] = $this->reference(); ...
php
{ "resource": "" }
q6756
Schema._relationCast
train
protected function _relationCast($field, $name, $data, $options) { $options = $this->_relations[$name] + $options; $options['basePath'] = $options['embedded'] ? $name : null; $options['schema'] = $options['embedded'] ? $this : null; if ($options['relation'] !== 'hasManyThrough') { ...
php
{ "resource": "" }
q6757
Schema._columnCast
train
protected function _columnCast($field, $name, $data, $options) { $column = $this->_columns[$name]; if (!empty($column['setter'])) { $data = $column['setter']($options['parent'], $data, $name); } if ($column['array'] && $field) { return $this->_castArray($name,...
php
{ "resource": "" }
q6758
Schema._cast
train
public function _cast($name, $data, $options) { if ($data === null) { return; } if ($data instanceof Document) { return $data; } $class = ltrim($options['class'], '\\'); $config = [ 'schema' => $class === Document::class ? $thi...
php
{ "resource": "" }
q6759
Schema._castArray
train
public function _castArray($name, $data, $options) { $options['type'] = isset($options['relation']) && $options['relation'] === 'hasManyThrough' ? 'through' : 'set'; $class = ltrim($options['class'], '\\'); $classes = $class::classes(); $collection = $classes[$options['type']]; ...
php
{ "resource": "" }
q6760
Schema.format
train
public function format($mode, $name, $data) { if ($mode === 'cast') { throw new InvalidArgumentException("Use `Schema::cast()` to perform casting."); } if (!isset($this->_columns[$name])) { // Formatting non defined columns or relations doesn't make sense, bailing out...
php
{ "resource": "" }
q6761
Schema.convert
train
public function convert($mode, $type, $data, $column = [], $options = []) { $formatter = null; $type = $data === null ? 'null' : $type; if (isset($this->_formatters[$mode][$type])) { $formatter = $this->_formatters[$mode][$type]; } elseif (isset($this->_formatters[$mode][...
php
{ "resource": "" }
q6762
Schema.saveRelation
train
public function saveRelation($instance, $types, $options = []) { $defaults = ['embed' => []]; $options += $defaults; $types = (array) $types; $collection = $instance instanceof Document ? [$instance] : $instance; $success = true; foreach ($collection as $entity) { ...
php
{ "resource": "" }
q6763
EntryPromise.getField
train
public function getField($key) { $resolved = $this->getResolved(); if (!$resolved instanceof EntryInterface) { return null; } return $resolved->getField($key); }
php
{ "resource": "" }
q6764
StringBuffer.appendTab
train
public function appendTab($str=null, $tabNum=1) { $tab = ""; for ( $i = 0; $i < $tabNum; $i++ ) { $tab .= "\t"; } $this->appendLine($tab.$str); }
php
{ "resource": "" }
q6765
AttributeTypeQuery.filterByHasAttributeAvValue
train
public function filterByHasAttributeAvValue($hasAttributeAvValue = null, $comparison = null) { if (is_array($hasAttributeAvValue)) { $useMinMax = false; if (isset($hasAttributeAvValue['min'])) { $this->addUsingAlias(AttributeTypeTableMap::HAS_ATTRIBUTE_AV_VALUE, $hasA...
php
{ "resource": "" }
q6766
AttributeTypeQuery.filterByIsMultilingualAttributeAvValue
train
public function filterByIsMultilingualAttributeAvValue($isMultilingualAttributeAvValue = null, $comparison = null) { if (is_array($isMultilingualAttributeAvValue)) { $useMinMax = false; if (isset($isMultilingualAttributeAvValue['min'])) { $this->addUsingAlias(Attribut...
php
{ "resource": "" }
q6767
AttributeTypeQuery.filterByPattern
train
public function filterByPattern($pattern = null, $comparison = null) { if (null === $comparison) { if (is_array($pattern)) { $comparison = Criteria::IN; } elseif (preg_match('/[\%\*]/', $pattern)) { $pattern = str_replace('*', '%', $pattern); ...
php
{ "resource": "" }
q6768
AttributeTypeQuery.filterByImageRatio
train
public function filterByImageRatio($imageRatio = null, $comparison = null) { if (is_array($imageRatio)) { $useMinMax = false; if (isset($imageRatio['min'])) { $this->addUsingAlias(AttributeTypeTableMap::IMAGE_RATIO, $imageRatio['min'], Criteria::GREATER_EQUAL); ...
php
{ "resource": "" }
q6769
AttributeTypeQuery.filterByAttributeTypeI18n
train
public function filterByAttributeTypeI18n($attributeTypeI18n, $comparison = null) { if ($attributeTypeI18n instanceof \AttributeType\Model\AttributeTypeI18n) { return $this ->addUsingAlias(AttributeTypeTableMap::ID, $attributeTypeI18n->getId(), $comparison); } elseif ($at...
php
{ "resource": "" }
q6770
AttributeTypeQuery.useAttributeTypeI18nQuery
train
public function useAttributeTypeI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this ->joinAttributeTypeI18n($relationAlias, $joinType) ->useQuery($relationAlias ? $relationAlias : 'AttributeTypeI18n', '\AttributeType\Model\AttributeTypeI18nQuery'); }
php
{ "resource": "" }
q6771
AttributeTypeI18nQuery.create
train
public static function create($modelAlias = null, $criteria = null) { if ($criteria instanceof \AttributeType\Model\AttributeTypeI18nQuery) { return $criteria; } $query = new \AttributeType\Model\AttributeTypeI18nQuery(); if (null !== $modelAlias) { $query->se...
php
{ "resource": "" }
q6772
CurrencyConverter.validate
train
private function validate() { if (null === $this->provider) { throw new MissingProviderException('A provider must be set for converting a currency'); } if (null === $this->from || null === $this->to) { throw new \RuntimeException('from and to parameters must be provi...
php
{ "resource": "" }
q6773
ZookeeperClient.set
train
public function set($path, $value) { if (!$this->zookeeper->exists($path)) { $this->makePath($path); $this->makeNode($path, $value); } else { $this->zookeeper->set($path, $value); } }
php
{ "resource": "" }
q6774
ZookeeperClient.makePath
train
public function makePath($path, $value = '') { $parts = explode('/', $path); $parts = array_filter($parts); $subpath = ''; while (count($parts) > 1) { $subpath .= '/' . array_shift($parts); if (!$this->zookeeper->exists($subpath)) { $this->makeNode($subpath, $value); } } }
php
{ "resource": "" }
q6775
ZookeeperClient.makeNode
train
public function makeNode($path, $value, array $params = array()) { if (empty($params)) { $params = array( array( 'perms' => \Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone', ) ); } return $this->zookeeper->create($path, $value, $params); }
php
{ "resource": "" }
q6776
ZookeeperClient.get
train
public function get($path) { if (!$this->zookeeper->exists($path)) { return null; } return $this->zookeeper->get($path); }
php
{ "resource": "" }
q6777
ZookeeperClient.getChildren
train
public function getChildren($path) { if (strlen($path) > 1 && preg_match('@/$@', $path)) { // remove trailing / $path = substr($path, 0, -1); } return $this->zookeeper->getChildren($path); }
php
{ "resource": "" }
q6778
ZookeeperClient.deleteNode
train
public function deleteNode($path) { if(!$this->zookeeper->exists($path)) { return null; } else { return $this->zookeeper->delete($path); } }
php
{ "resource": "" }
q6779
ZookeeperClient.watch
train
public function watch($path, $callback) { if (!is_callable($callback)) { return null; } if ($this->zookeeper->exists($path)) { if (!isset($this->callback[$path])) { $this->callback[$path] = array(); } if (!in_array($callback, $this->callback[$path])) { $this->callback[$path][] = $callback;...
php
{ "resource": "" }
q6780
ZookeeperClient.watchCallback
train
public function watchCallback($event_type, $stat, $path) { if (!isset($this->callback[$path])) { return null; } foreach ($this->callback[$path] as $callback) { $this->zookeeper->get($path, array($this, 'watchCallback')); return call_user_func($callback); } }
php
{ "resource": "" }
q6781
ZookeeperClient.loadNode
train
public function loadNode($path) { $list = @$this->zookeeper->getChildren($path); if(!empty($list)) { $data = []; foreach($list as $key) { $value = $this->zookeeper->get($path . '/' . $key); if(!empty($value)) { $data[$key] = $va...
php
{ "resource": "" }
q6782
Conventions.config
train
public function config($config = []) { $defaults = [ 'conventions' => [ 'source' => function($class) { $basename = substr(strrchr($class, '\\'), 1); return Inflector::underscore($basename); }, 'key' => functi...
php
{ "resource": "" }
q6783
Conventions.get
train
public function get($name = null) { if (!$name) { return $this->_conventions; } if (!isset($this->_conventions[$name])) { throw new ORMException("Convention for `'{$name}'` doesn't exists."); } return $this->_conventions[$name]; }
php
{ "resource": "" }
q6784
Conventions.apply
train
public function apply($name) { $params = func_get_args(); array_shift($params); $convention = $this->get($name); return call_user_func_array($convention, $params); }
php
{ "resource": "" }
q6785
ScriptEngineType.toArray
train
public function toArray() { return [ 'name' => $this->name, 'label' => $this->label, 'description' => $this->description, 'sandboxed' => $this->sandboxed, 'supports_inline_execu...
php
{ "resource": "" }
q6786
HasMany.junction
train
public function junction($boolean = null) { if (func_num_args()) { $this->_junction = $boolean; return $this; } return $this->_junction; }
php
{ "resource": "" }
q6787
Eloquent.saveIfExists
train
public function saveIfExists(array $options = []): bool { if ($this->exists === false) { return false; } return $this->save($options); }
php
{ "resource": "" }
q6788
Eloquent.saveIfExistsOrFail
train
public function saveIfExistsOrFail(array $options = []): bool { if ($this->exists === false) { return false; } return $this->saveOrFail($options); }
php
{ "resource": "" }
q6789
TreeCore.loadRawOrder
train
protected function loadRawOrder($tmpSubTier) { $nID = $tmpSubTier[0]; $this->nodesRawIndex[$nID] = sizeof($this->nodesRawOrder); $this->nodesRawOrder[] = $nID; if (sizeof($tmpSubTier[1]) > 0) { foreach ($tmpSubTier[1] as $deeper) { $this->loadRawOrder($dee...
php
{ "resource": "" }
q6790
TreeCore.prevNode
train
public function prevNode($nID) { $nodeOverride = $this->movePrevOverride($nID); if ($nodeOverride > 0) { return $nodeOverride; } if (!isset($this->nodesRawIndex[$nID])) { return -3; } $prevNodeInd = $this->nodesRawIndex[$nID]-1; if ($pr...
php
{ "resource": "" }
q6791
TreeCore.nextNode
train
public function nextNode($nID) { if ($nID <= 0 || !isset($this->nodesRawIndex[$nID])) { return -3; } $this->runCurrNode($nID); $nodeOverride = $this->moveNextOverride($nID); if ($nodeOverride > 0) { return $nodeOverride; } //if ($nID ==...
php
{ "resource": "" }
q6792
TreeCore.nextNodeSibling
train
public function nextNodeSibling($nID) { //if ($nID == $this->tree->TreeLastPage) return -37; if (!$this->hasNode($nID) || $this->allNodes[$nID]->parentID <= 0) { return -3; } $nodeOverride = $this->moveNextOverride($nID); if ($nodeOverride > 0) { retur...
php
{ "resource": "" }
q6793
TreeCore.updateCurrNode
train
public function updateCurrNode($nID = -3) { if ($nID > 0) { if (!isset($GLOBALS["SL"]->formTree->TreeID)) { if (!$this->sessInfo) { $this->createNewSess(); } $this->sessInfo->SessCurrNode = $nID; $this->se...
php
{ "resource": "" }
q6794
Request.setParameters
train
public function setParameters(array $parameters, $append = false) { if (!$append) { $this->parameters = $parameters; } else { foreach ($parameters as $field => $value) { $this->setParameter($field, $value); } } }
php
{ "resource": "" }
q6795
Request.getHeader
train
public function getHeader($field) { if (!isset($this->headers[$field])) { return null; } return is_array($this->headers[$field]) ? implode(',', $this->headers[$field]) : $this->headers[$field]; }
php
{ "resource": "" }
q6796
Request.getHeaders
train
public function getHeaders() { $headerFields = array_keys($this->headers); $result = array(); foreach ($headerFields as $field) { $result[] = sprintf('%s: %s', $field, $this->getHeader($field)); } return $result; }
php
{ "resource": "" }
q6797
Request.setHeaders
train
public function setHeaders(array $headers, $append = false) { if (!$append) { $this->headers = $headers; } else { foreach ($headers as $field => $value) { $this->setHeader($field, $value); } } }
php
{ "resource": "" }
q6798
Curl.send
train
public function send(Request $request) { $curl = $this->prepareRequest($request); $data = curl_exec($curl); if (false === $data) { $errorMsg = curl_error($curl); $errorNo = curl_errno($curl); throw new \RuntimeException($errorMsg, $errorNo); ...
php
{ "resource": "" }
q6799
Curl.prepareRequest
train
protected function prepareRequest(Request $request) { $curl = curl_init(); // TODO Timeout and Follow Redirect settings $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_CONNECTTIMEOUT_MS => 1000, ...
php
{ "resource": "" }