Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractSet.php

class AbstractSet

This class contains the basic implementation of a collection that does not allow duplicated values (a set), to minimize the effort required to implement this specific type of collection.

@template T @extends AbstractCollection<T>

Hierarchy

  • class \Ramsey\Collection\AbstractArray implements \Ramsey\Collection\ArrayInterface
    • class \Ramsey\Collection\AbstractCollection extends \Ramsey\Collection\AbstractArray implements \Ramsey\Collection\CollectionInterface uses \Ramsey\Collection\Tool\TypeTrait, \Ramsey\Collection\Tool\ValueToStringTrait, \Ramsey\Collection\Tool\ValueExtractorTrait
      • class \Ramsey\Collection\AbstractSet extends \Ramsey\Collection\AbstractCollection

Expanded class hierarchy of AbstractSet

File

vendor/ramsey/collection/src/AbstractSet.php, line 25

Namespace

Ramsey\Collection
View source
abstract class AbstractSet extends AbstractCollection {
    public function add(mixed $element) : bool {
        if ($this->contains($element)) {
            return false;
        }
        return parent::add($element);
    }
    public function offsetSet(mixed $offset, mixed $value) : void {
        if ($this->contains($value)) {
            return;
        }
        parent::offsetSet($offset, $value);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AbstractArray::$data protected property The items of this array.
AbstractArray::clear public function Removes all items from this array. Overrides ArrayInterface::clear
AbstractArray::count public function Returns the number of items in this array.
AbstractArray::getIterator public function Returns an iterator for this array. 2
AbstractArray::isEmpty public function Returns `true` if this array is empty. Overrides ArrayInterface::isEmpty
AbstractArray::offsetExists public function Returns `true` if the given offset exists in this array.
AbstractArray::offsetGet public function Returns the value at the specified offset.
AbstractArray::offsetUnset public function Removes the given offset and its value from the array.
AbstractArray::toArray public function @inheritDoc Overrides ArrayInterface::toArray 1
AbstractArray::__construct public function Constructs a new array object. 4
AbstractArray::__serialize public function Returns data suitable for PHP serialization. 1
AbstractArray::__unserialize public function Adds unserialized data to the object.
AbstractCollection::column public function @inheritDoc Overrides CollectionInterface::column
AbstractCollection::compareCollectionTypes private function
AbstractCollection::contains public function Returns `true` if this collection contains the specified element. Overrides CollectionInterface::contains
AbstractCollection::diff public function Overrides CollectionInterface::diff
AbstractCollection::filter public function Overrides CollectionInterface::filter
AbstractCollection::first public function Overrides CollectionInterface::first
AbstractCollection::getComparator private function
AbstractCollection::getUniformType private function
AbstractCollection::intersect public function Overrides CollectionInterface::intersect
AbstractCollection::last public function Overrides CollectionInterface::last
AbstractCollection::map public function @template TCallbackReturn Overrides CollectionInterface::map
AbstractCollection::merge public function Overrides CollectionInterface::merge
AbstractCollection::reduce public function @template TCarry Overrides CollectionInterface::reduce
AbstractCollection::remove public function Removes a single instance of the specified element from this collection,
if it is present.
Overrides CollectionInterface::remove
AbstractCollection::sort public function Overrides CollectionInterface::sort
AbstractCollection::where public function Overrides CollectionInterface::where
AbstractSet::add public function Ensures that this collection contains the specified element (optional
operation).
Overrides AbstractCollection::add
AbstractSet::offsetSet public function Sets the given value to the given offset in the array. Overrides AbstractCollection::offsetSet
CollectionInterface::getType public function Returns the type associated with this collection. 4
TypeTrait::checkType protected function Returns `true` if value is of the specified type.
ValueExtractorTrait::extractValue protected function Extracts the value of the given property, method, or array key from the
element.
ValueToStringTrait::toolValueToString protected function Returns a string representation of the value.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal