public function add()
    {

        if( !$args = func_get_args() ) {
            return $this;
        }

        $intervals = array_map(
            array($this, 'addHelper'),
            $args
        );
        $intervals[] = $this->intervals;

        $output = array();

        // merge the lot
        $intervals = call_user_func_array( 'array_merge', $intervals );

        usort( $intervals, array( $this, "sortIntervals" ) );

        $working = null;
        while( list(,$current) = each($intervals) ) {

            // we got anything to compare against
            if( $working === null ) {

                $working = $current;

            // we've maxed out - everything else is going to match this!
            } elseif ( $working[1] === null ) {

                break;

            // is current lower bound contained in our working interval
            // or isContinuous()
            } elseif (
                $this->sort( $working[1], $current[0], self::NULL_IS_HIGH ) >= 0 or
                $this->isContinuous( $working[1], $current[0] )
            ) {

                // get the maximum upper bound
                $working[1] = $this->max( $working[1], $current[1], self::NULL_IS_HIGH );

            // intervals are distinct, add to output
            } else {

                $output[] = $working;
                $working = $current;

            }

        }

        if( !is_null( $working ) ) {
            $output[] = $working;
        }

        $this->intervals = $output;
        return $this;

    }
public function add()
    {

        if( !$args = func_get_args() ) {
            return $this;
        }

        $intervals = array_map(
            array($this, 'addHelper'),
            $args
        );
        $intervals[] = $this->intervals;

        $output = array();

        // merge the lot
        $intervals = call_user_func_array( 'array_merge', $intervals );

        usort( $intervals, array( $this, "sortIntervals" ) );

        $working = null;
        while( list(,$current) = each($intervals) ) {

            // we got anything to compare against
            if( $working === null ) {

                $working = $current;

            // we've maxed out - everything else is going to match this!
            } elseif ( $working[1] === null ) {

                break;

            // is current lower bound contained in our working interval
            // or isContinuous()
            } elseif (
                $this->sort( $working[1], $current[0], self::NULL_IS_HIGH ) >= 0 or
                $this->isContinuous( $working[1], $current[0] )
            ) {

                // get the maximum upper bound
                $working[1] = $this->max( $working[1], $current[1], self::NULL_IS_HIGH );

            // intervals are distinct, add to output
            } else {

                $output[] = $working;
                $working = $current;

            }

        }

        if( !is_null( $working ) ) {
            $output[] = $working;
        }

        $this->intervals = $output;
        return $this;

    }
public function add ( ) { if ( ! $ args = func_get_args ( ) ) { return $ this ; } $ intervals = array_map ( array ( $ this , 'addHelper' ) , $ args ) ; $ intervals [ ] = $ this -> intervals ; $ output = array ( ) ; // merge the lot $ intervals = call_user_func_array ( 'array_merge' , $ intervals ) ; usort ( $ intervals , array ( $ this , "sortIntervals" ) ) ; $ working = null ; while ( list ( , $ current ) = each ( $ intervals ) ) { // we got anything to compare against if ( $ working === null ) { $ working = $ current ; // we've maxed out - everything else is going to match this! } elseif ( $ working [ 1 ] === null ) { break ; // is current lower bound contained in our working interval // or isContinuous() } elseif ( $ this -> sort ( $ working [ 1 ] , $ current [ 0 ] , self :: NULL_IS_HIGH ) >= 0 or $ this -> isContinuous ( $ working [ 1 ] , $ current [ 0 ] ) ) { // get the maximum upper bound $ working [ 1 ] = $ this -> max ( $ working [ 1 ] , $ current [ 1 ] , self :: NULL_IS_HIGH ) ; // intervals are distinct, add to output } else { $ output [ ] = $ working ; $ working = $ current ; } } if ( ! is_null ( $ working ) ) { $ output [ ] = $ working ; } $ this -> intervals = $ output ; return $ this ; }
Variable number of argument of things we're likey to be able to make a set out of.

@param See $this->addHelper()
..
@return $this
Variable number of argument of things we re likey to be able to make a set out of .