Is Valid Collection

@param mixed $collection

@return bool
425340
public static function isValid($collection)
    {
        if (false === is_array($collection) && false === ($collection instanceof Collection)) {
            return false;
        }

        return true;
    }
349324
public function valid()
    {
        return $this->isValidKey($this->currentKey) ? array_key_exists($this->currentKey, $this->items) : false;
    }
1227304
public static function dropCollection($collection)
  {
    static::checkConnexion();
    $collection = self::$db->$collection;
    $r = $collection->drop();
    if ($r['ok']) {
      return true;
    }
    return false;
  }
37397
protected function isValid($value): bool
    {
        $type = gettype($value);
        switch ($type) {
            case 'string':
            case 'integer':
            case 'double':
            case 'boolean':
            case 'NULL':
                return true;
                break;
            case 'array':
                return ArrayCollection::create($value)->every(function ($v) {
                    return $this->isValid($v);
                });
                break;
            default:
                break;
        }

        return false;
    }
639074
public function hasKey($key, $collection)
    {
        if (empty($this->queriesResultCache[ 'collectionKeys' ][ $collection ])) {
            $this->getKeys($collection);
        }

        return (bool)in_array($key, $this->queriesResultCache[ 'collectionKeys' ][ $collection ]);
    }
661919
protected function validateCollection()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->collection->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Collection'));
            return false;
        }

        $this->setSubmitted('update', $data);
        return true;
    }
681756
public static boolean contains(Collection<?> collection, Object value) {
		return isNotEmpty(collection) && collection.contains(value);
	}
522466
public function isSubsetOf($collection)
    {
        /** @var ModelInterface $localModel */
        foreach ($this as $localModel) {
            /** @var ModelInterface $otherModel */
            foreach ($collection as $otherModel) {
                if (($localModel->getProviderName() === $otherModel->getProviderName())
                    && ($localModel->getId() === $otherModel->getId())
                ) {
                    continue;
                }
                return false;
            }
        }
        return true;
    }
339133
protected function removeCollection(Collection $collection) {
		$transaction = $this->getTransactionsManager()->get(true);
			
		foreach ($collection as $model) {
			$phalconModel = $this->createTableModel($model);
			$phalconModel->setTransaction($transaction);

			if (! $phalconModel->delete()) {
				$transaction->rollback();
			}
		}

		$transaction->commit();
		return true;
	}
1111526
public function values($collection=null) {
    list($collection) = self::_wrapArgs(func_get_args(), 1);
    
    return self::_wrap(array_values((array) $collection));
  }
584069
protected function isRecord($data)
    {
        if ($data instanceof Collection) {
            return false;
        }

        $keys = array_keys($data);
        return (in_array('id', $keys, true) || in_array('name', $keys, true));
    }
1040358
protected function validateTypeCollection()
    {
        $field = 'type';

        if ($this->isExcluded($field) || $this->isUpdating()) {
            return null; // Do not check type on update - it cannot be changed and will be ignored
        }

        $value = $this->getSubmitted($field);
        $label = $this->translation->text('Type');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        $types = $this->collection->getTypes();

        if (!isset($types[$value])) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
751375
private function isCollectionDynamic(Collection $collection): bool
    {
        try {
            $this->loadCollectionQuery($collection);
        } catch (NotFoundException $e) {
            return false;
        }

        return true;
    }
153237
public function getCollectionName($collection)
    {
        if ($collection instanceof Collection) {
            $collectionId = $collection->getName();

            return $collectionId;
        }

        $collectionId = $collection;

        return $collectionId;
    }
561338
public function filterModelCollectionAsContainer(Collection $collection)
    {
        parent::filterModelCollectionAsContainer($collection);

        $collection->filter(new Equals("Accepted", false));
    }
612899
protected function validateCollectionCollectionItem()
    {
        $field = 'collection_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $collection_id = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($collection_id)) {
            return null;
        }

        $label = $this->translation->text('Collection');

        if (empty($collection_id)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_numeric($collection_id)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        $collection = $this->collection->get($collection_id);

        if (empty($collection)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        $this->setSubmitted('collection', $collection);
        return true;
    }
837689
public function validateCollectionName()
    {
        if (empty($this->modelClass)) {
            $class = $this->generateClassName($this->collectionName);
            if ($this->isReservedKeyword($class)) {
                $this->addError('collectionName', "Collection '{$this->collectionName}' will generate a class which is a reserved PHP keyword.");
            }
        }
    }