_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
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 guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result
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 binding for other direction
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, $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
php
{ "resource": "" }
q6703
Owns.scopeOwns
train
public function scopeOwns(Builder $query, Model $related, ?string $foreignKey = null): Builder { if (\is_null($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()) { $data = $schema->cast(null, $data, [ 'exists' => isset($options['exists']) ? $options['exists'] : null, 'parent' => $this, 'basePath' => $this->basePath(), 'defaults' => true ]); } if ($name !== null) { if (!is_numeric($name)) { throw new ORMException("Invalid index `" . $name . "` for a collection, must be a numeric value."); } $previous = isset($this->_data[$name]) ? $this->_data[$name] : null;
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; } $value = $this->_data[$name]; if ($value instanceof
php
{ "resource": "" }
q6706
Collection.modified
train
public function modified($options = []) { $options += ['embed' => false]; if ($this->_modified) { return true; } foreach ($this->_data as $index => $entity) {
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)
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) {
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'; } return 'https://api.pin.net.au'; } )) ->setRequired(array( 'key' )) ->setDefined(array( 'host',
php
{ "resource": "" }
q6710
DocBlock.addAnnotation
train
public function addAnnotation($key, $value) { if (!isset($this->annotations[$key])) {
php
{ "resource": "" }
q6711
UploadableListener.postLoad
train
public function postLoad(LifecycleEventArgs $eventArgs) { $entityManager = $eventArgs->getEntityManager(); $object = $eventArgs->getEntity(); $uploadableMeta = $this->getObjectExtendedMetadata($entityManager, $object);
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 = $this->getObjectExtendedMetadata($entityManager, $object);
php
{ "resource": "" }
q6713
UploadableListener.loadFiles
train
protected function loadFiles( EntityManagerInterface $entityManager, $object, UploadableClassMetadata $uploadableMeta ): void { $this->assertIsObject($object); $propertyManipulator = $this->getPropertyManipulator($entityManager); foreach ($uploadableMeta->getUploadableProperties() as $property => $config) { $key = $propertyManipulator->getPropertyValue($object, $property); if
php
{ "resource": "" }
q6714
UploadableListener.getPropertyManipulator
train
private function getPropertyManipulator(EntityManagerInterface $entityManager): PropertyManipulator { $oid = spl_object_hash($entityManager); if (!isset($this->propertyManipulators[$oid])) {
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 $criteria = $values; } elseif ($values instanceof \AttributeType\Model\AttributeTypeI18n) { // it's a model object // create criteria based on pk values $criteria = $values->buildPkeyCriteria(); } else { // it's a primary key, or an array of pks $criteria = new Criteria(AttributeTypeI18nTableMap::DATABASE_NAME); // primary key is composite; we therefore, expect // the primary key passed to be an array of pkey values if (count($values) == count($values, COUNT_RECURSIVE)) { // array is not multi-dimensional $values = array($values); } foreach ($values as $value) { $criterion = $criteria->getNewCriterion(AttributeTypeI18nTableMap::ID, $value[0]);
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; // rename for clarity } else { $criteria = $criteria->buildCriteria(); // build Criteria from AttributeTypeI18n object } // Set the correct dbName $query = AttributeTypeI18nQuery::create()->mergeWith($criteria); try { // use transaction because $criteria could contain info
php
{ "resource": "" }
q6717
OciPdoAdapter.closeConnection
train
public function closeConnection() { if (is_resource($this->_dbh)) { $res = @oci_close($this->_dbh);
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 {
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']); } switch($this->getAttribute(PDO::ATTR_ERRMODE)) { case PDO::ERRMODE_SILENT: $message = sprintf('(%s) Error ' . $message, date('Y-m-d H:i:s')); error_log($message); break;
php
{ "resource": "" }
q6720
Buffer.first
train
public function first($options = []) { $result = $this->get($options); return
php
{ "resource": "" }
q6721
TranslatableListener.postLoad
train
public function postLoad(LifecycleEventArgs $eventArgs) { $this->loadTranslation( $eventArgs->getEntityManager(),
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); } foreach
php
{ "resource": "" }
q6723
TranslatableListener.updateObjectTranslations
train
private function updateObjectTranslations(EntityManagerInterface $entityManager, $object): void { $translatableMeta = $this->getTranslatableMetadata($entityManager, $object); if (!$translatableMeta->hasTranslatableProperties()) { return; } foreach ($translatableMeta->getTranslationAssociationMetadatas() as $associationMeta) { $context = $this->getTranslationContext($entityManager, $associationMeta, $object); $locale = $this->translationHelper->getObjectLocale($context, $object);
php
{ "resource": "" }
q6724
Data.get
train
public function get($key, $default = null, $filter = null) { $result = $default; if ($this->has($key)) {
php
{ "resource": "" }
q6725
Data.filter
train
protected function filter($value, $filter) { if (null !== $filter)
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
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())) { $options['categories'] = array_values($axis->getCategories()); } if (null !== $axis->getMaxValue()) { $options['max'] = $axis->getMaxValue(); } if (null !== $axis->getMinValue()) { $options['min'] = $axis->getMinValue(); } if (false === $axis->getTitle()->isEnabled()) { $options['title']['text'] = null; } else { if (null !== $axis->getTitle()->getText()) { $options['title']['text'] = $axis->getTitle()->getText(); } if (0 < count($axis->getTitle()->getStyles())) { $options['title']['style'] = $axis->getTitle()->getStyles(); } } $options['labels'] = array( 'enabled' => $axis->getLabel()->isEnabled(), ); if (null !== $axis->getLabel()->getAlign()) {
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->isSliced(); }
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.
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, $required_spacing); return; } //otherwise, if there is whitespace, change the whitespace to the required spacing for ($i = ($start + 1); $i < $end; $i++) {
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"]->REQ->uID); $user->name = $GLOBALS["SL"]->REQ->name; $user->email = $GLOBALS["SL"]->REQ->email; $user->save(); $user->loadRoles(); if ($this->v["user"]->hasRole('administrator')) { if ($GLOBALS["SL"]->REQ->has('roles') && is_array($GLOBALS["SL"]->REQ->roles) && sizeof($GLOBALS["SL"]->REQ->roles) > 0) {
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;
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]) ||
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;
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>--no-push option enabled (this option disable push commit to remotes)</comment>' ); } /** @var GitElephantRepositoryCollection $rc */ $rc = $this->getContainer()->get('git_repositories'); if ($rc->count() == 0) { throw new \Exception('Must have at least one Git repository. See https://github.com/matteosister/GitElephantBundle#how-to-use');
php
{ "resource": "" }
q6736
Schema.lock
train
public function lock($locked = true) { $this->_locked = $locked === false
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 = $key; } if (!$fieldName || $fieldName === '*' || strpos($fieldName, '.') !==
php
{ "resource": "" }
q6739
Schema.type
train
public function type($name) { if (!$this->has($name)) { return; } $column
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($params); if ($column['type'] !== 'object' && !$column['array']) { $this->_columns[$name] = $column; return $this; } $relationship = $this->_classes['relationship']; $this->bind($name, [ 'type' => $column['array'] ?
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])) {
php
{ "resource": "" }
q6742
Schema.append
train
public function append($fields) { if (is_array($fields)) { foreach ($fields as $key => $value) { $this->column($key, $value); } } else {
php
{ "resource": "" }
q6743
Schema.virtuals
train
public function virtuals($attribute = null) { $fields = []; foreach ($this->_columns as $name => $field)
php
{ "resource": "" }
q6744
Schema.belongsTo
train
public function belongsTo($name, $to, $config = []) { $defaults = [ 'to' => $to, 'relation' => 'belongsTo' ];
php
{ "resource": "" }
q6745
Schema.hasMany
train
public function hasMany($name, $to, $config = []) { $defaults = [ 'to' => $to, 'relation' => 'hasMany' ];
php
{ "resource": "" }
q6746
Schema.hasOne
train
public function hasOne($name, $to, $config = []) { $defaults = [ 'to' => $to, 'relation' => 'hasOne' ];
php
{ "resource": "" }
q6747
Schema.hasManyThrough
train
public function hasManyThrough($name, $through, $using, $config = []) { $defaults = [ 'through' => $through,
php
{ "resource": "" }
q6748
Schema.unbind
train
public function unbind($name) { if (!isset($this->_relations[$name])) { return;
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]; $relationship = $config['relation'];
php
{ "resource": "" }
q6750
Schema.relations
train
public function relations($embedded = false) { $result = []; foreach ($this->_relations as $field => $config) { if (!$config['embedded']
php
{ "resource": "" }
q6751
Schema.hasRelation
train
public function hasRelation($name, $embedded = null) { if (!isset($this->_relations[$name])) { return false;
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->type() === 'hasManyThrough') { $habtm[] = $name; continue; } $to = $rel->to(); $query = empty($relations[$name]) ? [] : $relations[$name]; if (is_callable($query)) { $options['query']['handler'] = $query; } else { $options['query'] = $query; } $related = $rel->embed($collection, $options); $subrelations = []; foreach ($relations as $path => $value) {
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, $num) : $path; $rel = $this->relation($name); if ($rel->type() !== 'hasManyThrough') { continue; }
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])) { continue; } if ($this->_relations[$relName]['relation'] === 'hasManyThrough') { $rel = $this->relation($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(); if ($field !== null) { $name = $options['basePath'] ? $options['basePath'] . '.' . $field : (string) $field; } else { $name = $options['basePath']; } if ($name === null) { return $this->_cast($name, $data, $options);
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') { $options['class'] = $options['to']; } else { $through = $this->relation($name); $options['class'] = $through->to(); } if ($field) {
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) {
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 ? $this : null, 'basePath' => $options['basePath'], 'exists' => $options['exists'], 'defaults' => $options['defaults'] ]; if (isset($options['config'])){ $config = Set::extend($config, $options['config']);
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']]; if ($data instanceof $collection) { return $data; } $isThrough = $options['type'] === 'through'; $isDocument = $class === Document::class; $config = [ 'schema' => $isDocument ? $this : $class::definition(), 'basePath' => $isDocument ? $name : null,
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. return $this->convert($mode, '_default_', $data, []); } $column = $this->_columns[$name]; $isNull = $data === null; $type = $isNull ? 'null' : $this->type($name); if (!$column['array']) {
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])) {
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) { foreach ($types as $type) { foreach ($options['embed'] as $relName => $value) { if (!($rel = $this->relation($relName)) || $rel->type() !== $type) {
php
{ "resource": "" }
q6763
EntryPromise.getField
train
public function getField($key) { $resolved = $this->getResolved(); if (!$resolved instanceof EntryInterface) {
php
{ "resource": "" }
q6764
StringBuffer.appendTab
train
public function appendTab($str=null, $tabNum=1) { $tab = ""; for ( $i = 0; $i < $tabNum; $i++ ) {
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, $hasAttributeAvValue['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($hasAttributeAvValue['max'])) { $this->addUsingAlias(AttributeTypeTableMap::HAS_ATTRIBUTE_AV_VALUE, $hasAttributeAvValue['max'], Criteria::LESS_EQUAL); $useMinMax = true;
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(AttributeTypeTableMap::IS_MULTILINGUAL_ATTRIBUTE_AV_VALUE, $isMultilingualAttributeAvValue['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } if (isset($isMultilingualAttributeAvValue['max'])) { $this->addUsingAlias(AttributeTypeTableMap::IS_MULTILINGUAL_ATTRIBUTE_AV_VALUE, $isMultilingualAttributeAvValue['max'], Criteria::LESS_EQUAL);
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('*',
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); $useMinMax = true; } if (isset($imageRatio['max'])) { $this->addUsingAlias(AttributeTypeTableMap::IMAGE_RATIO, $imageRatio['max'], Criteria::LESS_EQUAL); $useMinMax = true;
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 ($attributeTypeI18n instanceof ObjectCollection) { return $this
php
{ "resource": "" }
q6770
AttributeTypeQuery.useAttributeTypeI18nQuery
train
public function useAttributeTypeI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN') { return $this ->joinAttributeTypeI18n($relationAlias, $joinType)
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) {
php
{ "resource": "" }
q6772
CurrencyConverter.validate
train
private function validate() { if (null === $this->provider) { throw new MissingProviderException('A provider must be set
php
{ "resource": "" }
q6773
ZookeeperClient.set
train
public function set($path, $value) { if (!$this->zookeeper->exists($path)) {
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);
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',
php
{ "resource": "" }
q6776
ZookeeperClient.get
train
public function get($path) { if (!$this->zookeeper->exists($path)) { return null; }
php
{ "resource": "" }
q6777
ZookeeperClient.getChildren
train
public function getChildren($path) { if (strlen($path) > 1 && preg_match('@/$@', $path))
php
{ "resource": "" }
q6778
ZookeeperClient.deleteNode
train
public function deleteNode($path) { if(!$this->zookeeper->exists($path)) { return null; } else
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]))
php
{ "resource": "" }
q6780
ZookeeperClient.watchCallback
train
public function watchCallback($event_type, $stat, $path) { if (!isset($this->callback[$path])) { return null;
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] = $value; }else {
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' => function() { return 'id'; }, 'reference' => function($class) { $pos = strrpos($class, '\\'); $basename = substr($class, $pos !== false ? $pos + 1 : 0); return Inflector::underscore(Inflector::singularize($basename)). '_id'; }, 'references' => function($class) { $pos = strrpos($class, '\\'); $basename = substr($class, $pos !== false ? $pos + 1 : 0); return Inflector::underscore(Inflector::singularize($basename)). '_ids'; },
php
{ "resource": "" }
q6783
Conventions.get
train
public function get($name = null) { if (!$name) { return $this->_conventions; } if (!isset($this->_conventions[$name]))
php
{ "resource": "" }
q6784
Conventions.apply
train
public function apply($name) { $params = func_get_args(); array_shift($params);
php
{ "resource": "" }
q6785
ScriptEngineType.toArray
train
public function toArray() { return [ 'name' => $this->name, 'label' => $this->label, 'description' => $this->description,
php
{ "resource": "" }
q6786
HasMany.junction
train
public function junction($boolean = null) { if (func_num_args()) { $this->_junction = $boolean;
php
{ "resource": "" }
q6787
Eloquent.saveIfExists
train
public function saveIfExists(array $options = []): bool { if ($this->exists === false) { return false;
php
{ "resource": "" }
q6788
Eloquent.saveIfExistsOrFail
train
public function saveIfExistsOrFail(array $options = []): bool { if ($this->exists === false) { return false;
php
{ "resource": "" }
q6789
TreeCore.loadRawOrder
train
protected function loadRawOrder($tmpSubTier) { $nID = $tmpSubTier[0]; $this->nodesRawIndex[$nID] = sizeof($this->nodesRawOrder);
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;
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) { return $nodeOverride; } $nextSibling = SLNode::where('NodeTree', $this->treeID) ->where('NodeParentID', $this->allNodes[$nID]->parentID)
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->sessInfo->save();
php
{ "resource": "" }
q6794
Request.setParameters
train
public function setParameters(array $parameters, $append = false) { if (!$append) { $this->parameters = $parameters; } else {
php
{ "resource": "" }
q6795
Request.getHeader
train
public function getHeader($field) { if (!isset($this->headers[$field])) { return null; }
php
{ "resource": "" }
q6796
Request.getHeaders
train
public function getHeaders() { $headerFields = array_keys($this->headers); $result = array(); foreach ($headerFields as $field) {
php
{ "resource": "" }
q6797
Request.setHeaders
train
public function setHeaders(array $headers, $append = false) { if (!$append) { $this->headers = $headers; } else {
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, CURLOPT_TIMEOUT_MS => 3000, CURLOPT_CUSTOMREQUEST => $request->getMethod(), CURLOPT_URL => $request->getUri(), CURLOPT_HTTPHEADER => $request->getHeaders(), CURLOPT_HTTPGET => false, CURLOPT_NOBODY => false, CURLOPT_POST => false, CURLOPT_POSTFIELDS => null, ); switch ($request->getMethod()) { case Request::METHOD_HEAD: $options[CURLOPT_NOBODY] = true; $query = http_build_query($request->getParameters()); if (!empty($query)) {
php
{ "resource": "" }