PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.12.4
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.12.4
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / vendor / league / flysystem / src / DirectoryAttributes.php

DirectoryAttributes.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.12.4, at vendor/league/flysystem/src/DirectoryAttributes.php

88 lines 2.0 KB
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
5 namespace League\Flysystem;
6
7 class DirectoryAttributes implements StorageAttributes
8 {
9 use ProxyArrayAccessToProperties;
10 private string $type = StorageAttributes::TYPE_DIRECTORY;
11
12 public function __construct(
13 private string $path,
14 private ?string $visibility = null,
15 private ?int $lastModified = null,
16 private array $extraMetadata = []
17 ) {
18 $this->path = trim($this->path, '/');
19 }
20
21 public function path(): string
22 {
23 return $this->path;
24 }
25
26 public function type(): string
27 {
28 return $this->type;
29 }
30
31 public function visibility(): ?string
32 {
33 return $this->visibility;
34 }
35
36 public function lastModified(): ?int
37 {
38 return $this->lastModified;
39 }
40
41 public function extraMetadata(): array
42 {
43 return $this->extraMetadata;
44 }
45
46 public function isFile(): bool
47 {
48 return false;
49 }
50
51 public function isDir(): bool
52 {
53 return true;
54 }
55
56 public function withPath(string $path): self
57 {
58 $clone = clone $this;
59 $clone->path = $path;
60
61 return $clone;
62 }
63
64 public static function fromArray(array $attributes): self
65 {
66 return new DirectoryAttributes(
67 $attributes[StorageAttributes::ATTRIBUTE_PATH],
68 $attributes[StorageAttributes::ATTRIBUTE_VISIBILITY] ?? null,
69 $attributes[StorageAttributes::ATTRIBUTE_LAST_MODIFIED] ?? null,
70 $attributes[StorageAttributes::ATTRIBUTE_EXTRA_METADATA] ?? []
71 );
72 }
73
74 /**
75 * @inheritDoc
76 */
77 public function jsonSerialize(): array
78 {
79 return [
80 StorageAttributes::ATTRIBUTE_TYPE => $this->type,
81 StorageAttributes::ATTRIBUTE_PATH => $this->path,
82 StorageAttributes::ATTRIBUTE_VISIBILITY => $this->visibility,
83 StorageAttributes::ATTRIBUTE_LAST_MODIFIED => $this->lastModified,
84 StorageAttributes::ATTRIBUTE_EXTRA_METADATA => $this->extraMetadata,
85 ];
86 }
87 }
88