• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

plank / laravel-mediable / 4211702717

pending completion
4211702717

push

github

GitHub
Bump actions/checkout from 2 to 3

1193 of 1260 relevant lines covered (94.68%)

117.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/SourceAdapters/StreamResourceAdapter.php
1
<?php
2
declare(strict_types=1);
3

4
namespace Plank\Mediable\SourceAdapters;
5

6
use Plank\Mediable\Exceptions\MediaUpload\ConfigurationException;
7
use Plank\Mediable\Stream;
8

9
/**
10
 * Stream resource Adapter.
11
 *
12
 * Adapts a stream resource.
13
 */
14
class StreamResourceAdapter extends StreamAdapter
15
{
16
    /**
17
     * The resource.
18
     * @var resource|null
19
     */
20
    protected $resource;
21

22
    /**
23
     * Constructor.
24
     * @param resource $source
25
     * @throws ConfigurationException
26
     */
27
    public function __construct($source)
28
    {
29
        if (!is_resource($source) || get_resource_type($source) !== 'stream') {
174✔
30
            throw ConfigurationException::unrecognizedSource($source);
×
31
        }
32

33
        parent::__construct(new Stream($source));
174✔
34

35
        $this->resource = $source;
174✔
36
    }
87✔
37

38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getSource()
42
    {
43
        return $this->resource;
18✔
44
    }
45

46
    /**
47
     * @inheritdoc
48
     */
49
    public function getStreamResource()
50
    {
51
        return $this->resource;
30✔
52
    }
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc