<?php namespace nur\ldap\io; use nur\b\io\IWriter; use nur\ldap\LdapObject; use nur\writer; abstract class LdapWriter { static function write_object($output, LdapObject $object, ?array $names=null): void { $writer = new static($output); $writer->write($object, $names); $writer->close(); } function __construct($output=null) { $this->writer = writer::with($output); } /** @var IWriter */ protected $writer; function close(): void { $this->writer->close(); } }