Checks if the other index already fulfills all the indexing and constraint needs of the current one.

@return bool
779397
public function isFullfilledBy(Index $other)
    {
        // allow the other index to be equally large only. It being larger is an option
        // but it creates a problem with scenarios of the kind PRIMARY KEY(foo,bar) UNIQUE(foo)
        if (count($other->getColumns()) !== count($this->getColumns())) {
            return false;
        }

        // Check if columns are the same, and even in the same order
        $sameColumns = $this->spansColumns($other->getColumns());

        if ($sameColumns) {
            if (! $this->samePartialIndex($other)) {
                return false;
            }

            if (! $this->hasSameColumnLengths($other)) {
                return false;
            }

            if (! $this->isUnique() && ! $this->isPrimary()) {
                // this is a special case: If the current key is neither primary or unique, any unique or
                // primary key will always have the same effect for the index and there cannot be any constraint
                // overlaps. This means a primary or unique index can always fulfill the requirements of just an
                // index that has no constraints.
                return true;
            }

            if ($other->isPrimary() !== $this->isPrimary()) {
                return false;
            }

            return $other->isUnique() === $this->isUnique();
        }

        return false;
    }
850093
public function offsetExists($index)
    {
        if (!$exists = parent::offsetExists($index)) {
            if (isset($this->{$index})) {
                return true;
            }
        }
        return $exists;
    }
493773
protected function areRequirementsMet(): bool
    {
        return (bool) $this->uses = ClassHelper::getTraitUsePointers($this->getFile(), $this->getStackPos());
    }
874272
public function contentExists() {
		$r = Catalog::getRoot();
		if (count($r->children) > 1) return true;
		if (count($r->children) < 1) return false;
		
		$s = $r->children[0];
		
		if (count($s->children)) return true;
		if (count($s->getMaterials()->unpublished())) return true;
		
		return false;
	}
415290
public function checkDuplicates()
    {
        $shopNumbers = array();
        $files       = scandir(dirname($this->buildConfigFilePath()));

        foreach ($files as $file) {
            if (!is_file($this->buildConfigFilePath($file))) {
                continue;
            }

            $shopgate_config = null;
            /** @noinspection PhpIncludeInspection */
            include($this->buildConfigFilePath($file));
            if (isset($shopgate_config) && isset($shopgate_config['shop_number'])) {
                if (in_array($shopgate_config['shop_number'], $shopNumbers)) {
                    return true;
                } else {
                    $shopNumbers[] = $shopgate_config['shop_number'];
                }
            }
        }

        return false;
    }
1082702
public function check() {
        if ($this->_exist) {
            foreach ($this->_constraints as $constraint) {
                switch ($constraint['type']) {
                    case self::ACCEPT:
                        if (!is_array($this->_data[$this->_field]['type'])) {
                            $this->_data[$this->_field]['type'] = [$this->_data[$this->_field]['type']];
                        }

                        foreach ($this->_data[$this->_field]['type'] as $value) {
                            if ($value != '') {
                                if (!in_array($value, $constraint['value'])) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::EXTENSION:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        foreach ($this->_data[$this->_field]['name'] as $value) {
                            if ($value != '') {
                                if (!in_array(pathinfo($value)['extension'], $constraint['value'])) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEMIN:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value < $constraint['value']) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEMAX:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value > $constraint['value']) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEBETWEEN:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value < $constraint['value'][0] || $value > $constraint['value'][1]) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::COUNT:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) != $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTMIN:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) < $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTMAX:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) > $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTIN:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (!in_array(count($this->_data[$this->_field]['name']), $constraint['value'])) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::CUSTOM:
                        /** @var object[] $constraints */
                        if ($constraints['value']->filter() == false) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['value']->error()]);
                        }
                        break;
                }
            }
        }
    }
701826
protected function isRepeatRelational()
    {
        $is_repeat = false;
        
        if (array_count_values($this->getParentArray())[$this->prefix] > 1) {
            $is_repeat = true;
        }
        
        return $is_repeat;
    }
534809
public function hasPrimaryKey()
    {
        $empty = true;

        foreach ($this->keys as $key) {
            $empty = $empty && !$this->$key;
        }

        return !$empty;
    }
