- WIP on RAW token

- WIP on caching interface
- Work done on easing template rendering for the controller
This commit is contained in:
mcndave committed 2019-10-04 08:38:11 -04:00
1 parent f8e3dbd60f
commit bcd49884fc
37 files changed
+381 -107

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
<?php
namespace Picea\Extension;
trait ExtensionTrait {
protected function parseOptions(?string $options) : array
{
if ( $options ?? false ) {
$attributes = eval("return $options;");
if ( ! is_array($attributes) ) {
throw new InvalidArgumentException("Given options `$options` is not a valid attributes array.");
}
return $attributes;
}
return [];
}
protected function trim(string $value) : string
{
$value = trim($value, " \t");
if ( in_array(substr($value, 0, 1), [ "'", '"' ]) ) {
if ( ! in_array(substr($value, strlen($value) - 1), [ "'", '"' ]) ) {
throw new \InvalidArgumentException("Given argument `$value` string is not closed");
}
return substr($value, 1, -1);
}
return $value;
}
}