Compare commits
9 Commits
fd8c865c85
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 450e769442 | |||
| 3dc5e104f1 | |||
| 8f43a0e823 | |||
| 057c7f1187 | |||
| 3946cee2a0 | |||
| 919f529394 | |||
| 7b64a4af8f | |||
| da36060d32 | |||
|
|
995a0f9c9f |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,8 +1,4 @@
|
||||
# ---> Composer
|
||||
composer.lock
|
||||
composer.phar
|
||||
/nbproject/
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
# composer.lock
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Potter
|
||||
Copyright (c) 2025 Jay Potter
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
|
||||
21
composer.json
Normal file
21
composer.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "potter/renderable",
|
||||
"type": "library",
|
||||
"require": {
|
||||
"php": "^8.4",
|
||||
"potter/stringable": "dev-main"
|
||||
},
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Potter\\Renderable\\": "src/Potter/Renderable/"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jay Potter",
|
||||
"email": "j@ypotter.ca"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
10
src/Potter/Renderable/AbstractRenderable.php
Normal file
10
src/Potter/Renderable/AbstractRenderable.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Renderable;
|
||||
|
||||
abstract class AbstractRenderable implements RenderableInterface
|
||||
{
|
||||
abstract public function render(): string;
|
||||
}
|
||||
10
src/Potter/Renderable/Renderable.php
Normal file
10
src/Potter/Renderable/Renderable.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Renderable;
|
||||
|
||||
abstract class Renderable extends AbstractRenderable
|
||||
{
|
||||
use RenderableTrait;
|
||||
}
|
||||
12
src/Potter/Renderable/RenderableInterface.php
Normal file
12
src/Potter/Renderable/RenderableInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Renderable;
|
||||
|
||||
use \Potter\Stringable\StringableInterface;
|
||||
|
||||
interface RenderableInterface extends StringableInterface
|
||||
{
|
||||
public function render(): string;
|
||||
}
|
||||
15
src/Potter/Renderable/RenderableTrait.php
Normal file
15
src/Potter/Renderable/RenderableTrait.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Renderable;
|
||||
|
||||
trait RenderableTrait
|
||||
{
|
||||
final public function __toString(): string
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
|
||||
abstract public function render(): string;
|
||||
}
|
||||
Reference in New Issue
Block a user