src/ADT/String.php
public function extend( $length, $string = " ", $left = FALSE, $right = TRUE )
	{
		if( !is_int( $length ) )
			throw new InvalidArgumentException( 'Length must be integer' );
		if( $length < $this->getLength() )
			throw new InvalidArgumentException( 'Length cannot be lower than string length' );
		if( !is_string( $string ) && !( $string instanceof ADT_String ) )
			throw new InvalidArgumentException( 'Padding string must be of string' );
		if( !$string )
			throw new InvalidArgumentException( 'Padding string cannot be empty' );

		$oldLength	= $this->getLength();
		$mode		= STR_PAD_RIGHT;
		if( $right && $left )
			$mode	= STR_PAD_BOTH;
		else if( $left )
			$mode	= STR_PAD_LEFT;
		else if( !$right )
			throw new InvalidArgumentException( 'No mode given, set left and/or right to TRUE' );
		$this->string	= str_pad( $this->string, $length, (string) $string, $mode );
		return $this->getLength() - $oldLength;
	}
public function extend( $length, $string = " ", $left = FALSE, $right = TRUE )
	{
		if( !is_int( $length ) )
			throw new InvalidArgumentException( 'Length must be integer' );
		if( $length < $this->getLength() )
			throw new InvalidArgumentException( 'Length cannot be lower than string length' );
		if( !is_string( $string ) && !( $string instanceof ADT_String ) )
			throw new InvalidArgumentException( 'Padding string must be of string' );
		if( !$string )
			throw new InvalidArgumentException( 'Padding string cannot be empty' );

		$oldLength	= $this->getLength();
		$mode		= STR_PAD_RIGHT;
		if( $right && $left )
			$mode	= STR_PAD_BOTH;
		else if( $left )
			$mode	= STR_PAD_LEFT;
		else if( !$right )
			throw new InvalidArgumentException( 'No mode given, set left and/or right to TRUE' );
		$this->string	= str_pad( $this->string, $length, (string) $string, $mode );
		return $this->getLength() - $oldLength;
	}
public function extend ( $ length , $ string = " " , $ left = FALSE , $ right = TRUE ) { if ( ! is_int ( $ length ) ) throw new InvalidArgumentException ( 'Length must be integer' ) ; if ( $ length < $ this -> getLength ( ) ) throw new InvalidArgumentException ( 'Length cannot be lower than string length' ) ; if ( ! is_string ( $ string ) && ! ( $ string instanceof ADT_String ) ) throw new InvalidArgumentException ( 'Padding string must be of string' ) ; if ( ! $ string ) throw new InvalidArgumentException ( 'Padding string cannot be empty' ) ; $ oldLength = $ this -> getLength ( ) ; $ mode = STR_PAD_RIGHT ; if ( $ right && $ left ) $ mode = STR_PAD_BOTH ; else if ( $ left ) $ mode = STR_PAD_LEFT ; else if ( ! $ right ) throw new InvalidArgumentException ( 'No mode given, set left and/or right to TRUE' ) ; $ this -> string = str_pad ( $ this -> string , $ length , ( string ) $ string , $ mode ) ; return $ this -> getLength ( ) - $ oldLength ; }
Extends this string with another and returns number of added characters.
If left and right is set,
@access		public
@param		int			$length			Length of resulting string
@param		string		$string			String to extend with
@param		bool		$left			Extend left side
@param		bool		$right			Extend right side
Extends this string with another and returns number of added characters . If left and right is set