47009
public function isSelfIssued()
    {
        if (!$this->issuer) {
            return false;
        }
        if (!$this->contact) {
            return false;
        }
        if (!$this->contact->user) {
            return false;
        }

        return $this->issuer->id == $this->contact->user->id;
    }
243661
public function hasIncrementField(): bool
    {
        $fields = $this->getFields();

        foreach ($this->data as $key => $datum) {
            if (isset($fields[$key]) && $fields[$key]->Extra === 'auto_increment') {
                return true;
            }
        }

        return false;
    }
1143827
public function isIndexed(): bool
    {
        $arr = $this->bag;

        for (reset($arr); is_int(key($arr)); next($arr)) {
            ;
        }
        return is_null(key($arr));
    }
140102
public function hasScalarKeys() {
    if ($this->key instanceof ScalarNode) {
      return $this->array instanceof ArrayLookupNode ? $this->array->hasScalarKeys() : TRUE;
    }
    else {
      return FALSE;
    }
  }
1158171
public function hasChange()
    {
        foreach ($this as $key => $value) {
            if ($this->isAdded || $this->isDeleted) {
                return true;
            }

            if (!is_null($value) && $value instanceof ChangeDetector && $value->hasChange()) {
                return true;
            }
        }
        if ($this->hasFromToFields()) {
            // check for change in presence of foreign-constraint
            $fromConstraint = null !== $this->fromField->getForeignConstraint();
            $toConstraint = null !== $this->toField->getForeignConstraint();
            $constraintChange = $fromConstraint != $toConstraint;
            if ($constraintChange) {
                return true;
            }
        }

        return false;
    }
587570
public function isExtendedSearch()
    {
        $result = false;

        if (array_key_exists('extended', $this->requestArguments)) {
            // Show extended search when told so by the »extended« argument.
            $result = (true == $this->requestArguments['extended']);
        } else {
            // Show extended search when any of the »extended« fields are used.
            if (array_key_exists('q', $this->requestArguments)) {
                foreach ($this->settings['queryFields'] as $fieldInfo) {
                    if ($fieldInfo['extended']
                        && array_key_exists($fieldInfo['id'], $this->requestArguments['q'])
                        && $this->requestArguments['q'][$fieldInfo['id']]
                    ) {
                        $result = true;
                        break;
                    }
                }
            }
        }

        return $result;
    }
669149
public function compareIndexes(Index $oldIndex, Index $newIndex)
    {
        return ($oldIndex->getName() !== $newIndex->getName())
            || ($oldIndex->getColumnNames() !== $newIndex->getColumnNames())
            || ($oldIndex->isUnique() !== $newIndex->isUnique());
    }
1280922
public boolean indexAppliesTo( Constraint constraint ) {
        if (constraint instanceof Comparison) {
            return indexAppliesTo((Comparison)constraint);
        }
        if (constraint instanceof And) {
            return indexAppliesTo((And)constraint);
        }
        if (constraint instanceof Or) {
            return indexAppliesTo((Or)constraint);
        }
        if (constraint instanceof Not) {
            return indexAppliesTo((Not)constraint);
        }
        if (constraint instanceof Between) {
            return indexAppliesTo((Between)constraint);
        }
        if (constraint instanceof SetCriteria) {
            return indexAppliesTo((SetCriteria)constraint);
        }
        if (constraint instanceof Relike) {
            return indexAppliesTo((Relike)constraint);
        }
        if (constraint instanceof PropertyExistence) {
            return indexAppliesTo((PropertyExistence)constraint);
        }
        if (constraint instanceof FullTextSearch) {
            return applies((FullTextSearch)constraint);
        }
        return false;
    }
110344
public function matches(ConstraintInterface $provider)
    {
        if (false === $this->conjunctive) {
            foreach ($this->constraints as $constraint) {
                if ($constraint->matches($provider)) {
                    return true;
                }
            }

            return false;
        }

        foreach ($this->constraints as $constraint) {
            if (!$constraint->matches($provider)) {
                return false;
            }
        }

        return true;
    }