Get the readable version of the writer(s)

@param array $writer

@return string|array
426673
protected function getReadable(array $writer)
    {
        $classes = array_map('get_class', $writer);

        if (count($classes) == 1) {
            return reset($classes);
        }

        return $classes;
    }
917539
public static function buildAndGetDocument($content) :array {
		// convert the array to a basic CSV string
		$content = is_array($content) ? self::convertArrayToString($content) : $content;
		// convert the content to the proper charset (if needs be)
		$content = mb_convert_encoding($content, self::destination_charset);
		// prefix it with the BOM characters
		$content = self::getBomCharacters() . $content;
		// return the formatted document
		return [
			$content,
			self::destination_charset
		];
	}
1018426
protected function getReadConfig(array $config)
    {
        $readConfig = $this->getReadWriteConfig($config, 'read');

        return $this->mergeReadWriteConfig($config, $readConfig);
    }
268535
function xmlSerialize(Writer $writer) {
        $this->validate();

        $writer->write([
                [
                    'name' => Schema::CBC . 'TaxableAmount',
                    'value' => number_format($this->taxableAmount, 2, '.', ''),
                    'attributes' => [
                        'currencyID' => Generator::$currencyID
                    ]

                ],
                [
                    'name' => Schema::CBC . 'TaxAmount',
                    'value' => number_format($this->taxAmount, 2, '.', ''),
                    'attributes' => [
                        'currencyID' => Generator::$currencyID
                    ]

                ],
                Schema::CAC.'TaxCategory' => $this->taxCategory
            ]
        );
    }
1037851
function xmlSerialize(Writer $writer) {
        $writer->write([
           Schema::CBC.'Description' => $this->description,
           Schema::CBC.'Name' => $this->name,
           Schema::CAC.'SellersItemIdentification' => [
               Schema::CBC.'ID' => $this->sellersItemIdentification
           ],
        ]);
    }
1273434
function xmlSerialize(Writer $writer) {
        $writer->write([
            Schema::CBC . 'ID' => $this->id,
            [
                'name' => Schema::CBC . 'InvoicedQuantity',
                'value' => $this->invoicedQuantity,
                'attributes' => [
                    'unitCode' => $this->unitCode
                ]
            ],
            [
                'name' => Schema::CBC . 'LineExtensionAmount',
                'value' => number_format($this->lineExtensionAmount, 2, '.', ''),
                'attributes' => [
                    'currencyID' => Generator::$currencyID
                ]
            ],
            Schema::CAC . 'TaxTotal' => $this->taxTotal,
            Schema::CAC . 'Item' => $this->item,
        ]);

        if ($this->price !== null) {
            $writer->write(
                [
                    Schema::CAC . 'Price' => $this->price
                ]
            );
        }
    }
638334
public function xmlSerializeFull(Writer $writer)
    {
        $cs = '{'.CalDAV\Plugin::NS_CALENDARSERVER.'}';

        $this->dtStamp->setTimezone(new \DateTimeZone('GMT'));
        $writer->writeElement($cs.'dtstamp', $this->dtStamp->format('Ymd\\THis\\Z'));

        $writer->startElement($cs.'invite-reply');

        $writer->writeElement($cs.'uid', $this->id);
        $writer->writeElement($cs.'in-reply-to', $this->inReplyTo);
        $writer->writeElement('{DAV:}href', $this->href);

        switch ($this->type) {
            case DAV\Sharing\Plugin::INVITE_ACCEPTED:
                $writer->writeElement($cs.'invite-accepted');
                break;
            case DAV\Sharing\Plugin::INVITE_DECLINED:
                $writer->writeElement($cs.'invite-declined');
                break;
        }

        $writer->writeElement($cs.'hosturl', [
            '{DAV:}href' => $writer->contextUri.$this->hostUrl,
            ]);

        if ($this->summary) {
            $writer->writeElement($cs.'summary', $this->summary);
        }
        $writer->endElement(); // invite-reply
    }
1043408
public function format(array $response)
    {
        $car = '<br />';
        $format = '';
        foreach ($response as $page) {
            $format .= '<div class="page"><span class="title">'
            . ApiTools::safeString($page->getTitle()) . '</span>'
            .$car . 'pageid: <span class="pageid">' . $page->getPageid() . '</span>'
            .$car . 'displaytitle: ' . ApiTools::safeString($page->getDisplaytitle())
            .$car . 'page_image_free: ' . $page->getPageImageFree()
            .$car . 'wikibase_item: ' . $page->getWikibaseItem()
            .$car . 'disambiguation: ' . $page->getDisambiguation()
            .$car . 'defaultsort: ' . $page->getDefaultsort()
            .'</div>';
        }
        return $format;
    }
622658
public static function updateVersion($file = '')
    {
        $composer = file_get_contents($file);
        $composer = json_decode($composer, true);
        $version = $composer['version'];
        $version = explode('.', $version);
        $version[2] = intval($version[2]) + 1;
        $version = implode('.', $version);
        $composer['version'] = $version;
        $composer = json_encode($composer, JSON_PRETTY_PRINT);
        $composer = str_replace('\\/', '/', $composer);
        file_put_contents($file, $composer);
        return $version;
    }
