- Added documentation, fixed some bugs and optimized some parts of the source code while doing the doc.

This commit is contained in:
mcndave committed 2022-12-22 14:34:37 +00:00
1 parent 9190987b53
commit 3986437800
33 files changed
+431 -16

No files matched your search

+1 -1
View File
@@ -242,7 +242,7 @@ class UiElement implements \ArrayAccess, \Iterator, \JsonSerializable {
public function text(?string $set = null) {
if ($set !== null) {
$this->content = htmlspecialchars( $set, ENT_NOQUOTES );
$this->content = htmlspecialchars( $set, \ENT_NOQUOTES );
return $this;
}
+2 -2
View File
@@ -22,9 +22,9 @@ class UiPopup extends UiElement implements Extension {
return "<?php echo 'ui-popup=\"' . ( new \\" . static::class . "() )->buildAttributes($arguments) . '\"' ?>";
}
public function buildAttributes(string $name, array $variables = [], $options = []) : string
public function buildAttributes(string $name, array $variables = [], array $options = []) : string
{
return htmlentities(json_encode([ "name" => $name, "vars" => $variables, "options" => $options ], JSON_HEX_APOS | JSON_HEX_QUOT), ENT_QUOTES, 'UTF-8');
return htmlentities(json_encode([ "name" => $name, "vars" => $variables, "options" => $options ], JSON_HEX_APOS | JSON_HEX_QUOT), \ENT_QUOTES, 'UTF-8');
}
}
-1
View File
@@ -27,7 +27,6 @@ class UiTextarea extends UiInput {
return "<?php echo ( new \\" . static::class . "() )->echoRaw($raw)->buildHtml($arguments) ?>";
}
protected function setValue($value) : void
{
$this->echoRaw ? $this->html($value) : $this->text($value);
+6 -4
View File
@@ -7,9 +7,10 @@ use Picea\Extension\Extension,
use Picea\Compiler\Context;
use Picea\Extension\FunctionExtension;
use Psr\Http\Message\ServerRequestInterface;
class Form implements Extension {
class Form implements Extension, FunctionExtension {
use ExtensionTrait;
public array $tokens;
@@ -22,14 +23,15 @@ class Form implements Extension {
public function __construct(ServerRequestInterface $request, Context $context) {
$this->request = $request;
$this->register($context);
}
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) : string { }
public function register(Context $context) : void
public function exportFunctions(): array
{
$context->pushFunction("form", [ $this, 'formClass' ]);
return [
"form" => [ $this, 'formClass' ],
];
}
public function formClass(FormInterface $form, ? FormContext $formContext = null) : FormHandler
+2 -2
View File
@@ -13,7 +13,7 @@ class FormContext implements FormContextInterface
public bool $formExecuted = false;
public /*mixed*/ $formExecutionStatus = null;
public mixed $formExecutionStatus = null;
public array $values = [];
@@ -86,7 +86,7 @@ class FormContext implements FormContextInterface
return $this->formSent = $valid;
}
public function __set($key, $value)
{
return $this->set($key, $value);
+1 -1
View File
@@ -8,5 +8,5 @@ interface FormInterface
public function validate(FormContextInterface $context) : bool;
public function execute(FormContextInterface $context) /* : mixed */;
public function execute(FormContextInterface $context);
}
+7 -4
View File
@@ -7,9 +7,10 @@ use Picea\Extension\Extension,
use Picea\Compiler\Context;
use Picea\Extension\FunctionExtension;
use Psr\Http\Message\ServerRequestInterface;
class Pagination implements Extension {
class Pagination implements Extension, FunctionExtension {
use ExtensionTrait;
public array $tokens;
@@ -20,14 +21,16 @@ class Pagination implements Extension {
public function __construct(ServerRequestInterface $request, Context $context) {
$this->request = $request;
$this->register($context);
}
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) : string { }
public function register(Context $context) : void
public function exportFunctions(): array
{
$context->pushFunction("pagination", [ $this, 'paginationClass' ]);
return [
"pagination" => [ $this, 'paginationClass' ]
];
}
public function paginationClass(string $name, ?string $url = null, ?array $params = null) : PaginationHandler
+1 -1
View File
@@ -41,7 +41,7 @@ class PaginationHandler {
}
public function __toString() {
return "hello world";
return "";
}
}