src/Collection.php
final public function count(): int
    {
        // If size if known, return it
        if (isset($this->size)) {
            return $this->size;
        }

        // Calculate, cache and then return the size
        return $this->size = count($this->data);
    }
final public function count(): int
    {
        // If size if known, return it
        if (isset($this->size)) {
            return $this->size;
        }

        // Calculate, cache and then return the size
        return $this->size = count($this->data);
    }
final public function count ( ) : int { // If size if known, return it if ( isset ( $ this -> size ) ) { return $ this -> size ; } // Calculate, cache and then return the size return $ this -> size = count ( $ this -> data ) ; }
Counts the items in the set

@return int
Counts the items in the set