public function encrypt($value, string $key, bool $base64 = false): string
    {
        $ret = $this->encryptBinary(serialize($value), $key);
        return ($base64) ? base64_encode($ret) : $ret;
    }
public function encrypt($value, string $key, bool $base64 = false): string
    {
        $ret = $this->encryptBinary(serialize($value), $key);
        return ($base64) ? base64_encode($ret) : $ret;
    }
public function encrypt ( $ value , string $ key , bool $ base64 = false ) : string { $ ret = $ this -> encryptBinary ( serialize ( $ value ) , $ key ) ; return ( $ base64 ) ? base64_encode ( $ ret ) : $ ret ; }
Serialize and encrypt a value

@param mixed $value
@param string $key
@param boolean $base64 Whether to base64 encode the result
@return string|null
Serialize and encrypt a value