PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.23
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.23
1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 All 168 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / Attachment / FileAttachment.php

FileAttachment.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.23, at vendor_prefixed/sentry/sentry/src/Attachment/FileAttachment.php

41 lines 889 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace WCPOS\Vendor\Sentry\Attachment;
5
6 /**
7 * Represents a file that is readable by using a path.
8 */
9 class FileAttachment extends Attachment
10 {
11 /**
12 * @var string
13 */
14 private $path;
15 public function __construct(string $path, string $contentType)
16 {
17 parent::__construct(\basename($path), $contentType);
18 $this->path = $path;
19 }
20 public function getSize() : ?int
21 {
22 $size = @\filesize($this->path);
23 if ($size !== \false) {
24 return $size;
25 }
26 return null;
27 }
28 public function getData() : ?string
29 {
30 try {
31 $content = @\file_get_contents($this->path);
32 if ($content !== \false) {
33 return $content;
34 }
35 return null;
36 } catch (\ValueError $e) {
37 return null;
38 }
39 }
40 }
41