Compare commits

...

10 Commits

Author SHA1 Message Date
9719965abb Create TemplateEngineAwareTrait 2025-10-25 15:36:45 -04:00
4ce08f2ae4 Create TemplateEngineAwareInterface 2025-10-25 15:36:26 -04:00
f6b21d80d4 Require potter/aware 2025-10-25 15:31:36 -04:00
2d1416ddf9 Implement league/plates Engine 2025-10-25 15:24:24 -04:00
1bc25e2b70 Create TemplateEngine 2025-10-25 15:22:29 -04:00
6d7bab5bfe Create AbstractTemplateEngine 2025-10-25 15:22:19 -04:00
a156637df8 Create TemplateEngineInterface 2025-10-25 15:22:10 -04:00
dd20215d6a composer init 2025-10-25 15:19:39 -04:00
8900d0bae6 Add first name to Copyright 2025-10-25 15:18:27 -04:00
a262b71333 Add composer.lock and /nbproject/ 2025-10-25 15:18:12 -04:00
8 changed files with 129 additions and 8 deletions

10
.gitignore vendored
View File

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

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

22
composer.json Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "potter/template",
"type": "library",
"require": {
"php": "^8.4",
"league/plates": "v3.x-dev",
"potter/aware": "dev-main"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Potter\\Template\\": "src/Potter/Template/"
}
},
"authors": [
{
"name": "Jay Potter",
"email": "j@ypotter.ca"
}
],
"minimum-stability": "dev"
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace Potter\Template\Engine;
use \League\Plates\Engine;
abstract class AbstractTemplateEngine extends Engine implements TemplateEngineInterface
{
}

View File

@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace Potter\Template\Engine\Aware;
use \Potter\Aware\AwareInterface;
use \Potter\Template\Engine\TemplateEngineInterface;
interface TemplateEngineAwareInterface extends AwareInterface
{
public function getTemplateEngine(): TemplateEngineInterface;
public function hasTemplateEngine(): bool;
public function withTemplateEngine(): self;
public function withoutTemplateEngine(): self;
}

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace Potter\Template\Engine\Aware;
use \Potter\Aware\AwareInterface;
use \Potter\Template\Engine\TemplateEngineInterface;
trait TemplateEngineAwareTrait
{
private const string TEMPLATE_ENGINE = 'templateEngine';
abstract public function get(string $key): mixed;
final public function getTemplateEngine(): TemplateEngineInterface
{
return $this->get(self::TEMPLATE_ENGINE);
}
abstract public function has(string $key): bool;
final public function hasTemplateEngine(): bool
{
return $this->has(self::TEMPLATE_ENGINE);
}
abstract protected function set(string $key, mixed $value): mixed;
final public function setTemplateEngine(TemplateEngineInterface $templateEngine): TemplateEngineInterface
{
return $this->set(self::TEMPLATE_ENGINE, $templateEngine);
}
abstract protected function unset(string $key): void;
final public function unsetTemplateEngine(): void
{
$this->unset(self::TEMPLATE_ENGINE);
}
abstract public function with(string $key, mixed $value): AwareInterface;
final public function withTemplateEngine(TemplateEngineInterface $templateEngine): TemplateEngineAwareInterface
{
return $this->with(self::TEMPLATE_ENGINE, $templateEngine);
}
abstract public function without(string $key): AwareInterface;
final public function withoutTemplateEngine(): TemplateEngineAwareInterface
{
return $this->without(self::TEMPLATE_ENGINE);
}
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Template\Engine;
final class TemplateEngine extends AbstractTemplateEngine
{
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Template\Engine;
interface TemplateEngineInterface
{
}