public function padStringFilter($value, $padCharacter, $maxLength, $padType = 'STR_PAD_RIGHT')
    {
        if ($this->isNullOrEmptyString($padCharacter)) {
            throw new \InvalidArgumentException('Pad String Filter cannot accept a null value or empty string as its first argument');
        }
        if ( ! is_int($maxLength)) {
            throw new \InvalidArgumentException('Pad String Filter expects its second argument to be an integer');
        }
        $diff = (function_exists('mb_strlen'))? strlen($value) - mb_strlen($value) : 0;
        $padType = constant($padType);

        return str_pad($value, $maxLength + $diff, $padCharacter, $padType);
    }
public function padStringFilter($value, $padCharacter, $maxLength, $padType = 'STR_PAD_RIGHT')
    {
        if ($this->isNullOrEmptyString($padCharacter)) {
            throw new \InvalidArgumentException('Pad String Filter cannot accept a null value or empty string as its first argument');
        }
        if ( ! is_int($maxLength)) {
            throw new \InvalidArgumentException('Pad String Filter expects its second argument to be an integer');
        }
        $diff = (function_exists('mb_strlen'))? strlen($value) - mb_strlen($value) : 0;
        $padType = constant($padType);

        return str_pad($value, $maxLength + $diff, $padCharacter, $padType);
    }
public function padStringFilter ( $ value , $ padCharacter , $ maxLength , $ padType = 'STR_PAD_RIGHT' ) { if ( $ this -> isNullOrEmptyString ( $ padCharacter ) ) { throw new \ InvalidArgumentException ( 'Pad String Filter cannot accept a null value or empty string as its first argument' ) ; } if ( ! is_int ( $ maxLength ) ) { throw new \ InvalidArgumentException ( 'Pad String Filter expects its second argument to be an integer' ) ; } $ diff = ( function_exists ( 'mb_strlen' ) ) ? strlen ( $ value ) - mb_strlen ( $ value ) : 0 ; $ padType = constant ( $ padType ) ; return str_pad ( $ value , $ maxLength + $ diff , $ padCharacter , $ padType ) ; }
Pads string on right or left with given padCharacter until string
reaches maxLength

@param string  $value
@param string  $padCharacter
@param int     $maxLength
@param string  $padType

@return string
@throws \InvalidArgumentException
Pads string on right or left with given padCharacter until string reaches maxLength