1201178
public function getFormatImagineSaveOptions($format)
    {
        $format = $this->normalizeFormat($format);
        $result = [
            'format' => $format,
        ];
        switch ($format) {
            case static::FORMAT_PNG:
                $result['png_compression_level'] = $this->getDefaultPngCompressionLevel();
                break;
            case static::FORMAT_JPEG:
                $result['jpeg_quality'] = $this->getDefaultJpegQuality();
                break;
        }

        return $result;
    }
540434
private function convertAuthor($author)
    {
        list($name, $email) = \explode(' <', $author);
        return [
            'name'     => \trim($name),
            'email'    => \trim(\substr($email, 0, -1)),
        ];
    }
560484
public function serialise($input)
    {
        $writer = Writer::createFromString('');

        if (is_array(reset($input))) {
            $writer->insertOne(array_keys(reset($input)));
        } else {
            $writer->insertOne(array_keys($input));
        }

        if (is_array(reset($input))) {
            $writer->insertAll($input);
        } else {
            $writer->insertOne($input);
        }

        return $writer->__toString();
    }
1139265
public function xmlSerializeFull(Writer $writer)
    {
        $cs = '{'.CalDAV\Plugin::NS_CALENDARSERVER.'}';

        $this->dtStamp->setTimezone(new \DateTimeZone('GMT'));
        $writer->writeElement($cs.'dtstamp', $this->dtStamp->format('Ymd\\THis\\Z'));

        $writer->startElement($cs.'invite-notification');

        $writer->writeElement($cs.'uid', $this->id);
        $writer->writeElement('{DAV:}href', $this->href);

        switch ($this->type) {
            case DAV\Sharing\Plugin::INVITE_ACCEPTED:
                $writer->writeElement($cs.'invite-accepted');
                break;
            case DAV\Sharing\Plugin::INVITE_NORESPONSE:
                $writer->writeElement($cs.'invite-noresponse');
                break;
        }

        $writer->writeElement($cs.'hosturl', [
            '{DAV:}href' => $writer->contextUri.$this->hostUrl,
            ]);

        if ($this->summary) {
            $writer->writeElement($cs.'summary', $this->summary);
        }

        $writer->startElement($cs.'access');
        if ($this->readOnly) {
            $writer->writeElement($cs.'read');
        } else {
            $writer->writeElement($cs.'read-write');
        }
        $writer->endElement(); // access

        $writer->startElement($cs.'organizer');
        // If the organizer contains a 'mailto:' part, it means it should be
        // treated as absolute.
        if ('mailto:' === strtolower(substr($this->organizer, 0, 7))) {
            $writer->writeElement('{DAV:}href', $this->organizer);
        } else {
            $writer->writeElement('{DAV:}href', $writer->contextUri.$this->organizer);
        }
        if ($this->commonName) {
            $writer->writeElement($cs.'common-name', $this->commonName);
        }
        if ($this->firstName) {
            $writer->writeElement($cs.'first-name', $this->firstName);
        }
        if ($this->lastName) {
            $writer->writeElement($cs.'last-name', $this->lastName);
        }
        $writer->endElement(); // organizer

        if ($this->commonName) {
            $writer->writeElement($cs.'organizer-cn', $this->commonName);
        }
        if ($this->firstName) {
            $writer->writeElement($cs.'organizer-first', $this->firstName);
        }
        if ($this->lastName) {
            $writer->writeElement($cs.'organizer-last', $this->lastName);
        }
        if ($this->supportedComponents) {
            $writer->writeElement('{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set', $this->supportedComponents);
        }

        $writer->endElement(); // invite-notification
    }
377366
public static function getExtBySignature($stream)
    {
        $prefix = strval(bin2hex(mb_strcut($stream, 0, 10)));

        foreach (self::$signatures as $signature => $extension) {
            if (0 === strpos($prefix, strval($signature))) {
                return $extension;
            }
        }

        return '';
    }
963734
private function beautifyAuthorList($authors)
    {
        if ($authors === null) {
            return null;
        }

        $authors = \array_intersect_key($authors, \array_unique(\array_map('strtolower', $authors)));
        \usort($authors, 'strcasecmp');

        $mapped = [];
        foreach ($authors as $author) {
            $mapped[\strtolower($author)] = $author;
        }

        return $mapped;
    }
611328
private function makeWriters(array $config): array
    {
        $writers = [];

        foreach ($config as $name => $binding) {
            $writers[$name] = $binding->resolve($this->factory);
        }

        return $writers;
    }
473166
public function format(array $output): iterable
    {
        $formatted = [];
        $pattern = sprintf('#^(?:%s)\t(.+)$#i', implode('|', $this->status));
        foreach ($output as $row) {
            $matches = [];
            if (preg_match($pattern, $row, $matches)) {
                $formatted[] = $matches[1];
            }
        }
        return $formatted;
    }