This commit is contained in:
2026-06-12 15:34:52 -04:00
parent 292cf0cd05
commit 9f58653b49
6 changed files with 3 additions and 84 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
# Resource
Potter Framework Resource Implementation
Potter Framework Resource Interface
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "potter/resource",
"description": "Potter Framework Resource Implementation",
"description": "Potter Framework Resource Interface",
"type": "library",
"require": {
"php": "^8.5",
-17
View File
@@ -1,17 +0,0 @@
<?php
declare(strict_types=1);
namespace Potter\Resource;
use \Potter\Aware\Aware;
abstract class AbstractResource extends Aware
{
abstract public function getResource();
abstract public function hasResource(): bool;
abstract protected function setResource($resource);
abstract protected function unsetResource(): void;
abstract public function withResource($resource): static;
abstract public function withoutResource(): static;
}
-10
View File
@@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
namespace Potter\Resource;
abstract class Resource extends AbstractResource
{
use ResourceTrait;
}
+1 -8
View File
@@ -4,12 +4,5 @@ declare(strict_types=1);
namespace Potter\Resource;
use \Potter\Aware\AwareInterface;
interface ResourceInterface extends AwareInterface
{
public function getResource();
public function hasResource(): bool;
public function withResource($resource): static;
public function withoutResource(): static;
}
{ }
-47
View File
@@ -1,47 +0,0 @@
<?php
declare(strict_types=1);
namespace Potter\Resource;
trait ResourceTrait
{
private const string RESOURCE = 'resource';
final public function getResource()
{
return $this->get(self::RESOURCE);
}
final public function hasResource(): bool
{
return $this->has(self::RESOURCE);
}
final protected function setResource($resource)
{
return $this->set(self::RESOURCE, $resource);
}
final protected function unsetResource(): void
{
$this->unset(self::RESOURCE);
}
final public function withResource($resource): static
{
return $this->with(self::RESOURCE, $resource);
}
final public function withoutResource(): static
{
return $this->without(self::RESOURCE);
}
abstract public function get(string $key): mixed;
abstract public function has(string $key): bool;
abstract protected function set(string $key, mixed $value): mixed;
abstract protected function unset(string $key): void;
abstract public function with(string $key, mixed $value): static;
abstract public function without(string $key): static;
}