public function encryptObject(object $object, string $key = null): string
    {
        return $this->encrypt(\json_encode($object), $key);
    }
public function encryptObject(object $object, string $key = null): string
    {
        return $this->encrypt(\json_encode($object), $key);
    }
public function encryptObject ( object $ object , string $ key = null ) : string { return $ this -> encrypt ( \ json_encode ( $ object ) , $ key ) ; }
Encrypt a json array.

@param object $object The object to encrypt
@param string $key    The encryption key

@throws Exception Random Bytes Failure

@return string
Encrypt a json array .