Skip to content

Allow to attach all files from directories as attachments #18

@discordier

Description

@discordier

When generating complex assets, like HTML reports, it is tedious to attach them one-by-one.

For example, the coverage report of phpunit spans lots of sub-directories and all sorts of files, like CSS, SVG, JS.

I therefore suggest to add something along the lines of:

<?php

declare(strict_types=1);

namespace Phpcq\PluginApi\Version11\Report;

use Phpcq\PluginApi\Version10\Exception\RuntimeException;
use Phpcq\PluginApi\Version10\Report\AttachmentBuilderInterface as AttachmentBuilderInterface10;

interface AttachmentBuilderInterface extends AttachmentBuilderInterface10
{
    /**
     * Load the contents from a reachable directory.
     *
     * @param string $directory The absolute path to the directory.
     *
     * @return $this
     *
     * @throws RuntimeException When the path is not absolute.
     */
    public function fromDirectory(string $directory): self;
}

I am unsure how to determine the mimetypes, though.

An alternative approach would be to collect the directory contents as zip file, they won't be browsable then though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions