add `toString()`, `__toString()` and `toArray()` methods