public function setCapacity($capacity)
    {
        if ($capacity !== NULL) {
            if (!is_float($capacity) && !is_int($capacity)) {
                throw new InvalidArgumentException('Invalid capacity given - must be numeric');
            }
            if ($capacity < 0) {
                throw new InvalidArgumentException('Capacity must not be negative');
            }
            if ($this->flow !== NULL && $this->flow > $capacity) {
                throw new RangeException('Current flow of ' . $this->flow . ' exceeds new capacity');
            }
        }
        $this->capacity = $capacity;

        return $this;
    }
public function setCapacity($capacity)
    {
        if ($capacity !== NULL) {
            if (!is_float($capacity) && !is_int($capacity)) {
                throw new InvalidArgumentException('Invalid capacity given - must be numeric');
            }
            if ($capacity < 0) {
                throw new InvalidArgumentException('Capacity must not be negative');
            }
            if ($this->flow !== NULL && $this->flow > $capacity) {
                throw new RangeException('Current flow of ' . $this->flow . ' exceeds new capacity');
            }
        }
        $this->capacity = $capacity;

        return $this;
    }
public function setCapacity ( $ capacity ) { if ( $ capacity !== NULL ) { if ( ! is_float ( $ capacity ) && ! is_int ( $ capacity ) ) { throw new InvalidArgumentException ( 'Invalid capacity given - must be numeric' ) ; } if ( $ capacity < 0 ) { throw new InvalidArgumentException ( 'Capacity must not be negative' ) ; } if ( $ this -> flow !== NULL && $ this -> flow > $ capacity ) { throw new RangeException ( 'Current flow of ' . $ this -> flow . ' exceeds new capacity' ) ; } } $ this -> capacity = $ capacity ; return $ this ; }
set new total capacity of this edge

@param  float|int|NULL           $capacity
@return self                     $this (chainable)
@throws InvalidArgumentException if $capacity is invalid (not numeric or negative)
@throws RangeException           if current flow exceeds new capacity
set new total capacity of this edge