Compare commits

...

9 Commits

Author SHA1 Message Date
450e769442 Add first name to Copyright 2025-10-25 15:05:10 -04:00
3dc5e104f1 Implement StringableInterface 2025-10-25 14:59:18 -04:00
8f43a0e823 Add render() Method 2025-10-25 14:57:11 -04:00
057c7f1187 Create RenderableTrait 2025-10-25 14:50:32 -04:00
3946cee2a0 Create Renderable 2025-10-25 14:49:50 -04:00
919f529394 Create AbstractRenderable 2025-10-25 14:49:41 -04:00
7b64a4af8f Create RenderableInterface 2025-10-25 14:49:28 -04:00
da36060d32 composer init 2025-10-25 13:31:50 -04:00
jay
995a0f9c9f Add composer.lock and /nbproject/ 2025-10-25 13:30:07 -04:00
7 changed files with 72 additions and 8 deletions

8
.gitignore vendored
View File

@@ -1,8 +1,4 @@
# ---> Composer composer.lock
composer.phar composer.phar
/nbproject/
/vendor/ /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

View File

@@ -1,6 +1,6 @@
MIT License 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 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 associated documentation files (the "Software"), to deal in the Software without restriction, including

21
composer.json Normal file
View 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"
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Renderable;
abstract class AbstractRenderable implements RenderableInterface
{
abstract public function render(): string;
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Renderable;
abstract class Renderable extends AbstractRenderable
{
use RenderableTrait;
}

View 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;
}

View 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;
}