# woocommerce-pos/1.10.23/vendor_prefixed/sentry/sentry/src/Attachment/FileAttachment.php

WCPOS – Point of Sale (POS) plugin for WooCommerce, version 1.10.23. 41 lines.

- Page: https://pluginprobe.com/plugins/woocommerce-pos/1.10.23/code/vendor_prefixed/sentry/sentry/src/Attachment/FileAttachment.php
- Raw: https://pluginprobe.com/plugins/woocommerce-pos/1.10.23/raw/vendor_prefixed/sentry/sentry/src/Attachment/FileAttachment.php
- Modified: 2026-10-06T17:12:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woocommerce-pos/1.10.23/code/vendor_prefixed/sentry/sentry/src/Attachment/FileAttachment.php#L10-L20`.

```php
<?php

declare (strict_types=1);
namespace WCPOS\Vendor\Sentry\Attachment;

/**
 * Represents a file that is readable by using a path.
 */
class FileAttachment extends Attachment
{
    /**
     * @var string
     */
    private $path;
    public function __construct(string $path, string $contentType)
    {
        parent::__construct(\basename($path), $contentType);
        $this->path = $path;
    }
    public function getSize() : ?int
    {
        $size = @\filesize($this->path);
        if ($size !== \false) {
            return $size;
        }
        return null;
    }
    public function getData() : ?string
    {
        try {
            $content = @\file_get_contents($this->path);
            if ($content !== \false) {
                return $content;
            }
            return null;
        } catch (\ValueError $e) {
            return null;
        }
    }
}

```
