public function remove(string $data): string
    {
        $len = strlen($data);
        if (!$len) {
            throw new \UnexpectedValueException("No padding.");
        }
        $n = ord($data[$len - 1]);
        if ($len < $n || $n > $this->_blocksize) {
            throw new \UnexpectedValueException("Invalid padding length.");
        }
        $ps = substr($data, -$n);
        if ($ps !== str_repeat(chr($n), $n)) {
            throw new \UnexpectedValueException("Invalid padding string.");
        }
        return substr($data, 0, -$n);
    }
public function remove(string $data): string
    {
        $len = strlen($data);
        if (!$len) {
            throw new \UnexpectedValueException("No padding.");
        }
        $n = ord($data[$len - 1]);
        if ($len < $n || $n > $this->_blocksize) {
            throw new \UnexpectedValueException("Invalid padding length.");
        }
        $ps = substr($data, -$n);
        if ($ps !== str_repeat(chr($n), $n)) {
            throw new \UnexpectedValueException("Invalid padding string.");
        }
        return substr($data, 0, -$n);
    }
public function remove ( string $ data ) : string { $ len = strlen ( $ data ) ; if ( ! $ len ) { throw new \ UnexpectedValueException ( "No padding." ) ; } $ n = ord ( $ data [ $ len - 1 ] ) ; if ( $ len < $ n || $ n > $ this -> _blocksize ) { throw new \ UnexpectedValueException ( "Invalid padding length." ) ; } $ ps = substr ( $ data , - $ n ) ; if ( $ ps !== str_repeat ( chr ( $ n ) , $ n ) ) { throw new \ UnexpectedValueException ( "Invalid padding string." ) ; } return substr ( $ data , 0 , - $ n ) ; }
Remove padding.

@param string $data
@throws \UnexpectedValueException
@return string
Remove padding .