protected function populate($name, $value)
    {
        switch ($name) {
            case 'port':
                if (!is_int($value)) {
                    throw new InvalidArgumentException('Value given to set "'.$name.'" must be a valid int!!');
                }
                if (isset(self::$defaultPorts[$this->scheme]) && $value == self::$defaultPorts[$this->scheme]) {
                    break;
                }
                $this->$name = $value;
                break;
            case 'host':
                if (strpos($value, ':') !== false) {
                    $tmp = explode(':', $value);
                    $this->port((int)$tmp[1]);
                    $value = $tmp[0];
                }
                //Just extract port then go to the default case
            default:
                if (!is_string($value)) {
                    throw new InvalidArgumentException('Value given to set "'.$name.'" must be a valid string!!');
                }
                $this->$name = $value;
                break;
        }
    }
protected function populate($name, $value)
    {
        switch ($name) {
            case 'port':
                if (!is_int($value)) {
                    throw new InvalidArgumentException('Value given to set "'.$name.'" must be a valid int!!');
                }
                if (isset(self::$defaultPorts[$this->scheme]) && $value == self::$defaultPorts[$this->scheme]) {
                    break;
                }
                $this->$name = $value;
                break;
            case 'host':
                if (strpos($value, ':') !== false) {
                    $tmp = explode(':', $value);
                    $this->port((int)$tmp[1]);
                    $value = $tmp[0];
                }
                //Just extract port then go to the default case
            default:
                if (!is_string($value)) {
                    throw new InvalidArgumentException('Value given to set "'.$name.'" must be a valid string!!');
                }
                $this->$name = $value;
                break;
        }
    }
protected function populate ( $ name , $ value ) { switch ( $ name ) { case 'port' : if ( ! is_int ( $ value ) ) { throw new InvalidArgumentException ( 'Value given to set "' . $ name . '" must be a valid int!!' ) ; } if ( isset ( self :: $ defaultPorts [ $ this -> scheme ] ) && $ value == self :: $ defaultPorts [ $ this -> scheme ] ) { break ; } $ this -> $ name = $ value ; break ; case 'host' : if ( strpos ( $ value , ':' ) !== false ) { $ tmp = explode ( ':' , $ value ) ; $ this -> port ( ( int ) $ tmp [ 1 ] ) ; $ value = $ tmp [ 0 ] ; } //Just extract port then go to the default case default : if ( ! is_string ( $ value ) ) { throw new InvalidArgumentException ( 'Value given to set "' . $ name . '" must be a valid string!!' ) ; } $ this -> $ name = $ value ; break ; } }
Fill a property with the given value
@param string $name
@param mixed $value
@throws InvalidArgumentException
Fill a property with the given value