generated from Potter/Template
re-word
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
# Resource
|
||||
|
||||
Potter Framework Resource Implementation
|
||||
Potter Framework Resource Interface
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "potter/resource",
|
||||
"description": "Potter Framework Resource Implementation",
|
||||
"description": "Potter Framework Resource Interface",
|
||||
"type": "library",
|
||||
"require": {
|
||||
"php": "^8.5",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Resource;
|
||||
|
||||
abstract class Resource extends AbstractResource
|
||||
{
|
||||
use ResourceTrait;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
{ }
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user